New agents, NeDB encryption, WebApp Fixes.
Ylian Saint-Hilaire committed
Jan 24, 2019 at 12:08 UTC
bf3d73235c6912bd86507902102ed9f0aeaf542c
34 files changed
+89
-7436
agents/MeshCmd-signed.exe
Binary files a/agents/MeshCmd-signed.exe and b/agents/MeshCmd-signed.exe differ
agents/MeshCmd64-signed.exe
Binary files a/agents/MeshCmd64-signed.exe and b/agents/MeshCmd64-signed.exe differ
agents/MeshService-signed.exe
Binary files a/agents/MeshService-signed.exe and b/agents/MeshService-signed.exe differ
agents/MeshService.exe
Binary files a/agents/MeshService.exe and b/agents/MeshService.exe differ
agents/MeshService64-signed.exe
Binary files a/agents/MeshService64-signed.exe and b/agents/MeshService64-signed.exe differ
agents/MeshService64.exe
Binary files a/agents/MeshService64.exe and b/agents/MeshService64.exe differ
agents/meshagent_arm
Binary files a/agents/meshagent_arm and b/agents/meshagent_arm differ
agents/meshagent_arm-linaro
Binary files a/agents/meshagent_arm-linaro and b/agents/meshagent_arm-linaro differ
agents/meshagent_armhf
Binary files a/agents/meshagent_armhf and b/agents/meshagent_armhf differ
agents/meshagent_mips
Binary files a/agents/meshagent_mips and b/agents/meshagent_mips differ
agents/meshagent_pogo
Binary files a/agents/meshagent_pogo and b/agents/meshagent_pogo differ
agents/meshagent_poky
Binary files a/agents/meshagent_poky and b/agents/meshagent_poky differ
agents/meshagent_poky64
Binary files a/agents/meshagent_poky64 and b/agents/meshagent_poky64 differ
agents/meshagent_x86
Binary files a/agents/meshagent_x86 and b/agents/meshagent_x86 differ
agents/meshagent_x86-64
Binary files a/agents/meshagent_x86-64 and b/agents/meshagent_x86-64 differ
agents/meshagent_x86-64_nokvm
Binary files a/agents/meshagent_x86-64_nokvm and b/agents/meshagent_x86-64_nokvm differ
agents/meshagent_x86_nokvm
Binary files a/agents/meshagent_x86_nokvm and b/agents/meshagent_x86_nokvm differ
agents/modules_meshcmd/user-sessions.js
+1
-1
@@ -653,7 +653,7 @@ function UserSessions()
653
}
654
this.consoleUid = function consoleUid()
655
{
656
- var checkstr = process.platform == 'darwin' ? 'console' : process.env['DISPLAY'];
656
+ var checkstr = process.platform == 'darwin' ? 'console' : ((process.env['DISPLAY'])?process.env['DISPLAY']:':0')
657
var child = require('child_process').execFile('/bin/sh', ['sh']);
658
child.stdout.str = '';
659
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
agents/modules_meshcmd_min/user-sessions.min.js
+1
-1
@@ -1 +1 @@
1
-var NOTIFY_FOR_THIS_SESSION=0;var NOTIFY_FOR_ALL_SESSIONS=1;var WM_WTSSESSION_CHANGE=689;var WM_POWERBROADCAST=536;var PBT_POWERSETTINGCHANGE=32787;var PBT_APMSUSPEND=4;var PBT_APMRESUMESUSPEND=7;var PBT_APMRESUMEAUTOMATIC=18;var PBT_APMPOWERSTATUSCHANGE=10;var WTS_CONSOLE_CONNECT=(1);var WTS_CONSOLE_DISCONNECT=(2);var WTS_REMOTE_CONNECT=(3);var WTS_REMOTE_DISCONNECT=(4);var WTS_SESSION_LOGON=(5);var WTS_SESSION_LOGOFF=(6);var WTS_SESSION_LOCK=(7);var WTS_SESSION_UNLOCK=(8);var WTS_SESSION_REMOTE_CONTROL=(9);var WTS_SESSION_CREATE=(10);var WTS_SESSION_TERMINATE=(11);var GUID_ACDC_POWER_SOURCE;var GUID_BATTERY_PERCENTAGE_REMAINING;var GUID_CONSOLE_DISPLAY_STATE;function UserSessions(){this._ObjectID="user-sessions";require("events").EventEmitter.call(this,true).createEvent("changed").createEvent("locked").createEvent("unlocked");this.enumerateUsers=function h(){var s=require("promise");var r=new s(function(t,p){this.__resolver=t;this.__rejector=p});r.__handler=function o(p){r.__resolver(p)};try{this.Current(r.__handler)}catch(q){r.__rejector(q)}r.parent=this;return(r)};if(process.platform=="win32"){this._serviceHooked=false;this._marshal=require("_GenericMarshal");this._kernel32=this._marshal.CreateNativeProxy("Kernel32.dll");this._kernel32.CreateMethod("GetLastError");try{this._wts=this._marshal.CreateNativeProxy("Wtsapi32.dll");this._wts.CreateMethod("WTSEnumerateSessionsA");this._wts.CreateMethod("WTSQuerySessionInformationA");this._wts.CreateMethod("WTSRegisterSessionNotification");this._wts.CreateMethod("WTSUnRegisterSessionNotification");this._wts.CreateMethod("WTSFreeMemory")}catch(i){}this._user32=this._marshal.CreateNativeProxy("user32.dll");this._user32.CreateMethod({method:"RegisterPowerSettingNotification",threadDispatch:1});this._user32.CreateMethod("UnregisterPowerSettingNotification");this._rpcrt=this._marshal.CreateNativeProxy("Rpcrt4.dll");this._rpcrt.CreateMethod("UuidFromStringA");this._rpcrt.StringToUUID=function n(o){var p=n.us._marshal.CreateVariable(16);if(n.us._rpcrt.UuidFromStringA(n.us._marshal.CreateVariable(o),p).Val==0){return(p)}else{throw ("Could not convert string to UUID")}};this._rpcrt.StringToUUID.us=this;GUID_ACDC_POWER_SOURCE=this._rpcrt.StringToUUID("5d3e9a59-e9D5-4b00-a6bd-ff34ff516548");GUID_BATTERY_PERCENTAGE_REMAINING=this._rpcrt.StringToUUID("a7ad8041-b45a-4cae-87a3-eecbb468a9e1");GUID_CONSOLE_DISPLAY_STATE=this._rpcrt.StringToUUID("6fe69556-704a-47a0-8f24-c28d936fda47");this.SessionStates=["Active","Connected","ConnectQuery","Shadow","Disconnected","Idle","Listening","Reset","Down","Init"];this.InfoClass={WTSInitialProgram:0,WTSApplicationName:1,WTSWorkingDirectory:2,WTSOEMId:3,WTSSessionId:4,WTSUserName:5,WTSWinStationName:6,WTSDomainName:7,WTSConnectState:8,WTSClientBuildNumber:9,WTSClientName:10,WTSClientDirectory:11,WTSClientProductId:12,WTSClientHardwareId:13,WTSClientAddress:14,WTSClientDisplay:15,WTSClientProtocolType:16,WTSIdleTime:17,WTSLogonTime:18,WTSIncomingBytes:19,WTSOutgoingBytes:20,WTSIncomingFrames:21,WTSOutgoingFrames:22,WTSClientInfo:23,WTSSessionInfo:24,WTSSessionInfoEx:25,WTSConfigInfo:26,WTSValidationInfo:27,WTSSessionAddressV4:28,WTSIsRemoteSession:29};this.getSessionAttribute=function j(s,o){var p=this._marshal.CreatePointer();var q=this._marshal.CreateVariable(4);if(this._wts.WTSQuerySessionInformationA(0,s,o,p,q).Val==0){throw ("Error calling WTSQuerySessionInformation: "+this._kernel32.GetLastError.Val)}var r=p.Deref().String;this._wts.WTSFreeMemory(p.Deref());return(r)};this.Current=function f(o){var u={};var t=this._marshal.CreatePointer();var p=this._marshal.CreateVariable(4);if(this._wts.WTSEnumerateSessionsA(0,0,1,t,p).Val==0){throw ("Error calling WTSEnumerateSessionsA: "+this._kernel32.GetLastError().Val)}for(var q=0;q<p.toBuffer().readUInt32LE();++q){var r=t.Deref().Deref(q*(this._marshal.PointerSize==4?12:24),this._marshal.PointerSize==4?12:24);var s={SessionId:r.toBuffer().readUInt32LE()};s.StationName=r.Deref(this._marshal.PointerSize==4?4:8,this._marshal.PointerSize).Deref().String;s.State=this.SessionStates[r.Deref(this._marshal.PointerSize==4?8:16,4).toBuffer().readUInt32LE()];if(s.State=="Active"){s.Username=this.getSessionAttribute(s.SessionId,this.InfoClass.WTSUserName);s.Domain=this.getSessionAttribute(s.SessionId,this.InfoClass.WTSDomainName)}u[s.SessionId]=s}this._wts.WTSFreeMemory(t.Deref());Object.defineProperty(u,"Active",{value:showActiveOnly(u)});if(o){o(u)}return(u)};var l=require("win-message-pump");this._messagepump=new l({filter:WM_WTSSESSION_CHANGE});this._messagepump.parent=this;this._messagepump.on("exit",function(o){this.parent._wts.WTSUnRegisterSessionNotification(this.parent.hwnd)});this._messagepump.on("hwnd",function(o){this.parent.hwnd=o;this.immediate=setImmediate(function(p){if(p.parent._wts){p.parent._wts.WTSRegisterSessionNotification(p.parent.hwnd,NOTIFY_FOR_ALL_SESSIONS)}p.parent._user32.ACDC_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_ACDC_POWER_SOURCE,0);p.parent._user32.BATT_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_BATTERY_PERCENTAGE_REMAINING,0);p.parent._user32.DISP_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_CONSOLE_DISPLAY_STATE,0)},this)});this._messagepump.on("message",function(q){switch(q.message){case WM_WTSSESSION_CHANGE:switch(q.wparam){case WTS_SESSION_LOCK:this.parent.enumerateUsers().then(function(r){if(r[q.lparam]){this.parent.emit("locked",r[q.lparam])}});break;case WTS_SESSION_UNLOCK:this.parent.enumerateUsers().then(function(r){if(r[q.lparam]){this.parent.emit("unlocked",r[q.lparam])}});break;case WTS_SESSION_LOGON:case WTS_SESSION_LOGOFF:this.parent.emit("changed");break}break;case WM_POWERBROADCAST:switch(q.wparam){default:console.log("WM_POWERBROADCAST [UNKNOWN wparam]: "+q.wparam);break;case PBT_APMSUSPEND:require("power-monitor").emit("sx","SLEEP");break;case PBT_APMRESUMEAUTOMATIC:require("power-monitor").emit("sx","RESUME_NON_INTERACTIVE");break;case PBT_APMRESUMESUSPEND:require("power-monitor").emit("sx","RESUME_INTERACTIVE");break;case PBT_APMPOWERSTATUSCHANGE:require("power-monitor").emit("changed");break;case PBT_POWERSETTINGCHANGE:var p=this.parent._marshal.CreatePointer(Buffer.from(q.lparam_hex,"hex"));var o=p.Deref(20,p.Deref(16,4).toBuffer().readUInt32LE(0)).toBuffer();switch(p.Deref(0,16).toBuffer().toString("hex")){case GUID_ACDC_POWER_SOURCE.Deref(0,16).toBuffer().toString("hex"):switch(o.readUInt32LE(0)){case 0:require("power-monitor").emit("acdc","AC");break;case 1:require("power-monitor").emit("acdc","BATTERY");break;case 2:require("power-monitor").emit("acdc","HOT");break}break;case GUID_BATTERY_PERCENTAGE_REMAINING.Deref(0,16).toBuffer().toString("hex"):require("power-monitor").emit("batteryLevel",o.readUInt32LE(0));break;case GUID_CONSOLE_DISPLAY_STATE.Deref(0,16).toBuffer().toString("hex"):switch(o.readUInt32LE(0)){case 0:require("power-monitor").emit("display","OFF");break;case 1:require("power-monitor").emit("display","ON");break;case 2:require("power-monitor").emit("display","DIMMED");break}break}break}break;default:break}})}else{if(process.platform=="linux"){var g=require("linux-dbus");this._linuxWatcher=require("fs").watch("/var/run/utmp");this._linuxWatcher.user_session=this;this._linuxWatcher.on("change",function(o,p){this.user_session.emit("changed")});this._users=function d(){var o=require("child_process").execFile("/bin/sh",["sh"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("awk -F: '($3 >= 0) {printf \"%s:%s\\n\", $1, $3}' /etc/passwd\nexit\n");o.waitExit();var p=o.stdout.str.split("\n");var r={},s;for(var q in p){s=p[q].split(":");if(s[0]){r[s[0]]=s[1]}}return(r)};this._uids=function c(){var o=require("child_process").execFile("/bin/sh",["sh"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("awk -F: '($3 >= 0) {printf \"%s:%s\\n\", $1, $3}' /etc/passwd\nexit\n");o.waitExit();var p=o.stdout.str.split("\n");var r={},s;for(var q in p){s=p[q].split(":");if(s[0]){r[s[1]]=s[0]}}return(r)};this.Self=function m(){var q=require("promise");var o=new q(function(r,p){this.__resolver=r;this.__rejector=p;this.__child=require("child_process").execFile("/usr/bin/id",["id","-u"]);this.__child.promise=this;this.__child.stdout._txt="";this.__child.stdout.on("data",function(s){this._txt+=s.toString()});this.__child.on("exit",function(s){try{parseInt(this.stdout._txt)}catch(t){this.promise.__rejector("invalid uid");return}var u=parseInt(this.stdout._txt);this.promise.__resolver(u)})});return(o)};this.Current=function f(o){var p={};p._ObjectID="UserSession";Object.defineProperty(p,"_callback",{value:o});Object.defineProperty(p,"_child",{value:require("child_process").execFile("/usr/bin/last",["last","-f","/var/run/utmp"])});p._child.Parent=p;p._child._txt="";p._child.on("exit",function(q){var u=this._txt.split("\n");var A=[];var D={};for(var t in u){if(u[t]){var B=getTokens(u[t]);var z={Username:B[0],SessionId:B[1]};if(B[3].includes("still logged in")){z.State="Active"}else{z.LastActive=B[3]}A.push(z)}}A.pop();var C={};var y=[];for(var t in A){if(A[t].Username!="reboot"){D[A[t].SessionId]=A[t];if(C[A[t].Username]==null){C[A[t].Username]=-1}}}try{require("promise")}catch(r){Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(this.Parent._callback){this.Parent._callback.call(this.Parent,D)}return}var x=require("promise");for(var v in C){var w=new x(function(E,s){this.__username=v;this.__resolver=E;this.__rejector=s;this.__child=require("child_process").execFile("/usr/bin/id",["id","-u",v]);this.__child.promise=this;this.__child.stdout._txt="";this.__child.stdout.on("data",function(F){this._txt+=F.toString()});this.__child.on("exit",function(F){try{parseInt(this.stdout._txt)}catch(G){this.promise.__rejector("invalid uid");return}var H=parseInt(this.stdout._txt);this.promise.__resolver(H)})});y.push(w)}x.all(y).then(function(E){var F={};for(var s in E){F[E[s].__username]=E[s]._internal.completedArgs[0]}for(var s in D){D[s].uid=F[D[s].Username]}Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(p._callback){p._callback.call(p,D)}},function(s){Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(p._callback){p._callback.call(p,D)}})});p._child.stdout.Parent=p._child;p._child.stdout.on("data",function(q){this.Parent._txt+=q.toString()});return(p)};this._recheckLoggedInUsers=function a(){this.enumerateUsers().then(function(o){if(o.Active.length>0){if(this.parent._linux_lock_watcher!=null&&this.parent._linux_lock_watcher.uid!=o.Active[0].uid){delete this.parent._linux_lock_watcher}this.parent._linux_lock_watcher=new g(process.env.XDG_CURRENT_DESKTOP=="Unity"?"com.ubuntu.Upstart0_6":"org.gnome.ScreenSaver",o.Active[0].uid);this.parent._linux_lock_watcher.user_session=this.parent;this.parent._linux_lock_watcher.on("signal",function(r){var q=this.user_session.enumerateUsers();q.signalData=r.data[0];q.then(function(p){switch(this.signalData){case true:case"desktop-lock":this.parent.emit("locked",p.Active[0]);break;case false:case"desktop-unlock":this.parent.emit("unlocked",p.Active[0]);break}})})}else{if(this.parent._linux_lock_watcher!=null){delete this.parent._linux_lock_watcher}}})};this.on("changed",this._recheckLoggedInUsers);this._recheckLoggedInUsers()}else{if(process.platform=="darwin"){this._users=function(){var o=require("child_process").execFile("/usr/bin/dscl",["dscl",".","list","/Users","UniqueID"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("exit\n");o.waitExit();var q=o.stdout.str.split("\n");var r,p;var s={};for(p=0;p<q.length;++p){r=q[p].split(" ");if(r[0]){s[r[0]]=r[r.length-1]}}return(s)};this._uids=function(){var o=require("child_process").execFile("/usr/bin/dscl",["dscl",".","list","/Users","UniqueID"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("exit\n");o.waitExit();var q=o.stdout.str.split("\n");var r,p;var s={};for(p=0;p<q.length;++p){r=q[p].split(" ");if(r[0]){s[r[r.length-1]]=r[0]}}return(s)};this._idTable=function(){var v={};var o=require("child_process").execFile("/usr/bin/id",["id"]);o.stdout.str="";o.stdout.on("data",function(y){this.str+=y.toString()});o.waitExit();var t=o.stdout.str.split("\n")[0].split(" ");for(var p=0;p<t.length;++p){var x=t[p].split("=");var w=x[1].split(",");v[x[0]]={};for(var s in w){var r=w[s].split("(");var q=r[0];var u=r[1].substring(0,r[1].length-1).trim();v[x[0]][u]=q;v[x[0]][q]=u}}return(v)};this.Current=function(o){var u={};var t=this._idTable();var p=require("child_process").execFile("/usr/bin/last",["last"]);p.stdout.str="";p.stdout.on("data",function(v){this.str+=v.toString()});p.waitExit();var s=p.stdout.str.split("\n");for(var r=0;r<s.length&&s[r].length>0;++r){if(!u[s[r].split(" ")[0]]){try{u[s[r].split(" ")[0]]={Username:s[r].split(" ")[0],State:s[r].split("still logged in").length>1?"Active":"Inactive",uid:t.uid[s[r].split(" ")[0]]}}catch(q){}}else{if(u[s[r].split(" ")[0]].State!="Active"&&s[r].split("still logged in").length>1){u[s[r].split(" ")[0]].State="Active"}}}Object.defineProperty(u,"Active",{value:showActiveOnly(u)});if(o){o.call(this,u)}}}}}if(process.platform=="linux"||process.platform=="darwin"){this._self=function b(){var o=require("child_process").execFile("/usr/bin/id",["id","-u"]);o.stdout.str="";o.stdout.on("data",function(p){this.str+=p.toString()});o.waitExit();return(parseInt(o.stdout.str))};this.isRoot=function k(){return(this._self()==0)};this.consoleUid=function e(){var o=process.platform=="darwin"?"console":process.env.DISPLAY;var p=require("child_process").execFile("/bin/sh",["sh"]);p.stdout.str="";p.stdout.on("data",function(u){this.str+=u.toString()});p.stdin.write("who\nexit\n");p.waitExit();var s=p.stdout.str.split("\n");var t,q,r;for(q in s){t=s[q].split(" ");for(r=1;r<t.length;++r){if(t[r].length>0&&(t[r]==o||t[r]==("("+o+")"))){return(parseInt(this._users()[t[0]]))}}}throw ("nobody logged into console")}}}function showActiveOnly(c){var b=[];var e={};var f=[];var d;for(var a in c){if(c[a].State=="Active"){b.push(c[a]);d=(c[a].Domain?(c[a].Domain+"\\"):"")+c[a].Username;if(!e[d]){e[d]=d}}}for(var a in e){f.push(a)}Object.defineProperty(b,"usernames",{value:f});return(b)}function getTokens(d){var a=[];var b;a.push(d.substring(0,(b=d.indexOf(" "))));while(d[++b]==" "){}a.push(d.substring(b,(b=d.substring(b).indexOf(" ")+b)));while(d[++b]==" "){}a.push(d.substring(b,(b=d.substring(b).indexOf(" ")+b)));while(d[++b]==" "){}var c=d.substring(b).trim();a.push(c);return(a)}module.exports=new UserSessions();
\ No newline at end of file
1
+var NOTIFY_FOR_THIS_SESSION=0;var NOTIFY_FOR_ALL_SESSIONS=1;var WM_WTSSESSION_CHANGE=689;var WM_POWERBROADCAST=536;var PBT_POWERSETTINGCHANGE=32787;var PBT_APMSUSPEND=4;var PBT_APMRESUMESUSPEND=7;var PBT_APMRESUMEAUTOMATIC=18;var PBT_APMPOWERSTATUSCHANGE=10;var WTS_CONSOLE_CONNECT=(1);var WTS_CONSOLE_DISCONNECT=(2);var WTS_REMOTE_CONNECT=(3);var WTS_REMOTE_DISCONNECT=(4);var WTS_SESSION_LOGON=(5);var WTS_SESSION_LOGOFF=(6);var WTS_SESSION_LOCK=(7);var WTS_SESSION_UNLOCK=(8);var WTS_SESSION_REMOTE_CONTROL=(9);var WTS_SESSION_CREATE=(10);var WTS_SESSION_TERMINATE=(11);var GUID_ACDC_POWER_SOURCE;var GUID_BATTERY_PERCENTAGE_REMAINING;var GUID_CONSOLE_DISPLAY_STATE;function UserSessions(){this._ObjectID="user-sessions";require("events").EventEmitter.call(this,true).createEvent("changed").createEvent("locked").createEvent("unlocked");this.enumerateUsers=function h(){var s=require("promise");var r=new s(function(t,p){this.__resolver=t;this.__rejector=p});r.__handler=function o(p){r.__resolver(p)};try{this.Current(r.__handler)}catch(q){r.__rejector(q)}r.parent=this;return(r)};if(process.platform=="win32"){this._serviceHooked=false;this._marshal=require("_GenericMarshal");this._kernel32=this._marshal.CreateNativeProxy("Kernel32.dll");this._kernel32.CreateMethod("GetLastError");try{this._wts=this._marshal.CreateNativeProxy("Wtsapi32.dll");this._wts.CreateMethod("WTSEnumerateSessionsA");this._wts.CreateMethod("WTSQuerySessionInformationA");this._wts.CreateMethod("WTSRegisterSessionNotification");this._wts.CreateMethod("WTSUnRegisterSessionNotification");this._wts.CreateMethod("WTSFreeMemory")}catch(i){}this._user32=this._marshal.CreateNativeProxy("user32.dll");this._user32.CreateMethod({method:"RegisterPowerSettingNotification",threadDispatch:1});this._user32.CreateMethod("UnregisterPowerSettingNotification");this._rpcrt=this._marshal.CreateNativeProxy("Rpcrt4.dll");this._rpcrt.CreateMethod("UuidFromStringA");this._rpcrt.StringToUUID=function n(o){var p=n.us._marshal.CreateVariable(16);if(n.us._rpcrt.UuidFromStringA(n.us._marshal.CreateVariable(o),p).Val==0){return(p)}else{throw ("Could not convert string to UUID")}};this._rpcrt.StringToUUID.us=this;GUID_ACDC_POWER_SOURCE=this._rpcrt.StringToUUID("5d3e9a59-e9D5-4b00-a6bd-ff34ff516548");GUID_BATTERY_PERCENTAGE_REMAINING=this._rpcrt.StringToUUID("a7ad8041-b45a-4cae-87a3-eecbb468a9e1");GUID_CONSOLE_DISPLAY_STATE=this._rpcrt.StringToUUID("6fe69556-704a-47a0-8f24-c28d936fda47");this.SessionStates=["Active","Connected","ConnectQuery","Shadow","Disconnected","Idle","Listening","Reset","Down","Init"];this.InfoClass={WTSInitialProgram:0,WTSApplicationName:1,WTSWorkingDirectory:2,WTSOEMId:3,WTSSessionId:4,WTSUserName:5,WTSWinStationName:6,WTSDomainName:7,WTSConnectState:8,WTSClientBuildNumber:9,WTSClientName:10,WTSClientDirectory:11,WTSClientProductId:12,WTSClientHardwareId:13,WTSClientAddress:14,WTSClientDisplay:15,WTSClientProtocolType:16,WTSIdleTime:17,WTSLogonTime:18,WTSIncomingBytes:19,WTSOutgoingBytes:20,WTSIncomingFrames:21,WTSOutgoingFrames:22,WTSClientInfo:23,WTSSessionInfo:24,WTSSessionInfoEx:25,WTSConfigInfo:26,WTSValidationInfo:27,WTSSessionAddressV4:28,WTSIsRemoteSession:29};this.getSessionAttribute=function j(s,o){var p=this._marshal.CreatePointer();var q=this._marshal.CreateVariable(4);if(this._wts.WTSQuerySessionInformationA(0,s,o,p,q).Val==0){throw ("Error calling WTSQuerySessionInformation: "+this._kernel32.GetLastError.Val)}var r=p.Deref().String;this._wts.WTSFreeMemory(p.Deref());return(r)};this.Current=function f(o){var u={};var t=this._marshal.CreatePointer();var p=this._marshal.CreateVariable(4);if(this._wts.WTSEnumerateSessionsA(0,0,1,t,p).Val==0){throw ("Error calling WTSEnumerateSessionsA: "+this._kernel32.GetLastError().Val)}for(var q=0;q<p.toBuffer().readUInt32LE();++q){var r=t.Deref().Deref(q*(this._marshal.PointerSize==4?12:24),this._marshal.PointerSize==4?12:24);var s={SessionId:r.toBuffer().readUInt32LE()};s.StationName=r.Deref(this._marshal.PointerSize==4?4:8,this._marshal.PointerSize).Deref().String;s.State=this.SessionStates[r.Deref(this._marshal.PointerSize==4?8:16,4).toBuffer().readUInt32LE()];if(s.State=="Active"){s.Username=this.getSessionAttribute(s.SessionId,this.InfoClass.WTSUserName);s.Domain=this.getSessionAttribute(s.SessionId,this.InfoClass.WTSDomainName)}u[s.SessionId]=s}this._wts.WTSFreeMemory(t.Deref());Object.defineProperty(u,"Active",{value:showActiveOnly(u)});if(o){o(u)}return(u)};var l=require("win-message-pump");this._messagepump=new l({filter:WM_WTSSESSION_CHANGE});this._messagepump.parent=this;this._messagepump.on("exit",function(o){this.parent._wts.WTSUnRegisterSessionNotification(this.parent.hwnd)});this._messagepump.on("hwnd",function(o){this.parent.hwnd=o;this.immediate=setImmediate(function(p){if(p.parent._wts){p.parent._wts.WTSRegisterSessionNotification(p.parent.hwnd,NOTIFY_FOR_ALL_SESSIONS)}p.parent._user32.ACDC_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_ACDC_POWER_SOURCE,0);p.parent._user32.BATT_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_BATTERY_PERCENTAGE_REMAINING,0);p.parent._user32.DISP_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_CONSOLE_DISPLAY_STATE,0)},this)});this._messagepump.on("message",function(q){switch(q.message){case WM_WTSSESSION_CHANGE:switch(q.wparam){case WTS_SESSION_LOCK:this.parent.enumerateUsers().then(function(r){if(r[q.lparam]){this.parent.emit("locked",r[q.lparam])}});break;case WTS_SESSION_UNLOCK:this.parent.enumerateUsers().then(function(r){if(r[q.lparam]){this.parent.emit("unlocked",r[q.lparam])}});break;case WTS_SESSION_LOGON:case WTS_SESSION_LOGOFF:this.parent.emit("changed");break}break;case WM_POWERBROADCAST:switch(q.wparam){default:console.log("WM_POWERBROADCAST [UNKNOWN wparam]: "+q.wparam);break;case PBT_APMSUSPEND:require("power-monitor").emit("sx","SLEEP");break;case PBT_APMRESUMEAUTOMATIC:require("power-monitor").emit("sx","RESUME_NON_INTERACTIVE");break;case PBT_APMRESUMESUSPEND:require("power-monitor").emit("sx","RESUME_INTERACTIVE");break;case PBT_APMPOWERSTATUSCHANGE:require("power-monitor").emit("changed");break;case PBT_POWERSETTINGCHANGE:var p=this.parent._marshal.CreatePointer(Buffer.from(q.lparam_hex,"hex"));var o=p.Deref(20,p.Deref(16,4).toBuffer().readUInt32LE(0)).toBuffer();switch(p.Deref(0,16).toBuffer().toString("hex")){case GUID_ACDC_POWER_SOURCE.Deref(0,16).toBuffer().toString("hex"):switch(o.readUInt32LE(0)){case 0:require("power-monitor").emit("acdc","AC");break;case 1:require("power-monitor").emit("acdc","BATTERY");break;case 2:require("power-monitor").emit("acdc","HOT");break}break;case GUID_BATTERY_PERCENTAGE_REMAINING.Deref(0,16).toBuffer().toString("hex"):require("power-monitor").emit("batteryLevel",o.readUInt32LE(0));break;case GUID_CONSOLE_DISPLAY_STATE.Deref(0,16).toBuffer().toString("hex"):switch(o.readUInt32LE(0)){case 0:require("power-monitor").emit("display","OFF");break;case 1:require("power-monitor").emit("display","ON");break;case 2:require("power-monitor").emit("display","DIMMED");break}break}break}break;default:break}})}else{if(process.platform=="linux"){var g=require("linux-dbus");this._linuxWatcher=require("fs").watch("/var/run/utmp");this._linuxWatcher.user_session=this;this._linuxWatcher.on("change",function(o,p){this.user_session.emit("changed")});this._users=function d(){var o=require("child_process").execFile("/bin/sh",["sh"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("awk -F: '($3 >= 0) {printf \"%s:%s\\n\", $1, $3}' /etc/passwd\nexit\n");o.waitExit();var p=o.stdout.str.split("\n");var r={},s;for(var q in p){s=p[q].split(":");if(s[0]){r[s[0]]=s[1]}}return(r)};this._uids=function c(){var o=require("child_process").execFile("/bin/sh",["sh"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("awk -F: '($3 >= 0) {printf \"%s:%s\\n\", $1, $3}' /etc/passwd\nexit\n");o.waitExit();var p=o.stdout.str.split("\n");var r={},s;for(var q in p){s=p[q].split(":");if(s[0]){r[s[1]]=s[0]}}return(r)};this.Self=function m(){var q=require("promise");var o=new q(function(r,p){this.__resolver=r;this.__rejector=p;this.__child=require("child_process").execFile("/usr/bin/id",["id","-u"]);this.__child.promise=this;this.__child.stdout._txt="";this.__child.stdout.on("data",function(s){this._txt+=s.toString()});this.__child.on("exit",function(s){try{parseInt(this.stdout._txt)}catch(t){this.promise.__rejector("invalid uid");return}var u=parseInt(this.stdout._txt);this.promise.__resolver(u)})});return(o)};this.Current=function f(o){var p={};p._ObjectID="UserSession";Object.defineProperty(p,"_callback",{value:o});Object.defineProperty(p,"_child",{value:require("child_process").execFile("/usr/bin/last",["last","-f","/var/run/utmp"])});p._child.Parent=p;p._child._txt="";p._child.on("exit",function(q){var u=this._txt.split("\n");var A=[];var D={};for(var t in u){if(u[t]){var B=getTokens(u[t]);var z={Username:B[0],SessionId:B[1]};if(B[3].includes("still logged in")){z.State="Active"}else{z.LastActive=B[3]}A.push(z)}}A.pop();var C={};var y=[];for(var t in A){if(A[t].Username!="reboot"){D[A[t].SessionId]=A[t];if(C[A[t].Username]==null){C[A[t].Username]=-1}}}try{require("promise")}catch(r){Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(this.Parent._callback){this.Parent._callback.call(this.Parent,D)}return}var x=require("promise");for(var v in C){var w=new x(function(E,s){this.__username=v;this.__resolver=E;this.__rejector=s;this.__child=require("child_process").execFile("/usr/bin/id",["id","-u",v]);this.__child.promise=this;this.__child.stdout._txt="";this.__child.stdout.on("data",function(F){this._txt+=F.toString()});this.__child.on("exit",function(F){try{parseInt(this.stdout._txt)}catch(G){this.promise.__rejector("invalid uid");return}var H=parseInt(this.stdout._txt);this.promise.__resolver(H)})});y.push(w)}x.all(y).then(function(E){var F={};for(var s in E){F[E[s].__username]=E[s]._internal.completedArgs[0]}for(var s in D){D[s].uid=F[D[s].Username]}Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(p._callback){p._callback.call(p,D)}},function(s){Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(p._callback){p._callback.call(p,D)}})});p._child.stdout.Parent=p._child;p._child.stdout.on("data",function(q){this.Parent._txt+=q.toString()});return(p)};this._recheckLoggedInUsers=function a(){this.enumerateUsers().then(function(o){if(o.Active.length>0){if(this.parent._linux_lock_watcher!=null&&this.parent._linux_lock_watcher.uid!=o.Active[0].uid){delete this.parent._linux_lock_watcher}this.parent._linux_lock_watcher=new g(process.env.XDG_CURRENT_DESKTOP=="Unity"?"com.ubuntu.Upstart0_6":"org.gnome.ScreenSaver",o.Active[0].uid);this.parent._linux_lock_watcher.user_session=this.parent;this.parent._linux_lock_watcher.on("signal",function(r){var q=this.user_session.enumerateUsers();q.signalData=r.data[0];q.then(function(p){switch(this.signalData){case true:case"desktop-lock":this.parent.emit("locked",p.Active[0]);break;case false:case"desktop-unlock":this.parent.emit("unlocked",p.Active[0]);break}})})}else{if(this.parent._linux_lock_watcher!=null){delete this.parent._linux_lock_watcher}}})};this.on("changed",this._recheckLoggedInUsers);this._recheckLoggedInUsers()}else{if(process.platform=="darwin"){this._users=function(){var o=require("child_process").execFile("/usr/bin/dscl",["dscl",".","list","/Users","UniqueID"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("exit\n");o.waitExit();var q=o.stdout.str.split("\n");var r,p;var s={};for(p=0;p<q.length;++p){r=q[p].split(" ");if(r[0]){s[r[0]]=r[r.length-1]}}return(s)};this._uids=function(){var o=require("child_process").execFile("/usr/bin/dscl",["dscl",".","list","/Users","UniqueID"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("exit\n");o.waitExit();var q=o.stdout.str.split("\n");var r,p;var s={};for(p=0;p<q.length;++p){r=q[p].split(" ");if(r[0]){s[r[r.length-1]]=r[0]}}return(s)};this._idTable=function(){var v={};var o=require("child_process").execFile("/usr/bin/id",["id"]);o.stdout.str="";o.stdout.on("data",function(y){this.str+=y.toString()});o.waitExit();var t=o.stdout.str.split("\n")[0].split(" ");for(var p=0;p<t.length;++p){var x=t[p].split("=");var w=x[1].split(",");v[x[0]]={};for(var s in w){var r=w[s].split("(");var q=r[0];var u=r[1].substring(0,r[1].length-1).trim();v[x[0]][u]=q;v[x[0]][q]=u}}return(v)};this.Current=function(o){var u={};var t=this._idTable();var p=require("child_process").execFile("/usr/bin/last",["last"]);p.stdout.str="";p.stdout.on("data",function(v){this.str+=v.toString()});p.waitExit();var s=p.stdout.str.split("\n");for(var r=0;r<s.length&&s[r].length>0;++r){if(!u[s[r].split(" ")[0]]){try{u[s[r].split(" ")[0]]={Username:s[r].split(" ")[0],State:s[r].split("still logged in").length>1?"Active":"Inactive",uid:t.uid[s[r].split(" ")[0]]}}catch(q){}}else{if(u[s[r].split(" ")[0]].State!="Active"&&s[r].split("still logged in").length>1){u[s[r].split(" ")[0]].State="Active"}}}Object.defineProperty(u,"Active",{value:showActiveOnly(u)});if(o){o.call(this,u)}}}}}if(process.platform=="linux"||process.platform=="darwin"){this._self=function b(){var o=require("child_process").execFile("/usr/bin/id",["id","-u"]);o.stdout.str="";o.stdout.on("data",function(p){this.str+=p.toString()});o.waitExit();return(parseInt(o.stdout.str))};this.isRoot=function k(){return(this._self()==0)};this.consoleUid=function e(){var o=process.platform=="darwin"?"console":((process.env.DISPLAY)?process.env.DISPLAY:":0");var p=require("child_process").execFile("/bin/sh",["sh"]);p.stdout.str="";p.stdout.on("data",function(u){this.str+=u.toString()});p.stdin.write("who\nexit\n");p.waitExit();var s=p.stdout.str.split("\n");var t,q,r;for(q in s){t=s[q].split(" ");for(r=1;r<t.length;++r){if(t[r].length>0&&(t[r]==o||t[r]==("("+o+")"))){return(parseInt(this._users()[t[0]]))}}}throw ("nobody logged into console")}}}function showActiveOnly(c){var b=[];var e={};var f=[];var d;for(var a in c){if(c[a].State=="Active"){b.push(c[a]);d=(c[a].Domain?(c[a].Domain+"\\"):"")+c[a].Username;if(!e[d]){e[d]=d}}}for(var a in e){f.push(a)}Object.defineProperty(b,"usernames",{value:f});return(b)}function getTokens(d){var a=[];var b;a.push(d.substring(0,(b=d.indexOf(" "))));while(d[++b]==" "){}a.push(d.substring(b,(b=d.substring(b).indexOf(" ")+b)));while(d[++b]==" "){}a.push(d.substring(b,(b=d.substring(b).indexOf(" ")+b)));while(d[++b]==" "){}var c=d.substring(b).trim();a.push(c);return(a)}module.exports=new UserSessions();
\ No newline at end of file
agents/modules_meshcore/user-sessions.js
+1
-1
@@ -653,7 +653,7 @@ function UserSessions()
653
}
654
this.consoleUid = function consoleUid()
655
{
656
- var checkstr = process.platform == 'darwin' ? 'console' : process.env['DISPLAY'];
656
+ var checkstr = process.platform == 'darwin' ? 'console' : ((process.env['DISPLAY'])?process.env['DISPLAY']:':0')
657
var child = require('child_process').execFile('/bin/sh', ['sh']);
658
child.stdout.str = '';
659
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
agents/modules_meshcore_min/user-sessions.min.js
+1
-1
@@ -1 +1 @@
1
-var NOTIFY_FOR_THIS_SESSION=0;var NOTIFY_FOR_ALL_SESSIONS=1;var WM_WTSSESSION_CHANGE=689;var WM_POWERBROADCAST=536;var PBT_POWERSETTINGCHANGE=32787;var PBT_APMSUSPEND=4;var PBT_APMRESUMESUSPEND=7;var PBT_APMRESUMEAUTOMATIC=18;var PBT_APMPOWERSTATUSCHANGE=10;var WTS_CONSOLE_CONNECT=(1);var WTS_CONSOLE_DISCONNECT=(2);var WTS_REMOTE_CONNECT=(3);var WTS_REMOTE_DISCONNECT=(4);var WTS_SESSION_LOGON=(5);var WTS_SESSION_LOGOFF=(6);var WTS_SESSION_LOCK=(7);var WTS_SESSION_UNLOCK=(8);var WTS_SESSION_REMOTE_CONTROL=(9);var WTS_SESSION_CREATE=(10);var WTS_SESSION_TERMINATE=(11);var GUID_ACDC_POWER_SOURCE;var GUID_BATTERY_PERCENTAGE_REMAINING;var GUID_CONSOLE_DISPLAY_STATE;function UserSessions(){this._ObjectID="user-sessions";require("events").EventEmitter.call(this,true).createEvent("changed").createEvent("locked").createEvent("unlocked");this.enumerateUsers=function h(){var s=require("promise");var r=new s(function(t,p){this.__resolver=t;this.__rejector=p});r.__handler=function o(p){r.__resolver(p)};try{this.Current(r.__handler)}catch(q){r.__rejector(q)}r.parent=this;return(r)};if(process.platform=="win32"){this._serviceHooked=false;this._marshal=require("_GenericMarshal");this._kernel32=this._marshal.CreateNativeProxy("Kernel32.dll");this._kernel32.CreateMethod("GetLastError");try{this._wts=this._marshal.CreateNativeProxy("Wtsapi32.dll");this._wts.CreateMethod("WTSEnumerateSessionsA");this._wts.CreateMethod("WTSQuerySessionInformationA");this._wts.CreateMethod("WTSRegisterSessionNotification");this._wts.CreateMethod("WTSUnRegisterSessionNotification");this._wts.CreateMethod("WTSFreeMemory")}catch(i){}this._user32=this._marshal.CreateNativeProxy("user32.dll");this._user32.CreateMethod({method:"RegisterPowerSettingNotification",threadDispatch:1});this._user32.CreateMethod("UnregisterPowerSettingNotification");this._rpcrt=this._marshal.CreateNativeProxy("Rpcrt4.dll");this._rpcrt.CreateMethod("UuidFromStringA");this._rpcrt.StringToUUID=function n(o){var p=n.us._marshal.CreateVariable(16);if(n.us._rpcrt.UuidFromStringA(n.us._marshal.CreateVariable(o),p).Val==0){return(p)}else{throw ("Could not convert string to UUID")}};this._rpcrt.StringToUUID.us=this;GUID_ACDC_POWER_SOURCE=this._rpcrt.StringToUUID("5d3e9a59-e9D5-4b00-a6bd-ff34ff516548");GUID_BATTERY_PERCENTAGE_REMAINING=this._rpcrt.StringToUUID("a7ad8041-b45a-4cae-87a3-eecbb468a9e1");GUID_CONSOLE_DISPLAY_STATE=this._rpcrt.StringToUUID("6fe69556-704a-47a0-8f24-c28d936fda47");this.SessionStates=["Active","Connected","ConnectQuery","Shadow","Disconnected","Idle","Listening","Reset","Down","Init"];this.InfoClass={WTSInitialProgram:0,WTSApplicationName:1,WTSWorkingDirectory:2,WTSOEMId:3,WTSSessionId:4,WTSUserName:5,WTSWinStationName:6,WTSDomainName:7,WTSConnectState:8,WTSClientBuildNumber:9,WTSClientName:10,WTSClientDirectory:11,WTSClientProductId:12,WTSClientHardwareId:13,WTSClientAddress:14,WTSClientDisplay:15,WTSClientProtocolType:16,WTSIdleTime:17,WTSLogonTime:18,WTSIncomingBytes:19,WTSOutgoingBytes:20,WTSIncomingFrames:21,WTSOutgoingFrames:22,WTSClientInfo:23,WTSSessionInfo:24,WTSSessionInfoEx:25,WTSConfigInfo:26,WTSValidationInfo:27,WTSSessionAddressV4:28,WTSIsRemoteSession:29};this.getSessionAttribute=function j(s,o){var p=this._marshal.CreatePointer();var q=this._marshal.CreateVariable(4);if(this._wts.WTSQuerySessionInformationA(0,s,o,p,q).Val==0){throw ("Error calling WTSQuerySessionInformation: "+this._kernel32.GetLastError.Val)}var r=p.Deref().String;this._wts.WTSFreeMemory(p.Deref());return(r)};this.Current=function f(o){var u={};var t=this._marshal.CreatePointer();var p=this._marshal.CreateVariable(4);if(this._wts.WTSEnumerateSessionsA(0,0,1,t,p).Val==0){throw ("Error calling WTSEnumerateSessionsA: "+this._kernel32.GetLastError().Val)}for(var q=0;q<p.toBuffer().readUInt32LE();++q){var r=t.Deref().Deref(q*(this._marshal.PointerSize==4?12:24),this._marshal.PointerSize==4?12:24);var s={SessionId:r.toBuffer().readUInt32LE()};s.StationName=r.Deref(this._marshal.PointerSize==4?4:8,this._marshal.PointerSize).Deref().String;s.State=this.SessionStates[r.Deref(this._marshal.PointerSize==4?8:16,4).toBuffer().readUInt32LE()];if(s.State=="Active"){s.Username=this.getSessionAttribute(s.SessionId,this.InfoClass.WTSUserName);s.Domain=this.getSessionAttribute(s.SessionId,this.InfoClass.WTSDomainName)}u[s.SessionId]=s}this._wts.WTSFreeMemory(t.Deref());Object.defineProperty(u,"Active",{value:showActiveOnly(u)});if(o){o(u)}return(u)};var l=require("win-message-pump");this._messagepump=new l({filter:WM_WTSSESSION_CHANGE});this._messagepump.parent=this;this._messagepump.on("exit",function(o){this.parent._wts.WTSUnRegisterSessionNotification(this.parent.hwnd)});this._messagepump.on("hwnd",function(o){this.parent.hwnd=o;this.immediate=setImmediate(function(p){if(p.parent._wts){p.parent._wts.WTSRegisterSessionNotification(p.parent.hwnd,NOTIFY_FOR_ALL_SESSIONS)}p.parent._user32.ACDC_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_ACDC_POWER_SOURCE,0);p.parent._user32.BATT_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_BATTERY_PERCENTAGE_REMAINING,0);p.parent._user32.DISP_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_CONSOLE_DISPLAY_STATE,0)},this)});this._messagepump.on("message",function(q){switch(q.message){case WM_WTSSESSION_CHANGE:switch(q.wparam){case WTS_SESSION_LOCK:this.parent.enumerateUsers().then(function(r){if(r[q.lparam]){this.parent.emit("locked",r[q.lparam])}});break;case WTS_SESSION_UNLOCK:this.parent.enumerateUsers().then(function(r){if(r[q.lparam]){this.parent.emit("unlocked",r[q.lparam])}});break;case WTS_SESSION_LOGON:case WTS_SESSION_LOGOFF:this.parent.emit("changed");break}break;case WM_POWERBROADCAST:switch(q.wparam){default:console.log("WM_POWERBROADCAST [UNKNOWN wparam]: "+q.wparam);break;case PBT_APMSUSPEND:require("power-monitor").emit("sx","SLEEP");break;case PBT_APMRESUMEAUTOMATIC:require("power-monitor").emit("sx","RESUME_NON_INTERACTIVE");break;case PBT_APMRESUMESUSPEND:require("power-monitor").emit("sx","RESUME_INTERACTIVE");break;case PBT_APMPOWERSTATUSCHANGE:require("power-monitor").emit("changed");break;case PBT_POWERSETTINGCHANGE:var p=this.parent._marshal.CreatePointer(Buffer.from(q.lparam_hex,"hex"));var o=p.Deref(20,p.Deref(16,4).toBuffer().readUInt32LE(0)).toBuffer();switch(p.Deref(0,16).toBuffer().toString("hex")){case GUID_ACDC_POWER_SOURCE.Deref(0,16).toBuffer().toString("hex"):switch(o.readUInt32LE(0)){case 0:require("power-monitor").emit("acdc","AC");break;case 1:require("power-monitor").emit("acdc","BATTERY");break;case 2:require("power-monitor").emit("acdc","HOT");break}break;case GUID_BATTERY_PERCENTAGE_REMAINING.Deref(0,16).toBuffer().toString("hex"):require("power-monitor").emit("batteryLevel",o.readUInt32LE(0));break;case GUID_CONSOLE_DISPLAY_STATE.Deref(0,16).toBuffer().toString("hex"):switch(o.readUInt32LE(0)){case 0:require("power-monitor").emit("display","OFF");break;case 1:require("power-monitor").emit("display","ON");break;case 2:require("power-monitor").emit("display","DIMMED");break}break}break}break;default:break}})}else{if(process.platform=="linux"){var g=require("linux-dbus");this._linuxWatcher=require("fs").watch("/var/run/utmp");this._linuxWatcher.user_session=this;this._linuxWatcher.on("change",function(o,p){this.user_session.emit("changed")});this._users=function d(){var o=require("child_process").execFile("/bin/sh",["sh"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("awk -F: '($3 >= 0) {printf \"%s:%s\\n\", $1, $3}' /etc/passwd\nexit\n");o.waitExit();var p=o.stdout.str.split("\n");var r={},s;for(var q in p){s=p[q].split(":");if(s[0]){r[s[0]]=s[1]}}return(r)};this._uids=function c(){var o=require("child_process").execFile("/bin/sh",["sh"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("awk -F: '($3 >= 0) {printf \"%s:%s\\n\", $1, $3}' /etc/passwd\nexit\n");o.waitExit();var p=o.stdout.str.split("\n");var r={},s;for(var q in p){s=p[q].split(":");if(s[0]){r[s[1]]=s[0]}}return(r)};this.Self=function m(){var q=require("promise");var o=new q(function(r,p){this.__resolver=r;this.__rejector=p;this.__child=require("child_process").execFile("/usr/bin/id",["id","-u"]);this.__child.promise=this;this.__child.stdout._txt="";this.__child.stdout.on("data",function(s){this._txt+=s.toString()});this.__child.on("exit",function(s){try{parseInt(this.stdout._txt)}catch(t){this.promise.__rejector("invalid uid");return}var u=parseInt(this.stdout._txt);this.promise.__resolver(u)})});return(o)};this.Current=function f(o){var p={};p._ObjectID="UserSession";Object.defineProperty(p,"_callback",{value:o});Object.defineProperty(p,"_child",{value:require("child_process").execFile("/usr/bin/last",["last","-f","/var/run/utmp"])});p._child.Parent=p;p._child._txt="";p._child.on("exit",function(q){var u=this._txt.split("\n");var A=[];var D={};for(var t in u){if(u[t]){var B=getTokens(u[t]);var z={Username:B[0],SessionId:B[1]};if(B[3].includes("still logged in")){z.State="Active"}else{z.LastActive=B[3]}A.push(z)}}A.pop();var C={};var y=[];for(var t in A){if(A[t].Username!="reboot"){D[A[t].SessionId]=A[t];if(C[A[t].Username]==null){C[A[t].Username]=-1}}}try{require("promise")}catch(r){Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(this.Parent._callback){this.Parent._callback.call(this.Parent,D)}return}var x=require("promise");for(var v in C){var w=new x(function(E,s){this.__username=v;this.__resolver=E;this.__rejector=s;this.__child=require("child_process").execFile("/usr/bin/id",["id","-u",v]);this.__child.promise=this;this.__child.stdout._txt="";this.__child.stdout.on("data",function(F){this._txt+=F.toString()});this.__child.on("exit",function(F){try{parseInt(this.stdout._txt)}catch(G){this.promise.__rejector("invalid uid");return}var H=parseInt(this.stdout._txt);this.promise.__resolver(H)})});y.push(w)}x.all(y).then(function(E){var F={};for(var s in E){F[E[s].__username]=E[s]._internal.completedArgs[0]}for(var s in D){D[s].uid=F[D[s].Username]}Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(p._callback){p._callback.call(p,D)}},function(s){Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(p._callback){p._callback.call(p,D)}})});p._child.stdout.Parent=p._child;p._child.stdout.on("data",function(q){this.Parent._txt+=q.toString()});return(p)};this._recheckLoggedInUsers=function a(){this.enumerateUsers().then(function(o){if(o.Active.length>0){if(this.parent._linux_lock_watcher!=null&&this.parent._linux_lock_watcher.uid!=o.Active[0].uid){delete this.parent._linux_lock_watcher}this.parent._linux_lock_watcher=new g(process.env.XDG_CURRENT_DESKTOP=="Unity"?"com.ubuntu.Upstart0_6":"org.gnome.ScreenSaver",o.Active[0].uid);this.parent._linux_lock_watcher.user_session=this.parent;this.parent._linux_lock_watcher.on("signal",function(r){var q=this.user_session.enumerateUsers();q.signalData=r.data[0];q.then(function(p){switch(this.signalData){case true:case"desktop-lock":this.parent.emit("locked",p.Active[0]);break;case false:case"desktop-unlock":this.parent.emit("unlocked",p.Active[0]);break}})})}else{if(this.parent._linux_lock_watcher!=null){delete this.parent._linux_lock_watcher}}})};this.on("changed",this._recheckLoggedInUsers);this._recheckLoggedInUsers()}else{if(process.platform=="darwin"){this._users=function(){var o=require("child_process").execFile("/usr/bin/dscl",["dscl",".","list","/Users","UniqueID"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("exit\n");o.waitExit();var q=o.stdout.str.split("\n");var r,p;var s={};for(p=0;p<q.length;++p){r=q[p].split(" ");if(r[0]){s[r[0]]=r[r.length-1]}}return(s)};this._uids=function(){var o=require("child_process").execFile("/usr/bin/dscl",["dscl",".","list","/Users","UniqueID"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("exit\n");o.waitExit();var q=o.stdout.str.split("\n");var r,p;var s={};for(p=0;p<q.length;++p){r=q[p].split(" ");if(r[0]){s[r[r.length-1]]=r[0]}}return(s)};this._idTable=function(){var v={};var o=require("child_process").execFile("/usr/bin/id",["id"]);o.stdout.str="";o.stdout.on("data",function(y){this.str+=y.toString()});o.waitExit();var t=o.stdout.str.split("\n")[0].split(" ");for(var p=0;p<t.length;++p){var x=t[p].split("=");var w=x[1].split(",");v[x[0]]={};for(var s in w){var r=w[s].split("(");var q=r[0];var u=r[1].substring(0,r[1].length-1).trim();v[x[0]][u]=q;v[x[0]][q]=u}}return(v)};this.Current=function(o){var u={};var t=this._idTable();var p=require("child_process").execFile("/usr/bin/last",["last"]);p.stdout.str="";p.stdout.on("data",function(v){this.str+=v.toString()});p.waitExit();var s=p.stdout.str.split("\n");for(var r=0;r<s.length&&s[r].length>0;++r){if(!u[s[r].split(" ")[0]]){try{u[s[r].split(" ")[0]]={Username:s[r].split(" ")[0],State:s[r].split("still logged in").length>1?"Active":"Inactive",uid:t.uid[s[r].split(" ")[0]]}}catch(q){}}else{if(u[s[r].split(" ")[0]].State!="Active"&&s[r].split("still logged in").length>1){u[s[r].split(" ")[0]].State="Active"}}}Object.defineProperty(u,"Active",{value:showActiveOnly(u)});if(o){o.call(this,u)}}}}}if(process.platform=="linux"||process.platform=="darwin"){this._self=function b(){var o=require("child_process").execFile("/usr/bin/id",["id","-u"]);o.stdout.str="";o.stdout.on("data",function(p){this.str+=p.toString()});o.waitExit();return(parseInt(o.stdout.str))};this.isRoot=function k(){return(this._self()==0)};this.consoleUid=function e(){var o=process.platform=="darwin"?"console":process.env.DISPLAY;var p=require("child_process").execFile("/bin/sh",["sh"]);p.stdout.str="";p.stdout.on("data",function(u){this.str+=u.toString()});p.stdin.write("who\nexit\n");p.waitExit();var s=p.stdout.str.split("\n");var t,q,r;for(q in s){t=s[q].split(" ");for(r=1;r<t.length;++r){if(t[r].length>0&&(t[r]==o||t[r]==("("+o+")"))){return(parseInt(this._users()[t[0]]))}}}throw ("nobody logged into console")}}}function showActiveOnly(c){var b=[];var e={};var f=[];var d;for(var a in c){if(c[a].State=="Active"){b.push(c[a]);d=(c[a].Domain?(c[a].Domain+"\\"):"")+c[a].Username;if(!e[d]){e[d]=d}}}for(var a in e){f.push(a)}Object.defineProperty(b,"usernames",{value:f});return(b)}function getTokens(d){var a=[];var b;a.push(d.substring(0,(b=d.indexOf(" "))));while(d[++b]==" "){}a.push(d.substring(b,(b=d.substring(b).indexOf(" ")+b)));while(d[++b]==" "){}a.push(d.substring(b,(b=d.substring(b).indexOf(" ")+b)));while(d[++b]==" "){}var c=d.substring(b).trim();a.push(c);return(a)}module.exports=new UserSessions();
\ No newline at end of file
1
+var NOTIFY_FOR_THIS_SESSION=0;var NOTIFY_FOR_ALL_SESSIONS=1;var WM_WTSSESSION_CHANGE=689;var WM_POWERBROADCAST=536;var PBT_POWERSETTINGCHANGE=32787;var PBT_APMSUSPEND=4;var PBT_APMRESUMESUSPEND=7;var PBT_APMRESUMEAUTOMATIC=18;var PBT_APMPOWERSTATUSCHANGE=10;var WTS_CONSOLE_CONNECT=(1);var WTS_CONSOLE_DISCONNECT=(2);var WTS_REMOTE_CONNECT=(3);var WTS_REMOTE_DISCONNECT=(4);var WTS_SESSION_LOGON=(5);var WTS_SESSION_LOGOFF=(6);var WTS_SESSION_LOCK=(7);var WTS_SESSION_UNLOCK=(8);var WTS_SESSION_REMOTE_CONTROL=(9);var WTS_SESSION_CREATE=(10);var WTS_SESSION_TERMINATE=(11);var GUID_ACDC_POWER_SOURCE;var GUID_BATTERY_PERCENTAGE_REMAINING;var GUID_CONSOLE_DISPLAY_STATE;function UserSessions(){this._ObjectID="user-sessions";require("events").EventEmitter.call(this,true).createEvent("changed").createEvent("locked").createEvent("unlocked");this.enumerateUsers=function h(){var s=require("promise");var r=new s(function(t,p){this.__resolver=t;this.__rejector=p});r.__handler=function o(p){r.__resolver(p)};try{this.Current(r.__handler)}catch(q){r.__rejector(q)}r.parent=this;return(r)};if(process.platform=="win32"){this._serviceHooked=false;this._marshal=require("_GenericMarshal");this._kernel32=this._marshal.CreateNativeProxy("Kernel32.dll");this._kernel32.CreateMethod("GetLastError");try{this._wts=this._marshal.CreateNativeProxy("Wtsapi32.dll");this._wts.CreateMethod("WTSEnumerateSessionsA");this._wts.CreateMethod("WTSQuerySessionInformationA");this._wts.CreateMethod("WTSRegisterSessionNotification");this._wts.CreateMethod("WTSUnRegisterSessionNotification");this._wts.CreateMethod("WTSFreeMemory")}catch(i){}this._user32=this._marshal.CreateNativeProxy("user32.dll");this._user32.CreateMethod({method:"RegisterPowerSettingNotification",threadDispatch:1});this._user32.CreateMethod("UnregisterPowerSettingNotification");this._rpcrt=this._marshal.CreateNativeProxy("Rpcrt4.dll");this._rpcrt.CreateMethod("UuidFromStringA");this._rpcrt.StringToUUID=function n(o){var p=n.us._marshal.CreateVariable(16);if(n.us._rpcrt.UuidFromStringA(n.us._marshal.CreateVariable(o),p).Val==0){return(p)}else{throw ("Could not convert string to UUID")}};this._rpcrt.StringToUUID.us=this;GUID_ACDC_POWER_SOURCE=this._rpcrt.StringToUUID("5d3e9a59-e9D5-4b00-a6bd-ff34ff516548");GUID_BATTERY_PERCENTAGE_REMAINING=this._rpcrt.StringToUUID("a7ad8041-b45a-4cae-87a3-eecbb468a9e1");GUID_CONSOLE_DISPLAY_STATE=this._rpcrt.StringToUUID("6fe69556-704a-47a0-8f24-c28d936fda47");this.SessionStates=["Active","Connected","ConnectQuery","Shadow","Disconnected","Idle","Listening","Reset","Down","Init"];this.InfoClass={WTSInitialProgram:0,WTSApplicationName:1,WTSWorkingDirectory:2,WTSOEMId:3,WTSSessionId:4,WTSUserName:5,WTSWinStationName:6,WTSDomainName:7,WTSConnectState:8,WTSClientBuildNumber:9,WTSClientName:10,WTSClientDirectory:11,WTSClientProductId:12,WTSClientHardwareId:13,WTSClientAddress:14,WTSClientDisplay:15,WTSClientProtocolType:16,WTSIdleTime:17,WTSLogonTime:18,WTSIncomingBytes:19,WTSOutgoingBytes:20,WTSIncomingFrames:21,WTSOutgoingFrames:22,WTSClientInfo:23,WTSSessionInfo:24,WTSSessionInfoEx:25,WTSConfigInfo:26,WTSValidationInfo:27,WTSSessionAddressV4:28,WTSIsRemoteSession:29};this.getSessionAttribute=function j(s,o){var p=this._marshal.CreatePointer();var q=this._marshal.CreateVariable(4);if(this._wts.WTSQuerySessionInformationA(0,s,o,p,q).Val==0){throw ("Error calling WTSQuerySessionInformation: "+this._kernel32.GetLastError.Val)}var r=p.Deref().String;this._wts.WTSFreeMemory(p.Deref());return(r)};this.Current=function f(o){var u={};var t=this._marshal.CreatePointer();var p=this._marshal.CreateVariable(4);if(this._wts.WTSEnumerateSessionsA(0,0,1,t,p).Val==0){throw ("Error calling WTSEnumerateSessionsA: "+this._kernel32.GetLastError().Val)}for(var q=0;q<p.toBuffer().readUInt32LE();++q){var r=t.Deref().Deref(q*(this._marshal.PointerSize==4?12:24),this._marshal.PointerSize==4?12:24);var s={SessionId:r.toBuffer().readUInt32LE()};s.StationName=r.Deref(this._marshal.PointerSize==4?4:8,this._marshal.PointerSize).Deref().String;s.State=this.SessionStates[r.Deref(this._marshal.PointerSize==4?8:16,4).toBuffer().readUInt32LE()];if(s.State=="Active"){s.Username=this.getSessionAttribute(s.SessionId,this.InfoClass.WTSUserName);s.Domain=this.getSessionAttribute(s.SessionId,this.InfoClass.WTSDomainName)}u[s.SessionId]=s}this._wts.WTSFreeMemory(t.Deref());Object.defineProperty(u,"Active",{value:showActiveOnly(u)});if(o){o(u)}return(u)};var l=require("win-message-pump");this._messagepump=new l({filter:WM_WTSSESSION_CHANGE});this._messagepump.parent=this;this._messagepump.on("exit",function(o){this.parent._wts.WTSUnRegisterSessionNotification(this.parent.hwnd)});this._messagepump.on("hwnd",function(o){this.parent.hwnd=o;this.immediate=setImmediate(function(p){if(p.parent._wts){p.parent._wts.WTSRegisterSessionNotification(p.parent.hwnd,NOTIFY_FOR_ALL_SESSIONS)}p.parent._user32.ACDC_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_ACDC_POWER_SOURCE,0);p.parent._user32.BATT_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_BATTERY_PERCENTAGE_REMAINING,0);p.parent._user32.DISP_H=p.parent._user32.RegisterPowerSettingNotification(p.parent.hwnd,GUID_CONSOLE_DISPLAY_STATE,0)},this)});this._messagepump.on("message",function(q){switch(q.message){case WM_WTSSESSION_CHANGE:switch(q.wparam){case WTS_SESSION_LOCK:this.parent.enumerateUsers().then(function(r){if(r[q.lparam]){this.parent.emit("locked",r[q.lparam])}});break;case WTS_SESSION_UNLOCK:this.parent.enumerateUsers().then(function(r){if(r[q.lparam]){this.parent.emit("unlocked",r[q.lparam])}});break;case WTS_SESSION_LOGON:case WTS_SESSION_LOGOFF:this.parent.emit("changed");break}break;case WM_POWERBROADCAST:switch(q.wparam){default:console.log("WM_POWERBROADCAST [UNKNOWN wparam]: "+q.wparam);break;case PBT_APMSUSPEND:require("power-monitor").emit("sx","SLEEP");break;case PBT_APMRESUMEAUTOMATIC:require("power-monitor").emit("sx","RESUME_NON_INTERACTIVE");break;case PBT_APMRESUMESUSPEND:require("power-monitor").emit("sx","RESUME_INTERACTIVE");break;case PBT_APMPOWERSTATUSCHANGE:require("power-monitor").emit("changed");break;case PBT_POWERSETTINGCHANGE:var p=this.parent._marshal.CreatePointer(Buffer.from(q.lparam_hex,"hex"));var o=p.Deref(20,p.Deref(16,4).toBuffer().readUInt32LE(0)).toBuffer();switch(p.Deref(0,16).toBuffer().toString("hex")){case GUID_ACDC_POWER_SOURCE.Deref(0,16).toBuffer().toString("hex"):switch(o.readUInt32LE(0)){case 0:require("power-monitor").emit("acdc","AC");break;case 1:require("power-monitor").emit("acdc","BATTERY");break;case 2:require("power-monitor").emit("acdc","HOT");break}break;case GUID_BATTERY_PERCENTAGE_REMAINING.Deref(0,16).toBuffer().toString("hex"):require("power-monitor").emit("batteryLevel",o.readUInt32LE(0));break;case GUID_CONSOLE_DISPLAY_STATE.Deref(0,16).toBuffer().toString("hex"):switch(o.readUInt32LE(0)){case 0:require("power-monitor").emit("display","OFF");break;case 1:require("power-monitor").emit("display","ON");break;case 2:require("power-monitor").emit("display","DIMMED");break}break}break}break;default:break}})}else{if(process.platform=="linux"){var g=require("linux-dbus");this._linuxWatcher=require("fs").watch("/var/run/utmp");this._linuxWatcher.user_session=this;this._linuxWatcher.on("change",function(o,p){this.user_session.emit("changed")});this._users=function d(){var o=require("child_process").execFile("/bin/sh",["sh"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("awk -F: '($3 >= 0) {printf \"%s:%s\\n\", $1, $3}' /etc/passwd\nexit\n");o.waitExit();var p=o.stdout.str.split("\n");var r={},s;for(var q in p){s=p[q].split(":");if(s[0]){r[s[0]]=s[1]}}return(r)};this._uids=function c(){var o=require("child_process").execFile("/bin/sh",["sh"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("awk -F: '($3 >= 0) {printf \"%s:%s\\n\", $1, $3}' /etc/passwd\nexit\n");o.waitExit();var p=o.stdout.str.split("\n");var r={},s;for(var q in p){s=p[q].split(":");if(s[0]){r[s[1]]=s[0]}}return(r)};this.Self=function m(){var q=require("promise");var o=new q(function(r,p){this.__resolver=r;this.__rejector=p;this.__child=require("child_process").execFile("/usr/bin/id",["id","-u"]);this.__child.promise=this;this.__child.stdout._txt="";this.__child.stdout.on("data",function(s){this._txt+=s.toString()});this.__child.on("exit",function(s){try{parseInt(this.stdout._txt)}catch(t){this.promise.__rejector("invalid uid");return}var u=parseInt(this.stdout._txt);this.promise.__resolver(u)})});return(o)};this.Current=function f(o){var p={};p._ObjectID="UserSession";Object.defineProperty(p,"_callback",{value:o});Object.defineProperty(p,"_child",{value:require("child_process").execFile("/usr/bin/last",["last","-f","/var/run/utmp"])});p._child.Parent=p;p._child._txt="";p._child.on("exit",function(q){var u=this._txt.split("\n");var A=[];var D={};for(var t in u){if(u[t]){var B=getTokens(u[t]);var z={Username:B[0],SessionId:B[1]};if(B[3].includes("still logged in")){z.State="Active"}else{z.LastActive=B[3]}A.push(z)}}A.pop();var C={};var y=[];for(var t in A){if(A[t].Username!="reboot"){D[A[t].SessionId]=A[t];if(C[A[t].Username]==null){C[A[t].Username]=-1}}}try{require("promise")}catch(r){Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(this.Parent._callback){this.Parent._callback.call(this.Parent,D)}return}var x=require("promise");for(var v in C){var w=new x(function(E,s){this.__username=v;this.__resolver=E;this.__rejector=s;this.__child=require("child_process").execFile("/usr/bin/id",["id","-u",v]);this.__child.promise=this;this.__child.stdout._txt="";this.__child.stdout.on("data",function(F){this._txt+=F.toString()});this.__child.on("exit",function(F){try{parseInt(this.stdout._txt)}catch(G){this.promise.__rejector("invalid uid");return}var H=parseInt(this.stdout._txt);this.promise.__resolver(H)})});y.push(w)}x.all(y).then(function(E){var F={};for(var s in E){F[E[s].__username]=E[s]._internal.completedArgs[0]}for(var s in D){D[s].uid=F[D[s].Username]}Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(p._callback){p._callback.call(p,D)}},function(s){Object.defineProperty(D,"Active",{value:showActiveOnly(D)});if(p._callback){p._callback.call(p,D)}})});p._child.stdout.Parent=p._child;p._child.stdout.on("data",function(q){this.Parent._txt+=q.toString()});return(p)};this._recheckLoggedInUsers=function a(){this.enumerateUsers().then(function(o){if(o.Active.length>0){if(this.parent._linux_lock_watcher!=null&&this.parent._linux_lock_watcher.uid!=o.Active[0].uid){delete this.parent._linux_lock_watcher}this.parent._linux_lock_watcher=new g(process.env.XDG_CURRENT_DESKTOP=="Unity"?"com.ubuntu.Upstart0_6":"org.gnome.ScreenSaver",o.Active[0].uid);this.parent._linux_lock_watcher.user_session=this.parent;this.parent._linux_lock_watcher.on("signal",function(r){var q=this.user_session.enumerateUsers();q.signalData=r.data[0];q.then(function(p){switch(this.signalData){case true:case"desktop-lock":this.parent.emit("locked",p.Active[0]);break;case false:case"desktop-unlock":this.parent.emit("unlocked",p.Active[0]);break}})})}else{if(this.parent._linux_lock_watcher!=null){delete this.parent._linux_lock_watcher}}})};this.on("changed",this._recheckLoggedInUsers);this._recheckLoggedInUsers()}else{if(process.platform=="darwin"){this._users=function(){var o=require("child_process").execFile("/usr/bin/dscl",["dscl",".","list","/Users","UniqueID"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("exit\n");o.waitExit();var q=o.stdout.str.split("\n");var r,p;var s={};for(p=0;p<q.length;++p){r=q[p].split(" ");if(r[0]){s[r[0]]=r[r.length-1]}}return(s)};this._uids=function(){var o=require("child_process").execFile("/usr/bin/dscl",["dscl",".","list","/Users","UniqueID"]);o.stdout.str="";o.stdout.on("data",function(t){this.str+=t.toString()});o.stdin.write("exit\n");o.waitExit();var q=o.stdout.str.split("\n");var r,p;var s={};for(p=0;p<q.length;++p){r=q[p].split(" ");if(r[0]){s[r[r.length-1]]=r[0]}}return(s)};this._idTable=function(){var v={};var o=require("child_process").execFile("/usr/bin/id",["id"]);o.stdout.str="";o.stdout.on("data",function(y){this.str+=y.toString()});o.waitExit();var t=o.stdout.str.split("\n")[0].split(" ");for(var p=0;p<t.length;++p){var x=t[p].split("=");var w=x[1].split(",");v[x[0]]={};for(var s in w){var r=w[s].split("(");var q=r[0];var u=r[1].substring(0,r[1].length-1).trim();v[x[0]][u]=q;v[x[0]][q]=u}}return(v)};this.Current=function(o){var u={};var t=this._idTable();var p=require("child_process").execFile("/usr/bin/last",["last"]);p.stdout.str="";p.stdout.on("data",function(v){this.str+=v.toString()});p.waitExit();var s=p.stdout.str.split("\n");for(var r=0;r<s.length&&s[r].length>0;++r){if(!u[s[r].split(" ")[0]]){try{u[s[r].split(" ")[0]]={Username:s[r].split(" ")[0],State:s[r].split("still logged in").length>1?"Active":"Inactive",uid:t.uid[s[r].split(" ")[0]]}}catch(q){}}else{if(u[s[r].split(" ")[0]].State!="Active"&&s[r].split("still logged in").length>1){u[s[r].split(" ")[0]].State="Active"}}}Object.defineProperty(u,"Active",{value:showActiveOnly(u)});if(o){o.call(this,u)}}}}}if(process.platform=="linux"||process.platform=="darwin"){this._self=function b(){var o=require("child_process").execFile("/usr/bin/id",["id","-u"]);o.stdout.str="";o.stdout.on("data",function(p){this.str+=p.toString()});o.waitExit();return(parseInt(o.stdout.str))};this.isRoot=function k(){return(this._self()==0)};this.consoleUid=function e(){var o=process.platform=="darwin"?"console":((process.env.DISPLAY)?process.env.DISPLAY:":0");var p=require("child_process").execFile("/bin/sh",["sh"]);p.stdout.str="";p.stdout.on("data",function(u){this.str+=u.toString()});p.stdin.write("who\nexit\n");p.waitExit();var s=p.stdout.str.split("\n");var t,q,r;for(q in s){t=s[q].split(" ");for(r=1;r<t.length;++r){if(t[r].length>0&&(t[r]==o||t[r]==("("+o+")"))){return(parseInt(this._users()[t[0]]))}}}throw ("nobody logged into console")}}}function showActiveOnly(c){var b=[];var e={};var f=[];var d;for(var a in c){if(c[a].State=="Active"){b.push(c[a]);d=(c[a].Domain?(c[a].Domain+"\\"):"")+c[a].Username;if(!e[d]){e[d]=d}}}for(var a in e){f.push(a)}Object.defineProperty(b,"usernames",{value:f});return(b)}function getTokens(d){var a=[];var b;a.push(d.substring(0,(b=d.indexOf(" "))));while(d[++b]==" "){}a.push(d.substring(b,(b=d.substring(b).indexOf(" ")+b)));while(d[++b]==" "){}a.push(d.substring(b,(b=d.substring(b).indexOf(" ")+b)));while(d[++b]==" "){}var c=d.substring(b).trim();a.push(c);return(a)}module.exports=new UserSessions();
\ No newline at end of file
db.js
+27
-1
@@ -31,6 +31,7 @@ module.exports.CreateDB = function (parent) {
31
obj.path = require('path');
32
obj.parent = parent;
33
obj.identifier = null;
34
+ obj.dbKey = null;
35
36
if (obj.parent.args.mongodb) {
37
// Use MongoDB
@@ -44,7 +45,32 @@ module.exports.CreateDB = function (parent) {
45
// Use NeDB (The default)
46
obj.databaseType = 1;
47
Datastore = require('nedb');
47
- obj.file = new Datastore({ filename: obj.parent.getConfigFilePath('meshcentral.db'), autoload: true });
48
+ var datastoreOptions = { filename: obj.parent.getConfigFilePath('meshcentral.db'), autoload: true };
49
+
50
+ // If a DB encryption key is provided, perform database encryption
51
+ if (typeof obj.parent.args.dbencryptkey == 'string') {
52
+ // Hash the database password into a AES256 key and setup encryption and decryption.
53
+ obj.dbKey = obj.parent.crypto.createHash('sha384').update(obj.parent.args.dbencryptkey).digest("raw").slice(0, 32);
54
+ datastoreOptions.afterSerialization = function (plaintext) {
55
+ const iv = obj.parent.crypto.randomBytes(16);
56
+ const aes = obj.parent.crypto.createCipheriv('aes-256-cbc', obj.dbKey, iv);
57
+ var ciphertext = aes.update(plaintext);
58
+ ciphertext = Buffer.concat([iv, ciphertext, aes.final()]);
59
+ return ciphertext.toString('base64');
60
+ }
61
+ datastoreOptions.beforeDeserialization = function (ciphertext) {
62
+ const ciphertextBytes = Buffer.from(ciphertext, 'base64');
63
+ const iv = ciphertextBytes.slice(0, 16);
64
+ const data = ciphertextBytes.slice(16);
65
+ const aes = obj.parent.crypto.createDecipheriv('aes-256-cbc', obj.dbKey, iv);
66
+ var plaintextBytes = Buffer.from(aes.update(data));
67
+ plaintextBytes = Buffer.concat([plaintextBytes, aes.final()]);
68
+ return plaintextBytes.toString();
69
+ }
70
+ }
71
+
72
+ // Start NeDB
73
+ obj.file = new Datastore(datastoreOptions);
74
obj.file.persistence.setAutocompactionInterval(3600);
75
}
76
meshagent.js
+6
@@ -716,6 +716,12 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
716
});
717
break;
718
}
719
+ case 'openUrl':
720
+ {
721
+ // Sent by the agent to return the status of a open URL action.
722
+ // Nothing is done right now.
723
+ break;
724
+ }
725
default: {
726
console.log('Unknown agent action (' + obj.remoteaddrport + '): ' + command.action + '.');
727
break;
meshcentral.js
+4
@@ -65,9 +65,13 @@ function CreateMeshCentralServer(config, args) {
65
if ((__dirname.endsWith('/node_modules/meshcentral')) || (__dirname.endsWith('\\node_modules\\meshcentral')) || (__dirname.endsWith('/node_modules/meshcentral/')) || (__dirname.endsWith('\\node_modules\\meshcentral\\'))) {
66
obj.datapath = obj.path.join(__dirname, '../../meshcentral-data');
67
obj.filespath = obj.path.join(__dirname, '../../meshcentral-files');
68
+ if (obj.fs.existsSync(obj.path.join(__dirname, '../../meshcentral-web/views'))) { obj.webViewsPath = obj.path.join(__dirname, '../../meshcentral-web/views'); } else { obj.webViewsPath = obj.path.join(__dirname, 'views'); }
69
+ if (obj.fs.existsSync(obj.path.join(__dirname, '../../meshcentral-web/public'))) { obj.webPublicPath = obj.path.join(__dirname, '../../meshcentral-web/public'); } else { obj.webPublicPath = obj.path.join(__dirname, 'public'); }
70
} else {
71
obj.datapath = obj.path.join(__dirname, '../meshcentral-data');
72
obj.filespath = obj.path.join(__dirname, '../meshcentral-files');
73
+ if (obj.fs.existsSync(obj.path.join(__dirname, '../meshcentral-web/views'))) { obj.webViewsPath = obj.path.join(__dirname, '../meshcentral-web/views'); } else { obj.webViewsPath = obj.path.join(__dirname, 'views'); }
74
+ if (obj.fs.existsSync(obj.path.join(__dirname, '../meshcentral-web/public'))) { obj.webPublicPath = obj.path.join(__dirname, '../meshcentral-web/public'); } else { obj.webPublicPath = obj.path.join(__dirname, 'public'); }
75
}
76
77
// Create data and files folders if needed
meshrelay.js
+1
-1
@@ -96,7 +96,7 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain, user, cookie
96
97
// If this is a MeshMessenger session, the ID is the two userid's and authentication must match one of them.
98
if (obj.id.startsWith('meshmessenger/')) {
99
- if (obj.user == null) { try { obj.close(); } catch (e) { } return null; }
99
+ if ((obj.id.startsWith('meshmessenger/user/') == true) && (obj.user == null)) { try { obj.close(); } catch (e) { } return null; } // If user-to-user, both sides need to be authenticated.
100
var x = obj.id.split('/'), user1 = x[1] + '/' + x[2] + '/' + x[3], user2 = x[4] + '/' + x[5] + '/' + x[6];
101
if ((x[1] != 'user') && (x[4] != 'user')) { try { obj.close(); } catch (e) { } return null; } // MeshMessenger session must have at least one authenticated user
102
if ((x[1] == 'user') && (x[4] == 'user')) {
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.2.6-v",
3
+ "version": "0.2.6-w",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
public/scripts/agent-desktop-0.0.2.js
+2
-2
@@ -250,8 +250,8 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
250
if (obj.onMessage != null) obj.onMessage(str.substring(4, cmdsize), obj);
251
break;
252
case 65: // Alert
253
- console.error(str.substring(4));
254
- alert(str.substring(4));
253
+ str = str.substring(4);
254
+ if (str[0] != '.') { console.log(str); alert('KVM: ' + str); } else { console.log('KVM: ' + str.substring(1)); }
255
break;
256
}
257
return cmdsize;
public/styles/style-morecss.css
deleted
-745
@@ -1,745 +0,0 @@
1
-body {
2
- margin: 0;
3
- padding: 0;
4
- border: 0;
5
- color: black;
6
- font-size: 13px;
7
- font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
8
- background-color: #d3d9d6;
9
-}
10
-
11
-#container {
12
- background-color: #fff;
13
- width: 960px;
14
- min-width: 960px;
15
- margin: 0 auto;
16
- border-top: 0;
17
- border-right: 1px solid #b7b7b7;
18
- border-bottom: 0;
19
- border-left: 1px solid #b7b7b7;
20
- padding: 0;
21
-}
22
-
23
-#masthead {
24
- width: auto;
25
- margin: 0;
26
- padding: 0;
27
- overflow: auto;
28
- text-align: right;
29
- background-color: #036;
30
- width: 960px;
31
-}
32
-
33
-#column_l {
34
- position: relative;
35
- float: left;
36
- width: 930px;
37
- margin: 0;
38
- padding: 0 15px;
39
- background-color: #fff;
40
-}
41
-
42
-#footer {
43
- clear: both;
44
- overflow: auto;
45
- width: 100%;
46
- text-align: center;
47
- background-color: #113962;
48
- padding-top: 5px;
49
- padding-bottom: 5px;
50
-}
51
-
52
-#masthead img {
53
- float: left;
54
-}
55
-
56
-#masthead p {
57
- font-size: 11px;
58
- color: #fff;
59
- margin: 10px 10px 0;
60
-}
61
-
62
-#footer a {
63
- color: #fff;
64
- text-decoration: underline;
65
-}
66
-
67
- #footer a:hover {
68
- color: #fff;
69
- text-decoration: none;
70
- }
71
-
72
-a {
73
- color: #036;
74
- text-decoration: underline;
75
-}
76
-
77
-.i1 {
78
- background: url(../images/icons50.png) 0px 0px;
79
- height: 50px;
80
- width: 50px;
81
- cursor: pointer;
82
- border: none;
83
-}
84
-
85
-.i2 {
86
- background: url(../images/icons50.png) -50px 0px;
87
- height: 50px;
88
- width: 50px;
89
- cursor: pointer;
90
- border: none;
91
-}
92
-
93
-.i3 {
94
- background: url(../images/icons50.png) -100px 0px;
95
- height: 50px;
96
- width: 50px;
97
- cursor: pointer;
98
- border: none;
99
-}
100
-
101
-.i4 {
102
- background: url(../images/icons50.png) -150px 0px;
103
- height: 50px;
104
- width: 50px;
105
- cursor: pointer;
106
- border: none;
107
-}
108
-
109
-.i5 {
110
- background: url(../images/icons50.png) -200px 0px;
111
- height: 50px;
112
- width: 50px;
113
- cursor: pointer;
114
- border: none;
115
-}
116
-
117
-.i6 {
118
- background: url(../images/icons50.png) -250px 0px;
119
- height: 50px;
120
- width: 50px;
121
- cursor: pointer;
122
- border: none;
123
-}
124
-
125
-.j1 {
126
- background: url(../images/icons16.png) 0px 0px;
127
- height: 16px;
128
- width: 16px;
129
- cursor: pointer;
130
- border: none;
131
-}
132
-
133
-.j2 {
134
- background: url(../images/icons16.png) -16px 0px;
135
- height: 16px;
136
- width: 16px;
137
- cursor: pointer;
138
- border: none;
139
-}
140
-
141
-.j3 {
142
- background: url(../images/icons16.png) -32px 0px;
143
- height: 16px;
144
- width: 16px;
145
- cursor: pointer;
146
- border: none;
147
-}
148
-
149
-.j4 {
150
- background: url(../images/icons16.png) -48px 0px;
151
- height: 16px;
152
- width: 16px;
153
- cursor: pointer;
154
- border: none;
155
-}
156
-
157
-.j5 {
158
- background: url(../images/icons16.png) -64px 0px;
159
- height: 16px;
160
- width: 16px;
161
- cursor: pointer;
162
- border: none;
163
-}
164
-
165
-.j6 {
166
- background: url(../images/icons16.png) -80px 0px;
167
- height: 16px;
168
- width: 16px;
169
- cursor: pointer;
170
- border: none;
171
-}
172
-
173
-.lbbutton {
174
- width:74px;
175
- height:74px;
176
- border-radius:5px;
177
- background-color:white;
178
- margin-left:8px;
179
- margin-top:8px;
180
- position:relative;
181
- cursor:pointer;
182
- opacity:0.5;
183
-}
184
-
185
-.lbbutton:hover {
186
- opacity:1;
187
-}
188
-
189
-.lbbuttonsel {
190
- opacity:0.9;
191
-}
192
-
193
-.lbbuttonsel2 {
194
- width:82px;
195
- border-radius:5px 0px 0px 5px;
196
- opacity:1;
197
-}
198
-
199
-.lb1 {
200
- background: url(../images/leftbar-62.jpg) -0px 0px;
201
- height: 62px;
202
- width: 62px;
203
- cursor: pointer;
204
- border: none;
205
-}
206
-
207
-.lb2 {
208
- background: url(../images/leftbar-62.jpg) -75px 0px;
209
- height: 62px;
210
- width: 62px;
211
- cursor: pointer;
212
- border: none;
213
-}
214
-
215
-.lb3 {
216
- background: url(../images/leftbar-62.jpg) -150px 0px;
217
- height: 62px;
218
- width: 62px;
219
- cursor: pointer;
220
- border: none;
221
-}
222
-
223
-.lb4 {
224
- background: url(../images/leftbar-62.jpg) -225px 0px;
225
- height: 62px;
226
- width: 62px;
227
- cursor: pointer;
228
- border: none;
229
-}
230
-
231
-.lb5 {
232
- background: url(../images/leftbar-62.jpg) -294px 0px;
233
- height: 62px;
234
- width: 62px;
235
- cursor: pointer;
236
- border: none;
237
-}
238
-
239
-.lb6 {
240
- background: url(../images/leftbar-62.jpg) -360px 0px;
241
- height: 62px;
242
- width: 62px;
243
- cursor: pointer;
244
- border: none;
245
-}
246
-
247
-.m0 { background : url(../images/images16.png) -32px 0px; height : 16px; width : 16px; border:none; float:left }
248
-.m1 { background : url(../images/images16.png) -16px 0px; height : 16px; width : 16px; border:none; float:left }
249
-.m2 { background : url(../images/images16.png) -96px 0px; height : 16px; width : 16px; border:none; float:left }
250
-.m3 { background : url(../images/images16.png) -112px 0px; height : 16px; width : 16px; border:none; float:left }
251
-.si0 { background : url(../images/icons16.png) 0px 0px; height : 16px; width : 16px; border:none; float:left }
252
-.si1 { background : url(../images/icons16.png) -16px 0px; height : 16px; width : 16px; border:none; float:left }
253
-.si2 { background : url(../images/icons16.png) -32px 0px; height : 16px; width : 16px; border:none; float:left }
254
-.si3 { background : url(../images/icons16.png) -48px 0px; height : 16px; width : 16px; border:none; float:left }
255
-.si4 { background : url(../images/icons16.png) -64px 0px; height : 16px; width : 16px; border:none; float:left }
256
-
257
-.mi { background : url(../images/meshicon50.png) 0px 0px; height: 50px; width: 50px; cursor:pointer; border:none }
258
-
259
-#floatframe {
260
- position: fixed;
261
- top: 200px;
262
- height: 300px;
263
- z-index: 200;
264
- display: none;
265
-}
266
-
267
-.style1 {
268
- text-align: center;
269
-}
270
-
271
-.style2 {
272
- text-align: center;
273
- background-color: #808080;
274
- font-weight: bold;
275
-}
276
-
277
-.style3 {
278
- text-align: center;
279
- color: white;
280
- background-color: #808080;
281
- font-weight: bold;
282
-}
283
-
284
-.style3x {
285
- text-align: center;
286
- color: white;
287
- background-color: #808080;
288
- font-weight: bold;
289
-}
290
-
291
- .style3x:hover {
292
- background-color: #606060;
293
- }
294
-
295
-.style3sel {
296
- text-align: center;
297
- color: white;
298
- background-color: #003366;
299
- font-weight: bold;
300
-}
301
-
302
-.style4 {
303
- color: white;
304
- text-decoration: none;
305
-}
306
-
307
-.style5 {
308
- text-align: center;
309
- background-color: #808080;
310
- font-weight: normal;
311
-}
312
-
313
-.style6 {
314
- text-align: center;
315
- background-color: #D3D9D6;
316
-}
317
-
318
-.style7 {
319
- font-size: large;
320
- background-color: #FFFFFF;
321
-}
322
-
323
-.style10 {
324
- background-color: #C9C9C9;
325
-}
326
-
327
-.style11 {
328
- font-size: large;
329
- background-color: #C9C9C9;
330
-}
331
-
332
-.style14 {
333
- text-align: left;
334
- background-color: #D3D9D6;
335
-}
336
-
337
-.auto-style1 {
338
- text-align: right;
339
- background-color: #D3D9D6;
340
-}
341
-
342
-
343
-.fileIcon1 {
344
- background: url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);
345
- height: 16px;
346
- width: 16px;
347
- cursor: pointer;
348
- border: none;
349
- float: left;
350
- margin-top: 1px;
351
-}
352
-
353
-.fileIcon2 {
354
- background: url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);
355
- height: 16px;
356
- width: 16px;
357
- cursor: pointer;
358
- border: none;
359
- float: left;
360
- margin-top: 1px;
361
-}
362
-
363
-.fileIcon3 {
364
- background: url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);
365
- height: 16px;
366
- width: 16px;
367
- cursor: pointer;
368
- border: none;
369
- float: left;
370
- margin-top: 1px;
371
-}
372
-
373
-.fileIcon4 {
374
- background: url(../images/meshicon16.png);
375
- height: 16px;
376
- width: 16px;
377
- cursor: pointer;
378
- border: none;
379
- float: left;
380
- margin-top: 1px;
381
-}
382
-
383
-.filelist {
384
- -moz-user-select: none;
385
- -khtml-user-select: none;
386
- -webkit-user-select: none;
387
- -o-user-select: none;
388
- cursor: default;
389
- -khtml-user-drag: element;
390
- background-color: white;
391
- clear: both;
392
-}
393
-
394
-.noselect {
395
- -webkit-touch-callout: none;
396
- -webkit-user-select: none;
397
- -khtml-user-select: none;
398
- -moz-user-select: none;
399
- -ms-user-select: none;
400
- user-select: none;
401
-}
402
-
403
-.fsize {
404
- float: right;
405
- text-align: right;
406
- width: 180px;
407
-}
408
-
409
-.g1 {
410
- background-position: 0% 0%;
411
- width: 14px;
412
- height: 100%;
413
- float: left;
414
- /* fallback (Opera) */
415
- /* Mozilla: */
416
- /* Chrome, Safari:*/
417
- background-image: linear-gradient(to right, #ffffff 0%, #c9c9c9 100%);
418
- background-color: #c9c9c9;
419
- background-repeat: repeat;
420
- background-attachment: scroll;
421
-}
422
-
423
-.g1s {
424
- background-image: linear-gradient(to right, #ffffff 0%, #b9b9b9 100%);
425
-}
426
-
427
-.g2 {
428
- background-position: 0% 0%;
429
- width: 14px;
430
- height: 100%;
431
- float: right;
432
- /* fallback (Opera) */
433
- /* Mozilla: */
434
- /* Chrome, Safari:*/
435
- background-image: linear-gradient(to right, #c9c9c9 0%, #ffffff 100%);
436
- background-color: #c9c9c9;
437
- background-repeat: repeat;
438
- background-attachment: scroll;
439
-}
440
-
441
-.g2s {
442
- background-image: linear-gradient(to right, #b9b9b9 0%, #ffffff 100%);
443
-}
444
-
445
-.h1 {
446
- background-position: 0% 0%;
447
- width: 14px;
448
- height: 100%;
449
- /* fallback (Opera) */
450
- /* Mozilla: */
451
- /* Chrome, Safari:*/
452
- background-image: linear-gradient(to right, #ffffff 0%, #d3d9d6 100%);
453
- background-color: #d3d9d6;
454
- background-repeat: repeat;
455
- background-attachment: scroll;
456
-}
457
-
458
-.h2 {
459
- background-position: 0% 0%;
460
- width: 14px;
461
- height: 100%;
462
- /* fallback (Opera) */
463
- /* Mozilla: */
464
- /* Chrome, Safari:*/
465
- background-image: linear-gradient(to right, #d3d9d6 0%, #ffffff 100%);
466
- background-color: #d3d9d6;
467
- background-repeat: repeat;
468
- background-attachment: scroll;
469
-}
470
-
471
-.e1 {
472
- font-size: large;
473
- margin-top: 4px;
474
- margin-bottom: 3px;
475
- overflow: hidden;
476
- word-wrap: hyphenate;
477
- white-space: nowrap;
478
- text-overflow: ellipsis;
479
- max-width: 200px
480
-}
481
-
482
-.e2 {
483
- float: left;
484
- height: 100%;
485
-}
486
-
487
-.f1 { background-color: #c9c9c9; }
488
-.f1s { background-color: #b9b9b9; }
489
-
490
-.bar {
491
- font-size: large;
492
- background-color: #C9C9C9;
493
- height: 24px;
494
- float: left;
495
- margin-bottom: 2px;
496
-}
497
-
498
-.bar2 {
499
- font-size: large;
500
- height: 24px;
501
- float: left;
502
- margin-bottom: 2px;
503
-}
504
-
505
-.bar18 {
506
- font-size: large;
507
- background-color: #C9C9C9;
508
- height: 18px;
509
- float: left;
510
- margin-bottom: 2px;
511
-}
512
-
513
-.bar182 {
514
- font-size: large;
515
- height: 18px;
516
- float: left;
517
- margin-bottom: 2px;
518
-}
519
-
520
-.devHeaderx {
521
- color: lightgray;
522
-}
523
-
524
-.DevSt {
525
- border-bottom-style: solid;
526
- border-bottom-width: 1px;
527
- border-bottom-color: #DDDDDD;
528
-}
529
-
530
-.contextMenu {
531
- background: #F9F9F9;
532
- box-shadow: 0 0 12px rgba( 0, 0, 0, .3 );
533
- border: 1px solid #ccc;
534
- /*border-radius: 4px;*/
535
- display: none;
536
- position: absolute;
537
- top: 0;
538
- left: 0;
539
- list-style: none;
540
- margin: 0;
541
- padding: 5px;
542
- min-width: 100px;
543
- max-width: 150px;
544
- z-index: 500;
545
-}
546
-
547
-.cmtext {
548
- color: #444;
549
- display: inline-block;
550
- padding-left: 8px;
551
- padding-right: 8px;
552
- padding-top: 5px;
553
- padding-bottom: 5px;
554
- text-decoration: none;
555
- width: 85%;
556
- cursor: default;
557
- overflow: hidden;
558
- position: relative;
559
-}
560
-
561
- .cmtext:hover {
562
- color: #f9f9f9;
563
- background: #444;
564
- }
565
-
566
-.gray {
567
- /*filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");*/ /* Firefox 10+, Firefox on Android */
568
- filter: gray; /* IE6-9 */
569
- -webkit-filter: grayscale(100%) opacity(60%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */
570
-}
571
-
572
-.unselectable {
573
- -webkit-touch-callout: none;
574
- -webkit-user-select: none;
575
- -khtml-user-select: none;
576
- -moz-user-select: none;
577
- -ms-user-select: none;
578
- user-select: none;
579
-}
580
-
581
-.notifiyBox {
582
- position: absolute;
583
- z-index:1000;
584
- top: 50px;
585
- right: 26px;
586
- width: 300px;
587
- text-align: left;
588
- background-color: #F0ECCD;
589
- border: 4px solid #666;
590
- -webkit-border-radius: 10px;
591
- -moz-border-radius: 10px;
592
- border-radius: 10px;
593
- -webkit-box-shadow: 2px 2px 4px #888;
594
- -moz-box-shadow: 2px 2px 4px #888;
595
- box-shadow: 2px 2px 4px #888;
596
- max-height:200px;
597
-}
598
-
599
-.notifiyBox:before {
600
- content: ' ';
601
- position: absolute;
602
- width: 0;
603
- height: 0;
604
- right: 5px;
605
- top: -30px;
606
- border: 15px solid;
607
- border-color: transparent #666 #666 transparent;
608
-}
609
-
610
-.notifiyBox:after {
611
- content: ' ';
612
- position: absolute;
613
- width: 0;
614
- height: 0;
615
- right: 7px;
616
- top: -24px;
617
- border: 12px solid;
618
- border-color: transparent #F0ECCD #F0ECCD transparent;
619
-}
620
-
621
-.notification {
622
- width:100%;
623
- min-height:30px;
624
-}
625
-
626
-.notification:hover {
627
- background-color: #EFE8B6;
628
-}
629
-
630
-.deskToolsBar {
631
- padding:3px;
632
-}
633
-
634
-.deskToolsBar:hover {
635
- background-color: #EFE8B6;
636
-}
637
-
638
-.userTableHeader {
639
- border-bottom: 1pt solid lightgray;
640
- padding-top: 4px;
641
- padding-bottom: 4px;
642
-}
643
-
644
-.viewSelector {
645
- width:32px;
646
- height:32px;
647
- background-color:#DDD;
648
- border-radius:3px;
649
- float:left;
650
- margin-left:5px;
651
- cursor: pointer;
652
- opacity: 0.3;
653
-}
654
-
655
-.viewSelectorSel {
656
- background-color:#BBB;
657
- opacity: 0.8;
658
-}
659
-
660
- .viewSelector:hover {
661
- opacity: 0.5;
662
- background-color:#AAA;
663
- }
664
-
665
-
666
-.viewSelector1 {
667
- margin-left:2px;
668
- margin-top:2px;
669
- background: url(../images/views.png) -0px 0px;
670
- height: 28px;
671
- width: 28px;
672
-}
673
-
674
-.viewSelector2 {
675
- margin-left:2px;
676
- margin-top:2px;
677
- background: url(../images/views.png) -28px 0px;
678
- height: 28px;
679
- width: 28px;
680
-}
681
-
682
-.viewSelector3 {
683
- margin-left:2px;
684
- margin-top:2px;
685
- background: url(../images/views.png) -56px 0px;
686
- height: 28px;
687
- width: 28px;
688
-}
689
-
690
-.viewSelector4 {
691
- margin-left:2px;
692
- margin-top:2px;
693
- background: url(../images/views.png) -84px 0px;
694
- height: 28px;
695
- width: 28px;
696
-}
697
-
698
-.viewSelector5 {
699
- margin-left:2px;
700
- margin-top:2px;
701
- background: url(../images/views.png) -112px 0px;
702
- height: 28px;
703
- width: 28px;
704
-}
705
-
706
-.backButtonEx {
707
- margin-left:2px;
708
- margin-top:2px;
709
- background: url(../images/views.png) -140px 0px;
710
- height: 28px;
711
- width: 28px;
712
-}
713
-
714
-.backButton {
715
- width:32px;
716
- height:32px;
717
- background-color:#DDD;
718
- border-radius:3px;
719
- float:left;
720
- margin-right:5px;
721
- cursor: pointer;
722
- opacity: 0.3;
723
-}
724
- .backButton:hover {
725
- opacity: 0.5;
726
- background-color:#AAA;
727
- }
728
-
729
-.hoverButton {
730
- opacity: 0.5;
731
-}
732
-
733
- .hoverButton:hover {
734
- opacity: 1;
735
- }
736
-
737
-
738
-.devgrid-container {
739
- display: grid;
740
- grid-template-columns: repeat(auto-fit, minmax(300px, auto));
741
-}
742
-
743
-.devgrid-container > div {
744
-
745
-}
\ No newline at end of file
views/default-min.handlebars
+1
-1
@@ -1 +1 @@
1
-<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <style>body{margin:0;padding:0;border:0;color:black;font-size:13px;font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;background-color:#d3d9d6;}#container{background-color:#fff;width:960px;min-width:960px;margin:0 auto;border-top:0;border-right:1px solid #b7b7b7;border-bottom:0;border-left:1px solid #b7b7b7;padding:0;}#masthead{width:auto;margin:0;padding:0;overflow:auto;text-align:right;background-color:#036;width:960px;}#column_l{position:relative;float:left;width:930px;margin:0;padding:0 15px;background-color:#fff;}#footer{clear:both;overflow:auto;width:100%;text-align:center;background-color:#113962;padding-top:5px;padding-bottom:5px;}#masthead img{float:left;}#masthead p{font-size:11px;color:#fff;margin:10px 10px 0;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}a{color:#036;text-decoration:underline;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;cursor:pointer;border:none;}.j1{background:url(../images/icons16.png) 0px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j2{background:url(../images/icons16.png) -16px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j3{background:url(../images/icons16.png) -32px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j4{background:url(../images/icons16.png) -48px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j5{background:url(../images/icons16.png) -64px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j6{background:url(../images/icons16.png) -80px 0px;height:16px;width:16px;cursor:pointer;border:none;}.lbbutton{width:74px;height:74px;border-radius:5px;background-color:white;margin-left:8px;margin-top:8px;position:relative;cursor:pointer;opacity:0.5;}.lbbutton:hover{opacity:1;}.lbbuttonsel{opacity:0.9;}.lbbuttonsel2{width:82px;border-radius:5px 0px 0px 5px;opacity:1;}.lb1{background:url(../images/leftbar-62.jpg) -0px 0px;height:62px;width:62px;cursor:pointer;border:none;}.lb2{background:url(../images/leftbar-62.jpg) -75px 0px;height:62px;width:62px;cursor:pointer;border:none;}.lb3{background:url(../images/leftbar-62.jpg) -150px 0px;height:62px;width:62px;cursor:pointer;border:none;}.lb4{background:url(../images/leftbar-62.jpg) -225px 0px;height:62px;width:62px;cursor:pointer;border:none;}.lb5{background:url(../images/leftbar-62.jpg) -294px 0px;height:62px;width:62px;cursor:pointer;border:none;}.lb6{background:url(../images/leftbar-62.jpg) -360px 0px;height:62px;width:62px;cursor:pointer;border:none;}.m0{background :url(../images/images16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.m1{background :url(../images/images16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.m2{background :url(../images/images16.png) -96px 0px;height :16px;width :16px;border:none;float:left }.m3{background :url(../images/images16.png) -112px 0px;height :16px;width :16px;border:none;float:left }.si0{background :url(../images/icons16.png) 0px 0px;height :16px;width :16px;border:none;float:left }.si1{background :url(../images/icons16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.si2{background :url(../images/icons16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.si3{background :url(../images/icons16.png) -48px 0px;height :16px;width :16px;border:none;float:left }.si4{background :url(../images/icons16.png) -64px 0px;height :16px;width :16px;border:none;float:left }.mi{background :url(../images/meshicon50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none }#floatframe{position:fixed;top:200px;height:300px;z-index:200;display:none;}.style1{text-align:center;}.style2{text-align:center;background-color:#808080;font-weight:bold;}.style3{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style3x{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style3x:hover{background-color:#606060;}.style3sel{text-align:center;color:white;background-color:#003366;font-weight:bold;}.style4{color:white;text-decoration:none;}.style5{text-align:center;background-color:#808080;font-weight:normal;}.style6{text-align:center;background-color:#D3D9D6;}.style7{font-size:large;background-color:#FFFFFF;}.style10{background-color:#C9C9C9;}.style11{font-size:large;background-color:#C9C9C9;}.style14{text-align:left;background-color:#D3D9D6;}.auto-style1{text-align:right;background-color:#D3D9D6;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fsize{float:right;text-align:right;width:180px;}.g1{background-position:0% 0%;width:14px;height:100%;float:left; background-image:linear-gradient(to right, #ffffff 0%, #c9c9c9 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.g1s{background-image:linear-gradient(to right, #ffffff 0%, #b9b9b9 100%);}.g2{background-position:0% 0%;width:14px;height:100%;float:right; background-image:linear-gradient(to right, #c9c9c9 0%, #ffffff 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.g2s{background-image:linear-gradient(to right, #b9b9b9 0%, #ffffff 100%);}.h1{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #ffffff 0%, #d3d9d6 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.h2{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #d3d9d6 0%, #ffffff 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.e1{font-size:large;margin-top:4px;margin-bottom:3px;overflow:hidden;word-wrap:hyphenate;white-space:nowrap;text-overflow:ellipsis;}.e2{float:left;height:100%;background-color:#c9c9c9;}.e2s{background-color:#b9b9b9;}.bar{font-size:large;background-color:#C9C9C9;height:24px;float:left;margin-bottom:2px;}.bar2{font-size:large;height:24px;float:left;margin-bottom:2px;}.bar18{font-size:large;background-color:#C9C9C9;height:18px;float:left;margin-bottom:2px;}.bar182{font-size:large;height:18px;float:left;margin-bottom:2px;}.devHeaderx{color:lightgray;}.DevSt{border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.contextMenu{background:#F9F9F9;box-shadow:0 0 12px rgba( 0, 0, 0, .3 );border:1px solid #ccc; display:none;position:absolute;top:0;left:0;list-style:none;margin:0;padding:5px;min-width:100px;max-width:150px;z-index:500;}.cmtext{color:#444;display:inline-block;padding-left:8px;padding-right:8px;padding-top:5px;padding-bottom:5px;text-decoration:none;width:85%;cursor:default;overflow:hidden;position:relative;}.cmtext:hover{color:#f9f9f9;background:#444;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.notifiyBox{position:absolute;z-index:1000;top:50px;right:26px;width:300px;text-align:left;background-color:#F0ECCD;border:4px solid #666;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-box-shadow:2px 2px 4px #888;-moz-box-shadow:2px 2px 4px #888;box-shadow:2px 2px 4px #888;max-height:200px;}.notifiyBox:before{content:' ';position:absolute;width:0;height:0;right:5px;top:-30px;border:15px solid;border-color:transparent #666 #666 transparent;}.notifiyBox:after{content:' ';position:absolute;width:0;height:0;right:7px;top:-24px;border:12px solid;border-color:transparent #F0ECCD #F0ECCD transparent;}.notification{width:100%;min-height:30px;}.notification:hover{background-color:#EFE8B6;}.deskToolsBar{padding:3px;}.deskToolsBar:hover{background-color:#EFE8B6;}.userTableHeader{border-bottom:1pt solid lightgray;padding-top:4px;padding-bottom:4px;}.viewSelector{width:32px;height:32px;background-color:#DDD;border-radius:3px;float:left;margin-left:5px;cursor:pointer;opacity:0.3;}.viewSelectorSel{background-color:#BBB;opacity:0.8;}.viewSelector:hover{opacity:0.5;background-color:#AAA;}.viewSelector1{margin-left:2px;margin-top:2px;background:url(../images/views.png) -0px 0px;height:28px;width:28px;}.viewSelector2{margin-left:2px;margin-top:2px;background:url(../images/views.png) -28px 0px;height:28px;width:28px;}.viewSelector3{margin-left:2px;margin-top:2px;background:url(../images/views.png) -56px 0px;height:28px;width:28px;}.viewSelector4{margin-left:2px;margin-top:2px;background:url(../images/views.png) -84px 0px;height:28px;width:28px;}.viewSelector5{margin-left:2px;margin-top:2px;background:url(../images/views.png) -112px 0px;height:28px;width:28px;}.backButtonEx{margin-left:2px;margin-top:2px;background:url(../images/views.png) -140px 0px;height:28px;width:28px;}.backButton{width:32px;height:32px;background-color:#DDD;border-radius:3px;float:left;margin-right:5px;cursor:pointer;opacity:0.3;}.backButton:hover{opacity:0.5;background-color:#AAA;}.hoverButton{opacity:0.5;}.hoverButton:hover{opacity:1;}</style> <style>.ol-box{box-sizing:border-box;border-radius:2px;border:2px solid #00f;}.ol-mouse-position{top:8px;right:8px;position:absolute;}.ol-scale-line{background:rgba(0,60,136,.3);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute;}.ol-scale-line-inner{border:1px solid #eee;border-top:none;color:#eee;font-size:10px;text-align:center;margin:1px;will-change:contents,width;}.ol-overlay-container{will-change:left,right,top,bottom;}.ol-unsupported{display:none;}.ol-unselectable, .ol-viewport{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto;}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing;}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab;}.ol-control{position:absolute;background-color:rgba(255,255,255,.4);border-radius:4px;padding:2px;}.ol-control:hover{background-color:rgba(255,255,255,.6);}.ol-zoom{top:.5em;right:.5em;}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear;}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s;}.ol-zoom-extent{top:4.643em;left:.5em;}.ol-full-screen{right:.5em;top:.5em;}@media print{.ol-control{display:none;}}.ol-control button{display:block;margin:1px;padding:0;color:#fff;font-size:1.14em;font-weight:700;text-decoration:none;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:rgba(0,60,136,.5);border:none;border-radius:2px;}.ol-control button::-moz-focus-inner{border:none;padding:0;}.ol-zoom-extent button{line-height:1.4em;}.ol-compass{display:block;font-weight:400;font-size:1.2em;will-change:transform;}.ol-touch .ol-control button{font-size:1.5em;}.ol-touch .ol-zoom-extent{top:5.5em;}.ol-control button:focus, .ol-control button:hover{text-decoration:none;background-color:rgba(0,60,136,.7);}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0;}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px;}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);}.ol-attribution ul{margin:0;padding:0 .5em;font-size:.7rem;line-height:1.375em;color:#000;text-shadow:0 0 2px #fff;}.ol-attribution li{display:inline;list-style:none;line-height:inherit;}.ol-attribution li:not(:last-child):after{content:" ";}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle;}.ol-attribution button, .ol-attribution ul{display:inline-block;}.ol-attribution.ol-collapsed ul{display:none;}.ol-attribution.ol-logo-only ul{display:block;}.ol-attribution:not(.ol-collapsed){background:rgba(255,255,255,.8);}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0;height:1.1em;line-height:1em;}.ol-attribution.ol-logo-only{background:0 0;bottom:.4em;height:1.1em;line-height:1em;}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em;}.ol-attribution.ol-logo-only button, .ol-attribution.ol-uncollapsible button{display:none;}.ol-zoomslider{top:4.5em;left:.5em;height:200px;}.ol-zoomslider button{position:relative;height:10px;}.ol-touch .ol-zoomslider{top:5.5em;}.ol-overviewmap{left:.5em;bottom:.5em;}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0;}.ol-overviewmap .ol-overviewmap-map, .ol-overviewmap button{display:inline-block;}.ol-overviewmap .ol-overviewmap-map{border:1px solid #7b98bc;height:150px;margin:2px;width:150px;}.ol-overviewmap:not(.ol-collapsed) button{bottom:1px;left:2px;position:absolute;}.ol-overviewmap.ol-collapsed .ol-overviewmap-map, .ol-overviewmap.ol-uncollapsible button{display:none;}.ol-overviewmap:not(.ol-collapsed){background:rgba(255,255,255,.8);}.ol-overviewmap-box{border:2px dotted rgba(0,60,136,.7);}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move;}</style> <style> .ol-ctx-menu-container{position:absolute;padding:8px;background:#fff;color:#222;font-size:13px;border-radius:5px;box-shadow:3px 3px 5px rgba(0,0,0,.2);box-sizing:border-box}.ol-ctx-menu-container a,.ol-ctx-menu-container div,.ol-ctx-menu-container img,.ol-ctx-menu-container li,.ol-ctx-menu-container span,.ol-ctx-menu-container ul{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}.ol-ctx-menu-container a img{border:none}.ol-ctx-menu-container *,.ol-ctx-menu-container :after,.ol-ctx-menu-container :before{box-sizing:inherit}.ol-ctx-menu-container.ol-ctx-menu-hidden{opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container ul{list-style:none}.ol-ctx-menu-container li{position:relative;line-height:20px;padding:2px 5px}.ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover{cursor:pointer;background-color:#333;color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-submenu .ol-ctx-menu-container{border:1px solid #eee;padding:8px;top:0;opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover .ol-ctx-menu-container{opacity:1;visibility:visible;-webkit-transition-delay:0s;transition-delay:0s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:after{position:absolute;top:7px;right:10px;content:"";display:inline-block;width:.6em;height:.6em;border-right:.3em solid #222;border-top:.3em solid #222;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover:after{border-color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-separator{padding:0}.ol-ctx-menu-container li.ol-ctx-menu-separator hr{border:0;height:1px;background-image:-webkit-linear-gradient(right,transparent,rgba(0,0,0,.75),transparent);background-image:linear-gradient(270deg,transparent,rgba(0,0,0,.75),transparent)}.ol-ctx-menu-icon{text-indent:20px;background-size:20px auto;background-repeat:no-repeat;background-position:0}.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg==")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII=")}.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC")}</style> <script type="text/javascript" src="scripts/charts.js"></script> <script type="text/javascript" src="scripts/filesaver.1.1.20151003.js"></script> <script type="text/javascript" src="scripts/ol.js"></script> <script type="text/javascript" src="scripts/ol3-contextmenu.js"></script> <title>MeshCentral</title> </head> <body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none"> <div id="contextMenu" class="contextMenu" style="display:none"> <div id="cxinfo" class="cmtext" onclick="cmaction(1)"><b>Information</b></div> <div id="cxdesktop" class="cmtext" onclick="cmaction(3)">Desktop</div> <div id="cxterminal" class="cmtext" onclick="cmaction(2)">Terminal</div> <div id="cxfiles" class="cmtext" onclick="cmaction(4)">Files</div> <div id="cxevents" class="cmtext" onclick="cmaction(5)">Events</div> <div id="cxconsole" class="cmtext" onclick="cmaction(6)">Console</div> <hr id="cxmgroupsplit"> <div id="cxmdesktop" class="cmtext" onclick="cmaction(7)" style="display:none">Multi-Desktop</div> </div> <div id="meshContextMenu" class="contextMenu" style="display:none;min-width:0px"> <div id="cxselectall" class="cmtext" onclick="cmmeshaction(1)">Select All</div> <div id="cxselectnone" class="cmtext" onclick="cmmeshaction(2)">Select None</div> <hr id="cxmgroupsplit2" style="display:none"> <div id="cxmmdesktop" class="cmtext" style="display:none" onclick="cmmeshaction(3)">Multi-Desktop</div> </div> <div id="container" style="max-height:100vh;position:relative"> <div id="notifiyBox" class="notifiyBox" style="display:none"></div> <div id="mastheadx"></div> <div id="masthead" class="noselect" style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px"> <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px"> <strong><font style="font-size:14px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> <div style="float:right"> <div id="notificationCount" onclick="clickNotificationIcon()" class="unselectable" style="display:none;min-width:28px;font-size:20px;border-radius:5px;background-color:lightblue;text-align:center;margin:8px;cursor:pointer;padding:4px" title="Click to view current notifications">0</div> </div> <p id="logoutControl">{{{logoutControl}}}</p> </div> <div id="page_leftbar" style="height:calc(100vh - 66px);width:90px;position:absolute;z-index:1000;background:#113962;background:linear-gradient(to bottom, #104893 0%,#113962 100%);color:white;display:none"> <div style="height:16px"></div> <div id="LeftMenuMyDevices" class="lbbutton lbbuttonsel" title="My Devices" onclick="go(1)"> <div class="lb2" style="position:absolute;top:6px;left:6px"></div> </div> <div id="LeftMenuMyAccount" class="lbbutton" title="My Account" onclick="go(2)"> <div class="lb1" style="position:absolute;top:6px;left:6px"></div> </div> <div id="LeftMenuMyEvents" class="lbbutton" title="My Events" onclick="go(3)"> <div class="lb3" style="position:absolute;top:6px;left:6px"></div> </div> <div id="LeftMenuMyFiles" class="lbbutton" title="My Files" onclick="go(5)"> <div class="lb4" style="position:absolute;top:6px;left:6px"></div> </div> <div id="LeftMenuMyUsers" class="lbbutton" title="My Users" onclick="go(4)"> <div class="lb5" style="position:absolute;top:6px;left:6px"></div> </div> <div id="LeftMenuMyServer" class="lbbutton" title="My Server" onclick="go(6)" style="display:none"> <div class="lb6" style="position:absolute;top:6px;left:6px"></div> </div> </div> <div id="page_content" style="max-height:calc(100vh - 130px)"> <div id="topbarmaster"> <div id="topbar" class="noselect"> <div> <div style="position:relative"> <div style="position:absolute;top:3px;right:6px"> <span title="Toggle full width" style="cursor:pointer;color:white" onclick="toggleFullScreen(1)">↔</span> </div> <table id="MainMenuSpan" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MainMenuMyDevices" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(1)">My Devices</td> <td id="MainMenuMyAccount" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(2)">My Account</td> <td id="MainMenuMyEvents" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(3)">My Events</td> <td id="MainMenuMyFiles" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(5)">My Files</td> <td id="MainMenuMyUsers" style="width:100px;height:24px;cursor:pointer;display:none" class="style3x" onclick="go(4)">My Users</td> <td id="MainMenuMyServer" style="width:100px;height:24px;cursor:pointer;display:none" class="style3x" onclick="go(6)">My Server</td> <td class="style3" style="text-align:right;height:24px"> </td> </tr> </table> <div id="MainSubMenuSpan" style="display:none"> <table id="MainSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MainDev" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(10)">General</td> <td id="MainDevDesktop" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(11)">Desktop</td> <td id="MainDevTerminal" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(12)">Terminal</td> <td id="MainDevFiles" style="width:100px;height:24px;cursor:pointer;display:none" class="style3x" onclick="go(13)">Files</td> <td id="MainDevEvents" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(16)">Events</td> <td id="MainDevAmt" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(14)">Intel® AMT</td> <td id="MainDevConsole" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(15)">Console</td> <td class="style3" style="height:24px"> </td> </tr> </table> </div> <div id="MeshSubMenuSpan" style="display:none"> <table id="MeshSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MeshGeneral" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(20)">General</td> <td class="style3" style="height:24px"> </td> </tr> </table> </div> <div id="UserSubMenuSpan" style="display:none"> <table id="UserSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="UserGeneral" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(30)">General</td> <td id="UserEvents" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(31)">Events</td> <td class="style3" style="height:24px"> </td> </tr> </table> </div> <div id="UserDummyMenuSpan"> <table id="UserDummyMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr><td class="style3" style="text-align:right;height:24px"> </td></tr> </table> </div> </div> </div> </div> </div> <div id="column_l"> <div id="p0" style="display:none"> <div id="p0message" style="margin:50px;text-align:center">Server disconnected, <href onclick="reload()" style="cursor:pointer"><u>click to reconnect</u></href>.</div> </div> <div id="p1" style="display:none"> <div style="float:right" id="devListToolbarViewIcons"> <div id="devViewButton1" class="viewSelector" onclick="onDeviceViewChange(1)" title="Columns"><div class="viewSelector2"></div></div> <div id="devViewButton2" class="viewSelector" onclick="onDeviceViewChange(2)" title="List"><div class="viewSelector1"></div></div> <div id="devViewButton3" class="viewSelector" onclick="onDeviceViewChange(3)" title="Desktops"><div class="viewSelector3"></div></div> <div id="devViewButton4" class="viewSelector" onclick="onDeviceViewChange(4)" title="Map"><div class="viewSelector4"></div></div> </div><div><h1>My Devices</h1></div> <table style="width:100%;height:24px;background-color:#d3d9d6;vertical-align:middle;border-spacing:0"> <tr> <td class="h1"></td> <td id="devListToolbar" class="style14"> <input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All"> <input type="button" id="GroupActionButton" disabled="disabled" value="Group Action" onclick="groupActionFunction()"> <input id="SearchInput" type="text" style="width:120px" placeholder="Filter" onchange="onSearchInputChanged()" onkeyup="onSearchInputChanged()" autocomplete="off" onfocus="onSearchFocus(1)" onblur="onSearchFocus(0)"> <input type="checkbox" id="RealNameCheckBox" onclick="onRealNameCheckBox()"><span title="Show devices operating system name">OS Name</span> </td> <td id="kvmListToolbar" class="style14" style="height:100%"> <input type="button" onclick="connectAllKvmFunction()" value="Connect All"> <input type="button" onclick="disconnectAllKvmFunction()" value="Disconnect All"> <input type="checkbox" id="autoConnectDesktopCheckbox" onclick="autoConnectDesktops(event)" title="Automatic connect">Auto <input type="button" onclick="showMultiDesktopSettings()" value="Settings"> </td> <td id="devMapToolbar" class="style14" style="height:100%"> <input type="text" id="mapSearchLocation" placeholder="Search Location" onfocus="onMapSearchFocus(1)" onblur="onMapSearchFocus(0)"> <input type="button" value="Search" title="Search for location" onclick="getSearchLocation()"> <input type="button" id="refreshmap" title="Reset map view" value="Reset" style="margin-left:5px" onclick="refreshMap(false,true)"> </td> <td class="auto-style1" style="height:100%"> <div style="float:right;display:none" id="devListToolbarView"> View <select id="viewselect" onchange="onDeviceViewChange()"> <option value="1">Columns <option value="2">List <option value="3">Desktops <option id="viewselectmapoption" value="4">Map </select> </div> <div style="float:right" id="devListToolbarSort"> Sort <select id="sortselect" onchange="onSortSelectChange()"> <option>Group <option>Power <option>Device <option>Tags </select> </div> <div style="float:right" id="devListToolbarSize"> Size <select id="sizeselect" onchange="onDeviceViewChange()"> <option value="0">Small <option value="1">Medium <option value="2">Large </select> </div> </td> <td class="h2"></td> </tr> </table> <div id="NoMeshesPanel" style="display:none"> <table style="width:100%;padding:20px"> <tr> <td valign="top" style="width:50px"> <img src="images/info.png" height="48" width="47"> </td> <td> To get started, <a onclick="account_createMesh()" style="cursor:pointer"><strong>click here to create a device group</strong></a>. </td> </tr> </table> </div> <div id="xdevices" style="max-height:calc(100vh - 239px);overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch"></div> <div id="xdevicesmap" style="height:calc(100vh - 239px);width:100%;overflow:hidden;position:relative"> <div id="xmapSearchResultsDlg" style="position:absolute;display:none;max-height:280px;left:5px;top:5px;max-width:250px;z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="xmapSearchClose" style="float:right;padding:5px;cursor:pointer" onclick="mapCloseSearchWindow()"><b>X</b></div> <div style="padding:5px">Location Results</div> <div style="width:100%;margin:6px"></div> </div> <div id="xmapSearchResults" style="margin:6px"></div> </div> </div> <div id="xmap-info-window" style="text-shadow:0px 0px 15px #FFF"></div> </div> <div id="p2" style="display:none"> <h1>My Account</h1> <div id="p2AccountActions"> <p><strong><img alt="" width="150" height="103" src="images/mainaccount.jpg" style="margin-bottom:10px;margin-right:20px;float:right">Account actions</strong></p> <p style="margin-left:40px"> <span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a><br></span> <span id="otpAuth" style="display:none"><a onclick="account_addOtp()" style="cursor:pointer">Add 2-step login</a><br></span> <span id="otpAuthRemove" style="display:none"><a onclick="account_removeOtp()" style="cursor:pointer">Remove 2-step login</a><br></span> <a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a><br> <a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><br> <a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a><br> </p> <br style="clear:both"> </div> <strong>Device Groups</strong> ( <a onclick="account_createMesh()" style="cursor:pointer"><img height="12" src="images/icon-addnew.png" width="12" border="0"> New</a> ) <br><br> <div id="p2meshes"></div> <div id="p2noMeshFound" style="margin-left:40px;display:none">No device groups. <a onclick="account_createMesh()" style="cursor:pointer"><strong>Get started here!</strong></a></div> <br style="clear:both"> </div> <div id="p3" style="display:none"> <h1>My Events</h1> <table style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0"> <tr> <td class="h1"></td> <td> <input id="p2deleteall" type="button" onclick="showDeleteAllEventsDialog()" style="display:none" value="Delete All..."></td> <td class="auto-style1"> Show <select id="p3limitdropdown" onchange="refreshEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> </td> <td class="h2"></td> </tr> </table> <div id="p3events" style="height:calc(100vh - 243px);overflow-y:scroll"></div> </div> <div id="p4" style="display:none"> <h1>My Users</h1> <table style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0"> <tr> <td class="h1"></td> <td class="style14"> <input type="button" onclick="showCreateNewAccountDialog()" value="New Account..."> <input id="UserSearchInput" type="text" style="width:120px" placeholder="Filter" onchange="onUserSearchInputChanged()" onkeyup="onUserSearchInputChanged()" autocomplete="off" onfocus="onUserSearchFocus(1)" onblur="onUserSearchFocus(0)"> </td> <td class="h2"></td> </tr> </table> <div id="p3users" style="max-height:calc(100vh - 243px);overflow-y:auto"></div> </div> <div id="p5" style="display:none"> <h1>My Files</h1> <table id="p5toolbar" style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div id="p5rightOfButtons" style="float:right;margin-top:3px"></div> <div> <input type="button" id="p5FolderUp" disabled="disabled" onclick="p5folderup();" value="Up"> <input type="button" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile();" value="Select All" onkeypress="return false;" onkeydown="return false;"> <input type="button" id="p5RenameFileButton" disabled="disabled" value="Rename" onclick="p5renamefile();" onkeypress="return false;" onkeydown="return false;"> <input type="button" id="p5DeleteFileButton" disabled="disabled" value="Delete" onclick="p5deletefile();" onkeypress="return false;" onkeydown="return false;"> <input type="button" id="p5NewFolderButton" disabled="disabled" value="New Folder" onclick="p5createfolder();" onkeypress="return false;" onkeydown="return false;"> <input type="button" id="p5UploadButton" disabled="disabled" value="Upload" onclick="p5uploadFile()" onkeypress="return false;" onkeydown="return false;"> <input type="button" id="p5CutButton" disabled="disabled" value="Cut" onclick="p5copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" id="p5CopyButton" disabled="disabled" value="Copy" onclick="p5copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" id="p5PasteButton" disabled="disabled" value="Paste" onclick="p5pasteFile()" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <div style="float:right"> <select id="p5sortdropdown" onchange="updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </div> <div> <span id="p5currentpath"></span></div> </td> </tr> </table> <div id="p5filetable" style="width:100%;height:calc(100vh - 294px);overflow:auto;-webkit-user-select:none;position:relative"> <div id="p5PublicShare" style="display:none;width:100%;overflow:auto;-webkit-user-select:none;background-color:lightsteelblue"><div style="padding:4px">These files are shared publicly, click "link" to get public url.</div></div> <div id="bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✓</b></div> <div id="bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✗</b></div> <span id="p5files"></span> </div> <table id="p5toolbarBottom" style="width:100%" cellpadding="0" cellspacing="0"> <tr><td class="style6" style="text-align:left;padding:3px"> <span id="p5bottomstatus"></span></td></tr> </table> </div> <div id="p6" style="display:none"> <img id="MainMeshImage" src="serverpic.ashx" style="border-width:0px;height:200px;width:200px;float:right"> <h1>My Server</h1> <p id="p2ServerActions"><strong>Server actions</strong></p> <p style="margin-left:40px"> <a id="p2ServerActionsBackup" href="/backup.zip" rel="noreferrer noopener" target="_blank" style="cursor:pointer">Download server backup</a><br> <a id="p2ServerActionsRestore" onclick="server_showRestoreDlg()" style="cursor:pointer">Restore server with backup</a><br> <a id="p2ServerActionsVersion" onclick="server_showVersionDlg()" style="cursor:pointer">Check server version</a><br> <a id="p2ServerActionsErrors" onclick="server_showErrorsDlg()" style="cursor:pointer">Show server error log</a><br> </p> <br><strong>Server Statistics</strong><br><br> <div id="serverStats" style="margin-left:40px"> <div id="serverCpuChartView" style="display:none"> <div style="width:60px;display:inline-block"><canvas id="serverCpuChart" style="width:60px;height:60px"></canvas></div> <div style="width:160px;display:inline-block" id="serverCpuChartText"></div> </div> <div id="serverMemoryChartView" style="display:none"> <div style="width:60px;display:inline-block"><canvas id="serverMemoryChart" style="width:60px;height:60px"></canvas></div> <div style="width:160px;display:inline-block" id="serverMemoryChartText"></div> </div><br><br> <div id="serverStatsTable"></div> </div> </div> <div id="p10" style="display:none"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:auto" valign="top"> <div id="p10title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>General - <span id="p10deviceName"></span></h1> </div> <div id="p10html"></div> </td> <td style="width:20px"></td> <td style="width:200px"> <a style="cursor:pointer" onclick="p10showiconselector()"><img id="MainComputerImage" style="border-width:0px;height:200px;width:200px"></a> <div style="width:100%;text-align:center"><strong><span id="MainComputerState"></span></strong></div> </td> </tr> </table><br> <div id="p10html2"></div> <div id="p10html3"></div> </div> <div id="p11" class="noselect" style="display:none"> <div id="p11title"> <div id="p11deviceNameHeader"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <div style="float:right" id="devListToolbarViewIcons"><div class="viewSelector" onclick="deskToggleFull(event)" title="Full Screen. Hold shift to browser full screen."><div class="viewSelector5"></div></div></div> <h1>Desktop - <span id="p11deviceName"></span></h1> </div> </div> <div id="p14warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showFeaturesDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel® AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div> </div> <div id="p14warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showPowerActionDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div> </div> <table id="deskarea0" cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr id="deskarea1"> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <span id="p14power"></span> <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Left" onclick="drotate(-1)">↺</div> <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Right" onclick="drotate(1)">↻</div> <input id="deskFocusBtn" type="button" title="Toggle focus mode, when active only the region around the mouse is updated" onkeypress="return false" onkeydown="return false" value="Focus All" onclick="deskToggleFocus()" style="margin-right:3px;display:none"> <input id="deskSaveBtn" type="button" title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value="Save..." onclick="deskSaveImage()" style="margin-right:3px"> <input id="deskActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> <input id="deskActionsSettings" type="button" value="Settings..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()" style="margin-right:3px"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="margin-right:3px;display:none"> </div> <div> <div id="idx_deskFullBtn2" onclick="deskToggleFull(event)" style="float:left;font-size:large;cursor:pointer;display:none"> ✖</div> <input type="button" id="autoconnectbutton1" value="AutoConnect" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <span id="connectbutton1span"> <input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1hspan"> <input type="button" id="connectbutton1h" value="HW Connect" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="disconnectbutton1span"> <input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span> <span id="deskstatus">Disconnected</span> </div> </td> </tr> <tr id="deskarea2"> <td> <div style="background-color:gray"><div id="progressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr id="deskarea3"> <td id="deskarea3x" style="background:black;text-align:center;position:relative;overflow:hidden"> <div id="DeskFocus" style="overflow:hidden;color:transparent;border:3px dotted rgba(255,0,0,.2);position:absolute;border-radius:5px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)"></div> <div id="DeskParent" style="overflow:hidden"> <canvas id="Desk" width="640" height="480" style="overflow:hidden;width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)" onmousewheel="dmousewheel(event)"></canvas> </div> <div id="DeskTools" style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none"> <a id="DeskToolsRefreshButton" style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a> <div id="DeskToolsBar" style="position:absolute;padding:3px;border-radius:3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div> <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left"> <div style="border-bottom:1px solid darkgray;padding:3px"><a style="width:50px;padding-right:5px;float:left;cursor:pointer" title="Sort by process id" onclick="sortProcess(0)">PID</a><a style="cursor:pointer" title="Sort by name" onclick="sortProcess(1)">Name</a></div> <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div> </div> </div> </td> </tr> <tr id="deskarea4"> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onclick="deskGetDisplayNumbers(event)"></select> <input id="DeskToolsButton" type="button" value="Tools" title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()"> <span id="DeskChatButton" style="float:right;margin-top:1px;margin-right:4px;cursor:pointer" title="Open chat window to this computer"><img src='images/icon-chat.png' onclick="deviceChat()" height="16" width="16" style="padding-top:2px"></span> <span id="DeskNotifyButton" style="float:right;margin-top:1px;margin-right:4px;cursor:pointer" title="Display a notification on the remote computer"><img src='images/icon-notify.png' onclick="deviceToastFunction()" height="16" width="16" style="padding-top:2px"></span> <span id="DeskOpenWebButton" style="float:right;margin-top:1px;margin-right:4px;cursor:pointer" title="Open a web address on remote computer"><img src='images/icon-url2.png' onclick="deviceUrlFunction()" height="16" width="16" style="padding-top:2px"></span> </div> <div> <select style="margin-left:6px" id="deskkeys"> <option value="5">Win <option value="0">Win+Down <option value="1">Win+Up <option value="2">Win+L <option value="3">Win+M <option value="4">Shift+Win+M <option value="6">Win+R </select> <input id="DeskWD" type="button" value="Send" onkeypress="return false" onkeydown="return false" onclick="deskSendKeys()"> <input id="DeskCAD" style="margin-left:6px" type="button" value="Ctrl-Alt-Del" onkeypress="return false" onkeydown="return false" onclick="sendCAD()"> <span id="DeskControlSpan" style="margin-left:6px" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false" onclick="toggleKvmControl()">Input</span> </div> </td> </tr> </table> </div> <div id="p12" style="display:none"> <div id="p12title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Terminal - <span id="p12deviceName"></span></h1> </div> <div id="p12warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showFeaturesDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel® AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div> </div> <div id="p12warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showPowerActionDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div> </div> <table cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <input id="termActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> </div> <div> <input type="button" id="autoconnectbutton2" value="AutoConnect" onclick="autoConnectTerminal(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <span id="connectbutton2span"> <input type="button" id="connectbutton2" value="Connect" onclick="connectTerminal(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton2hspan"> <input type="button" id="connectbutton2h" value="HW Connect" onclick="connectTerminal(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="disconnectbutton2span"> <input type="button" id="disconnectbutton2" value="Disconnect" onclick="connectTerminal(event,0)" onkeypress="return false" onkeydown="return false"></span> <span id="termstatus">Disconnected</span> </div> </td> </tr> <tr> <td> <div style="background-color:gray"><div id="termprogressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr> <td style="background:black;text-align:center;height:500px;position:relative"> <pre id="Term" style="background:black;margin:0;padding:0"></pre> </td> </tr> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <span id="terminalSettingsButtons" style="display:none"> <input id="id_tcrbutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="CR+LF" title="Toggle what the return key will send" onclick="termToggleCr()"> <input id="id_tfxkeysbutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick="termToggleFx()"> <input id="id_ttypebutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Extended Ascii" title="Toggle terminal emulation type" onclick="termToggleType()"> </span> <select id="specialkeylist" onkeypress="return false" style="margin-left:5px"></select> <input id="specialkeylistinput" type="button" onkeypress="return false" class="bottombutton" value="Send" title="Send the selected special key" onclick="sendSpecialKey()"> </div> <div> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlcbutton" value="Ctl-C" onclick="termSendKey(3,'ctrlcbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlxbutton" value="Ctl-X" onclick="termSendKey(24,'ctrlxbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="escbutton" value="ESC" onclick="termSendKey(27,'escbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="bsbutton" value="Backspace" onclick="termSendKey(8,'bsbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="pastebutton" value="Paste" title="Paste text into the terminal" onclick="showTermPasteDialog()"> </div> </td> </tr> </table> </div> <div id="p13" style="display:none"> <div id="p13title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Files - <span id="p13deviceName"></span></h1> </div> <table id="p13toolbar" style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px"> <div style="float:right;text-align:right"> <input id="filesActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> </div> <div> <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" onkeypress="return false" onkeydown="return false" type="button" style="display:none"> <input id="p13Connect" value="Connect" onclick="connectFiles(event)" onkeypress="return false" onkeydown="return false" type="button"> <span id="p13Status">Disconnected</span> </div> </td> </tr> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div id="p13rightOfButtons" style="float:right;margin-top:3px"></div> <div> <input type="button" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Up"> <input type="button" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="Select All" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13RenameFileButton" disabled="disabled" value="Rename" onclick="p13renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13DeleteFileButton" disabled="disabled" value="Delete" onclick="p13deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13NewFolderButton" disabled="disabled" value="New Folder" onclick="p13createfolder()" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13UploadButton" disabled="disabled" value="Upload" onclick="p13uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13CutButton" disabled="disabled" value="Cut" onclick="p13copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13CopyButton" disabled="disabled" value="Copy" onclick="p13copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13PasteButton" disabled="disabled" value="Paste" onclick="p13pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13RefreshButton" disabled="disabled" value="Refresh" onclick="p13folderup(9999)" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <div style="float:right"> <select id="p13sortdropdown" onchange="p13updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </div> <div> <span id="p13currentpath"></span></div> </td> </tr> </table> <div id="p13filetable" style="width:100%;height:calc(100vh - 346px);overflow:auto;-webkit-user-select:none"> <div id="p13bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✓</b></div> <div id="p13bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✗</b></div> <span id="p13files"></span> </div> <table id="p13toolbarBottom" style="width:100%" cellpadding="0" cellspacing="0"> <tr><td class="style6" style="text-align:left;padding:3px"> <span id="p13bottomstatus"></span></td></tr> </table> </div> <div id="p14" style="display:none"> <div id="p14title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Intel® AMT - <span id="p14deviceName"></span></h1> </div> <iframe id="p14iframe" style="width:100%;height:calc(100vh - 242px);border:0;overflow:hidden" src="/commander.htm"></iframe> </div> <div id="p15" style="display:none"> <div id="p15title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Console - <span id="p15deviceName"></span></h1> </div> <table cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr> <td style="background:#C0C0C0"> <div style="float:right;padding-right:4px"> <div style="padding:4px;display:inline-block" id="p15coreName" title="Information about current core running on this agent"></div> <input type="button" id="p15uploadCore" value="Agent Action" onclick="p15uploadCore(event)" title="Change the agent Java Script code module"> </div> <div id="p15statetext" style="padding:4px"></div> </td> </tr> <tr> <td> <div style="background-color:gray"><div id="consoleprogressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr> <td id="p15agentConsole" style="background:black;margin:0;padding:0;color:lightgray;width:100%;height:calc(100vh - 296px);max-height:500px;position:relative"> <pre id="p15agentConsoleText" style="position:absolute;margin:0;padding:0;top:0;bottom:0;left:0;right:0;overflow-y:scroll;overflow-x:auto"></pre> </td> </tr> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <table style="width:100%"> <tr> <td style="width:99%"> <input id="p15consoleText" style="width:100%" onkeyup="p15consoleSend(event)" onfocus="onConsoleFocus(1)" onblur="onConsoleFocus(0)"> </td> <td> </td> <td style="width:1%"><input id="id_p15consoleClear" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Clear" onclick="p15consoleClear()"></td> </tr> </table> </td> </tr> </table> </div> <div id="p16" style="display:none"> <div id="p16title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Events - <span id="p16deviceName"></span></h1> </div> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left"> </div> <div class="h1" style="height:100%;float:left"> </div> <div class="style14" style="height:100%;float:left"> <input type="button" value="Refresh" onclick="refreshDeviceEvents()"> </div> <div class="auto-style1" style="height:100%;float:right"> Show <select id="p16limitdropdown" onchange="refreshDeviceEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right"> </div> </div> </div> <div id="p16events" style="max-height:calc(100vh - 267px);overflow-y:auto"></div> </div> <div id="p20" style="display:none"> <picture id="MainMeshImage" style="border-width:0px;height:200px;width:200px;float:right"> <source type="image/webp" width="200" height="200" srcset="images/webp/mesh-200.webp"> <img alt="" width="200" height="200" src="images/mesh-200.jpg"> </source></picture> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>General - <span id="p20meshName"></span></h1> <p id="p20info"> </div> <div id="p30" style="display:none"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:auto" valign="top"> <div id="p30title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>General - <span id="p30userName"></span></h1> </div> <div id="p30html"></div> </td> <td style="width:20px"></td> <td style="width:200px"> <picture id="MainUserImage" style="border-width:0px;height:200px;width:200px;float:right"> <source type="image/webp" width="200" height="200" srcset="images/webp/user-200.webp"> <img alt="" width="200" height="200" src="images/user-200.jpg"> </source></picture> <div style="width:100%;text-align:center"><strong><span id="MainUserState"></span></strong></div> </td> </tr> </table><br> <div id="p30html2"></div> <div id="p30html3"></div> </div> <div id="p31" style="display:none"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Events - <span id="p31userName"></span></h1> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left"> </div> <div class="h1" style="height:100%;float:left"> </div> <div class="style14" style="height:100%;float:left"> <input type="button" value="Refresh" onclick="refreshUsersEvents()"> </div> <div class="auto-style1" style="height:100%;float:right"> Show <select id="p31limitdropdown" onchange="refreshUsersEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right;"> </div> </div> </div> <div id="p31events" style="max-height:calc(100vh - 267px);overflow-y:scroll"></div> </div> <br id="column_l_bottomgap"> </div> <div id="footer" class="noselect"> <table cellpadding="0" cellspacing="10" style="width:100%"> <tr> <td style="text-align:left;color:white"> {{{footer}}} </td> <td style="text-align:right"> <a id="verifyEmailId2" style="color:yellow;margin-left:3px;cursor:pointer;display:none" onclick="account_showVerifyEmail()">Verify Email</a> <a style="margin-left:3px" href="terms">Terms & Privacy</a> </td> </tr> </table> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:160px;width:400px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:3px;margin-right:3px;cursor:pointer" onclick="setDialogMode()">✖</div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> <div id="dialog3" style="margin:auto;margin:3px"> <div style="height:26px"> <select id="d3uploadMode" style="float:right;width:260px" onchange="d3modechange()"> <option value="1">Local file upload <option value="2">Server file selection </select> <div>File Selection</div> </div> <div id="d3localmode" style="height:26px;display:none"> <form id="d3localmodeform" method="post" enctype="multipart/form-data" action="uploadfile.ashx" target="fileUploadFrame"> <input type="text" id="d3attrib" name="attrib" style="display:none"> <input type="file" id="d3localFile" name="files" style="float:right;width:260px" onchange="d3setActions()"> <input type="submit" id="d3submit" style="display:none"> </form> <div>Upload File</div> </div> <div id="d3servermode"> <div style="width:100%;background-color:#d3d9d6;text-align:left;padding:3px" valign="bottom"> <input type="button" id="p3FolderUp" disabled="disabled" onclick="d3folderup()" value="Up"> </div> <div id="d3serverfiles" style="width:100%;height:150px;background-color:white;padding:2px;border:1px solid gray;overflow-y:scroll"></div> </div> </div> <div id="dialog7" style="margin:auto;margin:3px"> <div id="d7meshkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Agent Remote Desktop</h4> <div style="margin:3px 0 3px 0"> <select id="d7bitmapquality" style="float:right;width:200px;height:20px" dir="rtl"></select> <div style="height:20px">Quality</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7bitmapscaling" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="1024">100% <option value="896">87.5% <option value="768">75% <option value="640">62.5% <option value="512">50% <option value="384">37.5% <option value="256">25% <option value="128">12.5% </select> <div style="height:20px">Scaling</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7framelimiter" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="50">Fast <option value="100">Medium <option value="400">Slow <option value="1000">Very slow </select> <div style="height:20px">Frame rate</div> </div> </div> <div id="d7amtkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Intel® AMT Hardware KVM</h4> <div style='height:26px'> <select id="d7desktopmode" style="float:right;width:200px"> <option value="1">RLE8, Fastest <option value="2">RLE16, Recommended <option value="3">RAW8, Slow <option value="4">RAW16, Very Slow </select> <div>Image Encoding</div> </div> <div style="height:60px"> <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white"> <input type="checkbox" id='d7showfocus'>Show Focus Tool<br> <input type="checkbox" id='d7showcursor'>Show Local Mouse Cursor<br> </div> <div>Other Settings</div> </div> </div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:4px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> <div style="height:25px"><input id="idx_dlgDeleteButton" type="button" value="Delete" style="width:80px;display:none" onclick="dialogclose(2)"></div> </div> </div> <iframe name="fileUploadFrame" style="display:none"></iframe> <form style="display:none" method="post" action="uploadfile.ashx" enctype="multipart/form-data" target="fileUploadFrame"><input id="p5fileDragName" name="name"><input id="p5fileDragSize" name="size"><input id="p5fileDragType" name="type"><input id="p5fileDragData" name="data"><input id="p5fileDragLink" name="link"><input type="submit" id="p5loginSubmit2" style="display:none"></form> <form style="display:none" method="post" action="uploadnodefile.ashx" enctype="multipart/form-data" target="fileUploadFrame"><input id="p13fileDragName" name="name"><input id="p13fileDragSize" name="size"><input id="p13fileDragType" name="type"><input id="p13fileDragData" name="data"><input id="p13fileDragLink" name="link"><input type="submit" id="p13loginSubmit2" style="display:none"></form> <audio id="chimes"><source src="sounds/chimes.mp3" type="audio/mp3"></source></audio> </div> </div> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g," ")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"®").replace(/\(TM\)/g,"™")}var MeshServerCreateControl=function(a){var b={};b.State=0;b.connectstate=0;b.pingTimer=null;b.xxStateChange=function(c){if(b.State==c){return}b.State=c;if(b.onStateChanged){b.onStateChanged(b,b.State)}};b.Start=function(){b.connectstate=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+a+"control.ashx");b.socket.onopen=function(){b.connectstate=1;b.xxStateChange(2)};b.socket.onmessage=b.xxOnMessage;b.socket.onclose=function(){b.Stop()};b.xxStateChange(1);if(b.pingTimer!=null){clearInterval(b.pingTimer)}b.pingTimer=setInterval(function(){b.send({action:"ping"})},29000)};b.Stop=function(){b.connectstate=0;if(b.socket){b.socket.close();delete b.socket}if(b.pingTimer!=null){clearInterval(b.pingTimer);b.pingTimer=null}b.xxStateChange(0)};b.xxOnMessage=function(c){var d;try{d=JSON.parse(c.data)}catch(c){return}if(d.action=="pong"){return}if(b.onMessage){b.onMessage(b,d)}};b.send=function(c){if(b.socket!=null&&b.connectstate==1){b.socket.send(JSON.stringify(c))}};return b};function AmtStackCreateService(s){var r=new Object();r.wsman=s;r.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];r.PendingEnums=[];r.PendingBatchOperations=0;r.ActiveEnumsCount=0;r.MaxActiveEnumsCount=1;r.onProcessChanged=null;var m=0;var l=0;r.GetPendingActions=function(){return(r.PendingEnums.length*2)+(r.ActiveEnumsCount)+r.wsman.comm.PendingAjax.length+r.wsman.comm.ActiveAjaxCount+r.PendingBatchOperations};function q(){var t=r.GetPendingActions();if(m<t){m=t}if(r.onProcessChanged!=null&&l!=t){l=t;r.onProcessChanged(t,m)}if(t==0){m=0}}r.Subscribe=function(v,u,B,t,A,y,z,w,C,x){r.wsman.ExecSubscribe(r.CompleteName(v),u,B,function(F,E,D,G){q();t(r,v,D,G,A)},0,y,z,w,C,x);q()};r.UnSubscribe=function(u,t,x,v,w){r.wsman.ExecUnSubscribe(r.CompleteName(u),function(A,z,y,B){q();t(r,u,y,B,x)},0,v,w);q()};r.Get=function(u,t,w,v){r.wsman.ExecGet(r.CompleteName(u),function(z,y,x,A){q();t(r,u,x,A,w)},0,v);q()};r.Put=function(u,w,t,y,v,x){r.wsman.ExecPut(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v,x);q()};r.Create=function(u,w,t,x,v){r.wsman.ExecCreate(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Delete=function(u,w,t,x,v){r.wsman.ExecDelete(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Exec=function(w,v,t,u,z,x,y){r.wsman.ExecMethod(r.CompleteName(w),v,t,function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.ExecWithXml=function(w,v,t,u,z,x,y){r.wsman.ExecMethodXml(r.CompleteName(w),v,execArgumentsToXml(t),function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.Enum=function(u,t,w,v){if(r.ActiveEnumsCount<r.MaxActiveEnumsCount){r.ActiveEnumsCount++;r.wsman.ExecEnum(r.CompleteName(u),function(A,y,x,B,z){q();d(u,x,t,y,B,z)},w,v)}else{r.PendingEnums.push([u,t,w,v])}q()};function d(v,x,t,y,z,A,w){if(z!=200){t(r,v,null,z,A);c(1);return}if(x==null||x.Header.Method!="EnumerateResponse"||!x.Body.EnumerationContext){t(r,v,null,603,A);c(1);return}var u=x.Body.EnumerationContext;r.wsman.ExecPull(y,u,function(D,C,B,E){b(v,B,t,C,[],E,A,w)})}function b(y,A,t,B,w,C,D,z){if(C!=200){t(r,y,null,C,D);c(1);return}if(A==null||A.Header.Method!="PullResponse"){t(r,y,null,604,D);c(1);return}for(var v in A.Body.Items){if(A.Body.Items[v] instanceof Array){for(var x in A.Body.Items[v]){w.push(A.Body.Items[v][x])}}else{w.push(A.Body.Items[v])}}if(A.Body.EnumerationContext){var u=A.Body.EnumerationContext;r.wsman.ExecPull(B,u,function(G,F,E,H){b(y,E,t,F,w,H,D,1)})}else{c(1);t(r,y,w,C,D);q()}}function c(t){r.ActiveEnumsCount-=t;if(r.ActiveEnumsCount>=r.MaxActiveEnumsCount||r.PendingEnums.length==0){return}var u=r.PendingEnums.shift();r.Enum(u[0],u[1],u[2]);c(0)}r.BatchEnum=function(t,w,u,y,v,x){r.PendingBatchOperations+=(w.length*2);a(t,Clone(w),u,y,{},v,x);q()};function a(t,y,u,B,A,v,z){r.PendingBatchOperations-=2;var x=y.shift(),w=r.Enum;if(x[0]=="*"){w=r.Get;x=x.substring(1)}w(x,function(E,C,D,F,G){G[2][C]={response:(D==null?null:D.Body),responses:D,status:F};if(G[1].length==0||F==401||(v!=true&&F!=200&&F!=400)){r.PendingBatchOperations-=(y.length*2);q();u(r,t,G[2],F,B)}else{q();a(t,y,u,B,G[2],z)}},[t,y,A],z);q()}r.BatchGet=function(t,v,u,x,w){g({name:t,names:v,callback:u,current:0,responses:{},tag:x,pri:w});q()};function g(t){if(t.names.length<=t.current){t.callback(r,t.name,t.responses,200,t.tag)}else{r.wsman.ExecGet(r.CompleteName(t.names[t.current]),function(w,v,u,x){f(t,u,x)},t.pri);t.current++}q()}function f(t,u,v){if(u==null||v!=200){t.callback(r,t.name,null,v,t.tag)}else{t.responses[u.Header.Method]=u;g(t)}}r.CompleteName=function(t){if(t.indexOf("AMT_")==0){return r.pfx[0]+t}if(t.indexOf("CIM_")==0){return r.pfx[1]+t}if(t.indexOf("IPS_")==0){return r.pfx[2]+t}};r.CompleteExecResponse=function(t){if(t&&t!=null&&t.Body&&t.Body.ReturnValue){t.Body.ReturnValueStr=r.AmtStatusToStr(t.Body.ReturnValue)}return t};r.RequestPowerStateChange=function(u,t){r.CIM_PowerManagementService_RequestPowerStateChange(u,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',null,null,t)};r.SetBootConfigRole=function(u,t){r.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',u,t)};r.CancelAllQueries=function(t){r.wsman.CancelAllQueries(t)};r.AMT_AgentPresenceWatchdog_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdog_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AddAction=function(y,x,w,u,t,v,B,z,A){r.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:y,NewState:x,EventOnTransition:w,ActionSd:u,ActionEac:t},v,B,z,A)};r.AMT_AgentPresenceWatchdog_DeleteAllActions=function(t,w,u,v){r.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},t,w,u,v)};r.AMT_AgentPresenceWatchdogAction_GetActionEac=function(t){r.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},t)};r.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdogVA_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AddAction=function(y,x,w,u,t,v){r.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:y,NewState:x,EventOnTransition:w,ActionSd:u,ActionEac:t},v)};r.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(t,u){r.Exec("AMT_AgentPresenceWatchdogVA","DeleteAllActions",{_method_dummy:t},u)};r.AMT_AuditLog_ClearLog=function(t){r.Exec("AMT_AuditLog","ClearLog",{},t)};r.AMT_AuditLog_RequestStateChange=function(u,v,t){r.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_AuditLog_ReadRecords=function(u,t,v){r.Exec("AMT_AuditLog","ReadRecords",{StartIndex:u},t,v)};r.AMT_AuditLog_SetAuditLock=function(w,u,v,t){r.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:w,Flag:u,Handle:v},t)};r.AMT_AuditLog_ExportAuditLogSignature=function(u,t){r.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:u},t)};r.AMT_AuditLog_SetSigningKeyMaterial=function(x,w,v,u,t){r.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:x,SigningKey:w,LengthOfCertificates:v,Certificates:u},t)};r.AMT_AuditPolicyRule_SetAuditPolicy=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicyBulk",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuthorizationService_AddUserAclEntryEx=function(w,v,x,t,y,u){r.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:w,DigestPassword:v,KerberosUserSid:x,AccessPermission:t,Realms:y},u)};r.AMT_AuthorizationService_EnumerateUserAclEntries=function(u,t){r.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:u},t)};r.AMT_AuthorizationService_GetUserAclEntryEx=function(u,t,v){r.Exec("AMT_AuthorizationService","GetUserAclEntryEx",{Handle:u},t,v)};r.AMT_AuthorizationService_UpdateUserAclEntryEx=function(x,w,v,y,t,z,u){r.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:x,DigestUsername:w,DigestPassword:v,KerberosUserSid:y,AccessPermission:t,Realms:z},u)};r.AMT_AuthorizationService_RemoveUserAclEntry=function(u,t){r.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:u},t)};r.AMT_AuthorizationService_SetAdminAclEntryEx=function(v,u,t){r.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",{Username:v,DigestPassword:u},t)};r.AMT_AuthorizationService_GetAdminAclEntry=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},t)};r.AMT_AuthorizationService_GetAdminAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},t)};r.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},t)};r.AMT_AuthorizationService_SetAclEnabledState=function(v,u,t,w){r.Exec("AMT_AuthorizationService","SetAclEnabledState",{Handle:v,Enabled:u},t,w)};r.AMT_AuthorizationService_GetAclEnabledState=function(u,t,v){r.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:u},t,v)};r.AMT_EndpointAccessControlService_RequestStateChange=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_EndpointAccessControlService_GetPosture=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:u},t)};r.AMT_EndpointAccessControlService_GetPostureHash=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:u},t)};r.AMT_EndpointAccessControlService_UpdatePostureState=function(u,t){r.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:u},t)};r.AMT_EndpointAccessControlService_GetEacOptions=function(t){r.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},t)};r.AMT_EndpointAccessControlService_SetEacOptions=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:u,PostureHashAlgorithm:v},t)};r.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:u},t)};r.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:u},t)};r.AMT_EthernetPortSettings_SetLinkPreference=function(u,v,t){r.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:u,Timeout:v},t)};r.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=function(u,t){r.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:u},t)};r.AMT_KerberosSettingData_GetCredentialCacheState=function(t){r.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},t)};r.AMT_KerberosSettingData_SetCredentialCacheState=function(u,t){r.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:u},t)};r.AMT_MessageLog_CancelIteration=function(u,t){r.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:u},t)};r.AMT_MessageLog_RequestStateChange=function(u,v,t){r.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_MessageLog_ClearLog=function(t){r.Exec("AMT_MessageLog","ClearLog",{},t)};r.AMT_MessageLog_GetRecords=function(u,v,t,w){r.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:u,MaxReadRecords:v},t,w)};r.AMT_MessageLog_GetRecord=function(u,v,t){r.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:u,PositionToNext:v},t)};r.AMT_MessageLog_PositionAtRecord=function(u,v,w,t){r.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:u,MoveAbsolute:v,RecordNumber:w},t)};r.AMT_MessageLog_PositionToFirstRecord=function(t,u){r.Exec("AMT_MessageLog","PositionToFirstRecord",{},t,u)};r.AMT_MessageLog_FreezeLog=function(u,t){r.Exec("AMT_MessageLog","FreezeLog",{Freeze:u},t)};r.AMT_PublicKeyManagementService_AddCRL=function(v,u,t){r.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:v,SerialNumbers:u},t)};r.AMT_PublicKeyManagementService_ResetCRLList=function(t,u){r.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:t},u)};r.AMT_PublicKeyManagementService_AddCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddKey=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:u},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(v,u,w,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:v,DNName:u,Usage:w},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(u,w,v,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:u,SigningAlgorithm:w,NullSignedCertificateRequest:v},t)};r.AMT_PublicKeyManagementService_GenerateKeyPair=function(u,v,t){r.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:u,KeyLength:v},t)};r.AMT_RedirectionService_RequestStateChange=function(u,t){r.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:u},t)};r.AMT_RedirectionService_TerminateSession=function(u,t){r.Exec("AMT_RedirectionService","TerminateSession",{SessionType:u},t)};r.AMT_RemoteAccessService_AddMpServer=function(t,y,A,u,w,B,z,x,v){r.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:t,InfoFormat:y,Port:A,AuthMethod:u,Certificate:w,Username:B,Password:z,CN:x},v)};r.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(w,x,u,v,t){r.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:w,TunnelLifeTime:x,ExtendedData:u,MpServer:v},t)};r.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(t,u){r.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_CommitChanges=function(t,u){r.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_Unprovision=function(u,t){r.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:u},t)};r.AMT_SetupAndConfigurationService_PartialUnprovision=function(t,u){r.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(t,u){r.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(u,t){r.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:u},t)};r.AMT_SetupAndConfigurationService_SetMEBxPassword=function(u,t){r.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:u},t)};r.AMT_SetupAndConfigurationService_SetTLSPSK=function(u,v,t){r.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:u,PPS:v},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},t)};r.AMT_SetupAndConfigurationService_GetUuid=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUuid",{},t)};r.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},t)};r.AMT_SystemDefensePolicy_GetTimeout=function(t){r.Exec("AMT_SystemDefensePolicy","GetTimeout",{},t)};r.AMT_SystemDefensePolicy_SetTimeout=function(u,t){r.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:u},t)};r.AMT_SystemDefensePolicy_UpdateStatistics=function(u,w,t,y,v,x){r.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:u,ResetOnRead:w},t,y,v,x)};r.AMT_SystemPowerScheme_SetPowerScheme=function(t,u,v){r.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},t,v,0,{InstanceID:u})};r.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(t,u){r.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},t,u)};r.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(u,w,x,t,v){r.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:u,Tm1:w,Tm2:x},t,v)};r.AMT_UserInitiatedConnectionService_RequestStateChange=function(u,v,t){r.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WebUIService_RequestStateChange=function(u,v,t){r.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:x,WiFiEndpointSettingsInput:y,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:x,WiFiEndpointSettingsInput:y,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:t},u)};r.CIM_Account_RequestStateChange=function(u,v,t){r.Exec("CIM_Account","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_AccountManagementService_CreateAccount=function(v,t,u){r.Exec("CIM_AccountManagementService","CreateAccount",{System:v,AccountTemplate:t},u)};r.CIM_BootConfigSetting_ChangeBootOrder=function(u,t){r.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:u},t)};r.CIM_BootService_SetBootConfigRole=function(t,v,u){r.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:t,Role:v},u,0,1)};r.CIM_Card_ConnectorPower=function(u,v,t){r.Exec("CIM_Card","ConnectorPower",{Connector:u,PoweredOn:v},t)};r.CIM_Card_IsCompatible=function(u,t){r.Exec("CIM_Card","IsCompatible",{ElementToCheck:u},t)};r.CIM_Chassis_IsCompatible=function(u,t){r.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:u},t)};r.CIM_Fan_SetSpeed=function(u,t){r.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:u},t)};r.CIM_KVMRedirectionSAP_RequestStateChange=function(u,v,t){r.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:u},t)};r.CIM_MediaAccessDevice_LockMedia=function(u,t){r.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:u},t)};r.CIM_MediaAccessDevice_SetPowerState=function(u,v,t){r.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_MediaAccessDevice_Reset=function(t){r.Exec("CIM_MediaAccessDevice","Reset",{},t)};r.CIM_MediaAccessDevice_EnableDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:u},t)};r.CIM_MediaAccessDevice_OnlineDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:u},t)};r.CIM_MediaAccessDevice_QuiesceDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:u},t)};r.CIM_MediaAccessDevice_SaveProperties=function(t){r.Exec("CIM_MediaAccessDevice","SaveProperties",{},t)};r.CIM_MediaAccessDevice_RestoreProperties=function(t){r.Exec("CIM_MediaAccessDevice","RestoreProperties",{},t)};r.CIM_MediaAccessDevice_RequestStateChange=function(u,v,t){r.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_PhysicalFrame_IsCompatible=function(u,t){r.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:u},t)};r.CIM_PhysicalPackage_IsCompatible=function(u,t){r.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:u},t)};r.CIM_PowerManagementService_RequestPowerStateChange=function(v,u,w,x,t){r.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:v,ManagedElement:u,Time:w,TimeoutPeriod:x},t,0,1)};r.CIM_PowerSupply_SetPowerState=function(u,v,t){r.Exec("CIM_PowerSupply","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_PowerSupply_Reset=function(t){r.Exec("CIM_PowerSupply","Reset",{},t)};r.CIM_PowerSupply_EnableDevice=function(u,t){r.Exec("CIM_PowerSupply","EnableDevice",{Enabled:u},t)};r.CIM_PowerSupply_OnlineDevice=function(u,t){r.Exec("CIM_PowerSupply","OnlineDevice",{Online:u},t)};r.CIM_PowerSupply_QuiesceDevice=function(u,t){r.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:u},t)};r.CIM_PowerSupply_SaveProperties=function(t){r.Exec("CIM_PowerSupply","SaveProperties",{},t)};r.CIM_PowerSupply_RestoreProperties=function(t){r.Exec("CIM_PowerSupply","RestoreProperties",{},t)};r.CIM_PowerSupply_RequestStateChange=function(u,v,t){r.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Processor_SetPowerState=function(u,v,t){r.Exec("CIM_Processor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Processor_Reset=function(t){r.Exec("CIM_Processor","Reset",{},t)};r.CIM_Processor_EnableDevice=function(u,t){r.Exec("CIM_Processor","EnableDevice",{Enabled:u},t)};r.CIM_Processor_OnlineDevice=function(u,t){r.Exec("CIM_Processor","OnlineDevice",{Online:u},t)};r.CIM_Processor_QuiesceDevice=function(u,t){r.Exec("CIM_Processor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Processor_SaveProperties=function(t){r.Exec("CIM_Processor","SaveProperties",{},t)};r.CIM_Processor_RestoreProperties=function(t){r.Exec("CIM_Processor","RestoreProperties",{},t)};r.CIM_Processor_RequestStateChange=function(u,v,t){r.Exec("CIM_Processor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RecordLog_ClearLog=function(t){r.Exec("CIM_RecordLog","ClearLog",{},t)};r.CIM_RecordLog_RequestStateChange=function(u,v,t){r.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RedirectionService_RequestStateChange=function(u,v,t){r.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Sensor_SetPowerState=function(u,v,t){r.Exec("CIM_Sensor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Sensor_Reset=function(t){r.Exec("CIM_Sensor","Reset",{},t)};r.CIM_Sensor_EnableDevice=function(u,t){r.Exec("CIM_Sensor","EnableDevice",{Enabled:u},t)};r.CIM_Sensor_OnlineDevice=function(u,t){r.Exec("CIM_Sensor","OnlineDevice",{Online:u},t)};r.CIM_Sensor_QuiesceDevice=function(u,t){r.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Sensor_SaveProperties=function(t){r.Exec("CIM_Sensor","SaveProperties",{},t)};r.CIM_Sensor_RestoreProperties=function(t){r.Exec("CIM_Sensor","RestoreProperties",{},t)};r.CIM_Sensor_RequestStateChange=function(u,v,t){r.Exec("CIM_Sensor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_StatisticalData_ResetSelectedStats=function(u,t){r.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:u},t)};r.CIM_Watchdog_KeepAlive=function(t){r.Exec("CIM_Watchdog","KeepAlive",{},t)};r.CIM_Watchdog_SetPowerState=function(u,v,t){r.Exec("CIM_Watchdog","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Watchdog_Reset=function(t){r.Exec("CIM_Watchdog","Reset",{},t)};r.CIM_Watchdog_EnableDevice=function(u,t){r.Exec("CIM_Watchdog","EnableDevice",{Enabled:u},t)};r.CIM_Watchdog_OnlineDevice=function(u,t){r.Exec("CIM_Watchdog","OnlineDevice",{Online:u},t)};r.CIM_Watchdog_QuiesceDevice=function(u,t){r.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:u},t)};r.CIM_Watchdog_SaveProperties=function(t){r.Exec("CIM_Watchdog","SaveProperties",{},t)};r.CIM_Watchdog_RestoreProperties=function(t){r.Exec("CIM_Watchdog","RestoreProperties",{},t)};r.CIM_Watchdog_RequestStateChange=function(u,v,t){r.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_WiFiPort_SetPowerState=function(u,v,t){r.Exec("CIM_WiFiPort","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_WiFiPort_Reset=function(t){r.Exec("CIM_WiFiPort","Reset",{},t)};r.CIM_WiFiPort_EnableDevice=function(u,t){r.Exec("CIM_WiFiPort","EnableDevice",{Enabled:u},t)};r.CIM_WiFiPort_OnlineDevice=function(u,t){r.Exec("CIM_WiFiPort","OnlineDevice",{Online:u},t)};r.CIM_WiFiPort_QuiesceDevice=function(u,t){r.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:u},t)};r.CIM_WiFiPort_SaveProperties=function(t){r.Exec("CIM_WiFiPort","SaveProperties",{},t)};r.CIM_WiFiPort_RestoreProperties=function(t){r.Exec("CIM_WiFiPort","RestoreProperties",{},t)};r.CIM_WiFiPort_RequestStateChange=function(u,v,t){r.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_HostBasedSetupService_Setup=function(x,y,w,u,z,v,t){r.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:x,NetworkAdminPassword:y,McNonce:w,Certificate:u,SigningAlgorithm:z,DigitalSignature:v},t)};r.IPS_HostBasedSetupService_AddNextCertInChain=function(w,u,v,t){r.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:w,IsLeafCertificate:u,IsRootCertificate:v},t)};r.IPS_HostBasedSetupService_AdminSetup=function(w,x,v,y,u,t){r.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:w,NetworkAdminPassword:x,McNonce:v,SigningAlgorithm:y,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(v,w,u,t){r.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:v,SigningAlgorithm:w,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_DisableClientControlMode=function(t,u){r.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:t},u)};r.IPS_KVMRedirectionSettingData_TerminateSession=function(t){r.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},t)};r.IPS_OptInService_StartOptIn=function(t){r.Exec("IPS_OptInService","StartOptIn",{},t)};r.IPS_OptInService_CancelOptIn=function(t){r.Exec("IPS_OptInService","CancelOptIn",{},t)};r.IPS_OptInService_SendOptInCode=function(u,t){r.Exec("IPS_OptInService","SendOptInCode",{OptInCode:u},t)};r.IPS_OptInService_StartService=function(t){r.Exec("IPS_OptInService","StartService",{},t)};r.IPS_OptInService_StopService=function(t){r.Exec("IPS_OptInService","StopService",{},t)};r.IPS_OptInService_RequestStateChange=function(u,v,t){r.Exec("IPS_OptInService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_RequestStateChange=function(u,v,t){r.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_ClearLog=function(t,u){r.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:t},u)};r.IPS_SecIOService_RequestStateChange=function(u,v,t){r.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AmtStatusToStr=function(t){if(r.AmtStatusCodes[t]){return r.AmtStatusCodes[t]}else{return"UNKNOWN_ERROR"}};r.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};r.GetMessageLog=function(t,u){r.AMT_MessageLog_PositionToFirstRecord(j,[t,u,[]])};function j(v,t,u,w,x){if(w!=200||u.Body.ReturnValue!="0"){x[0](r,null,x[2]);return}r.AMT_MessageLog_GetRecords(u.Body.IterationIdentifier,390,k,x)}function k(D,A,C,E,G){if(E!=200||C.Body.ReturnValue!="0"){G[0](r,null,G[2]);return}var y,z,I,v,u=G[2],F=new Date(),H,B=C.Body.RecordArray;if(typeof B==="string"){C.Body.RecordArray=[C.Body.RecordArray]}for(y in B){v=null;try{v=window.atob(B[y])}catch(w){}if(v!=null){H=ReadIntX(v,0);if((H>0)&&(H<4294967295)){I={DeviceAddress:v.charCodeAt(4),EventSensorType:v.charCodeAt(5),EventType:v.charCodeAt(6),EventOffset:v.charCodeAt(7),EventSourceType:v.charCodeAt(8),EventSeverity:v.charCodeAt(9),SensorNumber:v.charCodeAt(10),Entity:v.charCodeAt(11),EntityInstance:v.charCodeAt(12),EventData:[],Time:new Date((H+(F.getTimezoneOffset()*60))*1000)};for(z=13;z<21;z++){I.EventData.push(v.charCodeAt(z))}I.EntityStr=n[I.Entity];I.Desc=h(I.EventSensorType,I.EventOffset,I.EventData,I.Entity);if(!I.EntityStr){I.EntityStr="Unknown"}u.push(I)}}}if(C.Body.NoMoreRecords!=true){r.AMT_MessageLog_GetRecords(C.Body.IterationIdentifier,390,k,[G[0],u,G[2]])}else{G[0](r,u,G[2])}}var e="Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split("|");var o="Unspecified.|No system memory is physically installed in the system.|No usable system memory, all installed memory has experienced an unrecoverable failure.|Unrecoverable hard-disk/ATAPI/IDE device failure.|Unrecoverable system-board failure.|Unrecoverable diskette subsystem failure.|Unrecoverable hard-disk controller failure.|Unrecoverable PS/2 or USB keyboard failure.|Removable boot media not found.|Unrecoverable video controller failure.|No video device detected.|Firmware (BIOS) ROM corruption detected.|CPU voltage mismatch (processors that share same supply have mismatched voltage requirements)|CPU speed matching failure".split("|");var p="Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split("|");var n="Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split("|");r.RealmNames="||Redirection|PT Administration|Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split("|");r.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};function h(w,v,u,t){if(w==15){if(u[0]==235){return"Invalid Data"}if(v==0){return o[u[1]]}return p[u[1]]}if(w==18&&u[0]==170){return"Agent watchdog "+char2hex(u[4])+char2hex(u[3])+char2hex(u[2])+char2hex(u[1])+"-"+char2hex(u[6])+char2hex(u[5])+"-... changed to "+r.WatchdogCurrentStates[u[7]]}if(w==6){return"Authentication failed "+(u[1]+(u[2]<<8))+" times. The system may be under attack."}if(w==30){return"No bootable media"}if(w==32){return"Operating system lockup or power interrupt"}if(w==35){return"System boot failure"}if(w==37){return"System firmware started (at least one CPU is properly executing)."}return"Unknown Sensor Type #"+w}return r}var md5_k=[];for(var i=0;i<64;){md5_k[i]=0|(Math.abs(Math.sin(++i))*4294967296)}function hex_md5(o){var f,g,k,n,q=[],p=unescape(encodeURI(o)),e=p.length,l=[f=1732584193,g=-271733879,~f,~g],m=0;for(;m<=e;){q[m>>2]|=(p.charCodeAt(m)||128)<<8*(m++%4)}q[o=(e+8>>6)*16+14]=e*8;m=0;for(;m<o;m+=16){e=l;n=0;for(;n<64;){e=[k=e[3],((f=e[1]|0)+((k=((e[0]+[f&(g=e[2])|~f&k,k&f|~k&g,f^g^k,g^(f|~k)][e=n>>4])+(md5_k[n]+(q[[n,5*n+1,3*n+5,7*n][e]%16+m]|0))))<<(e=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*e+n++%4])|k>>>32-e)),f,g]}for(n=4;n;){l[--n]=l[n]+e[n]}}o="";for(;n<32;){o+=((l[n>>3]>>((1^n++&7)*4))&15).toString(16)}return o}function rstr_md5(a){return hex2rstr(hex_md5(a))}function execArgumentsToXml(c){if(c===undefined||c===null){return null}var d="";for(var b in c){var a=c[b];if(!a){continue}if(a.__parameterType==="reference"){d+=referenceToXml(b,a)}else{d+=instanceToXml(b,a)}}return d}function instanceToXml(d,c){if(c===undefined||c===null){return null}var b=!!c.__namespace;var h=b?"<q:":"<";var a=b?"</q:":"</";var e=b?(' xmlns:q="'+c.__namespace+'"'):"";var g="<r:"+d+e+">";for(var f in c){if(!c.hasOwnProperty(f)||f.indexOf("__")===0){continue}if(typeof c[f]==="function"||Array.isArray(c[f])){continue}if(typeof c[f]==="object"){console.error("only convert one level down...")}else{g+=h+f+">"+c[f].toString()+a+f+">"}}g+="</r:"+d+">";return g}function referenceToXml(b,a){if(a===undefined||a===null){return null}var c="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+a.__resourceUri+"</w:ResourceURI><w:SelectorSet>";for(var d in a){if(!a.hasOwnProperty(d)||d.indexOf("__")===0){continue}if(typeof a[d]==="function"||typeof a[d]==="object"||Array.isArray(a[d])){continue}c+='<w:Selector Name="'+d+'">'+a[d].toString()+"</w:Selector>"}c+="</w:SelectorSet></a:ReferenceParameters></r:"+b+">";return c}function GetSidString(c){var b="S-"+c.charCodeAt(0)+"-"+c.charCodeAt(7);for(var a=2;a<(c.length/4);a++){b+="-"+ReadIntX(c,a*4)}return b}function GetSidByteArray(d){if(!d||d==null){return null}var c=d.split("-");if(c.length<4||(c[0]!="s"&&c[0]!="S")){return null}for(var a=1;a<c.length;a++){var e=parseInt(c[a]);if(e!=c[a]){return null}c[a]=e}var b=String.fromCharCode(c[1])+String.fromCharCode(c.length-3)+ShortToStr(Math.floor(c[2]/Math.pow(2,32)))+IntToStr((c[2])&65535);for(var a=3;a<c.length;a++){b+=IntToStrX(c[a])}return b}var WsmanStackCreateService=function(g,k,m,j,l,f){var h={};h.NextMessageId=1;h.Address="/wsman";h.comm=CreateWsmanComm(g,k,m,j,l,f);h.PerformAjax=function(p,n,r,q,o){if(o==undefined){o=""}h.comm.PerformAjax('<?xml version="1.0" encoding="utf-8"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+o+"><Header><a:Action>"+p,function(s,t,u){if(t!=200){n(h,null,{Header:{HttpError:t}},t,u);return}var v=h.ParseWsman(s);if(!v||v==null){n(h,null,{Header:{HttpError:t}},601,u)}else{n(h,v.Header.ResourceURI,v,200,u)}},r,q)};h.CancelAllQueries=function(n){h.comm.CancelAllQueries(n)};h.GetNameFromUrl=function(n){var o=n.lastIndexOf("/");return(o==-1)?n:n.substring(o+1)};h.ExecSubscribe=function(v,p,y,n,x,u,w,s,z,t){var q="",r="";if(z!=undefined&&t!=undefined){q="<t:IssuedTokens><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>"+z+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+t+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>";r='<Auth Profile="http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/secprofile/http/digest"/>'}if(s!=undefined&&s!=null){s="<a:ReferenceParameters>"+s+"</a:ReferenceParameters>"}else{s=""}var o="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+v+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+d(w)+q+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.dmtf.org/wbem/wsman/1/wsman/'+p+'"><e:NotifyTo><a:Address>'+y+"</a:Address></e:NotifyTo>"+r+"</e:Delivery><e:Expires>PT0.000000S</e:Expires></e:Subscribe>";h.PerformAjax(o+"</Body></Envelope>",n,x,u,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:m="http://x.com"')};h.ExecUnSubscribe=function(q,n,s,p,r){var o="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+q+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+d(r)+"</Header><Body><e:Unsubscribe/>";h.PerformAjax(o+"</Body></Envelope>",n,s,p,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};h.ExecPut=function(r,q,n,t,p,s){var o="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+d(s)+"</Header><Body>"+c(r,q);h.PerformAjax(o+"</Body></Envelope>",n,t,p)};h.ExecCreate=function(u,t,o,w,s,v){var r=h.GetNameFromUrl(u);var p="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+u+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(v)+"</Header><Body><g:"+r+' xmlns:g="'+u+'">';for(var q in t){p+="<g:"+q+">"+t[q]+"</g:"+q+">"}h.PerformAjax(p+"</g:"+r+"></Body></Envelope>",o,w,s)};h.ExecCreateXml=function(r,n,o,t,q){var p=h.GetNameFromUrl(r),s="";h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout></Header><Body><r:"+p+' xmlns:r="'+r+'">'+n+"</r:"+p+"></Body></Envelope>",o,t,q)};h.ExecDelete=function(r,q,n,s,p){var o="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(q)+"</Header><Body /></Envelope>";h.PerformAjax(o,n,s,p)};h.ExecGet=function(p,n,q,o){h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+p+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>",n,q,o)};h.ExecMethod=function(t,r,n,p,v,s,u){var o="";for(var q in n){if(n[q]!=null){if(Array.isArray(n[q])){for(var w in n[q]){o+="<r:"+q+">"+n[q][w]+"</r:"+q+">"}}else{o+="<r:"+q+">"+n[q]+"</r:"+q+">"}}}h.ExecMethodXml(t,r,o,p,v,s,u)};h.ExecMethodXml=function(r,p,n,o,t,q,s){h.PerformAjax(r+"/"+p+"</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(s)+"</Header><Body><r:"+p+'_INPUT xmlns:r="'+r+'">'+n+"</r:"+p+"_INPUT></Body></Envelope>",o,t,q)};h.ExecEnum=function(p,n,q,o){h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+p+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',n,q,o)};h.ExecPull=function(q,o,n,r,p){h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+q+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>'+o+"</EnumerationContext><MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters></Pull></Body></Envelope>",n,r,p)};h.ParseWsman=function(w){try{if(!w.childNodes){w=e(w)}var u={Header:{}},q=w.getElementsByTagName("Header")[0],v;if(!q){q=w.getElementsByTagName("a:Header")[0]}if(!q){return null}for(var s=0;s<q.childNodes.length;s++){var o=q.childNodes[s];u.Header[o.localName]=o.textContent}var n=w.getElementsByTagName("Body")[0];if(!n){n=w.getElementsByTagName("a:Body")[0]}if(!n){return null}if(n.childNodes.length>0){v=n.childNodes[0].localName;if(v.indexOf("_OUTPUT")==v.length-7){v=v.substring(0,v.length-7)}u.Header.Method=v;u.Body=b(n.childNodes[0])}return u}catch(p){console.log("Unable to parse XML: "+w);return null}};function b(t){var p,u={};for(var q=0;q<t.childNodes.length;q++){var n=t.childNodes[q];if(n.childElementCount==0){p=n.textContent}else{p=b(n)}if(p=="true"){p=true}if(p=="false"){p=false}var o=p;if(n.attributes.length>0){o={Value:p};for(var s=0;s<n.attributes.length;s++){o["@"+n.attributes[s].name]=n.attributes[s].value}}if(u[n.localName] instanceof Array){u[n.localName].push(o)}else{if(u[n.localName]==undefined){u[n.localName]=o}else{u[n.localName]=[u[n.localName],o]}}}return u}function c(s,q){if(!s||q===undefined||q===null){return""}var o=h.GetNameFromUrl(s);var r="<r:"+o+' xmlns:r="'+s+'">';for(var p in q){if(!q.hasOwnProperty(p)||p.indexOf("__")===0||p.indexOf("@")===0){continue}if(q[p]===undefined||q[p]===null||typeof q[p]==="function"){continue}if(typeof q[p]==="object"&&q[p]["ReferenceParameters"]){r+="<r:"+p+"><a:Address>"+q[p].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+q[p]["ReferenceParameters"]["ResourceURI"]+"</w:ResourceURI><w:SelectorSet>";var t=q[p]["ReferenceParameters"]["SelectorSet"]["Selector"];if(Array.isArray(t)){for(var n=0;n<t.length;n++){r+="<w:Selector"+a(t[n])+">"+t[n]["Value"]+"</w:Selector>"}}else{r+="<w:Selector"+a(t)+">"+t.Value+"</w:Selector>"}r+="</w:SelectorSet></a:ReferenceParameters></r:"+p+">"}else{if(Array.isArray(q[p])){for(var n=0;n<q[p].length;n++){r+="<r:"+p+">"+q[p][n].toString()+"</r:"+p+">"}}else{r+="<r:"+p+">"+q[p].toString()+"</r:"+p+">"}}}r+="</r:"+o+">";return r}function a(n){if(!n){return""}var p=" ";for(var o in n){if(!n.hasOwnProperty(o)||o.indexOf("@")!==0){continue}p+=o.substring(1)+'="'+n[o]+'" '}return p}function d(r){if(!r){return""}if(typeof r=="string"){return r}if(r.InstanceID){return'<w:SelectorSet><w:Selector Name="InstanceID">'+r.InstanceID+"</w:Selector></w:SelectorSet>"}var p="<w:SelectorSet>";for(var o in r){if(!r.hasOwnProperty(o)){continue}p+='<w:Selector Name="'+o+'">';if(r[o]["ReferenceParameters"]){p+="<a:EndpointReference>";p+="<a:Address>"+r[o]["Address"]+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+r[o]["ReferenceParameters"]["ResourceURI"]+"</w:ResourceURI><w:SelectorSet>";var q=r[o]["ReferenceParameters"]["SelectorSet"]["Selector"];if(Array.isArray(q)){for(var n=0;n<q.length;n++){p+="<w:Selector"+a(q[n])+">"+q[n]["Value"]+"</w:Selector>"}}else{p+="<w:Selector"+a(q)+">"+q.Value+"</w:Selector>"}p+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else{p+=r[o]}p+="</w:Selector>"}p+="</w:SelectorSet>";return p}function e(n){if(window.DOMParser){return new DOMParser().parseFromString(n,"text/xml")}else{var o=new ActiveXObject("Microsoft.XMLDOM");o.async=false;o.loadXML(n);return o}}return h};var CreateAmtRemoteDesktop=function(l,o){var n={};n.canvasid=l;n.CanvasId=Q(l);n.scrolldiv=o;n.canvas=Q(l).getContext("2d");n.protocol=2;n.state=0;n.acc="";n.ScreenWidth=960;n.ScreenHeight=700;n.width=0;n.height=0;n.rwidth=0;n.rheight=0;n.bpp=2;n.useZRLE=true;n.showmouse=true;n.buttonmask=0;n.spare=null;n.sparew=0;n.spareh=0;n.sparew2=0;n.spareh2=0;n.sparecache={};n.ZRLEfirst=1;n.onScreenSizeChange=null;n.frameRateDelay=0;n.kvmDataSupported=false;n.onKvmData=null;n.onKvmDataPending=[];n.onKvmDataAck=-1;n.holding=false;n.lastKeepAlive=Date.now();n.Debug=function(p){console.log(p)};n.xxStateChange=function(p){if(p==0){n.canvas.fillStyle="#000000";n.canvas.fillRect(0,0,n.width,n.height);n.canvas.canvas.width=n.rwidth=n.width=640;n.canvas.canvas.height=n.rheight=n.height=400;QS(n.canvasid).cursor="auto"}else{if(!n.showmouse){QS(n.canvasid).cursor="none"}}};n.ProcessData=function(r){if(!r){return}n.acc+=r;while(n.acc.length>0){var p=0;if(n.state==0&&n.acc.length>=12){p=12;n.state=1;n.send("RFB 003.008\n")}else{if(n.state==1&&n.acc.length>=1){p=n.acc.charCodeAt(0)+1;n.send(String.fromCharCode(1));n.state=2}else{if(n.state==2&&n.acc.length>=4){p=4;if(ReadInt(n.acc,0)!=0){return n.Stop()}n.send(String.fromCharCode(1));n.state=3}else{if(n.state==3&&n.acc.length>=24){var C=ReadInt(n.acc,20);if(n.acc.length<24+C){return}p=24+C;n.canvas.canvas.width=n.rwidth=n.width=n.ScreenWidth=ReadShort(n.acc,0);n.canvas.canvas.height=n.rheight=n.height=n.ScreenHeight=ReadShort(n.acc,2);var F="";if(n.useZRLE){F+=IntToStr(16)}F+=IntToStr(0);F+=IntToStr(1092);n.send(String.fromCharCode(2,0)+ShortToStr((F.length/4)+1)+F+IntToStr(-223));if(n.bpp==1){n.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0))}n.state=4;n.parent.xxStateChange(3);g();if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}else{if(n.state==4){switch(n.acc.charCodeAt(0)){case 0:if(n.acc.length<4){return}n.state=100+ReadShort(n.acc,2);p=4;break;case 2:p=1;break;case 3:if(n.acc.length<8){return}var B=ReadInt(n.acc,4)+8;if(n.acc.length<B){return}p=m(n.acc);break}}else{if(n.state>100&&n.acc.length>=12){var H=ReadShort(n.acc,0),J=ReadShort(n.acc,2),G=ReadShort(n.acc,4),z=ReadShort(n.acc,6),E=G*z,w=ReadInt(n.acc,8);if(w<17){if(G<1||G>64||z<1||z>64){console.log("Invalid tile size ("+G+","+z+"), disconnecting.");return n.Stop()}if(n.sparew!=G||n.spareh!=z){n.sparew=n.sparew2=G;n.spareh=n.spareh2=z;var I=n.sparew2+"x"+n.spareh2;n.spare=n.sparecache[I];if(!n.spare){n.sparecache[I]=n.spare=n.canvas.createImageData(n.sparew2,n.spareh2)}}}if(w==4294967073){n.canvas.canvas.width=n.rwidth=n.width=G;n.canvas.canvas.height=n.rheight=n.height=z;n.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(n.width)+ShortToStr(n.height));p=12;if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}else{if(w==0){var D=12,q=12+(E*n.bpp);if(n.acc.length<q){return}p=q;for(var A=0;A<E;A++){h(n.acc.charCodeAt(D++)+((n.bpp==2)?(n.acc.charCodeAt(D++)<<8):0),A)}f(n.spare,H,J)}else{if(w==16){if(n.acc.length<16){return}var t=ReadInt(n.acc,12);if(n.acc.length<(16+t)){return}var D=16,u=5,v=0;if(t>5&&n.acc.charCodeAt(D)==0&&ReadShortX(n.acc,D+1)==(t-u)){a(n.acc,D+5,H,J,G,z,E,t)}p=16+t}else{n.Debug("Unknown Encoding: "+w);return n.Stop()}}}if(--n.state==100){n.state=4;if(n.frameRateDelay==0){g()}else{setTimeout(g,n.frameRateDelay)}}}}}}}}if(p==0){return}n.acc=n.acc.substring(p)}};function a(r,B,J,K,I,u,F,t){var G=r.charCodeAt(B++),z,H,E,A={},C=0,D=0,w;if(G==0){for(w=0;w<F;w++){h(r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0),w)}f(n.spare,J,K)}else{if(G==1){H=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0);n.canvas.fillStyle="rgb("+((n.bpp==1)?((H&224)+","+((H&28)<<3)+","+b((H&3)<<6)):(((H>>8)&248)+","+((H>>3)&252)+","+((H&31)<<3)))+")";n.canvas.fillRect(J,K,I,u)}else{if(G>1&&G<17){var q=4,p=15;for(w=0;w<G;w++){A[w]=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0)}if(G==2){q=1;p=1}else{if(G<=4){q=2;p=3}}while(C<F&&B<r.length){H=r.charCodeAt(B++);for(w=(8-q);w>=0;w-=q){h(A[(H>>w)&p],C++)}}f(n.spare,J,K)}else{if(G==128){while(C<F&&B<r.length){H=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0);D=1;do{D+=(E=r.charCodeAt(B++))}while(E==255);while(--D>=0){h(H,C++)}}f(n.spare,J,K)}else{if(G>129){for(w=0;w<(G-128);w++){A[w]=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0)}while(C<F&&B<r.length){D=1;z=r.charCodeAt(B++);H=A[z%128];if(z>127){do{D+=(E=r.charCodeAt(B++))}while(E==255)}while(--D>=0){h(H,C++)}}f(n.spare,J,K)}}}}}}n.hold=function(p){if(n.holding==p){return}n.holding=p;n.canvas.fillStyle="#000000";n.canvas.fillRect(0,0,n.width,n.height);if(n.holding==false){if((n.canvas.canvas.width!=n.width)||(n.canvas.canvas.height!=n.height)){n.canvas.canvas.width=n.width;n.canvas.canvas.height=n.height;if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}n.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(n.width)+ShortToStr(n.height))}else{n.UnGrabMouseInput();n.UnGrabKeyInput()}};function f(p,q,r){if(n.holding==true){return}n.canvas.putImageData(p,q,r)}function h(s,q){var r=q*4;if(n.bpp==1){n.spare.data[r++]=s&224;n.spare.data[r++]=(s&28)<<3;n.spare.data[r++]=b((s&3)<<6)}else{n.spare.data[r++]=(s>>8)&248;n.spare.data[r++]=(s>>3)&252;n.spare.data[r++]=(s&31)<<3}n.spare.data[r]=255}function b(p){return(p>127)?(p+32):p}function g(){if(n.holding==true){return}n.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(n.rwidth)+ShortToStr(n.rheight))}n.Start=function(){n.state=0;n.acc="";n.ZRLEfirst=1;n.onKvmDataPending=[];n.onKvmDataAck=-1;n.kvmDataSupported=false;for(var p in n.sparecache){delete n.sparecache[p]}};n.Stop=function(){n.UnGrabMouseInput();n.UnGrabKeyInput();n.parent.Stop()};n.send=function(p){n.parent.send(p)};var k={Pause:19,CapsLock:20,Space:32,Quote:39,Minus:45,NumpadMultiply:42,NumpadAdd:43,PrintScreen:44,Comma:44,NumpadSubtract:45,NumpadDecimal:46,Period:46,Slash:47,NumpadDivide:47,Semicolon:59,Equal:61,OSLeft:91,BracketLeft:91,OSRight:91,Backslash:92,BracketRight:93,ContextMenu:93,Backquote:96,NumLock:144,ScrollLock:145,Backspace:65288,Tab:65289,Enter:65293,NumpadEnter:65293,Escape:65307,Delete:65535,Home:65360,PageUp:65365,PageDown:65366,ArrowLeft:65361,ArrowUp:65362,ArrowRight:65363,ArrowDown:65364,End:65367,Insert:65379,F1:65470,F2:65471,F3:65472,F4:65473,F5:65474,F6:65475,F7:65476,F8:65477,F9:65478,F10:65479,F11:65480,F12:65481,ShiftLeft:65505,ShiftRight:65506,ControlLeft:65507,ControlRight:65508,AltLeft:65513,AltRight:65514,MetaLeft:65511,MetaRight:65512};function j(p){if(p.code.startsWith("Key")&&p.code.length==4){return p.code.charCodeAt(3)+((p.shiftKey==false)?32:0)}if(p.code.startsWith("Digit")&&p.code.length==6){return p.code.charCodeAt(5)}if(p.code.startsWith("Numpad")&&p.code.length==7){return p.code.charCodeAt(6)}return k[p.code]}function c(p,q){if(!q){q=window.event}if(q.code){var r=j(q);if(r!=null){n.sendkey(r,p)}}else{var r=q.keyCode,s=r;if(q.shiftKey==false&&r>=65&&r<=90){s=r+32}if(r>=112&&r<=124){s=r+65358}if(r==8){s=65288}if(r==9){s=65289}if(r==13){s=65293}if(r==16){s=65505}if(r==17){s=65507}if(r==18){s=65513}if(r==27){s=65307}if(r==33){s=65365}if(r==34){s=65366}if(r==35){s=65367}if(r==36){s=65360}if(r==37){s=65361}if(r==38){s=65362}if(r==39){s=65363}if(r==40){s=65364}if(r==45){s=65379}if(r==46){s=65535}if(r>=96&&r<=105){s=r-48}if(r==106){s=42}if(r==107){s=43}if(r==109){s=45}if(r==110){s=46}if(r==111){s=47}if(r==186){s=59}if(r==187){s=61}if(r==188){s=44}if(r==189){s=45}if(r==190){s=46}if(r==191){s=47}if(r==192){s=96}if(r==219){s=91}if(r==220){s=92}if(r==221){s=93}if(r==222){s=39}n.sendkey(s,p)}return n.haltEvent(q)}n.sendkey=function(r,p){if(typeof r=="object"){for(var q in r){n.sendkey(r[q][0],r[q][1])}}else{n.send(String.fromCharCode(4,p,0,0)+IntToStr(r))}};function m(p){if(p.length<8){return 0}var r=ReadInt(n.acc,4)+8;if(p.length<r){return 0}if(n.onKvmData!=null){var q=p.substring(8,r);if((q.length>=16)&&(q.substring(0,15)=="\0KvmDataChannel")){if(n.kvmDataSupported==false){n.kvmDataSupported=true;console.log("KVM Data Channel Supported.")}if(((n.onKvmDataAck==-1)&&(q.length==16))||(q.charCodeAt(15)!=0)){n.onKvmDataAck=true}if(q.length>=16){n.onKvmData(q.substring(16))}if((n.onKvmDataAck==true)&&(n.onKvmDataPending.length>0)){n.sendKvmData(n.onKvmDataPending.shift())}}}return r}n.sendKvmData=function(p){if(n.onKvmDataAck!==true){n.onKvmDataPending.push(p)}else{p="\0KvmDataChannel\0"+p;n.send(String.fromCharCode(6,0,0,0)+IntToStr(p.length)+p);n.onKvmDataAck=false}};n.sendKeepAlive=function(){if(n.lastKeepAlive<Date.now()-5000){n.lastKeepAlive=Date.now();n.send(String.fromCharCode(6,0,0,0)+IntToStr(16)+"\0KvmDataChannel\0")}};n.SendCtrlAltDelMsg=function(){n.sendcad()};n.sendcad=function(){n.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var e=false;var d=false;n.GrabMouseInput=function(){if(e==true){return}var p=n.canvas.canvas;p.onmouseup=n.mouseup;p.onmousedown=n.mousedown;p.onmousemove=n.mousemove;e=true};n.UnGrabMouseInput=function(){if(e==false){return}var p=n.canvas.canvas;p.onmousemove=null;p.onmouseup=null;p.onmousedown=null;e=false};n.GrabKeyInput=function(){if(d==true){return}document.onkeyup=n.handleKeyUp;document.onkeydown=n.handleKeyDown;document.onkeypress=n.handleKeys;d=true};n.UnGrabKeyInput=function(){if(d==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d=false};n.handleKeys=function(p){return n.haltEvent(p)};n.handleKeyUp=function(p){return c(0,p)};n.handleKeyDown=function(p){return c(1,p)};n.haltEvent=function(p){if(p.preventDefault){p.preventDefault()}if(p.stopPropagation){p.stopPropagation()}return false};n.mousedown=function(p){n.buttonmask|=(1<<p.button);return n.mousemove(p)};n.mouseup=function(p){n.buttonmask&=(65535-(1<<p.button));return n.mousemove(p)};n.mousemove=function(p){if(n.state!=4){return true}var q=n.getPositionOfControl(Q(n.canvasid));n.mx=(p.pageX-q[0])*(n.canvas.canvas.height/Q(n.canvasid).offsetHeight);n.my=((p.pageY-q[1]+(o?o.scrollTop:0))*(n.canvas.canvas.width/Q(n.canvasid).offsetWidth));n.send(String.fromCharCode(5,n.buttonmask)+ShortToStr(n.mx)+ShortToStr(n.my));return n.haltEvent(p)};n.getPositionOfControl=function(p){var q=Array(2);q[0]=q[1]=0;while(p){q[0]+=p.offsetLeft;q[1]+=p.offsetTop;p=p.offsetParent}return q};return n};var CreateAmtRemoteTerminal=function(A){var B={};B.DivId=A;B.DivElement=document.getElementById(A);B.protocol=1;B.fxEmulation=0;B.lineFeed="\r\n";B.debugmode=0;B.width=80;B.height=25;var q=21;var r=13;var l=["000000","BB0000","00BB00","BBBB00","0000BB","BB00BB","00BBBB","BBBBBB","555555","FF5555","55FF55","FFFF55","5555FF","FF55FF","55FFFF","FFFFFF"];var o=0;var n=7;var m=0;var s=true;var v=0;var w=0;var u=0;var d=[];var e=0;var k=[];var x=[];var z=1;var y=2;B.Start=function(){};B.Init=function(D,C){B.width=D?D:80;B.height=C?C:25;for(var F=0;F<B.height;F++){x[F]=[];k[F]=[];for(var E=0;E<B.width;E++){x[F][E]=" ";k[F][E]=(7<<6)}}B.TermInit();B.TermDraw()};B.xxStateChange=function(C){};B.ProcessData=function(C){if(B.debugmode==2){console.log("TRecv("+C.length+"): "+rstr2hex(C))}if(B.capture!=null){B.capture+=C}j(C);B.TermDraw()};function j(D){for(var C=0;C<D.length;C++){h(String.fromCharCode(D.charCodeAt(C)),D.charCodeAt(C))}}function h(C,D){switch(u){case 0:switch(D){case 27:u=1;break;default:g(C);break}break;case 1:switch(C){case"[":e=0;d=[];u=2;break;case"(":u=4;break;case")":u=5;break;default:u=0;break}break;case 2:if(C>="0"&&C<="9"){if(!d[e]){d[e]=(C-"0")}else{d[e]=((d[e]*10)+(C-"0"))}break}else{if(C==";"){e++;break}else{if(!d[0]){d[0]=0}f(C,d,e+1);u=0}}break;case 4:u=0;break;case 5:u=0;break}}function f(F,C,D){var G;switch(F){case"c":B.TermResetScreen();break;case"A":if(D==1){w-=C[0];if(w<0){w=0}}break;case"B":if(D==1){w+=C[0];if(w>B.height){w=B.height}}break;case"C":if(D==1){v+=C[0];if(v>B.width){v=B.width}}break;case"D":if(D==1){v-=C[0];if(v<0){v=0}}break;case"d":if(D==1){w=C[0]-1;if(w>B.height){w=B.height}if(w<0){w=0}}break;case"G":if(D==1){v=C[0]-1;if(v<0){v=0}if(v>79){v=79}}break;case"J":if(D==1&&C[0]==2){B.TermClear((m<<12)+(n<<6));v=0;w=0}else{if(D==0||D==1&&C[0]==0){b();for(G=w+1;G<B.height;G++){c(G)}}else{if(D==1&&C[0]==1){b();for(G=0;G<w-1;G++){c(G)}}}}break;case"H":if(D==2){if(C[0]<1){C[0]=1}if(C[1]<1){C[1]=1}if(C[0]>B.height){C[0]=B.height}if(C[1]>B.width){C[1]=B.width}w=C[0]-1;v=C[1]-1}else{w=0;v=0}break;case"m":for(G=0;G<D;G++){if(!C[G]||C[G]==0){m=0;n=7;o=0}else{if(C[G]==1){if(n<8){n+=8}}else{if(C[G]==2||C[G]==22){if(n>=8){n-=8}}else{if(C[G]==7){o=2}else{if(C[G]==27){o=0}else{if(C[G]>=30&&C[G]<=37){var E=(n>=8);n=(C[G]-30);if(E&&n<=8){n+=8}}else{if(C[G]>=40&&C[G]<=47){m=(C[G]-40)}else{if(C[G]>=90&&C[G]<=99){n=(C[G]-82)}else{if(C[G]>=100&&C[G]<=109){m=(C[G]-92)}}}}}}}}}}break;case"K":if(D==0||(D==1&&(!C[0]||C[0]==0))){b()}else{if(D==1){if(C[0]==1){a()}else{if(C[0]==2){c(w)}}}}break;case"h":s=true;break;case"l":s=false;break;default:break}}B.ProcessVt100String=function(D){for(var C=0;C<D.length;C++){g(String.fromCharCode(D.charCodeAt(C)))}};function g(C){if(C=="\0"||C.charCodeAt()==7){return}var D=C.charCodeAt();switch(D){case 16:C=" ";break;case 24:C="?";break;case 25:C="?";break}if(v>B.width){v=B.width}if(w>(B.height-1)){w=(B.height-1)}switch(C){case"\b":if(v>0){v=v-1;p(" ")}break;case"\t":var E=8-(v%8);for(var F=0;F<E;F++){g(" ")}break;case"\n":w++;if(w>(B.height-1)){t(1);w=(B.height-1)}if(B.lineFeed="\n"){v=0}break;case"\r":v=0;break;default:if(v>=B.width){v=0;if(s){w++}if(w>=(B.height-1)){t(1);w=(B.height-1)}}p(C);v++;break}}function p(C){x[w][v]=C;k[w][v]=(n<<6)+(m<<12)+o}B.TermClear=function(C){for(var E=0;E<B.height;E++){for(var D=0;D<B.width;D++){x[E][D]=" ";k[E][D]=C}}};B.TermResetScreen=function(){o=0;n=7;m=0;s=true;v=0;w=0;B.TermClear(7<<6)};function b(){var C=(m<<12);for(var D=v;D<B.width;D++){x[w][D]=" ";k[w][D]=C}}function a(){var C=(m<<12);for(var D=0;D<v;D++){x[w][D]=" ";k[w][D]=C}}function c(C){var D=(m<<12);for(var E=0;E<B.width;E++){x[C][E]=" ";k[C][E]=D}}B.TermSendKeys=function(C){if(B.debugmode==2){if(B.debugmode==2){console.log("TSend("+C.length+"): "+rstr2hex(C))}}B.parent.send(C)};B.TermSendKey=function(C){if(B.debugmode==2){if(B.debugmode==2){console.log("TSend(1): "+rstr2hex(String.fromCharCode(C)))}}B.parent.send(String.fromCharCode(C))};function t(C){var D,E;for(E=0;E<B.height-C;E++){x[E]=x[E+C];k[E]=k[E+C]}for(E=B.height-C;E<B.height;E++){x[E]=[];k[E]=[];for(D=0;D<B.width;D++){x[E][D]=" ";k[E][D]=(7<<6)}}}B.TermHandleKeys=function(C){if(!C.ctrlKey){if(C.which==127){B.TermSendKey(8)}else{if(C.which==13){B.TermSendKeys(B.lineFeed)}else{if(C.which!=0){B.TermSendKey(C.which)}}}return false}if(C.preventDefault){C.preventDefault()}if(C.stopPropagation){C.stopPropagation()}};B.TermHandleKeyUp=function(C){if((C.which!=8)&&(C.which!=32)&&(C.which!=9)){return true}if(C.preventDefault){C.preventDefault()}if(C.stopPropagation){C.stopPropagation()}return false};B.TermHandleKeyDown=function(C){if((C.which>=65)&&(C.which<=90)&&(C.ctrlKey==true)){B.TermSendKey(C.which-64);if(C.preventDefault){C.preventDefault()}if(C.stopPropagation){C.stopPropagation()}return}if(C.which==27){B.TermSendKeys(String.fromCharCode(27));return true}if(C.which==37){B.TermSendKeys(String.fromCharCode(27,91,68));return true}if(C.which==38){B.TermSendKeys(String.fromCharCode(27,91,65));return true}if(C.which==39){B.TermSendKeys(String.fromCharCode(27,91,67));return true}if(C.which==40){B.TermSendKeys(String.fromCharCode(27,91,66));return true}if(C.which==9){B.TermSendKeys("\t");if(C.preventDefault){C.preventDefault()}if(C.stopPropagation){C.stopPropagation()}return true}if(C.which!=8&&C.which!=32&&C.which!=9){return true}B.TermSendKey(C.which);if(C.preventDefault){C.preventDefault()}if(C.stopPropagation){C.stopPropagation()}return false};B.TermDraw=function(){var D,C="",E="",F,G=1,I,J;for(var K=0;K<B.height;++K){for(var H=0;H<B.width;++H){F=k[K][H];if(v==H&&w==K){F|=y}if(F!=G){C+=E;E="";I=6;J=12;if(F&y){I=12;J=6}C+='<span style="color:#'+l[(F>>I)&63]+";background-color:#"+l[(F>>J)&63];if(F&z){C+=";text-decoration:underline"}C+=';">';E="</span>"+E;G=F}D=x[K][H];switch(D){case"&":C+="&";break;case"<":C+="<";break;case">":C+=">";break;case" ":C+=" ";break;default:C+=D;break}}if(K!=(B.height-1)){C+="<br>"}}B.DivElement.innerHTML="<font size='4'><b>"+C+E+"</b></font>"};B.TermInit=function(){B.TermResetScreen()};B.Init();return B};var ZLIB=(ZLIB||{});if(typeof ZLIB.common_initialized==="undefined"){ZLIB.Z_NO_FLUSH=0;ZLIB.Z_PARTIAL_FLUSH=1;ZLIB.Z_SYNC_FLUSH=2;ZLIB.Z_FULL_FLUSH=3;ZLIB.Z_FINISH=4;ZLIB.Z_BLOCK=5;ZLIB.Z_TREES=6;ZLIB.Z_OK=0;ZLIB.Z_STREAM_END=1;ZLIB.Z_NEED_DICT=2;ZLIB.Z_ERRNO=(-1);ZLIB.Z_STREAM_ERROR=(-2);ZLIB.Z_DATA_ERROR=(-3);ZLIB.Z_MEM_ERROR=(-4);ZLIB.Z_BUF_ERROR=(-5);ZLIB.Z_VERSION_ERROR=(-6);ZLIB.Z_DEFLATED=8;ZLIB.z_stream=function(){this.next_in=0;this.avail_in=0;this.total_in=0;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg=null;this.state=null;this.data_type=0;this.adler=0;this.input_data="";this.output_data="";this.error=0;this.checksum_function=null};ZLIB.gz_header=function(){this.text=0;this.time=0;this.xflags=0;this.os=255;this.extra=null;this.extra_len=0;this.extra_max=0;this.name=null;this.name_max=0;this.comment=null;this.comm_max=0;this.hcrc=0;this.done=0};ZLIB.common_initialized=true}if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js")}(function(){var n=15;var F=0;var C=1;var al=2;var ae=3;var z=4;var A=5;var ab=6;var h=7;var E=8;var p=9;var o=10;var am=11;var an=12;var ai=13;var k=14;var j=15;var ak=16;var V=17;var f=18;var R=19;var P=20;var S=21;var q=22;var r=23;var Z=24;var X=25;var d=26;var U=27;var u=28;var a=29;var aa=30;var aj=31;var y=852;var x=592;var w=(y+x);var g=0;var W=1;var t=2;var M=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var N=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69];var K=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var L=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ZLIB.inflate_copyright=" inflate 1.2.6 Copyright 1995-2012 Mark Adler ";function J(aQ,aU){var aL=15;var aT=aQ.next;var ar=(aU==t?aQ.distbits:aQ.lenbits);var aW=aQ.work;var aG=aQ.lens;var aH=(aU==t?aQ.nlen:0);var aR=aQ.codes;var at;if(aU==W){at=aQ.nlen}else{if(aU==t){at=aQ.ndist}else{at=19}}var aF;var aS;var aM,aK;var aP;var av;var aw;var aE;var aV;var aC;var aD;var aA;var aI;var aJ;var aB;var aN;var ap;var aq;var ay;var az;var ax;var au=new Array(aL+1);var aO=new Array(aL+1);for(aF=0;aF<=aL;aF++){au[aF]=0}for(aS=0;aS<at;aS++){au[aG[aH+aS]]++}aP=ar;for(aK=aL;aK>=1;aK--){if(au[aK]!=0){break}}if(aP>aK){aP=aK}if(aK==0){aB={op:64,bits:1,val:0};aR[aT++]=aB;aR[aT++]=aB;if(aU==t){aQ.distbits=1}else{aQ.lenbits=1}aQ.next=aT;return 0}for(aM=1;aM<aK;aM++){if(au[aM]!=0){break}}if(aP<aM){aP=aM}aE=1;for(aF=1;aF<=aL;aF++){aE<<=1;aE-=au[aF];if(aE<0){return -1}}if(aE>0&&(aU==g||aK!=1)){aQ.next=aT;return -1}aO[1]=0;for(aF=1;aF<aL;aF++){aO[aF+1]=aO[aF]+au[aF]}for(aS=0;aS<at;aS++){if(aG[aH+aS]!=0){aW[aO[aG[aH+aS]]++]=aS}}switch(aU){case g:ap=ay=aW;aq=0;az=0;ax=19;break;case W:ap=M;aq=-257;ay=N;az=-257;ax=256;break;default:ap=K;ay=L;aq=0;az=0;ax=-1}aC=0;aS=0;aF=aM;aN=aT;av=aP;aw=0;aI=-1;aV=1<<aP;aJ=aV-1;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}for(;;){aB={op:0,bits:aF-aw,val:0};if(aW[aS]<ax){aB.val=aW[aS]}else{if(aW[aS]>ax){aB.op=ay[az+aW[aS]];aB.val=ap[aq+aW[aS]]}else{aB.op=32+64}}aD=1<<(aF-aw);aA=1<<av;aM=aA;do{aA-=aD;aR[aN+(aC>>>aw)+aA]=aB}while(aA!=0);aD=1<<(aF-1);while(aC&aD){aD>>>=1}if(aD!=0){aC&=aD-1;aC+=aD}else{aC=0}aS++;if(--(au[aF])==0){if(aF==aK){break}aF=aG[aH+aW[aS]]}if(aF>aP&&(aC&aJ)!=aI){if(aw==0){aw=aP}aN+=aM;av=aF-aw;aE=(1<<av);while(av+aw<aK){aE-=au[av+aw];if(aE<=0){break}av++;aE<<=1}aV+=1<<av;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}aI=aC&aJ;aR[aT+aI]={op:av,bits:aP,val:aN-aT}}}if(aC!=0){aR[aN+aC]={op:64,bits:aF-aw,val:0}}aQ.next=aT+aV;if(aU==t){aQ.distbits=aP}else{aQ.lenbits=aP}return 0}function G(aM,aK){var aL;var aB;var aH;var aC;var aJ;var ap;var aw;var aQ;var aN;var aP;var aO;var aA;var aq;var ar;var aD;var at;var aG;var av;var az;var aI;var aE;var au;var ay=-1;var ax=-1;aL=aM.state;aB=aM.input_data;aH=aM.next_in;aC=aH+aM.avail_in-5;aJ=aM.next_out;ap=aJ-(aK-aM.avail_out);aw=aJ+(aM.avail_out-257);aQ=aL.wsize;aN=aL.whave;aP=aL.wnext;aO=aL.window;aA=aL.hold;aq=aL.bits;ar=aL.codes;aD=aL.lencode;at=aL.distcode;aG=(1<<aL.lenbits)-1;av=(1<<aL.distbits)-1;loop:do{if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[aD+(aA&aG)];dolen:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI==0){aM.output_data+=String.fromCharCode(az.val);aJ++}else{if(aI&16){aE=az.val;aI&=15;if(aI){if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}aE+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI}if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[at+(aA&av)];dodist:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI&16){au=az.val;aI&=15;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}}au+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI;aI=aJ-ap;if(au>aI){aI=au-aI;if(aI>aN){if(aL.sane){aM.msg="invalid distance too far back";aL.mode=a;break loop}}ay=0;ax=-1;if(aP==0){ay+=aQ-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;aI=0;ay=-1;ax=aJ-au}}else{ay+=aP-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;ay=-1;ax=aJ-au}}}else{ay=-1;ax=aJ-au}if(ay>=0){aM.output_data+=aO.substring(ay,ay+aE);aJ+=aE;ay+=aE}else{var aF=aE;if(aF>aJ-ax){aF=aJ-ax}aM.output_data+=aM.output_data.substring(ax,ax+aF);aJ+=aF;aE-=aF;ax+=aF;aJ+=aE;while(aE>2){aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aE-=3}if(aE){aM.output_data+=aM.output_data.charAt(ax++);if(aE>1){aM.output_data+=aM.output_data.charAt(ax++)}}}}else{if((aI&64)==0){az=ar[at+(az.val+(aA&((1<<aI)-1)))];continue dodist}else{aM.msg="invalid distance code";aL.mode=a;break loop}}break dodist}}else{if((aI&64)==0){az=ar[aD+(az.val+(aA&((1<<aI)-1)))];continue dolen}else{if(aI&32){aL.mode=am;break loop}else{aM.msg="invalid literal/length code";aL.mode=a;break loop}}}}break dolen}}while(aH<aC&&aJ<aw);aE=aq>>>3;aH-=aE;aq-=aE<<3;aA&=(1<<aq)-1;aM.next_in=aH;aM.next_out=aJ;aM.avail_in=(aH<aC?5+(aC-aH):5-(aH-aC));aM.avail_out=(aJ<aw?257+(aw-aJ):257-(aJ-aw));aL.hold=aA;aL.bits=aq}function ad(ar){var aq;var ap=new Array(ar);for(aq=0;aq<ar;aq++){ap[aq]=0}return ap}function D(ar,aq,ap){return(ar&&(aq in ar))?ar[aq]:ap}function e(){return 0}function I(){var aq;this.mode=0;this.last=0;this.wrap=0;this.havedict=0;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=0;this.distcode=0;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=0;this.lens=ad(320);this.work=ad(288);this.codes=new Array(w);var ap={op:0,bits:0,val:0};for(aq=0;aq<w;aq++){this.codes[aq]=ap}this.sane=0;this.back=0;this.was=0}ZLIB.inflateResetKeep=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;aq.total_in=aq.total_out=ap.total=0;aq.msg=null;if(ap.wrap){aq.adler=ap.wrap&1}ap.mode=F;ap.last=0;ap.havedict=0;ap.dmax=32768;ap.head=null;ap.hold=0;ap.bits=0;ap.lencode=0;ap.distcode=0;ap.next=0;ap.sane=1;ap.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(aq,ar){var at;var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;if(typeof ar==="undefined"){ar=n}if(ar<0){at=0;ar=-ar}else{at=(ar>>>4)+1;if(ar<48){ar&=15}}if(at==1&&(typeof ZLIB.adler32==="function")){aq.checksum_function=ZLIB.adler32}else{if(at==2&&(typeof ZLIB.crc32==="function")){aq.checksum_function=ZLIB.crc32}else{aq.checksum_function=e}}if(ar&&(ar<8||ar>15)){return ZLIB.Z_STREAM_ERROR}if(ap.window&&ap.wbits!=ar){ap.window=null}ap.wrap=at;ap.wbits=ar;ap.wsize=0;ap.whave=0;ap.wnext=0;return ZLIB.inflateResetKeep(aq)};ZLIB.inflateInit=function(aq){var ap=new ZLIB.z_stream();ap.state=new I();ZLIB.inflateReset(ap,aq);return ap};ZLIB.inflatePrime=function(ar,ap,at){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;if(ap<0){aq.hold=0;aq.bits=0;return ZLIB.Z_OK}if(ap>16||aq.bits+ap>32){return ZLIB.Z_STREAM_ERROR}at&=(1<<ap)-1;aq.hold+=at<<aq.bits;aq.bits+=ap;return ZLIB.Z_OK};var T=null;var s=null;function B(aq){var ap;if(!T){T=[{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:192},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:160},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:224},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:144},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:208},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:176},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:240},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:200},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:168},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:232},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:152},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:216},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:184},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:248},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:196},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:164},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:228},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:148},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:212},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:180},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:244},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:204},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:172},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:236},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:156},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:220},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:188},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:252},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:194},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:162},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:226},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:146},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:210},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:178},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:242},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:202},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:170},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:234},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:154},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:218},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:186},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:250},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:198},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:166},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:230},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:150},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:214},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:182},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:246},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:206},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:174},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:238},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:158},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:222},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:190},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:254},{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:193},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:161},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:225},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:145},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:209},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:177},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:241},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:201},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:169},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:233},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:153},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:217},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:185},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:249},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:197},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:165},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:229},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:149},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:213},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:181},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:245},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:205},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:173},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:237},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:157},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:221},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:189},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:253},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:195},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:163},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:227},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:147},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:211},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:243},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:203},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:171},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:235},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:155},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:219},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:187},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:251},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:199},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:167},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:231},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:151},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:215},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:183},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:247},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:207},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:175},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:239},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:159},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:223},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:191},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:255}]}if(!s){s=[{op:16,bits:5,val:1},{op:23,bits:5,val:257},{op:19,bits:5,val:17},{op:27,bits:5,val:4097},{op:17,bits:5,val:5},{op:25,bits:5,val:1025},{op:21,bits:5,val:65},{op:29,bits:5,val:16385},{op:16,bits:5,val:3},{op:24,bits:5,val:513},{op:20,bits:5,val:33},{op:28,bits:5,val:8193},{op:18,bits:5,val:9},{op:26,bits:5,val:2049},{op:22,bits:5,val:129},{op:64,bits:5,val:0},{op:16,bits:5,val:2},{op:23,bits:5,val:385},{op:19,bits:5,val:25},{op:27,bits:5,val:6145},{op:17,bits:5,val:7},{op:25,bits:5,val:1537},{op:21,bits:5,val:97},{op:29,bits:5,val:24577},{op:16,bits:5,val:4},{op:24,bits:5,val:769},{op:20,bits:5,val:49},{op:28,bits:5,val:12289},{op:18,bits:5,val:13},{op:26,bits:5,val:3073},{op:22,bits:5,val:193},{op:64,bits:5,val:0}]}aq.lencode=0;aq.distcode=512;for(ap=0;ap<512;ap++){aq.codes[ap]=T[ap]}for(ap=0;ap<32;ap++){aq.codes[ap+512]=s[ap]}aq.lenbits=9;aq.distbits=5}function ao(ar){var aq=ar.state;var ap=ar.output_data.length;if(aq.window===null){aq.window=""}if(aq.wsize==0){aq.wsize=1<<aq.wbits}if(ap>=aq.wsize){aq.window=ar.output_data.substring(ap-aq.wsize)}else{if(aq.whave+ap<aq.wsize){aq.window+=ar.output_data}else{aq.window=aq.window.substring(aq.whave-(aq.wsize-ap))+ar.output_data}}aq.whave=aq.window.length;if(aq.whave<aq.wsize){aq.wnext=aq.whave}else{aq.wnext=0}return 0}function l(aq,ar){var ap=[ar&255,(ar>>>8)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,2)}function m(aq,ar){var ap=[ar&255,(ar>>>8)&255,(ar>>>16)&255,(ar>>>24)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,4)}function Y(aq,ap){ap.strm=aq;ap.left=aq.avail_out;ap.next=aq.next_in;ap.have=aq.avail_in;ap.hold=aq.state.hold;ap.bits=aq.state.bits;return ap}function ag(ap){var aq=ap.strm;aq.next_in=ap.next;aq.avail_out=ap.left;aq.avail_in=ap.have;aq.state.hold=ap.hold;aq.state.bits=ap.bits}function O(ap){ap.hold=0;ap.bits=0}function af(ap){if(ap.have==0){return false}ap.have--;ap.hold+=(ap.strm.input_data.charCodeAt(ap.next++)&255)<<ap.bits;ap.bits+=8;return true}function ac(aq,ap){while(aq.bits<ap){if(!af(aq)){return false}}return true}function b(aq,ap){return aq.hold&((1<<ap)-1)}function v(aq,ap){aq.hold>>>=ap;aq.bits-=ap}function c(ap){ap.hold>>>=ap.bits&7;ap.bits-=ap.bits&7}function ah(ap){return((ap>>>24)&255)+((ap>>>8)&65280)+((ap&65280)<<8)+((ap&255)<<24)}var H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(aC,ar){var aB;var aA;var ap,ay;var aq;var au=-1;var at=-1;var av;var aw;var ax;var az;if(!aC||!aC.state||(!aC.input_data&&aC.avail_in!=0)){return ZLIB.Z_STREAM_ERROR}aB=aC.state;if(aB.mode==am){aB.mode=an}aA={};Y(aC,aA);ap=aA.have;ay=aA.left;az=ZLIB.Z_OK;inf_leave:for(;;){switch(aB.mode){case F:if(aB.wrap==0){aB.mode=an;break}if(!ac(aA,16)){break inf_leave}if((aB.wrap&2)&&aA.hold==35615){aB.check=aC.checksum_function(0,null,0,0);l(aC,aA.hold);O(aA);aB.mode=C;break}aB.flags=0;if(aB.head!==null){aB.head.done=-1}if(!(aB.wrap&1)||((b(aA,8)<<8)+(aA.hold>>>8))%31){aC.msg="incorrect header check";aB.mode=a;break}if(b(aA,4)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}v(aA,4);ax=b(aA,4)+8;if(aB.wbits==0){aB.wbits=ax}else{if(ax>aB.wbits){aC.msg="invalid window size";aB.mode=a;break}}aB.dmax=1<<ax;aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=aA.hold&512?p:am;O(aA);break;case C:if(!ac(aA,16)){break inf_leave}aB.flags=aA.hold;if((aB.flags&255)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}if(aB.flags&57344){aC.msg="unknown header flags set";aB.mode=a;break}if(aB.head!==null){aB.head.text=(aA.hold>>>8)&1}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=al;case al:if(!ac(aA,32)){break inf_leave}if(aB.head!==null){aB.head.time=aA.hold}if(aB.flags&512){m(aC,aA.hold)}O(aA);aB.mode=ae;case ae:if(!ac(aA,16)){break inf_leave}if(aB.head!==null){aB.head.xflags=aA.hold&255;aB.head.os=aA.hold>>>8}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=z;case z:if(aB.flags&1024){if(!ac(aA,16)){break inf_leave}aB.length=aA.hold;if(aB.head!==null){aB.head.extra_len=aA.hold}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.head.extra=""}else{if(aB.head!==null){aB.head.extra=null}}aB.mode=A;case A:if(aB.flags&1024){aq=aB.length;if(aq>aA.have){aq=aA.have}if(aq){if(aB.head!==null&&aB.head.extra!==null){ax=aB.head.extra_len-aB.length;aB.head.extra+=aC.input_data.substring(aA.next,aA.next+(ax+aq>aB.head.extra_max?aB.head.extra_max-ax:aq))}if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;aB.length-=aq}if(aB.length){break inf_leave}}aB.length=0;aB.mode=ab;case ab:if(aB.flags&2048){if(aA.have==0){break inf_leave}if(aB.head!==null&&aB.head.name===null){aB.head.name=""}aq=0;do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.name_max){aB.head.name+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.name=null}}aB.length=0;aB.mode=h;case h:if(aB.flags&4096){if(aA.have==0){break inf_leave}aq=0;if(aB.head!==null&&aB.head.comment===null){aB.head.comment=""}do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.comm_max){aB.head.comment+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.comment=null}}aB.mode=E;case E:if(aB.flags&512){if(!ac(aA,16)){break inf_leave}if(aA.hold!=(aB.check&65535)){aC.msg="header crc mismatch";aB.mode=a;break}O(aA)}if(aB.head!==null){aB.head.hcrc=(aB.flags>>>9)&1;aB.head.done=1}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;break;case p:if(!ac(aA,32)){break inf_leave}aC.adler=aB.check=ah(aA.hold);O(aA);aB.mode=o;case o:if(aB.havedict==0){ag(aA);return ZLIB.Z_NEED_DICT}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;case am:if(ar==ZLIB.Z_BLOCK||ar==ZLIB.Z_TREES){break inf_leave}case an:if(aB.last){c(aA);aB.mode=d;break}if(!ac(aA,3)){break inf_leave}aB.last=b(aA,1);v(aA,1);switch(b(aA,2)){case 0:aB.mode=ai;break;case 1:B(aB);aB.mode=R;if(ar==ZLIB.Z_TREES){v(aA,2);break inf_leave}break;case 2:aB.mode=ak;break;case 3:aC.msg="invalid block type";aB.mode=a}v(aA,2);break;case ai:c(aA);if(!ac(aA,32)){break inf_leave}if((aA.hold&65535)!=(((aA.hold>>>16)&65535)^65535)){aC.msg="invalid stored block lengths";aB.mode=a;break}aB.length=aA.hold&65535;O(aA);aB.mode=k;if(ar==ZLIB.Z_TREES){break inf_leave}case k:aB.mode=j;case j:aq=aB.length;if(aq){if(aq>aA.have){aq=aA.have}if(aq>aA.left){aq=aA.left}if(aq==0){break inf_leave}aC.output_data+=aC.input_data.substring(aA.next,aA.next+aq);aC.next_out+=aq;aA.have-=aq;aA.next+=aq;aA.left-=aq;aB.length-=aq;break}aB.mode=am;break;case ak:if(!ac(aA,14)){break inf_leave}aB.nlen=b(aA,5)+257;v(aA,5);aB.ndist=b(aA,5)+1;v(aA,5);aB.ncode=b(aA,4)+4;v(aA,4);if(aB.nlen>286||aB.ndist>30){aC.msg="too many length or distance symbols";aB.mode=a;break}aB.have=0;aB.mode=V;case V:while(aB.have<aB.ncode){if(!ac(aA,3)){break inf_leave}var aD=b(aA,3);aB.lens[H[aB.have++]]=aD;v(aA,3)}while(aB.have<19){aB.lens[H[aB.have++]]=0}aB.next=0;aB.lencode=0;aB.lenbits=7;az=J(aB,g);if(az){aC.msg="invalid code lengths set";aB.mode=a;break}aB.have=0;aB.mode=f;case f:while(aB.have<aB.nlen+aB.ndist){for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.val<16){v(aA,av.bits);aB.lens[aB.have++]=av.val}else{if(av.val==16){if(!ac(aA,av.bits+2)){break inf_leave}v(aA,av.bits);if(aB.have==0){aC.msg="invalid bit length repeat";aB.mode=a;break}ax=aB.lens[aB.have-1];aq=3+b(aA,2);v(aA,2)}else{if(av.val==17){if(!ac(aA,av.bits+3)){break inf_leave}v(aA,av.bits);ax=0;aq=3+b(aA,3);v(aA,3)}else{if(!ac(aA,av.bits+7)){break inf_leave}v(aA,av.bits);ax=0;aq=11+b(aA,7);v(aA,7)}}if(aB.have+aq>aB.nlen+aB.ndist){aC.msg="invalid bit length repeat";aB.mode=a;break}while(aq--){aB.lens[aB.have++]=ax}}}if(aB.mode==a){break}if(aB.lens[256]==0){aC.msg="invalid code -- missing end-of-block";aB.mode=a;break}aB.next=0;aB.lencode=aB.next;aB.lenbits=9;az=J(aB,W);if(az){aC.msg="invalid literal/lengths set";aB.mode=a;break}aB.distcode=aB.next;aB.distbits=6;az=J(aB,t);if(az){aC.msg="invalid distances set";aB.mode=a;break}aB.mode=R;if(ar==ZLIB.Z_TREES){break inf_leave}case R:aB.mode=P;case P:if(aA.have>=6&&aA.left>=258){ag(aA);G(aC,ay);Y(aC,aA);if(aB.mode==am){aB.back=-1}break}aB.back=0;for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.op&&(av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.lencode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if(aw.bits+av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;aB.length=av.val;if(av.op==0){aB.mode=X;break}if(av.op&32){aB.back=-1;aB.mode=am;break}if(av.op&64){aC.msg="invalid literal/length code";aB.mode=a;break}aB.extra=av.op&15;aB.mode=S;case S:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.length+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.was=aB.length;aB.mode=q;case q:for(;;){av=aB.codes[aB.distcode+b(aA,aB.distbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if((av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.distcode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if((aw.bits+av.bits)<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;if(av.op&64){aC.msg="invalid distance code";aB.mode=a;break}aB.offset=av.val;aB.extra=av.op&15;aB.mode=r;case r:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.offset+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.mode=Z;case Z:if(aA.left==0){break inf_leave}aq=ay-aA.left;if(aB.offset>aq){aq=aB.offset-aq;if(aq>aB.whave){if(aB.sane){aC.msg="invalid distance too far back";aB.mode=a;break}}if(aq>aB.wnext){aq-=aB.wnext;au=aB.wsize-aq;at=-1}else{au=aB.wnext-aq;at=-1}if(aq>aB.length){aq=aB.length}}else{au=-1;at=aC.next_out-aB.offset;aq=aB.length}if(aq>aA.left){aq=aA.left}aA.left-=aq;aB.length-=aq;if(au>=0){aC.output_data+=aB.window.substring(au,au+aq);aC.next_out+=aq;aq=0}else{aC.next_out+=aq;do{aC.output_data+=aC.output_data.charAt(at++)}while(--aq)}if(aB.length==0){aB.mode=P}break;case X:if(aA.left==0){break inf_leave}aC.output_data+=String.fromCharCode(aB.length);aC.next_out++;aA.left--;aB.mode=P;break;case d:if(aB.wrap){if(!ac(aA,32)){break inf_leave}ay-=aA.left;aC.total_out+=ay;aB.total+=ay;if(ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,aC.output_data.length-ay,ay)}ay=aA.left;if((aB.flags?aA.hold:ah(aA.hold))!=aB.check){aC.msg="incorrect data check";aB.mode=a;break}O(aA)}aB.mode=U;case U:if(aB.wrap&&aB.flags){if(!ac(aA,32)){break inf_leave}if(aA.hold!=(aB.total&4294967295)){aC.msg="incorrect length check";aB.mode=a;break}O(aA)}aB.mode=u;case u:az=ZLIB.Z_STREAM_END;break inf_leave;case a:az=ZLIB.Z_DATA_ERROR;break inf_leave;case aa:return ZLIB.Z_MEM_ERROR;case aj:default:return ZLIB.Z_STREAM_ERROR}}inf_leave:ag(aA);if(aB.wsize||(ay!=aC.avail_out&&aB.mode<a&&(aB.mode<d||ar!=ZLIB.Z_FINISH))){if(ao(aC)){aB.mode=aa;return ZLIB.Z_MEM_ERROR}}ap-=aC.avail_in;ay-=aC.avail_out;aC.total_in+=ap;aC.total_out+=ay;aB.total+=ay;if(aB.wrap&&ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,0,aC.output_data.length)}aC.data_type=aB.bits+(aB.last?64:0)+(aB.mode==am?128:0)+(aB.mode==R||aB.mode==k?256:0);if(((ap==0&&ay==0)||ar==ZLIB.Z_FINISH)&&az==ZLIB.Z_OK){az=ZLIB.Z_BUF_ERROR}return az};ZLIB.inflateEnd=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;ap.window=null;aq.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(at,au){var ar;var ap;var aq=16384;this.input_data=at;this.next_in=D(au,"next_in",0);this.avail_in=D(au,"avail_in",at.length-this.next_in);ar=D(au,"flush",ZLIB.Z_SYNC_FLUSH);ap=D(au,"avail_out",-1);var av="";do{this.avail_out=(ap>=0?ap:aq);this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,ar);if(ap>=0){return this.output_data}av+=this.output_data;if(this.avail_out>0){break}}while(this.error==ZLIB.Z_OK);return av};ZLIB.z_stream.prototype.inflateReset=function(ap){return ZLIB.inflateReset(this,ap)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js")}(function(){var c=65521;var d=5552;function b(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f.charCodeAt(j)&255;if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f.charCodeAt(j++)&255;k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(g--){e+=f.charCodeAt(j++)&255;k+=e}e%=c;k%=c}return e|(k<<16)}function a(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f[j];if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f[j++];k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(g--){e+=f[j++];k+=e}e%=c;k%=c}return e|(k<<16)}ZLIB.adler32=function(e,f,h,g){if(typeof f==="string"){return b(e,f,h,g)}else{return a(e,f,h,g)}};ZLIB.adler32_combine=function(e,f,g){var j;var k;var h;if(g<0){return 4294967295}g%=c;h=g;j=e&65535;k=h*j;k%=c;j+=(f&65535)+c-1;k+=((e>>16)&65535)+((f>>16)&65535)+c-h;if(j>=c){j-=c}if(j>=c){j-=c}if(k>=(c<<1)){k-=(c<<1)}if(k>=c){k-=c}return j|(k<<16)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js")}(function(){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function c(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g.charCodeAt(k++))&255]^(h>>>8)}while(--j)}return h^4294967295}function b(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g[k++])&255]^(h>>>8)}while(--j)}return h^4294967295}ZLIB.crc32=function(h,g,k,j){if(typeof g==="string"){return c(h,g,k,j)}else{return b(h,g,k,j)}};var d=32;function f(g,k){var j;var h=0;j=0;while(k){if(k&1){j^=g[h]}k>>=1;h++}return j}function e(j,g){var h;for(h=0;h<d;h++){j[h]=f(g,g[h])}}ZLIB.crc32_combine=function(g,h,k){var l;var o;var j;var m;if(k<=0){return g}j=new Array(d);m=new Array(d);m[0]=3988292384;o=1;for(l=1;l<d;l++){m[l]=o;o<<=1}e(j,m);e(m,j);do{e(j,m);if(k&1){g=f(j,g)}k>>=1;if(k==0){break}e(m,j);if(k&1){g=f(m,g)}k>>=1}while(k!=0);g^=h;return g}}());var CreateAmtRedirect=function(a){var b={};b.m=a;a.parent=b;b.State=0;b.socket=null;b.host=null;b.port=0;b.user=null;b.pass=null;b.authuri="/RedirectionService";b.tlsv1only=0;b.inDataCount=0;b.connectstate=0;b.protocol=a.protocol;b.debugmode=0;b.amtaccumulator="";b.amtsequence=1;b.amtkeepalivetimer=null;b.onStateChanged=null;b.Start=function(c,e,g,d,f){b.host=c;b.port=e;b.user=g;b.pass=d;b.connectstate=0;b.inDataCount=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+c+"&port="+e+"&tls="+f+((g=="*")?"&serverauth=1":"")+((typeof d==="undefined")?("&serverauth=1&user="+g):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed;b.xxStateChange(1)};b.xxOnSocketConnected=function(){if(b.debugmode==1){console.log("onSocketConnected")}b.xxStateChange(2);if(b.protocol==1){b.xxSend(b.RedirectStartSol)}if(b.protocol==2){b.xxSend(b.RedirectStartKvm)}if(b.protocol==3){b.xxSend(b.RedirectStartIder)}};b.xxOnMessage=function(g){if(b.debugmode==1){console.log("Recv",g.data)}b.inDataCount++;if(typeof g.data=="object"){var h=new FileReader();if(h.readAsBinaryString){h.onload=function(f){b.xxOnSocketData(f.target.result)};h.readAsBinaryString(new Blob([g.data]))}else{if(h.readAsArrayBuffer){h.onloadend=function(f){b.xxOnSocketData(f.target.result)};h.readAsArrayBuffer(g.data)}else{var c="";var d=new Uint8Array(g.data);var k=d.byteLength;for(var j=0;j<k;j++){c+=String.fromCharCode(d[j])}b.xxOnSocketData(c)}}}else{b.xxOnSocketData(g.data)}};b.xxOnSocketData=function(o){if(!o||b.connectstate==-1){return}if(typeof o==="object"){var g="";var j=new Uint8Array(o);var t=j.byteLength;for(var s=0;s<t;s++){g+=String.fromCharCode(j[s])}o=g}else{if(typeof o!=="string"){return}}if((b.protocol==2||b.protocol==3)&&b.connectstate==1){return b.m.ProcessData(o)}b.amtaccumulator+=o;while(b.amtaccumulator.length>=1){var k=0;switch(b.amtaccumulator.charCodeAt(0)){case 17:if(b.amtaccumulator.length<4){return}var G=b.amtaccumulator.charCodeAt(1);switch(G){case 0:if(b.amtaccumulator.length<13){return}var x=b.amtaccumulator.charCodeAt(12);if(b.amtaccumulator.length<13+x){return}b.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));k=(13+x);break;default:b.Stop(1);break}break;case 20:if(b.amtaccumulator.length<9){return}var e=ReadIntX(b.amtaccumulator,5);if(b.amtaccumulator.length<9+e){return}var F=b.amtaccumulator.charCodeAt(1);var f=b.amtaccumulator.charCodeAt(4);var c=[];for(s=0;s<e;s++){c.push(b.amtaccumulator.charCodeAt(9+s))}var d=b.amtaccumulator.substring(9,9+e);k=9+e;if(f==0){if(c.indexOf(4)>=0){b.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(b.user.length+b.authuri.length+8)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0,0))}else{if(c.indexOf(3)>=0){b.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(b.user.length+b.authuri.length+7)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0))}else{if(c.indexOf(1)>=0){b.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(b.user.length+b.pass.length+2)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(b.pass.length)+b.pass)}else{b.Stop(2)}}}}else{if((f==3||f==4)&&F==1){var n=0;var B=d.charCodeAt(n);var A=d.substring(n+1,n+1+B);n+=(B+1);var w=d.charCodeAt(n);var v=d.substring(n+1,n+1+w);n+=(w+1);var z=0;var y=null;var l=b.xxRandomNonce(32);var E="00000002";var q="";if(f==4){z=d.charCodeAt(n);y=d.substring(n+1,n+1+z);n+=(z+1);q=E+":"+l+":"+y+":"}var p=hex_md5(hex_md5(b.user+":"+A+":"+b.pass)+":"+v+":"+q+hex_md5("POST:"+b.authuri));var H=b.user.length+A.length+v.length+b.authuri.length+l.length+E.length+p.length+7;if(f==4){H+=(y.length+1)}var h=String.fromCharCode(19,0,0,0,f)+IntToStrX(H)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(A.length)+A+String.fromCharCode(v.length)+v+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(l.length)+l+String.fromCharCode(E.length)+E+String.fromCharCode(p.length)+p;if(f==4){h+=(String.fromCharCode(y.length)+y)}b.xxSend(h)}else{if(F==0){if(b.protocol==1){var u=10000;var J=100;var I=0;var D=10000;var C=100;var r=0;b.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(u)+ShortToStrX(J)+ShortToStrX(I)+ShortToStrX(D)+ShortToStrX(C)+ShortToStrX(r)+IntToStrX(0))}if(b.protocol==2){b.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0))}if(b.protocol==3){b.connectstate=1;b.xxStateChange(3)}}else{b.Stop(3)}}}break;case 33:if(b.amtaccumulator.length<23){break}k=23;b.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(b.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));if(b.protocol==1){b.amtkeepalivetimer=setInterval(b.xxSendAmtKeepAlive,2000)}b.connectstate=1;b.xxStateChange(3);break;case 41:if(b.amtaccumulator.length<10){break}k=10;break;case 42:if(b.amtaccumulator.length<10){break}var m=(10+((b.amtaccumulator.charCodeAt(9)&255)<<8)+(b.amtaccumulator.charCodeAt(8)&255));if(b.amtaccumulator.length<m){break}b.m.ProcessData(b.amtaccumulator.substring(10,m));k=m;break;case 43:if(b.amtaccumulator.length<8){break}k=8;break;case 65:if(b.amtaccumulator.length<8){break}b.connectstate=1;b.m.Start();if(b.amtaccumulator.length>8){b.m.ProcessData(b.amtaccumulator.substring(8))}k=b.amtaccumulator.length;break;default:console.log("Unknown Intel AMT command: "+b.amtaccumulator.charCodeAt(0)+" acclen="+b.amtaccumulator.length);b.Stop(4);return}if(k==0){return}b.amtaccumulator=b.amtaccumulator.substring(k)}};b.xxSend=function(e){if(b.socket!=null&&b.socket.readyState==WebSocket.OPEN){if(b.debugmode==1){console.log("Send",e)}var c=new Uint8Array(e.length);for(var d=0;d<e.length;++d){c[d]=e.charCodeAt(d)}b.socket.send(c.buffer)}};b.send=function(c){if(b.socket==null||b.connectstate!=1){return}if(b.protocol==1){b.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(c.length)+c)}else{b.xxSend(c)}};b.xxSendAmtKeepAlive=function(){if(b.socket==null){return}b.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(b.amtsequence++))};b.xxRandomNonceX="abcdef0123456789";b.xxRandomNonce=function(d){var e="";for(var c=0;c<d;c++){e+=b.xxRandomNonceX.charAt(Math.floor(Math.random()*b.xxRandomNonceX.length))}return e};b.xxOnSocketClosed=function(){if(b.debugmode==1){console.log("onSocketClosed")}if((b.inDataCount==0)&&(b.tlsv1only==0)){b.tlsv1only=1;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+b.host+"&port="+b.port+"&tls="+b.tls+"&tls1only=1"+((b.user=="*")?"&serverauth=1":"")+((typeof pass==="undefined")?("&serverauth=1&user="+b.user):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed}else{b.Stop(5)}};b.xxStateChange=function(c){if(b.State==c){return}b.State=c;b.m.xxStateChange(b.State);if(b.onStateChanged!=null){b.onStateChanged(b,b.State)}};b.Stop=function(c){if(b.debugmode==1){console.log("onSocketStop",c)}b.xxStateChange(0);b.connectstate=-1;b.amtaccumulator="";if(b.socket!=null){b.socket.close();b.socket=null}if(b.amtkeepalivetimer!=null){clearInterval(b.amtkeepalivetimer);b.amtkeepalivetimer=null}};b.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);b.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);b.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return b};var CreateWsmanComm=function(g,k,m,j,l){var h={};h.PendingAjax=[];h.ActiveAjaxCount=0;h.MaxActiveAjaxCount=1;h.FailAllError=0;h.challengeParams=null;h.noncecounter=1;h.authcounter=0;h.socket=null;h.socketState=0;h.host=g;h.port=k;h.user=m;h.pass=j;h.tls=l;h.tlsv1only=1;h.cnonce=Math.random().toString(36).substring(7);h.PerformAjax=function(p,o,r,q,s,n){if(h.ActiveAjaxCount<h.MaxActiveAjaxCount&&h.PendingAjax.length==0){h.PerformAjaxEx(p,o,r,s,n)}else{if(q==1){h.PendingAjax.unshift([p,o,r,s,n])}else{h.PendingAjax.push([p,o,r,s,n])}}};h.PerformNextAjax=function(){if(h.ActiveAjaxCount>=h.MaxActiveAjaxCount||h.PendingAjax.length==0){return}var n=h.PendingAjax.shift();h.PerformAjaxEx(n[0],n[1],n[2],n[3],n[4]);h.PerformNextAjax()};h.PerformAjaxEx=function(p,o,q,r,n){if(h.FailAllError!=0){h.gotNextMessagesError({status:h.FailAllError},"error",null,[p,o,q,r,n]);return}if(!p){p=""}h.ActiveAjaxCount++;return h.PerformAjaxExNodeJS(p,o,q,r,n)};h.pendingAjaxCall=[];h.PerformAjaxExNodeJS=function(p,o,q,r,n){h.PerformAjaxExNodeJS2(p,o,q,r,n,3)};h.PerformAjaxExNodeJS2=function(p,o,r,s,n,q){if(q<=0||h.FailAllError!=0){h.ActiveAjaxCount--;if(h.FailAllError!=999){h.gotNextMessages(null,"error",{status:((h.FailAllError==0)?408:h.FailAllError)},[p,o,r,s,n])}h.PerformNextAjax();return}h.pendingAjaxCall.push([p,o,r,s,n,q]);if(h.socketState==0){h.xxConnectHttpSocket()}else{if(h.socketState==2){h.sendRequest(p,s,n)}}};h.sendRequest=function(p,r,n){r=r?r:"/wsman";n=n?n:"POST";var o=n+" "+r+" HTTP/1.1\r\n";if(h.challengeParams!=null){var q=hex_md5(hex_md5(h.user+":"+h.challengeParams.realm+":"+h.pass)+":"+h.challengeParams.nonce+":"+h.noncecounter+":"+h.cnonce+":"+h.challengeParams.qop+":"+hex_md5(n+":"+r));o+="Authorization: "+h.renderDigest({username:h.user,realm:h.challengeParams.realm,nonce:h.challengeParams.nonce,uri:r,qop:h.challengeParams.qop,response:q,nc:h.noncecounter++,cnonce:h.cnonce})+"\r\n"}o+="Host: "+h.host+":"+h.port+"\r\nTransfer-Encoding: chunked\r\n\r\n"+p.length.toString(16).toUpperCase()+"\r\n"+p+"\r\n0\r\n\r\n";f(o)};h.parseDigest=function(n){var o=n.substring(7).split(",");for(i in o){o[i]=o[i].trim()}return o.reduce(function(p,r){var q=r.split("=");p[q[0]]=q[1].replace(/"/g,"");return p},{})};h.renderDigest=function(n){var o=[];for(i in n){o.push(i)}return"Digest "+o.reduce(function(q,p){return q+","+p+'="'+n[p]+'"'},"").substring(1)};h.xxConnectHttpSocket=function(){h.socketParseState=0;h.socketAccumulator="";h.socketHeader=null;h.socketData="";h.socketState=1;console.log(h.tlsv1only);h.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=1&host="+h.host+"&port="+h.port+"&tls="+h.tls+"&tlsv1only="+h.tlsv1only+((m=="*")?"&serverauth=1":"")+((typeof j==="undefined")?("&serverauth=1&user="+m):""));h.socket.onopen=c;h.socket.onmessage=a;h.socket.onclose=b};function c(){h.socketState=2;for(i in h.pendingAjaxCall){h.sendRequest(h.pendingAjaxCall[i][0],h.pendingAjaxCall[i][3],h.pendingAjaxCall[i][4])}}function a(p){if(typeof p.data=="object"){var q=new FileReader();if(q.readAsBinaryString){q.onload=function(t){d(t.target.result)};q.readAsBinaryString(new Blob([p.data]))}else{if(q.readAsArrayBuffer){q.onloadend=function(t){d(t.target.result)};q.readAsArrayBuffer(p.data)}else{var n="";var o=new Uint8Array(p.data);var s=o.byteLength;for(var r=0;r<s;r++){n+=String.fromCharCode(o[r])}d(n)}}}else{if(typeof p.data=="string"){d(p.data)}}}function d(r){if(typeof r==="object"){var n="",o=new Uint8Array(r),u=o.byteLength;for(var t=0;t<u;t++){n+=String.fromCharCode(o[t])}r=n}else{if(typeof r!=="string"){return}}h.socketAccumulator+=r;while(true){if(h.socketParseState==0){var s=h.socketAccumulator.indexOf("\r\n\r\n");if(s<0){return}h.socketHeader=h.socketAccumulator.substring(0,s).split("\r\n");h.socketAccumulator=h.socketAccumulator.substring(s+4);h.socketParseState=1;h.socketData="";h.socketXHeader={Directive:h.socketHeader[0].split(" ")};for(t in h.socketHeader){if(t!=0){var v=h.socketHeader[t].indexOf(":");h.socketXHeader[h.socketHeader[t].substring(0,v).toLowerCase()]=h.socketHeader[t].substring(v+2)}}}if(h.socketParseState==1){var q=-1;if((h.socketXHeader.connection!=undefined)&&(h.socketXHeader.connection.toLowerCase()=="close")&&((h.socketXHeader["transfer-encoding"]==undefined)||(h.socketXHeader["transfer-encoding"].toLowerCase()!="chunked"))){q=0}else{if(h.socketXHeader["content-length"]!=undefined){q=parseInt(h.socketXHeader["content-length"]);if(h.socketAccumulator.length<q){return}var r=h.socketAccumulator.substring(0,q);h.socketAccumulator=h.socketAccumulator.substring(q);h.socketData=r;q=0}else{var p=h.socketAccumulator.indexOf("\r\n");if(p<0){return}q=parseInt(h.socketAccumulator.substring(0,p),16);if(isNaN(q)){if(h.websocket){h.websocket.close()}return}if(h.socketAccumulator.length<p+2+q+2){return}var r=h.socketAccumulator.substring(p+2,p+2+q);h.socketAccumulator=h.socketAccumulator.substring(p+2+q+2);h.socketData+=r}}if(q==0){e(h.socketXHeader,h.socketData);h.socketParseState=0;h.socketHeader=null}}}}function e(o,n){var q=parseInt(o.Directive[1]);if(isNaN(q)){q=602}if(q==401&&++(h.authcounter)<3){h.challengeParams=h.parseDigest(o["www-authenticate"])}else{var p=h.pendingAjaxCall.shift();h.authcounter=0;h.ActiveAjaxCount--;h.gotNextMessages(n,"success",{status:q},p);h.PerformNextAjax()}}function b(n){h.socketState=0;if(h.socket!=null){h.socket.close();h.socket=null}if(h.pendingAjaxCall.length>0){var o=h.pendingAjaxCall.shift();var p=o[5];h.PerformAjaxExNodeJS2(o[0],o[1],o[2],o[3],o[4],--p)}}function f(q){if(h.socketState==2&&h.socket!=null&&h.socket.readyState==WebSocket.OPEN){var n=new Uint8Array(q.length);for(var p=0;p<q.length;++p){n[p]=q.charCodeAt(p)}try{h.socket.send(n.buffer)}catch(o){}}}h.gotNextMessages=function(o,q,p,n){if(h.FailAllError==999){return}if(h.FailAllError!=0){n[1](null,h.FailAllError,n[2]);return}if(p.status!=200){n[1](null,p.status,n[2]);return}n[1](o,200,n[2])};h.gotNextMessagesError=function(p,q,o,n){if(h.FailAllError==999){return}if(h.FailAllError!=0){n[1](null,h.FailAllError,n[2]);return}n[1](h,null,{Header:{HttpError:p.status}},p.status,n[2])};h.CancelAllQueries=function(n){while(h.PendingAjax.length>0){var o=h.PendingAjax.shift();o[1](null,n,o[2])}if(h.websocket!=null){h.websocket.close();h.websocket=null;h.socketState=0}};return h};var CreateAgentRedirect=function(a,b,e){var c={};c.m=b;b.parent=c;c.meshserver=a;c.State=0;c.nodeid=null;c.socket=null;c.connectstate=-1;c.tunnelid=Math.random().toString(36).substring(2);c.protocol=b.protocol;c.onStateChanged=null;c.ctrlMsgAllowed=true;c.attemptWebRTC=false;c.webRtcActive=false;c.webSwitchOk=false;c.webchannel=null;c.webrtc=null;c.debugmode=0;c.Start=function(f){var h,g=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+c.tunnelid;c.nodeid=f;c.connectstate=0;c.socket=new WebSocket(g);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onerror=function(j){console.error(j)};c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1);c.meshserver.send({action:"msg",type:"tunnel",nodeid:c.nodeid,value:"*/meshrelay.ashx?id="+c.tunnelid})};c.xxOnSocketConnected=function(){if(c.debugmode==1){console.log("onSocketConnected")}c.xxStateChange(2)};c.xxOnControlCommand=function(h){var f;try{f=JSON.parse(h)}catch(g){return}if(f.ctrlChannel!="102938"){c.xxOnSocketData(h);return}if(c.webrtc!=null){if(f.type=="answer"){c.webrtc.setRemoteDescription(new RTCSessionDescription(f),function(){},c.xxCloseWebRTC)}else{if(f.type=="webrtc0"){c.webSwitchOk=true;d()}else{if(f.type=="webrtc1"){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}')}else{if(f.type=="webrtc2"){}}}}}};c.sendCtrlMsg=function(g){if(c.ctrlMsgAllowed==true){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof g,g)}try{c.socket.send(g)}catch(f){}}};function d(){if((c.webSwitchOk==true)&&(c.webRtcActive==true)){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}');c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}');if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}}}c.xxOnMessage=function(k){if(c.State<3){if(k.data=="c"){try{c.socket.send(c.protocol)}catch(l){}c.xxStateChange(3);if(c.attemptWebRTC==true){var j=null;if(typeof RTCPeerConnection!=="undefined"){c.webrtc=new RTCPeerConnection(j)}else{if(typeof webkitRTCPeerConnection!=="undefined"){c.webrtc=new webkitRTCPeerConnection(j)}}if(c.webrtc!=null){c.webchannel=c.webrtc.createDataChannel("DataChannel",{});c.webchannel.onmessage=function(f){c.xxOnMessage({data:f.data})};c.webchannel.onopen=function(){c.webRtcActive=true;d()};c.webchannel.onclose=function(f){if(c.webRtcActive){c.Stop()}};c.webrtc.onicecandidate=function(f){if(f.candidate==null){try{c.socket.send(JSON.stringify(c.webrtcoffer))}catch(p){}}else{c.webrtcoffer.sdp+=("a="+f.candidate.candidate+"\r\n")}};c.webrtc.oniceconnectionstatechange=function(){if(c.webrtc!=null){if(c.webrtc.iceConnectionState=="disconnected"){if(c.webRtcActive==true){c.Stop()}else{c.xxCloseWebRTC()}}else{if(c.webrtc.iceConnectionState=="failed"){c.xxCloseWebRTC()}}}};c.webrtc.createOffer(function(f){c.webrtcoffer=f;c.webrtc.setLocalDescription(f,function(){},c.xxCloseWebRTC)},c.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}}return}}if(typeof k.data=="string"){c.xxOnControlCommand(k.data);return}if(typeof k.data=="object"){var m=new FileReader();if(m.readAsBinaryString){m.onload=function(f){c.xxOnSocketData(f.target.result)};m.readAsBinaryString(new Blob([k.data]))}else{if(m.readAsArrayBuffer){m.onloadend=function(f){c.xxOnSocketData(f.target.result)};m.readAsArrayBuffer(k.data)}else{var g="";var h=new Uint8Array(k.data);var o=h.byteLength;for(var n=0;n<o;n++){g+=String.fromCharCode(h[n])}c.xxOnSocketData(g)}}}else{c.xxOnSocketData(k.data)}};c.xxOnSocketData=function(h){if(!h||c.connectstate==-1){return}if(typeof h==="object"){var f="",g=new Uint8Array(h),k=g.byteLength;for(var j=0;j<k;j++){f+=String.fromCharCode(g[j])}h=f}else{if(typeof h!=="string"){return}}if((typeof args!="undefined")&&args.redirtrace){console.log("RedirRecv",typeof h,h.length,h)}return c.m.ProcessData(h)};c.sendText=function(f){if(typeof f!="string"){f=JSON.stringify(f)}c.send(encode_utf8(f))};c.send=function(k){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof k,k.length,k)}try{if(c.socket!=null&&c.socket.readyState==WebSocket.OPEN){if(typeof k=="string"){if(c.debugmode==1){var f=new Uint8Array(k.length),g=[];for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j);g.push(k.charCodeAt(j))}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}else{var f=new Uint8Array(k.length);for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j)}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}}else{if(c.webRtcActive==true){c.webchannel.send(k)}else{c.socket.send(k)}}}}catch(h){}};c.xxOnSocketClosed=function(){c.Stop(1)};c.xxStateChange=function(f){if(c.State==f){return}c.State=f;c.m.xxStateChange(c.State);if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}};c.xxCloseWebRTC=function(){if(c.webchannel!=null){try{c.webchannel.close()}catch(f){}c.webchannel=null}if(c.webrtc!=null){try{c.webrtc.close()}catch(f){}c.webrtc=null}c.webRtcActive=false};c.Stop=function(g){if(c.debugmode==1){console.log("stop",g)}c.xxCloseWebRTC();c.connectstate=-1;if(c.socket!=null){try{if(c.socket.readyState==1){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}');c.socket.close()}}catch(f){}c.socket=null}c.xxStateChange(0)};return c};var CreateKvmDataChannel=function(d,b,a){var c={};c.m=b;b.parent=c;c.webchannel=d;c.State=0;c.protocol=b.protocol;c.onStateChanged=null;c.onControlMsg=null;c.debugmode=0;c.keepalive=a;c.rtcKeepAlive=null;c.Start=function(){if(c.debugmode==1){console.log("start")}c.xxStateChange(3);c.webchannel.onmessage=c.xxOnMessage;c.rtcKeepAlive=setInterval(c.xxSendRtcKeepAlive,30000)};c.xxOnMessage=function(j){if(typeof j.data=="string"){if(c.onControlMsg!=null){c.onControlMsg(j.data)}return}if(typeof j.data=="object"){var k=new FileReader();if(k.readAsBinaryString){k.onload=function(f){c.xxOnSocketData(f.target.result)};k.readAsBinaryString(new Blob([j.data]))}else{if(k.readAsArrayBuffer){k.onloadend=function(f){c.xxOnSocketData(f.target.result)};k.readAsArrayBuffer(j.data)}else{var g="",h=new Uint8Array(j.data),m=h.byteLength;for(var l=0;l<m;l++){g+=String.fromCharCode(h[l])}c.xxOnSocketData(g)}}}else{c.xxOnSocketData(j.data)}};c.xxOnSocketData=function(g){if(!g){return}if(typeof g==="object"){var e="",f=new Uint8Array(g),j=f.byteLength;for(var h=0;h<j;h++){e+=String.fromCharCode(f[h])}g=e}else{if(typeof g!=="string"){return}}return c.m.ProcessData(g)};c.sendCtrlMsg=function(e){if(typeof e=="string"){c.webchannel.send(e);if(c.keepalive!=null){c.keepalive.sendKeepAlive()}}};c.send=function(g){if(typeof g=="string"){var e=new Uint8Array(g.length);for(var f=0;f<g.length;++f){e[f]=g.charCodeAt(f)}g=e}c.webchannel.send(g)};c.xxStateChange=function(e){if(c.State==e){return}c.State=e;c.m.xxStateChange(c.State);if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}};c.Stop=function(){if(c.debugmode==1){console.log("stop")}if(c.rtcKeepAlive!=null){clearInterval(c.rtcKeepAlive);c.rtcKeepAlive=null}c.xxStateChange(0)};c.xxSendRtcKeepAlive=function(){c.sendCtrlMsg(JSON.stringify({action:"ping"}))};return c};var CreateAgentRemoteDesktop=function(a,e){var d={};d.CanvasId=a;if(typeof a==="string"){d.CanvasId=Q(a)}d.Canvas=d.CanvasId.getContext("2d");d.scrolldiv=e;d.State=0;d.PendingOperations=[];d.tilesReceived=0;d.TilesDrawn=0;d.KillDraw=0;d.ipad=false;d.tabletKeyboardVisible=false;d.LastX=0;d.LastY=0;d.touchenabled=0;d.submenuoffset=0;d.touchtimer=null;d.TouchArray={};d.connectmode=0;d.connectioncount=0;d.rotation=0;d.protocol=2;d.debugmode=0;d.firstUpKeys=[];d.stopInput=false;d.sessionid=0;d.username;d.oldie=false;d.CompressionLevel=50;d.ScalingLevel=1024;d.FrameRateTimer=50;d.FirstDraw=false;d.ScreenWidth=960;d.ScreenHeight=700;d.width=960;d.height=960;d.onScreenSizeChange=null;d.onMessage=null;d.onConnectCountChanged=null;d.onDebugMessage=null;d.onTouchEnabledChanged=null;d.onDisplayinfo=null;d.Start=function(){d.State=0};d.Stop=function(){d.setRotation(0);d.UnGrabKeyInput();d.UnGrabMouseInput();d.touchenabled=0;if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}d.Canvas.clearRect(0,0,d.CanvasId.width,d.CanvasId.height)};d.xxStateChange=function(f){if(d.State==f){return}d.State=f;switch(f){case 0:d.Stop();break;case 3:break}};d.send=function(f){if(d.debugmode>1){console.log("KSend("+f.length+"): "+rstr2hex(f))}d.parent.send(f)};d.ProcessPictureMsg=function(g,j,k){var h=new Image();h.xcount=d.tilesReceived++;var f=d.tilesReceived;h.src="data:image/jpeg;base64,"+btoa(g.substring(4,g.length));h.onload=function(){if(d.Canvas!=null&&d.KillDraw<f&&d.State!=0){d.PendingOperations.push([f,2,h,j,k]);while(d.DoPendingOperations()){}}};h.error=function(){console.log("DecodeTileError")}};d.DoPendingOperations=function(){if(d.PendingOperations.length==0){return false}for(var f=0;f<d.PendingOperations.length;f++){var g=d.PendingOperations[f];if(g[0]==(d.TilesDrawn+1)){if(g[1]==1){d.ProcessCopyRectMsg(g[2])}else{if(g[1]==2){d.Canvas.drawImage(g[2],d.rotX(g[3],g[4]),d.rotY(g[3],g[4]));delete g[2]}}d.PendingOperations.splice(f,1);delete g;d.TilesDrawn++;if(d.TilesDrawn==d.tilesReceived&&d.KillDraw<d.TilesDrawn){d.KillDraw=d.TilesDrawn=d.tilesReceived=0}return true}}if(d.oldie&&d.PendingOperations.length>0){d.TilesDrawn++}return false};d.ProcessCopyRectMsg=function(j){var k=((j.charCodeAt(0)&255)<<8)+(j.charCodeAt(1)&255);var l=((j.charCodeAt(2)&255)<<8)+(j.charCodeAt(3)&255);var f=((j.charCodeAt(4)&255)<<8)+(j.charCodeAt(5)&255);var g=((j.charCodeAt(6)&255)<<8)+(j.charCodeAt(7)&255);var m=((j.charCodeAt(8)&255)<<8)+(j.charCodeAt(9)&255);var h=((j.charCodeAt(10)&255)<<8)+(j.charCodeAt(11)&255);d.Canvas.drawImage(Canvas.canvas,k,l,m,h,f,g,m,h)};d.SendUnPause=function(){d.send(String.fromCharCode(0,8,0,5,0))};d.SendPause=function(){d.send(String.fromCharCode(0,8,0,5,1))};d.SendCompressionLevel=function(j,g,h,f){if(g){d.CompressionLevel=g}if(h){d.ScalingLevel=h}if(f){d.FrameRateTimer=f}d.send(String.fromCharCode(0,5,0,10,j,d.CompressionLevel)+d.shortToStr(d.ScalingLevel)+d.shortToStr(d.FrameRateTimer))};d.SendRefresh=function(){d.send(String.fromCharCode(0,6,0,4))};d.ProcessScreenMsg=function(g,f){if(d.debugmode>0){console.log("ScreenSize: "+g+" x "+f)}d.Canvas.setTransform(1,0,0,1,0,0);d.rotation=0;d.FirstDraw=true;d.ScreenWidth=d.width=g;d.ScreenHeight=d.height=f;d.KillDraw=d.tilesReceived;while(d.PendingOperations.length>0){d.PendingOperations.shift()}d.SendCompressionLevel(1);d.SendUnPause();if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}};d.ProcessData=function(g){var f=0;while(f<g.length){f+=d.ProcessDataEx(g.substring(f))}};d.ProcessDataEx=function(p){if(d.debugmode>1){console.log("KRecv("+p.length+"): "+rstr2hex(p.substring(0,Math.min(p.length,40))))}if(p.length<4){return}var f=null,q=0,r=0,h=ReadShort(p,0),g=ReadShort(p,2);if((g!=p.length)&&(d.debugmode>0)){console.log(g,p.length,g==p.length)}if(h>=18){if(h==65){console.error(p);alert(p)}else{console.error("Invalid KVM command "+h+" of size "+g);console.log("Invalid KVM data",p.length,p,rstr2hex(p));return}}if(g>p.length){console.error("KVM invalid command size",g,p.length);return}if(h==3||h==4||h==7){f=p.substring(4,g);q=((f.charCodeAt(0)&255)<<8)+(f.charCodeAt(1)&255);r=((f.charCodeAt(2)&255)<<8)+(f.charCodeAt(3)&255);if(d.debugmode>0){console.log("CMD"+h+" at X="+q+" Y="+r)}}switch(h){case 3:if(d.FirstDraw){d.onResize()}d.ProcessPictureMsg(f,q,r);break;case 4:if(d.FirstDraw){d.onResize()}if(d.TilesDrawn==d.tilesReceived){d.ProcessCopyRectMsg(f)}else{d.PendingOperations.push([++tilesReceived,1,f])}break;case 7:d.ProcessScreenMsg(q,r);d.SendKeyMsgKC(d.KeyAction.UP,16);d.SendKeyMsgKC(d.KeyAction.UP,17);d.SendKeyMsgKC(d.KeyAction.UP,18);d.SendKeyMsgKC(d.KeyAction.UP,91);d.SendKeyMsgKC(d.KeyAction.UP,92);d.SendKeyMsgKC(d.KeyAction.UP,16);d.send(String.fromCharCode(0,14,0,4));break;case 11:var m=[],j=((p.charCodeAt(4)&255)<<8)+(p.charCodeAt(5)&255);if(j>0){var o=0,n=((p.charCodeAt(6+(j*2))&255)<<8)+(p.charCodeAt(7+(j*2))&255);for(var l=0;l<j;l++){var k=((p.charCodeAt(6+(l*2))&255)<<8)+(p.charCodeAt(7+(l*2))&255);if(k==65535){m.push("All Displays")}else{m.push("Display "+k)}if(k==n){o=l}}}if(d.onDisplayinfo!=null){d.onDisplayinfo(d,m,o)}break;case 12:break;case 14:d.touchenabled=1;d.TouchArray={};if(d.onTouchEnabledChanged!=null){d.onTouchEnabledChanged(d.touchenabled)}break;case 15:d.TouchArray={};break;case 16:d.connectioncount=ReadInt(p,4);if(d.onConnectCountChanged!=null){d.onConnectCountChanged(d.connectioncount,d)}break;case 17:if(d.onMessage!=null){d.onMessage(p.substring(4,g),d)}break}return g};d.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};d.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5};d.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};d.Alternate=0;var c={Pause:19,CapsLock:20,Space:32,Quote:222,Minus:189,NumpadMultiply:106,NumpadAdd:107,PrintScreen:44,Comma:188,NumpadSubtract:109,NumpadDecimal:110,Period:190,Slash:191,NumpadDivide:111,Semicolon:186,Equal:187,OSLeft:91,BracketLeft:219,OSRight:91,Backslash:220,BracketRight:221,ContextMenu:93,Backquote:192,NumLock:144,ScrollLock:145,Backspace:8,Tab:9,Enter:13,NumpadEnter:13,Escape:27,Delete:46,Home:36,PageUp:33,PageDown:34,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,End:35,Insert:45,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,VolumeMute:181};function b(f){if(f.code.startsWith("Key")&&f.code.length==4){return f.code.charCodeAt(3)}if(f.code.startsWith("Digit")&&f.code.length==6){return f.code.charCodeAt(5)}if(f.code.startsWith("Numpad")&&f.code.length==7){return f.code.charCodeAt(6)+48}return c[f.code]}d.SendKeyMsg=function(f,g){if(f==null){return}if(!g){g=window.event}if(g.code){var h=b(g);if(h!=null){d.SendKeyMsgKC(f,h)}}else{var h=g.keyCode;if(h==59){h=186}d.SendKeyMsgKC(f,h)}};d.SendMessage=function(f){if(d.State==3){d.send(String.fromCharCode(0,17)+d.shortToStr(4+f.length)+f)}};d.SendKeyMsgKC=function(f,h){if(d.State!=3){return}if(typeof f=="object"){for(var g in f){d.SendKeyMsgKC(f[g][0],f[g][1])}}else{d.send(String.fromCharCode(0,d.InputType.KEY,0,6,(f-1),h))}};d.sendcad=function(){d.SendCtrlAltDelMsg()};d.SendCtrlAltDelMsg=function(){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.CTRLALTDEL,0,4))}};d.SendEscKey=function(){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.KEY,0,6,0,27,0,d.InputType.KEY,0,6,1,27))}};d.SendStartMsg=function(){d.SendKeyMsgKC(d.KeyAction.EXDOWN,91);d.SendKeyMsgKC(d.KeyAction.EXUP,91)};d.SendCharmsMsg=function(){d.SendKeyMsgKC(d.KeyAction.EXDOWN,91);d.SendKeyMsgKC(d.KeyAction.DOWN,67);d.SendKeyMsgKC(d.KeyAction.UP,67);d.SendKeyMsgKC(d.KeyAction.EXUP,91)};d.SendTouchMsg1=function(g,f,h,j){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.TOUCH)+d.shortToStr(14)+String.fromCharCode(1,g)+d.intToStr(f)+d.shortToStr(h)+d.shortToStr(j))}};d.SendTouchMsg2=function(h,f){var l="";var g;var m="TOUCHSEND: ";for(var j in d.TouchArray){if(j==h){g=f}else{if(d.TouchArray[j].f==1){g=65536|2|4;d.TouchArray[j].f=3;m+="START"+j}else{if(d.TouchArray[j].f==2){g=262144;m+="STOP"+j}else{g=2|4|131072}}}l+=String.fromCharCode(j)+d.intToStr(g)+d.shortToStr(d.TouchArray[j].x)+d.shortToStr(d.TouchArray[j].y);if(d.TouchArray[j].f==2){delete d.TouchArray[j]}}if(d.State==3){d.send(String.fromCharCode(0,d.InputType.TOUCH)+d.shortToStr(5+l.length)+String.fromCharCode(2)+l)}if(Object.keys(d.TouchArray).length==0&&d.touchtimer!=null){clearInterval(d.touchtimer);d.touchtimer=null}};d.SendMouseMsg=function(f,j){if(d.State!=3){return}if(f!=null&&d.Canvas!=null){if(!j){var j=window.event}var m=(d.Canvas.canvas.height/d.CanvasId.clientHeight);var n=(d.Canvas.canvas.width/d.CanvasId.clientWidth);var l=d.GetPositionOfControl(d.Canvas.canvas);var o=((j.pageX-l[0])*n);var p=((j.pageY-l[1])*m);if(o>=0&&o<=d.Canvas.canvas.width&&p>=0&&p<=d.Canvas.canvas.height){var g=0;var h=0;if(f==d.KeyAction.UP||f==d.KeyAction.DOWN){if(j.which){((j.which==1)?(g=d.MouseButton.LEFT):((j.which==2)?(g=d.MouseButton.MIDDLE):(g=d.MouseButton.RIGHT)))}else{if(j.button){((j.button==0)?(g=d.MouseButton.LEFT):((j.button==1)?(g=d.MouseButton.MIDDLE):(g=d.MouseButton.RIGHT)))}}}else{if(f==d.KeyAction.SCROLL){if(j.detail){h=(-1*(j.detail*120))}else{if(j.wheelDelta){h=(j.wheelDelta*3)}}}}var k="";if(f==d.KeyAction.SCROLL){k=String.fromCharCode(0,d.InputType.MOUSE,0,12,0,((f==d.KeyAction.DOWN)?g:((g*2)&255)),((o/256)&255),(o&255),((p/256)&255),(p&255),((h/256)&255),(h&255))}else{k=String.fromCharCode(0,d.InputType.MOUSE,0,10,0,((f==d.KeyAction.DOWN)?g:((g*2)&255)),((o/256)&255),(o&255),((p/256)&255),(p&255))}if(d.Action==d.KeyAction.NONE){if(d.Alternate==0||d.ipad){d.send(k);d.Alternate=1}else{d.Alternate=0}}else{d.send(k)}}}};d.GetDisplayNumbers=function(){d.send(String.fromCharCode(0,11,0,4))};d.SetDisplay=function(f){d.send(String.fromCharCode(0,12,0,6,f>>8,f&255))};d.intToStr=function(f){return String.fromCharCode((f>>24)&255,(f>>16)&255,(f>>8)&255,f&255)};d.shortToStr=function(f){return String.fromCharCode((f>>8)&255,f&255)};d.onResize=function(){if(d.ScreenWidth==0||d.ScreenHeight==0){return}if(d.Canvas.canvas.width==d.ScreenWidth&&d.Canvas.canvas.height==d.ScreenHeight){return}if(d.FirstDraw){d.Canvas.canvas.width=d.ScreenWidth;d.Canvas.canvas.height=d.ScreenHeight;d.Canvas.fillRect(0,0,d.ScreenWidth,d.ScreenHeight);if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}}d.FirstDraw=false};d.xxMouseInputGrab=false;d.xxKeyInputGrab=false;d.xxMouseMove=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.NONE,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxMouseUp=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.UP,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxMouseDown=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.DOWN,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxDOMMouseScroll=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.SCROLL,f);return false}return true};d.xxMouseWheel=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.SCROLL,f);return false}return true};d.xxKeyUp=function(f){if(d.State==3){d.SendKeyMsg(d.KeyAction.UP,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxKeyDown=function(f){if(d.State==3){d.SendKeyMsg(d.KeyAction.DOWN,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxKeyPress=function(f){if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.handleKeys=function(f){if(d.stopInput==true||desktop.State!=3){return false}return d.xxKeyPress(f)};d.handleKeyUp=function(f){if(d.stopInput==true||desktop.State!=3){return false}if(d.firstUpKeys.length<5){d.firstUpKeys.push(f.keyCode);if((d.firstUpKeys.length==5)){var g=d.firstUpKeys.join(",");if((g=="16,17,91,91,16")||(g=="16,17,18,91,92")){d.stopInput=true}}}return d.xxKeyUp(f)};d.handleKeyDown=function(f){if(d.stopInput==true||desktop.State!=3){return false}return d.xxKeyDown(f)};d.mousedown=function(f){if(d.stopInput==true){return false}return d.xxMouseDown(f)};d.mouseup=function(f){if(d.stopInput==true){return false}return d.xxMouseUp(f)};d.mousemove=function(f){if(d.stopInput==true){return false}return d.xxMouseMove(f)};d.mousewheel=function(f){if(d.stopInput==true){return false}return d.xxMouseWheel(f)};d.xxMsTouchEvent=function(f){if(f.originalEvent.pointerType==4){return}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}if(f.type=="MSPointerDown"||f.type=="MSPointerMove"||f.type=="MSPointerUp"){var g=0;var h=f.originalEvent.pointerId%256;var j=f.offsetX*(Canvas.canvas.width/d.CanvasId.clientWidth);var k=f.offsetY*(Canvas.canvas.height/d.CanvasId.clientHeight);if(f.type=="MSPointerDown"){g=65536|2|4}else{if(f.type=="MSPointerMove"){g=131072|2|4}else{if(f.type=="MSPointerUp"){g=262144}}}if(!d.TouchArray[h]){d.TouchArray[h]={x:j,y:k}}d.SendTouchMsg2(h,g);if(f.type=="MSPointerUp"){delete d.TouchArray[h]}}else{alert(f.type)}return true};d.xxTouchStart=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}var k=f.originalEvent.touches[0];f.which=1;d.LastX=f.pageX=k.pageX;d.LastY=f.pageY=k.pageY;d.SendMouseMsg(KeyAction.DOWN,f)}else{var j=d.GetPositionOfControl(Canvas.canvas);for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(!d.TouchArray[h]){d.TouchArray[h]={x:(f.originalEvent.touches[g].pageX-j[0])*(Canvas.canvas.width/d.CanvasId.clientWidth),y:(f.originalEvent.touches[g].pageY-j[1])*(Canvas.canvas.height/d.CanvasId.clientHeight),f:1}}}if(Object.keys(d.TouchArray).length>0&&touchtimer==null){d.touchtimer=setInterval(function(){d.SendTouchMsg2(256,0)},50)}}};d.xxTouchMove=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}var k=f.originalEvent.touches[0];f.which=1;d.LastX=f.pageX=k.pageX;d.LastY=f.pageY=k.pageY;d.SendMouseMsg(d.KeyAction.NONE,f)}else{var j=d.GetPositionOfControl(Canvas.canvas);for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(d.TouchArray[h]){d.TouchArray[h].x=(f.originalEvent.touches[g].pageX-j[0])*(d.Canvas.canvas.width/d.CanvasId.clientWidth);d.TouchArray[h].y=(f.originalEvent.touches[g].pageY-j[1])*(d.Canvas.canvas.height/d.CanvasId.clientHeight)}}}};d.xxTouchEnd=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}f.which=1;f.pageX=LastX;f.pageY=LastY;d.SendMouseMsg(KeyAction.UP,f)}else{for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(d.TouchArray[h]){d.TouchArray[h].f=2}}}};d.GrabMouseInput=function(){if(d.xxMouseInputGrab==true){return}var f=d.CanvasId;f.onmousemove=d.xxMouseMove;f.onmouseup=d.xxMouseUp;f.onmousedown=d.xxMouseDown;f.touchstart=d.xxTouchStart;f.touchmove=d.xxTouchMove;f.touchend=d.xxTouchEnd;f.MSPointerDown=d.xxMsTouchEvent;f.MSPointerMove=d.xxMsTouchEvent;f.MSPointerUp=d.xxMsTouchEvent;if(navigator.userAgent.match(/mozilla/i)){f.DOMMouseScroll=d.xxDOMMouseScroll}else{f.onmousewheel=d.xxMouseWheel}d.xxMouseInputGrab=true};d.UnGrabMouseInput=function(){if(d.xxMouseInputGrab==false){return}var f=d.CanvasId;f.onmousemove=null;f.onmouseup=null;f.onmousedown=null;f.touchstart=null;f.touchmove=null;f.touchend=null;f.MSPointerDown=null;f.MSPointerMove=null;f.MSPointerUp=null;if(navigator.userAgent.match(/mozilla/i)){f.DOMMouseScroll=null}else{f.onmousewheel=null}d.xxMouseInputGrab=false};d.GrabKeyInput=function(){if(d.xxKeyInputGrab==true){return}document.onkeyup=d.xxKeyUp;document.onkeydown=d.xxKeyDown;document.onkeypress=d.xxKeyPress;d.xxKeyInputGrab=true};d.UnGrabKeyInput=function(){if(d.xxKeyInputGrab==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d.xxKeyInputGrab=false};d.GetPositionOfControl=function(f){var g=Array(2);g[0]=g[1]=0;while(f){g[0]+=f.offsetLeft;g[1]+=f.offsetTop;f=f.offsetParent}return g};d.crotX=function(f,g){if(d.rotation==0){return f}if(d.rotation==1){return g}if(d.rotation==2){return d.Canvas.canvas.width-f}if(d.rotation==3){return d.Canvas.canvas.height-g}};d.crotY=function(f,g){if(d.rotation==0){return g}if(d.rotation==1){return d.Canvas.canvas.width-f}if(d.rotation==2){return d.Canvas.canvas.height-g}if(d.rotation==3){return f}};d.rotX=function(f,g){if(d.rotation==0||d.rotation==1){return f}if(d.rotation==2){return f-d.Canvas.canvas.width}if(d.rotation==3){return f-d.Canvas.canvas.height}};d.rotY=function(f,g){if(d.rotation==0||d.rotation==3){return g}if(d.rotation==1){return g-d.Canvas.canvas.width}if(d.rotation==2){return g-d.Canvas.canvas.height}};d.tcanvas=null;d.setRotation=function(k){while(k<0){k+=4}var f=k%4;if(f==d.rotation){return true}var h=d.Canvas.canvas.width;var g=d.Canvas.canvas.height;if(d.rotation==1||d.rotation==3){h=d.Canvas.canvas.height;g=d.Canvas.canvas.width}if(d.tcanvas==null){d.tcanvas=document.createElement("canvas")}var j=d.tcanvas.getContext("2d");j.setTransform(1,0,0,1,0,0);j.canvas.width=h;j.canvas.height=g;j.rotate((d.rotation*-90)*Math.PI/180);if(d.rotation==0){j.drawImage(d.Canvas.canvas,0,0)}if(d.rotation==1){j.drawImage(d.Canvas.canvas,-d.Canvas.canvas.width,0)}if(d.rotation==2){j.drawImage(d.Canvas.canvas,-d.Canvas.canvas.width,-d.Canvas.canvas.height)}if(d.rotation==3){j.drawImage(d.Canvas.canvas,0,-d.Canvas.canvas.height)}if(d.rotation==0||d.rotation==2){d.Canvas.canvas.height=h;d.Canvas.canvas.width=g}if(d.rotation==1||d.rotation==3){d.Canvas.canvas.height=g;d.Canvas.canvas.width=h}d.Canvas.setTransform(1,0,0,1,0,0);d.Canvas.rotate((f*90)*Math.PI/180);d.rotation=f;d.Canvas.drawImage(d.tcanvas,d.rotX(0,0),d.rotY(0,0));d.ScreenWidth=d.Canvas.canvas.width;d.ScreenHeight=d.Canvas.canvas.height;if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}return true};d.MuchTheSame=function(f,g){return(Math.abs(f-g)<4)};d.Debug=function(f){console.log(f)};d.getIEVersion=function(){var f=-1;if(navigator.appName=="Microsoft Internet Explorer"){var h=navigator.userAgent;var g=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(g.exec(h)!=null){f=parseFloat(RegExp.$1)}}return f};d.haltEvent=function(f){if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};return d};var QRCode;!function(){function t(c){this.mode=v.MODE_8BIT_BYTE,this.data=c,this.parsedData=[];for(var g=[],h=0,j=this.data.length;j>h;h++){var k=this.data.charCodeAt(h);k>65536?(g[0]=240|(1835008&k)>>>18,g[1]=128|(258048&k)>>>12,g[2]=128|(4032&k)>>>6,g[3]=128|63&k):k>2048?(g[0]=224|(61440&k)>>>12,g[1]=128|(4032&k)>>>6,g[2]=128|63&k):k>128?(g[0]=192|(1984&k)>>>6,g[1]=128|63&k):g[0]=k,this.parsedData=this.parsedData.concat(g)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function u(c,d){this.typeNumber=c,this.errorCorrectLevel=d,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function B(e,f){if(void 0==e.length){throw new Error(e.length+"/"+f)}for(var g=0;g<e.length&&0==e[g];){g++}this.num=new Array(e.length-g+f);for(var h=0;h<e.length-g;h++){this.num[h]=e[h+g]}}function C(c,d){this.totalCount=c,this.dataCount=d}function D(){this.buffer=[],this.length=0}function F(){return"undefined"!=typeof CanvasRenderingContext2D}function G(){var c=!1,d=navigator.userAgent;return/android/i.test(d)&&(c=!0,aMat=d.toString().match(/android ([0-9]\.[0-9])/i),aMat&&aMat[1]&&(c=parseFloat(aMat[1]))),c}function K(d,j){for(var k=1,l=L(d),m=0,n=E.length;n>=m;m++){var o=0;switch(j){case w.L:o=E[m][0];break;case w.M:o=E[m][1];break;case w.Q:o=E[m][2];break;case w.H:o=E[m][3]}if(o>=l){break}k++}if(k>E.length){throw new Error("Too long data")}return k}function L(c){var d=encodeURI(c).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return d.length+(d.length!=c?3:0)}t.prototype={getLength:function(){return this.parsedData.length},write:function(d){for(var e=0,f=this.parsedData.length;f>e;e++){d.put(this.parsedData[e],8)}}},u.prototype={addData:function(a){var d=new t(a);this.dataList.push(d),this.dataCache=null},isDark:function(c,d){if(0>c||this.moduleCount<=c||0>d||this.moduleCount<=d){throw new Error(c+","+d)}return this.modules[c][d]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(b,f){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var g=0;g<this.moduleCount;g++){this.modules[g]=new Array(this.moduleCount);for(var h=0;h<this.moduleCount;h++){this.modules[g][h]=null}}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(b,f),this.typeNumber>=7&&this.setupTypeNumber(b),null==this.dataCache&&(this.dataCache=u.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,f)},setupPositionProbePattern:function(e,f){for(var g=-1;7>=g;g++){if(!(-1>=e+g||this.moduleCount<=e+g)){for(var h=-1;7>=h;h++){-1>=f+h||this.moduleCount<=f+h||(this.modules[e+g][f+h]=g>=0&&6>=g&&(0==h||6==h)||h>=0&&6>=h&&(0==g||6==g)||g>=2&&4>=g&&h>=2&&4>=h?!0:!1)}}}},getBestMaskPattern:function(){for(var e=0,f=0,g=0;8>g;g++){this.makeImpl(!0,g);var h=y.getLostPoint(this);(0==g||e>h)&&(e=h,f=g)}return f},createMovieClip:function(k,l,m){var n=k.createEmptyMovieClip(l,m),o=1;this.make();for(var p=0;p<this.modules.length;p++){for(var q=p*o,r=0;r<this.modules[p].length;r++){var s=r*o,M=this.modules[p][r];M&&(n.beginFill(0,100),n.moveTo(s,q),n.lineTo(s+o,q),n.lineTo(s+o,q+o),n.lineTo(s,q+o),n.endFill())}}return n},setupTimingPattern:function(){for(var c=8;c<this.moduleCount-8;c++){null==this.modules[c][6]&&(this.modules[c][6]=0==c%2)}for(var d=8;d<this.moduleCount-8;d++){null==this.modules[6][d]&&(this.modules[6][d]=0==d%2)}},setupPositionAdjustPattern:function(){for(var f=y.getPatternPosition(this.typeNumber),j=0;j<f.length;j++){for(var k=0;k<f.length;k++){var l=f[j],m=f[k];if(null==this.modules[l][m]){for(var n=-2;2>=n;n++){for(var o=-2;2>=o;o++){this.modules[l+n][m+o]=-2==n||2==n||-2==o||2==o||0==n&&0==o?!0:!1}}}}}},setupTypeNumber:function(e){for(var f=y.getBCHTypeNumber(this.typeNumber),g=0;18>g;g++){var h=!e&&1==(1&f>>g);this.modules[Math.floor(g/3)][g%3+this.moduleCount-8-3]=h}for(var g=0;18>g;g++){var h=!e&&1==(1&f>>g);this.modules[g%3+this.moduleCount-8-3][Math.floor(g/3)]=h}},setupTypeInfo:function(f,h){for(var j=this.errorCorrectLevel<<3|h,k=y.getBCHTypeInfo(j),l=0;15>l;l++){var m=!f&&1==(1&k>>l);6>l?this.modules[l][8]=m:8>l?this.modules[l+1][8]=m:this.modules[this.moduleCount-15+l][8]=m}for(var l=0;15>l;l++){var m=!f&&1==(1&k>>l);8>l?this.modules[8][this.moduleCount-l-1]=m:9>l?this.modules[8][15-l-1+1]=m:this.modules[8][15-l-1]=m}this.modules[this.moduleCount-8][8]=!f},mapData:function(f,l){for(var m=-1,n=this.moduleCount-1,o=7,p=0,q=this.moduleCount-1;q>0;q-=2){for(6==q&&q--;;){for(var r=0;2>r;r++){if(null==this.modules[n][q-r]){var s=!1;p<f.length&&(s=1==(1&f[p]>>>o));var M=y.getMask(l,n,q-r);M&&(s=!s),this.modules[n][q-r]=s,o--,-1==o&&(p++,o=7)}}if(n+=m,0>n||this.moduleCount<=n){n-=m,m=-m;break}}}}},u.PAD0=236,u.PAD1=17,u.createData=function(b,f,j){for(var k=C.getRSBlocks(b,f),m=new D,n=0;n<j.length;n++){var o=j[n];m.put(o.mode,4),m.put(o.getLength(),y.getLengthInBits(o.mode,b)),o.write(m)}for(var p=0,n=0;n<k.length;n++){p+=k[n].dataCount}if(m.getLengthInBits()>8*p){throw new Error("code length overflow. ("+m.getLengthInBits()+">"+8*p+")")}for(m.getLengthInBits()+4<=8*p&&m.put(0,4);0!=m.getLengthInBits()%8;){m.putBit(!1)}for(;;){if(m.getLengthInBits()>=8*p){break}if(m.put(u.PAD0,8),m.getLengthInBits()>=8*p){break}m.put(u.PAD1,8)}return u.createBytes(m,k)},u.createBytes=function(f,M){for(var N=0,O=0,P=0,R=new Array(M.length),S=new Array(M.length),T=0;T<M.length;T++){var U=M[T].dataCount,V=M[T].totalCount-U;O=Math.max(O,U),P=Math.max(P,V),R[T]=new Array(U);for(var W=0;W<R[T].length;W++){R[T][W]=255&f.buffer[W+N]}N+=U;var X=y.getErrorCorrectPolynomial(V),Y=new B(R[T],X.getLength()-1),Z=Y.mod(X);S[T]=new Array(X.getLength()-1);for(var W=0;W<S[T].length;W++){var aa=W+Z.getLength()-S[T].length;S[T][W]=aa>=0?Z.get(aa):0}}for(var ab=0,W=0;W<M.length;W++){ab+=M[W].totalCount}for(var ac=new Array(ab),ad=0,W=0;O>W;W++){for(var T=0;T<M.length;T++){W<R[T].length&&(ac[ad++]=R[T][W])}}for(var W=0;P>W;W++){for(var T=0;T<M.length;T++){W<S[T].length&&(ac[ad++]=S[T][W])}}return ac};for(var v={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},w={L:1,M:0,Q:3,H:2},x={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},y={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(c){for(var d=c<<10;y.getBCHDigit(d)-y.getBCHDigit(y.G15)>=0;){d^=y.G15<<y.getBCHDigit(d)-y.getBCHDigit(y.G15)}return(c<<10|d)^y.G15_MASK},getBCHTypeNumber:function(c){for(var d=c<<12;y.getBCHDigit(d)-y.getBCHDigit(y.G18)>=0;){d^=y.G18<<y.getBCHDigit(d)-y.getBCHDigit(y.G18)}return c<<12|d},getBCHDigit:function(c){for(var d=0;0!=c;){d++,c>>>=1}return d},getPatternPosition:function(b){return y.PATTERN_POSITION_TABLE[b-1]},getMask:function(d,e,f){switch(d){case x.PATTERN000:return 0==(e+f)%2;case x.PATTERN001:return 0==e%2;case x.PATTERN010:return 0==f%3;case x.PATTERN011:return 0==(e+f)%3;case x.PATTERN100:return 0==(Math.floor(e/2)+Math.floor(f/3))%2;case x.PATTERN101:return 0==e*f%2+e*f%3;case x.PATTERN110:return 0==(e*f%2+e*f%3)%2;case x.PATTERN111:return 0==(e*f%3+(e+f)%2)%2;default:throw new Error("bad maskPattern:"+d)}},getErrorCorrectPolynomial:function(d){for(var e=new B([1],0),f=0;d>f;f++){e=e.multiply(new B([1,z.gexp(f)],0))}return e},getLengthInBits:function(c,d){if(d>=1&&10>d){switch(c){case v.MODE_NUMBER:return 10;case v.MODE_ALPHA_NUM:return 9;case v.MODE_8BIT_BYTE:return 8;case v.MODE_KANJI:return 8;default:throw new Error("mode:"+c)}}else{if(27>d){switch(c){case v.MODE_NUMBER:return 12;case v.MODE_ALPHA_NUM:return 11;case v.MODE_8BIT_BYTE:return 16;case v.MODE_KANJI:return 10;default:throw new Error("mode:"+c)}}else{if(!(41>d)){throw new Error("type:"+d)}switch(c){case v.MODE_NUMBER:return 14;case v.MODE_ALPHA_NUM:return 13;case v.MODE_8BIT_BYTE:return 16;case v.MODE_KANJI:return 12;default:throw new Error("mode:"+c)}}}},getLostPoint:function(m){for(var n=m.getModuleCount(),o=0,p=0;n>p;p++){for(var q=0;n>q;q++){for(var r=0,s=m.isDark(p,q),M=-1;1>=M;M++){if(!(0>p+M||p+M>=n)){for(var N=-1;1>=N;N++){0>q+N||q+N>=n||(0!=M||0!=N)&&s==m.isDark(p+M,q+N)&&r++}}}r>5&&(o+=3+r-5)}}for(var p=0;n-1>p;p++){for(var q=0;n-1>q;q++){var O=0;m.isDark(p,q)&&O++,m.isDark(p+1,q)&&O++,m.isDark(p,q+1)&&O++,m.isDark(p+1,q+1)&&O++,(0==O||4==O)&&(o+=3)}}for(var p=0;n>p;p++){for(var q=0;n-6>q;q++){m.isDark(p,q)&&!m.isDark(p,q+1)&&m.isDark(p,q+2)&&m.isDark(p,q+3)&&m.isDark(p,q+4)&&!m.isDark(p,q+5)&&m.isDark(p,q+6)&&(o+=40)}}for(var q=0;n>q;q++){for(var p=0;n-6>p;p++){m.isDark(p,q)&&!m.isDark(p+1,q)&&m.isDark(p+2,q)&&m.isDark(p+3,q)&&m.isDark(p+4,q)&&!m.isDark(p+5,q)&&m.isDark(p+6,q)&&(o+=40)}}for(var P=0,q=0;n>q;q++){for(var p=0;n>p;p++){m.isDark(p,q)&&P++}}var R=Math.abs(100*P/n/n-50)/5;return o+=10*R}},z={glog:function(b){if(1>b){throw new Error("glog("+b+")")}return z.LOG_TABLE[b]},gexp:function(b){for(;0>b;){b+=255}for(;b>=256;){b-=255}return z.EXP_TABLE[b]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},A=0;8>A;A++){z.EXP_TABLE[A]=1<<A}for(var A=8;256>A;A++){z.EXP_TABLE[A]=z.EXP_TABLE[A-4]^z.EXP_TABLE[A-5]^z.EXP_TABLE[A-6]^z.EXP_TABLE[A-8]}for(var A=0;255>A;A++){z.LOG_TABLE[z.EXP_TABLE[A]]=A}B.prototype={get:function(b){return this.num[b]},getLength:function(){return this.num.length},multiply:function(e){for(var f=new Array(this.getLength()+e.getLength()-1),g=0;g<this.getLength();g++){for(var h=0;h<e.getLength();h++){f[g+h]^=z.gexp(z.glog(this.get(g))+z.glog(e.get(h)))}}return new B(f,0)},mod:function(e){if(this.getLength()-e.getLength()<0){return this}for(var f=z.glog(this.get(0))-z.glog(e.get(0)),g=new Array(this.getLength()),h=0;h<this.getLength();h++){g[h]=this.get(h)}for(var h=0;h<e.getLength();h++){g[h]^=z.gexp(z.glog(e.get(h))+f)}return new B(g,0).mod(e)}},C.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],C.getRSBlocks=function(j,l){var m=C.getRsBlockTable(j,l);if(void 0==m){throw new Error("bad rs block @ typeNumber:"+j+"/errorCorrectLevel:"+l)}for(var n=m.length/3,o=[],p=0;n>p;p++){for(var q=m[3*p+0],r=m[3*p+1],s=m[3*p+2],M=0;q>M;M++){o.push(new C(r,s))}}return o},C.getRsBlockTable=function(c,d){switch(d){case w.L:return C.RS_BLOCK_TABLE[4*(c-1)+0];case w.M:return C.RS_BLOCK_TABLE[4*(c-1)+1];case w.Q:return C.RS_BLOCK_TABLE[4*(c-1)+2];case w.H:return C.RS_BLOCK_TABLE[4*(c-1)+3];default:return void 0}},D.prototype={get:function(c){var d=Math.floor(c/8);return 1==(1&this.buffer[d]>>>7-c%8)},put:function(d,e){for(var f=0;e>f;f++){this.putBit(1==(1&d>>>e-f-1))}},getLengthInBits:function(){return this.length},putBit:function(c){var d=Math.floor(this.length/8);this.buffer.length<=d&&this.buffer.push(0),c&&(this.buffer[d]|=128>>>this.length%8),this.length++}};var E=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],H=function(){var b=function(c,d){this._el=c,this._htOption=d};return b.prototype.draw=function(e){function n(g,h){var j=document.createElementNS("http://www.w3.org/2000/svg",g);for(var k in h){h.hasOwnProperty(k)&&j.setAttribute(k,h[k])}return j}var f=this._htOption,l=this._el,m=e.getModuleCount();Math.floor(f.width/m),Math.floor(f.height/m),this.clear();var o=n("svg",{viewBox:"0 0 "+String(m)+" "+String(m),width:"100%",height:"100%",fill:f.colorLight});o.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),l.appendChild(o),o.appendChild(n("rect",{fill:f.colorDark,width:"1",height:"1",id:"template"}));for(var p=0;m>p;p++){for(var q=0;m>q;q++){if(e.isDark(p,q)){var r=n("use",{x:String(p),y:String(q)});r.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),o.appendChild(r)}}}},b.prototype.clear=function(){for(;this._el.hasChildNodes();){this._el.removeChild(this._el.lastChild)}},b}(),I="svg"===document.documentElement.tagName.toLowerCase(),J=I?H:F()?function(){function f(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}function j(l,m){var n=this;if(n._fFail=m,n._fSuccess=l,null===n._bSupportDataURI){var o=document.createElement("img"),p=function(){n._bSupportDataURI=!1,n._fFail&&_fFail.call(n)},q=function(){n._bSupportDataURI=!0,n._fSuccess&&n._fSuccess.call(n)};return o.onabort=p,o.onerror=p,o.onload=q,o.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",void 0}n._bSupportDataURI===!0&&n._fSuccess?n._fSuccess.call(n):n._bSupportDataURI===!1&&n._fFail&&n._fFail.call(n)}if(this._android&&this._android<=2.1){var g=1/window.devicePixelRatio,h=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(b,c,m,n,o,p,q,r){if("nodeName" in b&&/img/i.test(b.nodeName)){for(var s=arguments.length-1;s>=1;s--){arguments[s]=arguments[s]*g}}else{"undefined"==typeof r&&(arguments[1]*=g,arguments[2]*=g,arguments[3]*=g,arguments[4]*=g)}h.apply(this,arguments)}}var k=function(c,d){this._bIsPainted=!1,this._android=G(),this._htOption=d,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=d.width,this._elCanvas.height=d.height,c.appendChild(this._elCanvas),this._el=c,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return k.prototype.draw=function(o){var p=this._elImage,q=this._oContext,r=this._htOption,s=o.getModuleCount(),M=r.width/s,N=r.height/s,O=Math.round(M),P=Math.round(N);p.style.display="none",this.clear();for(var R=0;s>R;R++){for(var S=0;s>S;S++){var T=o.isDark(R,S),U=S*M,V=R*N;q.strokeStyle=T?r.colorDark:r.colorLight,q.lineWidth=1,q.fillStyle=T?r.colorDark:r.colorLight,q.fillRect(U,V,M,N),q.strokeRect(Math.floor(U)+0.5,Math.floor(V)+0.5,O,P),q.strokeRect(Math.ceil(U)-0.5,Math.ceil(V)-0.5,O,P)}}this._bIsPainted=!0},k.prototype.makeImage=function(){this._bIsPainted&&j.call(this,f)},k.prototype.isPainted=function(){return this._bIsPainted},k.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},k.prototype.round=function(b){return b?Math.floor(1000*b)/1000:b},k}():function(){var b=function(c,d){this._el=c,this._htOption=d};return b.prototype.draw=function(m){for(var n=this._htOption,o=this._el,p=m.getModuleCount(),q=Math.floor(n.width/p),r=Math.floor(n.height/p),s=['<table style="border:0;border-collapse:collapse;">'],M=0;p>M;M++){s.push("<tr>");for(var N=0;p>N;N++){s.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:'+q+"px;height:"+r+"px;background-color:"+(m.isDark(M,N)?n.colorDark:n.colorLight)+';"></td>')}s.push("</tr>")}s.push("</table>"),o.innerHTML=s.join("");var O=o.childNodes[0],P=(n.width-O.offsetWidth)/2,R=(n.height-O.offsetHeight)/2;P>0&&R>0&&(O.style.margin=R+"px "+P+"px")},b.prototype.clear=function(){this._el.innerHTML=""},b}();QRCode=function(d,e){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:w.H},"string"==typeof e&&(e={text:e}),e){for(var f in e){this._htOption[f]=e[f]}}"string"==typeof d&&(d=document.getElementById(d)),this._android=G(),this._el=d,this._oQRCode=null,this._oDrawing=new J(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},QRCode.prototype.makeCode=function(b){this._oQRCode=new u(K(b,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(b),this._oQRCode.make(),this._el.title=b,this._oDrawing.draw(this._oQRCode),this.makeImage()},QRCode.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},QRCode.prototype.clear=function(){this._oDrawing.clear()},QRCode.CorrectLevel=w}();"use strict";var args;var powerStatetable=["","Powered","Sleep","Sleep","Sleep","Hibernating","Power off","Present"];var StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel® AMT Connected"];var sort=0;var searchFocus=0;var mapSearchFocus=0;var userSearchFocus=0;var consoleFocus=0;var showRealNames=false;var meshserver=null;var meshes={};var meshcount=0;var nodes=[];var filetree={};var userinfo=null;var serverinfo=null;var events=[];var users=null;var wssessions=null;var nodeShortIdent=0;var desktop;var desktopsettings={encoding:2,showfocus:false,showmouse:true,showcad:true,quality:40,scaling:1024,framerate:50};var multidesktopsettings={quality:20,scaling:128,framerate:1000};var terminal;var files;var debugLevel=parseInt("{{{debuglevel}}}");var features=parseInt("{{{features}}}");var sessionTime=parseInt("{{{sessiontime}}}");var domain="{{{domain}}}";var domainUrl="{{{domainurl}}}";var multiDesktop={};var multiDesktopFilter=null;var serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}";var amtScanResults=null;var debugmode=0;var clickOnce=(((features&256)!=0)&&detectClickOnce());var attemptWebRTC=((features&128)!=0);var webPageFullScreen=getstore("webPageFullScreen",true);if(webPageFullScreen=="false"){webPageFullScreen=false}if(webPageFullScreen=="true"){webPageFullScreen=true}var passRequirements="{{{passRequirements}}}";if(passRequirements!=""){passRequirements=JSON.parse(decodeURIComponent(passRequirements))}function startup(){if((features&32)==0){var g=null;try{g=top.location.toString().toLowerCase()}catch(b){}if(top!=self&&(g==null||top.active==false)){top.location=self.location;return}}toggleFullScreen();args=parseUriArgs();debugmode=args.debug;if(args.webrtc!=null){attemptWebRTC=(args.webrtc==1)}QV("p13AutoConnect",debugmode);QV("autoconnectbutton2",debugmode);QV("autoconnectbutton1",debugmode);if(args.hide){var d=parseInt(args.hide);QV("masthead",!(d&1));QV("topbarmaster",!(d&2));QV("page_leftbar",!(d&2));QV("footer",!(d&4));QV("p10title",!(d&8));QV("p11title",!(d&8));QV("p12title",!(d&8));QV("p13title",!(d&8));QV("p14title",!(d&8));QV("p15title",!(d&8));QV("p16title",!(d&8))}p1updateInfo();document.onclick=function(c){hideContextMenu()};document.onkeypress=ondockeypress;document.onkeydown=ondockeydown;document.onkeyup=ondockeyup;window.onresize=center;center();meshserver=MeshServerCreateControl(domainUrl);meshserver.onStateChanged=onStateChanged;meshserver.onMessage=onMessage;meshserver.Start();Q("sortselect").selectedIndex=sort=getstore("sort",0);Q("sizeselect").selectedIndex=getstore("viewsize",1);Q("SearchInput").value=getstore("search","");showRealNames=(getstore("showRealNames",0)==1);Q("RealNameCheckBox").checked=showRealNames;Q("viewselect").value=getstore("deviceView",1);Q("DeskControl").checked=(getstore("DeskControl",1)==1);onSortSelectChange(true);onSearchInputChanged();for(var f=1;f<5;f++){Q("devViewButton"+f).classList.remove("viewSelectorSel")}Q("devViewButton"+Q("viewselect").value).classList.add("viewSelectorSel");Q("p5filetable").addEventListener("drop",p5fileDragDrop,false);Q("p5filetable").addEventListener("dragover",p5fileDragOver,false);Q("p5filetable").addEventListener("dragleave",p5fileDragLeave,false);Q("p13filetable").addEventListener("drop",p13fileDragDrop,false);Q("p13filetable").addEventListener("dragover",p13fileDragOver,false);Q("p13filetable").addEventListener("dragleave",p13fileDragLeave,false);setInterval(updateDeviceTimeline,120000);var h=localStorage.getItem("desktopsettings");if(h!=null){desktopsettings=JSON.parse(h)}h=localStorage.getItem("multidesktopsettings");if(h!=null){multidesktopsettings=JSON.parse(h)}applyDesktopSettings();var k="";for(var a=1;a<27;a++){k+="<option value='"+a+"'>Ctrl-"+String.fromCharCode(64+a)+" ("+a+")</option>"}QH("specialkeylist",k);setupServerStats()}function toggleFullScreen(a){if(a===1){webPageFullScreen=!webPageFullScreen;putstore("webPageFullScreen",webPageFullScreen)}if(webPageFullScreen==false){QS("container").width="960px";QS("container")["border-right"]="1px solid #b7b7b7";QS("container")["border-left"]="1px solid #b7b7b7";QS("container")["min-width"]="960px";QS("container")["overflow"]="";QS("column_l").width="930px";QS("column_l").height="";QS("column_l")["margin-left"]="";QS("column_l")["overflow-y"]="";QS("column_l")["max-height"]=(xxcurrentView>=10)?"calc(100vh - 159px)":"calc(100vh - 135px)";QS("container").position="";QS("page_content").position="";QV("MainMenuSpan",true);QV("UserDummyMenuSpan",false);QV("page_leftbar",false)}else{QS("container").position="absolute";QS("container").width="100%";QS("container").top="0px";QS("container").bottom="0px";QS("container")["border-right"]="0";QS("container")["border-left"]="0";QS("container")["min-width"]="700px";QS("container")["overflow"]="hidden";QS("page_content").position="absolute";QS("page_content").top="66px";QS("page_content").left="90px";QS("page_content").right="0px";QS("page_content").bottom="0px";QS("column_l").height="calc(100vh - 135px)";QS("column_l").width="calc(100% - 30px)";QS("column_l")["overflow-y"]="auto";QS("column_l")["max-height"]="calc(100vh - 135px)";QV("MainMenuSpan",false);QV("UserDummyMenuSpan",(xxcurrentView<10)&&webPageFullScreen);QV("page_leftbar",true)}center();QV("body",true)}function getNodeFromId(b){for(var a in nodes){if(nodes[a]._id==b){return nodes[a]}}return null}function reload(){window.location.href=window.location.href}function onStateChanged(a,b){if(b==0){setDialogMode(0);go(0);powerTimeline=null;powerTimelineReq=null;powerTimelineNode=null;powerTimelineUpdate=null;deleteAllNotifications();hideContextMenu();QV("verifyEmailId2",false);QV("logoutControl",false);setTimeout(serverPoll,5000)}else{if(b==2){meshserver.send({action:"meshes"});meshserver.send({action:"nodes"});meshserver.send({action:"files"})}}}function serverPoll(){var b=null;try{b=new XDomainRequest()}catch(a){}if(!b){b=new XMLHttpRequest()}b.open("HEAD",window.location.href);b.timeout=15000;b.onload=function(){reload()};b.onerror=b.ontimeout=function(){setTimeout(serverPoll,10000)};b.send()}function detectClickOnce(){for(var a in window.navigator.mimeTypes){if(window.navigator.mimeTypes[a].type=="application/x-ms-application"){return true}}var b=window.navigator.userAgent.toUpperCase();return(b.indexOf(".NET CLR 3.5")>=0)||(b.indexOf("(WINDOWS NT ")>=0)}function updateSiteAdmin(){var a="{{{noServerBackup}}}";var b=userinfo.siteadmin;if(a==1){b&=4294967290}QV("p2AccountActions",((features&4)==0)&&(serverinfo.domainauth==false));QV("p2ServerActions",b&21);QV("LeftMenuMyServer",b&21);QV("MainMenuMyServer",b&21);QV("p2ServerActionsBackup",b&1);QV("p2ServerActionsRestore",b&4);QV("p2ServerActionsVersion",b&16);QV("MainMenuMyFiles",b&8);QV("LeftMenuMyFiles",b&8);if(((b&8)==0)&&(xxcurrentView==5)){setDialogMode(0);go(1)}if(currentNode!=null){gotoDevice(currentNode._id,xxcurrentView,true)}if((userinfo.siteadmin&2)!=0){if(users==null){meshserver.send({action:"users"})}if(wssessions==null){meshserver.send({action:"wssessioncount"})}}else{users=null;wssessions=null;updateUsers();if(xxcurrentView==4||((xxcurrentView>=30)&&(xxcurrentView<40))){setDialogMode(0);go(1);currentUser=null}}meshserver.send({action:"events",limit:parseInt(p3limitdropdown.value)});QV("p2deleteall",userinfo.siteadmin==4294967295);if((b&21)!=0){meshserver.send({action:"serverstats",interval:10000})}}var updateEventsNaggleTimer=null;function updateEventsNaggle(){if(updateEventsNaggleTimer==null){updateEventsNaggleTimer=setTimeout(function(){events_update();updateEventsNaggleTimer=null},100)}}var updateDevicesNaggleTimer=null;function updateDevicesNaggle(){if(updateDevicesNaggleTimer==null){updateDevicesNaggleTimer=setTimeout(function(){onSortSelectChange(true);drawNotifications();onSearchInputChanged();updateDevices();updateMapMarkers();updateDevicesNaggleTimer=null},100)}}function onMessage(v,f){switch(f.action){case"serverstats":updateServerStats(f);break;case"serverinfo":serverinfo=f.serverinfo;break;case"userinfo":userinfo=f.userinfo;updateSiteAdmin();QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("verifyEmailId2",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("otpAuth",((features&4096)!=0)&&(userinfo.otpsecret!=1));QV("otpAuthRemove",((features&4096)!=0)&&(userinfo.otpsecret==1));break;case"users":users={};for(var e in f.users){users[f.users[e]._id]=f.users[e]}updateUsers();break;case"wssessioncount":wssessions=f.wssessions;updateUsers();break;case"meshes":meshes={};for(var e in f.meshes){meshes[f.meshes[e]._id]=f.meshes[e]}updateMeshes();updateDevices();break;case"files":filetree=setupBackPointers(f.filetree);updateFiles();d3updatefiles();break;case"nodes":nodes=[];for(var e in f.nodes){if(!meshes[e]){console.log("Invalid mesh (1): "+e);continue}for(var g in f.nodes[e]){if(f.nodes[e][g]._id==null){console.log("Invalid node ("+g+"): "+JSON.stringify(f.nodes));continue}f.nodes[e][g].namel=f.nodes[e][g].name.toLowerCase();if(f.nodes[e][g].rname){f.nodes[e][g].rnamel=f.nodes[e][g].rname.toLowerCase()}else{f.nodes[e][g].rnamel=f.nodes[e][g].namel}f.nodes[e][g].meshnamel=meshes[e].name.toLowerCase();f.nodes[e][g].meshid=e;f.nodes[e][g].state=(f.nodes[e][g].state)?(f.nodes[e][g].state):0;f.nodes[e][g].desc=f.nodes[e][g].desc;if(!f.nodes[e][g].icon){f.nodes[e][g].icon=1}f.nodes[e][g].ident=++nodeShortIdent;nodes.push(f.nodes[e][g])}}updateDevicesNaggle();refreshMap(false,true);if(xxcurrentView==0){if("{{viewmode}}"!=""){go(parseInt("{{viewmode}}"))}else{setDialogMode(0);go(1)}}if("{{currentNode}}"!=""){gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"))}break;case"powertimeline":if(f.nodeid!=powerTimelineReq){break}powerTimelineNode=f.nodeid;powerTimeline=f.timeline;powerTimelineUpdate=Date.now()+300000;if(currentNode._id==f.nodeid){drawDeviceTimeline()}break;case"lastconnect":var o=getNodeFromId(f.nodeid);if(o!=null){o.lastconnect=f.time;if((currentNode._id==o._id)&&(Q("MainComputerState").innerHTML=="")){QH("MainComputerState","<span style=font-size:12px>Last seen:<br />"+new Date(o.lastconnect).toLocaleDateString()+", "+new Date(o.lastconnect).toLocaleTimeString()+"</span>")}}break;case"msg":if(f.nodeid!=null){var d=-1;for(var c in nodes){if(nodes[c]._id==f.nodeid){d=c;break}}if(d!=-1){if(f.type=="console"){p15consoleReceive(nodes[d],f.value)}else{if(f.type=="notify"){var g={text:f.value};if(f.nodeid!=null){g.nodeid=f.nodeid}if(f.tag!=null){g.tag=f.tag}if(f.username!=null){g.username=f.username}addNotification(g)}else{if(f.type=="ps"){showDeskToolsProcesses(f)}}}}}else{if(f.type=="notify"){var g={text:f.value};if(f.tag!=null){g.tag=f.tag}if(f.username!=null){g.username=f.username}addNotification(g)}}break;case"getnetworkinfo":if((currentNode._id==f.nodeid)&&(xxdialogMode==2)&&(xxdialogTag=="if"+f.nodeid)){if(f.netif==null){QH("d2netinfo","No network interface information available for this device.")}else{var z="<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>";z+=addHtmlValue2("Last Updated",new Date(f.updateTime).toLocaleString());if(currentNode.publicip){z+=addHtmlValue2("Public IP address",currentNode.publicip)}for(var c in f.netif){var h=f.netif[c];z+="<hr />";if(h.name){z+=addHtmlValue2("Name","<b>"+EscapeHtml(h.name)+"</b>")}if(h.desc){z+=addHtmlValue2("Description",EscapeHtml(h.desc).replace("(R)","®").replace("(r)","®"))}if(h.dnssuffix){z+=addHtmlValue2("DNS suffix",EscapeHtml(h.dnssuffix))}if(h.mac){z+=addHtmlValue2("MAC address",EscapeHtml(h.mac.toUpperCase()))}if(h.v4addr){z+=addHtmlValue2("IPv4 address",EscapeHtml(h.v4addr))}if(h.v4mask){z+=addHtmlValue2("IPv4 mask",EscapeHtml(h.v4mask))}if(h.v4gateway){z+=addHtmlValue2("IPv4 gateway",EscapeHtml(h.v4gateway))}if(h.gatewaymac){z+=addHtmlValue2("Gateway MAC",EscapeHtml(h.gatewaymac))}}z+="</div>";QH("d2netinfo",z)}}break;case"serverversion":if((xxdialogMode==2)&&(xxdialogTag=="MeshCentralServerUpdate")){var z="<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>";if(!f.current){f.current="Unknown"}if(!f.latest){f.latest="Unknown"}z+=addHtmlValue2("Current Version","<b>"+EscapeHtml(f.current)+"</b>");z+=addHtmlValue2("Latest Version","<b>"+EscapeHtml(f.latest)+"</b>");z+="</div>";if((f.latest.indexOf(".")==-1)||(f.current==f.latest)||((features&2048)==0)){setDialogMode(2,"MeshCentral Version",1,null,z)}else{setDialogMode(2,"MeshCentral Version",3,server_showVersionDlgEx,z+"<br /><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> Check and click OK to start server self-update.");server_showVersionDlgUpdate()}}break;case"servererrors":if((xxdialogMode==2)&&(xxdialogTag=="MeshCentralServerErrors")){if(f.data==null){setDialogMode(2,"MeshCentral Server Errors",1,null,"Server has no error log.")}else{var z="<div style=width:100%;max-height:260px;overflow-x:hidden;overflow:auto;line-height:160%;font-size:10px><pre>"+f.data+"<pre></div>";setDialogMode(2,"MeshCentral Server Errors",3,server_showErrorsDlgEx,z+"<br /><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> Check and click OK to clear error log.");server_showVersionDlgUpdate()}}break;case"events":if((f.nodeid!=null)&&(f.nodeid==currentNode._id)){currentDeviceEvents=f.events;devevents_update()}else{if((f.user!=null)&&(f.user==currentUser.name)){currentUserEvents=f.events;userEvents_update()}else{events=f.events;updateEventsNaggle()}}break;case"getcookie":if(f.tag=="clickonce"){var a="{{{serverRedirPort}}}"==""?"{{{serverPublicPort}}}":"{{{serverRedirPort}}}";var s="http://"+window.location.hostname+":"+a+"/clickonce/minirouter/MeshMiniRouter.application?WS=wss%3A%2F%2F"+window.location.hostname+"%2Fmeshrelay.ashx%3Fauth="+f.cookie+"&CH={{{webcerthash}}}&AP="+f.protocol+((debugmode==1)?"":"&HOL=1");var l=window.open(s,"_blank");l.opener=null}break;case"getNotes":var g=Q("d2devNotes");if(g&&(f.id==decodeURIComponent(g.attributes.noteid.value))){if(f.notes){QH("d2devNotes",decodeURIComponent(f.notes))}else{QH("d2devNotes","")}var t=g.attributes.ro.value=="true";if(t==false){g.removeAttribute("readonly");QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",true);focusTextBox("d2devNotes")}}break;case"otpauth-request":if((xxdialogMode==2)&&(xxdialogTag=="otpauth-request")){var u=f.secret;if(u.length==52){u=u.split(/(.............)/).filter(Boolean).join(" ")}else{if(u.length==32){u=u.split(/(....)/).filter(Boolean).join(" ");u=u.substring(0,20)+"<br/>"+u.substring(20)}}QH("d2optinfo",'<table style=width:380px><tr><td style=vertical-align:top>Install <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" rel="noreferrer noopener" target=_blank>Google Authenticator</a> or a compatible application and scan the barcode, use <a href="'+f.url+'" rel="noreferrer noopener" target=_blank> this link</a> or enter the secret. Then, enter the current 6 digit token below to activate 2-Step login.<br /><br />Secret<br /><tt id=d2optsecret secret="'+f.secret+'" style=font-size:12px>'+u+'</tt><br /><br /></td><td style=width:1px;vertical-align:top><a href="'+f.url+'" rel="noreferrer noopener" target=_blank><div id="qrcode"></div></a></td><tr><td colspan=2 style="text-align:center;border-top:1px solid black"><br />Enter the token here for 2-step login: <input type=text onkeypress="return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text></td></table>');new QRCode(Q("qrcode"),{text:f.url,width:128,height:128,colorDark:"#000000",colorLight:"#EEE",correctLevel:QRCode.CorrectLevel.H});QV("idx_dlgOkButton",true);QE("idx_dlgOkButton",false);Q("d2otpauthinput").focus()}break;case"otpauth-setup":if(xxdialogMode){return}setDialogMode(2,"Add 2-Step Login",1,null,f.success?"<b style=color:green>2-step login activation successful</b>. You will now need a valid token to login again.":"<b style=color:red>2-step login activation failed</b>. Clear the secret from the application and try again. You only have a few minutes to enter the proper code.");break;case"otpauth-clear":if(xxdialogMode){return}setDialogMode(2,"Remove 2-Step Login",1,null,f.success?"<b style=color:green>2-step login activation removed</b>. You can reactivate this feature at any time.":"<b style=color:red>2-step login activation removal failed</b>. Try again.");break;case"event":if(!f.event.nolog){events.unshift(f.event);var b=parseInt(p3limitdropdown.value);while(events.length>b){events.pop()}updateEventsNaggle()}switch(f.event.action){case"accountcreate":case"accountchange":if(userinfo.name==f.event.account.name){var k=f.event.account.siteadmin?f.event.account.siteadmin:0;var p=userinfo.siteadmin?userinfo.siteadmin:0;if((f.event.account.quota!=userinfo.quota)||(((userinfo.siteadmin&8)==0)&&((f.event.account.siteadmin&8)!=0))){meshserver.send({action:"files"})}userinfo=f.event.account;if(p!=k){updateSiteAdmin()}QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("verifyEmailId2",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true))}if(users==null){break}users[f.event.account._id]=f.event.account;updateUsers();break;case"accountremove":if(users==null){break}delete users["user/"+domain+"/"+f.event.username.toLowerCase()];updateUsers();break;case"createmesh":if(f.event.links["user/"+domain+"/"+userinfo.name.toLowerCase()]!=null){meshes[f.event.meshid]={_id:f.event.meshid,name:f.event.name,mtype:f.event.mtype,desc:f.event.desc,links:f.event.links};updateMeshes();updateDevices();meshserver.send({action:"files"})}break;case"meshchange":if(meshes[f.event.meshid]==null){meshes[f.event.meshid]={_id:f.event.meshid,name:f.event.name,mtype:f.event.mtype,desc:f.event.desc,links:f.event.links};meshserver.send({action:"nodes"})}else{meshes[f.event.meshid].name=f.event.name;meshes[f.event.meshid].desc=f.event.desc;meshes[f.event.meshid].flags=f.event.flags;meshes[f.event.meshid].links=f.event.links;if(meshes[f.event.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()]==null){if((xxcurrentView==20)&&(currentMesh==meshes[f.event.meshid])){go(2)}delete meshes[f.event.meshid];var j=[];for(var c in nodes){if(nodes[c].meshid!=f.event.meshid){j.push(nodes[c])}}nodes=j;if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==f.event.meshid){setDialogMode(0);go(1)}}}updateMeshes();updateDevices();meshserver.send({action:"files"});if(xxcurrentView==20&¤tMesh._id==f.event.meshid){p20updateMesh()}break;case"deletemesh":if(meshes[f.event.meshid]){delete meshes[f.event.meshid];updateMeshes();meshserver.send({action:"files"})}var j=[];for(var c in nodes){if(nodes[c].meshid!=f.event.meshid){j.push(nodes[c])}}nodes=j;updateDevices();if(xxcurrentView>=20&&xxcurrentView<30&¤tMesh._id==f.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==f.event.meshid){setDialogMode(0);go(1)}break;case"addnode":var o=f.event.node;if(!meshes[o.meshid]){break}o.namel=o.name.toLowerCase();if(o.rname){o.rnamel=o.rname.toLowerCase()}else{o.rnamel=o.namel}o.meshnamel=meshes[o.meshid].name.toLowerCase();o.state=0;if(!o.icon){o.icon=1}o.ident=++nodeShortIdent;nodes.push(o);updateDevicesNaggle();break;case"removenode":var d=-1;for(var c in nodes){if(nodes[c]._id==f.event.nodeid){d=c;break}}if(d!=-1){var o=nodes[d];if(currentNode==o){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(1)}currentNode=null}nodes.splice(d,1);updateDevicesNaggle()}break;case"changenode":var d=-1;for(var c in nodes){if(nodes[c]._id==f.event.nodeid){d=c;break}}if(d!=-1){var o=nodes[d];o.name=f.event.node.name;o.rname=f.event.node.rname;o.users=f.event.node.users;o.host=f.event.node.host;o.desc=f.event.node.desc;o.osdesc=f.event.node.osdesc;o.publicip=f.event.node.publicip;o.iploc=f.event.node.iploc;o.wifiloc=f.event.node.wifiloc;o.gpsloc=f.event.node.gpsloc;o.tags=f.event.node.tags;o.userloc=f.event.node.userloc;if(f.event.node.agent!=null){if(o.agent==null){o.agent={}}if(f.event.node.agent.ver!=null){o.agent.ver=f.event.node.agent.ver}if(f.event.node.agent.id!=null){o.agent.id=f.event.node.agent.id}if(f.event.node.agent.caps!=null){o.agent.caps=f.event.node.agent.caps}if(f.event.node.agent.core!=null){o.agent.core=f.event.node.agent.core}else{if(o.agent.core){delete o.agent.core}}o.agent.tag=f.event.node.agent.tag}if(f.event.node.intelamt!=null){if(o.intelamt==null){o.intelamt={}}if(f.event.node.intelamt.host!=null){o.intelamt.user=f.event.node.intelamt.host}if(f.event.node.intelamt.user!=null){o.intelamt.user=f.event.node.intelamt.user}if(f.event.node.intelamt.tls!=null){o.intelamt.tls=f.event.node.intelamt.tls}if(f.event.node.intelamt.ver!=null){o.intelamt.ver=f.event.node.intelamt.ver}if(f.event.node.intelamt.state!=null){o.intelamt.state=f.event.node.intelamt.state}}o.namel=o.name.toLowerCase();if(o.rname){o.rnamel=o.rname.toLowerCase()}else{o.rnamel=o.namel}if(f.event.node.icon){o.icon=f.event.node.icon}updateDevicesNaggle();refreshDevice(o._id);if((currentNode==o)&&(xxdialogMode!=null)&&(xxdialogTag=="@xxmap")){p10showNodeLocationDialog()}}break;case"nodeconnect":var d=-1;for(var c in nodes){if(nodes[c]._id==f.event.nodeid){d=c;break}}if(d!=-1){var o=nodes[d];o.conn=f.event.conn;o.pwr=f.event.pwr;updateDevicesNaggle();refreshDevice(o._id)}break;case"wssessioncount":if(wssessions!=null){if(f.event.count==0&&wssessions["user/"+domain+"/"+f.event.username.toLowerCase()]){delete wssessions["user/"+domain+"/"+f.event.username.toLowerCase()]}else{wssessions["user/"+domain+"/"+f.event.username.toLowerCase()]=f.event.count}updateUsers()}break;case"clearevents":events=[];updateEventsNaggle();break;case"login":if(users!=null&&users["user/"+domain+"/"+f.event.username.toLowerCase()]){users["user/"+domain+"/"+f.event.username.toLowerCase()].login=f.event.time}break;case"scanamtdevice":if((xxdialogMode==null)||(!Q("dp1range"))||(Q("dp1range").value!=f.event.range)){return}var z="";if(f.event.results==null){z="<div style=width:100%;text-align:center;margin-top:12px>Unable to scan this address range.</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>"}else{amtScanResults=f.event.results;for(var c in f.event.results){var q=f.event.results[c],w=q.hostname;if(w.length>20){w=w.substring(0,20)+"..."}var y='<b title="'+EscapeHtml(q.hostname)+'">'+EscapeHtml(w)+"</b> - v"+q.ver;if(q.state==2){if(q.tls==1){y+=" with TLS."}else{y+=" without TLS."}}else{y+=" not activated."}z+='<div style=width:100%;margin-bottom:2px;background-color:lightgray><div style=padding:4px><div style=display:inline-block;margin-right:5px><input class=DevScanCheckbox name=dp1checkbox tag="'+EscapeHtml(c)+'" type=checkbox onclick=addAmtScanToMeshCheckbox() /></div><div class=j1 style=display:inline-block></div><div style=display:inline-block;margin-left:5px;overflow-x:auto;white-space:nowrap>'+y+"</div></div></div>"}if(z==""){z="<div style=width:100%;text-align:center;margin-top:12px>Scan returned no results.</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>"}}QH("dp1results",z);QE("dp1range",true);QE("dp1rangebutton",true);break;case"notify":var g={text:f.event.value};if(f.event.tag!=null){g.tag=f.event.tag}addNotification(g);break;default:break}break;default:console.log("Unknown message.action",f.action);break}}function onRealNameCheckBox(){showRealNames=Q("RealNameCheckBox").checked;putstore("showRealNames",showRealNames?1:0);onSortSelectChange(true);return}function onDeviceViewChange(a){if(a!=null){Q("viewselect").value=a}for(var b=1;b<5;b++){Q("devViewButton"+b).classList.remove("viewSelectorSel")}Q("devViewButton"+Q("viewselect").value).classList.add("viewSelectorSel");putstore("deviceView",Q("viewselect").value);putstore("viewsize",Q("sizeselect").value);updateDevices()}function ondockeypress(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeys(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==15){return agentConsoleHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==4){if(a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}var b=0;if(a.key){if(a.key.length===1&&userSearchFocus==0){Q("UserSearchInput").value=((Q("UserSearchInput").value+a.key));b=1}if(a.keyCode==8&&userSearchFocus==0){var c=Q("UserSearchInput").value;Q("UserSearchInput").value=c.substring(0,c.length-1);b=1}if(a.keyCode==27){Q("UserSearchInput").value="";b=1}}else{if(a.charCode!=0&&userSearchFocus==0){Q("UserSearchInput").value=((Q("UserSearchInput").value+String.fromCharCode(a.charCode)));b=1}}if(b>0){if(b==1){onUserSearchInputChanged()}return haltEvent(a)}}if(xxdialogMode||xxcurrentView!=1){return}if(a.ctrlKey==true&&a.charCode==96){showRealNames=!showRealNames;Q("RealNameCheckBox").value=showRealNames;putstore("showRealNames",showRealNames?1:0);onSortSelectChange(true);return}if(a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}if(Q("viewselect").value<3){var b=0;if(a.key){if(a.key.length===1&&searchFocus==0){Q("SearchInput").value=((Q("SearchInput").value+a.key));b=1}if(a.keyCode==8&&searchFocus==0){var c=Q("SearchInput").value;Q("SearchInput").value=c.substring(0,c.length-1);b=1}if(a.keyCode==27){Q("SearchInput").value="";b=1}}else{if(a.charCode!=0&&searchFocus==0){Q("SearchInput").value=((Q("SearchInput").value+String.fromCharCode(a.charCode)));b=1}}if(b>0){if(b==1){onSearchInputChanged()}return haltEvent(a)}}if(Q("viewselect").value==3){if(a.key){if(a.key.length===1&&mapSearchFocus==0){Q("mapSearchLocation").value=((Q("mapSearchLocation").value+a.key));b=1}if(a.keyCode==27){Q("mapSearchLocation").value="";mapCloseSearchWindow();b=1}if(a.keyCode==13){getSearchLocation()}}else{if(a.charCode!=0&&mapSearchFocus==0){Q("mapSearchLocation").value=((Q("mapSearchLocation").value+String.fromCharCode(a.charCode)));b=1}}}}function ondockeydown(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeyDown(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeyDown(a)}if(!xxdialogMode&&xxcurrentView==13&&a.keyCode==116&&p13filetree!=null){haltEvent(a);return false}if(!xxdialogMode&&xxcurrentView==15){return agentConsoleHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==4){if(a.keyCode===8&&userSearchFocus==0){var c=Q("UserSearchInput").value;Q("UserSearchInput").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("UserSearchInput").value="";b=1}if(b>0){if(b==1){onSearchInputChanged()}return haltEvent(a)}}if(xxdialogMode||xxcurrentView!=1||a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}var b=0;if(Q("viewselect").value<3){if(a.keyCode===8&&searchFocus==0){var c=Q("SearchInput").value;Q("SearchInput").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("SearchInput").value="";b=1}if(b>0){if(b==1){onSearchInputChanged()}return haltEvent(a)}}if(Q("viewselect").value==3){if(a.keyCode===8&&mapSearchFocus==0){var c=Q("mapSearchLocation").value;Q("mapSearchLocation").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("mapSearchLocation").value="";mapCloseSearchWindow();b=1}}}function ondockeyup(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeyUp(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeyUp(a)}if(!xxdialogMode&&xxcurrentView==13&&a.keyCode==116&&p13filetree!=null){p13folderup(9999);haltEvent(a);return false}if(!xxdialogMode&&xxcurrentView==4){if((a.keyCode===8&&searchFocus==0)||a.keyCode===27){return haltEvent(a)}}if(xxdialogMode&&a.keyCode==27){dialogclose(0)}if(xxdialogMode||xxcurrentView!=0||a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}if(Q("viewselect").value<3){if((a.keyCode===8&&searchFocus==0)||a.keyCode===27){return haltEvent(a)}}if(Q("viewselect").value==3){if((a.keyCode===8&&mapSearchFocus==0)||a.keyCode===27){return haltEvent(a)}}}var updateDevicesTimer=null;function updateDevices(){if(updateDevicesTimer!=null){return}updateDevicesTimer=setTimeout(updateDevicesEx,200)}function devMouseHover(b,c){var d=Q("viewselect").value;if(d==1){var a=b.children[1].children[1];a.children[0].classList.remove("g1s");a.children[1].classList.remove("e2s");a.children[2].classList.remove("g2s");if(c==1){a.children[0].classList.add("g1s");a.children[1].classList.add("e2s");a.children[2].classList.add("g2s")}}else{if(d==2){var a=b;a.children[2].classList.remove("g1s");a.children[4].classList.remove("e2s");a.children[3].classList.remove("g2s");if(c==1){a.children[2].classList.add("g1s");a.children[4].classList.add("e2s");a.children[3].classList.add("g2s")}}}}var deviceHeaderId=0;var deviceHeaderTotal=0;var deviceHeadersTitles={};var deviceHeaderCount;var deviceHeaders={};var oldviewmode=0;function updateDevicesEx(){if(updateDevicesTimer!=null){clearTimeout(updateDevicesTimer);updateDevicesTimer=null}var F="",a=0,f=null,e=0,h={},L=Q("viewselect").value,p={},n={};QV("xdevices",L<4);QV("xdevicesmap",L==4);QV("devListToolbar",L<3);QV("kvmListToolbar",L==3);QV("devMapToolbar",L==4);QV("devListToolbarSize",L==3);QV("NoMeshesPanel",meshcount==0);QV("devListToolbarViewIcons",(meshcount!=0)&&(nodes.length>0));QV("devListToolbarSort",(meshcount!=0)&&(nodes.length>0)&&(L<4));if((meshcount==0)||(nodes.length==0)){L=1;sort=0}if(L==4){setTimeout(function(){if(xxmap.map!=null){xxmap.map.updateSize()}},200)}else{deviceHeaderId=0;deviceHeaderCount={};deviceHeaderTotal=0;deviceHeaders={};deviceHeadersTitles={};var v=[];if(sort==0){nodes.sort(meshSort)}else{if(sort==1){nodes.sort(powerSort)}else{if(sort==2){if(showRealNames==true){nodes.sort(deviceHostSort)}else{nodes.sort(deviceSort)}}}}var d=[],k=document.getElementsByClassName("DeviceCheckbox"),b=0;for(var q=0;q<k.length;q++){if(k[q].checked){d.push(k[q].value)}}if((oldviewmode<3)&&(L==3)){multiDesktopFilter=d}else{if((oldviewmode==3)&&(L<3)){d=multiDesktopFilter}}for(var q in nodes){if(nodes[q].v==false){continue}var x=meshes[nodes[q].meshid],z=x.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(z==null){continue}var A=z.rights;if((L==3)&&(x.mtype==1)){continue}if(sort==0){if(nodes[q].meshid!=f){deviceHeaderSet();var m="";if(meshes[nodes[q].meshid].mtype==1){m="<span class=devHeaderx>, Intel® AMT only</span>"}if((L==1)&&(f!=null)){if(a==2){F+="<td><div style=width:301px></div></td>"}if(F!=""){F+="</tr></table>"}}F+="<div class=DevSt style=width:100%;padding-top:4px><span style=float:right>";F+=getMeshActions(x,A);F+='</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("'+nodes[q].meshid+'")>'+EscapeHtml(meshes[nodes[q].meshid].name)+"</span>"+m+"<span id=DevxHeader"+deviceHeaderId+" class=devHeaderx></span></div>";f=nodes[q].meshid;h[f]=1;a=0}}else{if(sort==1){var E=nodes[q].pwr?nodes[q].pwr:0;if(E!==f){deviceHeaderSet();if((L==1)&&(f!==null)){if(a==2){F+="<td><div style=width:301px></div></td>"}if(F!=""){F+="</tr></table>"}}F+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[q].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+' class="devHeaderx"></span></div>';f=E;a=0}}else{if(sort==2){if(f==null){f="1"}}}}e++;var J=EscapeHtml(nodes[q].name);if(J.length==0){J="<i>None</i>"}if((nodes[q].rname!=null)&&(nodes[q].rname.length>0)){J+=" / "+EscapeHtml(nodes[q].rname)}var B=EscapeHtml(nodes[q].name);if(showRealNames==true&&nodes[q].rname!=null){B=EscapeHtml(nodes[q].rname)}if(B.length==0){B="<i>None</i>"}var s=nodes[q].icon;var D=NodeStateStr(nodes[q]);if((!nodes[q].conn)||(nodes[q].conn==0)){s+=" gray"}if(L==1){var G=Q("xdevices").clientWidth-30;var N=Math.floor(G/301);N=301+Math.floor((G-(N*301))/N);F+="<div id=devs onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=display:inline-block;width:"+N+'px;height:50px;padding-top:1px;padding-bottom:1px><div style=width:22px;height:50%;float:left;padding-top:12px><input class="'+nodes[q].meshid+' DeviceCheckbox" onclick=p1updateInfo() value=devid_'+nodes[q]._id+" type=checkbox></div><div style=height:100%;cursor:pointer onclick=gotoDevice('"+nodes[q]._id+"')><div class=\"i"+s+'" style=width:50px;float:left></div><div style=height:100%><div class=g1></div><div class=e2><div class=e1 style=width:'+(N-100)+'px title="'+J+'">'+B+"</div><div>"+D+"</div></div><div class=g2></div></div></div></div>"}else{if(L==2){F+="<tr><td><div id=devs class=bar18 onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=height:18px;width:100%;font-size:medium>";F+='<div style=width:22px;float:left;background-color:white><input class="'+nodes[q].meshid+' DeviceCheckbox" onclick=p1updateInfo() value=devid_'+nodes[q]._id+" type=checkbox></div>";F+="<div style=float:left;height:18px;width:18px;background-color:white onclick=gotoDevice('"+nodes[q]._id+"')><div class=j"+s+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";F+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";F+='<div style=cursor:pointer;font-size:14px title="'+J+"\" onclick=gotoDevice('"+nodes[q]._id+"')><span style=float:right>"+D+"</span><span style=width:300px>"+B+"</span></div></div></td></tr>"}else{if((L==3)&&(nodes[q].conn&1)&&(((A&8)||(A&256))!=0)&&((nodes[q].agent.caps&1)!=0)){if((multiDesktopFilter.length==0)||(multiDesktopFilter.indexOf("devid_"+nodes[q]._id)>=0)){F+="<div id=devs style=display:inline-block;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div style=padding:3px;cursor:pointer onclick=gotoDevice('"+nodes[q]._id+"',11)>";F+='<div class="j'+s+'" style=width:16px;float:left></div> '+B+"</div>";F+="<span onclick=gotoDevice('"+nodes[q]._id+"')></span><div id=xkvmid_"+nodes[q]._id.split("/")[2]+"><div id=skvmid_"+nodes[q]._id.split("/")[2]+' style="position:absolute;color:white;left:5px;top:27px;text-shadow:0px 0px 5px #000;z-index:1000;cursor:default" onclick=toggleKvmDevice(\''+nodes[q]._id+"')>Disconnected</div></div>";F+="</div>";v.push(nodes[q]._id)}}}}if((sort==3)&&(F!="")){if(nodes[q].tags){for(var u in nodes[q].tags){var I=nodes[q].tags[u];if(p[I]==null){p[I]=F;n[I]=1}else{p[I]+=F;n[I]+=1}if(L==3){break}}}F=""}deviceHeaderTotal++;if(typeof deviceHeaderCount[nodes[q].state]=="undefined"){deviceHeaderCount[nodes[q].state]=1}else{deviceHeaderCount[nodes[q].state]++}}if(sort==3){var o=[];for(var q in p){o.push(q)}o.sort(function(c,j){return c.toLowerCase().localeCompare(j.toLowerCase())});for(var u in o){var q=o[u];F+="<div class=DevSt style=width:100%;padding-top:4px><span>"+q+'</span><span class="devHeaderx">, '+n[q]+" device"+((n[q]>1)?"s":"")+"</span></div>"+p[q]}}if((F=="")&&(meshcount>0)&&(Q("SearchInput").value!="")){if(sort==3){F='<div style="margin:30px">No devices are included in any groups, click on a device\'s "Groups" to add to a group.</div>'}else{F='<div style="margin:30px">No devices matching this search.</div>'}}if((L==1)&&(a==2)){F+="<td><div style=width:301px></div></td>"}if((sort==0)&&(Q("SearchInput").value=="")&&(L<3)){for(var q in meshes){var w=meshes[q],y=w.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(y!=null){var A=y.rights;if(h[w._id]==null){if((f!="")&&(F!="")){F+="</tr></table>"}F+="<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr><td colspan=3 class=DevSt><span style=float:right>";F+=getMeshActions(w,A);F+='</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("'+w._id+'")>'+EscapeHtml(w.name)+"</span></td></tr><tr>";if(w.mtype==1){F+="<td><div style=padding:10px><i>No Intel® AMT devices in this mesh";if((A&4)!=0){F+=', <a style=cursor:pointer onclick=addDeviceToMesh("'+w._id+'")>add one</a>'}}if(w.mtype==2){F+="<td><div style=padding:10px><i>No devices in this mesh";if((A&4)!=0){F+=', <a style=cursor:pointer onclick=addAgentToMesh("'+w._id+'")>add one</a>'}}F+=".</i></div></td>";f=w._id;e++}}}}F+="</tr></table><div style=height:1px></div>";F+="<div style=border-top-style:solid;border-top-width:1px;border-top-color:#DDDDDD;cursor:pointer;font-size:10px>";if((L<3)&&(sort==0)&&(meshcount>0)){F+='<a onclick=account_createMesh() title="Create a new group of devices." style=cursor:pointer>Add Device Group</a> '}F+='<a onclick=p10showMeshCmdDialog(0) style=cursor:pointer title="Download MeshCmd, a command line tool that performs many functions.">MeshCmd</a></div>';F+="</div><br/>";QH("xdevices",F);deviceHeaderSet();var k=document.getElementsByClassName("DeviceCheckbox"),b=0;for(var q=0;q<k.length;q++){k[q].checked=(d.indexOf(k[q].value)>=0)}for(var q in deviceHeaders){QH(q,deviceHeaders[q])}for(var q in deviceHeadersTitles){Q(q).title=deviceHeadersTitles[q]}p1updateInfo();if(L==3){var M=[{x:180,y:101},{x:302,y:169},{x:454,y:255}][Q("sizeselect").selectedIndex];var G=M.x+2,K=Q("xdevices").clientWidth-30,N=Math.floor(K/G);N=G+Math.floor((K-(N*G))/N);M.y=M.y*(N/M.x);M.x=N;for(var q in multiDesktop){multiDesktop[q].xxdelete=true}for(var q in v){var t=v[q],H=t.split("/")[2],g=multiDesktop[t];if(g!=null){g.m.CanvasId.setAttribute("style","background-color:black;width:"+M.x+"px;height:"+M.y+"px");Q("xkvmid_"+H).appendChild(g.m.CanvasId);delete g.xxdelete;QH("skvmid_"+H,["Disconnected","Connecting...","Setup...","",""][((g.m.State==null)?g.m.state:g.m.State)])}else{var C=getNodeFromId(t);if((desktopNode==C)&&(desktop!=null)){var a=desktop.m.CanvasId;a.setAttribute("id","kvmid_"+H);a.setAttribute("style","background-color:black;width:"+M.x+"px;height:"+M.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+t+"')");a.removeAttribute("onmousedown");a.removeAttribute("onmouseup");a.removeAttribute("onmousemove");Q("xkvmid_"+H).appendChild(a);QH("skvmid_"+H,["Disconnected","Connecting...","Setup...","",""][((desktop.m.State==null)?desktop.m.state:desktop.m.State)]);if(desktop.m.SendCompressionLevel){desktop.m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}desktop.shortid=H;desktop.onStateChanged=onMultiDesktopStateChange;multiDesktop[t]=desktop;desktop=desktopNode=currentNode=null;QH("DeskParent",'<canvas id="Desk" width="640" height="480" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>')}else{var a=document.createElement("canvas");a.setAttribute("id","kvmid_"+H);a.setAttribute("width",640);a.setAttribute("height",480);a.setAttribute("oncontextmenu","return false");a.setAttribute("style","background-color:black;width:"+M.x+"px;height:"+M.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+t+"')");try{Q("xkvmid_"+H).appendChild(a)}catch(l){}if(Q("autoConnectDesktopCheckbox").checked==true){setTimeout(function(){connectMultiDesktop(C,1)},100)}}}}for(var q in multiDesktop){if(multiDesktop[q].xxdelete==true){multiDesktop[q].Stop();delete multiDesktop[q]}else{if(debugmode&&multiDesktop[q].m&&multiDesktop[q].m.onScreenSizeChange){mdeskAdjust(multiDesktop[q].m,multiDesktop[q].m.ScreenWidth,multiDesktop[q].m.ScreenHeight,multiDesktop[q].m.CanvasId)}}}deskAdjust()}else{disconnectAllKvmFunction();Q("autoConnectDesktopCheckbox").checked=false}}oldviewmode=L}function toggleKvmDevice(d){var c=getNodeFromId(d),a=meshes[c.meshid],b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&8)||(b&256)){if(c.conn&1){connectMultiDesktop(c,1)}}}function autoConnectDesktops(){if(Q("autoConnectDesktopCheckbox").checked==true){connectAllKvmFunction()}}function connectAllKvmFunction(){for(var a in nodes){if(multiDesktop[nodes[a]._id]==null){toggleKvmDevice(nodes[a]._id)}}}function disconnectAllKvmFunction(){for(var a in multiDesktop){multiDesktop[a].Stop()}multiDesktop={}}function onMultiDesktopStateChange(a,c){try{QH("skvmid_"+a.shortid,["Disconnected","Connecting...","Setup...","",""][c])}catch(b){}}function showMultiDesktopSettings(){QV("d7amtkvm",false);QV("d7meshkvm",true);d7bitmapquality.value=multidesktopsettings.quality;d7bitmapscaling.value=multidesktopsettings.scaling;if(multidesktopsettings.framerate){d7framelimiter.value=multidesktopsettings.framerate}else{d7framelimiter.value=1000}setDialogMode(7,"Remote Desktop Settings",3,showMultiDesktopSettingsChanged)}function showMultiDesktopSettingsChanged(){multidesktopsettings.quality=d7bitmapquality.value;multidesktopsettings.scaling=d7bitmapscaling.value;multidesktopsettings.framerate=d7framelimiter.value;localStorage.setItem("multidesktopsettings",JSON.stringify(multidesktopsettings));for(var a in multiDesktop){multiDesktop[a].m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}}function connectMultiDesktop(c,a){var d=c._id,e=d.split("/")[2];var b=multiDesktop[d];if(b==null){if(Q("kvmid_"+e)==null){return}if(a==2){if((c.intelamt.user==null)||(c.intelamt.user=="")){return}b=CreateAmtRedirect(CreateAmtRemoteDesktop("kvmid_"+e));b.shortid=e;b.onStateChanged=onMultiDesktopStateChange;b.m.bpp=1;b.m.useZRLE=true;b.m.showmouse=true;b.m.onKvmData=function(f){console.log("KVM Data received in multi-desktop mode, this is not supported.")};if(debugmode>0){b.m.onScreenSizeChange=mdeskAdjust}b.Start(d,16994,"*","*",0);b.contype=2;multiDesktop[d]=b}else{if(a==1){b=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("kvmid_"+e),serverPublicNamePort);b.shortid=e;b.attemptWebRTC=attemptWebRTC;b.onStateChanged=onMultiDesktopStateChange;b.m.CompressionLevel=multidesktopsettings.quality;b.m.ScalingLevel=multidesktopsettings.scaling;b.m.FrameRateTimer=multidesktopsettings.framerate;if(debugmode>0){b.m.onScreenSizeChange=mdeskAdjust}b.Start(d);b.contype=1;multiDesktop[d]=b}}}else{b.Stop();delete multiDesktop[d]}}function getMeshActions(a,b){if((b&4)==0){return""}var c="";if((features&1024)==0){c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel® AMT computer that is located on the internet." onclick=addCiraDeviceToMesh("'+a._id+'")>Add CIRA</a>'}if(a.mtype==1){if((features&1)==0){c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel® AMT computer that is located on the local network." onclick=addDeviceToMesh("'+a._id+'")>Add Local</a>';c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel® AMT computer by scanning the local network." onclick=addAmtScanToMesh("'+a._id+'")>Scan Network</a>'}}if(a.mtype==2){c+=' <a style=cursor:pointer;font-size:10px title="Add a new computer to this mesh by installing the mesh agent." onclick=addAgentToMesh("'+a._id+'")>Add Agent</a>';if(features&64){c+=' <a style=cursor:pointer;font-size:10px title="Invite someone to install the mesh agent on this mesh." onclick=inviteAgentToMesh("'+a._id+'")>Invite</a>'}}return c}function addDeviceToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c='Add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+'".<br /><br />';c+=addHtmlValue("Device Name","<input id=dp1devicename style=width:230px maxlength=32 autocomplete=off onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />");c+=addHtmlValue("Hostname",'<input id=dp1hostname style=width:230px maxlength=32 autocomplete=off placeholder="Same as device name" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');c+=addHtmlValue("Username",'<input id=dp1username style=width:230px maxlength=32 autocomplete=off placeholder="admin" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');c+=addHtmlValue("Password","<input id=dp1password type=password style=width:230px autocomplete=off maxlength=32 onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />");c+=addHtmlValue("Security","<select id=dp1tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");setDialogMode(2,"Add Intel® AMT device",3,addDeviceToMeshEx,c,b);validateDeviceToMesh();Q("dp1devicename").focus()}function addAmtScanToMesh(a){if(xxdialogMode){return}var b="Enter a range of IP addresses to scan for Intel AMT devices.<br /><br />";b+=addHtmlValue("IP Range",'<input id=dp1range style=width:184px value="192.168.1.0/24" onkeyup=addAmtScanToMeshKeyUp(event) /><input id=dp1rangebutton type=button value=Scan onclick=addAmtScanToMeshButton()></input>');b+='<div id=dp1results style="width:100%;height:200px;background-color:white;border:1px gray solid;overflow-y:scroll"></div>';setDialogMode(2,"Scan for Intel® AMT devices",3,addAmtScanToMeshEx,b,a);QE("idx_dlgOkButton",false);QH("dp1results","<div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>");focusTextBox("dp1range")}function addAmtScanToMeshKeyUp(a){if(a.keyCode==13){haltEvent(a);addAmtScanToMeshButton()}}function addAmtScanToMeshEx(b,g){var d=document.getElementsByClassName("DevScanCheckbox"),c=0;for(var e=0;e<d.length;e++){if(d[e].checked){var f=d[e].getAttribute("tag");var a=amtScanResults[f];meshserver.send({action:"addamtdevice",meshid:g,devicename:f,hostname:a.hostname,amtusername:"",amtpassword:"",amttls:a.tls})}}}function addAmtScanToMeshButton(){QE("dp1range",false);QE("dp1rangebutton",false);QH("dp1results","<div style=width:100%;text-align:center;margin-top:12px>Scanning...</div>");meshserver.send({action:"scanamtdevice",range:Q("dp1range").value})}function addAmtScanToMeshCheckbox(){var b=document.getElementsByClassName("DevScanCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked){a++}}QE("idx_dlgOkButton",a>0)}function addCiraDeviceToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c=b.split("/")[2].replace(/\@/g,"X").replace(/\$/g,"X");var e="<select id=dlgAddCiraSel onclick=dlgAddCiraSelClick() style=width:230px><option value=0>MeshCommander Script</option><option value=1>Manual Username/Password</option>";if((features&16)==0){e+="<option value=2>Manual Certificate</option></select>"}var d="";d+=addHtmlValue("Setup Method",e);d+="<hr>";d+='<div id=dlgAddCira0>To add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+"\" with CIRA, download the following script files and use <a href='http://meshcommander.com' rel='noreferrer noopener' target='_blank'>MeshCommander</a> to run the script to configure computers.<br /><br />";d+=addHtmlValue("Setup CIRA",'<a href="mescript.ashx?type=1&meshid='+c.substring(0,16)+'" rel="noreferrer noopener" target="_blank">cira_setup.mescript</a>');d+=addHtmlValue("Cleanup CIRA",'<a href="mescript.ashx?type=2" rel="noreferrer noopener" target="_blank">cira_clean.mescript</a>');d+="</div>";d+='<div id=dlgAddCira1 style=display:none>To add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+'" with CIRA, load the following certificate as trusted root within Intel AMT';if(serverinfo.mpspass){d+=" and authenticate to the server using this username and password.<br /><br />"}else{d+=" and authenticate to the server using this username and any password.<br /><br />"}d+=addHtmlValue("Root Certificate",'<a href="MeshServerRootCert.cer" rel="noreferrer noopener" target="_blank">Root Certificate File</a>');d+=addHtmlValue("Username",'<input style=width:230px readonly value="'+c.substring(0,16)+'" />');if(serverinfo.mpspass){d+=addHtmlValue("Password",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpspass)+'" />')}if(serverinfo!=null){d+=addHtmlValue("MPS Server",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpsname)+":"+serverinfo.mpsport+'" />')}d+="</div>";if((features&16)==0){d+='<div id=dlgAddCira2 style=display:none>To add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+'" with CIRA, load the following certificate as trusted root within Intel AMT, authenticate using a client certificate with the following common name and connect to the following server.<br /><br />';d+=addHtmlValue("Root Certificate",'<a href="MeshServerRootCert.cer" rel="noreferrer noopener" target="_blank">Root Certificate File</a>');d+=addHtmlValue("Organization",'<input style=width:230px readonly value="'+c+'" />');if(serverinfo!=null){d+=addHtmlValue("MPS Server",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpsname)+":"+serverinfo.mpsport+'" />')}d+="</div>"}setDialogMode(2,"Add Intel® AMT CIRA device",1,null,d)}function dlgAddCiraSelClick(){var a=Q("dlgAddCiraSel").value;QV("dlgAddCira0",a==0);QV("dlgAddCira1",a==1);QV("dlgAddCira2",a==2)}function checkEmail(c){var d=c.split("@");var b=((d.length==2)&&(d[0].length>0)&&(d[1].split(".").length>1)&&(d[1].length>2));if(b==true){var e=d[1].split(".");for(var a in e){if(e[a].length==0){b=false}}}return b}function inviteAgentToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c="Invite someone to install the mesh agent. An email with be sent with the link to the mesh agent installation for "+EscapeHtml(a.name)+".<br /><br />";c+=addHtmlValue("Name (optional)",'<input id=agentInviteName value="" style=width:230px maxlength=64 />');c+=addHtmlValue("Email",'<input id=agentInviteEmail style=width:230px placeholder="example@email.com" onkeyup=validateAgentInvite()></input>');c+=addHtmlValue("Operating System","<select id=agentInviteNameOs style=width:236px><option value=0>Any supported</option><option value=1>Windows only</option><option value=3>Apple OSX only</option><option value=2>Linux only</option></select>");c+=addHtmlValue("Installation Type","<select id=agentInviteType style=width:236px><option value=0>Background and interactive</option><option value=2>Background only</option><option value=1>Interactive only</option></select>");c+=addHtmlValue("Message<br />(optional)",'<textarea id=agentInviteMessage value="" style=width:230px;height:100px;resize:none maxlength=1024 /></textarea>');setDialogMode(2,"Invite",3,performAgentInvite,c,b);validateAgentInvite()}function validateAgentInvite(){QE("idx_dlgOkButton",checkEmail(Q("agentInviteEmail").value))}function performAgentInvite(a,b){meshserver.send({action:"inviteAgent",meshid:b,email:Q("agentInviteEmail").value,name:Q("agentInviteName").value,os:Q("agentInviteNameOs").value,flags:Q("agentInviteType").value,msg:Q("agentInviteMessage").value})}function addAgentToMesh(c){if(xxdialogMode){return}var b=meshes[c],f="",a=0;f+=addHtmlValue("Operating System","<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>Windows</option><option value=1>Linux</option><option value=2>Apple OSX</option><option value=3>Windows (UnInstall)</option><option value=4>Linux (UnInstall)</option></select>");f+="<div id=aginsTypeDiv>";f+=addHtmlValue("Installation Type","<select id=aginsType onchange=addAgentToMeshClick() style=width:236px><option value=0>Background & interactive</option><option value=2>Background only</option><option value=1>Interactive only</option></select>");f+="</div><hr>";f+='<div id=agins_windows>To add a new computer to device group "'+EscapeHtml(b.name)+'", download the mesh agent and install it the computer to manage. This agent has server and mesh information embedded within it.<br /><br />';f+=addHtmlValue("Mesh Agent",'<a id=aginsw32lnk href="meshagents?id=3&meshid='+c.split("/")[2]+'&installflags=0" rel="noreferrer noopener" target="_blank" title="32bit version of the MeshAgent">Windows (.exe)</a>');f+=addHtmlValue("Mesh Agent",'<a id=aginsw64lnk href="meshagents?id=4&meshid='+c.split("/")[2]+'&installflags=0" rel="noreferrer noopener" target="_blank" title="64bit version of the MeshAgent">Windows x64 (.exe)</a>');if(debugmode>0){f+=addHtmlValue("Settings File",'<a id=aginswmshlnk href="meshsettings?id='+c.split("/")[2]+'&installflags=0" rel="noreferrer noopener" target="_blank">'+EscapeHtml(b.name)+" settings (.msh)</a>")}f+="</div>";f+="<div id=agins_linux style=display:none>To add a computer to "+EscapeHtml(b.name)+" run the following command. Root credentials will be needed.<br />";f+="<textarea id=agins_linux_area rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>";f+="</div>";f+='<div id=agins_osx style=display:none>To add a new computer to device group "'+EscapeHtml(b.name)+'", download the mesh agent and install it the computer to manage. This agent installer has server and mesh information embedded within it.<br /><br />';f+=addHtmlValue("Mesh Agent",'<a href="meshosxagent?id=16&meshid='+c.split("/")[2]+'" rel="noreferrer noopener" target="_blank" title="64bit version of OSX Mesh Agent">OSX Agent (64bit)</a>');f+="</div>";f+='<div id=agins_windows_un style=display:none>To remove a mesh agent, download the file below, run it and click "uninstall".<br /><br />';f+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=3" rel="noreferrer noopener" target="_blank" title="32bit version of the MeshAgent">Windows (.exe)</a>');f+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=3" rel="noreferrer noopener" target="_blank" title="64bit version of the MeshAgent">Windows x64 (.exe)</a>');f+="</div>";f+="<div id=agins_linux_un style=display:none>To remove a mesh agent, run the following command. Root credentials will be needed.<br />";f+="<textarea id=agins_linux_area_un rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>";f+="</div>";setDialogMode(2,"Add Mesh Agent",9,null,f);var e=serverinfo.name;if((e=="un-configured")||((features&2)!=0)){e=window.location.hostname}if(serverinfo.https==true){var d=(serverinfo.port==443)?"":(":"+serverinfo.port);Q("agins_linux_area").value="wget https://"+e+d+"/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://"+e+d+" '"+c.split("/")[2]+"'\r\n";Q("agins_linux_area_un").value="wget https://"+e+d+"/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"}else{var d=(serverinfo.port==80)?"":(":"+serverinfo.port);Q("agins_linux_area").value="wget http://"+e+d+"/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://"+e+d+" '"+c.split("/")[2]+"'\r\n";Q("agins_linux_area_un").value="wget http://"+e+d+"/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"}Q("aginsSelect").focus();addAgentToMeshClick()}function addAgentToMeshClick(){var a=Q("aginsSelect").value;QV("agins_windows",a==0);QV("agins_linux",a==1);QV("agins_osx",a==2);QV("agins_windows_un",a==3);QV("agins_linux_un",a==4);QV("aginsTypeDiv",a==0);Q("aginsw32lnk").href=(Q("aginsw32lnk").href.split("installflags=")[0])+"installflags="+Q("aginsType").value;Q("aginsw64lnk").href=(Q("aginsw64lnk").href.split("installflags=")[0])+"installflags="+Q("aginsType").value;if(debugmode>0){Q("aginswmshlnk").href=(Q("aginswmshlnk").href.split("installflags=")[0])+"installflags="+Q("aginsType").value}}function validateDeviceToMesh(){QE("idx_dlgOkButton",(Q("dp1devicename").value.length>0)&&(passwordcheck(Q("dp1password").value)))}function addDeviceToMeshEx(b,d){var a=Q("dp1username").value;if(a==""){a="admin"}var c=Q("dp1hostname").value;if(c==""){c=Q("dp1devicename").value}meshserver.send({action:"addamtdevice",meshid:d,devicename:Q("dp1devicename").value,hostname:c,amtusername:a,amtpassword:Q("dp1password").value,amttls:Q("dp1tls").value})}function deviceHeaderSet(){if(deviceHeaderId==0){deviceHeaderId=1;return}deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+((deviceHeaderTotal==1)?" node":" nodes");deviceHeaderId++;deviceHeaderCount={};deviceHeaderTotal=0}var powerStateStrings=["",'<span title="Device is powered on.">Powered</span>','<span title="Device is in sleep state (S1).">Sleeping</span>','<span title="Device is in sleep state (S2).">Sleeping</span>','<span title="Device is in deep sleep state (S3).">Deep Sleep</span>','<span title="Device is in hibernating state (S4).">Hibernating</span>','<span title="Device is in powered off state (S5).">Soft-Off</span>','<span title="Device is detected but power state could not be obtained.">Present</span>'];var powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"];var powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(a){var b=[];if(a.state>0&&a.state<powerStatetable.length){state.push(powerStatetable[a.state])}if(a.conn){if((a.conn&1)!=0){b.push('<span title="Mesh agent is connected and ready for use.">Agent</span>')}if((a.conn&2)!=0){b.push('<span title="Intel® AMT CIRA is connected and ready for use.">CIRA</span>')}if((a.conn&4)!=0){b.push('<span title="Intel® AMT is routable.">Intel® AMT</span>')}if((a.conn&8)!=0){b.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>')}}if((a.pwr!=null)&&(a.pwr!=0)){b.push(powerStateStrings[a.pwr])}return b.join(", ")}function PowerStateStr(a){if(a<powerStatetable.length){return powerStatetable[a]}return""}function PowerStateStr2(a){if((a!=0)&&(a<powerStatetable.length)){return powerStatetable[a]}return"Unknown"}function selectallButtonFunction(){var b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked===true){a++}}for(var c=0;c<b.length;c++){b[c].checked=(a==0)}p1updateInfo()}function p1updateInfo(){var b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked===true){a++}}if(a>0){QE("GroupActionButton",true);Q("SelectAllButton").value="Select None";QV("cxmgroupsplit",true);QV("cxmdesktop",true)}else{QE("GroupActionButton",false);Q("SelectAllButton").value="Select All";QV("cxmgroupsplit",false);QV("cxmdesktop",false)}}function groupActionFunction(){var a="Select an operation to perform on all selected devices. Actions will be performed only with proper rights.<br /><br />";a+=addHtmlValue("Operation","<select id=d2groupop style=float:right;width:250px><option value=100>Wake-up devices</option><option value=4>Sleep devices</option><option value=3>Reset devices</option><option value=2>Power off devices</option><option value=101>Delete devices</option></select>");setDialogMode(2,"Group Action",3,groupActionFunctionEx,a)}function getCheckedDevices(){var e=[],b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked){if(b[c].value){var d=b[c].value.substring(6);if(e.indexOf(d)==-1){e.push(d)}}}}return e}function groupActionFunctionEx(){var a=Q("d2groupop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:getCheckedDevices()})}else{if(a==101){var b="Confirm delete selected devices(s)?<br /><br />";b+="<input id=d2check type=checkbox onchange=d2groupActionFunctionDelEx() />Confirm";setDialogMode(2,"Delete Nodes",3,groupActionFunctionDelEx,b);QE("idx_dlgOkButton",false)}else{meshserver.send({action:"poweraction",nodeids:getCheckedDevices(),actiontype:a})}}}function d2groupActionFunctionDelEx(){QE("idx_dlgOkButton",Q("d2check").checked)}function groupActionFunctionDelEx(){meshserver.send({action:"removedevices",nodeids:getCheckedDevices()})}function onSortSelectChange(a){sort=document.getElementById("sortselect").selectedIndex;if(!a){putstore("sort",sort)}updateDevicesEx()}function meshSort(c,d){if(c.meshnamel>d.meshnamel){return 1}if(c.meshnamel<d.meshnamel){return -1}if(c.meshid==d.meshid){if(showRealNames==true){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}else{if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}}return 0}function powerSort(c,e){var d=c.pwr?c.pwr:0;var f=e.pwr?e.pwr:0;if(d>f){return -1}if(d<f){return 1}if(d==f){if(showRealNames==true){if(c.rnamel>e.rnamel){return 1}if(c.rnamel<e.rnamel){return -1}return 0}else{if(c.namel>e.namel){return 1}if(c.namel<e.namel){return -1}return 0}}return 0}function deviceSort(c,d){if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}function deviceHostSort(c,d){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}function onSearchFocus(a){searchFocus=a}function onMapSearchFocus(a){mapSearchFocus=a}function onUserSearchFocus(a){userSearchFocus=a}function onConsoleFocus(a){consoleFocus=a}function onSearchInputChanged(){var g=Q("SearchInput").value.toLowerCase().trim();putstore("search",g);if(g==""){for(var a in nodes){nodes[a].v=true}}else{try{var c=g.split(/\s+/).join("|"),e=new RegExp(c);for(var a in nodes){nodes[a].v=(e.test(nodes[a].name.toLowerCase()))||(nodes[a].rnamel!=null&&e.test(nodes[a].rnamel.toLowerCase()));if((nodes[a].v==false)&&nodes[a].tags){for(var f in nodes[a].tags){if(e.test(nodes[a].tags[f].toLowerCase())){nodes[a].v=true;break}else{nodes[a].v=false}}}}}catch(b){for(var a in nodes){nodes[a].v=true}}}updateDevices()}var contextelement=null;function handleContextMenu(d){hideContextMenu();var k=(window.pageXOffset!==null)?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft;var l=(window.pageYOffset!==null)?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;var c=document.elementFromPoint(d.pageX-k,d.pageY-l);if(c&&c!=null&&c.id=="MxMESH"){contextelement=c;var b=document.getElementById("meshContextMenu");b.style.left=d.pageX+"px";b.style.top=d.pageY+"px";b.style.display="block"}else{while(c&&c!=null&&c.id!="devs"){c=c.parentElement}if(!c||c==null){return true}contextelement=c;var b=document.getElementById("contextMenu");b.style.left=d.pageX+"px";b.style.top=d.pageY+"px";b.style.display="block"}var j=contextelement.children[1].attributes.onclick.value;var h=getNodeFromId(j.substring(12,j.length-2));var e=meshes[h.meshid];var f=e.links["user/"+domain+"/"+userinfo.name.toLowerCase()];var g=f.rights;var a=((g&16)!=0);QV("cxdesktop",((e.mtype==1)||(h.agent==null)||(h.agent.caps==null)||((h.agent.caps&1)!=0)||(h.intelamt&&(h.intelamt.state==2)))&&((g&8)||(g&256)));QV("cxterminal",((e.mtype==1)||(h.agent==null)||(h.agent.caps==null)||((h.agent.caps&2)!=0)||(h.intelamt&&(h.intelamt.state==2)))&&(g&8));QV("cxfiles",((e.mtype==2)&&((h.agent==null)||(h.agent.caps==null)||((h.agent.caps&4)!=0)))&&(g&8));QV("cxevents",(h.intelamt!=null)&&((h.intelamt.state==2)||(h.conn&2))&&(g&8));QV("cxconsole",(a&&(e.mtype==2)&&((h.agent==null)||(h.agent.caps==null)||((h.agent.caps&8)!=0)))&&(g&8));return haltEvent(d)}function cmaction(a){var b=contextelement.children[1].attributes.onclick.value;b=b.substring(12,b.length-2);if(a==1){gotoDevice(b,10)}if(a==2){gotoDevice(b,12)}if(a==3){gotoDevice(b,11)}if(a==4){gotoDevice(b,13)}if(a==5){gotoDevice(b,16)}if(a==6){gotoDevice(b,15)}if(a==7){Q("viewselect").value=3;Q("viewselect").onchange();Q("autoConnectDesktopCheckbox").checked=true;Q("autoConnectDesktopCheckbox").onclick()}}function cmmeshaction(a){var d=contextelement.attributes.onclick.value.substring(32,(32+69));var b=document.getElementsByClassName("DeviceCheckbox");if(a==1){for(var c=0;c<b.length;c++){if((b[c].attributes)&&(b[c].attributes["class"]["value"].substring(0,69)==d)){b[c].checked=true}}}if(a==2){for(var c=0;c<b.length;c++){if((b[c].attributes)&&(b[c].attributes["class"]["value"].substring(0,69)==d)){b[c].checked=false}}}p1updateInfo()}function hideContextMenu(){QV("contextMenu",false);QV("meshContextMenu",false);contextelement=null}var xxmap={map:null,contextmenu:null,activeInteractions:[],showindex:0,markersSource:null,markersLayer:null,mapLayer:null,mapView:null,};function updateMapMarkers(h){if((xxmap!=null)&&(xxmap.map==null)){try{loadmap()}catch(b){console.error("loadmap() exception",b)}}if(xxmap==null){return}var a=null;for(var d in nodes){try{var f=map_parseNodeLoc(nodes[d]),c=xxmap.markersSource.getFeatureById(nodes[d]._id);if((f!=null)&&((nodes[d].meshid==h)||(h==null))){var e=f[0],g=f[1],j=f[2];if(a==null){a=[e,g,e,g,0]}else{if(e<a[0]){a[0]=e}if(g<a[1]){a[1]=g}if(e>a[2]){a[2]=e}if(g>a[3]){a[3]=g}}if(c==null){addFeature(nodes[d]);a[4]=1}else{updateFeature(nodes[d],c);c.setStyle(markerStyle(nodes[d],f[2]))}}else{if(c){xxmap.markersSource.removeFeature(c)}}}catch(b){console.error("updateMapMarkers() exception",b,JSON.stringify(nodes[d]))}}return a}var map_cm_popup=new ol.Overlay({element:Q("xmap-info-window"),positioning:"bottom-center",stopEvent:false});var map_cm_editMarker={text:"Modify node location",callback:function(a){modifyMarkerloc(a.data)}};var map_cm_clearMarker={text:"Remove node location",callback:function(a){meshserver.send({action:"changedevice",nodeid:a.data.a,userloc:[]})}};var map_cm_saveMarker={text:"Save node location",callback:function(a){saveMarkerloc(a.data)}};var map_cm_nodemenu_items=[{text:"General information",callback:function(a){if(a.data!=null){gotoDevice(a.data,10)}}},{text:"Desktop",callback:function(a){if(a.data!=null){gotoDevice(a.data,11)}}},{text:"Terminal",callback:function(a){if(a.data!=null){gotoDevice(a.data,12)}}},{text:"Intel® AMT",callback:function(a){if(a.data!=null){gotoDevice(a.data,14)}}},"-",{text:"Zoom-in to extent",callback:function(b){var a=b.data.getGeometry().getCoordinates();zoomToLocation(a,19)}},{text:"Zoom-out to extent",callback:function(b){var a=b.data.getGeometry().getCoordinates();zoomToLocation(a,2)}}];var contextmenu_items=[{text:"Refresh",callback:function(){refreshMap(true,true)}},{text:"Zoom to fit extent",callback:function(){zoomToFitExtent()}},{text:"Center map here",callback:function(a){xxmap.mapView.animate({center:a.coordinate})}},{text:"Place node here",callback:function(a){placeNode(a.coordinate)}}];function stringToIntHash(c){var a=0,b;for(b=0;b<c.length;b++){a=((a<<5)-a)+c.charCodeAt(b);a|=0}return a}function map_parseNodeLoc(b){var a=null,c=0;if(b.iploc){a=b.iploc;c=1}if(b.wifiloc){a=b.wifiloc;c=2}if(b.gpsloc){a=b.gpsloc;c=3}if(b.userloc){a=b.userloc;c=4}if((a==null)||(typeof a!="string")){return null}a=a.split(",");if(c==1){return[parseFloat(a[0])+(stringToIntHash(b._id.substring(0,20))/100000000000),parseFloat(a[1])+(stringToIntHash(b._id.substring(20))/100000000000),c]}else{return[parseFloat(a[0]),parseFloat(a[1]),c]}}function loadmap(){if(xxmap==null){return}try{xxmap.markersSource=new ol.source.Vector();xxmap.markersLayer=new ol.layer.Vector({source:xxmap.markersSource});xxmap.mapLayer=new ol.layer.Tile({source:new ol.source.OSM()});xxmap.mapView=new ol.View({center:ol.proj.transform([0,0],"EPSG:4326","EPSG:3857"),zoom:2,minZoom:2,maxZoom:20,extent:ol.proj.transformExtent([-100000,-69.55,100000,69.55],"EPSG:4326","EPSG:3857")});xxmap.map=new ol.Map({target:"xdevicesmap",layers:[xxmap.mapLayer,xxmap.markersLayer],view:xxmap.mapView});xxmap.map.addOverlay(map_cm_popup);xxmap.map.on("click",function(c){var d=xxmap.map.forEachFeatureAtPixel(c.pixel,function(g,h){return g});if(d){var f=d.getId();if(f!=null){gotoDevice(f,10)}else{var e=getCorrespondingFeature(d);gotoDevice(e.getId(),10)}}});xxmap.map.on("pointermove",function(d){var f=xxmap.map.forEachFeatureAtPixel(d.pixel,function(h,j){return h});if(f){xxmap.map.getTargetElement().style.cursor="pointer";var c=f.getGeometry().getCoordinates();map_cm_popup.setPosition(c);var e=f.getId();if(e){QH("xmap-info-window",f.get("name"))}else{var g=getCorrespondingFeature(f);QH("xmap-info-window",g.get("name"))}}else{xxmap.map.getTargetElement().style.cursor="";QH("xmap-info-window","")}});var a=new ContextMenu({width:160,defaultItems:false,items:contextmenu_items});a.on("open",function(c){var e=xxmap.map.forEachFeatureAtPixel(c.pixel,function(g,h){return g});xxmap.contextmenu.clear();if(e){var d=e.getId();if(d){addContextMenuItems(e)}else{var f=getCorrespondingFeature(e);if(f){addContextMenuItems(f)}else{xxmap.contextmenu.extend(contextmenu_items)}}}else{xxmap.contextmenu.extend(contextmenu_items)}});if(xxmap.contextmenu==null){xxmap.contextmenu=a}xxmap.map.addControl(xxmap.contextmenu)}catch(b){console.log(b);QV("viewselectmapoption",false);QV("devViewButton4",false);xxmap=null}}function addFeature(f,c,e){var a=getModifiedFeature(f._id);if(a){xxmap.markersSource.addFeature(a)}else{if(!c&&!e){var d=map_parseNodeLoc(f);c=d[0];e=d[1]}if(e>180){e=180-e;meshserver.send({action:"changedevice",nodeid:f._id,userloc:[c,e]})}if((c<90)&&(c>-90)&&(e<180)&&(e>-180)){var b=new ol.Feature({geometry:new ol.geom.Point(ol.proj.transform([e,c],"EPSG:4326","EPSG:3857")),name:f.name,status:f.conn,lat:c,lon:e});b.setId(f._id);b.setStyle(markerStyle(f));xxmap.markersSource.addFeature(b)}}}function removeFeature(b){var a=xxmap.markersSource.getFeatureById(b._id);if(a){xxmap.markersSource.removeFeature(a)}}function updateFeature(f,a){if(f.conn!=a.get("status")){a.set("status",f.conn);a.setStyle(markerStyle(f))}var c=map_parseNodeLoc(f);if(c!=null){var b=c[0],d=c[1];if((b!=a.get("lat"))||(d!=a.get("lon"))){a.set("lat",b);a.set("lon",d);var e=ol.proj.transform([parseFloat(d),parseFloat(b)],"EPSG:4326","EPSG:3857");a.getGeometry().setCoordinates(e)}}if(f.name!=a.get("name")){a.set("name",f.name)}}function modifyMarkerloc(c){var b=c.getId();if(b){c.setStyle(markerStyle(getNodeFromId(c.a),4));if(!getActiveInteractions(c)){var a=new ol.interaction.Modify({features:new ol.Collection([c]),pixelTolerance:10});xxmap.activeInteractions.push({featureid:b,feature:c,interaction:a});xxmap.map.addInteraction(a)}}}function saveMarkerloc(d){var c=d.getId();if(c){var a=getActiveInteractions(d);if(a){xxmap.map.removeInteraction(a);removeInteraction(c);var b=d.getGeometry().getCoordinates();var e=ol.proj.transform(b,"EPSG:3857","EPSG:4326");if(e[0]>180){e[0]=180-e[0]}var f=[e[1],e[0]];meshserver.send({action:"changedevice",nodeid:c,userloc:f})}}}function markerStyle(b,d){if(d==null){d=0;if(b.iploc){d=1}if(b.wifiloc){d=2}if(b.gpsloc){d=3}if(b.userloc){d=4}}var e=["","-ip","-wifi","-gps","-user"];var a=connStateColor(b);var c=new ol.style.Style({image:new ol.style.Icon({color:a,anchor:[0.5,1],src:"images/mapmarker"+e[d]+".png"})});return[c]}function connStateColor(a){if(a.conn==1||a.conn==3||a.conn==5){return"#00ffdd"}return"#C70039"}function addContextMenuItems(a){if(getActiveInteractions(a)){map_cm_saveMarker.data=a;xxmap.contextmenu.push(map_cm_saveMarker)}else{map_cm_editMarker.data=a;xxmap.contextmenu.push(map_cm_editMarker);var b=getNodeFromId(a.a);if(b.userloc){map_cm_clearMarker.data=a;xxmap.contextmenu.push(map_cm_clearMarker)}}map_cm_nodemenu_items.forEach(function(c){if(c.text=="Zoom-in to extent"||c.text=="Zoom-out to extent"){c.data=a}else{if(c!="-"){c.data=a.getId()}}});xxmap.contextmenu.extend(map_cm_nodemenu_items)}function getActiveInteractions(b){var a=b.getId();for(var c=0;c<xxmap.activeInteractions.length;c++){if(xxmap.activeInteractions[c].featureid==a){return xxmap.activeInteractions[c].interaction}}return false}function getModifiedFeature(a){if(a){for(var b=0;b<xxmap.activeInteractions.length;b++){if(xxmap.activeInteractions[b].featureid==a){return xxmap.activeInteractions[b].feature}}}return null}function removeInteraction(a){var c=-1;for(var b=0;b<xxmap.activeInteractions.length;b++){if(xxmap.activeInteractions[b].featureid===a){c=b;break}}if(c>=0){xxmap.activeInteractions.splice(c,1)}}function getCorrespondingFeature(e){var d=e.getGeometry().getCoordinates();for(var b=0;b<xxmap.activeInteractions.length;b++){var c=xxmap.activeInteractions[b].feature;var a=c.getGeometry().getCoordinates();if(a[0].toFixed(5)==d[0].toFixed(5)&&a[1].toFixed(5)==d[1].toFixed(5)){return c}}return null}function refreshMap(h,g){if(h){xxmap.map.setTarget(null);xxmap.map=null;xxmap.markersSource=null;xxmap.mapView=null;xxmap.mapLayer=null;xxmap.activeInteractions=[]}var a=updateMapMarkers();if((a!=null)&&(g||(a[4]==1))){var b=(a[0]+a[2])/2;var c=(a[1]+a[3])/2;var d=Math.max(Math.abs(a[0]-a[2]),Math.abs(a[1]-a[3]));var k=xxmap.map.getView();k.setCenter(ol.proj.transform([c,b],"EPSG:4326","EPSG:3857"));var e=360,f=-2;while(e>d){f++;e=e/2}k.setZoom(f)}}function placeNode(a){if(xxdialogMode){return}var c='<div style=margin-bottom:6px><label for=selectnode-search>Search</label>  <input type=text placeholder="Device name" id="selectnode-search" onchange=onPlaceNodeInputChange() onkeyup=onPlaceNodeInputChange() autocomplete=off style=width:120px></div><div id=placenode style="height:254px;overflow-y:auto;width:100%;margin:12px 1px 4px 1px;"><div id=noNodesMapPlace style=text-align:center;width:100%;display:none>No devices found.</div>';for(var b in nodes){c+="<div class=noselect id="+nodes[b]._id+"-rowid onclick=selectNodeToPlace(event,'"+nodes[b]._id+"') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id="+nodes[b]._id+"-checkid type=checkbox style=width:16px;display:inline />";c+="<div class=j"+nodes[b].icon+" style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>"+nodes[b].name+"</div></div>"}setDialogMode(2,"Select a node to place",3,placeNodeEx,c+"</div>",a);onPlaceNodeInputChange()}function placeNodeEx(b,c){var d=document.getElementsByName("PlaceMapDeviceCheckbox");for(var f in d){if(d[f].checked){var g=getNodeFromId(d[f].id.substring(0,d[f].id.length-8));if(g){var e=xxmap.markersSource.getFeatureById(f);var h=ol.proj.transform(c,"EPSG:3857","EPSG:4326");var j=[h[1],h[0]];if(e){e.getGeometry().setCoordinates(c);var a=getActiveInteractions(e);if(a){saveMarkerloc(e)}else{meshserver.send({action:"changedevice",nodeid:g._id,userloc:j})}}else{meshserver.send({action:"changedevice",nodeid:g._id,userloc:j})}}}}}function onPlaceNodeInputChange(){updatePlaceNodeTable(Q("selectnode-search").value.trim().toLowerCase())}function updatePlaceNodeTable(d){var b=document.getElementsByName("PlaceMapDeviceCheckbox"),a=0;for(var c in nodes){var e=((nodes[c].namel.indexOf(d)>=0||d=="")||(nodes[c].rnamel!=null&&nodes[c].rnamel.indexOf(d)>=0));if(e){a++}QV(nodes[c]._id+"-rowid",e)}QV("noNodesMapPlace",a==0)}function selectNodeToPlace(b,f){if(b.target.name!="PlaceMapDeviceCheckbox"){var g=Q(f+"-checkid");g.checked=!g.checked}var c=document.getElementsByName("PlaceMapDeviceCheckbox"),a=0;for(var d in c){if(c[d].checked){a++}}QE("idx_dlgOkButton",a>0)}function addMeshOptions(a,b){}function meshOptionRmvMod(a,b){}function meshExists(){for(var a in meshes){if(meshes[a]){return true}}return false}function setMeshView(a){var c=Q("select-mesh");var b=c.selectedIndex;if(c[b].value==a){c[0].selected=true;onSelectMeshChange()}}function clearMeshOptions(){}function getSearchLocation(){try{var b=Q("mapSearchLocation").value.trim();if(b.length>0){var c=new XMLHttpRequest();c.onreadystatechange=function(){if(c.readyState==4&&c.status==200){formatSearchData(c.responseText)}};c.open("GET","https://nominatim.openstreetmap.org/search?q="+b+"&format=json",true);c.send()}}catch(a){}}function formatSearchData(c){try{QH("xmapSearchResults","");var d=JSON.parse(c),b=0,j='<div style="overflow-y:auto;width:100%;max-height:240px">';for(var h=0;h<d.length;h++){if(d[h].display_name&&d[h].boundingbox[0]&&d[h].boundingbox[1]&&d[h].boundingbox[2]&&d[h].boundingbox[3]){b++;var a=(h%2==0)?"F5F5F5":"EBEBEB";j+="<div style=cursor:pointer;padding:5px;background-color:#"+a+" onclick=mapGotoSelectedLocation(this)><div>"+d[h].display_name+"</div><div style=display:none>"+d[h].boundingbox[0]+"!#!"+d[h].boundingbox[1]+"!#!"+d[h].boundingbox[2]+"!#!"+d[h].boundingbox[3]+"</div></div>"}}j+="</div>";if(b==1){var g=[parseFloat(d[0].boundingbox[2]),parseFloat(d[0].boundingbox[0]),parseFloat(d[0].boundingbox[3]),parseFloat(d[0].boundingbox[1])];zoomToExtent(g)}else{if(b==0){j="<div style=width:200px>No location found.<div>"}QV("xmapSearchResultsDlg",true)}QH("xmapSearchResults",j)}catch(f){}}function mapGotoSelectedLocation(c){var d=c.children;var a=d[1].innerHTML.split("!#!");var b=[parseFloat(a[2]),parseFloat(a[0]),parseFloat(a[3]),parseFloat(a[1])];zoomToExtent(b);mapCloseSearchWindow()}function mapCloseSearchWindow(){QH("xmapSearchResults","");QV("xmapSearchResultsDlg",false)}function zoomToLocation(a,c){var b=xxmap.map.getView();b.setCenter(a);b.setZoom(c)}function zoomToFitExtent(){var b=xxmap.markersSource.getFeatures();if(b.length>0){var a=xxmap.markersSource.getExtent();xxmap.map.getView().fit(a,xxmap.map.getSize())}}function zoomToExtent(b){var a=ol.proj.transformExtent(b,ol.proj.get("EPSG:4326"),ol.proj.get("EPSG:3857"));xxmap.map.getView().fit(a,xxmap.map.getSize())}function refreshDevice(a){if(!currentNode||currentNode._id!=a){return}gotoDevice(a,xxcurrentView,true)}function getNodeRights(c){var b=getNodeFromId(c),a=meshes[b.meshid];return a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights}var currentNode;var powerTimelineNode=null;var powerTimelineReq=null;var powerTimelineUpdate=null;var powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(n,p,s){var m=getNodeFromId(n);var j=meshes[m.meshid];var k=j.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(!currentNode||currentNode._id!=m._id||s==true){currentNode=m;var l=EscapeHtml(m.name);if(l.length==0){l="<i>None</i>"}if((k&4)!=0){l='<span title="Click here to edit the server-side device name" onclick=showEditNodeValueDialog(0) style=cursor:pointer>'+l+' <img class=hoverButton src="images/link5.png" /></span>'}QH("p10deviceName",l);QH("p11deviceName",l);QH("p12deviceName",l);QH("p13deviceName",l);QH("p14deviceName",l);QH("p15deviceName",l);QH("p16deviceName",l);var v="<table style=width:100%>";v+=addDeviceAttribute('<span title="The name of the device group this computer belong to.">Group</span>','<a title="The name of the device group this computer belong to" onclick=gotoMesh("'+m.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[m.meshid].name)+"</a>");if((m.rname!=null)&&(m.name!=m.rname)){v+=addDeviceAttribute('<span title="The name of this computer as set in the operating system">Name</span>','<span title="The name of this computer as set in the operating system">'+EscapeHtml(m.rname)+"</span>")}if((features&1)==0){if((k&4)!=0){if(m.host){v+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(m.host)+"</span>")}else{v+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>")}}else{v+=addDeviceAttribute("Hostname",EscapeHtml(m.host))}}var f=m.desc?EscapeHtml(m.desc):"<i>None</i>";if((k&4)!=0){v+=addDeviceAttribute("Description","<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+f+' <img class=hoverButton src="images/link5.png" /></span>')}else{v+=addDeviceAttribute("Description",f)}var a=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","OSX 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","OSX 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l"];if((m.agent!=null)&&(m.agent.id!=null)&&(m.agent.ver!=null)){var t="";if(m.agent.id<=a.length){t=a[m.agent.id]}else{t=a[0]}if(m.agent.ver!=0){t+=" v"+m.agent.ver}v+=addDeviceAttribute("Mesh Agent",t)}if(m.intelamt!=null){var t="";var r={0:"Not Activated (Pre)",1:"Not Activated (In)",2:"Activated"};if(m.intelamt.ver!=null&&m.intelamt.state==null){t+="<i>Unknown State</i>, v"+m.intelamt.ver}else{if((m.intelamt.ver==null)&&(m.intelamt.state==2)){t+="<i>Activated</i>"}else{if((m.intelamt.ver==null)||(m.intelamt.state==null)){t+="<i>Unknown Version & State</i>"}else{t+=r[m.intelamt.state];if(m.intelamt.flags){if(m.intelamt.flags&2){t+=' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'}else{if(m.intelamt.flags&4){t+=' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'}}}t+=(", v"+m.intelamt.ver)}}}if(m.intelamt.tls==1){t+=', <span title="Intel AMT is setup with TLS network security">TLS</span>'}if(m.intelamt.state==2){if(m.intelamt.user==null||m.intelamt.user==""){if((k&4)!=0){t+=', <i style=color:#FF0000;cursor:pointer title="Edit Intel® AMT credentials" onclick=editDeviceAmtSettings("'+m._id+'")>No Credentials</i>'}else{t+=", <i style=color:#FF0000>No Credentials</i>"}}t+=" ";if((k&4)!=0){t+='<img src=images/link4.png height=10 width=10 title="Edit Intel® AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("'+m._id+'")>'}}v+=addDeviceAttribute("Intel® AMT",t)}if((m.agent!=null)&&(m.agent.tag!=null)&&(m.agent.tag!="mailto:")){var u=EscapeHtml(m.agent.tag);if(u.startsWith("mailto:")){u='<a href="'+u+'">'+u.substring(7)+"</a>"}v+=addDeviceAttribute("Agent Tag",u)}if(m.osdesc){v+=addDeviceAttribute("Operating System",m.osdesc)}if(m.users&&m.conn&&(m.users.length>0)&&(m.conn&1)){v+=addDeviceAttribute("Active User"+((m.users.length>1)?"s":""),m.users.join(", "))}var c=m.conn;if(c&&c>1){var e=[];if((m.conn&1)!=0){e.push('<span title="Mesh agent is connected and ready for use.">Mesh Agent</span>')}if((m.conn&2)!=0){e.push('<span title="Intel® AMT CIRA is connected and ready for use.">Intel® AMT CIRA</span>')}if((m.conn&4)!=0){e.push('<span title="Intel® AMT is routable and ready for use.">Intel® AMT</span>')}if((m.conn&8)!=0){e.push('<span title="Mesh agent is reachable using another agent as relay.">Mesh Relay</span>')}v+=addDeviceAttribute("Connectivity",e.join(", "))}var g="<i>None</i>";if(m.tags!=null){g="";for(var h in m.tags){g+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+m.tags[h]+"</span>"}}v+=addDeviceAttribute("Tags","<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+g+' <img class=hoverButton src="images/link5.png" /></span>');v+="</table><br />";if((k&76)!=0){v+='<input type=button value=Actions title="Perform power actions on the device" onclick=deviceActionFunction() />'}v+='<input type=button value=Notes title="View notes about this device" onclick=showNotes('+((k&128)==0)+',"'+encodeURIComponent(m._id)+'") />';QH("p10html",v);drawDeviceTimeline();v="<div style=float:right;font-size:x-small>";if((k&4)!=0){v+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+m._id+'") title="Remove this device">Delete Device</a>'}v+="</div><div style=font-size:x-small>";if(j.mtype==2){v+='<a style=cursor:pointer onclick=p10showNodeNetInfoDialog("'+m._id+'") title="Show device network interface information">Interfaces</a> '}if(xxmap!=null){v+='<a style=cursor:pointer onclick=p10showNodeLocationDialog("'+m._id+'") title="Show device locations information">Location</a> '}if(((k&8)!=0)&&(j.mtype==2)){v+='<a style=cursor:pointer onclick=p10showMeshCmdDialog(1,"'+m._id+'") title="Traffic router used to connect to a device thru this server.">Router</a> '}if(((c&1)!=0)&&(clickOnce==true)&&(j.mtype==2)&&((k&8)!=0)){if((m.agent.id>0)&&(m.agent.id<5)){v+='<a style=cursor:pointer onclick=p10clickOnce("'+m._id+'","RDP2",3389) title="Requires Microsoft ClickOnce support in your browser.">RDP</a> '}if(m.agent.id>4){v+='<a style=cursor:pointer onclick=p10clickOnce("'+m._id+'","PSSH",22) title="Requires Microsoft ClickOnce support in your browser.">Putty</a> ';v+='<a style=cursor:pointer onclick=p10clickOnce("'+m._id+'","WSCP",22) title="Requires Microsoft ClickOnce support in your browser.">WinSCP</a> '}}v+="</div><br>";QH("p10html3",v);var q=PowerStateStr(m.state);if((c&1)!=0){if(q.length>0){q+="<br/>"}q+='<span style=font-size:12px title="Agent connected">Agent connected</span>'}if((c&2)!=0){if(q.length>0){q+="<br/>"}q+='<span style=font-size:12px title="Intel® AMT connected">Intel® AMT connected</span>'}if((c&4)!=0){if(q.length>0){q+="<br/>"}q+='<span style=font-size:12px title="Intel® AMT detected">Intel® AMT detected</span>'}if((q=="")&&m.lastconnect){q="<span style=font-size:12px>Last seen:<br />"+new Date(m.lastconnect).toLocaleDateString()+", "+new Date(m.lastconnect).toLocaleTimeString()+"</span>"}QH("MainComputerState",q);Q("MainComputerImage").setAttribute("src","images/icons200-"+m.icon+"-1.jpg");Q("MainComputerImage").className=((!m.conn)||(m.conn==0)?"gray":"");setupTerminal();setupFiles();var d=((k&16)!=0);if(d){setupConsole()}else{if(p==15){p=10}}QV("MainDevDesktop",((j.mtype==1)||(m.agent==null)||(m.agent.caps==null)||((m.agent.caps&1)!=0)||(m.intelamt&&(m.intelamt.state==2)))&&((k&8)||(k&256)));QV("MainDevTerminal",((j.mtype==1)||(m.agent==null)||(m.agent.caps==null)||((m.agent.caps&2)!=0)||(m.intelamt&&(m.intelamt.state==2)))&&(k&8));QV("MainDevFiles",((j.mtype==2)&&((m.agent==null)||(m.agent.caps==null)||((m.agent.caps&4)!=0)))&&(k&8));QV("MainDevAmt",(m.intelamt!=null)&&((m.intelamt.state==2)||(m.conn&2))&&(k&8));QV("MainDevConsole",(d&&(j.mtype==2)&&((m.agent==null)||(m.agent.caps==null)||((m.agent.caps&8)!=0)))&&(k&8));QV("p15uploadCore",(m.agent!=null)&&(m.agent.caps!=null)&&((m.agent.caps&16)!=0)&&(userinfo.siteadmin==4294967295));QH("p15coreName",((m.agent!=null)&&(m.agent.core!=null))?m.agent.core:"");var b=Q("p14iframe").contentWindow.getCurrentMeshNode();if((b!=null)&&(b._id!=currentNode._id)){Q("p14iframe").contentWindow.disconnect()}var o=((m.conn&6)!=0)?true:false;Q("p14iframe").contentWindow.setConnectionState(o);Q("p14iframe").contentWindow.setFrameHeight("650px");Q("p14iframe").contentWindow.setAuthCallback(updateAmtCredentials);QV("deskActionsBtn",(k&72)!=0);QV("termActionsBtn",(k&72)!=0);QV("filesActionsBtn",(k&72)!=0);if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id});meshserver.send({action:"lastconnect",nodeid:currentNode._id})}QV("DeskTools",false);showDeskToolsProcesses();refreshDeviceEvents()}setupDesktop();if(!p){p=10}go(p)}function showNotes(b,a){if(xxdialogMode){return}setDialogMode(2,"Notes",2,showNotesEx,"<textarea id=d2devNotes ro="+b+" noteid="+a+" readonly style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea><span style=font-size:10px>Notes can be viewed and changed by other administrators.<span>",a);meshserver.send({action:"getNotes",id:decodeURIComponent(a)})}function showNotesEx(a,b){meshserver.send({action:"setNotes",id:decodeURIComponent(b),notes:encodeURIComponent(Q("d2devNotes").value)})}function deviceChat(){if(xxdialogMode){return}window.open("/messenger?id=meshmessenger/"+encodeURIComponent(currentNode._id)+"/"+encodeURIComponent(userinfo._id)+"&title="+currentNode.name,"meshmessenger:"+currentNode._id);meshserver.send({action:"meshmessenger",nodeid:decodeURIComponent(currentNode._id)})}function deviceUrlFunction(){if(xxdialogMode){return}setDialogMode(2,"Open Page on Device",3,deviceUrlFunctionEx,'<input id=d2devurl placeholder="http://server.com" style=width:100%;overflow-y:scroll></input>')}function deviceUrlFunctionEx(){meshserver.send({action:"msg",type:"openUrl",nodeid:currentNode._id,url:Q("d2devurl").value})}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Notification",3,deviceToastFunctionEx,"<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var b="Select an operation to perform on this device.<br /><br />";var c="<select id=d2deviceop style=float:right;width:250px>";if((a&64)!=0){c+="<option value=100>Wake-up</option>"}if((a&8)!=0){c+="<option value=4>Sleep</option><option value=3>Reset</option><option value=2>Power off</option>"}c+="</select>";b+=addHtmlValue("Operation",c);setDialogMode(2,"Device Action",3,deviceActionFunctionEx,b)}function deviceActionFunctionEx(){var a=Q("d2deviceop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:[currentNode._id]})}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:a})}}function updateAmtCredentials(a){var b=getNodeFromId(currentNode._id);if((a==true)||(b.intelamt.user==null)||(b.intelamt.user=="")){editDeviceAmtSettings(currentNode._id,updateAmtCredentialsEx)}else{Q("p14iframe").contentWindow.connectButtonfunctionEx()}}function updateAmtCredentialsEx(a,b){Q("p14iframe").contentWindow.connectButtonfunctionEx()}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate<Date.now())){powerTimelineUpdate=null;meshserver.send({action:"powertimeline",nodeid:currentNode._id});meshserver.send({action:"lastconnect",nodeid:currentNode._id})}}function drawDeviceTimeline(){if((currentNode==null)||(xxcurrentView<10)||(xxcurrentView>19)){return}var r=null,n=Date.now();if(currentNode._id==powerTimelineNode){r=powerTimeline}var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var t=e.getTime();var s=[];if(r!=null&&r.length>1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l<r.length;l+=2){var o=r[l],h=n;if(r.length>(l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var z="",b=1,g=new Date();var v=Q("masthead").offsetWidth-(160+9+9+14);g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var w=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var y=Math.round(((q-w)*v)/86400000);if(y>0){var u=powerStateStrings2[a[2]]+" from "+new Date(w).toLocaleTimeString()+" to "+new Date(q).toLocaleTimeString()+".";f+='<div title="'+u+'" style=display:table-cell;width:'+y+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}z+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div> "+g.toLocaleDateString()+"<div></div></div></td><td><div>"+f+"</div></td></tr>";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p10html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>Day</th><th scope=col style=text-align:center>7 Day Power State</th></tr>'+z+"</tbody></table>")}function powerColor(a){if(a<powerColorTable.length){return powerColorTable[a]}return"yellow"}function isTimeBlockInside(d,c,b,a){if((b<d)&&(a>c)){return true}if((b>d)&&(b<c)){return true}if((a>d)&&(a<c)){return true}return false}function addDeviceAttribute(a,b){return"<tr><td class=style7 style=width:180px>"+a+"</td><td class=style9 style=max-width:400px;overflow:hidden>"+b+"</td></tr>"}function editDeviceAmtSettings(e,b){if(xxdialogMode){return}var f="",d=getNodeFromId(e),a=3,c=getNodeRights(e);if((c&4)==0){return}f+=addHtmlValue("Username",'<input id=dp10username style=width:230px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');f+=addHtmlValue("Password","<input id=dp10password type=password style=width:230px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />");f+=addHtmlValue("Security","<select id=dp10tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");if((d.intelamt.user!=null)&&(d.intelamt.user!="")){a=7}setDialogMode(2,"Edit Intel® AMT credentials",a,editDeviceAmtSettingsEx,f,{node:d,func:b});if((d.intelamt.user!=null)&&(d.intelamt.user!="")){Q("dp10username").value=d.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=d.intelamt.tls;validateDeviceAmtSettings()}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(c,d){if(c==2){meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:"",pass:""}})}else{var b=Q("dp10username").value;if(b==""){b="admin"}var a=Q("dp10password").value;if(a==""){b=""}meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:b,pass:a,tls:Q("dp10tls").value}});d.node.intelamt.user=b;d.node.intelamt.tls=Q("dp10tls").value;if(d.func){setTimeout(d.func,300)}}}function p10showDeleteNodeDialog(a){if(xxdialogMode){return}var b='Are you sure you want to delete node "'+EscapeHtml(currentNode.name)+'"?<br /><br />';b+="<input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm";setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,b,a);p10validateDeleteNodeDialog()}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(a,b){meshserver.send({action:"removedevices",nodeids:[b]})}function p10clickOnce(a,c,b){meshserver.send({action:"getcookie",nodeid:a,tcpport:b,tag:"clickonce",protocol:c})}var d2map=null;function p10showNodeLocationDialog(){if((xxdialogMode!=null)&&(xxdialogTag=="@xxmap")){setDialogMode(0)}else{if(xxdialogMode){return}}var l=[],m=["iploc","wifiloc","gpsloc","userloc"],a=null;for(var j in m){if(currentNode[m[j]]!=null){var h=currentNode[m[j]].split(","),g=parseFloat(h[0]),k=parseFloat(h[1]);if((g<90)&&(g>-90)&&(k<180)&&(k>-180)){var e=new ol.Feature({geometry:new ol.geom.Point(ol.proj.fromLonLat([k,g]))});e.setStyle(markerStyle(currentNode,parseInt(j)+1));l.push(e);if(a==null){a=[g,k,g,k,0]}else{if(g<a[0]){a[0]=g}if(k<a[1]){a[1]=k}if(g>a[2]){a[2]=g}if(k>a[3]){a[3]=k}}}}}var o=new ol.source.Vector({features:l});var n=new ol.layer.Vector({source:o});var p="<div id=d2map style=width:100%;height:300px></div>";setDialogMode(2,"Device Location",1,null,p,"@xxmap");var c=0,b=0,q=8;if(a!=null){var b=(a[0]+a[2])/2;var c=(a[1]+a[3])/2;var d=Math.max(Math.abs(a[0]-a[2]),Math.abs(a[1]-a[3]));var f=360,q=-2;while(f>d){q++;f=f/2}}if(l.length==1){q=8}d2map=new ol.Map({target:"d2map",interactions:ol.interaction.defaults({dragPan:false,mouseWheelZoom:false}),layers:[new ol.layer.Tile({source:new ol.source.OSM()}),n],view:new ol.View({center:ol.proj.fromLonLat([c,b]),zoom:q})})}function p10showNodeNetInfoDialog(){if(xxdialogMode){return}setDialogMode(2,"Network Interfaces",1,null,"<div id=d2netinfo>Loading...</div>","if"+currentNode._id);meshserver.send({action:"getnetworkinfo",nodeid:currentNode._id})}function p10showMeshCmdDialog(a,b){if(xxdialogMode){return}var d="<select id=aginsSelect onclick=meshCmdOsClick() style=width:236px>";d+="<option value=3>Windows (32bit)</option>";d+="<option value=4>Windows (64bit)</option>";d+="<option value=5>Linux x86 (32bit)</option>";d+="<option value=6>Linux x86 (64bit)</option>";d+="<option value=25>Linux ARM, Raspberry Pi (32bit)</option>";d+="</select>";var c="";if(a==0){c+="<div>MeshCmd is a command line tool that performs lots of different operations. The action file can optionally be downloaded and edited to provide server information and credentials.<br /><br />"}if(a==1){c+='<div>Download "meshcmd" with an action file to route traffic thru this server to this device. Make sure to edit meshaction.txt and add your account password or make any changes needed.<br /><br />'}c+=addHtmlValue("Operating System",d);c+=addHtmlValue("MeshCmd",'<a id=meshcmddownloadid href="meshagents?meshcmd=3" rel="noreferrer noopener" target="_blank"></a>');if(a==0){c+=addHtmlValue("Action File",'<a href="meshagents?meshaction=generic" rel="noreferrer noopener" target="_blank">MeshAction (.txt)</a>')}if(a==1){c+=addHtmlValue("Action File",'<a href="meshagents?meshaction=route&nodeid='+b+'" rel="noreferrer noopener" target="_blank">MeshAction (.txt)</a>')}c+="</div>";setDialogMode(2,["Download MeshCmd","Network Router"][a],9,null,c);meshCmdOsClick()}function meshCmdOsClick(){var a=Q("aginsSelect").value,b="";Q("meshcmddownloadid").href="meshagents?meshcmd="+a;if(a==3){b="MeshCmd (Win32 executable)"}if(a==4){b="MeshCmd (Win64 executable)"}if(a==5){b="MeshCmd (Linux x86, 32bit)"}if(a==6){b="MeshCmd (Linux x86, 64bit)"}if(a==25){b="MeshCmd (Linux ARM, 32bit)"}QH("meshcmddownloadid",b)}function p10showiconselector(){if(xxdialogMode){return}var a=meshes[currentNode.meshid];var b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&4)==0){return}var c="<br><div style=display:inline-block;width:40px></div>";c+="<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>";c+="<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>";c+="<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div>";c+="<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>";c+="<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>";c+="<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div><br><br>";setDialogMode(2,"Icon Selection",0,null,c);QV("id_dialogclose",true)}function p10setIcon(a){setDialogMode(0);meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:a})}var showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Tags"];var showEditNodeValueDialog_modes2=["name","host","desc","tags"];var showEditNodeValueDialog_modes3=["","","","Tag1, Tag2, Tag3"];function showEditNodeValueDialog(a){if(xxdialogMode){return}var c=addHtmlValue(showEditNodeValueDialog_modes[a],'<input id=dp10devicevalue style=width:230px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[a]+'" onchange=p10editdevicevalueValidate('+a+",event) onkeyup=p10editdevicevalueValidate("+a+",event) />");setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,c,a);var b=currentNode[showEditNodeValueDialog_modes2[a]];if(b==null){b=""}if(Array.isArray(b)){b=b.join(", ")}Q("dp10devicevalue").value=b;p10editdevicevalueValidate();Q("dp10devicevalue").focus()}function showEditNodeValueDialogEx(a,b){var c={action:"changedevice",nodeid:currentNode._id};c[showEditNodeValueDialog_modes2[b]]=Q("dp10devicevalue").value;meshserver.send(c)}function p10editdevicevalueValidate(b,a){var c=((b>1)||(Q("dp10devicevalue").value.length>0));QE("idx_dlgOkButton",c);if((a!=null)&&(c==true)&&(a.keyCode==13)){dialogclose(1)}}var desktopNode;function setupDesktop(){if((desktopNode!=currentNode)&&(desktop!=null)){desktop.Stop();desktopNode=null;desktop=null}if((desktopNode!=currentNode)||(desktop==null)){var b=multiDesktop[currentNode._id];if(b!=null){QH("DeskParent","");var a=b.m.CanvasId;a.setAttribute("id","Desk");a.setAttribute("style","width:100%;-ms-touch-action:none;margin-left:0px");a.setAttribute("onmousedown","dmousedown(event)");a.setAttribute("onmouseup","dmouseup(event)");a.setAttribute("onmousemove","dmousemove(event)");a.removeAttribute("onclick");Q("DeskParent").appendChild(a);desktop=b;if(desktop.m.SendCompressionLevel){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}desktop.onStateChanged=onDesktopStateChange;desktopNode=currentNode;onDesktopStateChange(desktop,desktop.State);delete multiDesktop[currentNode._id]}else{QH("DeskParent",'<canvas id=Desk width=640 height=480 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');desktopNode=currentNode}Q("Desk").addEventListener("DOMMouseScroll",function(c){return dmousewheel(c)});Q("Desk").addEventListener("mousewheel",function(c){return dmousewheel(c)})}desktopNode=currentNode;updateDesktopButtons();deskAdjust();if(!Q("Desk")["toBlob"]){QV("deskSaveBtn",false)}}function updateDesktopButtons(){var c=meshes[currentNode.meshid];var a=0;if(desktop!=null){a=desktop.State}var d=c.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;QV("disconnectbutton1span",(a!=0));QV("connectbutton1span",(a==0)&&((d&8)||(d&256))&&(c.mtype==2)&&(currentNode.agent.caps&1));QV("connectbutton1hspan",(a==0)&&(d&8)&&((currentNode.intelamt!=null)&&(c.mtype==1||currentNode.intelamt.state==2)&&((currentNode.intelamt.ver!=null)||(c.mtype==1))));QV("d7amtkvm",(currentNode.intelamt!=null&&((currentNode.intelamt.ver!=null)||(c.mtype==1)))&&((a==0)||(desktop.contype==2)));QV("d7meshkvm",(webRtcDesktop)||((c.mtype==2)&&(currentNode.agent.caps&1)&&((a==false)||(desktop.contype==1))));var e=((currentNode.conn&1)!=0);QE("connectbutton1",e);var b=((currentNode.conn&6)!=0);QE("connectbutton1h",b);QE("deskSaveBtn",a==3);QV("deskFocusBtn",(desktop!=null)&&(desktop.contype==2)&&(a!=0)&&(desktopsettings.showfocus));QV("DeskCAD",d&8);QE("DeskCAD",a==3);QV("DeskWD",(currentNode.agent)&&(currentNode.agent.id<5)&&(d&8));QE("DeskWD",a==3);QV("deskkeys",(currentNode.agent)&&(currentNode.agent.id<5)&&(d&8));QE("deskkeys",a==3);QV("DeskToolsButton",(d&8)&&(c.mtype==2)&&e);QV("DeskChatButton",(browserfullscreen==false)&&(d&8)&&(c.mtype==2)&&e);QV("DeskNotifyButton",(browserfullscreen==false)&&(currentNode.agent)&&(currentNode.agent.id<5)&&(d&8)&&(c.mtype==2)&&e);QV("DeskOpenWebButton",(browserfullscreen==false)&&(d&8)&&(c.mtype==2)&&e);QV("DeskControlSpan",d&8);QV("deskActionsBtn",(browserfullscreen==false));QV("deskActionsSettings",(browserfullscreen==false));if(d&8){Q("DeskControl").checked=(getstore("DeskControl",1)==1)}else{Q("DeskControl").checked=false}if(e==false){QV("DeskTools",false)}}var autoConnectDesktopTimer=null;function autoConnectDesktop(a){if(autoConnectDesktopTimer==null){autoConnectDesktopTimer=setInterval(connectDesktop,100)}else{clearInterval(autoConnectDesktopTimer);autoConnectDesktopTimer=null}}function connectDesktop(b,a){if(desktop==null){desktopNode=currentNode;if(a==2){if((desktopNode.intelamt.user==null)||(desktopNode.intelamt.user=="")){editDeviceAmtSettings(desktopNode._id,connectDesktop);return}desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"));desktop.debugmode=debugmode;desktop.onStateChanged=onDesktopStateChange;desktop.m.bpp=(desktopsettings.encoding==1||desktopsettings.encoding==3)?1:2;desktop.m.useZRLE=(desktopsettings.encoding<3);desktop.m.showmouse=desktopsettings.showmouse;desktop.m.onScreenSizeChange=deskAdjust;desktop.m.onKvmData=function(g){if(g.length==0){if(!desktop.m._sentPresence){desktop.m._sentPresence=true;desktop.m.sendKvmData(JSON.stringify({action:"present",ver:1}))}return}var d=null;try{d=JSON.parse(g)}catch(f){}if((d!=null)&&(d.action!=null)){if(d.action=="restart"){webRtcDesktopReset();desktop.m.sendKvmData(JSON.stringify({action:"present",ver:1}))}else{if((d.action=="present")&&(webRtcDesktop==null)){webRtcDesktop={platform:d.platform};var c=null;if(typeof RTCPeerConnection!=="undefined"){webRtcDesktop.webrtc=new RTCPeerConnection(c)}else{if(typeof webkitRTCPeerConnection!=="undefined"){webRtcDesktop.webrtc=new webkitRTCPeerConnection(c)}}webRtcDesktop.webchannel=webRtcDesktop.webrtc.createDataChannel("DataChannel",{});webRtcDesktop.webchannel.onopen=function(){console.log("WebRTC Data Channel Open");Q("deskstatus").textContent=StatusStrs[desktop.State]+", Soft-KVM";desktop.m.hold(true);webRtcDesktop.webRtcActive=true;webRtcDesktop.softdesktop=CreateKvmDataChannel(webRtcDesktop.webchannel,CreateAgentRemoteDesktop("Desk",Q("id_mainarea")),desktop.m);webRtcDesktop.softdesktop.m.setRotation(desktop.m.rotation);webRtcDesktop.softdesktop.m.onScreenSizeChange=deskAdjust;if(desktopsettings.quality){webRtcDesktop.softdesktop.m.CompressionLevel=desktopsettings.quality}if(desktopsettings.scaling){webRtcDesktop.softdesktop.m.ScalingLevel=desktopsettings.scaling}webRtcDesktop.softdesktop.Start()};webRtcDesktop.webchannel.onclose=function(e){console.log("WebRTC Data Channel Closed");webRtcDesktopReset()};webRtcDesktop.webrtc.onicecandidate=function(h){if(h.candidate==null){desktop.m.sendKvmData(JSON.stringify({action:"offer",ver:1,sdp:webRtcDesktop.webrtcoffer.sdp}))}else{webRtcDesktop.webrtcoffer.sdp+=("a="+h.candidate.candidate+"\r\n")}};webRtcDesktop.webrtc.oniceconnectionstatechange=function(){if((webRtcDesktop!=null)&&(webRtcDesktop.webrtc!=null)&&((webRtcDesktop.webrtc.iceConnectionState=="disconnected")||(webRtcDesktop.webrtc.iceConnectionState=="failed"))){webRtcDesktopReset()}};webRtcDesktop.webrtc.createOffer(function(e){webRtcDesktop.webrtcoffer=e;webRtcDesktop.webrtc.setLocalDescription(e,function(){},webRtcDesktopReset)},webRtcDesktopReset,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}else{if((d.action=="answer")&&(webRtcDesktop!=null)){webRtcDesktop.webrtc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:d.sdp}),function(){},webRtcDesktopReset)}}}}};desktop.Start(desktopNode._id,16994,"*","*",0);desktop.contype=2}else{desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort);desktop.debugmode=debugmode;desktop.m.debugmode=debugmode;desktop.attemptWebRTC=attemptWebRTC;desktop.onStateChanged=onDesktopStateChange;desktop.m.CompressionLevel=desktopsettings.quality;desktop.m.ScalingLevel=desktopsettings.scaling;desktop.m.FrameRateTimer=desktopsettings.framerate;desktop.m.onDisplayinfo=deskDisplayInfo;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id);desktop.contype=1}}else{desktop.Stop();webRtcDesktopReset();desktopNode=desktop=null}}var webRtcDesktop=null;function webRtcDesktopReset(){if(webRtcDesktop==null){return}if(webRtcDesktop.softdesktop!=null){webRtcDesktop.softdesktop.Stop();webRtcDesktop.softdesktop=null}if(webRtcDesktop.webchannel!=null){try{webRtcDesktop.webchannel.close()}catch(a){}webRtcDesktop.webchannel=null}if(webRtcDesktop.webrtc!=null){try{webRtcDesktop.webrtc.close()}catch(a){}webRtcDesktop.webrtc=null}webRtcDesktop=null;if(desktop&&desktop.m){desktop.m.hold(false);Q("deskstatus").textContent=StatusStrs[desktop.State]}}function onDesktopStateChange(c,a){var d=a;if((d==3)&&(c.contype==2)){d++}var b=StatusStrs[d];if((desktop!=null)&&(desktop.webRtcActive==true)){b+=", WebRTC"}QH("deskstatus",b);switch(a){case 0:desktop.Stop();desktopNode=desktop=null;QV("DeskFocus",false);QV("termdisplays",false);deskFocusBtn.value="All Focus";if(fullscreen==true){deskToggleFull()}webRtcDesktopReset();break;case 2:break;default:break}updateDesktopButtons();deskAdjust();setTimeout(deskAdjust,50)}function showDesktopSettings(){if(xxdialogMode){return}applyDesktopSettings();updateDesktopButtons();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value;desktopsettings.showfocus=d7showfocus.checked;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;desktopsettings.framerate=d7framelimiter.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();if(desktop){if(desktop.contype==1){if(desktop.State!=0){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}}if(desktop.contype==2){if(desktopsettings.showfocus==false){desktop.m.focusmode=0;deskFocusBtn.value="All Focus"}if(desktop.State!=0){desktop.Stop();setTimeout(function(){connectDesktop(null,2)},50)}}}}function applyDesktopSettings(){var c="",b=(features&512)?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];for(var a in b){c+="<option value="+b[a]+">"+b[a]+"%</option>"}QH("d7bitmapquality",c);d7desktopmode.value=desktopsettings.encoding;d7showfocus.checked=desktopsettings.showfocus;d7showcursor.checked=desktopsettings.showmouse;d7bitmapquality.value=40;if(b.indexOf(parseInt(desktopsettings.quality))>=0){d7bitmapquality.value=desktopsettings.quality}d7bitmapscaling.value=desktopsettings.scaling;if(desktopsettings.framerate){d7framelimiter.value=desktopsettings.framerate}QV("deskFocusBtn",(desktop!=null)&&(desktop.contype==2)&&(desktop.state!=0)&&(desktopsettings.showfocus))}function enterBrowserFullscreen(a){if(a.requestFullscreen){a.requestFullscreen()}else{if(a.msRequestFullscreen){a.msRequestFullscreen()}else{if(a.mozRequestFullScreen){a.mozRequestFullScreen()}else{if(a.webkitRequestFullscreen){a.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}}}}function exitBrowserFullscreen(){if(document.exitFullscreen){document.exitFullscreen()}else{if(document.msExitFullscreen){document.msExitFullscreen()}else{if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else{if(document.webkitExitFullscreen){document.webkitExitFullscreen()}}}}}function isBrowserFullscreen(){if(!document.fullscreenElement&&!document.mozFullScreenElement&&!document.webkitFullscreenElement&&!document.msFullscreenElement){return false}else{return true}}var fullscreen=false;var browserfullscreen=false;function deskToggleFull(a){fullscreen=!fullscreen;QV("mastheadx",!fullscreen);QV("masthead",!fullscreen);QV("topbar",!fullscreen);QV("p11deviceNameHeader",!fullscreen);QV("footer",!fullscreen);QV("column_l_bottomgap",!fullscreen);QV("idx_deskFullBtn2",fullscreen);QV("deskFullBtn",!fullscreen);QV("page_leftbar",!fullscreen);if(fullscreen){if(a.shiftKey==true){enterBrowserFullscreen(Q("deskarea0"));browserfullscreen=true}QS("column_l").width="930px";QS("column_l").height="";QS("column_l")["margin-left"]="";QS("column_l")["overflow-y"]="";QS("container").position="";QS("page_content").position="";QV("MainMenuSpan",true);QS("container").width="100%";QS("container")["border-right"]="0";QS("container")["border-left"]="0";QS("column_l").padding="0";QS("column_l").width="100%";QS("column_l")["max-height"]=""}else{exitBrowserFullscreen();browserfullscreen=false;QS("container").width="960px";QS("container")["border-right"]="1px solid #b7b7b7";QS("container")["border-left"]="1px solid #b7b7b7";QS("column_l").padding="0 15px";QS("column_l").width="930px";toggleFullScreen()}deskAdjust();deskAdjust();updateDesktopButtons()}function deskToggleFocus(){desktop.m.focusmode=(desktop.m.focusmode+64)%192;Q("deskFocusBtn").value=["All Focus","Small Focus","Large Focus"][desktop.m.focusmode/64]}function deskAdjust(){var c=(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(Q("deskarea1").clientHeight+Q("deskarea2").clientHeight+Q("Desk").clientHeight+Q("deskarea4").clientHeight+2))/2;if(fullscreen){document.documentElement.style.overflow="hidden";QS("deskarea3x").height=null;if(c<0){var a=(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(Q("deskarea1").clientHeight+Q("deskarea2").clientHeight+Q("deskarea4").clientHeight));var b=9999;if(desktop){b=(desktop.m.width/desktop.m.height)*a}if(webRtcDesktop&&webRtcDesktop.softdesktop){b=(webRtcDesktop.softdesktop.m.width/webRtcDesktop.softdesktop.m.height)*a}QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";c=0}else{QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null}QS("Desk")["margin-top"]=c+"px";QS("Desk")["margin-bottom"]=c+"px"}else{var b=9999,a=(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(webPageFullScreen?276:290));if(desktop){b=(desktop.m.width/desktop.m.height)*a}if(webRtcDesktop&&webRtcDesktop.softdesktop){b=(webRtcDesktop.softdesktop.m.width/webRtcDesktop.softdesktop.m.height)*a}document.documentElement.style.overflow="auto";QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";QS("Desk")["margin-top"]="0";QS("Desk")["margin-bottom"]="0"}}function mdeskAdjust(c,g,f,a){if(!c||!g||!f||!a){return}if(a.id=="Desk"){deskAdjust();return}var j=[{x:180,y:101},{x:302,y:169},{x:454,y:255}][Q("sizeselect").selectedIndex];var e=j.x+2,h=Q("xdevices").clientWidth-30,k=Math.floor(h/e);k=e+Math.floor((h-(k*e))/k);j.y=j.y*(k/j.x);j.x=k;var b=j.y,d=j.x;if(c.State!=0){b=j.y;d=(g/f)*j.y}QS(a.id)["max-height"]=b+"px";QS(a.id)["max-width"]=d+"px";QS(a.id)["margin-top"]="0";QS(a.id)["margin-bottom"]="0"}function deskSendKeys(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=Q("deskkeys").value;if(a==0){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65364,1],[65364,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==1){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65362,1],[65362,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==2){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[108,1],[108,0],[65511,0]])}else{desktop.sendCtrlMsg('{"action":"lock"}')}}else{if(a==3){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[109,1],[109,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==4){if(desktop.contype==2){desktop.m.sendkey([[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91],[desktop.m.KeyAction.UP,16]])}}else{if(a==5){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==6){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[114,1],[114,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,82],[desktop.m.KeyAction.UP,82],[desktop.m.KeyAction.EXUP,91]])}}}}}}}}}function sendCAD(){if(xxdialogMode||desktop==null||desktop.State!=3){return}desktop.m.sendcad()}function toggleDeskTools(){if(xxdialogMode){return}if(QS("DeskTools").display=="none"){QV("DeskTools",true);Q("DeskTools").nodeid=currentNode._id;refreshDeskTools()}else{QV("DeskTools",false)}}function refreshDeskTools(){QV("DeskToolsRefreshButton",false);setTimeout(refreshDeskToolsEx,500);meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",true)}var deskTools={sort:1,msg:null};function sortProcess(a){deskTools.sort=a;showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(c,d){if(c.p>d.p){return 1}if(c.p<d.p){return(-1)}return 0}function sortProcessName(c,d){if(c.d>d.d){return 1}if(c.d<d.d){return(-1)}return 0}function showDeskToolsProcesses(c){deskTools.msg=c;if(c==null){QH("DeskToolsProcesses","");return}if(Q("DeskTools").nodeid!=c.nodeid){return}var d=[],g=null;try{g=JSON.parse(c.value)}catch(a){}if(g!=null){for(var f in g){d.push({p:parseInt(f),c:g[f].cmd,d:g[f].cmd.toLowerCase(),u:g[f].user})}if(deskTools.sort==0){d.sort(sortProcessPid)}else{if(deskTools.sort==1){d.sort(sortProcessName)}}var h="";for(var b in d){if(d[b].p!=0){h+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+d[b].p+'</div><a style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=stopProcess('+d[b].p+',"'+d[b].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(d[b].u?d[b].u:"")+"</div><div>"+d[b].c+"</div></div>"}}QH("DeskToolsProcesses",h)}}function toggleKvmControl(){putstore("DeskControl",(Q("DeskControl").checked?1:0))}function deskSaveImage(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=new Date(),b="Desktop-"+currentNode.name+"-"+a.getFullYear()+"-"+("0"+(a.getMonth()+1)).slice(-2)+"-"+("0"+a.getDate()).slice(-2)+"-"+("0"+a.getHours()).slice(-2)+"-"+("0"+a.getMinutes()).slice(-2);Q("Desk")["toBlob"](function(c){saveAs(c,b+".jpg")})}function deskDisplayInfo(e,a,c,d){var f=Q("termdisplays").value;if(a.length>0){var b="";for(var g in a){b+="<option"+((f==a[g])?" selected":"")+">"+a[g]+"</option>"}QH("termdisplays",b)}QV("termdisplays",a.length>0)}function deskGetDisplayNumbers(a){desktop.m.GetDisplayNumbers()}function deskSetDisplay(b){var a=0,c=Q("termdisplays").value;if(c=="All Displays"){a=65535}else{a=parseInt(c.substring(8))}desktop.m.SetDisplay(a)}function dmousedown(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){if((webRtcDesktop!=null)&&(webRtcDesktop.softdesktop!=null)){webRtcDesktop.softdesktop.m.mousedown(a);desktop.m.sendKeepAlive()}else{desktop.m.mousedown(a)}}}function dmouseup(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){if((webRtcDesktop!=null)&&(webRtcDesktop.softdesktop!=null)){webRtcDesktop.softdesktop.m.mouseup(a);desktop.m.sendKeepAlive()}else{desktop.m.mouseup(a)}}}function dmousemove(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){if((webRtcDesktop!=null)&&(webRtcDesktop.softdesktop!=null)){webRtcDesktop.softdesktop.m.mousemove(a);desktop.m.sendKeepAlive()}else{desktop.m.mousemove(a)}}}function dmousewheel(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){if((webRtcDesktop!=null)&&(webRtcDesktop.softdesktop!=null)){webRtcDesktop.softdesktop.m.mousewheel(a);desktop.m.sendKeepAlive()}else{if(desktop.m.mousewheel){desktop.m.mousewheel(a)}}haltEvent(a);return true}return false}function drotate(a){if(!xxdialogMode&&desktop!=null){desktop.m.setRotation(desktop.m.rotation+a);deskAdjust();deskAdjust()}}function stopProcess(a,b){setDialogMode(2,"Process Control",3,stopProcessEx,"Stop process #"+a+' "'+b+'"?',a)}function stopProcessEx(a,b){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:b});setTimeout(refreshDeskTools,300)}var terminalNode;function setupTerminal(){if((terminalNode!=currentNode)&&(terminal!=null)){terminal.Stop();terminal=null}terminalNode=currentNode;updateTerminalButtons()}function updateTerminalButtons(){var b=meshes[terminalNode.meshid];var d=((terminal!=null)&&(terminal.state!=0));QV("disconnectbutton2span",(d==true));QV("connectbutton2span",(d==false)&&(b.mtype==2)&&(currentNode.agent.caps&2));QV("connectbutton2hspan",(d==false)&&((terminalNode.intelamt!=null)&&(b.mtype==1||terminalNode.intelamt.state==2)&&((terminalNode.intelamt.ver!=null)||(b.mtype==1))));var c=((terminalNode.conn&1)!=0);QE("connectbutton2",c);var a=((terminalNode.conn&6)!=0);QE("connectbutton2h",a);QE("ctrlcbutton",d);QE("ctrlxbutton",d);QE("escbutton",d);QE("bsbutton",d);QE("pastebutton",d);QE("specialkeylist",d);QE("specialkeylistinput",d);QV("terminalSettingsButtons",(terminal)&&(terminal.contype==2));if(terminal){Q("id_ttypebutton").value=terminalEmulations[terminal.m.terminalEmulation];Q("id_tfxkeysbutton").value=fxEmulations[terminal.m.fxEmulation];Q("id_tcrbutton").value=(terminal.m.lineFeed=="\r\n")?"CR+LF":"LF"}}function onTerminalStateChange(d,a){var c=a;if((c==3)&&(d.contype==2)){c++}var b=StatusStrs[c];if(terminal.webRtcActive==true){b+=", WebRTC"}QH("termstatus",b);switch(a){case 0:d.m.TermResetScreen();d.m.TermDraw();if(terminal!=null){terminal.Stop();terminal=null}break;case 3:break;default:break}updateTerminalButtons()}var autoConnectTerminalTimer=null;function autoConnectTerminal(a){if(autoConnectTerminalTimer==null){autoConnectTerminalTimer=setInterval(connectTerminal,100)}else{clearInterval(autoConnectTerminalTimer);autoConnectTerminalTimer=null}}function connectTerminal(b,a){if(!terminal){if(a==2){if((terminalNode.intelamt.user==null)||(terminalNode.intelamt.user=="")){editDeviceAmtSettings(terminalNode._id,connectTerminal);return}terminal=CreateAmtRedirect(CreateAmtRemoteTerminal("Term"));terminal.debugmode=debugmode;terminal.m.debugmode=debugmode;terminal.onStateChanged=onTerminalStateChange;terminal.Start(terminalNode._id,16994,"*","*",0);terminal.contype=2;Q("id_ttypebutton").value=terminalEmulations[terminal.m.terminalEmulation]}else{terminal=CreateAgentRedirect(meshserver,CreateAmtRemoteTerminal("Term"),serverPublicNamePort);terminal.debugmode=debugmode;terminal.m.debugmode=debugmode;terminal.m.lineFeed=([1,2,3,4,21,22].indexOf(currentNode.agent.id)>=0)?"\r\n":"\n";terminal.attemptWebRTC=attemptWebRTC;terminal.onStateChanged=onTerminalStateChange;terminal.Start(terminalNode._id);terminal.contype=1;terminal.m.terminalEmulation=0;terminal.m.fxEmulation=0;Q("id_ttypebutton").value=terminalEmulations[0]}}else{terminal.Stop();terminal=null}Q("connectbutton2").blur()}var terminalEmulations=["UTF8 Terminal","Extended ASCII","Intel ASCII"];function termToggleType(){if(!terminal||xxdialogMode){return}terminal.m.terminalEmulation=(terminal.m.terminalEmulation+1)%3;Q("id_ttypebutton").value=terminalEmulations[terminal.m.terminalEmulation];Q("id_ttypebutton").blur()}var fxEmulations=["Intel (F10 = ESC+[OM)","Alternate (F10 = ESC+0)","VT100+ (F10 = ESC+[OY)"];function termToggleFx(){if(!terminal||xxdialogMode){return}terminal.m.fxEmulation=(terminal.m.fxEmulation+1)%3;Q("id_tfxkeysbutton").value=fxEmulations[terminal.m.fxEmulation];Q("id_tfxkeysbutton").blur()}function termToggleCr(){if(!terminal||xxdialogMode){return}if(terminal.m.lineFeed=="\n"){terminal.m.lineFeed="\r\n"}else{terminal.m.lineFeed="\n"}Q("id_tcrbutton").value=(terminal.m.lineFeed=="\r\n")?"CR+LF":"LF"}function termSendKey(b,a){if(!terminal||xxdialogMode){return}terminal.m.TermSendKey(b);Q(a).blur()}function showTermPasteDialog(){if(!terminal||xxdialogMode){return}Q("pastebutton").blur();setDialogMode(2,"Paste",3,showTermPasteDialogEx,'<textarea id=d2pasteText style="width:100%;height:184px;resize:none"></textarea>');Q("d2pasteText").focus()}function showTermPasteDialogEx(){if(!terminal){return}terminal.m.TermSendKeys(Q("d2pasteText").value)}function sendSpecialKey(){terminal.m.TermSendKey(Q("specialkeylist").value);Q("specialkeylist").blur();Q("specialkeylistinput").blur()}var filesNode;function setupFiles(){var b=(filesNode==currentNode);filesNode=currentNode;var a=((filesNode.conn&1)!=0)?true:false;QE("p13Connect",a);if(((b==false)||(a==false))&&files){files.Stop();files=null}}function onFilesStateChange(c,a){p13Connect.value=(a==0)?"Connect":"Disconnect";var b=StatusStrs[a];if(files.webRtcActive==true){b+=", WebRTC"}Q("p13Status").textContent=b;switch(a){case 0:QH("p13files","");p13filetree=null;p13filetreelocation=[];QH("p13currentpath","");QE("p13FolderUp",false);p13setActions();if(files!=null){files.Stop();files=null}break;case 3:p13targetpath="";files.sendText({action:"ls",reqid:1,path:""});break;default:console.log("Unknown onFilesStateChange state",a);break}}function CreateRemoteFiles(b){var a={protocol:5};a.onFileUpdate=b;a.xxStateChange=function(c){};a.ProcessData=function(c){a.onFileUpdate(c)};return a}var autoConnectFilesTimer=null;function autoConnectFiles(a){if(autoConnectFilesTimer==null){autoConnectFilesTimer=setInterval(connectFiles,100)}else{clearInterval(autoConnectFilesTimer);autoConnectFilesTimer=null}}function connectFiles(a){if(!files){files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort);files.attemptWebRTC=attemptWebRTC;files.onStateChanged=onFilesStateChange;files.Start(filesNode._id)}else{files.Stop();files=null}p13clipboard=p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}var p13filetree=null;var p13targetpath=null;var p13filetreelocation=[];function p13gotFiles(b){if((b.length>0)&&(b.charCodeAt(0)!=123)){p13gotDownloadBinaryData(b);return}b=JSON.parse(decode_utf8(b));if(b.action=="download"){p13gotDownloadCommand(b);return}b.path=b.path.replace(/\//g,"\\");if((p13filetree!=null)&&(b.path==p13filetree.path)){var a=p13getCheckedNames();p13filetree=b;p13updateFiles(a)}else{var c=b.path.replace(/\//g,"\\"),d=p13targetpath.replace(/\//g,"\\");while((c.length>0)&&(c[0]=="\\")){c=c.substring(1)}while((d.length>0)&&(d[0]=="\\")){d=d.substring(1)}if((c==d)||((b.path=="\\")&&(p13targetpath==""))){p13filetree=b;p13updateFiles()}}}function p13getCheckedNames(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}return b}function p13updateFiles(b){var n="",o="",c="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",l="Root";var w=p13filetree.path.split("\\");p13filetreelocation=[];for(var p in w){if(w[p]!=""){p13filetreelocation.push(w[p])}}for(var p in p13filetreelocation){c+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(p)+1)+")>"+p13filetreelocation[p]+"</a>"}var s=p13filetreelocation.join("/");var j=p13sort_files(p13filetree.dir);for(var p in j){var d=j[p],r=d.n,u;u=r;if(r.length>70){u='<span title="'+EscapeHtml(r)+'">'+EscapeHtml(r.substring(0,70))+"...</span>"}else{u=EscapeHtml(r)}r=EscapeHtml(r);var g="";if(d.d!=null){var e=new Date(d.d),g=(e.getMonth()+1)+"/"+(e.getDate())+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" "}var k="";if(d.s!=null){k=getFileSizeStr(d.s)}var m="";if(d.t<3){var t="",v="";m="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'> <span style=float:right title=\""+v+'">'+t+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+u+"</a></span></div>"}else{var q=u;if(d.s>0){q='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(s+"/"+r)+"','"+encodeURIComponent(r)+"',"+d.s+')">'+u+"</a>"}m="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'> <span class=fsize>"+g+"</span><span style=float:right>"+k+"</span><span><div class=fileIcon"+d.t+"></div>"+q+"</span></div>"}if(d.t<3){n+=m}else{o+=m}}QH("p13files",n+o);QH("p13currentpath",c);QE("p13FolderUp",p13filetreelocation.length!=0);if(b!=null){var a=document.getElementsByName("fd");for(var p=0;p<a.length;p++){if(b.indexOf(p13filetree.dir[a[p].value].n)>=0){a[p].checked=true}}}p13setActions()}function p13folderset(a){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[a].n).split("\\").join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(a){if(a==null){p13filetreelocation.pop()}else{while(p13filetreelocation.length>a){p13filetreelocation.pop()}}p13targetpath=p13filetreelocation.join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}var p13sortorder;function p13sort_filename(c,d){if(c.ln>d.ln){return(1*p13sortorder)}if(c.ln<d.ln){return(-1*p13sortorder)}return 0}function p13sort_timestamp(c,d){if(c.d>d.d){return(1*p13sortorder)}if(c.d<d.d){return(-1*p13sortorder)}return 0}function p13sort_bysize(c,d){if(c.s==d.s){return p13sort_filename(c,d)}return(((c.s-d.s))*p13sortorder)}function p13sort_files(a){var c=[],d=Q("p13sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].s==null){a[b].s=0}if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}p13sortorder=1;if(d>3){p13sortorder=-1;d-=3}if(d==1){c.sort(p13sort_filename)}else{if(d==2){c.sort(p13sort_bysize)}else{if(d==3){c.sort(p13sort_timestamp)}}}return c}function p13setActions(){if(p13filetree==null){QE("p13DeleteFileButton",false);QE("p13NewFolderButton",false);QE("p13UploadButton",false);QE("p13RenameFileButton",false);QE("p13SelectAllButton",false);Q("p13SelectAllButton").value="Select All";QE("p13RefreshButton",false);QE("p13CutButton",false);QE("p13CopyButton",false);QE("p13PasteButton",false)}else{var a=p13getFileSelCount(),c=p13getFileCount(),b=p13getFileSelCount(false);var d=((currentNode.agent.id>0)&&(currentNode.agent.id<5));QE("p13DeleteFileButton",(a>0)&&((p13filetreelocation.length>0)||(d==false)));QE("p13NewFolderButton",((p13filetreelocation.length>0)||(d==false)));QE("p13UploadButton",((p13filetreelocation.length>0)||(d==false)));QE("p13RenameFileButton",(a==1)&&((p13filetreelocation.length>0)||(d==false)));QE("p13SelectAllButton",c>0);Q("p13SelectAllButton").value=(a>0?"Select None":"Select All");QE("p13RefreshButton",true);QE("p13CutButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13CopyButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13PasteButton",((p13filetreelocation.length>0)||(d==false))&&((p13clipboard!=null)&&(p13clipboard.length>0)))}}function p13getFileSelCount(d){var a=0;var b=document.getElementsByName("fd");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function p13getFileSelDirCount(){var a=0,b=document.getElementsByName("fd");for(var c=0;c<b.length;c++){if((b[c].checked)&&(b[c].attributes.file.value=="999")){a++}}return a}function p13getFileCount(){var a=0;var b=document.getElementsByName("fd");return b.length}function p13selectallfile(){var c=(p13getFileSelCount()==0),a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){a[b].checked=c}p13setActions()}function p13createfolder(){setDialogMode(2,"New Folder",3,p13createfolderEx,"<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />");focusTextBox("p13renameinput");p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value});p13folderup(999)}function p13deletefile(){var a=p13getFileSelCount(),b=(p13getFileSelDirCount()>0)?"<br /><br /><input type=checkbox id=p13recdeleteinput>Recursive delete<br>":"<input type=checkbox id=p13recdeleteinput style='display:none'>";setDialogMode(2,"Delete",3,p13deletefileEx,(a>1)?("Delete "+a+" selected items?"+b):("Delete selected item?"+b))}function p13deletefileEx(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:b,rec:Q("p13recdeleteinput").checked});p13folderup(999)}function p13renamefile(){var c,a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){if(a[b].checked){c=p13filetree.dir[a[b].value].n}}setDialogMode(2,"Rename",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:c});focusTextBox("p13renameinput");p13fileNameCheck()}function p13renamefileEx(a,c){c.newname=Q("p13renameinput").value;files.sendText(c);p13folderup(999)}function p13fileNameCheck(a){var b=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p13uploadinput')\" />");updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}var p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(b){var a=document.getElementsByName("fd");p13clipboard=[];p13clipboardCut=b,p13clipboardFolder=p13targetpath;for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p13clipboard.push(p13filetree.dir[a[c].value].n)}}p13updateClipview()}function p13pasteFile(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Confim "+(p13clipboardCut==0?"copy":"move")+" of "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p13pasteFileEx,a)}function p13pasteFileEx(){files.sendText({action:(p13clipboardCut==0?"copy":"move"),reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard});p13folderup(999);if(p13clipboardCut==1){p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;p13updateClipview()}}function p13updateClipview(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Holding "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" for "+(p13clipboardCut==0?"copy":"move")+", <a onclick=p13clearClip() style=cursor:pointer>Clear</a>."}QH("p13bottomstatus",a);p13setActions()}function p13clearClip(){p13clipboard=null;p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}function p13fileDragDrop(a){haltEvent(a);QV("p13bigfail",false);QV("p13bigok",false);if(a.dataTransfer==null||a.dataTransfer.files.length==0||p13filetree==null){return}p13doUploadFiles(a.dataTransfer.files)}var p13dragtimer=null;function p13fileDragOver(b){haltEvent(b);if(p13dragtimer!=null){clearTimeout(p13dragtimer);p13dragtimer=null}var a=(p13filetree!=null);QV("p13bigok",a);QV("p13bigfail",!a)}function p13fileDragLeave(a){haltEvent(a);if(a.target.id!="p13filetable"){QV("p13bigfail",false);QV("p13bigok",false)}else{p13dragtimer=setTimeout(function(){QV("p13bigfail",false);QV("p13bigok",false);p13dragtimer=null},10)}}var downloadFile;function p13downloadfile(a,b,c){if(xxdialogMode||downloadFile||!files){return}downloadFile={path:decodeURIComponent(a),file:decodeURIComponent(b),size:c,tsize:0,data:"",state:0,id:Math.random()};files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path});setDialogMode(2,"Download File",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+c+" />")}function p13downloadFileCancel(){setDialogMode(0);files.sendText({action:"download",sub:"cancel",id:downloadFile.id});downloadFile=null}function p13gotDownloadCommand(a){if((downloadFile==null)||(a.id!=downloadFile.id)){return}if(a.sub=="start"){downloadFile.state=1;files.sendText({action:"download",sub:"startack",id:downloadFile.id})}else{if(a.sub=="cancel"){downloadFile=null;setDialogMode(0)}}}function p13gotDownloadBinaryData(a){if(!downloadFile||downloadFile.state==0){return}if(a.length>4){downloadFile.tsize+=(a.length-4);downloadFile.data+=a.substring(4);Q("d2progressBar").value=downloadFile.tsize}if((ReadInt(a,0)&1)!=0){saveAs(data2blob(downloadFile.data),downloadFile.file);downloadFile=null;setDialogMode(0)}else{files.sendText({action:"download",sub:"ack",id:downloadFile.id})}}var uploadFile;function p13doUploadFiles(a){if(xxdialogMode){return}uploadFile={};uploadFile.xpath=p13filetreelocation.join("/");uploadFile.xfiles=a;uploadFile.xfilePtr=-1;setDialogMode(2,"Upload File",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />");p13uploadReconnect()}function onFileUploadStateChange(b,a){switch(a){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break;default:console.log("Unknown onFileUploadStateChange state",a);break}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort);uploadFile.ws.attemptWebRTC=false;uploadFile.ws.ctrlMsgAllowed=false;uploadFile.ws.onStateChanged=onFileUploadStateChange;uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var a=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",a.name);Q("d2progressBar").max=a.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader();uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;uploadFile.ws.sendText(JSON.stringify({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:a.name,size:uploadFile.xdata.byteLength}))};uploadFile.xreader.readAsArrayBuffer(a)}else{p13uploadFileCancel()}}function p13uploadFileCancel(a,b){if(uploadFile!=null){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}uploadFile=null}setDialogMode(0)}function p13gotUploadData(b){var a=JSON.parse(b);if((uploadFile==null)||(parseInt(uploadFile.xfilePtr)!=parseInt(a.reqid))){return}if(a.action=="uploadstart"){p13uploadNextPart(false);for(var c=0;c<8;c++){p13uploadNextPart(true)}}else{if(a.action=="uploadack"){p13uploadNextPart(false)}else{if(a.action=="uploaderror"){p13uploadFileCancel()}}}}function p13uploadNextPart(c){var a=uploadFile.xdata;var e=uploadFile.xptr;var d=uploadFile.xptr+4096;if(d>a.byteLength){if(c==true){return}d=a.byteLength}if(e==a.byteLength){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}if(uploadFile.xfiles.length>uploadFile.xfilePtr+1){p13uploadReconnect()}else{p13uploadFileCancel()}}else{var b=a.slice(e,d);uploadFile.ws.send(b);uploadFile.xptr=d;Q("d2progressBar").value=d}}var currentDeviceEvents=null;function devevents_update(){var g="",a=null;for(var c in currentDeviceEvents){var b=currentDeviceEvents[c];var f=new Date(b.time);if(f.toLocaleDateString()!=a){if(a!=null){g+="</table>"}g+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt colspan=4>"+f.toLocaleDateString()+"</td></tr>";a=f.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var e=b.msg.split("(R)").join("®");g+="<tr><td style=width:18px><div class="+d+"></div></td><td class=g1 style=float:none> </td><td style=background-color:#C9C9C9>"+f.toLocaleTimeString()+" - "+e+"</td><td class=g2 style=float:none> </td></tr><tr style=height:2px></tr>"}if(a!=null){g+="</table>"}if(g==""){g="<br><i>No Events Found</i><br><br>"}QH("p16events",g)}function refreshDeviceEvents(){meshserver.send({action:"events",nodeid:currentNode._id,limit:parseInt(p16limitdropdown.value)})}function agentConsoleHandleKeys(b){var d=0,a=Q("p15consoleText");if(b.key){if(b.keyCode==13&&consoleFocus==0){p15consoleSend(b);d=1}else{if(b.keyCode==8&&consoleFocus==0){var f=a.value;a.value=f.substring(0,f.length-1);d=1}else{if(b.keyCode==27){a.value="";d=1}else{if((b.keyCode==38)||(b.keyCode==40)){var c=consoleHistory.indexOf(a.value);if((b.keyCode==38)&&((consoleHistory.length-1)>c)){a.value=consoleHistory[c+1]}else{if((b.keyCode==40)&&(c>0)){a.value=consoleHistory[c-1]}else{if((b.keyCode==40)&&(c==0)){a.value=""}}}d=1}else{if(b.key.length===1){insertTextAtCursor(a,b.key);d=1}}}}}}else{if(b.charCode!=0&&consoleFocus==0){a.value=((a.value+String.fromCharCode(b.charCode)));d=1}}if(d>0){return haltEvent(b)}}function insertTextAtCursor(a,d){if(document.selection){a.focus();sel=document.selection.createRange();sel.text=d}else{if(a.selectionStart||a.selectionStart=="0"){var c=a.selectionStart,b=a.selectionEnd;a.value=a.value.substring(0,c)+d+a.value.substring(b,a.value.length);a.setSelectionRange(b+1,b+1)}else{a.value+=myValue}}}var consoleNode;function setupConsole(){var d=(consoleNode==currentNode);consoleNode=currentNode;var a=meshes[consoleNode.meshid];var b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&16)!=0){if(consoleNode.consoleText==null){consoleNode.consoleText=""}if(d==false){QH("p15agentConsoleText",consoleNode.consoleText);Q("p15agentConsoleText").scrollTop=Q("p15agentConsoleText").scrollHeight}var c=((consoleNode.conn&1)!=0)?true:false;QH("p15statetext",c?"Agent is online":"Agent is offline");QE("p15consoleText",c);QE("p15uploadCore",c)}else{QH("p15statetext","Access Denied");QE("p15consoleText",false);QE("p15uploadCore",false)}}function p15consoleClear(){QH("p15agentConsoleText","");Q("id_p15consoleClear").blur();consoleNode.consoleText=""}var consoleHistory=[];function p15consoleSend(a){if(a&&a.keyCode!=13){return}var d=Q("p15consoleText").value,c="<div style=color:green>> "+EscapeHtml(Q("p15consoleText").value)+"<br/></div>";Q("p15agentConsoleText").innerHTML+=c;consoleNode.consoleText+=c;Q("p15agentConsoleText").scrollTop=Q("p15agentConsoleText").scrollHeight;Q("p15consoleText").value="";meshserver.send({action:"msg",type:"console",nodeid:consoleNode._id,value:d});if(d.length>0){var b=consoleHistory.indexOf(d);if(b>=0){consoleHistory.splice(b,1)}consoleHistory.unshift(d);consoleHistory.splice(10)}}function p15consoleReceive(b,a){a="<div>"+a+"</div>";if(b.consoleText==null){b.consoleText=a}else{b.consoleText+=a}if(consoleNode==b){Q("p15agentConsoleText").innerHTML+=a;Q("p15agentConsoleText").scrollTop=Q("p15agentConsoleText").scrollHeight}}function p15uploadCore(a){if(xxdialogMode){return}if(a.shiftKey==true){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,path:"*"})}else{if(a.altKey==true){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id})}else{if(a.ctrlKey==true){p15uploadCore2()}else{setDialogMode(2,"Change Mesh Agent Core",3,p15uploadCoreEx,"<select id=d3coreMode style=float:right;width:260px><option value=1>Upload default server core</option><option value=2>Clear the core</option><option value=6>Upload recovery core</option><option value=3>Upload a core file</option><option value=4>Soft disconnect agent</option><option value=5>Hard disconnect agent</option></select><div>Change Core</div>")}}}}function p15uploadCoreEx(){if(Q("d3coreMode").value==1){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,type:"default"})}else{if(Q("d3coreMode").value==2){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,type:"clear"})}else{if(Q("d3coreMode").value==3){p15uploadCore2()}else{if(Q("d3coreMode").value==4){meshserver.send({action:"agentdisconnect",nodeid:consoleNode._id,disconnectMode:1})}else{if(Q("d3coreMode").value==5){meshserver.send({action:"agentdisconnect",nodeid:consoleNode._id,disconnectMode:2})}else{if(Q("d3coreMode").value==6){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,type:"recovery"})}}}}}}}function p15uploadCore2(){if(xxdialogMode){return}Q("d3localmodeform").action="uploadmeshcorefile.ashx";Q("d3attrib").value=currentNode._id;setDialogMode(3,"Upload Mesh Agent Core",3,p15uploadCoreEx2);d3init()}function p15uploadCoreEx2(){var b=Q("d3uploadMode").value;if(b==1){Q("d3submit").click()}else{var a=d3getFileSel();if(a.length==1){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,type:"custom",path:d3filetreelocation.join("/")+"/"+a[0]})}}}function account_addOtp(){if(xxdialogMode||(userinfo.otpsecret==1)||((features&4096)==0)){return}setDialogMode(2,"Add 2-Step Login",2,function(){meshserver.send({action:"otpauth-setup",secret:Q("d2optsecret").attributes.secret.value,token:Q("d2otpauthinput").value})},"<div id=d2optinfo>Loading...</div>","otpauth-request");meshserver.send({action:"otpauth-request"})}function account_addOtpCheck(a){var b=(Q("d2otpauthinput").value.length==6);QE("idx_dlgOkButton",b);if(a&&(a.keyCode==13)&&b){dialogclose(1)}}function account_removeOtp(){if(xxdialogMode||(userinfo.otpsecret!=1)||((features&4096)==0)){return}setDialogMode(2,"Remove 2-Step Login",3,function(){meshserver.send({action:"otpauth-clear"})},"Confirm removal of 2-step login?")}function account_showVerifyEmail(){if(xxdialogMode||(userinfo.emailVerified==true)||(serverinfo.emailcheck!=true)){return}var a="Click ok to send a verification mail to:<br /><div style=padding:8px><b>"+EscapeHtml(userinfo.email)+"</b></div>Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a)}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return}var a="Change your account email address here.<br /><br />";a+=addHtmlValue("Email","<input id=dp2email style=width:230px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp2email").value=userinfo.email}account_validateEmail();Q("dp2email").focus()}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp2email").value)&&(Q("dp2email").value!=userinfo.email));if((a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp2email").value})}function account_showDeleteAccount(){if(xxdialogMode){return}var a="To delete this account, type in the account password in both boxes below and hit ok.<br /><br />";a+="<form action='"+domainUrl+"deleteaccount' method=post><table style=margin-left:80px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr></table><br /><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_showChangePassword(){if(xxdialogMode){return}var a="Change your account password by entering the new password twice in the boxes below.<br /><br />";a+="<form action='"+domainUrl+"changepassword' method=post><table style=margin-left:60px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td>";a+="</tr><tr><td align=right>Password Hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off /></td>";a+="</tr></table><br /><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Change Password",0,null,a);Q("apassword1").focus();account_validateNewPassword()}function account_createMesh(){if(xxdialogMode){return}if((userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true)&&(userinfo.siteadmin!=4294967295)){setDialogMode(2,"New Device Group",1,null,'Unable to create a new device group until the email address is verified. Go to the "My Account" tab to change and verify an email address.');return}var a="Create a new device group using the options below.<br /><br />";a+=addHtmlValue("Name","<input id=dp2meshname style=width:230px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");a+=addHtmlValue("Type","<div style=width:230px;margin:0;padding:0><select id=dp2meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Manage using a software agent</option><option value=1>Intel® AMT only, no agent</option></select></div>");a+=addHtmlValue("Description","<div style=width:230px;margin:0;padding:0><textarea id=dp2meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"New Device Group",3,account_createMeshEx,a);account_validateMeshCreate();Q("dp2meshname").focus()}function account_validateMeshCreate(){QE("idx_dlgOkButton",Q("dp2meshname").value.length>0)}function account_createMeshEx(a,b){meshserver.send({action:"createmesh",meshname:Q("dp2meshname").value,meshtype:Q("dp2meshtype").value,desc:Q("dp2meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value))}function account_validateNewPassword(){var d="",a=(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value);if(Q("apassword1").value!=""){if(passRequirements==null||passRequirements==""){var c=checkPasswordStrength(Q("apassword1").value);if(c>=80){d="<span style=color:green>Strong<span>"}else{if(c>=60){d="<span style=color:blue>Good<span>"}else{d="<span style=color:red>Weak<span>"}}}else{var b=checkPasswordRequirements(Q("apassword1").value,passRequirements);if(b==false){a=false;d="<span style=color:red>Policy<span>"}}}QH("dxPassWarn",d);QE("account_dlgOkButton",a)}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}function checkPasswordRequirements(e,f){if((f==null)||(f=="")||(typeof f!="object")){return true}if(f.min){if(e.length<f.min){return false}}if(f.max){if(e.length>f.max){return false}}var d=0,b=0,g=0,c=0;for(var a=0;a<e.length;a++){if(/\d/.test(e[a])){d++}if(/[a-z]/.test(e[a])){b++}if(/[A-Z]/.test(e[a])){g++}if(/\W/.test(e[a])){c++}}if(f.num&&(d<f.num)){return false}if(f.lower&&(b<f.lower)){return false}if(f.upper&&(g<f.upper)){return false}if(f.nonalpha&&(c<f.nonalpha)){return false}return true}function updateMeshes(){var e="";var a=0,b=0;for(i in meshes){if(a>1){e+="</tr><tr>";a=0}a++;b++;var d=meshes[i].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var f="Partial Rights";if(d==4294967295){f="Full Administrator"}else{if(d==0){f="No Rights"}}e+="<div onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=display:inline-block;width:431px;height:50px;padding-top:1px;padding-bottom:1px;float:left><div style=float:left;width:30px;height:100%></div><div style=height:100%;cursor:pointer onclick=gotoMesh('"+i+"')><div class=mi style=float:left;width:50px;height:50px></div><div style=height:100%><div class=g1></div><div class=e2 style=width:300px><div class=e1>"+EscapeHtml(meshes[i].name)+"</div><div>"+f+"</div></div><div class=g2 style=float:left></div></div></div></div>"}meshcount=b;QH("p2meshes",e);QV("p2noMeshFound",b==0)}function gotoMesh(a){currentMesh=meshes[a];p20updateMesh();go(20)}function server_showRestoreDlg(){if(xxdialogMode){return}var a="Restore the server using a backup, <span style=color:red>this will delete the existing server data</span>. Only do this if you know what you are doing.<br /><br />";a+='<form action="/restoreserver.ashx" enctype="multipart/form-data" method="post"><div>';a+='<input id=account_dlgFileInput type=file name=datafile style=width:100% accept=".zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed" onchange=account_validateServerRestore()>';a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+="<input id=account_dlgOkButton type=submit value=OK style=float:right;width:80px onclick=dialogclose(1)>";a+="</div><br /><br /></form>";setDialogMode(2,"Restore Server",0,null,a);account_validateServerRestore()}function account_validateServerRestore(){QE("account_dlgOkButton",Q("account_dlgFileInput").files.length==1)}function server_showVersionDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Version",1,null,"Loading...","MeshCentralServerUpdate");meshserver.send({action:"serverversion"})}function server_showVersionDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showVersionDlgEx(){meshserver.send({action:"serverupdate"})}function server_showErrorsDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Errors",1,null,"Loading...","MeshCentralServerErrors");meshserver.send({action:"servererrors"})}function server_showErrorsDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showErrorsDlgEx(){meshserver.send({action:"serverclearerrorlog"})}var currentMesh;function p20updateMesh(){if(currentMesh==null){return}QH("p20meshName",EscapeHtml(currentMesh.name));var f="Unknown #"+currentMesh.mtype;var e=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(currentMesh.mtype==1){f="Intel® AMT only, no agent"}if(currentMesh.mtype==2){f="Managed using a software agent"}var l="";l+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(e&1)!=0));l+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&¤tMesh.desc!="")?EscapeHtml(currentMesh.desc):"<i>None</i>"),"p20editmesh(2)",(e&1)!=0));var d=[];if(currentMesh.flags){if(currentMesh.flags&1){d.push("Auto-Remove")}}d=d.join(", ");if(d==""){d="<i>None</i>"}l+=addHtmlValue("Features",addLinkConditional(d,"p20editmeshfeatures()",(e&1)!=0));l+=addHtmlValue("Type",f);if(e&1){l+='<br><input type=button value=Notes title="View notes about this device group" onclick=showNotes(false,"'+encodeURIComponent(currentMesh._id)+'") />'}l+="<br style=clear:both><br>";var b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(b&&((b.rights&2)!=0)){l+="<a onclick=p20showAddMeshUserDialog() style=cursor:pointer;margin-right:10px><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a>"}if((e&4)!=0){if(currentMesh.mtype==1){l+='<a onclick=addCiraDeviceToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new Intel® AMT computer that is located on the internet."><img src=images/icon-installmesh.png border=0 height=12 width=12> Install CIRA</a>';l+='<a onclick=addDeviceToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new Intel® AMT computer that is located on the local network."><img src=images/icon-installmesh.png border=0 height=12 width=12> Install local</a>'}if(currentMesh.mtype==2){l+='<a onclick=addAgentToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new computer to this mesh by installing the mesh agent."><img src=images/icon-addnew.png border=0 height=12 width=12> Install</a>';if(features&64){l+='<a onclick=inviteAgentToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Invite someone to install the mesh agent on this mesh."><img src=images/icon-addnew.png border=0 height=12 width=12> Invite</a>'}}}l+='<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th><th scope=col style=text-align:left></th></tr>';var a=1,j=[];for(var c in currentMesh.links){j.push({id:c,name:c.split("/")[2],rights:currentMesh.links[c].rights})}j.sort(function(m,n){if(m.name>n.name){return 1}if(m.name<n.name){return -1}return 0});for(var c in j){var k="",h="Partial Rights",g=j[c].rights;if(g==4294967295){h="Full Administrator"}else{if(g==0){h="No Rights"}}if((c!=userinfo._id)&&(e==4294967295||(((e&2)!=0)))){k='<a onclick=p20deleteUser(event,"'+encodeURIComponent(j[c].id)+'") title="Remote user rights to this mesh" style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'}l+='<tr onclick=p20viewuser("'+encodeURIComponent(j[c].id)+'") style=cursor:pointer'+(((a%2)==0)?";background-color:#DDD":"")+'><td><div title="User" class=m2></div><div> '+j[c].name+"<div></div></div></td><td><div style=float:right>"+k+"</div><div>"+h+"</div></td></tr>";++a}l+="</tbody></table>";if(e==4294967295){l+="<div style=font-size:x-small;text-align:right><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Mesh</a></span></div>"}QH("p20info",l)}function p20showDeleteMeshDialog(){if(xxdialogMode){return}var a='Are you sure you want to delete mesh "'+EscapeHtml(currentMesh.name)+'"? Deleting the mesh will also delete all information about computers within this mesh.<br /><br />';a+="<input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm";setDialogMode(2,"Delete Mesh",3,p20showDeleteMeshDialogEx,a);p20validateDeleteMeshDialog()}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(a,b){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(a){if(xxdialogMode){return}var b=addHtmlValue("Name","<input id=dp20meshname style=width:230px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");b+=addHtmlValue("Description","<div style=width:230px;margin:0;padding:0><textarea id=dp20meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"Edit Device Group",3,p20editmeshEx,b);Q("dp20meshname").value=currentMesh.name;if(currentMesh.desc){Q("dp20meshdesc").value=currentMesh.desc}p20editmeshValidate();if(a==2){Q("dp20meshdesc").focus()}else{Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",Q("dp20meshname").value.length>0)}function p20editmeshfeatures(){if(xxdialogMode){return}var a=(currentMesh.flags)?currentMesh.flags:0;var b="<div><input type=checkbox id=d20flag1 "+((a&1)?"checked":"")+">Remove device on disconnect<br></div>";setDialogMode(2,"Edit Device Group Features",3,p20editmeshfeaturesEx,b)}function p20editmeshfeaturesEx(){var a=0;if(Q("d20flag1").checked){a+=1}meshserver.send({action:"editmesh",meshid:currentMesh._id,flags:a})}function p20showAddMeshUserDialog(){if(xxdialogMode){return}var a="Allow a user to manage this device group and devices in this group<br /><br />";a+=addHtmlValue("User Name","<input id=dp20username style=width:230px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");a+="<br><div>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Device Group<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Device Group Users<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Device Group Computers<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remoteview>Remote View Only<br>";a+="</div>";setDialogMode(2,"Add User to Device Group",3,p20showAddMeshUserDialogEx,a);p20validateAddMeshUserDialog();Q("dp20username").focus()}function p20validateAddMeshUserDialog(){var a=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;QE("idx_dlgOkButton",(Q("dp20username").value.length>0));QE("p20fulladmin",a==4294967295);QE("p20editmesh",(!Q("p20fulladmin").checked)&&(a==4294967295));QE("p20manageusers",!Q("p20fulladmin").checked);QE("p20managecomputers",!Q("p20fulladmin").checked);QE("p20remotecontrol",!Q("p20fulladmin").checked);QE("p20meshagentconsole",!Q("p20fulladmin").checked);QE("p20meshserverfiles",!Q("p20fulladmin").checked);QE("p20wakedevices",!Q("p20fulladmin").checked);QE("p20editnotes",!Q("p20fulladmin").checked);QE("p20remoteview",!Q("p20fulladmin").checked)}function p20showAddMeshUserDialogEx(){var a=0;if(Q("p20fulladmin").checked==true){a=4294967295}else{if(Q("p20editmesh").checked==true){a+=1}if(Q("p20manageusers").checked==true){a+=2}if(Q("p20managecomputers").checked==true){a+=4}if(Q("p20remotecontrol").checked==true){a+=8}if(Q("p20meshagentconsole").checked==true){a+=16}if(Q("p20meshserverfiles").checked==true){a+=32}if(Q("p20wakedevices").checked==true){a+=64}if(Q("p20editnotes").checked==true){a+=128}if(Q("p20remoteview").checked==true){a+=256}}meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:a})}function p20viewuser(e){if(xxdialogMode){return}e=decodeURIComponent(e);var d="",b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights,c=currentMesh.links[e].rights;if(c==4294967295){d=", Full Administrator (all rights)"}else{if((c&1)!=0){d+=", Edit Device Group"}if((c&2)!=0){d+=", Manage Device Group Users"}if((c&4)!=0){d+=", Manage Device Group Computers"}if((c&8)!=0){d+=", Remote Control"}if((c&16)!=0){d+=", Agent Console"}if((c&32)!=0){d+=", Server Files"}if((c&64)!=0){d+=", Wake Devices"}if((c&128)!=0){d+=", Edit Notes"}if((c&256)!=0){d+=", Remote View Only"}}d=d.substring(2);if(d==""){d="No Rights"}var a=1,f=addHtmlValue("User Name",e.split("/")[2]);f+=addHtmlValue("Permissions",d);if((("user/"+domain+"/"+userinfo.name.toLowerCase())!=e)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){a+=4}setDialogMode(2,"Device Group User",a,p20viewuserEx,f,e)}function p20viewuserEx(a,b){if(a!=2){return}setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,"Confirm removal of user "+b.split("/")[2]+"?",b)}function p20deleteUser(a,b){haltEvent(a);p20viewuserEx(2,decodeURIComponent(b))}function p20viewuserEx2(a,b){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:b})}var filetreelinkpath;var filetreelocation=[];function updateFiles(){QV("MainMenuMyFiles",((features&8)==0));if((features&8)!=0){return}var q="",r="",c="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",o="Root",y,k=filetree,m=1;var j=[],v=filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var s=0;s<a.length;s++){if(a[s].checked){b.push(a[s].value)}}filetreelinkpath="";for(var s in filetreelocation){if((k.f!=null)&&(k.f[filetreelocation[s]]!=null)){j.push(filetreelocation[s]);o+=" / "+filetreelocation[s];if((m==1)){var B=filetreelocation[s].split("/");y=window.location+B[0]+"files/"+B[2];filetreelinkpath+=filetreelocation[s]}else{if(filetreelinkpath!=""){filetreelinkpath+="/"+filetreelocation[s];if(m>2){y+="/"+filetreelocation[s]}}}k=k.f[filetreelocation[s]];c+=" / <a style=cursor:pointer onclick=p5folderup("+m+")>"+(k.n!=null?k.n:filetreelocation[s])+"</a>";m++}else{break}}filetreelocation=j;var w=o.toLowerCase().startsWith("root / "+userinfo._id+" / public");var l=p5sort_files(k.f);for(var s in l){var d=l[s],u=d.n,A;A=u;if(u.length>70){A='<span title="'+EscapeHtml(u)+'">'+EscapeHtml(u.substring(0,70))+"...</span>"}else{A=EscapeHtml(u)}u=EscapeHtml(u);var g="";if(d.d!=null){var e=new Date(d.d),g=(e.getMonth()+1)+"/"+(e.getDate())+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" "}var n="";if(d.s!=null){n=getFileSizeStr(d.s)}var p="";if(d.t<3||d.t==4){var z=(d.t==1||d.t==4)?p5getQuotabar(d):"",C="";p="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+u+"'> <span style=float:right title=\""+C+'">'+z+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(d.nx)+'")>'+A+"</a></span></div>"}else{var t=A;var x="";if(w){x=' (<a style=cursor:pointer title="Display public link" onclick=\'p5showPublicLink("'+y+"/"+d.nx+"\")'>Link</a>)"}if(d.s>0){t='<a rel="noreferrer noopener" target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+d.nx)+'">'+A+"</a>"+x}p="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+d.nx+"'> <span class=fsize>"+g+"</span><span style=float:right>"+n+"</span><span><div class=fileIcon"+d.t+"></div>"+t+"</span></div>"}if(d.t<3){q+=p}else{r+=p}}QH("p5rightOfButtons",p5getQuotabar(k));QH("p5files",q+r);QH("p5currentpath",c);QE("p5FolderUp",filetreelocation.length!=0);QV("p5PublicShare",w);if(v==filetreelinkpath){a=document.getElementsByName("fc");for(var s=0;s<a.length;s++){a[s].checked=(b.indexOf(a[s].value)>=0)}}p5setActions()}function getNiceSize(a){if(a<=0){return"Storage limit exceed"}if(a<2048){return a+" bytes remaining"}if(a<2097152){return Math.round(a/1024)+" kilobytes remaining"}if(a<2147483648){return Math.round(a/1024/1024)+" megabytes remaining"}return Math.round(a/1024/1024/1024)+" gigabytes remaining"}function getNiceSize2(a){if(a<=0){return"None"}if(a<2048){return a+" b"}if(a<2097152){return Math.round(a/1024)+" Kb"}if(a<2147483648){return Math.round(a/1024/1024)+" Mb"}return Math.round(a/1024/1024/1024)+" Gb"}function p5getQuotabar(a){while(a.t>1&&a.t!=4){a=a.parent}if((a.t!=1&&a.t!=4)||(a.maxbytes==null)){return""}var b=Math.floor(a.s/1024),c=(a.maxbytes-a.s);return'<span title="'+b+"k in "+a.c+" file"+(a.c>1?"s":"")+". "+(Math.floor(a.maxbytes/1024/1024))+'k maxinum">'+getNiceSize(c)+" <progress style=height:10px;width:100px value="+a.s+" max="+a.maxbytes+" /></span>"}function p5showPublicLink(a){setDialogMode(2,"Public Link",1,null,'<input type=text style=width:100% value="'+a+'" readonly />')}var sortorder;function p5sort_filename(c,d){if(c.ln>d.ln){return(1*sortorder)}if(c.ln<d.ln){return(-1*sortorder)}return 0}function p5sort_timestamp(c,d){if(c.d>d.d){return(1*sortorder)}if(c.d<d.d){return(-1*sortorder)}return 0}function p5sort_bysize(c,d){if(c.s==d.s){return p5sort_filename(c,d)}return(((c.s-d.s))*sortorder)}function p5sort_files(a){var c=[],d=Q("p5sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}sortorder=1;if(d>3){sortorder=-1;d-=3}if(d==1){c.sort(p5sort_filename)}else{if(d==2){c.sort(p5sort_bysize)}else{if(d==3){c.sort(p5sort_timestamp)}}}return c}function p5setActions(){var a=getFileSelCount(),c=getFileCount(),b=getFileSelCount(false);QE("p5DeleteFileButton",(a>0)&&(filetreelocation.length>0));QE("p5NewFolderButton",filetreelocation.length>0);QE("p5UploadButton",filetreelocation.length>0);QE("p5RenameFileButton",(a==1)&&(filetreelocation.length>0));QE("p5SelectAllButton",c>0);Q("p5SelectAllButton").value=(a>0?"Select None":"Select All");QE("p5CutButton",(b>0)&&(a==b));QE("p5CopyButton",(b>0)&&(a==b));QE("p5PasteButton",(p5clipboard!=null)&&(p5clipboard.length>0)&&(filetreelocation.length>0))}function getFileSelCount(d){var a=0,b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileSelDirCount(){var a=0,b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&(b[c].attributes.file.value=="999")){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}function p5selectallfile(){var c=(getFileSelCount()==0),a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){a[b].checked=c}p5setActions()}function setupBackPointers(d){if(d.f!=null){var b=0,a=0;for(var c in d.f){setupBackPointers(d.f[c]);d.f[c].parent=d;if(d.f[c].s){b+=d.f[c].s}if(d.f[c].c){a+=d.f[c].c}if(d.f[c].t==3){a++}}d.s=b;d.c=a}return d}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function p5folderup(a){if(a==null){filetreelocation.pop()}else{while(filetreelocation.length>a){filetreelocation.pop()}}updateFiles()}function p5folderset(a){filetreelocation.push(decodeURIComponent(a));updateFiles()}function p5createfolder(){setDialogMode(2,"New Folder",3,p5createfolderEx,"<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />");focusTextBox("p5renameinput");p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var a=getFileSelCount(),b=(getFileSelDirCount()>0)?"<br /><br /><input type=checkbox id=p5recdeleteinput>Recursive delete<br>":"<input type=checkbox id=p5recdeleteinput style='display:none'>";setDialogMode(2,"Delete",3,p5deletefileEx,(a>1)?("Delete "+a+" selected items?"+b):("Delete selected item?"+b))}function p5deletefileEx(){var b=[],a=document.getElementsByName("fc");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(a[c].value)}}meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:b,rec:Q("p5recdeleteinput").checked})}function p5renamefile(){var c,a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){if(a[b].checked){c=a[b].value}}setDialogMode(2,"Rename",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:c});focusTextBox("p5renameinput");p5fileNameCheck()}function p5renamefileEx(a,c){c.newname=Q("p5renameinput").value;meshserver.send(c)}function p5fileNameCheck(a){var b=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a&&a.keyCode==13)){dialogclose(1)}}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value="'+encodeURIComponent(filetreelinkpath)+'" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=submit id=p5loginSubmit style=display:none /></form>');updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(b){var a=document.getElementsByName("fc");p5clipboard=[];p5clipboardCut=b,p5clipboardFolder=Clone(filetreelocation);for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p5clipboard.push(a[c].value)}}p5updateClipview()}function p5pasteFile(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Confim "+(p5clipboardCut==0?"copy":"move")+" of "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p5pasteFileEx,a)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:(p5clipboardCut==0?"copy":"move"),scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard});p5folderup(999);if(p5clipboardCut==1){p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;p5updateClipview()}}function p5updateClipview(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Holding "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" for "+(p5clipboardCut==0?"copy":"move")+", <a onclick=p5clearClip() style=cursor:pointer>Clear</a>."}QH("p5bottomstatus",a);p5setActions()}function p5clearClip(){p5clipboard=null;p5clipboardFolder=null;p5clipboardCut=0;p5updateClipview()}function p5fileDragDrop(b){if(xxdialogMode){return}haltEvent(b);QV("bigfail",false);QV("bigok",false);var c=0;p5uploadFile();try{Q("p5uploadinput").files=b.dataTransfer.files}catch(d){c=1}if(c==0){p5uploadFileEx()}setDialogMode(0);if(c==1){if(b.dataTransfer==null||b.dataTransfer.files.length==0||filetreelocation.length==0){return}var h=[],l=[],n=[],a=[],k=b.dataTransfer.files.length,m=0;for(var g=0;g<b.dataTransfer.files.length;g++){m+=b.dataTransfer.files[g].size}if(m>1300000){p5uploadFile();return}for(var g=0;g<b.dataTransfer.files.length;g++){var j=new FileReader(),f=b.dataTransfer.files[g];h.push(f.name);l.push(f.size);n.push(f.type);j.onload=function(e){a.push(e.target.result);if(--k==0){Q("p5fileDragName").value=h.join("*");Q("p5fileDragSize").value=l.join("*");Q("p5fileDragType").value=n.join("*");Q("p5fileDragData").value=a.join("*");Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath);Q("p5loginSubmit2").click()}};j.readAsDataURL(f)}}}var p5dragtimer=null;function p5fileDragOver(b){if(xxdialogMode){return}haltEvent(b);if(p5dragtimer!=null){clearTimeout(p5dragtimer);p5dragtimer=null}var a=true;if(filetreelocation.length==0){a=false}QV("bigok",a);QV("bigfail",!a)}function p5fileDragLeave(a){if(xxdialogMode){return}haltEvent(a);if(a.target.id!="p5filetable"){QV("bigfail",false);QV("bigok",false)}else{p5dragtimer=setTimeout(function(){QV("bigfail",false);QV("bigok",false);p5dragtimer=null},10)}}function eventMouseHover(a,b){a.children[1].classList.remove("g1s");a.children[2].style["background-color"]=((b==0)?"#c9c9c9":"#b9b9b9");a.children[3].classList.remove("g2s");if(b==1){a.children[1].classList.add("g1s");a.children[3].classList.add("g2s")}}function events_update(){var g="",a=null;for(var c in events){var b=events[c];var f=new Date(b.time);if(f.toLocaleDateString()!=a){if(a!=null){g+="</table>"}g+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td colspan=4 class=DevSt>"+f.toLocaleDateString()+"</td></tr>";a=f.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var e=b.msg.split("(R)").join("®");if(b.username&&b.username!=userinfo.name){e+=": "+b.username}g+="<tr onmouseover=eventMouseHover(this,1) onmouseout=eventMouseHover(this,0) style=cursor:pointer><td style=width:18px><div class="+d+"></div></td><td class=g1 style=float:none> </td><td style=background-color:#C9C9C9>"+f.toLocaleTimeString()+" - "+e+"</td><td class=g2 style=float:none> </td></tr><tr style=height:2px></tr>"}if(a!=null){g+="</table>"}if(g==""){g="<br><i>No Events Found</i><br><br>"}QH("p3events",g)}function showDeleteAllEventsDialog(){if(xxdialogMode){return}var a="Delete all events in the server event log?<br /><br />";a+="<input id=p3check type=checkbox onchange=validateDeleteAllEventsDialog() />Confirm";setDialogMode(2,"Delete All Events",3,showDeleteAllEventsDialogEx,a);validateDeleteAllEventsDialog()}function validateDeleteAllEventsDialog(){QE("idx_dlgOkButton",Q("p3check").checked)}function showDeleteAllEventsDialogEx(a,b){meshserver.send({action:"clearevents"})}function refreshEvents(){meshserver.send({action:"events",limit:parseInt(p3limitdropdown.value)})}function updateUsers(){QV("MainMenuMyUsers",(users!=null)&&((features&4)==0));QV("LeftMenuMyUsers",(users!=null)&&((features&4)==0));if((users==null)||((features&4)!=0)){QH("p3users","");return}var f=[],d=100,b=0;for(var c in users){f.push(c)}f.sort();var h=Q("UserSearchInput").value.toLowerCase();var j="<table style=width:100% cellpadding=0 cellspacing=0>",a=true;for(var c in f){var g=users[f[c]],e=null;if(wssessions!=null){e=wssessions[g._id]}if((e!=null)&&(g.name.toLowerCase().indexOf(h)>=0)){if(d>0){if(a){j+="<tr><td class=userTableHeader>Online Users";a=false}j+=addUserHtml(g,e);d--}else{b++}}}a=true;for(var c in f){var g=users[f[c]],e=null;if(wssessions!=null){e=wssessions[g._id]}if((e==null)&&(g.name.toLowerCase().indexOf(h)>=0)){if(d>0){if(a){j+="<tr><td class=userTableHeader>Offline Users";a=false}j+=addUserHtml(g,e);d--}else{b++}}}j+="</table>";if(b==1){j+="<br />1 more user not shown, use search box to look for users...<br />"}else{if(b>1){j+="<br />"+b+" more users not shown, use search box to look for users...<br />"}}if(d==100){j+="<br />No users found.<br />"}QH("p3users",j);if((currentUser!=null)&&(xxcurrentView==30)){gotoUser(encodeURIComponent(currentUser._id),true)}}function addUserHtml(h,g){var k="",b=" gray",c="m2",d="",e="",f=(h.name!=userinfo.name);if(g!=null){b="";if(f){e='<span style=float:right;margin-top:1px;margin-right:4px title=Chat><a onclick=userChat(event,"'+encodeURIComponent(h._id)+'","'+encodeURIComponent(h.name)+"\")><img src='images/icon-chat.png' height=16 width=16 style=padding-top:2px /></a></span>";e+='<span style=float:right;margin-top:1px;margin-left:4px;margin-right:4px title=Notify><a onclick=showUserAlertDialog(event,"'+encodeURIComponent(h._id)+"\")><img src='images/icon-notify.png' height=16 width=16 style=padding-top:2px /></a></span>"}if(g==1){d+="1 active session"}else{d+=g+" active sessions"}}else{if(h.login){d+='<span title="Last login: '+new Date(h.login).toLocaleString()+'">'+new Date(h.login).toLocaleDateString()+"</span>"}}if(d!=""){d+=", "}if(f){d+='<a onclick=showUserAdminDialog(event,"'+encodeURIComponent(h._id)+'")>'}if((h.siteadmin!=null)&&((h.siteadmin&32)!=0)&&(h.siteadmin!=4294967295)){d+="Locked, "}d+="<span title='Server Permissions'>";if((h.siteadmin==null)||(h.siteadmin==0)||(h.siteadmin==32)){d+="User"}else{if(h.siteadmin==8){d+="User with server files"}else{if(h.siteadmin==4294967295){d+="Administrator"}else{d+="Partial"}}}d+="</span>";if((h.quota!=null)&&((h.siteadmin&8)!=0)){d+=", "+(h.quota/1024)+" k"}if(f){d+="</a>"}var j=EscapeHtml(h.name),a="";if(serverinfo.emailcheck==true){a=((h.emailVerified!=true)?' <b style=color:red title="Email is not verified">🗴</b>':' <b style=color:green title="Email is verified">🗸</b>')}if(h.email!=null){j+=', <a onclick=doemail(event,"'+h.email+'")>'+h.email+"</a>"+a}k+='<tr onmouseover=userMouseHover(this,1) onmouseout=userMouseHover(this,0)><td style=cursor:pointer onclick=gotoUser("'+encodeURIComponent(h._id)+'")>';k+="<div class=bar style=height:24px;width:100%;font-size:medium>";k+='<div style=float:left;height:24px;width:24px;background-color:white><div class="'+c+b+'" style=width:16px;margin-top:4px;margin-left:2px;height:16px></div></div>';k+="<div class=g1 style=height:24px;float:left></div><div class=g2 style=height:24px;float:right></div>";k+="<div><span>"+j+"</span>"+e+"<span style=float:right>"+d+"</span></div></div>";return k}function userMouseHover(b,c){var a=b.children[0].children[0];a.children[1].classList.remove("g1s");a.children[2].classList.remove("g2s");if(c==1){a.children[1].classList.add("g1s");a.children[2].classList.add("g2s")}b.children[0].children[0].style["background-color"]=((c==0)?"#c9c9c9":"#b9b9b9")}function userChat(a,c,b){haltEvent(a);window.open("/messenger?id=meshmessenger/"+c+"/"+encodeURIComponent(userinfo._id)+"&title="+b,"meshmessenger:"+c);meshserver.send({action:"meshmessenger",userid:decodeURIComponent(c)});return false}function showUserAlertDialog(a,b){if(xxdialogMode){return}haltEvent(a);setDialogMode(2,"Notify "+EscapeHtml(users[decodeURIComponent(b)].name),3,showUserAlertDialogEx,'Send a text notification to this user.<textarea id=d2notifyText maxlength=2048 style="width:100%;height:184px;resize:none"></textarea>',b);Q("d2notifyText").focus();return false}function showUserAlertDialogEx(a,b){meshserver.send({action:"notifyuser",userid:decodeURIComponent(b),msg:Q("d2notifyText").value})}function doemail(b,a){if(xxdialogMode){return}haltEvent(b);window.open("mailto:"+a);return false}function showCreateNewAccountDialog(){if(xxdialogMode){return}var a="";a+=addHtmlValue("Name","<input id=p4name style=width:230px maxlength=64 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Email","<input id=p4email style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass1 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass2 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");setDialogMode(2,"Create Account",3,showCreateNewAccountDialogEx,a);showCreateNewAccountDialogValidate();Q("p4name").focus()}function showCreateNewAccountDialogValidate(){if((Q("p4email").value.length>0)&&(validateEmail(Q("p4email").value))==false){QE("idx_dlgOkButton",false);return}QE("idx_dlgOkButton",(!Q("p4name")||((Q("p4name").value.length>0)&&(Q("p4name").value.indexOf(" ")==-1)))&&Q("p4pass1").value.length>0&&Q("p4pass1").value==Q("p4pass2").value&&checkPasswordRequirements(Q("p4pass1").value,passRequirements))}function showCreateNewAccountDialogEx(){meshserver.send({action:"adduser",username:Q("p4name").value,email:Q("p4email").value,pass:Q("p4pass1").value})}function showUserAdminDialog(a,c){if(xxdialogMode){return}haltEvent(a);c=decodeURIComponent(c);var d="<div>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fileaccess>Server Files, <input type=number onchange=showUserAdminDialogValidate() maxlength=10 style=width:80px;text-align:right id=ua_fileaccessquota>k max, blank for default<br><hr/>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fulladmin>Full Administrator<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverbackup>Server Backup<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverrestore>Server Restore<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverupdate>Server Updates<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_manageusers>Manage Users<br>";d+="<hr/><input type=checkbox onchange=showUserAdminDialogValidate() id=ua_lockedaccount>Lock Account<br>";d+="</div>";var b=users[c.toLowerCase()];setDialogMode(2,"Server Permissions",3,showUserAdminDialogEx,d,b);if(b.siteadmin&&b.siteadmin!=0){Q("ua_fulladmin").checked=(b.siteadmin==4294967295);Q("ua_serverbackup").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&1)!=0));Q("ua_manageusers").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&2)!=0));Q("ua_serverrestore").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&4)!=0));Q("ua_fileaccess").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&8)!=0));Q("ua_serverupdate").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&16)!=0));Q("ua_lockedaccount").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&32)!=0))}QE("ua_fulladmin",userinfo.siteadmin==4294967295);QE("ua_serverbackup",userinfo.siteadmin==4294967295);QE("ua_manageusers",userinfo.siteadmin==4294967295);QE("ua_serverrestore",userinfo.siteadmin==4294967295);QE("ua_fileaccess",userinfo.siteadmin==4294967295);QE("ua_serverupdate",userinfo.siteadmin==4294967295);Q("ua_fileaccessquota").value=(b.quota!=null)?(b.quota/1024):"";showUserAdminDialogValidate();return false}function showUserAdminDialogValidate(){if(userinfo.siteadmin==4294967295){QE("ua_serverbackup",!Q("ua_fulladmin").checked);QE("ua_manageusers",!Q("ua_fulladmin").checked);QE("ua_serverrestore",!Q("ua_fulladmin").checked);QE("ua_fileaccess",!Q("ua_fulladmin").checked);QE("ua_serverupdate",!Q("ua_fulladmin").checked);QE("ua_fileaccessquota",Q("ua_fileaccess").checked&&!Q("ua_fulladmin").checked)}}function showUserAdminDialogEx(a,d){var c=0,b=parseInt(Q("ua_fileaccessquota").value);if(Q("ua_fulladmin").checked==true){c=4294967295}else{if(Q("ua_serverbackup").checked==true){c+=1}if(Q("ua_manageusers").checked==true){c+=2}if(Q("ua_serverrestore").checked==true){c+=4}if(Q("ua_fileaccess").checked==true){c+=8}if(Q("ua_serverupdate").checked==true){c+=16}if(Q("ua_lockedaccount").checked==true){c+=32}}var e={action:"edituser",name:d.name,siteadmin:c};if(isNaN(b)==false){e.quota=(b*1024)}meshserver.send(e)}function onUserSearchInputChanged(){updateUsers()}var currentUser=null;function gotoUser(j,e){if(xxdialogMode&&!e){return}var h=currentUser=users[decodeURIComponent(j)];if(h==null){setDialogMode(0);go(4);return}QH("p30userName",h.name);QH("p31userName",h.name);var g=(h.name==userinfo.name),a=0;if(wssessions!=null&&wssessions[h._id]){a=wssessions[h._id]}Q("MainUserImage").classList.remove("gray");if(a==0){Q("MainUserImage").classList.add("gray")}var f="";if((h.siteadmin!=null)&&((h.siteadmin&32)!=0)&&(h.siteadmin!=4294967295)){f+="Locked account, "}if((h.siteadmin==null)||(h.siteadmin==0)||(h.siteadmin==32)){f+="No server rights"}else{if(h.siteadmin==8){f+="Access to server files"}else{if(h.siteadmin==4294967295){f+="Full administrator"}else{f+="Partial rights"}}}var k="<div style=min-height:80px><table style=width:100%>";var c=h.email?EscapeHtml(h.email):"<i>Not set</i>",d="";if(serverinfo.emailcheck){d=((h.emailVerified==true)?'<b style=color:green;cursor:pointer title="Email is verified">🗸</b> ':'<b style=color:red;cursor:pointer title="Email not verified">🗴</b> ')}k+=addDeviceAttribute("Email",d+'<a style=cursor:pointer onclick=p30showUserEmailChangeDialog(event,"'+j+'")>'+c+'</a> <a style=cursor:pointer onclick=doemail(event,"'+h.email+'")><img src="images/link1.png" /></a>');k+=addDeviceAttribute("Server Rights",'<a style=cursor:pointer onclick=showUserAdminDialog(event,"'+j+'")>'+f+"</a>");if(h.quota){k+=addDeviceAttribute("Server Quota",EscapeHtml(parseInt(h.quota)/1024)+" k")}k+=addDeviceAttribute("Creation",new Date(h.creation).toLocaleString());if(h.login){k+=addDeviceAttribute("Last Login",new Date(h.login).toLocaleString())}k+="</table></div><br />";k+='<input type=button value=Notes title="View notes about this user" onclick=showNotes(false,"'+j+'") />';if(!g&&(a>0)){k+='<input type=button value=Notify title="Send user notification" onclick=showUserAlertDialog(event,"'+j+'") />'}QH("p30html",k);drawUserTimeline();var b=true;if(h._id==userinfo._id){b=false}if(h.siteadmin&&h.siteadmin>0&&userinfo.siteadmin!=4294967295){b=false}k="<div style=float:right;font-size:x-small>";if(b){k+='<a style=cursor:pointer onclick=p30showDeleteUserDialog() title="Remove this user">Delete User</a>'}k+="</div><div style=font-size:x-small>";if(userinfo.siteadmin==4294967295){k+='<a style=cursor:pointer onclick=p30showUserChangePassDialog() title="Change the password for this user">Change Password</a>'}k+="</div><br>";QH("p30html3",k);k="";if(a==1){k="1 active session"}else{if(a>1){k=a+" active sessions"}}QH("MainUserState",k);go(30);QH("p31events","");refreshUsersEvents()}function p30showUserEmailChangeDialog(a){if(xxdialogMode){return}var b="";b+=addHtmlValue("Email","<input id=dp30email style=width:230px maxlength=32 onchange=p30validateEmail() onkeyup=p30validateEmail() />");if(serverinfo.emailcheck){b+=addHtmlValue("Status","<select id=dp30verified style=width:230px onchange=p30validateEmail()><option value=0>Not verified</option><option value=1>Verified</option></select>")}setDialogMode(2,"Change Email for "+EscapeHtml(currentUser.name),3,p30showUserEmailChangeDialogEx,b);Q("dp30email").focus();Q("dp30email").value=currentUser.email;if(serverinfo.emailcheck){Q("dp30verified").value=currentUser.emailVerified?1:0}p30validateEmail()}function p30validateEmail(){var a=Q("dp30email").value,b=a.split("@");b=(b.length==2)&&(b[0].length>0)&&(b[1].split(".").length>1)&&(b[1].length>2)&&(a.length<1024)&&((a!=userinfo.email)||((serverinfo.emailcheck==true)&&(Q("dp30verified").value!=(userinfo.emailVerified?1:0))));QE("idx_dlgOkButton",b)}function p30showUserEmailChangeDialogEx(){var a={action:"edituser",name:currentUser.name,email:Q("dp30email").value};if(serverinfo.emailcheck){a.emailVerified=(Q("dp30verified").value==1)}meshserver.send(a)}function p30showUserChangePassDialog(){if(xxdialogMode){return}var a="";a+=addHtmlValue("Password","<input id=p4pass1 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass2 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");setDialogMode(2,"Change Password for "+EscapeHtml(currentUser.name),3,p30showUserChangePassDialogEx,a);showCreateNewAccountDialogValidate();Q("p4pass1").focus()}function p30showUserChangePassDialogEx(){if(Q("p4pass1").value==Q("p4pass2").value){meshserver.send({action:"changeuserpass",user:currentUser.name,pass:Q("p4pass1").value})}}function p30showDeleteUserDialog(){if(xxdialogMode){return}setDialogMode(2,"Delete User "+EscapeHtml(currentUser.name),3,p30showDeleteUserDialogEx,"Confirm deletion of user "+EscapeHtml(currentUser.name)+"?")}function p30showDeleteUserDialogEx(){meshserver.send({action:"deleteuser",userid:currentUser._id,username:currentUser.name})}function drawUserTimeline(){var r=null,n=Date.now();r=[];var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var t=e.getTime();var s=[];if(r!=null&&r.length>1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l<r.length;l+=2){var o=r[l],h=n;if(r.length>(l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var y="",b=1,g=new Date();g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var v=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var w=Math.round((q-v)/112794);if(w>0){var u=powerStateStrings2[a[2]]+" from "+new Date(v).toLocaleTimeString()+" to "+new Date(q).toLocaleTimeString()+".";f+='<div title="'+u+'" style=display:table-cell;width:'+w+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}y+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div> "+g.toLocaleDateString()+"<div></div></div></td><td><div>"+f+"</div></td></tr>";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p30html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>Day</th><th scope=col style=text-align:center>7 Day Login State</th></tr>'+y+"</tbody></table>")}var currentUserEvents=null;function userEvents_update(){var g="",a=null;for(var c in currentUserEvents){var b=currentUserEvents[c];var f=new Date(b.time);if(f.toLocaleDateString()!=a){if(a!=null){g+="</table>"}g+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>"+f.toLocaleDateString()+"</td></tr>";a=f.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var e=b.msg.split("(R)").join("®");if(b.username&&b.username!=userinfo.name){e+=": "+b.username}g+="<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>";g+="<div style=float:left;height:18px;width:18px;background-color:white><div class="+d+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";g+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";g+="<div style=font-size:14px><span style=width:300px>"+f.toLocaleTimeString()+" - "+e+"</span></div></div></td></tr>"}if(a!=null){g+="</table>"}if(g==""){g="<br><i>No Events Found</i><br><br>"}QH("p31events",g)}function refreshUsersEvents(){meshserver.send({action:"events",limit:parseInt(p31limitdropdown.value),user:currentUser.name})}function d3init(){Q("d3localFile").value="";d3modechange()}function d3modechange(){var a=Q("d3uploadMode").value;QV("d3localmode",a==1);QV("d3servermode",a==2);if(a==1){d3setActions()}else{d3updatefiles()}}var d3filetreelinkpath;var d3filetreelocation=[];function d3updatefiles(){if(Q("d3uploadMode").value==1){return}var m="",n="",e=filetree,j=1;var c=[],r=d3filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var o=0;o<a.length;o++){if(a[o].checked){b.push(a[o].value)}}d3filetreelinkpath="";for(var o in d3filetreelocation){if((e.f!=null)&&(e.f[d3filetreelocation[o]]!=null)){c.push(d3filetreelocation[o]);if((j==1)){var t=d3filetreelocation[o].split("/");publicPath=window.location+t[0]+"files/"+t[2];if(d3filetreelocation[o]===userinfo._id){d3filetreelinkpath+="self"}else{d3filetreelinkpath+=(t[0]+"/"+t[2])}}else{if(d3filetreelinkpath!=""){d3filetreelinkpath+="/"+d3filetreelocation[o];if(j>2){publicPath+="/"+d3filetreelocation[o]}}}e=e.f[d3filetreelocation[o]];j++}else{break}}d3filetreelocation=c;var g=p5sort_files(e.f);for(var o in g){var d=g[o],q=d.n,s;s=q;if(q.length>70){s='<span title="'+EscapeHtml(q)+'">'+EscapeHtml(q.substring(0,70))+"...</span>"}else{s=EscapeHtml(q)}q=EscapeHtml(q);var k="";if(d.s!=null){k=getFileSizeStr(d.s)}var l="";if(d.t<3){var u="";l='<div class=filelist file=999><span style=float:right title="'+u+'"></span><span><div class=fileIcon'+d.t+'></div> <a style=cursor:pointer onclick=d3folderset("'+encodeURIComponent(d.nx)+'")>'+s+"</a></span></div>"}else{var p=s;l="<div class=filelist file=3><input style=float:left name=fcx class=fcb type=checkbox onchange=d3setActions() value='"+d.nx+"'> <span style=float:right>"+k+"</span><span><div class=fileIcon"+d.t+"></div>"+p+"</span></div>"}if(d.t<3){m+=l}else{n+=l}}QH("d3serverfiles",m+n);QE("p3FolderUp",d3filetreelocation.length>0);d3setActions()}function d3folderset(a){d3filetreelocation.push(decodeURIComponent(a));d3updatefiles()}function d3folderup(a){if(a==null){d3filetreelocation.pop()}else{while(d3filetreelocation.length>a){d3filetreelocation.pop()}}d3updatefiles()}function d3getFileSel(){var a=[];var b=document.getElementsByName("fcx");for(var c=0;c<b.length;c++){if(b[c].checked){a.push(b[c].value)}}return a}function d3setActions(){var a=Q("d3uploadMode").value;if(a==1){QE("idx_dlgOkButton",Q("d3localFile").value.length>0)}else{QE("idx_dlgOkButton",d3getFileSel().length==1)}}var notifications=[];function clickNotificationIcon(a){if(a==true){QV("notifiyBox",true)}else{if(a==false){QV("notifiyBox",false)}else{QV("notifiyBox",QS("notifiyBox")["display"]=="none")}}drawNotifications()}function setNotificationCount(a){if(parseInt(Q("notificationCount").innerHTML)==a){return}QH("notificationCount",a);QS("notificationCount")["background-color"]=(a==0)?"lightblue":"orange";QV("notificationCount",a>0)}function drawNotifications(){var h="";if(notifications.length==0){h="<div style=margin:5px>There are currently no notifications</div>"}else{for(var c in notifications){var f=notifications[c];var j="";var a=new Date(f.time);var e=0;if(f.nodeid!=null){var g=getNodeFromId(f.nodeid);if(g!=null){e=g.icon;j="<b>"+g.name+"</b>: "}}h+='<div title="Occured at '+a.toLocaleString()+'" id="notifyx'+f.id+'" class=notification style="cursor:pointer;border-top:1px solid '+((h=="")?"transparent":"orange")+'"><div class=j'+e+' onclick="notificationSelected('+f.id+')" style=margin:5px;float:left></div><div onclick="notificationDelete('+f.id+')" class=unselectable title="Clear this notification" style=margin:5px;float:right;color:orange><b>X</b></div><div onclick="notificationSelected('+f.id+')" style=margin:5px>'+j+f.text+"</div></div>"}}var b="";if(notifications.length>1){b='<div id="notifyRemoveAll" onclick="deleteAllNotifications()" style="cursor:pointer;border-top:1px solid orange;margin:5px;color:orange;text-align:right;padding-right:3px">Clear all</div>'}QH("notifiyBox",'<div class=customScroll style="max-height:170px;overflow-y:auto;margin:5px">'+h+"</div>"+b)}function notificationSelected(b){var c=-1;for(var a in notifications){if(notifications[a].id==b){c=a}}if(c!=-1){var d=notifications[c];if(d.nodeid!=null){if(d.tag=="desktop"){gotoDevice(d.nodeid,12)}else{if(d.tag=="terminal"){gotoDevice(d.nodeid,11)}else{if(d.tag=="files"){gotoDevice(d.nodeid,13)}else{if(d.tag=="intelamt"){gotoDevice(d.nodeid,14)}else{if(d.tag=="console"){gotoDevice(d.nodeid,15)}else{gotoDevice(d.nodeid,10)}}}}}}else{if(d.tag.startsWith("meshmessenger/")){window.open("/messenger?id="+d.tag+"&title="+encodeURIComponent(d.username),d.tag.split("/")[2]);notificationDelete(b)}}}}function notificationDelete(c){var d=-1,a=Q("notifyx"+c);if(a!=null){for(var b in notifications){if(notifications[b].id==c){d=b}}if(d!=-1){notifications.splice(d,1);a.parentNode.removeChild(a);setNotificationCount(notifications.length);if(notifications.length==0){QV("notifiyBox",false)}if(notifications.length==1){QV("notifyRemoveAll",false)}if((notifications.length>0)&&(d==0)){var f=notifications[0];QS("notifyx"+f.id)["border-top"]="1px solid transparent"}}}}function addNotification(a){if(a.time==null){a.time=Date.now()}if(a.id==null){a.id=Math.random()}notifications.unshift(a);setNotificationCount(notifications.length);Q("chimes").play();clickNotificationIcon(true)}function deleteAllNotifications(){notifications=[];setNotificationCount(0);drawNotifications();QV("notifiyBox",false)}function setupServerStats(){window.serverStatCpu=new Chart(document.getElementById("serverCpuChart").getContext("2d"),{type:"doughnut",data:{datasets:[{data:[0,0],backgroundColor:["#AAAAAA","#00AA00"]}],labels:["Used","Free"]},options:{responsive:true,legend:{position:"none",},animation:{animateScale:true,animateRotate:true},width:"60px"}});window.serverStatMemory=new Chart(document.getElementById("serverMemoryChart").getContext("2d"),{type:"doughnut",data:{datasets:[{data:[0,0],backgroundColor:["#AAAAAA","#00AA00"]}],labels:["Used","Free"]},options:{responsive:true,legend:{position:"none",},animation:{animateScale:true,animateRotate:true},width:"60px"}})}var lastServerStats=null;function updateServerStats(d){if(d!=null){lastServerStats=d}else{d=lastServerStats}if(d==null){return}if(typeof d.cpuavg=="object"){var c=Math.min(d.cpuavg[0],1);window.serverStatCpu.config.data.datasets[0].data=[c,1-c];QH("serverCpuChartText",'<div style=margin-bottom:5px>CPU Load</div><div><b title="CPU load in the last minute">'+(Math.round(d.cpuavg[0]*100)/100)+'</b>, <b title="CPU load in the last 5 minutes">'+(Math.round(d.cpuavg[1]*100)/100)+'</b>, <b title="CPU load in the 15 minutes">'+(Math.round(d.cpuavg[2]*100)/100)+"</b></div>");QS("serverCpuChartView")["display"]="inline-block";window.serverStatCpu.update()}if((typeof d.totalmem=="number")&&(typeof d.freemem=="number")){window.serverStatMemory.config.data.datasets[0].data=[d.totalmem-d.freemem,d.freemem];QH("serverMemoryChartText","<div style=margin-bottom:5px>Memory</div><div><b>"+getNiceSize2(d.freemem)+"</b> free, <b>"+getNiceSize2(d.totalmem)+"</b> total</div>");QS("serverMemoryChartView")["display"]="inline-block";window.serverStatMemory.update()}var e="<div style=width:100% cellpadding=0 cellspacing=0>";if(typeof d.values=="object"){for(var a in d.values){e+="<div class=userTableHeader style=margin-bottom:4px;width:200px>"+a+"</div>";for(var b in d.values[a]){e+="<div style=display:inline-block><table style=width:300px;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0><tr><td class=h1></td><td><span>"+b+"</span><span style=float:right>"+d.values[a][b]+"</span></td><td class=h2></td></tr></table></div>"}}}e+="</div>";QH("serverStatsTable",e)}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;var xxcurrentView=0;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgDeleteButton",a&4);QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc,a=xxdialogButtons,d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-400)/2))+"px");if(xxcurrentView==11){deskAdjust();deskAdjust()}else{if(xxcurrentView==10){drawDeviceTimeline()}else{if(xxcurrentView==1){updateDevicesEx()}}}}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function goBack(){if(xxdialogMode){return}if((xxcurrentView>=10)&&(xxcurrentView<20)){go(1)}if((xxcurrentView>=20)&&(xxcurrentView<30)){go(2)}if((xxcurrentView>=30)&&(xxcurrentView<40)){go(4)}}function go(d){if(xxdialogMode||xxcurrentView==d){return}for(var a=0;a<32;a++){QV("p"+a,a==d)}xxcurrentView=d;var b=["LeftMenuMyDevices","LeftMenuMyAccount","LeftMenuMyEvents","LeftMenuMyFiles","LeftMenuMyUsers","LeftMenuMyServer"];for(var a in b){Q(b[a]).classList.remove("lbbuttonsel");Q(b[a]).classList.remove("lbbuttonsel2")}QV("topbar",d!=0);if(d>=10&&d<20){QS("MainMenuMyDevices").backgroundColor="#606060"}else{QS("MainMenuMyDevices").backgroundColor=((d==1)?"#003366":"#808080")}if(d==1||(d>=10&&d<20)){Q("LeftMenuMyDevices").classList.add("lbbuttonsel")}if(d==1){Q("LeftMenuMyDevices").classList.add("lbbuttonsel2")}if(d>=20&&d<30){QS("MainMenuMyAccount").backgroundColor="#606060"}else{QS("MainMenuMyAccount").backgroundColor=((d==2)?"#003366":"#808080")}if(d==2||(d>=20&&d<30)){Q("LeftMenuMyAccount").classList.add("lbbuttonsel")}if(d==2){Q("LeftMenuMyAccount").classList.add("lbbuttonsel2")}QS("MainMenuMyEvents").backgroundColor=((d==3)?"#003366":"#808080");if(d==3){Q("LeftMenuMyEvents").classList.add("lbbuttonsel","lbbuttonsel2")}if(d>=30&&d<40){QS("MainMenuMyUsers").backgroundColor="#606060"}else{QS("MainMenuMyUsers").backgroundColor=((d==4)?"#003366":"#808080")}if(d==4||(d>=30&&d<40)){Q("LeftMenuMyUsers").classList.add("lbbuttonsel")}if(d==4){Q("LeftMenuMyUsers").classList.add("lbbuttonsel2")}QS("MainMenuMyFiles").backgroundColor=((d==5)?"#003366":"#808080");if(d==5){Q("LeftMenuMyFiles").classList.add("lbbuttonsel","lbbuttonsel2")}QS("MainMenuMyServer").backgroundColor=((d==6)?"#003366":"#808080");if(d==6){Q("LeftMenuMyServer").classList.add("lbbuttonsel","lbbuttonsel2")}if(webPageFullScreen){QS("column_l")["max-height"]="calc(100vh - 135px)"}else{QS("column_l")["max-height"]=(d>=10)?"calc(100vh - 159px)":"calc(100vh - 135px)"}if((d==0)&&(webPageFullScreen)){QS("page_content").position="";QV("page_leftbar",false);QS("column_l").height="calc(100vh - 110px)";QS("column_l")["max-height"]=""}QV("MainSubMenuSpan",d>=10&&d<20);QV("UserDummyMenuSpan",(d<10)&&webPageFullScreen);QV("MeshSubMenuSpan",d>=20&&d<30);QV("UserSubMenuSpan",d>=30&&d<40);var c={10:"MainDev",11:"MainDevDesktop",12:"MainDevTerminal",13:"MainDevFiles",14:"MainDevAmt",15:"MainDevConsole",20:"MeshGeneral",30:"UserGeneral",31:"UserEvents"};for(var a in c){Q(c[a]).classList.remove("style3x");Q(c[a]).classList.remove("style3sel");Q(c[a]).classList.add((d==a)?"style3sel":"style3x")}if(d==1){updateDevicesEx()}}function joinPaths(){var c=[];for(var a in arguments){var b=arguments[a];if((b!=null)&&(b!="")){while(b.endsWith("/")||b.endsWith("\\")){b=b.substring(0,b.length-1)}while(b.startsWith("/")||b.startsWith("\\")){b=b.substring(1)}c.push(b)}}return c.join("/")}function putstore(b,c){try{if(typeof(localStorage)==="undefined"){return}localStorage.setItem(b,c)}catch(a){}}function getstore(b,d){try{if(typeof(localStorage)==="undefined"){return d}var c=localStorage.getItem(b);if((c==null)||(c==null)){return d}return c}catch(a){return d}}function addLink(b,a){return"<span style=cursor:pointer;text-decoration:none onclick='"+a+"'>"+b+" <img class=hoverButton src=images/link5.png></span>"}function addLinkConditional(d,b,a){if(a){return addLink(d,b)}return d}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function addOption(c,d,a){var b=document.createElement("option");b.text=d;b.value=a;Q(c).add(b)}function passwordcheck(a){return(a.length>7)&&(/\d/.test(a))&&(/[a-z]/.test(a))&&(/[A-Z]/.test(a))&&(/\W/.test(a))}function methodcheck(a){if(a&&a!=null&&a.Body&&a.Body.ReturnValueStr!="SUCCESS"){messagebox("Call Error",a.Header.Method+": "+a.Body.ReturnValueStr.replace("_"," "));return true}return false}function TableStart(){return"<table cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=200px><p><td>"}function TableStart2(){return"<table cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><p><td>"}function TableEntry(a,b){return"<tr><td><p>"+a+"<td>"+b}function FullTable(c,a){var b=TableStart();for(i in c){if(i&&c[i]){b+=TableEntry(i,c[i])}}return b+TableEnd(a)}function TableEnd(a){return"<tr><td colspan=2><p>"+(a?a:"")+"</table>"}function AddButton(b,a){return"<input type=button value='"+b+"' onclick='"+a+"' style=margin:4px>"}function AddButton2(b,a){return"<input type=button value='"+b+"' onclick='"+a+"'>"}function AddRefreshButton(a){return"<input type=button name=refreshbtn value=Refresh onclick='refreshButtons(false);"+a+"' style=margin:4px "+(refreshButtonsState==false?"disabled":"")+">"}function MoreStart(){return'<a style=cursor:pointer;color:blue id=morexxx1 onclick=QV("morexxx1",false);QV("morexxx2",true)>▼ More</a><div id=morexxx2 style=display:none><br><hr>'}function MoreEnd(){return'<a style=cursor:pointer;color:blue onclick=QV("morexxx2",false);QV("morexxx1",true)>▲ Less</a></div>'}function getSelectedOptions(e){var d=[],c;for(var a=0,b=e.options.length;a<b;a++){c=e.options[a];if(c.selected){d.push(c.value)}}return d}function getInstance(b,c){for(var a in b){if(b[a]["InstanceID"]==c){return b[a]}}return null}function getItem(b,c,d){for(var a in b){if(b[a][c]==d){return b[a]}}return null}function guidToStr(a){return a.substring(6,8)+a.substring(4,6)+a.substring(2,4)+a.substring(0,2)+"-"+a.substring(10,12)+a.substring(8,10)+"-"+a.substring(14,16)+a.substring(12,14)+"-"+a.substring(16,20)+"-"+a.substring(20)}function getUrlVars(){var d,a,e=[],b=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(var c=0;c<b.length;c++){d=b[c].indexOf("=");if(d>0){e[b[c].substring(0,d)]=b[c].substring(d+1,b[c].length)}}return e}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function addHtmlValue(a,b){return"<table><td style=width:120px>"+a+"<td><b>"+b+"</b></table>"}function addHtmlValue2(a,b){return"<div><div style=display:inline-block;float:right>"+b+"</div><div style=display:inline-block>"+a+"</div></div>"}function parseUriArgs(){var a,c={},b=window.document.location.href.split(/[\?&|\=]/);b.splice(0,1);for(d in b){switch(d%2){case 0:a=b[d];break;case 1:c[a]=b[d];var d=parseInt(c[a]);if(d==c[a]){c[a]=d}break;default:break}}return c}function focusTextBox(a){setTimeout(function(){Q(a).selectionStart=Q(a).selectionEnd=65535;Q(a).focus()},0)}function validateEmail(b){var a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return a.test(b)};</script></body></html>
\ No newline at end of file
1
+<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <style>body{margin:0;padding:0;border:0;color:black;font-size:13px;font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;background-color:#d3d9d6;}#container{background-color:#fff;width:960px;min-width:960px;margin:0 auto;border-top:0;border-right:1px solid #b7b7b7;border-bottom:0;border-left:1px solid #b7b7b7;padding:0;}#masthead{width:auto;margin:0;padding:0;overflow:auto;text-align:right;background-color:#036;width:960px;}#column_l{position:relative;float:left;width:930px;margin:0;padding:0 15px;background-color:#fff;}#footer{clear:both;overflow:auto;width:100%;text-align:center;background-color:#113962;padding-top:5px;padding-bottom:5px;}#masthead img{float:left;}#masthead p{font-size:11px;color:#fff;margin:10px 10px 0;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}a{color:#036;text-decoration:underline;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;cursor:pointer;border:none;}.j1{background:url(../images/icons16.png) 0px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j2{background:url(../images/icons16.png) -16px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j3{background:url(../images/icons16.png) -32px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j4{background:url(../images/icons16.png) -48px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j5{background:url(../images/icons16.png) -64px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j6{background:url(../images/icons16.png) -80px 0px;height:16px;width:16px;cursor:pointer;border:none;}.lbbutton{width:74px;height:74px;border-radius:5px;background-color:white;margin-left:8px;margin-top:8px;position:relative;cursor:pointer;opacity:0.5;}.lbbutton:hover{opacity:1;}.lbbuttonsel{opacity:0.9;}.lbbuttonsel2{width:82px;border-radius:5px 0px 0px 5px;opacity:1;}.lb1{background:url(../images/leftbar-62.jpg) -0px 0px;height:62px;width:62px;cursor:pointer;border:none;}.lb2{background:url(../images/leftbar-62.jpg) -75px 0px;height:62px;width:62px;cursor:pointer;border:none;}.lb3{background:url(../images/leftbar-62.jpg) -150px 0px;height:62px;width:62px;cursor:pointer;border:none;}.lb4{background:url(../images/leftbar-62.jpg) -225px 0px;height:62px;width:62px;cursor:pointer;border:none;}.lb5{background:url(../images/leftbar-62.jpg) -294px 0px;height:62px;width:62px;cursor:pointer;border:none;}.lb6{background:url(../images/leftbar-62.jpg) -360px 0px;height:62px;width:62px;cursor:pointer;border:none;}.m0{background :url(../images/images16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.m1{background :url(../images/images16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.m2{background :url(../images/images16.png) -96px 0px;height :16px;width :16px;border:none;float:left }.m3{background :url(../images/images16.png) -112px 0px;height :16px;width :16px;border:none;float:left }.si0{background :url(../images/icons16.png) 0px 0px;height :16px;width :16px;border:none;float:left }.si1{background :url(../images/icons16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.si2{background :url(../images/icons16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.si3{background :url(../images/icons16.png) -48px 0px;height :16px;width :16px;border:none;float:left }.si4{background :url(../images/icons16.png) -64px 0px;height :16px;width :16px;border:none;float:left }.mi{background :url(../images/meshicon50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none }#floatframe{position:fixed;top:200px;height:300px;z-index:200;display:none;}.style1{text-align:center;}.style2{text-align:center;background-color:#808080;font-weight:bold;}.style3{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style3x{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style3x:hover{background-color:#606060;}.style3sel{text-align:center;color:white;background-color:#003366;font-weight:bold;}.style4{color:white;text-decoration:none;}.style5{text-align:center;background-color:#808080;font-weight:normal;}.style6{text-align:center;background-color:#D3D9D6;}.style7{font-size:large;background-color:#FFFFFF;}.style10{background-color:#C9C9C9;}.style11{font-size:large;background-color:#C9C9C9;}.style14{text-align:left;background-color:#D3D9D6;}.auto-style1{text-align:right;background-color:#D3D9D6;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fsize{float:right;text-align:right;width:180px;}.g1{background-position:0% 0%;width:14px;height:100%;float:left; background-image:linear-gradient(to right, #ffffff 0%, #c9c9c9 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.g1s{background-image:linear-gradient(to right, #ffffff 0%, #b9b9b9 100%);}.g2{background-position:0% 0%;width:14px;height:100%;float:right; background-image:linear-gradient(to right, #c9c9c9 0%, #ffffff 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}.g2s{background-image:linear-gradient(to right, #b9b9b9 0%, #ffffff 100%);}.h1{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #ffffff 0%, #d3d9d6 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.h2{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #d3d9d6 0%, #ffffff 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.e1{font-size:large;margin-top:4px;margin-bottom:3px;overflow:hidden;word-wrap:hyphenate;white-space:nowrap;text-overflow:ellipsis;}.e2{float:left;height:100%;background-color:#c9c9c9;}.e2s{background-color:#b9b9b9;}.bar{font-size:large;background-color:#C9C9C9;height:24px;float:left;margin-bottom:2px;}.bar2{font-size:large;height:24px;float:left;margin-bottom:2px;}.bar18{font-size:large;background-color:#C9C9C9;height:18px;float:left;margin-bottom:2px;}.bar182{font-size:large;height:18px;float:left;margin-bottom:2px;}.devHeaderx{color:lightgray;}.DevSt{border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.contextMenu{background:#F9F9F9;box-shadow:0 0 12px rgba( 0, 0, 0, .3 );border:1px solid #ccc; display:none;position:absolute;top:0;left:0;list-style:none;margin:0;padding:5px;min-width:100px;max-width:150px;z-index:500;}.cmtext{color:#444;display:inline-block;padding-left:8px;padding-right:8px;padding-top:5px;padding-bottom:5px;text-decoration:none;width:85%;cursor:default;overflow:hidden;position:relative;}.cmtext:hover{color:#f9f9f9;background:#444;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.notifiyBox{position:absolute;z-index:1000;top:50px;right:26px;width:300px;text-align:left;background-color:#F0ECCD;border:4px solid #666;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-box-shadow:2px 2px 4px #888;-moz-box-shadow:2px 2px 4px #888;box-shadow:2px 2px 4px #888;max-height:200px;}.notifiyBox:before{content:' ';position:absolute;width:0;height:0;right:5px;top:-30px;border:15px solid;border-color:transparent #666 #666 transparent;}.notifiyBox:after{content:' ';position:absolute;width:0;height:0;right:7px;top:-24px;border:12px solid;border-color:transparent #F0ECCD #F0ECCD transparent;}.notification{width:100%;min-height:30px;}.notification:hover{background-color:#EFE8B6;}.deskToolsBar{padding:3px;}.deskToolsBar:hover{background-color:#EFE8B6;}.userTableHeader{border-bottom:1pt solid lightgray;padding-top:4px;padding-bottom:4px;}.viewSelector{width:32px;height:32px;background-color:#DDD;border-radius:3px;float:left;margin-left:5px;cursor:pointer;opacity:0.3;}.viewSelectorSel{background-color:#BBB;opacity:0.8;}.viewSelector:hover{opacity:0.5;background-color:#AAA;}.viewSelector1{margin-left:2px;margin-top:2px;background:url(../images/views.png) -0px 0px;height:28px;width:28px;}.viewSelector2{margin-left:2px;margin-top:2px;background:url(../images/views.png) -28px 0px;height:28px;width:28px;}.viewSelector3{margin-left:2px;margin-top:2px;background:url(../images/views.png) -56px 0px;height:28px;width:28px;}.viewSelector4{margin-left:2px;margin-top:2px;background:url(../images/views.png) -84px 0px;height:28px;width:28px;}.viewSelector5{margin-left:2px;margin-top:2px;background:url(../images/views.png) -112px 0px;height:28px;width:28px;}.backButtonEx{margin-left:2px;margin-top:2px;background:url(../images/views.png) -140px 0px;height:28px;width:28px;}.backButton{width:32px;height:32px;background-color:#DDD;border-radius:3px;float:left;margin-right:5px;cursor:pointer;opacity:0.3;}.backButton:hover{opacity:0.5;background-color:#AAA;}.hoverButton{opacity:0.5;}.hoverButton:hover{opacity:1;}</style> <style>.ol-box{box-sizing:border-box;border-radius:2px;border:2px solid #00f;}.ol-mouse-position{top:8px;right:8px;position:absolute;}.ol-scale-line{background:rgba(0,60,136,.3);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute;}.ol-scale-line-inner{border:1px solid #eee;border-top:none;color:#eee;font-size:10px;text-align:center;margin:1px;will-change:contents,width;}.ol-overlay-container{will-change:left,right,top,bottom;}.ol-unsupported{display:none;}.ol-unselectable, .ol-viewport{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto;}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing;}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab;}.ol-control{position:absolute;background-color:rgba(255,255,255,.4);border-radius:4px;padding:2px;}.ol-control:hover{background-color:rgba(255,255,255,.6);}.ol-zoom{top:.5em;right:.5em;}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear;}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s;}.ol-zoom-extent{top:4.643em;left:.5em;}.ol-full-screen{right:.5em;top:.5em;}@media print{.ol-control{display:none;}}.ol-control button{display:block;margin:1px;padding:0;color:#fff;font-size:1.14em;font-weight:700;text-decoration:none;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:rgba(0,60,136,.5);border:none;border-radius:2px;}.ol-control button::-moz-focus-inner{border:none;padding:0;}.ol-zoom-extent button{line-height:1.4em;}.ol-compass{display:block;font-weight:400;font-size:1.2em;will-change:transform;}.ol-touch .ol-control button{font-size:1.5em;}.ol-touch .ol-zoom-extent{top:5.5em;}.ol-control button:focus, .ol-control button:hover{text-decoration:none;background-color:rgba(0,60,136,.7);}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0;}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px;}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);}.ol-attribution ul{margin:0;padding:0 .5em;font-size:.7rem;line-height:1.375em;color:#000;text-shadow:0 0 2px #fff;}.ol-attribution li{display:inline;list-style:none;line-height:inherit;}.ol-attribution li:not(:last-child):after{content:" ";}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle;}.ol-attribution button, .ol-attribution ul{display:inline-block;}.ol-attribution.ol-collapsed ul{display:none;}.ol-attribution.ol-logo-only ul{display:block;}.ol-attribution:not(.ol-collapsed){background:rgba(255,255,255,.8);}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0;height:1.1em;line-height:1em;}.ol-attribution.ol-logo-only{background:0 0;bottom:.4em;height:1.1em;line-height:1em;}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em;}.ol-attribution.ol-logo-only button, .ol-attribution.ol-uncollapsible button{display:none;}.ol-zoomslider{top:4.5em;left:.5em;height:200px;}.ol-zoomslider button{position:relative;height:10px;}.ol-touch .ol-zoomslider{top:5.5em;}.ol-overviewmap{left:.5em;bottom:.5em;}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0;}.ol-overviewmap .ol-overviewmap-map, .ol-overviewmap button{display:inline-block;}.ol-overviewmap .ol-overviewmap-map{border:1px solid #7b98bc;height:150px;margin:2px;width:150px;}.ol-overviewmap:not(.ol-collapsed) button{bottom:1px;left:2px;position:absolute;}.ol-overviewmap.ol-collapsed .ol-overviewmap-map, .ol-overviewmap.ol-uncollapsible button{display:none;}.ol-overviewmap:not(.ol-collapsed){background:rgba(255,255,255,.8);}.ol-overviewmap-box{border:2px dotted rgba(0,60,136,.7);}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move;}</style> <style> .ol-ctx-menu-container{position:absolute;padding:8px;background:#fff;color:#222;font-size:13px;border-radius:5px;box-shadow:3px 3px 5px rgba(0,0,0,.2);box-sizing:border-box}.ol-ctx-menu-container a,.ol-ctx-menu-container div,.ol-ctx-menu-container img,.ol-ctx-menu-container li,.ol-ctx-menu-container span,.ol-ctx-menu-container ul{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}.ol-ctx-menu-container a img{border:none}.ol-ctx-menu-container *,.ol-ctx-menu-container :after,.ol-ctx-menu-container :before{box-sizing:inherit}.ol-ctx-menu-container.ol-ctx-menu-hidden{opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container ul{list-style:none}.ol-ctx-menu-container li{position:relative;line-height:20px;padding:2px 5px}.ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover{cursor:pointer;background-color:#333;color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-submenu .ol-ctx-menu-container{border:1px solid #eee;padding:8px;top:0;opacity:0;visibility:hidden;-webkit-transition:visibility 0s linear .3s,opacity .3s;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover .ol-ctx-menu-container{opacity:1;visibility:visible;-webkit-transition-delay:0s;transition-delay:0s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:after{position:absolute;top:7px;right:10px;content:"";display:inline-block;width:.6em;height:.6em;border-right:.3em solid #222;border-top:.3em solid #222;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover:after{border-color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-separator{padding:0}.ol-ctx-menu-container li.ol-ctx-menu-separator hr{border:0;height:1px;background-image:-webkit-linear-gradient(right,transparent,rgba(0,0,0,.75),transparent);background-image:linear-gradient(270deg,transparent,rgba(0,0,0,.75),transparent)}.ol-ctx-menu-icon{text-indent:20px;background-size:20px auto;background-repeat:no-repeat;background-position:0}.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg==")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII=")}.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC")}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC")}</style> <script type="text/javascript" src="scripts/charts.js"></script> <script type="text/javascript" src="scripts/filesaver.1.1.20151003.js"></script> <script type="text/javascript" src="scripts/ol.js"></script> <script type="text/javascript" src="scripts/ol3-contextmenu.js"></script> <title>MeshCentral</title> </head> <body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none"> <div id="contextMenu" class="contextMenu" style="display:none"> <div id="cxinfo" class="cmtext" onclick="cmaction(1)"><b>Information</b></div> <div id="cxdesktop" class="cmtext" onclick="cmaction(3)">Desktop</div> <div id="cxterminal" class="cmtext" onclick="cmaction(2)">Terminal</div> <div id="cxfiles" class="cmtext" onclick="cmaction(4)">Files</div> <div id="cxevents" class="cmtext" onclick="cmaction(5)">Events</div> <div id="cxconsole" class="cmtext" onclick="cmaction(6)">Console</div> <hr id="cxmgroupsplit"> <div id="cxmdesktop" class="cmtext" onclick="cmaction(7)" style="display:none">Multi-Desktop</div> </div> <div id="meshContextMenu" class="contextMenu" style="display:none;min-width:0px"> <div id="cxselectall" class="cmtext" onclick="cmmeshaction(1)">Select All</div> <div id="cxselectnone" class="cmtext" onclick="cmmeshaction(2)">Select None</div> <hr id="cxmgroupsplit2" style="display:none"> <div id="cxmmdesktop" class="cmtext" style="display:none" onclick="cmmeshaction(3)">Multi-Desktop</div> </div> <div id="container" style="max-height:100vh;position:relative"> <div id="notifiyBox" class="notifiyBox" style="display:none"></div> <div id="mastheadx"></div> <div id="masthead" class="noselect" style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px"> <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px"> <strong><font style="font-size:14px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> <div style="float:right"> <div id="notificationCount" onclick="clickNotificationIcon()" class="unselectable" style="display:none;min-width:28px;font-size:20px;border-radius:5px;background-color:lightblue;text-align:center;margin:8px;cursor:pointer;padding:4px" title="Click to view current notifications">0</div> </div> <p id="logoutControl">{{{logoutControl}}}</p> </div> <div id="page_leftbar" style="height:calc(100vh - 66px);width:90px;position:absolute;z-index:1000;background:#113962;background:linear-gradient(to bottom, #104893 0%,#113962 100%);color:white;display:none"> <div style="height:16px"></div> <div id="LeftMenuMyDevices" class="lbbutton lbbuttonsel" title="My Devices" onclick="go(1)"> <div class="lb2" style="position:absolute;top:6px;left:6px"></div> </div> <div id="LeftMenuMyAccount" class="lbbutton" title="My Account" onclick="go(2)"> <div class="lb1" style="position:absolute;top:6px;left:6px"></div> </div> <div id="LeftMenuMyEvents" class="lbbutton" title="My Events" onclick="go(3)"> <div class="lb3" style="position:absolute;top:6px;left:6px"></div> </div> <div id="LeftMenuMyFiles" class="lbbutton" title="My Files" onclick="go(5)"> <div class="lb4" style="position:absolute;top:6px;left:6px"></div> </div> <div id="LeftMenuMyUsers" class="lbbutton" title="My Users" onclick="go(4)"> <div class="lb5" style="position:absolute;top:6px;left:6px"></div> </div> <div id="LeftMenuMyServer" class="lbbutton" title="My Server" onclick="go(6)" style="display:none"> <div class="lb6" style="position:absolute;top:6px;left:6px"></div> </div> </div> <div id="page_content" style="max-height:calc(100vh - 130px)"> <div id="topbarmaster"> <div id="topbar" class="noselect"> <div> <div style="position:relative"> <div style="position:absolute;top:3px;right:6px"> <span title="Toggle full width" style="cursor:pointer;color:white" onclick="toggleFullScreen(1)">↔</span> </div> <table id="MainMenuSpan" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MainMenuMyDevices" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(1)">My Devices</td> <td id="MainMenuMyAccount" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(2)">My Account</td> <td id="MainMenuMyEvents" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(3)">My Events</td> <td id="MainMenuMyFiles" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(5)">My Files</td> <td id="MainMenuMyUsers" style="width:100px;height:24px;cursor:pointer;display:none" class="style3x" onclick="go(4)">My Users</td> <td id="MainMenuMyServer" style="width:100px;height:24px;cursor:pointer;display:none" class="style3x" onclick="go(6)">My Server</td> <td class="style3" style="text-align:right;height:24px"> </td> </tr> </table> <div id="MainSubMenuSpan" style="display:none"> <table id="MainSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MainDev" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(10)">General</td> <td id="MainDevDesktop" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(11)">Desktop</td> <td id="MainDevTerminal" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(12)">Terminal</td> <td id="MainDevFiles" style="width:100px;height:24px;cursor:pointer;display:none" class="style3x" onclick="go(13)">Files</td> <td id="MainDevEvents" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(16)">Events</td> <td id="MainDevAmt" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(14)">Intel® AMT</td> <td id="MainDevConsole" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(15)">Console</td> <td class="style3" style="height:24px"> </td> </tr> </table> </div> <div id="MeshSubMenuSpan" style="display:none"> <table id="MeshSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="MeshGeneral" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(20)">General</td> <td class="style3" style="height:24px"> </td> </tr> </table> </div> <div id="UserSubMenuSpan" style="display:none"> <table id="UserSubMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr> <td id="UserGeneral" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(30)">General</td> <td id="UserEvents" style="width:100px;height:24px;cursor:pointer" class="style3x" onclick="go(31)">Events</td> <td class="style3" style="height:24px"> </td> </tr> </table> </div> <div id="UserDummyMenuSpan"> <table id="UserDummyMenu" style="width:100%;height:22px" cellpadding="0" cellspacing="0" class="style1"> <tr><td class="style3" style="text-align:right;height:24px"> </td></tr> </table> </div> </div> </div> </div> </div> <div id="column_l"> <div id="p0" style="display:none"> <div id="p0message" style="margin:50px;text-align:center">Server disconnected, <href onclick="reload()" style="cursor:pointer"><u>click to reconnect</u></href>.</div> </div> <div id="p1" style="display:none"> <div style="float:right;display:none" id="devListToolbarViewIcons"> <div id="devViewButton1" class="viewSelector" onclick="onDeviceViewChange(1)" title="Columns"><div class="viewSelector2"></div></div> <div id="devViewButton2" class="viewSelector" onclick="onDeviceViewChange(2)" title="List"><div class="viewSelector1"></div></div> <div id="devViewButton3" class="viewSelector" onclick="onDeviceViewChange(3)" title="Desktops"><div class="viewSelector3"></div></div> <div id="devViewButton4" class="viewSelector" onclick="onDeviceViewChange(4)" title="Map"><div class="viewSelector4"></div></div> </div><div><h1>My Devices</h1></div> <table style="width:100%;height:24px;background-color:#d3d9d6;vertical-align:middle;border-spacing:0"> <tr> <td class="h1"></td> <td id="devListToolbar" class="style14" style="display:none"> <input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All"> <input type="button" id="GroupActionButton" disabled="disabled" value="Group Action" onclick="groupActionFunction()"> <input id="SearchInput" type="text" style="width:120px" placeholder="Filter" onchange="masterUpdate(5)" onkeyup="masterUpdate(5)" autocomplete="off" onfocus="onSearchFocus(1)" onblur="onSearchFocus(0)"> <input type="checkbox" id="RealNameCheckBox" onclick="onRealNameCheckBox()"><span title="Show devices operating system name">OS Name</span> </td> <td id="kvmListToolbar" class="style14" style="height:100%;display:none"> <input type="button" onclick="connectAllKvmFunction()" value="Connect All"> <input type="button" onclick="disconnectAllKvmFunction()" value="Disconnect All"> <input type="checkbox" id="autoConnectDesktopCheckbox" onclick="autoConnectDesktops(event)" title="Automatic connect">Auto <input type="button" onclick="showMultiDesktopSettings()" value="Settings"> </td> <td id="devMapToolbar" class="style14" style="height:100%;display:none"> <input type="text" id="mapSearchLocation" placeholder="Search Location" onfocus="onMapSearchFocus(1)" onblur="onMapSearchFocus(0)"> <input type="button" value="Search" title="Search for location" onclick="getSearchLocation()"> <input type="button" id="refreshmap" title="Reset map view" value="Reset" style="margin-left:5px" onclick="refreshMap(false,true)"> </td> <td class="auto-style1" style="height:100%"> <div style="float:right;display:none" id="devListToolbarView"> View <select id="viewselect" onchange="onDeviceViewChange()"> <option value="1">Columns <option value="2">List <option value="3">Desktops <option id="viewselectmapoption" value="4">Map </select> </div> <div style="float:right;display:none" id="devListToolbarSort"> Sort <select id="sortselect" onchange="masterUpdate(6)"> <option>Group <option>Power <option>Device <option>Tags </select> </div> <div style="float:right;display:none" id="devListToolbarSize"> Size <select id="sizeselect" onchange="onDeviceViewChange()"> <option value="0">Small <option value="1">Medium <option value="2">Large </select> </div> </td> <td class="h2"></td> </tr> </table> <div id="NoMeshesPanel" style="display:none"> <table style="width:100%;padding:20px"> <tr> <td valign="top" style="width:50px"> <img src="images/info.png" height="48" width="47"> </td> <td> To get started, <a onclick="account_createMesh()" style="cursor:pointer"><strong>click here to create a device group</strong></a>. </td> </tr> </table> </div> <div id="xdevices" style="max-height:calc(100vh - 239px);overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;display:none"></div> <div id="xdevicesmap" style="height:calc(100vh - 239px);width:100%;overflow:hidden;position:relative;display:none"> <div id="xmapSearchResultsDlg" style="position:absolute;display:none;max-height:280px;left:5px;top:5px;max-width:250px;z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="xmapSearchClose" style="float:right;padding:5px;cursor:pointer" onclick="mapCloseSearchWindow()"><b>X</b></div> <div style="padding:5px">Location Results</div> <div style="width:100%;margin:6px"></div> </div> <div id="xmapSearchResults" style="margin:6px"></div> </div> </div> <div id="xmap-info-window" style="text-shadow:0px 0px 15px #FFF"></div> </div> <div id="p2" style="display:none"> <h1>My Account</h1> <div id="p2AccountActions"> <p><strong><img alt="" width="150" height="103" src="images/mainaccount.jpg" style="margin-bottom:10px;margin-right:20px;float:right">Account actions</strong></p> <p style="margin-left:40px"> <span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a><br></span> <span id="otpAuth" style="display:none"><a onclick="account_addOtp()" style="cursor:pointer">Add 2-step login</a><br></span> <span id="otpAuthRemove" style="display:none"><a onclick="account_removeOtp()" style="cursor:pointer">Remove 2-step login</a><br></span> <a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a><br> <a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><br> <a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a><br> </p> <br style="clear:both"> </div> <strong>Device Groups</strong> ( <a onclick="account_createMesh()" style="cursor:pointer"><img height="12" src="images/icon-addnew.png" width="12" border="0"> New</a> ) <br><br> <div id="p2meshes"></div> <div id="p2noMeshFound" style="margin-left:40px;display:none">No device groups. <a onclick="account_createMesh()" style="cursor:pointer"><strong>Get started here!</strong></a></div> <br style="clear:both"> </div> <div id="p3" style="display:none"> <h1>My Events</h1> <table style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0"> <tr> <td class="h1"></td> <td> <input id="p2deleteall" type="button" onclick="showDeleteAllEventsDialog()" style="display:none" value="Delete All..."></td> <td class="auto-style1"> Show <select id="p3limitdropdown" onchange="refreshEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> </td> <td class="h2"></td> </tr> </table> <div id="p3events" style="height:calc(100vh - 243px);overflow-y:scroll"></div> </div> <div id="p4" style="display:none"> <h1>My Users</h1> <table style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0"> <tr> <td class="h1"></td> <td class="style14"> <input type="button" onclick="showCreateNewAccountDialog()" value="New Account..."> <input id="UserSearchInput" type="text" style="width:120px" placeholder="Filter" onchange="onUserSearchInputChanged()" onkeyup="onUserSearchInputChanged()" autocomplete="off" onfocus="onUserSearchFocus(1)" onblur="onUserSearchFocus(0)"> </td> <td class="h2"></td> </tr> </table> <div id="p3users" style="max-height:calc(100vh - 243px);overflow-y:auto"></div> </div> <div id="p5" style="display:none"> <h1>My Files</h1> <table id="p5toolbar" style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div id="p5rightOfButtons" style="float:right;margin-top:3px"></div> <div> <input type="button" id="p5FolderUp" disabled="disabled" onclick="p5folderup();" value="Up"> <input type="button" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile();" value="Select All" onkeypress="return false;" onkeydown="return false;"> <input type="button" id="p5RenameFileButton" disabled="disabled" value="Rename" onclick="p5renamefile();" onkeypress="return false;" onkeydown="return false;"> <input type="button" id="p5DeleteFileButton" disabled="disabled" value="Delete" onclick="p5deletefile();" onkeypress="return false;" onkeydown="return false;"> <input type="button" id="p5NewFolderButton" disabled="disabled" value="New Folder" onclick="p5createfolder();" onkeypress="return false;" onkeydown="return false;"> <input type="button" id="p5UploadButton" disabled="disabled" value="Upload" onclick="p5uploadFile()" onkeypress="return false;" onkeydown="return false;"> <input type="button" id="p5CutButton" disabled="disabled" value="Cut" onclick="p5copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" id="p5CopyButton" disabled="disabled" value="Copy" onclick="p5copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" id="p5PasteButton" disabled="disabled" value="Paste" onclick="p5pasteFile()" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <div style="float:right"> <select id="p5sortdropdown" onchange="updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </div> <div> <span id="p5currentpath"></span></div> </td> </tr> </table> <div id="p5filetable" style="width:100%;height:calc(100vh - 294px);overflow:auto;-webkit-user-select:none;position:relative"> <div id="p5PublicShare" style="display:none;width:100%;overflow:auto;-webkit-user-select:none;background-color:lightsteelblue"><div style="padding:4px">These files are shared publicly, click "link" to get public url.</div></div> <div id="bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✓</b></div> <div id="bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✗</b></div> <span id="p5files"></span> </div> <table id="p5toolbarBottom" style="width:100%" cellpadding="0" cellspacing="0"> <tr><td class="style6" style="text-align:left;padding:3px"> <span id="p5bottomstatus"></span></td></tr> </table> </div> <div id="p6" style="display:none"> <img id="MainMeshImage" src="serverpic.ashx" style="border-width:0px;height:200px;width:200px;float:right"> <h1>My Server</h1> <p id="p2ServerActions"><strong>Server actions</strong></p> <p style="margin-left:40px"> <a id="p2ServerActionsBackup" href="/backup.zip" rel="noreferrer noopener" target="_blank" style="cursor:pointer">Download server backup</a><br> <a id="p2ServerActionsRestore" onclick="server_showRestoreDlg()" style="cursor:pointer">Restore server with backup</a><br> <a id="p2ServerActionsVersion" onclick="server_showVersionDlg()" style="cursor:pointer">Check server version</a><br> <a id="p2ServerActionsErrors" onclick="server_showErrorsDlg()" style="cursor:pointer">Show server error log</a><br> </p> <br><strong>Server Statistics</strong><br><br> <div id="serverStats" style="margin-left:40px"> <div id="serverCpuChartView" style="display:none"> <div style="width:60px;display:inline-block"><canvas id="serverCpuChart" style="width:60px;height:60px"></canvas></div> <div style="width:160px;display:inline-block" id="serverCpuChartText"></div> </div> <div id="serverMemoryChartView" style="display:none"> <div style="width:60px;display:inline-block"><canvas id="serverMemoryChart" style="width:60px;height:60px"></canvas></div> <div style="width:160px;display:inline-block" id="serverMemoryChartText"></div> </div><br><br> <div id="serverStatsTable"></div> </div> </div> <div id="p10" style="display:none"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:auto" valign="top"> <div id="p10title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>General - <span id="p10deviceName"></span></h1> </div> <div id="p10html"></div> </td> <td style="width:20px"></td> <td style="width:200px"> <a style="cursor:pointer" onclick="p10showiconselector()"><img id="MainComputerImage" style="border-width:0px;height:200px;width:200px"></a> <div style="width:100%;text-align:center"><strong><span id="MainComputerState"></span></strong></div> </td> </tr> </table><br> <div id="p10html2"></div> <div id="p10html3"></div> </div> <div id="p11" class="noselect" style="display:none"> <div id="p11title"> <div id="p11deviceNameHeader"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <div style="float:right" id="devListToolbarViewIcons"><div class="viewSelector" onclick="deskToggleFull(event)" title="Full Screen. Hold shift to browser full screen."><div class="viewSelector5"></div></div></div> <h1>Desktop - <span id="p11deviceName"></span></h1> </div> </div> <div id="p14warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showFeaturesDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel® AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div> </div> <div id="p14warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showPowerActionDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div> </div> <table id="deskarea0" cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr id="deskarea1"> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <span id="p14power"></span> <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Left" onclick="drotate(-1)">↺</div> <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Right" onclick="drotate(1)">↻</div> <input id="deskFocusBtn" type="button" title="Toggle focus mode, when active only the region around the mouse is updated" onkeypress="return false" onkeydown="return false" value="Focus All" onclick="deskToggleFocus()" style="margin-right:3px;display:none"> <input id="deskSaveBtn" type="button" title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value="Save..." onclick="deskSaveImage()" style="margin-right:3px"> <input id="deskActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> <input id="deskActionsSettings" type="button" value="Settings..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()" style="margin-right:3px"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="margin-right:3px;display:none"> </div> <div> <div id="idx_deskFullBtn2" onclick="deskToggleFull(event)" style="float:left;font-size:large;cursor:pointer;display:none"> ✖</div> <input type="button" id="autoconnectbutton1" value="AutoConnect" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <span id="connectbutton1span"> <input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton1hspan"> <input type="button" id="connectbutton1h" value="HW Connect" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="disconnectbutton1span"> <input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span> <span id="deskstatus">Disconnected</span> </div> </td> </tr> <tr id="deskarea2"> <td> <div style="background-color:gray"><div id="progressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr id="deskarea3"> <td id="deskarea3x" style="background:black;text-align:center;position:relative;overflow:hidden"> <div id="DeskFocus" style="overflow:hidden;color:transparent;border:3px dotted rgba(255,0,0,.2);position:absolute;border-radius:5px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)"></div> <div id="DeskParent" style="overflow:hidden"> <canvas id="Desk" width="640" height="480" style="overflow:hidden;width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)" onmousewheel="dmousewheel(event)"></canvas> </div> <div id="DeskTools" style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none"> <a id="DeskToolsRefreshButton" style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a> <div id="DeskToolsBar" style="position:absolute;padding:3px;border-radius:3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div> <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left"> <div style="border-bottom:1px solid darkgray;padding:3px"><a style="width:50px;padding-right:5px;float:left;cursor:pointer" title="Sort by process id" onclick="sortProcess(0)">PID</a><a style="cursor:pointer" title="Sort by name" onclick="sortProcess(1)">Name</a></div> <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div> </div> </div> </td> </tr> <tr id="deskarea4"> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onclick="deskGetDisplayNumbers(event)"></select> <input id="DeskToolsButton" type="button" value="Tools" title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()"> <span id="DeskChatButton" style="float:right;margin-top:1px;margin-right:4px;cursor:pointer" title="Open chat window to this computer"><img src='images/icon-chat.png' onclick="deviceChat()" height="16" width="16" style="padding-top:2px"></span> <span id="DeskNotifyButton" style="float:right;margin-top:1px;margin-right:4px;cursor:pointer" title="Display a notification on the remote computer"><img src='images/icon-notify.png' onclick="deviceToastFunction()" height="16" width="16" style="padding-top:2px"></span> <span id="DeskOpenWebButton" style="float:right;margin-top:1px;margin-right:4px;cursor:pointer" title="Open a web address on remote computer"><img src='images/icon-url2.png' onclick="deviceUrlFunction()" height="16" width="16" style="padding-top:2px"></span> </div> <div> <select style="margin-left:6px" id="deskkeys"> <option value="5">Win <option value="0">Win+Down <option value="1">Win+Up <option value="2">Win+L <option value="3">Win+M <option value="4">Shift+Win+M <option value="6">Win+R </select> <input id="DeskWD" type="button" value="Send" onkeypress="return false" onkeydown="return false" onclick="deskSendKeys()"> <input id="DeskCAD" style="margin-left:6px" type="button" value="Ctrl-Alt-Del" onkeypress="return false" onkeydown="return false" onclick="sendCAD()"> <span id="DeskControlSpan" style="margin-left:6px" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false" onclick="toggleKvmControl()">Input</span> </div> </td> </tr> </table> </div> <div id="p12" style="display:none"> <div id="p12title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Terminal - <span id="p12deviceName"></span></h1> </div> <div id="p12warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showFeaturesDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel® AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div> </div> <div id="p12warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showPowerActionDlg()"> <div class="icon2" style="float:left;margin:7px"></div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div> </div> <table cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <input id="termActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> </div> <div> <input type="button" id="autoconnectbutton2" value="AutoConnect" onclick="autoConnectTerminal(event)" onkeypress="return false" onkeydown="return false" style="display:none"> <span id="connectbutton2span"> <input type="button" id="connectbutton2" value="Connect" onclick="connectTerminal(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="connectbutton2hspan"> <input type="button" id="connectbutton2h" value="HW Connect" onclick="connectTerminal(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id="disconnectbutton2span"> <input type="button" id="disconnectbutton2" value="Disconnect" onclick="connectTerminal(event,0)" onkeypress="return false" onkeydown="return false"></span> <span id="termstatus">Disconnected</span> </div> </td> </tr> <tr> <td> <div style="background-color:gray"><div id="termprogressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr> <td style="background:black;text-align:center;height:500px;position:relative"> <pre id="Term" style="background:black;margin:0;padding:0"></pre> </td> </tr> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <span id="terminalSettingsButtons" style="display:none"> <input id="id_tcrbutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="CR+LF" title="Toggle what the return key will send" onclick="termToggleCr()"> <input id="id_tfxkeysbutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick="termToggleFx()"> <input id="id_ttypebutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Extended Ascii" title="Toggle terminal emulation type" onclick="termToggleType()"> </span> <select id="specialkeylist" onkeypress="return false" style="margin-left:5px"></select> <input id="specialkeylistinput" type="button" onkeypress="return false" class="bottombutton" value="Send" title="Send the selected special key" onclick="sendSpecialKey()"> </div> <div> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlcbutton" value="Ctl-C" onclick="termSendKey(3,'ctrlcbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlxbutton" value="Ctl-X" onclick="termSendKey(24,'ctrlxbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="escbutton" value="ESC" onclick="termSendKey(27,'escbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="bsbutton" value="Backspace" onclick="termSendKey(8,'bsbutton')"> <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="pastebutton" value="Paste" title="Paste text into the terminal" onclick="showTermPasteDialog()"> </div> </td> </tr> </table> </div> <div id="p13" style="display:none"> <div id="p13title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Files - <span id="p13deviceName"></span></h1> </div> <table id="p13toolbar" style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px"> <div style="float:right;text-align:right"> <input id="filesActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:3px"> </div> <div> <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" onkeypress="return false" onkeydown="return false" type="button" style="display:none"> <input id="p13Connect" value="Connect" onclick="connectFiles(event)" onkeypress="return false" onkeydown="return false" type="button"> <span id="p13Status">Disconnected</span> </div> </td> </tr> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div id="p13rightOfButtons" style="float:right;margin-top:3px"></div> <div> <input type="button" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Up"> <input type="button" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="Select All" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13RenameFileButton" disabled="disabled" value="Rename" onclick="p13renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13DeleteFileButton" disabled="disabled" value="Delete" onclick="p13deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13NewFolderButton" disabled="disabled" value="New Folder" onclick="p13createfolder()" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13UploadButton" disabled="disabled" value="Upload" onclick="p13uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13CutButton" disabled="disabled" value="Cut" onclick="p13copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13CopyButton" disabled="disabled" value="Copy" onclick="p13copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13PasteButton" disabled="disabled" value="Paste" onclick="p13pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" id="p13RefreshButton" disabled="disabled" value="Refresh" onclick="p13folderup(9999)" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <div style="float:right"> <select id="p13sortdropdown" onchange="p13updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </div> <div> <span id="p13currentpath"></span></div> </td> </tr> </table> <div id="p13filetable" style="width:100%;height:calc(100vh - 346px);overflow:auto;-webkit-user-select:none"> <div id="p13bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✓</b></div> <div id="p13bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✗</b></div> <span id="p13files"></span> </div> <table id="p13toolbarBottom" style="width:100%" cellpadding="0" cellspacing="0"> <tr><td class="style6" style="text-align:left;padding:3px"> <span id="p13bottomstatus"></span></td></tr> </table> </div> <div id="p14" style="display:none"> <div id="p14title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Intel® AMT - <span id="p14deviceName"></span></h1> </div> <iframe id="p14iframe" style="width:100%;height:calc(100vh - 242px);border:0;overflow:hidden" src="/commander.htm"></iframe> </div> <div id="p15" style="display:none"> <div id="p15title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Console - <span id="p15deviceName"></span></h1> </div> <table cellpadding="0" cellspacing="0" style="width:100%;padding:0px;padding:0px;margin-top:0px"> <tr> <td style="background:#C0C0C0"> <div style="float:right;padding-right:4px"> <div style="padding:4px;display:inline-block" id="p15coreName" title="Information about current core running on this agent"></div> <input type="button" id="p15uploadCore" value="Agent Action" onclick="p15uploadCore(event)" title="Change the agent Java Script code module"> </div> <div id="p15statetext" style="padding:4px"></div> </td> </tr> <tr> <td> <div style="background-color:gray"><div id="consoleprogressbar" style="height:2px;width:0%;background-color:red"></div></div> </td> </tr> <tr> <td id="p15agentConsole" style="background:black;margin:0;padding:0;color:lightgray;width:100%;height:calc(100vh - 296px);max-height:500px;position:relative"> <pre id="p15agentConsoleText" style="position:absolute;margin:0;padding:0;top:0;bottom:0;left:0;right:0;overflow-y:scroll;overflow-x:auto"></pre> </td> </tr> <tr> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <table style="width:100%"> <tr> <td style="width:99%"> <input id="p15consoleText" style="width:100%" onkeyup="p15consoleSend(event)" onfocus="onConsoleFocus(1)" onblur="onConsoleFocus(0)"> </td> <td> </td> <td style="width:1%"><input id="id_p15consoleClear" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Clear" onclick="p15consoleClear()"></td> </tr> </table> </td> </tr> </table> </div> <div id="p16" style="display:none"> <div id="p16title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Events - <span id="p16deviceName"></span></h1> </div> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left"> </div> <div class="h1" style="height:100%;float:left"> </div> <div class="style14" style="height:100%;float:left"> <input type="button" value="Refresh" onclick="refreshDeviceEvents()"> </div> <div class="auto-style1" style="height:100%;float:right"> Show <select id="p16limitdropdown" onchange="refreshDeviceEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right"> </div> </div> </div> <div id="p16events" style="max-height:calc(100vh - 267px);overflow-y:auto"></div> </div> <div id="p20" style="display:none"> <picture id="MainMeshImage" style="border-width:0px;height:200px;width:200px;float:right"> <source type="image/webp" width="200" height="200" srcset="images/webp/mesh-200.webp"> <img alt="" width="200" height="200" src="images/mesh-200.jpg"> </source></picture> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>General - <span id="p20meshName"></span></h1> <p id="p20info"> </div> <div id="p30" style="display:none"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:auto" valign="top"> <div id="p30title"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>General - <span id="p30userName"></span></h1> </div> <div id="p30html"></div> </td> <td style="width:20px"></td> <td style="width:200px"> <picture id="MainUserImage" style="border-width:0px;height:200px;width:200px;float:right"> <source type="image/webp" width="200" height="200" srcset="images/webp/user-200.webp"> <img alt="" width="200" height="200" src="images/user-200.jpg"> </source></picture> <div style="width:100%;text-align:center"><strong><span id="MainUserState"></span></strong></div> </td> </tr> </table><br> <div id="p30html2"></div> <div id="p30html3"></div> </div> <div id="p31" style="display:none"> <div style="float:left"><div class="backButton" onclick="goBack()" title="Back"><div class="backButtonEx"></div></div></div> <h1>Events - <span id="p31userName"></span></h1> <div style="width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px"> <div class="style7" style="width:16px;height:100%;float:left"> </div> <div class="h1" style="height:100%;float:left"> </div> <div class="style14" style="height:100%;float:left"> <input type="button" value="Refresh" onclick="refreshUsersEvents()"> </div> <div class="auto-style1" style="height:100%;float:right"> Show <select id="p31limitdropdown" onchange="refreshUsersEvents()"> <option value="60">Last 60 <option value="120">Last 120 <option value="250">Last 250 <option value="500">Last 500 <option value="1000">Last 1000 </select> <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div> <div class="h2" style="height:100%;float:right;"> </div> </div> </div> <div id="p31events" style="max-height:calc(100vh - 267px);overflow-y:scroll"></div> </div> <br id="column_l_bottomgap"> </div> <div id="footer" class="noselect"> <table cellpadding="0" cellspacing="10" style="width:100%"> <tr> <td style="text-align:left;color:white"> {{{footer}}} </td> <td style="text-align:right"> <a id="verifyEmailId2" style="color:yellow;margin-left:3px;cursor:pointer;display:none" onclick="account_showVerifyEmail()">Verify Email</a> <a style="margin-left:3px" href="terms">Terms & Privacy</a> </td> </tr> </table> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:160px;width:400px;left:calc((100% / 2) - 200px);display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:3px;margin-right:3px;cursor:pointer" onclick="setDialogMode()">✖</div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> <div id="dialog3" style="margin:auto;margin:3px"> <div style="height:26px"> <select id="d3uploadMode" style="float:right;width:260px" onchange="d3modechange()"> <option value="1">Local file upload <option value="2">Server file selection </select> <div>File Selection</div> </div> <div id="d3localmode" style="height:26px;display:none"> <form id="d3localmodeform" method="post" enctype="multipart/form-data" action="uploadfile.ashx" target="fileUploadFrame"> <input type="text" id="d3attrib" name="attrib" style="display:none"> <input type="file" id="d3localFile" name="files" style="float:right;width:260px" onchange="d3setActions()"> <input type="submit" id="d3submit" style="display:none"> </form> <div>Upload File</div> </div> <div id="d3servermode"> <div style="width:100%;background-color:#d3d9d6;text-align:left;padding:3px" valign="bottom"> <input type="button" id="p3FolderUp" disabled="disabled" onclick="d3folderup()" value="Up"> </div> <div id="d3serverfiles" style="width:100%;height:150px;background-color:white;padding:2px;border:1px solid gray;overflow-y:scroll"></div> </div> </div> <div id="dialog7" style="margin:auto;margin:3px"> <div id="d7meshkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Agent Remote Desktop</h4> <div style="margin:3px 0 3px 0"> <select id="d7bitmapquality" style="float:right;width:200px;height:20px" dir="rtl"></select> <div style="height:20px">Quality</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7bitmapscaling" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="1024">100% <option value="896">87.5% <option value="768">75% <option value="640">62.5% <option value="512">50% <option value="384">37.5% <option value="256">25% <option value="128">12.5% </select> <div style="height:20px">Scaling</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7framelimiter" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="50">Fast <option value="100">Medium <option value="400">Slow <option value="1000">Very slow </select> <div style="height:20px">Frame rate</div> </div> </div> <div id="d7amtkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Intel® AMT Hardware KVM</h4> <div style='height:26px'> <select id="d7desktopmode" style="float:right;width:200px"> <option value="1">RLE8, Fastest <option value="2">RLE16, Recommended <option value="3">RAW8, Slow <option value="4">RAW16, Very Slow </select> <div>Image Encoding</div> </div> <div style="height:60px"> <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white"> <input type="checkbox" id='d7showfocus'>Show Focus Tool<br> <input type="checkbox" id='d7showcursor'>Show Local Mouse Cursor<br> </div> <div>Other Settings</div> </div> </div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:4px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> <div style="height:25px"><input id="idx_dlgDeleteButton" type="button" value="Delete" style="width:80px;display:none" onclick="dialogclose(2)"></div> </div> </div> <iframe name="fileUploadFrame" style="display:none"></iframe> <form style="display:none" method="post" action="uploadfile.ashx" enctype="multipart/form-data" target="fileUploadFrame"><input id="p5fileDragName" name="name"><input id="p5fileDragSize" name="size"><input id="p5fileDragType" name="type"><input id="p5fileDragData" name="data"><input id="p5fileDragLink" name="link"><input type="submit" id="p5loginSubmit2" style="display:none"></form> <form style="display:none" method="post" action="uploadnodefile.ashx" enctype="multipart/form-data" target="fileUploadFrame"><input id="p13fileDragName" name="name"><input id="p13fileDragSize" name="size"><input id="p13fileDragType" name="type"><input id="p13fileDragData" name="data"><input id="p13fileDragLink" name="link"><input type="submit" id="p13loginSubmit2" style="display:none"></form> <audio id="chimes"><source src="sounds/chimes.mp3" type="audio/mp3"></source></audio> </div> </div> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g," ")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"®").replace(/\(TM\)/g,"™")}var MeshServerCreateControl=function(a){var b={};b.State=0;b.connectstate=0;b.pingTimer=null;b.xxStateChange=function(c){if(b.State==c){return}b.State=c;if(b.onStateChanged){b.onStateChanged(b,b.State)}};b.Start=function(){b.connectstate=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+a+"control.ashx");b.socket.onopen=function(){b.connectstate=1;b.xxStateChange(2)};b.socket.onmessage=b.xxOnMessage;b.socket.onclose=function(){b.Stop()};b.xxStateChange(1);if(b.pingTimer!=null){clearInterval(b.pingTimer)}b.pingTimer=setInterval(function(){b.send({action:"ping"})},29000)};b.Stop=function(){b.connectstate=0;if(b.socket){b.socket.close();delete b.socket}if(b.pingTimer!=null){clearInterval(b.pingTimer);b.pingTimer=null}b.xxStateChange(0)};b.xxOnMessage=function(c){var d;try{d=JSON.parse(c.data)}catch(c){return}if(d.action=="pong"){return}if(b.onMessage){b.onMessage(b,d)}};b.send=function(c){if(b.socket!=null&&b.connectstate==1){b.socket.send(JSON.stringify(c))}};return b};function AmtStackCreateService(s){var r=new Object();r.wsman=s;r.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];r.PendingEnums=[];r.PendingBatchOperations=0;r.ActiveEnumsCount=0;r.MaxActiveEnumsCount=1;r.onProcessChanged=null;var m=0;var l=0;r.GetPendingActions=function(){return(r.PendingEnums.length*2)+(r.ActiveEnumsCount)+r.wsman.comm.PendingAjax.length+r.wsman.comm.ActiveAjaxCount+r.PendingBatchOperations};function q(){var t=r.GetPendingActions();if(m<t){m=t}if(r.onProcessChanged!=null&&l!=t){l=t;r.onProcessChanged(t,m)}if(t==0){m=0}}r.Subscribe=function(v,u,B,t,A,y,z,w,C,x){r.wsman.ExecSubscribe(r.CompleteName(v),u,B,function(F,E,D,G){q();t(r,v,D,G,A)},0,y,z,w,C,x);q()};r.UnSubscribe=function(u,t,x,v,w){r.wsman.ExecUnSubscribe(r.CompleteName(u),function(A,z,y,B){q();t(r,u,y,B,x)},0,v,w);q()};r.Get=function(u,t,w,v){r.wsman.ExecGet(r.CompleteName(u),function(z,y,x,A){q();t(r,u,x,A,w)},0,v);q()};r.Put=function(u,w,t,y,v,x){r.wsman.ExecPut(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v,x);q()};r.Create=function(u,w,t,x,v){r.wsman.ExecCreate(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Delete=function(u,w,t,x,v){r.wsman.ExecDelete(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Exec=function(w,v,t,u,z,x,y){r.wsman.ExecMethod(r.CompleteName(w),v,t,function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.ExecWithXml=function(w,v,t,u,z,x,y){r.wsman.ExecMethodXml(r.CompleteName(w),v,execArgumentsToXml(t),function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.Enum=function(u,t,w,v){if(r.ActiveEnumsCount<r.MaxActiveEnumsCount){r.ActiveEnumsCount++;r.wsman.ExecEnum(r.CompleteName(u),function(A,y,x,B,z){q();d(u,x,t,y,B,z)},w,v)}else{r.PendingEnums.push([u,t,w,v])}q()};function d(v,x,t,y,z,A,w){if(z!=200){t(r,v,null,z,A);c(1);return}if(x==null||x.Header.Method!="EnumerateResponse"||!x.Body.EnumerationContext){t(r,v,null,603,A);c(1);return}var u=x.Body.EnumerationContext;r.wsman.ExecPull(y,u,function(D,C,B,E){b(v,B,t,C,[],E,A,w)})}function b(y,A,t,B,w,C,D,z){if(C!=200){t(r,y,null,C,D);c(1);return}if(A==null||A.Header.Method!="PullResponse"){t(r,y,null,604,D);c(1);return}for(var v in A.Body.Items){if(A.Body.Items[v] instanceof Array){for(var x in A.Body.Items[v]){w.push(A.Body.Items[v][x])}}else{w.push(A.Body.Items[v])}}if(A.Body.EnumerationContext){var u=A.Body.EnumerationContext;r.wsman.ExecPull(B,u,function(G,F,E,H){b(y,E,t,F,w,H,D,1)})}else{c(1);t(r,y,w,C,D);q()}}function c(t){r.ActiveEnumsCount-=t;if(r.ActiveEnumsCount>=r.MaxActiveEnumsCount||r.PendingEnums.length==0){return}var u=r.PendingEnums.shift();r.Enum(u[0],u[1],u[2]);c(0)}r.BatchEnum=function(t,w,u,y,v,x){r.PendingBatchOperations+=(w.length*2);a(t,Clone(w),u,y,{},v,x);q()};function a(t,y,u,B,A,v,z){r.PendingBatchOperations-=2;var x=y.shift(),w=r.Enum;if(x[0]=="*"){w=r.Get;x=x.substring(1)}w(x,function(E,C,D,F,G){G[2][C]={response:(D==null?null:D.Body),responses:D,status:F};if(G[1].length==0||F==401||(v!=true&&F!=200&&F!=400)){r.PendingBatchOperations-=(y.length*2);q();u(r,t,G[2],F,B)}else{q();a(t,y,u,B,G[2],z)}},[t,y,A],z);q()}r.BatchGet=function(t,v,u,x,w){g({name:t,names:v,callback:u,current:0,responses:{},tag:x,pri:w});q()};function g(t){if(t.names.length<=t.current){t.callback(r,t.name,t.responses,200,t.tag)}else{r.wsman.ExecGet(r.CompleteName(t.names[t.current]),function(w,v,u,x){f(t,u,x)},t.pri);t.current++}q()}function f(t,u,v){if(u==null||v!=200){t.callback(r,t.name,null,v,t.tag)}else{t.responses[u.Header.Method]=u;g(t)}}r.CompleteName=function(t){if(t.indexOf("AMT_")==0){return r.pfx[0]+t}if(t.indexOf("CIM_")==0){return r.pfx[1]+t}if(t.indexOf("IPS_")==0){return r.pfx[2]+t}};r.CompleteExecResponse=function(t){if(t&&t!=null&&t.Body&&t.Body.ReturnValue){t.Body.ReturnValueStr=r.AmtStatusToStr(t.Body.ReturnValue)}return t};r.RequestPowerStateChange=function(u,t){r.CIM_PowerManagementService_RequestPowerStateChange(u,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',null,null,t)};r.SetBootConfigRole=function(u,t){r.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',u,t)};r.CancelAllQueries=function(t){r.wsman.CancelAllQueries(t)};r.AMT_AgentPresenceWatchdog_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdog_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AddAction=function(y,x,w,u,t,v,B,z,A){r.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:y,NewState:x,EventOnTransition:w,ActionSd:u,ActionEac:t},v,B,z,A)};r.AMT_AgentPresenceWatchdog_DeleteAllActions=function(t,w,u,v){r.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},t,w,u,v)};r.AMT_AgentPresenceWatchdogAction_GetActionEac=function(t){r.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},t)};r.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdogVA_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AddAction=function(y,x,w,u,t,v){r.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:y,NewState:x,EventOnTransition:w,ActionSd:u,ActionEac:t},v)};r.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(t,u){r.Exec("AMT_AgentPresenceWatchdogVA","DeleteAllActions",{_method_dummy:t},u)};r.AMT_AuditLog_ClearLog=function(t){r.Exec("AMT_AuditLog","ClearLog",{},t)};r.AMT_AuditLog_RequestStateChange=function(u,v,t){r.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_AuditLog_ReadRecords=function(u,t,v){r.Exec("AMT_AuditLog","ReadRecords",{StartIndex:u},t,v)};r.AMT_AuditLog_SetAuditLock=function(w,u,v,t){r.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:w,Flag:u,Handle:v},t)};r.AMT_AuditLog_ExportAuditLogSignature=function(u,t){r.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:u},t)};r.AMT_AuditLog_SetSigningKeyMaterial=function(x,w,v,u,t){r.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:x,SigningKey:w,LengthOfCertificates:v,Certificates:u},t)};r.AMT_AuditPolicyRule_SetAuditPolicy=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicyBulk",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuthorizationService_AddUserAclEntryEx=function(w,v,x,t,y,u){r.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:w,DigestPassword:v,KerberosUserSid:x,AccessPermission:t,Realms:y},u)};r.AMT_AuthorizationService_EnumerateUserAclEntries=function(u,t){r.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:u},t)};r.AMT_AuthorizationService_GetUserAclEntryEx=function(u,t,v){r.Exec("AMT_AuthorizationService","GetUserAclEntryEx",{Handle:u},t,v)};r.AMT_AuthorizationService_UpdateUserAclEntryEx=function(x,w,v,y,t,z,u){r.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:x,DigestUsername:w,DigestPassword:v,KerberosUserSid:y,AccessPermission:t,Realms:z},u)};r.AMT_AuthorizationService_RemoveUserAclEntry=function(u,t){r.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:u},t)};r.AMT_AuthorizationService_SetAdminAclEntryEx=function(v,u,t){r.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",{Username:v,DigestPassword:u},t)};r.AMT_AuthorizationService_GetAdminAclEntry=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},t)};r.AMT_AuthorizationService_GetAdminAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},t)};r.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},t)};r.AMT_AuthorizationService_SetAclEnabledState=function(v,u,t,w){r.Exec("AMT_AuthorizationService","SetAclEnabledState",{Handle:v,Enabled:u},t,w)};r.AMT_AuthorizationService_GetAclEnabledState=function(u,t,v){r.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:u},t,v)};r.AMT_EndpointAccessControlService_RequestStateChange=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_EndpointAccessControlService_GetPosture=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:u},t)};r.AMT_EndpointAccessControlService_GetPostureHash=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:u},t)};r.AMT_EndpointAccessControlService_UpdatePostureState=function(u,t){r.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:u},t)};r.AMT_EndpointAccessControlService_GetEacOptions=function(t){r.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},t)};r.AMT_EndpointAccessControlService_SetEacOptions=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:u,PostureHashAlgorithm:v},t)};r.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:u},t)};r.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:u},t)};r.AMT_EthernetPortSettings_SetLinkPreference=function(u,v,t){r.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:u,Timeout:v},t)};r.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=function(u,t){r.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:u},t)};r.AMT_KerberosSettingData_GetCredentialCacheState=function(t){r.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},t)};r.AMT_KerberosSettingData_SetCredentialCacheState=function(u,t){r.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:u},t)};r.AMT_MessageLog_CancelIteration=function(u,t){r.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:u},t)};r.AMT_MessageLog_RequestStateChange=function(u,v,t){r.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_MessageLog_ClearLog=function(t){r.Exec("AMT_MessageLog","ClearLog",{},t)};r.AMT_MessageLog_GetRecords=function(u,v,t,w){r.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:u,MaxReadRecords:v},t,w)};r.AMT_MessageLog_GetRecord=function(u,v,t){r.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:u,PositionToNext:v},t)};r.AMT_MessageLog_PositionAtRecord=function(u,v,w,t){r.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:u,MoveAbsolute:v,RecordNumber:w},t)};r.AMT_MessageLog_PositionToFirstRecord=function(t,u){r.Exec("AMT_MessageLog","PositionToFirstRecord",{},t,u)};r.AMT_MessageLog_FreezeLog=function(u,t){r.Exec("AMT_MessageLog","FreezeLog",{Freeze:u},t)};r.AMT_PublicKeyManagementService_AddCRL=function(v,u,t){r.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:v,SerialNumbers:u},t)};r.AMT_PublicKeyManagementService_ResetCRLList=function(t,u){r.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:t},u)};r.AMT_PublicKeyManagementService_AddCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddKey=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:u},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(v,u,w,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:v,DNName:u,Usage:w},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(u,w,v,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:u,SigningAlgorithm:w,NullSignedCertificateRequest:v},t)};r.AMT_PublicKeyManagementService_GenerateKeyPair=function(u,v,t){r.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:u,KeyLength:v},t)};r.AMT_RedirectionService_RequestStateChange=function(u,t){r.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:u},t)};r.AMT_RedirectionService_TerminateSession=function(u,t){r.Exec("AMT_RedirectionService","TerminateSession",{SessionType:u},t)};r.AMT_RemoteAccessService_AddMpServer=function(t,y,A,u,w,B,z,x,v){r.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:t,InfoFormat:y,Port:A,AuthMethod:u,Certificate:w,Username:B,Password:z,CN:x},v)};r.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(w,x,u,v,t){r.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:w,TunnelLifeTime:x,ExtendedData:u,MpServer:v},t)};r.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(t,u){r.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_CommitChanges=function(t,u){r.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_Unprovision=function(u,t){r.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:u},t)};r.AMT_SetupAndConfigurationService_PartialUnprovision=function(t,u){r.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(t,u){r.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(u,t){r.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:u},t)};r.AMT_SetupAndConfigurationService_SetMEBxPassword=function(u,t){r.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:u},t)};r.AMT_SetupAndConfigurationService_SetTLSPSK=function(u,v,t){r.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:u,PPS:v},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},t)};r.AMT_SetupAndConfigurationService_GetUuid=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUuid",{},t)};r.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},t)};r.AMT_SystemDefensePolicy_GetTimeout=function(t){r.Exec("AMT_SystemDefensePolicy","GetTimeout",{},t)};r.AMT_SystemDefensePolicy_SetTimeout=function(u,t){r.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:u},t)};r.AMT_SystemDefensePolicy_UpdateStatistics=function(u,w,t,y,v,x){r.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:u,ResetOnRead:w},t,y,v,x)};r.AMT_SystemPowerScheme_SetPowerScheme=function(t,u,v){r.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},t,v,0,{InstanceID:u})};r.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(t,u){r.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},t,u)};r.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(u,w,x,t,v){r.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:u,Tm1:w,Tm2:x},t,v)};r.AMT_UserInitiatedConnectionService_RequestStateChange=function(u,v,t){r.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WebUIService_RequestStateChange=function(u,v,t){r.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:x,WiFiEndpointSettingsInput:y,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:x,WiFiEndpointSettingsInput:y,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:t},u)};r.CIM_Account_RequestStateChange=function(u,v,t){r.Exec("CIM_Account","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_AccountManagementService_CreateAccount=function(v,t,u){r.Exec("CIM_AccountManagementService","CreateAccount",{System:v,AccountTemplate:t},u)};r.CIM_BootConfigSetting_ChangeBootOrder=function(u,t){r.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:u},t)};r.CIM_BootService_SetBootConfigRole=function(t,v,u){r.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:t,Role:v},u,0,1)};r.CIM_Card_ConnectorPower=function(u,v,t){r.Exec("CIM_Card","ConnectorPower",{Connector:u,PoweredOn:v},t)};r.CIM_Card_IsCompatible=function(u,t){r.Exec("CIM_Card","IsCompatible",{ElementToCheck:u},t)};r.CIM_Chassis_IsCompatible=function(u,t){r.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:u},t)};r.CIM_Fan_SetSpeed=function(u,t){r.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:u},t)};r.CIM_KVMRedirectionSAP_RequestStateChange=function(u,v,t){r.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:u},t)};r.CIM_MediaAccessDevice_LockMedia=function(u,t){r.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:u},t)};r.CIM_MediaAccessDevice_SetPowerState=function(u,v,t){r.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_MediaAccessDevice_Reset=function(t){r.Exec("CIM_MediaAccessDevice","Reset",{},t)};r.CIM_MediaAccessDevice_EnableDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:u},t)};r.CIM_MediaAccessDevice_OnlineDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:u},t)};r.CIM_MediaAccessDevice_QuiesceDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:u},t)};r.CIM_MediaAccessDevice_SaveProperties=function(t){r.Exec("CIM_MediaAccessDevice","SaveProperties",{},t)};r.CIM_MediaAccessDevice_RestoreProperties=function(t){r.Exec("CIM_MediaAccessDevice","RestoreProperties",{},t)};r.CIM_MediaAccessDevice_RequestStateChange=function(u,v,t){r.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_PhysicalFrame_IsCompatible=function(u,t){r.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:u},t)};r.CIM_PhysicalPackage_IsCompatible=function(u,t){r.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:u},t)};r.CIM_PowerManagementService_RequestPowerStateChange=function(v,u,w,x,t){r.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:v,ManagedElement:u,Time:w,TimeoutPeriod:x},t,0,1)};r.CIM_PowerSupply_SetPowerState=function(u,v,t){r.Exec("CIM_PowerSupply","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_PowerSupply_Reset=function(t){r.Exec("CIM_PowerSupply","Reset",{},t)};r.CIM_PowerSupply_EnableDevice=function(u,t){r.Exec("CIM_PowerSupply","EnableDevice",{Enabled:u},t)};r.CIM_PowerSupply_OnlineDevice=function(u,t){r.Exec("CIM_PowerSupply","OnlineDevice",{Online:u},t)};r.CIM_PowerSupply_QuiesceDevice=function(u,t){r.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:u},t)};r.CIM_PowerSupply_SaveProperties=function(t){r.Exec("CIM_PowerSupply","SaveProperties",{},t)};r.CIM_PowerSupply_RestoreProperties=function(t){r.Exec("CIM_PowerSupply","RestoreProperties",{},t)};r.CIM_PowerSupply_RequestStateChange=function(u,v,t){r.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Processor_SetPowerState=function(u,v,t){r.Exec("CIM_Processor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Processor_Reset=function(t){r.Exec("CIM_Processor","Reset",{},t)};r.CIM_Processor_EnableDevice=function(u,t){r.Exec("CIM_Processor","EnableDevice",{Enabled:u},t)};r.CIM_Processor_OnlineDevice=function(u,t){r.Exec("CIM_Processor","OnlineDevice",{Online:u},t)};r.CIM_Processor_QuiesceDevice=function(u,t){r.Exec("CIM_Processor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Processor_SaveProperties=function(t){r.Exec("CIM_Processor","SaveProperties",{},t)};r.CIM_Processor_RestoreProperties=function(t){r.Exec("CIM_Processor","RestoreProperties",{},t)};r.CIM_Processor_RequestStateChange=function(u,v,t){r.Exec("CIM_Processor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RecordLog_ClearLog=function(t){r.Exec("CIM_RecordLog","ClearLog",{},t)};r.CIM_RecordLog_RequestStateChange=function(u,v,t){r.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RedirectionService_RequestStateChange=function(u,v,t){r.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Sensor_SetPowerState=function(u,v,t){r.Exec("CIM_Sensor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Sensor_Reset=function(t){r.Exec("CIM_Sensor","Reset",{},t)};r.CIM_Sensor_EnableDevice=function(u,t){r.Exec("CIM_Sensor","EnableDevice",{Enabled:u},t)};r.CIM_Sensor_OnlineDevice=function(u,t){r.Exec("CIM_Sensor","OnlineDevice",{Online:u},t)};r.CIM_Sensor_QuiesceDevice=function(u,t){r.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Sensor_SaveProperties=function(t){r.Exec("CIM_Sensor","SaveProperties",{},t)};r.CIM_Sensor_RestoreProperties=function(t){r.Exec("CIM_Sensor","RestoreProperties",{},t)};r.CIM_Sensor_RequestStateChange=function(u,v,t){r.Exec("CIM_Sensor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_StatisticalData_ResetSelectedStats=function(u,t){r.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:u},t)};r.CIM_Watchdog_KeepAlive=function(t){r.Exec("CIM_Watchdog","KeepAlive",{},t)};r.CIM_Watchdog_SetPowerState=function(u,v,t){r.Exec("CIM_Watchdog","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Watchdog_Reset=function(t){r.Exec("CIM_Watchdog","Reset",{},t)};r.CIM_Watchdog_EnableDevice=function(u,t){r.Exec("CIM_Watchdog","EnableDevice",{Enabled:u},t)};r.CIM_Watchdog_OnlineDevice=function(u,t){r.Exec("CIM_Watchdog","OnlineDevice",{Online:u},t)};r.CIM_Watchdog_QuiesceDevice=function(u,t){r.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:u},t)};r.CIM_Watchdog_SaveProperties=function(t){r.Exec("CIM_Watchdog","SaveProperties",{},t)};r.CIM_Watchdog_RestoreProperties=function(t){r.Exec("CIM_Watchdog","RestoreProperties",{},t)};r.CIM_Watchdog_RequestStateChange=function(u,v,t){r.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_WiFiPort_SetPowerState=function(u,v,t){r.Exec("CIM_WiFiPort","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_WiFiPort_Reset=function(t){r.Exec("CIM_WiFiPort","Reset",{},t)};r.CIM_WiFiPort_EnableDevice=function(u,t){r.Exec("CIM_WiFiPort","EnableDevice",{Enabled:u},t)};r.CIM_WiFiPort_OnlineDevice=function(u,t){r.Exec("CIM_WiFiPort","OnlineDevice",{Online:u},t)};r.CIM_WiFiPort_QuiesceDevice=function(u,t){r.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:u},t)};r.CIM_WiFiPort_SaveProperties=function(t){r.Exec("CIM_WiFiPort","SaveProperties",{},t)};r.CIM_WiFiPort_RestoreProperties=function(t){r.Exec("CIM_WiFiPort","RestoreProperties",{},t)};r.CIM_WiFiPort_RequestStateChange=function(u,v,t){r.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_HostBasedSetupService_Setup=function(x,y,w,u,z,v,t){r.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:x,NetworkAdminPassword:y,McNonce:w,Certificate:u,SigningAlgorithm:z,DigitalSignature:v},t)};r.IPS_HostBasedSetupService_AddNextCertInChain=function(w,u,v,t){r.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:w,IsLeafCertificate:u,IsRootCertificate:v},t)};r.IPS_HostBasedSetupService_AdminSetup=function(w,x,v,y,u,t){r.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:w,NetworkAdminPassword:x,McNonce:v,SigningAlgorithm:y,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(v,w,u,t){r.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:v,SigningAlgorithm:w,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_DisableClientControlMode=function(t,u){r.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:t},u)};r.IPS_KVMRedirectionSettingData_TerminateSession=function(t){r.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},t)};r.IPS_OptInService_StartOptIn=function(t){r.Exec("IPS_OptInService","StartOptIn",{},t)};r.IPS_OptInService_CancelOptIn=function(t){r.Exec("IPS_OptInService","CancelOptIn",{},t)};r.IPS_OptInService_SendOptInCode=function(u,t){r.Exec("IPS_OptInService","SendOptInCode",{OptInCode:u},t)};r.IPS_OptInService_StartService=function(t){r.Exec("IPS_OptInService","StartService",{},t)};r.IPS_OptInService_StopService=function(t){r.Exec("IPS_OptInService","StopService",{},t)};r.IPS_OptInService_RequestStateChange=function(u,v,t){r.Exec("IPS_OptInService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_RequestStateChange=function(u,v,t){r.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_ClearLog=function(t,u){r.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:t},u)};r.IPS_SecIOService_RequestStateChange=function(u,v,t){r.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AmtStatusToStr=function(t){if(r.AmtStatusCodes[t]){return r.AmtStatusCodes[t]}else{return"UNKNOWN_ERROR"}};r.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};r.GetMessageLog=function(t,u){r.AMT_MessageLog_PositionToFirstRecord(j,[t,u,[]])};function j(v,t,u,w,x){if(w!=200||u.Body.ReturnValue!="0"){x[0](r,null,x[2]);return}r.AMT_MessageLog_GetRecords(u.Body.IterationIdentifier,390,k,x)}function k(D,A,C,E,G){if(E!=200||C.Body.ReturnValue!="0"){G[0](r,null,G[2]);return}var y,z,I,v,u=G[2],F=new Date(),H,B=C.Body.RecordArray;if(typeof B==="string"){C.Body.RecordArray=[C.Body.RecordArray]}for(y in B){v=null;try{v=window.atob(B[y])}catch(w){}if(v!=null){H=ReadIntX(v,0);if((H>0)&&(H<4294967295)){I={DeviceAddress:v.charCodeAt(4),EventSensorType:v.charCodeAt(5),EventType:v.charCodeAt(6),EventOffset:v.charCodeAt(7),EventSourceType:v.charCodeAt(8),EventSeverity:v.charCodeAt(9),SensorNumber:v.charCodeAt(10),Entity:v.charCodeAt(11),EntityInstance:v.charCodeAt(12),EventData:[],Time:new Date((H+(F.getTimezoneOffset()*60))*1000)};for(z=13;z<21;z++){I.EventData.push(v.charCodeAt(z))}I.EntityStr=n[I.Entity];I.Desc=h(I.EventSensorType,I.EventOffset,I.EventData,I.Entity);if(!I.EntityStr){I.EntityStr="Unknown"}u.push(I)}}}if(C.Body.NoMoreRecords!=true){r.AMT_MessageLog_GetRecords(C.Body.IterationIdentifier,390,k,[G[0],u,G[2]])}else{G[0](r,u,G[2])}}var e="Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split("|");var o="Unspecified.|No system memory is physically installed in the system.|No usable system memory, all installed memory has experienced an unrecoverable failure.|Unrecoverable hard-disk/ATAPI/IDE device failure.|Unrecoverable system-board failure.|Unrecoverable diskette subsystem failure.|Unrecoverable hard-disk controller failure.|Unrecoverable PS/2 or USB keyboard failure.|Removable boot media not found.|Unrecoverable video controller failure.|No video device detected.|Firmware (BIOS) ROM corruption detected.|CPU voltage mismatch (processors that share same supply have mismatched voltage requirements)|CPU speed matching failure".split("|");var p="Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split("|");var n="Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split("|");r.RealmNames="||Redirection|PT Administration|Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split("|");r.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};function h(w,v,u,t){if(w==15){if(u[0]==235){return"Invalid Data"}if(v==0){return o[u[1]]}return p[u[1]]}if(w==18&&u[0]==170){return"Agent watchdog "+char2hex(u[4])+char2hex(u[3])+char2hex(u[2])+char2hex(u[1])+"-"+char2hex(u[6])+char2hex(u[5])+"-... changed to "+r.WatchdogCurrentStates[u[7]]}if(w==6){return"Authentication failed "+(u[1]+(u[2]<<8))+" times. The system may be under attack."}if(w==30){return"No bootable media"}if(w==32){return"Operating system lockup or power interrupt"}if(w==35){return"System boot failure"}if(w==37){return"System firmware started (at least one CPU is properly executing)."}return"Unknown Sensor Type #"+w}return r}var md5_k=[];for(var i=0;i<64;){md5_k[i]=0|(Math.abs(Math.sin(++i))*4294967296)}function hex_md5(o){var f,g,k,n,q=[],p=unescape(encodeURI(o)),e=p.length,l=[f=1732584193,g=-271733879,~f,~g],m=0;for(;m<=e;){q[m>>2]|=(p.charCodeAt(m)||128)<<8*(m++%4)}q[o=(e+8>>6)*16+14]=e*8;m=0;for(;m<o;m+=16){e=l;n=0;for(;n<64;){e=[k=e[3],((f=e[1]|0)+((k=((e[0]+[f&(g=e[2])|~f&k,k&f|~k&g,f^g^k,g^(f|~k)][e=n>>4])+(md5_k[n]+(q[[n,5*n+1,3*n+5,7*n][e]%16+m]|0))))<<(e=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*e+n++%4])|k>>>32-e)),f,g]}for(n=4;n;){l[--n]=l[n]+e[n]}}o="";for(;n<32;){o+=((l[n>>3]>>((1^n++&7)*4))&15).toString(16)}return o}function rstr_md5(a){return hex2rstr(hex_md5(a))}function execArgumentsToXml(c){if(c===undefined||c===null){return null}var d="";for(var b in c){var a=c[b];if(!a){continue}if(a.__parameterType==="reference"){d+=referenceToXml(b,a)}else{d+=instanceToXml(b,a)}}return d}function instanceToXml(d,c){if(c===undefined||c===null){return null}var b=!!c.__namespace;var h=b?"<q:":"<";var a=b?"</q:":"</";var e=b?(' xmlns:q="'+c.__namespace+'"'):"";var g="<r:"+d+e+">";for(var f in c){if(!c.hasOwnProperty(f)||f.indexOf("__")===0){continue}if(typeof c[f]==="function"||Array.isArray(c[f])){continue}if(typeof c[f]==="object"){console.error("only convert one level down...")}else{g+=h+f+">"+c[f].toString()+a+f+">"}}g+="</r:"+d+">";return g}function referenceToXml(b,a){if(a===undefined||a===null){return null}var c="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+a.__resourceUri+"</w:ResourceURI><w:SelectorSet>";for(var d in a){if(!a.hasOwnProperty(d)||d.indexOf("__")===0){continue}if(typeof a[d]==="function"||typeof a[d]==="object"||Array.isArray(a[d])){continue}c+='<w:Selector Name="'+d+'">'+a[d].toString()+"</w:Selector>"}c+="</w:SelectorSet></a:ReferenceParameters></r:"+b+">";return c}function GetSidString(c){var b="S-"+c.charCodeAt(0)+"-"+c.charCodeAt(7);for(var a=2;a<(c.length/4);a++){b+="-"+ReadIntX(c,a*4)}return b}function GetSidByteArray(d){if(!d||d==null){return null}var c=d.split("-");if(c.length<4||(c[0]!="s"&&c[0]!="S")){return null}for(var a=1;a<c.length;a++){var e=parseInt(c[a]);if(e!=c[a]){return null}c[a]=e}var b=String.fromCharCode(c[1])+String.fromCharCode(c.length-3)+ShortToStr(Math.floor(c[2]/Math.pow(2,32)))+IntToStr((c[2])&65535);for(var a=3;a<c.length;a++){b+=IntToStrX(c[a])}return b}var WsmanStackCreateService=function(g,k,m,j,l,f){var h={};h.NextMessageId=1;h.Address="/wsman";h.comm=CreateWsmanComm(g,k,m,j,l,f);h.PerformAjax=function(p,n,r,q,o){if(o==undefined){o=""}h.comm.PerformAjax('<?xml version="1.0" encoding="utf-8"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+o+"><Header><a:Action>"+p,function(s,t,u){if(t!=200){n(h,null,{Header:{HttpError:t}},t,u);return}var v=h.ParseWsman(s);if(!v||v==null){n(h,null,{Header:{HttpError:t}},601,u)}else{n(h,v.Header.ResourceURI,v,200,u)}},r,q)};h.CancelAllQueries=function(n){h.comm.CancelAllQueries(n)};h.GetNameFromUrl=function(n){var o=n.lastIndexOf("/");return(o==-1)?n:n.substring(o+1)};h.ExecSubscribe=function(v,p,y,n,x,u,w,s,z,t){var q="",r="";if(z!=undefined&&t!=undefined){q="<t:IssuedTokens><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>"+z+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+t+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>";r='<Auth Profile="http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/secprofile/http/digest"/>'}if(s!=undefined&&s!=null){s="<a:ReferenceParameters>"+s+"</a:ReferenceParameters>"}else{s=""}var o="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+v+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+d(w)+q+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.dmtf.org/wbem/wsman/1/wsman/'+p+'"><e:NotifyTo><a:Address>'+y+"</a:Address></e:NotifyTo>"+r+"</e:Delivery><e:Expires>PT0.000000S</e:Expires></e:Subscribe>";h.PerformAjax(o+"</Body></Envelope>",n,x,u,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:m="http://x.com"')};h.ExecUnSubscribe=function(q,n,s,p,r){var o="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+q+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+d(r)+"</Header><Body><e:Unsubscribe/>";h.PerformAjax(o+"</Body></Envelope>",n,s,p,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};h.ExecPut=function(r,q,n,t,p,s){var o="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+d(s)+"</Header><Body>"+c(r,q);h.PerformAjax(o+"</Body></Envelope>",n,t,p)};h.ExecCreate=function(u,t,o,w,s,v){var r=h.GetNameFromUrl(u);var p="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+u+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(v)+"</Header><Body><g:"+r+' xmlns:g="'+u+'">';for(var q in t){p+="<g:"+q+">"+t[q]+"</g:"+q+">"}h.PerformAjax(p+"</g:"+r+"></Body></Envelope>",o,w,s)};h.ExecCreateXml=function(r,n,o,t,q){var p=h.GetNameFromUrl(r),s="";h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout></Header><Body><r:"+p+' xmlns:r="'+r+'">'+n+"</r:"+p+"></Body></Envelope>",o,t,q)};h.ExecDelete=function(r,q,n,s,p){var o="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(q)+"</Header><Body /></Envelope>";h.PerformAjax(o,n,s,p)};h.ExecGet=function(p,n,q,o){h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+p+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>",n,q,o)};h.ExecMethod=function(t,r,n,p,v,s,u){var o="";for(var q in n){if(n[q]!=null){if(Array.isArray(n[q])){for(var w in n[q]){o+="<r:"+q+">"+n[q][w]+"</r:"+q+">"}}else{o+="<r:"+q+">"+n[q]+"</r:"+q+">"}}}h.ExecMethodXml(t,r,o,p,v,s,u)};h.ExecMethodXml=function(r,p,n,o,t,q,s){h.PerformAjax(r+"/"+p+"</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+r+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+d(s)+"</Header><Body><r:"+p+'_INPUT xmlns:r="'+r+'">'+n+"</r:"+p+"_INPUT></Body></Envelope>",o,t,q)};h.ExecEnum=function(p,n,q,o){h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+p+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',n,q,o)};h.ExecPull=function(q,o,n,r,p){h.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+h.Address+"</a:To><w:ResourceURI>"+q+"</w:ResourceURI><a:MessageID>"+(h.NextMessageId++)+'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>'+o+"</EnumerationContext><MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters></Pull></Body></Envelope>",n,r,p)};h.ParseWsman=function(w){try{if(!w.childNodes){w=e(w)}var u={Header:{}},q=w.getElementsByTagName("Header")[0],v;if(!q){q=w.getElementsByTagName("a:Header")[0]}if(!q){return null}for(var s=0;s<q.childNodes.length;s++){var o=q.childNodes[s];u.Header[o.localName]=o.textContent}var n=w.getElementsByTagName("Body")[0];if(!n){n=w.getElementsByTagName("a:Body")[0]}if(!n){return null}if(n.childNodes.length>0){v=n.childNodes[0].localName;if(v.indexOf("_OUTPUT")==v.length-7){v=v.substring(0,v.length-7)}u.Header.Method=v;u.Body=b(n.childNodes[0])}return u}catch(p){console.log("Unable to parse XML: "+w);return null}};function b(t){var p,u={};for(var q=0;q<t.childNodes.length;q++){var n=t.childNodes[q];if(n.childElementCount==0){p=n.textContent}else{p=b(n)}if(p=="true"){p=true}if(p=="false"){p=false}var o=p;if(n.attributes.length>0){o={Value:p};for(var s=0;s<n.attributes.length;s++){o["@"+n.attributes[s].name]=n.attributes[s].value}}if(u[n.localName] instanceof Array){u[n.localName].push(o)}else{if(u[n.localName]==undefined){u[n.localName]=o}else{u[n.localName]=[u[n.localName],o]}}}return u}function c(s,q){if(!s||q===undefined||q===null){return""}var o=h.GetNameFromUrl(s);var r="<r:"+o+' xmlns:r="'+s+'">';for(var p in q){if(!q.hasOwnProperty(p)||p.indexOf("__")===0||p.indexOf("@")===0){continue}if(q[p]===undefined||q[p]===null||typeof q[p]==="function"){continue}if(typeof q[p]==="object"&&q[p]["ReferenceParameters"]){r+="<r:"+p+"><a:Address>"+q[p].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+q[p]["ReferenceParameters"]["ResourceURI"]+"</w:ResourceURI><w:SelectorSet>";var t=q[p]["ReferenceParameters"]["SelectorSet"]["Selector"];if(Array.isArray(t)){for(var n=0;n<t.length;n++){r+="<w:Selector"+a(t[n])+">"+t[n]["Value"]+"</w:Selector>"}}else{r+="<w:Selector"+a(t)+">"+t.Value+"</w:Selector>"}r+="</w:SelectorSet></a:ReferenceParameters></r:"+p+">"}else{if(Array.isArray(q[p])){for(var n=0;n<q[p].length;n++){r+="<r:"+p+">"+q[p][n].toString()+"</r:"+p+">"}}else{r+="<r:"+p+">"+q[p].toString()+"</r:"+p+">"}}}r+="</r:"+o+">";return r}function a(n){if(!n){return""}var p=" ";for(var o in n){if(!n.hasOwnProperty(o)||o.indexOf("@")!==0){continue}p+=o.substring(1)+'="'+n[o]+'" '}return p}function d(r){if(!r){return""}if(typeof r=="string"){return r}if(r.InstanceID){return'<w:SelectorSet><w:Selector Name="InstanceID">'+r.InstanceID+"</w:Selector></w:SelectorSet>"}var p="<w:SelectorSet>";for(var o in r){if(!r.hasOwnProperty(o)){continue}p+='<w:Selector Name="'+o+'">';if(r[o]["ReferenceParameters"]){p+="<a:EndpointReference>";p+="<a:Address>"+r[o]["Address"]+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+r[o]["ReferenceParameters"]["ResourceURI"]+"</w:ResourceURI><w:SelectorSet>";var q=r[o]["ReferenceParameters"]["SelectorSet"]["Selector"];if(Array.isArray(q)){for(var n=0;n<q.length;n++){p+="<w:Selector"+a(q[n])+">"+q[n]["Value"]+"</w:Selector>"}}else{p+="<w:Selector"+a(q)+">"+q.Value+"</w:Selector>"}p+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else{p+=r[o]}p+="</w:Selector>"}p+="</w:SelectorSet>";return p}function e(n){if(window.DOMParser){return new DOMParser().parseFromString(n,"text/xml")}else{var o=new ActiveXObject("Microsoft.XMLDOM");o.async=false;o.loadXML(n);return o}}return h};var CreateAmtRemoteDesktop=function(l,o){var n={};n.canvasid=l;n.CanvasId=Q(l);n.scrolldiv=o;n.canvas=Q(l).getContext("2d");n.protocol=2;n.state=0;n.acc="";n.ScreenWidth=960;n.ScreenHeight=700;n.width=0;n.height=0;n.rwidth=0;n.rheight=0;n.bpp=2;n.useZRLE=true;n.showmouse=true;n.buttonmask=0;n.spare=null;n.sparew=0;n.spareh=0;n.sparew2=0;n.spareh2=0;n.sparecache={};n.ZRLEfirst=1;n.onScreenSizeChange=null;n.frameRateDelay=0;n.kvmDataSupported=false;n.onKvmData=null;n.onKvmDataPending=[];n.onKvmDataAck=-1;n.holding=false;n.lastKeepAlive=Date.now();n.Debug=function(p){console.log(p)};n.xxStateChange=function(p){if(p==0){n.canvas.fillStyle="#000000";n.canvas.fillRect(0,0,n.width,n.height);n.canvas.canvas.width=n.rwidth=n.width=640;n.canvas.canvas.height=n.rheight=n.height=400;QS(n.canvasid).cursor="auto"}else{if(!n.showmouse){QS(n.canvasid).cursor="none"}}};n.ProcessData=function(r){if(!r){return}n.acc+=r;while(n.acc.length>0){var p=0;if(n.state==0&&n.acc.length>=12){p=12;n.state=1;n.send("RFB 003.008\n")}else{if(n.state==1&&n.acc.length>=1){p=n.acc.charCodeAt(0)+1;n.send(String.fromCharCode(1));n.state=2}else{if(n.state==2&&n.acc.length>=4){p=4;if(ReadInt(n.acc,0)!=0){return n.Stop()}n.send(String.fromCharCode(1));n.state=3}else{if(n.state==3&&n.acc.length>=24){var C=ReadInt(n.acc,20);if(n.acc.length<24+C){return}p=24+C;n.canvas.canvas.width=n.rwidth=n.width=n.ScreenWidth=ReadShort(n.acc,0);n.canvas.canvas.height=n.rheight=n.height=n.ScreenHeight=ReadShort(n.acc,2);var F="";if(n.useZRLE){F+=IntToStr(16)}F+=IntToStr(0);F+=IntToStr(1092);n.send(String.fromCharCode(2,0)+ShortToStr((F.length/4)+1)+F+IntToStr(-223));if(n.bpp==1){n.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0))}n.state=4;n.parent.xxStateChange(3);g();if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}else{if(n.state==4){switch(n.acc.charCodeAt(0)){case 0:if(n.acc.length<4){return}n.state=100+ReadShort(n.acc,2);p=4;break;case 2:p=1;break;case 3:if(n.acc.length<8){return}var B=ReadInt(n.acc,4)+8;if(n.acc.length<B){return}p=m(n.acc);break}}else{if(n.state>100&&n.acc.length>=12){var H=ReadShort(n.acc,0),J=ReadShort(n.acc,2),G=ReadShort(n.acc,4),z=ReadShort(n.acc,6),E=G*z,w=ReadInt(n.acc,8);if(w<17){if(G<1||G>64||z<1||z>64){console.log("Invalid tile size ("+G+","+z+"), disconnecting.");return n.Stop()}if(n.sparew!=G||n.spareh!=z){n.sparew=n.sparew2=G;n.spareh=n.spareh2=z;var I=n.sparew2+"x"+n.spareh2;n.spare=n.sparecache[I];if(!n.spare){n.sparecache[I]=n.spare=n.canvas.createImageData(n.sparew2,n.spareh2)}}}if(w==4294967073){n.canvas.canvas.width=n.rwidth=n.width=G;n.canvas.canvas.height=n.rheight=n.height=z;n.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(n.width)+ShortToStr(n.height));p=12;if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}else{if(w==0){var D=12,q=12+(E*n.bpp);if(n.acc.length<q){return}p=q;for(var A=0;A<E;A++){h(n.acc.charCodeAt(D++)+((n.bpp==2)?(n.acc.charCodeAt(D++)<<8):0),A)}f(n.spare,H,J)}else{if(w==16){if(n.acc.length<16){return}var t=ReadInt(n.acc,12);if(n.acc.length<(16+t)){return}var D=16,u=5,v=0;if(t>5&&n.acc.charCodeAt(D)==0&&ReadShortX(n.acc,D+1)==(t-u)){a(n.acc,D+5,H,J,G,z,E,t)}p=16+t}else{n.Debug("Unknown Encoding: "+w);return n.Stop()}}}if(--n.state==100){n.state=4;if(n.frameRateDelay==0){g()}else{setTimeout(g,n.frameRateDelay)}}}}}}}}if(p==0){return}n.acc=n.acc.substring(p)}};function a(r,B,J,K,I,u,F,t){var G=r.charCodeAt(B++),z,H,E,A={},C=0,D=0,w;if(G==0){for(w=0;w<F;w++){h(r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0),w)}f(n.spare,J,K)}else{if(G==1){H=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0);n.canvas.fillStyle="rgb("+((n.bpp==1)?((H&224)+","+((H&28)<<3)+","+b((H&3)<<6)):(((H>>8)&248)+","+((H>>3)&252)+","+((H&31)<<3)))+")";n.canvas.fillRect(J,K,I,u)}else{if(G>1&&G<17){var q=4,p=15;for(w=0;w<G;w++){A[w]=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0)}if(G==2){q=1;p=1}else{if(G<=4){q=2;p=3}}while(C<F&&B<r.length){H=r.charCodeAt(B++);for(w=(8-q);w>=0;w-=q){h(A[(H>>w)&p],C++)}}f(n.spare,J,K)}else{if(G==128){while(C<F&&B<r.length){H=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0);D=1;do{D+=(E=r.charCodeAt(B++))}while(E==255);while(--D>=0){h(H,C++)}}f(n.spare,J,K)}else{if(G>129){for(w=0;w<(G-128);w++){A[w]=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0)}while(C<F&&B<r.length){D=1;z=r.charCodeAt(B++);H=A[z%128];if(z>127){do{D+=(E=r.charCodeAt(B++))}while(E==255)}while(--D>=0){h(H,C++)}}f(n.spare,J,K)}}}}}}n.hold=function(p){if(n.holding==p){return}n.holding=p;n.canvas.fillStyle="#000000";n.canvas.fillRect(0,0,n.width,n.height);if(n.holding==false){if((n.canvas.canvas.width!=n.width)||(n.canvas.canvas.height!=n.height)){n.canvas.canvas.width=n.width;n.canvas.canvas.height=n.height;if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}n.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(n.width)+ShortToStr(n.height))}else{n.UnGrabMouseInput();n.UnGrabKeyInput()}};function f(p,q,r){if(n.holding==true){return}n.canvas.putImageData(p,q,r)}function h(s,q){var r=q*4;if(n.bpp==1){n.spare.data[r++]=s&224;n.spare.data[r++]=(s&28)<<3;n.spare.data[r++]=b((s&3)<<6)}else{n.spare.data[r++]=(s>>8)&248;n.spare.data[r++]=(s>>3)&252;n.spare.data[r++]=(s&31)<<3}n.spare.data[r]=255}function b(p){return(p>127)?(p+32):p}function g(){if(n.holding==true){return}n.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(n.rwidth)+ShortToStr(n.rheight))}n.Start=function(){n.state=0;n.acc="";n.ZRLEfirst=1;n.onKvmDataPending=[];n.onKvmDataAck=-1;n.kvmDataSupported=false;for(var p in n.sparecache){delete n.sparecache[p]}};n.Stop=function(){n.UnGrabMouseInput();n.UnGrabKeyInput();n.parent.Stop()};n.send=function(p){n.parent.send(p)};var k={Pause:19,CapsLock:20,Space:32,Quote:39,Minus:45,NumpadMultiply:42,NumpadAdd:43,PrintScreen:44,Comma:44,NumpadSubtract:45,NumpadDecimal:46,Period:46,Slash:47,NumpadDivide:47,Semicolon:59,Equal:61,OSLeft:91,BracketLeft:91,OSRight:91,Backslash:92,BracketRight:93,ContextMenu:93,Backquote:96,NumLock:144,ScrollLock:145,Backspace:65288,Tab:65289,Enter:65293,NumpadEnter:65293,Escape:65307,Delete:65535,Home:65360,PageUp:65365,PageDown:65366,ArrowLeft:65361,ArrowUp:65362,ArrowRight:65363,ArrowDown:65364,End:65367,Insert:65379,F1:65470,F2:65471,F3:65472,F4:65473,F5:65474,F6:65475,F7:65476,F8:65477,F9:65478,F10:65479,F11:65480,F12:65481,ShiftLeft:65505,ShiftRight:65506,ControlLeft:65507,ControlRight:65508,AltLeft:65513,AltRight:65514,MetaLeft:65511,MetaRight:65512};function j(p){if(p.code.startsWith("Key")&&p.code.length==4){return p.code.charCodeAt(3)+((p.shiftKey==false)?32:0)}if(p.code.startsWith("Digit")&&p.code.length==6){return p.code.charCodeAt(5)}if(p.code.startsWith("Numpad")&&p.code.length==7){return p.code.charCodeAt(6)}return k[p.code]}function c(p,q){if(!q){q=window.event}if(q.code){var r=j(q);if(r!=null){n.sendkey(r,p)}}else{var r=q.keyCode,s=r;if(q.shiftKey==false&&r>=65&&r<=90){s=r+32}if(r>=112&&r<=124){s=r+65358}if(r==8){s=65288}if(r==9){s=65289}if(r==13){s=65293}if(r==16){s=65505}if(r==17){s=65507}if(r==18){s=65513}if(r==27){s=65307}if(r==33){s=65365}if(r==34){s=65366}if(r==35){s=65367}if(r==36){s=65360}if(r==37){s=65361}if(r==38){s=65362}if(r==39){s=65363}if(r==40){s=65364}if(r==45){s=65379}if(r==46){s=65535}if(r>=96&&r<=105){s=r-48}if(r==106){s=42}if(r==107){s=43}if(r==109){s=45}if(r==110){s=46}if(r==111){s=47}if(r==186){s=59}if(r==187){s=61}if(r==188){s=44}if(r==189){s=45}if(r==190){s=46}if(r==191){s=47}if(r==192){s=96}if(r==219){s=91}if(r==220){s=92}if(r==221){s=93}if(r==222){s=39}n.sendkey(s,p)}return n.haltEvent(q)}n.sendkey=function(r,p){if(typeof r=="object"){for(var q in r){n.sendkey(r[q][0],r[q][1])}}else{n.send(String.fromCharCode(4,p,0,0)+IntToStr(r))}};function m(p){if(p.length<8){return 0}var r=ReadInt(n.acc,4)+8;if(p.length<r){return 0}if(n.onKvmData!=null){var q=p.substring(8,r);if((q.length>=16)&&(q.substring(0,15)=="\0KvmDataChannel")){if(n.kvmDataSupported==false){n.kvmDataSupported=true;console.log("KVM Data Channel Supported.")}if(((n.onKvmDataAck==-1)&&(q.length==16))||(q.charCodeAt(15)!=0)){n.onKvmDataAck=true}if(q.length>=16){n.onKvmData(q.substring(16))}if((n.onKvmDataAck==true)&&(n.onKvmDataPending.length>0)){n.sendKvmData(n.onKvmDataPending.shift())}}}return r}n.sendKvmData=function(p){if(n.onKvmDataAck!==true){n.onKvmDataPending.push(p)}else{p="\0KvmDataChannel\0"+p;n.send(String.fromCharCode(6,0,0,0)+IntToStr(p.length)+p);n.onKvmDataAck=false}};n.sendKeepAlive=function(){if(n.lastKeepAlive<Date.now()-5000){n.lastKeepAlive=Date.now();n.send(String.fromCharCode(6,0,0,0)+IntToStr(16)+"\0KvmDataChannel\0")}};n.SendCtrlAltDelMsg=function(){n.sendcad()};n.sendcad=function(){n.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var e=false;var d=false;n.GrabMouseInput=function(){if(e==true){return}var p=n.canvas.canvas;p.onmouseup=n.mouseup;p.onmousedown=n.mousedown;p.onmousemove=n.mousemove;e=true};n.UnGrabMouseInput=function(){if(e==false){return}var p=n.canvas.canvas;p.onmousemove=null;p.onmouseup=null;p.onmousedown=null;e=false};n.GrabKeyInput=function(){if(d==true){return}document.onkeyup=n.handleKeyUp;document.onkeydown=n.handleKeyDown;document.onkeypress=n.handleKeys;d=true};n.UnGrabKeyInput=function(){if(d==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d=false};n.handleKeys=function(p){return n.haltEvent(p)};n.handleKeyUp=function(p){return c(0,p)};n.handleKeyDown=function(p){return c(1,p)};n.haltEvent=function(p){if(p.preventDefault){p.preventDefault()}if(p.stopPropagation){p.stopPropagation()}return false};n.mousedblclick=function(p){};n.mousedown=function(p){n.buttonmask|=(1<<p.button);return n.mousemove(p)};n.mouseup=function(p){n.buttonmask&=(65535-(1<<p.button));return n.mousemove(p)};n.mousemove=function(p){if(n.state!=4){return true}var q=n.getPositionOfControl(Q(n.canvasid));n.mx=(p.pageX-q[0])*(n.canvas.canvas.height/Q(n.canvasid).offsetHeight);n.my=((p.pageY-q[1]+(o?o.scrollTop:0))*(n.canvas.canvas.width/Q(n.canvasid).offsetWidth));n.send(String.fromCharCode(5,n.buttonmask)+ShortToStr(n.mx)+ShortToStr(n.my));return n.haltEvent(p)};n.getPositionOfControl=function(p){var q=Array(2);q[0]=q[1]=0;while(p){q[0]+=p.offsetLeft;q[1]+=p.offsetTop;p=p.offsetParent}return q};return n};var CreateAmtRemoteTerminal=function(A){var B={};B.DivId=A;B.DivElement=document.getElementById(A);B.protocol=1;B.fxEmulation=0;B.lineFeed="\r\n";B.debugmode=0;B.width=80;B.height=25;var q=21;var r=13;var l=["000000","BB0000","00BB00","BBBB00","0000BB","BB00BB","00BBBB","BBBBBB","555555","FF5555","55FF55","FFFF55","5555FF","FF55FF","55FFFF","FFFFFF"];var o=0;var n=7;var m=0;var s=true;var v=0;var w=0;var u=0;var d=[];var e=0;var k=[];var x=[];var z=1;var y=2;B.Start=function(){};B.Init=function(D,C){B.width=D?D:80;B.height=C?C:25;for(var F=0;F<B.height;F++){x[F]=[];k[F]=[];for(var E=0;E<B.width;E++){x[F][E]=" ";k[F][E]=(7<<6)}}B.TermInit();B.TermDraw()};B.xxStateChange=function(C){};B.ProcessData=function(C){if(B.debugmode==2){console.log("TRecv("+C.length+"): "+rstr2hex(C))}if(B.capture!=null){B.capture+=C}j(C);B.TermDraw()};function j(D){for(var C=0;C<D.length;C++){h(String.fromCharCode(D.charCodeAt(C)),D.charCodeAt(C))}}function h(C,D){switch(u){case 0:switch(D){case 27:u=1;break;default:g(C);break}break;case 1:switch(C){case"[":e=0;d=[];u=2;break;case"(":u=4;break;case")":u=5;break;default:u=0;break}break;case 2:if(C>="0"&&C<="9"){if(!d[e]){d[e]=(C-"0")}else{d[e]=((d[e]*10)+(C-"0"))}break}else{if(C==";"){e++;break}else{if(!d[0]){d[0]=0}f(C,d,e+1);u=0}}break;case 4:u=0;break;case 5:u=0;break}}function f(F,C,D){var G;switch(F){case"c":B.TermResetScreen();break;case"A":if(D==1){w-=C[0];if(w<0){w=0}}break;case"B":if(D==1){w+=C[0];if(w>B.height){w=B.height}}break;case"C":if(D==1){v+=C[0];if(v>B.width){v=B.width}}break;case"D":if(D==1){v-=C[0];if(v<0){v=0}}break;case"d":if(D==1){w=C[0]-1;if(w>B.height){w=B.height}if(w<0){w=0}}break;case"G":if(D==1){v=C[0]-1;if(v<0){v=0}if(v>79){v=79}}break;case"J":if(D==1&&C[0]==2){B.TermClear((m<<12)+(n<<6));v=0;w=0}else{if(D==0||D==1&&C[0]==0){b();for(G=w+1;G<B.height;G++){c(G)}}else{if(D==1&&C[0]==1){b();for(G=0;G<w-1;G++){c(G)}}}}break;case"H":if(D==2){if(C[0]<1){C[0]=1}if(C[1]<1){C[1]=1}if(C[0]>B.height){C[0]=B.height}if(C[1]>B.width){C[1]=B.width}w=C[0]-1;v=C[1]-1}else{w=0;v=0}break;case"m":for(G=0;G<D;G++){if(!C[G]||C[G]==0){m=0;n=7;o=0}else{if(C[G]==1){if(n<8){n+=8}}else{if(C[G]==2||C[G]==22){if(n>=8){n-=8}}else{if(C[G]==7){o=2}else{if(C[G]==27){o=0}else{if(C[G]>=30&&C[G]<=37){var E=(n>=8);n=(C[G]-30);if(E&&n<=8){n+=8}}else{if(C[G]>=40&&C[G]<=47){m=(C[G]-40)}else{if(C[G]>=90&&C[G]<=99){n=(C[G]-82)}else{if(C[G]>=100&&C[G]<=109){m=(C[G]-92)}}}}}}}}}}break;case"K":if(D==0||(D==1&&(!C[0]||C[0]==0))){b()}else{if(D==1){if(C[0]==1){a()}else{if(C[0]==2){c(w)}}}}break;case"h":s=true;break;case"l":s=false;break;default:break}}B.ProcessVt100String=function(D){for(var C=0;C<D.length;C++){g(String.fromCharCode(D.charCodeAt(C)))}};function g(C){if(C=="\0"||C.charCodeAt()==7){return}var D=C.charCodeAt();switch(D){case 16:C=" ";break;case 24:C="?";break;case 25:C="?";break}if(v>B.width){v=B.width}if(w>(B.height-1)){w=(B.height-1)}switch(C){case"\b":if(v>0){v=v-1;p(" ")}break;case"\t":var E=8-(v%8);for(var F=0;F<E;F++){g(" ")}break;case"\n":w++;if(w>(B.height-1)){t(1);w=(B.height-1)}if(B.lineFeed="\n"){v=0}break;case"\r":v=0;break;default:if(v>=B.width){v=0;if(s){w++}if(w>=(B.height-1)){t(1);w=(B.height-1)}}p(C);v++;break}}function p(C){x[w][v]=C;k[w][v]=(n<<6)+(m<<12)+o}B.TermClear=function(C){for(var E=0;E<B.height;E++){for(var D=0;D<B.width;D++){x[E][D]=" ";k[E][D]=C}}};B.TermResetScreen=function(){o=0;n=7;m=0;s=true;v=0;w=0;B.TermClear(7<<6)};function b(){var C=(m<<12);for(var D=v;D<B.width;D++){x[w][D]=" ";k[w][D]=C}}function a(){var C=(m<<12);for(var D=0;D<v;D++){x[w][D]=" ";k[w][D]=C}}function c(C){var D=(m<<12);for(var E=0;E<B.width;E++){x[C][E]=" ";k[C][E]=D}}B.TermSendKeys=function(C){if(B.debugmode==2){if(B.debugmode==2){console.log("TSend("+C.length+"): "+rstr2hex(C))}}B.parent.send(C)};B.TermSendKey=function(C){if(B.debugmode==2){if(B.debugmode==2){console.log("TSend(1): "+rstr2hex(String.fromCharCode(C)))}}B.parent.send(String.fromCharCode(C))};function t(C){var D,E;for(E=0;E<B.height-C;E++){x[E]=x[E+C];k[E]=k[E+C]}for(E=B.height-C;E<B.height;E++){x[E]=[];k[E]=[];for(D=0;D<B.width;D++){x[E][D]=" ";k[E][D]=(7<<6)}}}B.TermHandleKeys=function(C){if(!C.ctrlKey){if(C.which==127){B.TermSendKey(8)}else{if(C.which==13){B.TermSendKeys(B.lineFeed)}else{if(C.which!=0){B.TermSendKey(C.which)}}}return false}if(C.preventDefault){C.preventDefault()}if(C.stopPropagation){C.stopPropagation()}};B.TermHandleKeyUp=function(C){if((C.which!=8)&&(C.which!=32)&&(C.which!=9)){return true}if(C.preventDefault){C.preventDefault()}if(C.stopPropagation){C.stopPropagation()}return false};B.TermHandleKeyDown=function(C){if((C.which>=65)&&(C.which<=90)&&(C.ctrlKey==true)){B.TermSendKey(C.which-64);if(C.preventDefault){C.preventDefault()}if(C.stopPropagation){C.stopPropagation()}return}if(C.which==27){B.TermSendKeys(String.fromCharCode(27));return true}if(C.which==37){B.TermSendKeys(String.fromCharCode(27,91,68));return true}if(C.which==38){B.TermSendKeys(String.fromCharCode(27,91,65));return true}if(C.which==39){B.TermSendKeys(String.fromCharCode(27,91,67));return true}if(C.which==40){B.TermSendKeys(String.fromCharCode(27,91,66));return true}if(C.which==9){B.TermSendKeys("\t");if(C.preventDefault){C.preventDefault()}if(C.stopPropagation){C.stopPropagation()}return true}if(C.which!=8&&C.which!=32&&C.which!=9){return true}B.TermSendKey(C.which);if(C.preventDefault){C.preventDefault()}if(C.stopPropagation){C.stopPropagation()}return false};B.TermDraw=function(){var D,C="",E="",F,G=1,I,J;for(var K=0;K<B.height;++K){for(var H=0;H<B.width;++H){F=k[K][H];if(v==H&&w==K){F|=y}if(F!=G){C+=E;E="";I=6;J=12;if(F&y){I=12;J=6}C+='<span style="color:#'+l[(F>>I)&63]+";background-color:#"+l[(F>>J)&63];if(F&z){C+=";text-decoration:underline"}C+=';">';E="</span>"+E;G=F}D=x[K][H];switch(D){case"&":C+="&";break;case"<":C+="<";break;case">":C+=">";break;case" ":C+=" ";break;default:C+=D;break}}if(K!=(B.height-1)){C+="<br>"}}B.DivElement.innerHTML="<font size='4'><b>"+C+E+"</b></font>"};B.TermInit=function(){B.TermResetScreen()};B.Init();return B};var ZLIB=(ZLIB||{});if(typeof ZLIB.common_initialized==="undefined"){ZLIB.Z_NO_FLUSH=0;ZLIB.Z_PARTIAL_FLUSH=1;ZLIB.Z_SYNC_FLUSH=2;ZLIB.Z_FULL_FLUSH=3;ZLIB.Z_FINISH=4;ZLIB.Z_BLOCK=5;ZLIB.Z_TREES=6;ZLIB.Z_OK=0;ZLIB.Z_STREAM_END=1;ZLIB.Z_NEED_DICT=2;ZLIB.Z_ERRNO=(-1);ZLIB.Z_STREAM_ERROR=(-2);ZLIB.Z_DATA_ERROR=(-3);ZLIB.Z_MEM_ERROR=(-4);ZLIB.Z_BUF_ERROR=(-5);ZLIB.Z_VERSION_ERROR=(-6);ZLIB.Z_DEFLATED=8;ZLIB.z_stream=function(){this.next_in=0;this.avail_in=0;this.total_in=0;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg=null;this.state=null;this.data_type=0;this.adler=0;this.input_data="";this.output_data="";this.error=0;this.checksum_function=null};ZLIB.gz_header=function(){this.text=0;this.time=0;this.xflags=0;this.os=255;this.extra=null;this.extra_len=0;this.extra_max=0;this.name=null;this.name_max=0;this.comment=null;this.comm_max=0;this.hcrc=0;this.done=0};ZLIB.common_initialized=true}if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js")}(function(){var n=15;var F=0;var C=1;var al=2;var ae=3;var z=4;var A=5;var ab=6;var h=7;var E=8;var p=9;var o=10;var am=11;var an=12;var ai=13;var k=14;var j=15;var ak=16;var V=17;var f=18;var R=19;var P=20;var S=21;var q=22;var r=23;var Z=24;var X=25;var d=26;var U=27;var u=28;var a=29;var aa=30;var aj=31;var y=852;var x=592;var w=(y+x);var g=0;var W=1;var t=2;var M=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var N=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69];var K=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var L=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ZLIB.inflate_copyright=" inflate 1.2.6 Copyright 1995-2012 Mark Adler ";function J(aQ,aU){var aL=15;var aT=aQ.next;var ar=(aU==t?aQ.distbits:aQ.lenbits);var aW=aQ.work;var aG=aQ.lens;var aH=(aU==t?aQ.nlen:0);var aR=aQ.codes;var at;if(aU==W){at=aQ.nlen}else{if(aU==t){at=aQ.ndist}else{at=19}}var aF;var aS;var aM,aK;var aP;var av;var aw;var aE;var aV;var aC;var aD;var aA;var aI;var aJ;var aB;var aN;var ap;var aq;var ay;var az;var ax;var au=new Array(aL+1);var aO=new Array(aL+1);for(aF=0;aF<=aL;aF++){au[aF]=0}for(aS=0;aS<at;aS++){au[aG[aH+aS]]++}aP=ar;for(aK=aL;aK>=1;aK--){if(au[aK]!=0){break}}if(aP>aK){aP=aK}if(aK==0){aB={op:64,bits:1,val:0};aR[aT++]=aB;aR[aT++]=aB;if(aU==t){aQ.distbits=1}else{aQ.lenbits=1}aQ.next=aT;return 0}for(aM=1;aM<aK;aM++){if(au[aM]!=0){break}}if(aP<aM){aP=aM}aE=1;for(aF=1;aF<=aL;aF++){aE<<=1;aE-=au[aF];if(aE<0){return -1}}if(aE>0&&(aU==g||aK!=1)){aQ.next=aT;return -1}aO[1]=0;for(aF=1;aF<aL;aF++){aO[aF+1]=aO[aF]+au[aF]}for(aS=0;aS<at;aS++){if(aG[aH+aS]!=0){aW[aO[aG[aH+aS]]++]=aS}}switch(aU){case g:ap=ay=aW;aq=0;az=0;ax=19;break;case W:ap=M;aq=-257;ay=N;az=-257;ax=256;break;default:ap=K;ay=L;aq=0;az=0;ax=-1}aC=0;aS=0;aF=aM;aN=aT;av=aP;aw=0;aI=-1;aV=1<<aP;aJ=aV-1;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}for(;;){aB={op:0,bits:aF-aw,val:0};if(aW[aS]<ax){aB.val=aW[aS]}else{if(aW[aS]>ax){aB.op=ay[az+aW[aS]];aB.val=ap[aq+aW[aS]]}else{aB.op=32+64}}aD=1<<(aF-aw);aA=1<<av;aM=aA;do{aA-=aD;aR[aN+(aC>>>aw)+aA]=aB}while(aA!=0);aD=1<<(aF-1);while(aC&aD){aD>>>=1}if(aD!=0){aC&=aD-1;aC+=aD}else{aC=0}aS++;if(--(au[aF])==0){if(aF==aK){break}aF=aG[aH+aW[aS]]}if(aF>aP&&(aC&aJ)!=aI){if(aw==0){aw=aP}aN+=aM;av=aF-aw;aE=(1<<av);while(av+aw<aK){aE-=au[av+aw];if(aE<=0){break}av++;aE<<=1}aV+=1<<av;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}aI=aC&aJ;aR[aT+aI]={op:av,bits:aP,val:aN-aT}}}if(aC!=0){aR[aN+aC]={op:64,bits:aF-aw,val:0}}aQ.next=aT+aV;if(aU==t){aQ.distbits=aP}else{aQ.lenbits=aP}return 0}function G(aM,aK){var aL;var aB;var aH;var aC;var aJ;var ap;var aw;var aQ;var aN;var aP;var aO;var aA;var aq;var ar;var aD;var at;var aG;var av;var az;var aI;var aE;var au;var ay=-1;var ax=-1;aL=aM.state;aB=aM.input_data;aH=aM.next_in;aC=aH+aM.avail_in-5;aJ=aM.next_out;ap=aJ-(aK-aM.avail_out);aw=aJ+(aM.avail_out-257);aQ=aL.wsize;aN=aL.whave;aP=aL.wnext;aO=aL.window;aA=aL.hold;aq=aL.bits;ar=aL.codes;aD=aL.lencode;at=aL.distcode;aG=(1<<aL.lenbits)-1;av=(1<<aL.distbits)-1;loop:do{if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[aD+(aA&aG)];dolen:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI==0){aM.output_data+=String.fromCharCode(az.val);aJ++}else{if(aI&16){aE=az.val;aI&=15;if(aI){if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}aE+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI}if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[at+(aA&av)];dodist:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI&16){au=az.val;aI&=15;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}}au+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI;aI=aJ-ap;if(au>aI){aI=au-aI;if(aI>aN){if(aL.sane){aM.msg="invalid distance too far back";aL.mode=a;break loop}}ay=0;ax=-1;if(aP==0){ay+=aQ-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;aI=0;ay=-1;ax=aJ-au}}else{ay+=aP-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;ay=-1;ax=aJ-au}}}else{ay=-1;ax=aJ-au}if(ay>=0){aM.output_data+=aO.substring(ay,ay+aE);aJ+=aE;ay+=aE}else{var aF=aE;if(aF>aJ-ax){aF=aJ-ax}aM.output_data+=aM.output_data.substring(ax,ax+aF);aJ+=aF;aE-=aF;ax+=aF;aJ+=aE;while(aE>2){aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aE-=3}if(aE){aM.output_data+=aM.output_data.charAt(ax++);if(aE>1){aM.output_data+=aM.output_data.charAt(ax++)}}}}else{if((aI&64)==0){az=ar[at+(az.val+(aA&((1<<aI)-1)))];continue dodist}else{aM.msg="invalid distance code";aL.mode=a;break loop}}break dodist}}else{if((aI&64)==0){az=ar[aD+(az.val+(aA&((1<<aI)-1)))];continue dolen}else{if(aI&32){aL.mode=am;break loop}else{aM.msg="invalid literal/length code";aL.mode=a;break loop}}}}break dolen}}while(aH<aC&&aJ<aw);aE=aq>>>3;aH-=aE;aq-=aE<<3;aA&=(1<<aq)-1;aM.next_in=aH;aM.next_out=aJ;aM.avail_in=(aH<aC?5+(aC-aH):5-(aH-aC));aM.avail_out=(aJ<aw?257+(aw-aJ):257-(aJ-aw));aL.hold=aA;aL.bits=aq}function ad(ar){var aq;var ap=new Array(ar);for(aq=0;aq<ar;aq++){ap[aq]=0}return ap}function D(ar,aq,ap){return(ar&&(aq in ar))?ar[aq]:ap}function e(){return 0}function I(){var aq;this.mode=0;this.last=0;this.wrap=0;this.havedict=0;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=0;this.distcode=0;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=0;this.lens=ad(320);this.work=ad(288);this.codes=new Array(w);var ap={op:0,bits:0,val:0};for(aq=0;aq<w;aq++){this.codes[aq]=ap}this.sane=0;this.back=0;this.was=0}ZLIB.inflateResetKeep=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;aq.total_in=aq.total_out=ap.total=0;aq.msg=null;if(ap.wrap){aq.adler=ap.wrap&1}ap.mode=F;ap.last=0;ap.havedict=0;ap.dmax=32768;ap.head=null;ap.hold=0;ap.bits=0;ap.lencode=0;ap.distcode=0;ap.next=0;ap.sane=1;ap.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(aq,ar){var at;var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;if(typeof ar==="undefined"){ar=n}if(ar<0){at=0;ar=-ar}else{at=(ar>>>4)+1;if(ar<48){ar&=15}}if(at==1&&(typeof ZLIB.adler32==="function")){aq.checksum_function=ZLIB.adler32}else{if(at==2&&(typeof ZLIB.crc32==="function")){aq.checksum_function=ZLIB.crc32}else{aq.checksum_function=e}}if(ar&&(ar<8||ar>15)){return ZLIB.Z_STREAM_ERROR}if(ap.window&&ap.wbits!=ar){ap.window=null}ap.wrap=at;ap.wbits=ar;ap.wsize=0;ap.whave=0;ap.wnext=0;return ZLIB.inflateResetKeep(aq)};ZLIB.inflateInit=function(aq){var ap=new ZLIB.z_stream();ap.state=new I();ZLIB.inflateReset(ap,aq);return ap};ZLIB.inflatePrime=function(ar,ap,at){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;if(ap<0){aq.hold=0;aq.bits=0;return ZLIB.Z_OK}if(ap>16||aq.bits+ap>32){return ZLIB.Z_STREAM_ERROR}at&=(1<<ap)-1;aq.hold+=at<<aq.bits;aq.bits+=ap;return ZLIB.Z_OK};var T=null;var s=null;function B(aq){var ap;if(!T){T=[{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:192},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:160},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:224},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:144},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:208},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:176},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:240},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:200},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:168},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:232},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:152},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:216},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:184},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:248},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:196},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:164},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:228},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:148},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:212},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:180},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:244},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:204},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:172},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:236},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:156},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:220},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:188},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:252},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:194},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:162},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:226},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:146},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:210},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:178},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:242},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:202},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:170},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:234},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:154},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:218},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:186},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:250},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:198},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:166},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:230},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:150},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:214},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:182},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:246},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:206},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:174},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:238},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:158},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:222},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:190},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:254},{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:193},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:161},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:225},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:145},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:209},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:177},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:241},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:201},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:169},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:233},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:153},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:217},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:185},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:249},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:197},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:165},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:229},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:149},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:213},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:181},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:245},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:205},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:173},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:237},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:157},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:221},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:189},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:253},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:195},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:163},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:227},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:147},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:211},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:243},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:203},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:171},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:235},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:155},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:219},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:187},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:251},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:199},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:167},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:231},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:151},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:215},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:183},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:247},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:207},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:175},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:239},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:159},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:223},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:191},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:255}]}if(!s){s=[{op:16,bits:5,val:1},{op:23,bits:5,val:257},{op:19,bits:5,val:17},{op:27,bits:5,val:4097},{op:17,bits:5,val:5},{op:25,bits:5,val:1025},{op:21,bits:5,val:65},{op:29,bits:5,val:16385},{op:16,bits:5,val:3},{op:24,bits:5,val:513},{op:20,bits:5,val:33},{op:28,bits:5,val:8193},{op:18,bits:5,val:9},{op:26,bits:5,val:2049},{op:22,bits:5,val:129},{op:64,bits:5,val:0},{op:16,bits:5,val:2},{op:23,bits:5,val:385},{op:19,bits:5,val:25},{op:27,bits:5,val:6145},{op:17,bits:5,val:7},{op:25,bits:5,val:1537},{op:21,bits:5,val:97},{op:29,bits:5,val:24577},{op:16,bits:5,val:4},{op:24,bits:5,val:769},{op:20,bits:5,val:49},{op:28,bits:5,val:12289},{op:18,bits:5,val:13},{op:26,bits:5,val:3073},{op:22,bits:5,val:193},{op:64,bits:5,val:0}]}aq.lencode=0;aq.distcode=512;for(ap=0;ap<512;ap++){aq.codes[ap]=T[ap]}for(ap=0;ap<32;ap++){aq.codes[ap+512]=s[ap]}aq.lenbits=9;aq.distbits=5}function ao(ar){var aq=ar.state;var ap=ar.output_data.length;if(aq.window===null){aq.window=""}if(aq.wsize==0){aq.wsize=1<<aq.wbits}if(ap>=aq.wsize){aq.window=ar.output_data.substring(ap-aq.wsize)}else{if(aq.whave+ap<aq.wsize){aq.window+=ar.output_data}else{aq.window=aq.window.substring(aq.whave-(aq.wsize-ap))+ar.output_data}}aq.whave=aq.window.length;if(aq.whave<aq.wsize){aq.wnext=aq.whave}else{aq.wnext=0}return 0}function l(aq,ar){var ap=[ar&255,(ar>>>8)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,2)}function m(aq,ar){var ap=[ar&255,(ar>>>8)&255,(ar>>>16)&255,(ar>>>24)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,4)}function Y(aq,ap){ap.strm=aq;ap.left=aq.avail_out;ap.next=aq.next_in;ap.have=aq.avail_in;ap.hold=aq.state.hold;ap.bits=aq.state.bits;return ap}function ag(ap){var aq=ap.strm;aq.next_in=ap.next;aq.avail_out=ap.left;aq.avail_in=ap.have;aq.state.hold=ap.hold;aq.state.bits=ap.bits}function O(ap){ap.hold=0;ap.bits=0}function af(ap){if(ap.have==0){return false}ap.have--;ap.hold+=(ap.strm.input_data.charCodeAt(ap.next++)&255)<<ap.bits;ap.bits+=8;return true}function ac(aq,ap){while(aq.bits<ap){if(!af(aq)){return false}}return true}function b(aq,ap){return aq.hold&((1<<ap)-1)}function v(aq,ap){aq.hold>>>=ap;aq.bits-=ap}function c(ap){ap.hold>>>=ap.bits&7;ap.bits-=ap.bits&7}function ah(ap){return((ap>>>24)&255)+((ap>>>8)&65280)+((ap&65280)<<8)+((ap&255)<<24)}var H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(aC,ar){var aB;var aA;var ap,ay;var aq;var au=-1;var at=-1;var av;var aw;var ax;var az;if(!aC||!aC.state||(!aC.input_data&&aC.avail_in!=0)){return ZLIB.Z_STREAM_ERROR}aB=aC.state;if(aB.mode==am){aB.mode=an}aA={};Y(aC,aA);ap=aA.have;ay=aA.left;az=ZLIB.Z_OK;inf_leave:for(;;){switch(aB.mode){case F:if(aB.wrap==0){aB.mode=an;break}if(!ac(aA,16)){break inf_leave}if((aB.wrap&2)&&aA.hold==35615){aB.check=aC.checksum_function(0,null,0,0);l(aC,aA.hold);O(aA);aB.mode=C;break}aB.flags=0;if(aB.head!==null){aB.head.done=-1}if(!(aB.wrap&1)||((b(aA,8)<<8)+(aA.hold>>>8))%31){aC.msg="incorrect header check";aB.mode=a;break}if(b(aA,4)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}v(aA,4);ax=b(aA,4)+8;if(aB.wbits==0){aB.wbits=ax}else{if(ax>aB.wbits){aC.msg="invalid window size";aB.mode=a;break}}aB.dmax=1<<ax;aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=aA.hold&512?p:am;O(aA);break;case C:if(!ac(aA,16)){break inf_leave}aB.flags=aA.hold;if((aB.flags&255)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}if(aB.flags&57344){aC.msg="unknown header flags set";aB.mode=a;break}if(aB.head!==null){aB.head.text=(aA.hold>>>8)&1}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=al;case al:if(!ac(aA,32)){break inf_leave}if(aB.head!==null){aB.head.time=aA.hold}if(aB.flags&512){m(aC,aA.hold)}O(aA);aB.mode=ae;case ae:if(!ac(aA,16)){break inf_leave}if(aB.head!==null){aB.head.xflags=aA.hold&255;aB.head.os=aA.hold>>>8}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=z;case z:if(aB.flags&1024){if(!ac(aA,16)){break inf_leave}aB.length=aA.hold;if(aB.head!==null){aB.head.extra_len=aA.hold}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.head.extra=""}else{if(aB.head!==null){aB.head.extra=null}}aB.mode=A;case A:if(aB.flags&1024){aq=aB.length;if(aq>aA.have){aq=aA.have}if(aq){if(aB.head!==null&&aB.head.extra!==null){ax=aB.head.extra_len-aB.length;aB.head.extra+=aC.input_data.substring(aA.next,aA.next+(ax+aq>aB.head.extra_max?aB.head.extra_max-ax:aq))}if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;aB.length-=aq}if(aB.length){break inf_leave}}aB.length=0;aB.mode=ab;case ab:if(aB.flags&2048){if(aA.have==0){break inf_leave}if(aB.head!==null&&aB.head.name===null){aB.head.name=""}aq=0;do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.name_max){aB.head.name+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.name=null}}aB.length=0;aB.mode=h;case h:if(aB.flags&4096){if(aA.have==0){break inf_leave}aq=0;if(aB.head!==null&&aB.head.comment===null){aB.head.comment=""}do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.comm_max){aB.head.comment+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.comment=null}}aB.mode=E;case E:if(aB.flags&512){if(!ac(aA,16)){break inf_leave}if(aA.hold!=(aB.check&65535)){aC.msg="header crc mismatch";aB.mode=a;break}O(aA)}if(aB.head!==null){aB.head.hcrc=(aB.flags>>>9)&1;aB.head.done=1}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;break;case p:if(!ac(aA,32)){break inf_leave}aC.adler=aB.check=ah(aA.hold);O(aA);aB.mode=o;case o:if(aB.havedict==0){ag(aA);return ZLIB.Z_NEED_DICT}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;case am:if(ar==ZLIB.Z_BLOCK||ar==ZLIB.Z_TREES){break inf_leave}case an:if(aB.last){c(aA);aB.mode=d;break}if(!ac(aA,3)){break inf_leave}aB.last=b(aA,1);v(aA,1);switch(b(aA,2)){case 0:aB.mode=ai;break;case 1:B(aB);aB.mode=R;if(ar==ZLIB.Z_TREES){v(aA,2);break inf_leave}break;case 2:aB.mode=ak;break;case 3:aC.msg="invalid block type";aB.mode=a}v(aA,2);break;case ai:c(aA);if(!ac(aA,32)){break inf_leave}if((aA.hold&65535)!=(((aA.hold>>>16)&65535)^65535)){aC.msg="invalid stored block lengths";aB.mode=a;break}aB.length=aA.hold&65535;O(aA);aB.mode=k;if(ar==ZLIB.Z_TREES){break inf_leave}case k:aB.mode=j;case j:aq=aB.length;if(aq){if(aq>aA.have){aq=aA.have}if(aq>aA.left){aq=aA.left}if(aq==0){break inf_leave}aC.output_data+=aC.input_data.substring(aA.next,aA.next+aq);aC.next_out+=aq;aA.have-=aq;aA.next+=aq;aA.left-=aq;aB.length-=aq;break}aB.mode=am;break;case ak:if(!ac(aA,14)){break inf_leave}aB.nlen=b(aA,5)+257;v(aA,5);aB.ndist=b(aA,5)+1;v(aA,5);aB.ncode=b(aA,4)+4;v(aA,4);if(aB.nlen>286||aB.ndist>30){aC.msg="too many length or distance symbols";aB.mode=a;break}aB.have=0;aB.mode=V;case V:while(aB.have<aB.ncode){if(!ac(aA,3)){break inf_leave}var aD=b(aA,3);aB.lens[H[aB.have++]]=aD;v(aA,3)}while(aB.have<19){aB.lens[H[aB.have++]]=0}aB.next=0;aB.lencode=0;aB.lenbits=7;az=J(aB,g);if(az){aC.msg="invalid code lengths set";aB.mode=a;break}aB.have=0;aB.mode=f;case f:while(aB.have<aB.nlen+aB.ndist){for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.val<16){v(aA,av.bits);aB.lens[aB.have++]=av.val}else{if(av.val==16){if(!ac(aA,av.bits+2)){break inf_leave}v(aA,av.bits);if(aB.have==0){aC.msg="invalid bit length repeat";aB.mode=a;break}ax=aB.lens[aB.have-1];aq=3+b(aA,2);v(aA,2)}else{if(av.val==17){if(!ac(aA,av.bits+3)){break inf_leave}v(aA,av.bits);ax=0;aq=3+b(aA,3);v(aA,3)}else{if(!ac(aA,av.bits+7)){break inf_leave}v(aA,av.bits);ax=0;aq=11+b(aA,7);v(aA,7)}}if(aB.have+aq>aB.nlen+aB.ndist){aC.msg="invalid bit length repeat";aB.mode=a;break}while(aq--){aB.lens[aB.have++]=ax}}}if(aB.mode==a){break}if(aB.lens[256]==0){aC.msg="invalid code -- missing end-of-block";aB.mode=a;break}aB.next=0;aB.lencode=aB.next;aB.lenbits=9;az=J(aB,W);if(az){aC.msg="invalid literal/lengths set";aB.mode=a;break}aB.distcode=aB.next;aB.distbits=6;az=J(aB,t);if(az){aC.msg="invalid distances set";aB.mode=a;break}aB.mode=R;if(ar==ZLIB.Z_TREES){break inf_leave}case R:aB.mode=P;case P:if(aA.have>=6&&aA.left>=258){ag(aA);G(aC,ay);Y(aC,aA);if(aB.mode==am){aB.back=-1}break}aB.back=0;for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.op&&(av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.lencode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if(aw.bits+av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;aB.length=av.val;if(av.op==0){aB.mode=X;break}if(av.op&32){aB.back=-1;aB.mode=am;break}if(av.op&64){aC.msg="invalid literal/length code";aB.mode=a;break}aB.extra=av.op&15;aB.mode=S;case S:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.length+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.was=aB.length;aB.mode=q;case q:for(;;){av=aB.codes[aB.distcode+b(aA,aB.distbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if((av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.distcode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if((aw.bits+av.bits)<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;if(av.op&64){aC.msg="invalid distance code";aB.mode=a;break}aB.offset=av.val;aB.extra=av.op&15;aB.mode=r;case r:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.offset+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.mode=Z;case Z:if(aA.left==0){break inf_leave}aq=ay-aA.left;if(aB.offset>aq){aq=aB.offset-aq;if(aq>aB.whave){if(aB.sane){aC.msg="invalid distance too far back";aB.mode=a;break}}if(aq>aB.wnext){aq-=aB.wnext;au=aB.wsize-aq;at=-1}else{au=aB.wnext-aq;at=-1}if(aq>aB.length){aq=aB.length}}else{au=-1;at=aC.next_out-aB.offset;aq=aB.length}if(aq>aA.left){aq=aA.left}aA.left-=aq;aB.length-=aq;if(au>=0){aC.output_data+=aB.window.substring(au,au+aq);aC.next_out+=aq;aq=0}else{aC.next_out+=aq;do{aC.output_data+=aC.output_data.charAt(at++)}while(--aq)}if(aB.length==0){aB.mode=P}break;case X:if(aA.left==0){break inf_leave}aC.output_data+=String.fromCharCode(aB.length);aC.next_out++;aA.left--;aB.mode=P;break;case d:if(aB.wrap){if(!ac(aA,32)){break inf_leave}ay-=aA.left;aC.total_out+=ay;aB.total+=ay;if(ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,aC.output_data.length-ay,ay)}ay=aA.left;if((aB.flags?aA.hold:ah(aA.hold))!=aB.check){aC.msg="incorrect data check";aB.mode=a;break}O(aA)}aB.mode=U;case U:if(aB.wrap&&aB.flags){if(!ac(aA,32)){break inf_leave}if(aA.hold!=(aB.total&4294967295)){aC.msg="incorrect length check";aB.mode=a;break}O(aA)}aB.mode=u;case u:az=ZLIB.Z_STREAM_END;break inf_leave;case a:az=ZLIB.Z_DATA_ERROR;break inf_leave;case aa:return ZLIB.Z_MEM_ERROR;case aj:default:return ZLIB.Z_STREAM_ERROR}}inf_leave:ag(aA);if(aB.wsize||(ay!=aC.avail_out&&aB.mode<a&&(aB.mode<d||ar!=ZLIB.Z_FINISH))){if(ao(aC)){aB.mode=aa;return ZLIB.Z_MEM_ERROR}}ap-=aC.avail_in;ay-=aC.avail_out;aC.total_in+=ap;aC.total_out+=ay;aB.total+=ay;if(aB.wrap&&ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,0,aC.output_data.length)}aC.data_type=aB.bits+(aB.last?64:0)+(aB.mode==am?128:0)+(aB.mode==R||aB.mode==k?256:0);if(((ap==0&&ay==0)||ar==ZLIB.Z_FINISH)&&az==ZLIB.Z_OK){az=ZLIB.Z_BUF_ERROR}return az};ZLIB.inflateEnd=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;ap.window=null;aq.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(at,au){var ar;var ap;var aq=16384;this.input_data=at;this.next_in=D(au,"next_in",0);this.avail_in=D(au,"avail_in",at.length-this.next_in);ar=D(au,"flush",ZLIB.Z_SYNC_FLUSH);ap=D(au,"avail_out",-1);var av="";do{this.avail_out=(ap>=0?ap:aq);this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,ar);if(ap>=0){return this.output_data}av+=this.output_data;if(this.avail_out>0){break}}while(this.error==ZLIB.Z_OK);return av};ZLIB.z_stream.prototype.inflateReset=function(ap){return ZLIB.inflateReset(this,ap)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js")}(function(){var c=65521;var d=5552;function b(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f.charCodeAt(j)&255;if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f.charCodeAt(j++)&255;k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(g--){e+=f.charCodeAt(j++)&255;k+=e}e%=c;k%=c}return e|(k<<16)}function a(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f[j];if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f[j++];k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(g--){e+=f[j++];k+=e}e%=c;k%=c}return e|(k<<16)}ZLIB.adler32=function(e,f,h,g){if(typeof f==="string"){return b(e,f,h,g)}else{return a(e,f,h,g)}};ZLIB.adler32_combine=function(e,f,g){var j;var k;var h;if(g<0){return 4294967295}g%=c;h=g;j=e&65535;k=h*j;k%=c;j+=(f&65535)+c-1;k+=((e>>16)&65535)+((f>>16)&65535)+c-h;if(j>=c){j-=c}if(j>=c){j-=c}if(k>=(c<<1)){k-=(c<<1)}if(k>=c){k-=c}return j|(k<<16)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js")}(function(){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function c(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g.charCodeAt(k++))&255]^(h>>>8)}while(--j)}return h^4294967295}function b(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g[k++])&255]^(h>>>8)}while(--j)}return h^4294967295}ZLIB.crc32=function(h,g,k,j){if(typeof g==="string"){return c(h,g,k,j)}else{return b(h,g,k,j)}};var d=32;function f(g,k){var j;var h=0;j=0;while(k){if(k&1){j^=g[h]}k>>=1;h++}return j}function e(j,g){var h;for(h=0;h<d;h++){j[h]=f(g,g[h])}}ZLIB.crc32_combine=function(g,h,k){var l;var o;var j;var m;if(k<=0){return g}j=new Array(d);m=new Array(d);m[0]=3988292384;o=1;for(l=1;l<d;l++){m[l]=o;o<<=1}e(j,m);e(m,j);do{e(j,m);if(k&1){g=f(j,g)}k>>=1;if(k==0){break}e(m,j);if(k&1){g=f(m,g)}k>>=1}while(k!=0);g^=h;return g}}());var CreateAmtRedirect=function(a){var b={};b.m=a;a.parent=b;b.State=0;b.socket=null;b.host=null;b.port=0;b.user=null;b.pass=null;b.authuri="/RedirectionService";b.tlsv1only=0;b.inDataCount=0;b.connectstate=0;b.protocol=a.protocol;b.debugmode=0;b.amtaccumulator="";b.amtsequence=1;b.amtkeepalivetimer=null;b.onStateChanged=null;b.Start=function(c,e,g,d,f){b.host=c;b.port=e;b.user=g;b.pass=d;b.connectstate=0;b.inDataCount=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+c+"&port="+e+"&tls="+f+((g=="*")?"&serverauth=1":"")+((typeof d==="undefined")?("&serverauth=1&user="+g):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed;b.xxStateChange(1)};b.xxOnSocketConnected=function(){if(b.debugmode==1){console.log("onSocketConnected")}b.xxStateChange(2);if(b.protocol==1){b.xxSend(b.RedirectStartSol)}if(b.protocol==2){b.xxSend(b.RedirectStartKvm)}if(b.protocol==3){b.xxSend(b.RedirectStartIder)}};b.xxOnMessage=function(g){if(b.debugmode==1){console.log("Recv",g.data)}b.inDataCount++;if(typeof g.data=="object"){var h=new FileReader();if(h.readAsBinaryString){h.onload=function(f){b.xxOnSocketData(f.target.result)};h.readAsBinaryString(new Blob([g.data]))}else{if(h.readAsArrayBuffer){h.onloadend=function(f){b.xxOnSocketData(f.target.result)};h.readAsArrayBuffer(g.data)}else{var c="";var d=new Uint8Array(g.data);var k=d.byteLength;for(var j=0;j<k;j++){c+=String.fromCharCode(d[j])}b.xxOnSocketData(c)}}}else{b.xxOnSocketData(g.data)}};b.xxOnSocketData=function(o){if(!o||b.connectstate==-1){return}if(typeof o==="object"){var g="";var j=new Uint8Array(o);var t=j.byteLength;for(var s=0;s<t;s++){g+=String.fromCharCode(j[s])}o=g}else{if(typeof o!=="string"){return}}if((b.protocol==2||b.protocol==3)&&b.connectstate==1){return b.m.ProcessData(o)}b.amtaccumulator+=o;while(b.amtaccumulator.length>=1){var k=0;switch(b.amtaccumulator.charCodeAt(0)){case 17:if(b.amtaccumulator.length<4){return}var G=b.amtaccumulator.charCodeAt(1);switch(G){case 0:if(b.amtaccumulator.length<13){return}var x=b.amtaccumulator.charCodeAt(12);if(b.amtaccumulator.length<13+x){return}b.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));k=(13+x);break;default:b.Stop(1);break}break;case 20:if(b.amtaccumulator.length<9){return}var e=ReadIntX(b.amtaccumulator,5);if(b.amtaccumulator.length<9+e){return}var F=b.amtaccumulator.charCodeAt(1);var f=b.amtaccumulator.charCodeAt(4);var c=[];for(s=0;s<e;s++){c.push(b.amtaccumulator.charCodeAt(9+s))}var d=b.amtaccumulator.substring(9,9+e);k=9+e;if(f==0){if(c.indexOf(4)>=0){b.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(b.user.length+b.authuri.length+8)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0,0))}else{if(c.indexOf(3)>=0){b.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(b.user.length+b.authuri.length+7)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0))}else{if(c.indexOf(1)>=0){b.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(b.user.length+b.pass.length+2)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(b.pass.length)+b.pass)}else{b.Stop(2)}}}}else{if((f==3||f==4)&&F==1){var n=0;var B=d.charCodeAt(n);var A=d.substring(n+1,n+1+B);n+=(B+1);var w=d.charCodeAt(n);var v=d.substring(n+1,n+1+w);n+=(w+1);var z=0;var y=null;var l=b.xxRandomNonce(32);var E="00000002";var q="";if(f==4){z=d.charCodeAt(n);y=d.substring(n+1,n+1+z);n+=(z+1);q=E+":"+l+":"+y+":"}var p=hex_md5(hex_md5(b.user+":"+A+":"+b.pass)+":"+v+":"+q+hex_md5("POST:"+b.authuri));var H=b.user.length+A.length+v.length+b.authuri.length+l.length+E.length+p.length+7;if(f==4){H+=(y.length+1)}var h=String.fromCharCode(19,0,0,0,f)+IntToStrX(H)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(A.length)+A+String.fromCharCode(v.length)+v+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(l.length)+l+String.fromCharCode(E.length)+E+String.fromCharCode(p.length)+p;if(f==4){h+=(String.fromCharCode(y.length)+y)}b.xxSend(h)}else{if(F==0){if(b.protocol==1){var u=10000;var J=100;var I=0;var D=10000;var C=100;var r=0;b.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(u)+ShortToStrX(J)+ShortToStrX(I)+ShortToStrX(D)+ShortToStrX(C)+ShortToStrX(r)+IntToStrX(0))}if(b.protocol==2){b.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0))}if(b.protocol==3){b.connectstate=1;b.xxStateChange(3)}}else{b.Stop(3)}}}break;case 33:if(b.amtaccumulator.length<23){break}k=23;b.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(b.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));if(b.protocol==1){b.amtkeepalivetimer=setInterval(b.xxSendAmtKeepAlive,2000)}b.connectstate=1;b.xxStateChange(3);break;case 41:if(b.amtaccumulator.length<10){break}k=10;break;case 42:if(b.amtaccumulator.length<10){break}var m=(10+((b.amtaccumulator.charCodeAt(9)&255)<<8)+(b.amtaccumulator.charCodeAt(8)&255));if(b.amtaccumulator.length<m){break}b.m.ProcessData(b.amtaccumulator.substring(10,m));k=m;break;case 43:if(b.amtaccumulator.length<8){break}k=8;break;case 65:if(b.amtaccumulator.length<8){break}b.connectstate=1;b.m.Start();if(b.amtaccumulator.length>8){b.m.ProcessData(b.amtaccumulator.substring(8))}k=b.amtaccumulator.length;break;default:console.log("Unknown Intel AMT command: "+b.amtaccumulator.charCodeAt(0)+" acclen="+b.amtaccumulator.length);b.Stop(4);return}if(k==0){return}b.amtaccumulator=b.amtaccumulator.substring(k)}};b.xxSend=function(e){if(b.socket!=null&&b.socket.readyState==WebSocket.OPEN){if(b.debugmode==1){console.log("Send",e)}var c=new Uint8Array(e.length);for(var d=0;d<e.length;++d){c[d]=e.charCodeAt(d)}b.socket.send(c.buffer)}};b.send=function(c){if(b.socket==null||b.connectstate!=1){return}if(b.protocol==1){b.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(c.length)+c)}else{b.xxSend(c)}};b.xxSendAmtKeepAlive=function(){if(b.socket==null){return}b.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(b.amtsequence++))};b.xxRandomNonceX="abcdef0123456789";b.xxRandomNonce=function(d){var e="";for(var c=0;c<d;c++){e+=b.xxRandomNonceX.charAt(Math.floor(Math.random()*b.xxRandomNonceX.length))}return e};b.xxOnSocketClosed=function(){if(b.debugmode==1){console.log("onSocketClosed")}if((b.inDataCount==0)&&(b.tlsv1only==0)){b.tlsv1only=1;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+b.host+"&port="+b.port+"&tls="+b.tls+"&tls1only=1"+((b.user=="*")?"&serverauth=1":"")+((typeof pass==="undefined")?("&serverauth=1&user="+b.user):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed}else{b.Stop(5)}};b.xxStateChange=function(c){if(b.State==c){return}b.State=c;b.m.xxStateChange(b.State);if(b.onStateChanged!=null){b.onStateChanged(b,b.State)}};b.Stop=function(c){if(b.debugmode==1){console.log("onSocketStop",c)}b.xxStateChange(0);b.connectstate=-1;b.amtaccumulator="";if(b.socket!=null){b.socket.close();b.socket=null}if(b.amtkeepalivetimer!=null){clearInterval(b.amtkeepalivetimer);b.amtkeepalivetimer=null}};b.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);b.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);b.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return b};var CreateWsmanComm=function(g,k,m,j,l){var h={};h.PendingAjax=[];h.ActiveAjaxCount=0;h.MaxActiveAjaxCount=1;h.FailAllError=0;h.challengeParams=null;h.noncecounter=1;h.authcounter=0;h.socket=null;h.socketState=0;h.host=g;h.port=k;h.user=m;h.pass=j;h.tls=l;h.tlsv1only=1;h.cnonce=Math.random().toString(36).substring(7);h.PerformAjax=function(p,o,r,q,s,n){if(h.ActiveAjaxCount<h.MaxActiveAjaxCount&&h.PendingAjax.length==0){h.PerformAjaxEx(p,o,r,s,n)}else{if(q==1){h.PendingAjax.unshift([p,o,r,s,n])}else{h.PendingAjax.push([p,o,r,s,n])}}};h.PerformNextAjax=function(){if(h.ActiveAjaxCount>=h.MaxActiveAjaxCount||h.PendingAjax.length==0){return}var n=h.PendingAjax.shift();h.PerformAjaxEx(n[0],n[1],n[2],n[3],n[4]);h.PerformNextAjax()};h.PerformAjaxEx=function(p,o,q,r,n){if(h.FailAllError!=0){h.gotNextMessagesError({status:h.FailAllError},"error",null,[p,o,q,r,n]);return}if(!p){p=""}h.ActiveAjaxCount++;return h.PerformAjaxExNodeJS(p,o,q,r,n)};h.pendingAjaxCall=[];h.PerformAjaxExNodeJS=function(p,o,q,r,n){h.PerformAjaxExNodeJS2(p,o,q,r,n,3)};h.PerformAjaxExNodeJS2=function(p,o,r,s,n,q){if(q<=0||h.FailAllError!=0){h.ActiveAjaxCount--;if(h.FailAllError!=999){h.gotNextMessages(null,"error",{status:((h.FailAllError==0)?408:h.FailAllError)},[p,o,r,s,n])}h.PerformNextAjax();return}h.pendingAjaxCall.push([p,o,r,s,n,q]);if(h.socketState==0){h.xxConnectHttpSocket()}else{if(h.socketState==2){h.sendRequest(p,s,n)}}};h.sendRequest=function(p,r,n){r=r?r:"/wsman";n=n?n:"POST";var o=n+" "+r+" HTTP/1.1\r\n";if(h.challengeParams!=null){var q=hex_md5(hex_md5(h.user+":"+h.challengeParams.realm+":"+h.pass)+":"+h.challengeParams.nonce+":"+h.noncecounter+":"+h.cnonce+":"+h.challengeParams.qop+":"+hex_md5(n+":"+r));o+="Authorization: "+h.renderDigest({username:h.user,realm:h.challengeParams.realm,nonce:h.challengeParams.nonce,uri:r,qop:h.challengeParams.qop,response:q,nc:h.noncecounter++,cnonce:h.cnonce})+"\r\n"}o+="Host: "+h.host+":"+h.port+"\r\nTransfer-Encoding: chunked\r\n\r\n"+p.length.toString(16).toUpperCase()+"\r\n"+p+"\r\n0\r\n\r\n";f(o)};h.parseDigest=function(n){var o=n.substring(7).split(",");for(i in o){o[i]=o[i].trim()}return o.reduce(function(p,r){var q=r.split("=");p[q[0]]=q[1].replace(/"/g,"");return p},{})};h.renderDigest=function(n){var o=[];for(i in n){o.push(i)}return"Digest "+o.reduce(function(q,p){return q+","+p+'="'+n[p]+'"'},"").substring(1)};h.xxConnectHttpSocket=function(){h.socketParseState=0;h.socketAccumulator="";h.socketHeader=null;h.socketData="";h.socketState=1;console.log(h.tlsv1only);h.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=1&host="+h.host+"&port="+h.port+"&tls="+h.tls+"&tlsv1only="+h.tlsv1only+((m=="*")?"&serverauth=1":"")+((typeof j==="undefined")?("&serverauth=1&user="+m):""));h.socket.onopen=c;h.socket.onmessage=a;h.socket.onclose=b};function c(){h.socketState=2;for(i in h.pendingAjaxCall){h.sendRequest(h.pendingAjaxCall[i][0],h.pendingAjaxCall[i][3],h.pendingAjaxCall[i][4])}}function a(p){if(typeof p.data=="object"){var q=new FileReader();if(q.readAsBinaryString){q.onload=function(t){d(t.target.result)};q.readAsBinaryString(new Blob([p.data]))}else{if(q.readAsArrayBuffer){q.onloadend=function(t){d(t.target.result)};q.readAsArrayBuffer(p.data)}else{var n="";var o=new Uint8Array(p.data);var s=o.byteLength;for(var r=0;r<s;r++){n+=String.fromCharCode(o[r])}d(n)}}}else{if(typeof p.data=="string"){d(p.data)}}}function d(r){if(typeof r==="object"){var n="",o=new Uint8Array(r),u=o.byteLength;for(var t=0;t<u;t++){n+=String.fromCharCode(o[t])}r=n}else{if(typeof r!=="string"){return}}h.socketAccumulator+=r;while(true){if(h.socketParseState==0){var s=h.socketAccumulator.indexOf("\r\n\r\n");if(s<0){return}h.socketHeader=h.socketAccumulator.substring(0,s).split("\r\n");h.socketAccumulator=h.socketAccumulator.substring(s+4);h.socketParseState=1;h.socketData="";h.socketXHeader={Directive:h.socketHeader[0].split(" ")};for(t in h.socketHeader){if(t!=0){var v=h.socketHeader[t].indexOf(":");h.socketXHeader[h.socketHeader[t].substring(0,v).toLowerCase()]=h.socketHeader[t].substring(v+2)}}}if(h.socketParseState==1){var q=-1;if((h.socketXHeader.connection!=undefined)&&(h.socketXHeader.connection.toLowerCase()=="close")&&((h.socketXHeader["transfer-encoding"]==undefined)||(h.socketXHeader["transfer-encoding"].toLowerCase()!="chunked"))){q=0}else{if(h.socketXHeader["content-length"]!=undefined){q=parseInt(h.socketXHeader["content-length"]);if(h.socketAccumulator.length<q){return}var r=h.socketAccumulator.substring(0,q);h.socketAccumulator=h.socketAccumulator.substring(q);h.socketData=r;q=0}else{var p=h.socketAccumulator.indexOf("\r\n");if(p<0){return}q=parseInt(h.socketAccumulator.substring(0,p),16);if(isNaN(q)){if(h.websocket){h.websocket.close()}return}if(h.socketAccumulator.length<p+2+q+2){return}var r=h.socketAccumulator.substring(p+2,p+2+q);h.socketAccumulator=h.socketAccumulator.substring(p+2+q+2);h.socketData+=r}}if(q==0){e(h.socketXHeader,h.socketData);h.socketParseState=0;h.socketHeader=null}}}}function e(o,n){var q=parseInt(o.Directive[1]);if(isNaN(q)){q=602}if(q==401&&++(h.authcounter)<3){h.challengeParams=h.parseDigest(o["www-authenticate"])}else{var p=h.pendingAjaxCall.shift();h.authcounter=0;h.ActiveAjaxCount--;h.gotNextMessages(n,"success",{status:q},p);h.PerformNextAjax()}}function b(n){h.socketState=0;if(h.socket!=null){h.socket.close();h.socket=null}if(h.pendingAjaxCall.length>0){var o=h.pendingAjaxCall.shift();var p=o[5];h.PerformAjaxExNodeJS2(o[0],o[1],o[2],o[3],o[4],--p)}}function f(q){if(h.socketState==2&&h.socket!=null&&h.socket.readyState==WebSocket.OPEN){var n=new Uint8Array(q.length);for(var p=0;p<q.length;++p){n[p]=q.charCodeAt(p)}try{h.socket.send(n.buffer)}catch(o){}}}h.gotNextMessages=function(o,q,p,n){if(h.FailAllError==999){return}if(h.FailAllError!=0){n[1](null,h.FailAllError,n[2]);return}if(p.status!=200){n[1](null,p.status,n[2]);return}n[1](o,200,n[2])};h.gotNextMessagesError=function(p,q,o,n){if(h.FailAllError==999){return}if(h.FailAllError!=0){n[1](null,h.FailAllError,n[2]);return}n[1](h,null,{Header:{HttpError:p.status}},p.status,n[2])};h.CancelAllQueries=function(n){while(h.PendingAjax.length>0){var o=h.PendingAjax.shift();o[1](null,n,o[2])}if(h.websocket!=null){h.websocket.close();h.websocket=null;h.socketState=0}};return h};var CreateAgentRedirect=function(a,b,e){var c={};c.m=b;b.parent=c;c.meshserver=a;c.State=0;c.nodeid=null;c.socket=null;c.connectstate=-1;c.tunnelid=Math.random().toString(36).substring(2);c.protocol=b.protocol;c.onStateChanged=null;c.ctrlMsgAllowed=true;c.attemptWebRTC=false;c.webRtcActive=false;c.webSwitchOk=false;c.webchannel=null;c.webrtc=null;c.debugmode=0;c.Start=function(f){var h,g=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+c.tunnelid;c.nodeid=f;c.connectstate=0;c.socket=new WebSocket(g);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onerror=function(j){console.error(j)};c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1);c.meshserver.send({action:"msg",type:"tunnel",nodeid:c.nodeid,value:"*/meshrelay.ashx?id="+c.tunnelid})};c.xxOnSocketConnected=function(){if(c.debugmode==1){console.log("onSocketConnected")}c.xxStateChange(2)};c.xxOnControlCommand=function(h){var f;try{f=JSON.parse(h)}catch(g){return}if(f.ctrlChannel!="102938"){c.xxOnSocketData(h);return}if(c.webrtc!=null){if(f.type=="answer"){c.webrtc.setRemoteDescription(new RTCSessionDescription(f),function(){},c.xxCloseWebRTC)}else{if(f.type=="webrtc0"){c.webSwitchOk=true;d()}else{if(f.type=="webrtc1"){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}')}else{if(f.type=="webrtc2"){}}}}}};c.sendCtrlMsg=function(g){if(c.ctrlMsgAllowed==true){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof g,g)}try{c.socket.send(g)}catch(f){}}};function d(){if((c.webSwitchOk==true)&&(c.webRtcActive==true)){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}');c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}');if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}}}c.xxOnMessage=function(k){if(c.State<3){if(k.data=="c"){try{c.socket.send(c.protocol)}catch(l){}c.xxStateChange(3);if(c.attemptWebRTC==true){var j=null;if(typeof RTCPeerConnection!=="undefined"){c.webrtc=new RTCPeerConnection(j)}else{if(typeof webkitRTCPeerConnection!=="undefined"){c.webrtc=new webkitRTCPeerConnection(j)}}if(c.webrtc!=null){c.webchannel=c.webrtc.createDataChannel("DataChannel",{});c.webchannel.onmessage=function(f){c.xxOnMessage({data:f.data})};c.webchannel.onopen=function(){c.webRtcActive=true;d()};c.webchannel.onclose=function(f){if(c.webRtcActive){c.Stop()}};c.webrtc.onicecandidate=function(f){if(f.candidate==null){try{c.socket.send(JSON.stringify(c.webrtcoffer))}catch(p){}}else{c.webrtcoffer.sdp+=("a="+f.candidate.candidate+"\r\n")}};c.webrtc.oniceconnectionstatechange=function(){if(c.webrtc!=null){if(c.webrtc.iceConnectionState=="disconnected"){if(c.webRtcActive==true){c.Stop()}else{c.xxCloseWebRTC()}}else{if(c.webrtc.iceConnectionState=="failed"){c.xxCloseWebRTC()}}}};c.webrtc.createOffer(function(f){c.webrtcoffer=f;c.webrtc.setLocalDescription(f,function(){},c.xxCloseWebRTC)},c.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}}return}}if(typeof k.data=="string"){c.xxOnControlCommand(k.data);return}if(typeof k.data=="object"){var m=new FileReader();if(m.readAsBinaryString){m.onload=function(f){c.xxOnSocketData(f.target.result)};m.readAsBinaryString(new Blob([k.data]))}else{if(m.readAsArrayBuffer){m.onloadend=function(f){c.xxOnSocketData(f.target.result)};m.readAsArrayBuffer(k.data)}else{var g="";var h=new Uint8Array(k.data);var o=h.byteLength;for(var n=0;n<o;n++){g+=String.fromCharCode(h[n])}c.xxOnSocketData(g)}}}else{c.xxOnSocketData(k.data)}};c.xxOnSocketData=function(h){if(!h||c.connectstate==-1){return}if(typeof h==="object"){var f="",g=new Uint8Array(h),k=g.byteLength;for(var j=0;j<k;j++){f+=String.fromCharCode(g[j])}h=f}else{if(typeof h!=="string"){return}}if((typeof args!="undefined")&&args.redirtrace){console.log("RedirRecv",typeof h,h.length,h)}return c.m.ProcessData(h)};c.sendText=function(f){if(typeof f!="string"){f=JSON.stringify(f)}c.send(encode_utf8(f))};c.send=function(k){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof k,k.length,k)}try{if(c.socket!=null&&c.socket.readyState==WebSocket.OPEN){if(typeof k=="string"){if(c.debugmode==1){var f=new Uint8Array(k.length),g=[];for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j);g.push(k.charCodeAt(j))}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}else{var f=new Uint8Array(k.length);for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j)}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}}else{if(c.webRtcActive==true){c.webchannel.send(k)}else{c.socket.send(k)}}}}catch(h){}};c.xxOnSocketClosed=function(){c.Stop(1)};c.xxStateChange=function(f){if(c.State==f){return}c.State=f;c.m.xxStateChange(c.State);if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}};c.xxCloseWebRTC=function(){if(c.webchannel!=null){try{c.webchannel.close()}catch(f){}c.webchannel=null}if(c.webrtc!=null){try{c.webrtc.close()}catch(f){}c.webrtc=null}c.webRtcActive=false};c.Stop=function(g){if(c.debugmode==1){console.log("stop",g)}c.xxCloseWebRTC();c.connectstate=-1;if(c.socket!=null){try{if(c.socket.readyState==1){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}');c.socket.close()}}catch(f){}c.socket=null}c.xxStateChange(0)};return c};var CreateKvmDataChannel=function(d,b,a){var c={};c.m=b;b.parent=c;c.webchannel=d;c.State=0;c.protocol=b.protocol;c.onStateChanged=null;c.onControlMsg=null;c.debugmode=0;c.keepalive=a;c.rtcKeepAlive=null;c.Start=function(){if(c.debugmode==1){console.log("start")}c.xxStateChange(3);c.webchannel.onmessage=c.xxOnMessage;c.rtcKeepAlive=setInterval(c.xxSendRtcKeepAlive,30000)};c.xxOnMessage=function(j){if(typeof j.data=="string"){if(c.onControlMsg!=null){c.onControlMsg(j.data)}return}if(typeof j.data=="object"){var k=new FileReader();if(k.readAsBinaryString){k.onload=function(f){c.xxOnSocketData(f.target.result)};k.readAsBinaryString(new Blob([j.data]))}else{if(k.readAsArrayBuffer){k.onloadend=function(f){c.xxOnSocketData(f.target.result)};k.readAsArrayBuffer(j.data)}else{var g="",h=new Uint8Array(j.data),m=h.byteLength;for(var l=0;l<m;l++){g+=String.fromCharCode(h[l])}c.xxOnSocketData(g)}}}else{c.xxOnSocketData(j.data)}};c.xxOnSocketData=function(g){if(!g){return}if(typeof g==="object"){var e="",f=new Uint8Array(g),j=f.byteLength;for(var h=0;h<j;h++){e+=String.fromCharCode(f[h])}g=e}else{if(typeof g!=="string"){return}}return c.m.ProcessData(g)};c.sendCtrlMsg=function(e){if(typeof e=="string"){c.webchannel.send(e);if(c.keepalive!=null){c.keepalive.sendKeepAlive()}}};c.send=function(g){if(typeof g=="string"){var e=new Uint8Array(g.length);for(var f=0;f<g.length;++f){e[f]=g.charCodeAt(f)}g=e}c.webchannel.send(g)};c.xxStateChange=function(e){if(c.State==e){return}c.State=e;c.m.xxStateChange(c.State);if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}};c.Stop=function(){if(c.debugmode==1){console.log("stop")}if(c.rtcKeepAlive!=null){clearInterval(c.rtcKeepAlive);c.rtcKeepAlive=null}c.xxStateChange(0)};c.xxSendRtcKeepAlive=function(){c.sendCtrlMsg(JSON.stringify({action:"ping"}))};return c};var CreateAgentRemoteDesktop=function(a,e){var d={};d.CanvasId=a;if(typeof a==="string"){d.CanvasId=Q(a)}d.Canvas=d.CanvasId.getContext("2d");d.scrolldiv=e;d.State=0;d.PendingOperations=[];d.tilesReceived=0;d.TilesDrawn=0;d.KillDraw=0;d.ipad=false;d.tabletKeyboardVisible=false;d.LastX=0;d.LastY=0;d.touchenabled=0;d.submenuoffset=0;d.touchtimer=null;d.TouchArray={};d.connectmode=0;d.connectioncount=0;d.rotation=0;d.protocol=2;d.debugmode=0;d.firstUpKeys=[];d.stopInput=false;d.sessionid=0;d.username;d.oldie=false;d.CompressionLevel=50;d.ScalingLevel=1024;d.FrameRateTimer=50;d.FirstDraw=false;d.ScreenWidth=960;d.ScreenHeight=700;d.width=960;d.height=960;d.onScreenSizeChange=null;d.onMessage=null;d.onConnectCountChanged=null;d.onDebugMessage=null;d.onTouchEnabledChanged=null;d.onDisplayinfo=null;d.Start=function(){d.State=0};d.Stop=function(){d.setRotation(0);d.UnGrabKeyInput();d.UnGrabMouseInput();d.touchenabled=0;if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}d.Canvas.clearRect(0,0,d.CanvasId.width,d.CanvasId.height)};d.xxStateChange=function(f){if(d.State==f){return}d.State=f;switch(f){case 0:d.Stop();break;case 3:break}};d.send=function(f){if(d.debugmode>1){console.log("KSend("+f.length+"): "+rstr2hex(f))}d.parent.send(f)};d.ProcessPictureMsg=function(g,j,k){var h=new Image();h.xcount=d.tilesReceived++;var f=d.tilesReceived;h.src="data:image/jpeg;base64,"+btoa(g.substring(4,g.length));h.onload=function(){if(d.Canvas!=null&&d.KillDraw<f&&d.State!=0){d.PendingOperations.push([f,2,h,j,k]);while(d.DoPendingOperations()){}}};h.error=function(){console.log("DecodeTileError")}};d.DoPendingOperations=function(){if(d.PendingOperations.length==0){return false}for(var f=0;f<d.PendingOperations.length;f++){var g=d.PendingOperations[f];if(g[0]==(d.TilesDrawn+1)){if(g[1]==1){d.ProcessCopyRectMsg(g[2])}else{if(g[1]==2){d.Canvas.drawImage(g[2],d.rotX(g[3],g[4]),d.rotY(g[3],g[4]));delete g[2]}}d.PendingOperations.splice(f,1);delete g;d.TilesDrawn++;if(d.TilesDrawn==d.tilesReceived&&d.KillDraw<d.TilesDrawn){d.KillDraw=d.TilesDrawn=d.tilesReceived=0}return true}}if(d.oldie&&d.PendingOperations.length>0){d.TilesDrawn++}return false};d.ProcessCopyRectMsg=function(j){var k=((j.charCodeAt(0)&255)<<8)+(j.charCodeAt(1)&255);var l=((j.charCodeAt(2)&255)<<8)+(j.charCodeAt(3)&255);var f=((j.charCodeAt(4)&255)<<8)+(j.charCodeAt(5)&255);var g=((j.charCodeAt(6)&255)<<8)+(j.charCodeAt(7)&255);var m=((j.charCodeAt(8)&255)<<8)+(j.charCodeAt(9)&255);var h=((j.charCodeAt(10)&255)<<8)+(j.charCodeAt(11)&255);d.Canvas.drawImage(Canvas.canvas,k,l,m,h,f,g,m,h)};d.SendUnPause=function(){d.send(String.fromCharCode(0,8,0,5,0))};d.SendPause=function(){d.send(String.fromCharCode(0,8,0,5,1))};d.SendCompressionLevel=function(j,g,h,f){if(g){d.CompressionLevel=g}if(h){d.ScalingLevel=h}if(f){d.FrameRateTimer=f}d.send(String.fromCharCode(0,5,0,10,j,d.CompressionLevel)+d.shortToStr(d.ScalingLevel)+d.shortToStr(d.FrameRateTimer))};d.SendRefresh=function(){d.send(String.fromCharCode(0,6,0,4))};d.ProcessScreenMsg=function(g,f){if(d.debugmode>0){console.log("ScreenSize: "+g+" x "+f)}d.Canvas.setTransform(1,0,0,1,0,0);d.rotation=0;d.FirstDraw=true;d.ScreenWidth=d.width=g;d.ScreenHeight=d.height=f;d.KillDraw=d.tilesReceived;while(d.PendingOperations.length>0){d.PendingOperations.shift()}d.SendCompressionLevel(1);d.SendUnPause();if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}};d.ProcessData=function(g){var f=0;while(f<g.length){f+=d.ProcessDataEx(g.substring(f))}};d.ProcessDataEx=function(p){if(d.debugmode>1){console.log("KRecv("+p.length+"): "+rstr2hex(p.substring(0,Math.min(p.length,40))))}if(p.length<4){return}var f=null,q=0,r=0,h=ReadShort(p,0),g=ReadShort(p,2);if((g!=p.length)&&(d.debugmode>0)){console.log(g,p.length,g==p.length)}if((h>=18)&&(h!=65)){console.error("Invalid KVM command "+h+" of size "+g);console.log("Invalid KVM data",p.length,p,rstr2hex(p));return}if(g>p.length){console.error("KVM invalid command size",g,p.length);return}if(h==3||h==4||h==7){f=p.substring(4,g);q=((f.charCodeAt(0)&255)<<8)+(f.charCodeAt(1)&255);r=((f.charCodeAt(2)&255)<<8)+(f.charCodeAt(3)&255);if(d.debugmode>0){console.log("CMD"+h+" at X="+q+" Y="+r)}}switch(h){case 3:if(d.FirstDraw){d.onResize()}d.ProcessPictureMsg(f,q,r);break;case 4:if(d.FirstDraw){d.onResize()}if(d.TilesDrawn==d.tilesReceived){d.ProcessCopyRectMsg(f)}else{d.PendingOperations.push([++tilesReceived,1,f])}break;case 7:d.ProcessScreenMsg(q,r);d.SendKeyMsgKC(d.KeyAction.UP,16);d.SendKeyMsgKC(d.KeyAction.UP,17);d.SendKeyMsgKC(d.KeyAction.UP,18);d.SendKeyMsgKC(d.KeyAction.UP,91);d.SendKeyMsgKC(d.KeyAction.UP,92);d.SendKeyMsgKC(d.KeyAction.UP,16);d.send(String.fromCharCode(0,14,0,4));break;case 11:var m=[],j=((p.charCodeAt(4)&255)<<8)+(p.charCodeAt(5)&255);if(j>0){var o=0,n=((p.charCodeAt(6+(j*2))&255)<<8)+(p.charCodeAt(7+(j*2))&255);for(var l=0;l<j;l++){var k=((p.charCodeAt(6+(l*2))&255)<<8)+(p.charCodeAt(7+(l*2))&255);if(k==65535){m.push("All Displays")}else{m.push("Display "+k)}if(k==n){o=l}}}if(d.onDisplayinfo!=null){d.onDisplayinfo(d,m,o)}break;case 12:break;case 14:d.touchenabled=1;d.TouchArray={};if(d.onTouchEnabledChanged!=null){d.onTouchEnabledChanged(d.touchenabled)}break;case 15:d.TouchArray={};break;case 16:d.connectioncount=ReadInt(p,4);if(d.onConnectCountChanged!=null){d.onConnectCountChanged(d.connectioncount,d)}break;case 17:if(d.onMessage!=null){d.onMessage(p.substring(4,g),d)}break;case 65:p=p.substring(4);if(p[0]!="."){console.log(p);alert("KVM: "+p)}else{console.log("KVM: "+p.substring(1))}break}return g};d.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};d.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5,DBLCLICK:6};d.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};d.Alternate=0;var c={Pause:19,CapsLock:20,Space:32,Quote:222,Minus:189,NumpadMultiply:106,NumpadAdd:107,PrintScreen:44,Comma:188,NumpadSubtract:109,NumpadDecimal:110,Period:190,Slash:191,NumpadDivide:111,Semicolon:186,Equal:187,OSLeft:91,BracketLeft:219,OSRight:91,Backslash:220,BracketRight:221,ContextMenu:93,Backquote:192,NumLock:144,ScrollLock:145,Backspace:8,Tab:9,Enter:13,NumpadEnter:13,Escape:27,Delete:46,Home:36,PageUp:33,PageDown:34,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,End:35,Insert:45,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,VolumeMute:181};function b(f){if(f.code.startsWith("Key")&&f.code.length==4){return f.code.charCodeAt(3)}if(f.code.startsWith("Digit")&&f.code.length==6){return f.code.charCodeAt(5)}if(f.code.startsWith("Numpad")&&f.code.length==7){return f.code.charCodeAt(6)+48}return c[f.code]}d.SendKeyMsg=function(f,g){if(f==null){return}if(!g){g=window.event}if(g.code){var h=b(g);if(h!=null){d.SendKeyMsgKC(f,h)}}else{var h=g.keyCode;if(h==59){h=186}d.SendKeyMsgKC(f,h)}};d.SendMessage=function(f){if(d.State==3){d.send(String.fromCharCode(0,17)+d.shortToStr(4+f.length)+f)}};d.SendKeyMsgKC=function(f,h){if(d.State!=3){return}if(typeof f=="object"){for(var g in f){d.SendKeyMsgKC(f[g][0],f[g][1])}}else{d.send(String.fromCharCode(0,d.InputType.KEY,0,6,(f-1),h))}};d.sendcad=function(){d.SendCtrlAltDelMsg()};d.SendCtrlAltDelMsg=function(){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.CTRLALTDEL,0,4))}};d.SendEscKey=function(){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.KEY,0,6,0,27,0,d.InputType.KEY,0,6,1,27))}};d.SendStartMsg=function(){d.SendKeyMsgKC(d.KeyAction.EXDOWN,91);d.SendKeyMsgKC(d.KeyAction.EXUP,91)};d.SendCharmsMsg=function(){d.SendKeyMsgKC(d.KeyAction.EXDOWN,91);d.SendKeyMsgKC(d.KeyAction.DOWN,67);d.SendKeyMsgKC(d.KeyAction.UP,67);d.SendKeyMsgKC(d.KeyAction.EXUP,91)};d.SendTouchMsg1=function(g,f,h,j){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.TOUCH)+d.shortToStr(14)+String.fromCharCode(1,g)+d.intToStr(f)+d.shortToStr(h)+d.shortToStr(j))}};d.SendTouchMsg2=function(h,f){var l="";var g;var m="TOUCHSEND: ";for(var j in d.TouchArray){if(j==h){g=f}else{if(d.TouchArray[j].f==1){g=65536|2|4;d.TouchArray[j].f=3;m+="START"+j}else{if(d.TouchArray[j].f==2){g=262144;m+="STOP"+j}else{g=2|4|131072}}}l+=String.fromCharCode(j)+d.intToStr(g)+d.shortToStr(d.TouchArray[j].x)+d.shortToStr(d.TouchArray[j].y);if(d.TouchArray[j].f==2){delete d.TouchArray[j]}}if(d.State==3){d.send(String.fromCharCode(0,d.InputType.TOUCH)+d.shortToStr(5+l.length)+String.fromCharCode(2)+l)}if(Object.keys(d.TouchArray).length==0&&d.touchtimer!=null){clearInterval(d.touchtimer);d.touchtimer=null}};d.SendMouseMsg=function(f,j){if(d.State!=3){return}if(f!=null&&d.Canvas!=null){if(!j){var j=window.event}var m=(d.Canvas.canvas.height/d.CanvasId.clientHeight);var n=(d.Canvas.canvas.width/d.CanvasId.clientWidth);var l=d.GetPositionOfControl(d.Canvas.canvas);var o=((j.pageX-l[0])*n);var p=((j.pageY-l[1])*m);if(o>=0&&o<=d.Canvas.canvas.width&&p>=0&&p<=d.Canvas.canvas.height){var g=0;var h=0;if(f==d.KeyAction.UP||f==d.KeyAction.DOWN){if(j.which){((j.which==1)?(g=d.MouseButton.LEFT):((j.which==2)?(g=d.MouseButton.MIDDLE):(g=d.MouseButton.RIGHT)))}else{if(j.button){((j.button==0)?(g=d.MouseButton.LEFT):((j.button==1)?(g=d.MouseButton.MIDDLE):(g=d.MouseButton.RIGHT)))}}}else{if(f==d.KeyAction.SCROLL){if(j.detail){h=(-1*(j.detail*120))}else{if(j.wheelDelta){h=(j.wheelDelta*3)}}}}var k="";if(f==d.KeyAction.DBLCLICK){k=String.fromCharCode(0,d.InputType.MOUSE,0,10,0,136,((o/256)&255),(o&255),((p/256)&255),(p&255))}else{if(f==d.KeyAction.SCROLL){k=String.fromCharCode(0,d.InputType.MOUSE,0,12,0,0,((o/256)&255),(o&255),((p/256)&255),(p&255),((h/256)&255),(h&255))}else{k=String.fromCharCode(0,d.InputType.MOUSE,0,10,0,((f==d.KeyAction.DOWN)?g:((g*2)&255)),((o/256)&255),(o&255),((p/256)&255),(p&255))}}if(d.Action==d.KeyAction.NONE){if(d.Alternate==0||d.ipad){d.send(k);d.Alternate=1}else{d.Alternate=0}}else{d.send(k)}}}};d.GetDisplayNumbers=function(){d.send(String.fromCharCode(0,11,0,4))};d.SetDisplay=function(f){d.send(String.fromCharCode(0,12,0,6,f>>8,f&255))};d.intToStr=function(f){return String.fromCharCode((f>>24)&255,(f>>16)&255,(f>>8)&255,f&255)};d.shortToStr=function(f){return String.fromCharCode((f>>8)&255,f&255)};d.onResize=function(){if(d.ScreenWidth==0||d.ScreenHeight==0){return}if(d.Canvas.canvas.width==d.ScreenWidth&&d.Canvas.canvas.height==d.ScreenHeight){return}if(d.FirstDraw){d.Canvas.canvas.width=d.ScreenWidth;d.Canvas.canvas.height=d.ScreenHeight;d.Canvas.fillRect(0,0,d.ScreenWidth,d.ScreenHeight);if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}}d.FirstDraw=false};d.xxMouseInputGrab=false;d.xxKeyInputGrab=false;d.xxMouseMove=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.NONE,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxMouseUp=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.UP,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxMouseDown=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.DOWN,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxMouseDblClick=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.DBLCLICK,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxDOMMouseScroll=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.SCROLL,f);return false}return true};d.xxMouseWheel=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.SCROLL,f);return false}return true};d.xxKeyUp=function(f){if(d.State==3){d.SendKeyMsg(d.KeyAction.UP,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxKeyDown=function(f){if(d.State==3){d.SendKeyMsg(d.KeyAction.DOWN,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxKeyPress=function(f){if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.handleKeys=function(f){if(d.stopInput==true||desktop.State!=3){return false}return d.xxKeyPress(f)};d.handleKeyUp=function(f){if(d.stopInput==true||desktop.State!=3){return false}if(d.firstUpKeys.length<5){d.firstUpKeys.push(f.keyCode);if((d.firstUpKeys.length==5)){var g=d.firstUpKeys.join(",");if((g=="16,17,91,91,16")||(g=="16,17,18,91,92")){d.stopInput=true}}}return d.xxKeyUp(f)};d.handleKeyDown=function(f){if(d.stopInput==true||desktop.State!=3){return false}return d.xxKeyDown(f)};d.mousedblclick=function(f){if(d.stopInput==true){return false}return d.xxMouseDblClick(f)};d.mousedown=function(f){if(d.stopInput==true){return false}return d.xxMouseDown(f)};d.mouseup=function(f){if(d.stopInput==true){return false}return d.xxMouseUp(f)};d.mousemove=function(f){if(d.stopInput==true){return false}return d.xxMouseMove(f)};d.mousewheel=function(f){if(d.stopInput==true){return false}return d.xxMouseWheel(f)};d.xxMsTouchEvent=function(f){if(f.originalEvent.pointerType==4){return}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}if(f.type=="MSPointerDown"||f.type=="MSPointerMove"||f.type=="MSPointerUp"){var g=0;var h=f.originalEvent.pointerId%256;var j=f.offsetX*(Canvas.canvas.width/d.CanvasId.clientWidth);var k=f.offsetY*(Canvas.canvas.height/d.CanvasId.clientHeight);if(f.type=="MSPointerDown"){g=65536|2|4}else{if(f.type=="MSPointerMove"){g=131072|2|4}else{if(f.type=="MSPointerUp"){g=262144}}}if(!d.TouchArray[h]){d.TouchArray[h]={x:j,y:k}}d.SendTouchMsg2(h,g);if(f.type=="MSPointerUp"){delete d.TouchArray[h]}}else{alert(f.type)}return true};d.xxTouchStart=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}var k=f.originalEvent.touches[0];f.which=1;d.LastX=f.pageX=k.pageX;d.LastY=f.pageY=k.pageY;d.SendMouseMsg(KeyAction.DOWN,f)}else{var j=d.GetPositionOfControl(Canvas.canvas);for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(!d.TouchArray[h]){d.TouchArray[h]={x:(f.originalEvent.touches[g].pageX-j[0])*(Canvas.canvas.width/d.CanvasId.clientWidth),y:(f.originalEvent.touches[g].pageY-j[1])*(Canvas.canvas.height/d.CanvasId.clientHeight),f:1}}}if(Object.keys(d.TouchArray).length>0&&touchtimer==null){d.touchtimer=setInterval(function(){d.SendTouchMsg2(256,0)},50)}}};d.xxTouchMove=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}var k=f.originalEvent.touches[0];f.which=1;d.LastX=f.pageX=k.pageX;d.LastY=f.pageY=k.pageY;d.SendMouseMsg(d.KeyAction.NONE,f)}else{var j=d.GetPositionOfControl(Canvas.canvas);for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(d.TouchArray[h]){d.TouchArray[h].x=(f.originalEvent.touches[g].pageX-j[0])*(d.Canvas.canvas.width/d.CanvasId.clientWidth);d.TouchArray[h].y=(f.originalEvent.touches[g].pageY-j[1])*(d.Canvas.canvas.height/d.CanvasId.clientHeight)}}}};d.xxTouchEnd=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}f.which=1;f.pageX=LastX;f.pageY=LastY;d.SendMouseMsg(KeyAction.UP,f)}else{for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(d.TouchArray[h]){d.TouchArray[h].f=2}}}};d.GrabMouseInput=function(){if(d.xxMouseInputGrab==true){return}var f=d.CanvasId;f.onmousemove=d.xxMouseMove;f.onmouseup=d.xxMouseUp;f.onmousedown=d.xxMouseDown;f.touchstart=d.xxTouchStart;f.touchmove=d.xxTouchMove;f.touchend=d.xxTouchEnd;f.MSPointerDown=d.xxMsTouchEvent;f.MSPointerMove=d.xxMsTouchEvent;f.MSPointerUp=d.xxMsTouchEvent;if(navigator.userAgent.match(/mozilla/i)){f.DOMMouseScroll=d.xxDOMMouseScroll}else{f.onmousewheel=d.xxMouseWheel}d.xxMouseInputGrab=true};d.UnGrabMouseInput=function(){if(d.xxMouseInputGrab==false){return}var f=d.CanvasId;f.onmousemove=null;f.onmouseup=null;f.onmousedown=null;f.touchstart=null;f.touchmove=null;f.touchend=null;f.MSPointerDown=null;f.MSPointerMove=null;f.MSPointerUp=null;if(navigator.userAgent.match(/mozilla/i)){f.DOMMouseScroll=null}else{f.onmousewheel=null}d.xxMouseInputGrab=false};d.GrabKeyInput=function(){if(d.xxKeyInputGrab==true){return}document.onkeyup=d.xxKeyUp;document.onkeydown=d.xxKeyDown;document.onkeypress=d.xxKeyPress;d.xxKeyInputGrab=true};d.UnGrabKeyInput=function(){if(d.xxKeyInputGrab==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d.xxKeyInputGrab=false};d.GetPositionOfControl=function(f){var g=Array(2);g[0]=g[1]=0;while(f){g[0]+=f.offsetLeft;g[1]+=f.offsetTop;f=f.offsetParent}return g};d.crotX=function(f,g){if(d.rotation==0){return f}if(d.rotation==1){return g}if(d.rotation==2){return d.Canvas.canvas.width-f}if(d.rotation==3){return d.Canvas.canvas.height-g}};d.crotY=function(f,g){if(d.rotation==0){return g}if(d.rotation==1){return d.Canvas.canvas.width-f}if(d.rotation==2){return d.Canvas.canvas.height-g}if(d.rotation==3){return f}};d.rotX=function(f,g){if(d.rotation==0||d.rotation==1){return f}if(d.rotation==2){return f-d.Canvas.canvas.width}if(d.rotation==3){return f-d.Canvas.canvas.height}};d.rotY=function(f,g){if(d.rotation==0||d.rotation==3){return g}if(d.rotation==1){return g-d.Canvas.canvas.width}if(d.rotation==2){return g-d.Canvas.canvas.height}};d.tcanvas=null;d.setRotation=function(k){while(k<0){k+=4}var f=k%4;if(f==d.rotation){return true}var h=d.Canvas.canvas.width;var g=d.Canvas.canvas.height;if(d.rotation==1||d.rotation==3){h=d.Canvas.canvas.height;g=d.Canvas.canvas.width}if(d.tcanvas==null){d.tcanvas=document.createElement("canvas")}var j=d.tcanvas.getContext("2d");j.setTransform(1,0,0,1,0,0);j.canvas.width=h;j.canvas.height=g;j.rotate((d.rotation*-90)*Math.PI/180);if(d.rotation==0){j.drawImage(d.Canvas.canvas,0,0)}if(d.rotation==1){j.drawImage(d.Canvas.canvas,-d.Canvas.canvas.width,0)}if(d.rotation==2){j.drawImage(d.Canvas.canvas,-d.Canvas.canvas.width,-d.Canvas.canvas.height)}if(d.rotation==3){j.drawImage(d.Canvas.canvas,0,-d.Canvas.canvas.height)}if(d.rotation==0||d.rotation==2){d.Canvas.canvas.height=h;d.Canvas.canvas.width=g}if(d.rotation==1||d.rotation==3){d.Canvas.canvas.height=g;d.Canvas.canvas.width=h}d.Canvas.setTransform(1,0,0,1,0,0);d.Canvas.rotate((f*90)*Math.PI/180);d.rotation=f;d.Canvas.drawImage(d.tcanvas,d.rotX(0,0),d.rotY(0,0));d.ScreenWidth=d.Canvas.canvas.width;d.ScreenHeight=d.Canvas.canvas.height;if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}return true};d.MuchTheSame=function(f,g){return(Math.abs(f-g)<4)};d.Debug=function(f){console.log(f)};d.getIEVersion=function(){var f=-1;if(navigator.appName=="Microsoft Internet Explorer"){var h=navigator.userAgent;var g=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(g.exec(h)!=null){f=parseFloat(RegExp.$1)}}return f};d.haltEvent=function(f){if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};return d};var QRCode;!function(){function t(c){this.mode=v.MODE_8BIT_BYTE,this.data=c,this.parsedData=[];for(var g=[],h=0,j=this.data.length;j>h;h++){var k=this.data.charCodeAt(h);k>65536?(g[0]=240|(1835008&k)>>>18,g[1]=128|(258048&k)>>>12,g[2]=128|(4032&k)>>>6,g[3]=128|63&k):k>2048?(g[0]=224|(61440&k)>>>12,g[1]=128|(4032&k)>>>6,g[2]=128|63&k):k>128?(g[0]=192|(1984&k)>>>6,g[1]=128|63&k):g[0]=k,this.parsedData=this.parsedData.concat(g)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function u(c,d){this.typeNumber=c,this.errorCorrectLevel=d,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function B(e,f){if(void 0==e.length){throw new Error(e.length+"/"+f)}for(var g=0;g<e.length&&0==e[g];){g++}this.num=new Array(e.length-g+f);for(var h=0;h<e.length-g;h++){this.num[h]=e[h+g]}}function C(c,d){this.totalCount=c,this.dataCount=d}function D(){this.buffer=[],this.length=0}function F(){return"undefined"!=typeof CanvasRenderingContext2D}function G(){var c=!1,d=navigator.userAgent;return/android/i.test(d)&&(c=!0,aMat=d.toString().match(/android ([0-9]\.[0-9])/i),aMat&&aMat[1]&&(c=parseFloat(aMat[1]))),c}function K(d,j){for(var k=1,l=L(d),m=0,n=E.length;n>=m;m++){var o=0;switch(j){case w.L:o=E[m][0];break;case w.M:o=E[m][1];break;case w.Q:o=E[m][2];break;case w.H:o=E[m][3]}if(o>=l){break}k++}if(k>E.length){throw new Error("Too long data")}return k}function L(c){var d=encodeURI(c).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return d.length+(d.length!=c?3:0)}t.prototype={getLength:function(){return this.parsedData.length},write:function(d){for(var e=0,f=this.parsedData.length;f>e;e++){d.put(this.parsedData[e],8)}}},u.prototype={addData:function(a){var d=new t(a);this.dataList.push(d),this.dataCache=null},isDark:function(c,d){if(0>c||this.moduleCount<=c||0>d||this.moduleCount<=d){throw new Error(c+","+d)}return this.modules[c][d]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(b,f){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var g=0;g<this.moduleCount;g++){this.modules[g]=new Array(this.moduleCount);for(var h=0;h<this.moduleCount;h++){this.modules[g][h]=null}}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(b,f),this.typeNumber>=7&&this.setupTypeNumber(b),null==this.dataCache&&(this.dataCache=u.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,f)},setupPositionProbePattern:function(e,f){for(var g=-1;7>=g;g++){if(!(-1>=e+g||this.moduleCount<=e+g)){for(var h=-1;7>=h;h++){-1>=f+h||this.moduleCount<=f+h||(this.modules[e+g][f+h]=g>=0&&6>=g&&(0==h||6==h)||h>=0&&6>=h&&(0==g||6==g)||g>=2&&4>=g&&h>=2&&4>=h?!0:!1)}}}},getBestMaskPattern:function(){for(var e=0,f=0,g=0;8>g;g++){this.makeImpl(!0,g);var h=y.getLostPoint(this);(0==g||e>h)&&(e=h,f=g)}return f},createMovieClip:function(k,l,m){var n=k.createEmptyMovieClip(l,m),o=1;this.make();for(var p=0;p<this.modules.length;p++){for(var q=p*o,r=0;r<this.modules[p].length;r++){var s=r*o,M=this.modules[p][r];M&&(n.beginFill(0,100),n.moveTo(s,q),n.lineTo(s+o,q),n.lineTo(s+o,q+o),n.lineTo(s,q+o),n.endFill())}}return n},setupTimingPattern:function(){for(var c=8;c<this.moduleCount-8;c++){null==this.modules[c][6]&&(this.modules[c][6]=0==c%2)}for(var d=8;d<this.moduleCount-8;d++){null==this.modules[6][d]&&(this.modules[6][d]=0==d%2)}},setupPositionAdjustPattern:function(){for(var f=y.getPatternPosition(this.typeNumber),j=0;j<f.length;j++){for(var k=0;k<f.length;k++){var l=f[j],m=f[k];if(null==this.modules[l][m]){for(var n=-2;2>=n;n++){for(var o=-2;2>=o;o++){this.modules[l+n][m+o]=-2==n||2==n||-2==o||2==o||0==n&&0==o?!0:!1}}}}}},setupTypeNumber:function(e){for(var f=y.getBCHTypeNumber(this.typeNumber),g=0;18>g;g++){var h=!e&&1==(1&f>>g);this.modules[Math.floor(g/3)][g%3+this.moduleCount-8-3]=h}for(var g=0;18>g;g++){var h=!e&&1==(1&f>>g);this.modules[g%3+this.moduleCount-8-3][Math.floor(g/3)]=h}},setupTypeInfo:function(f,h){for(var j=this.errorCorrectLevel<<3|h,k=y.getBCHTypeInfo(j),l=0;15>l;l++){var m=!f&&1==(1&k>>l);6>l?this.modules[l][8]=m:8>l?this.modules[l+1][8]=m:this.modules[this.moduleCount-15+l][8]=m}for(var l=0;15>l;l++){var m=!f&&1==(1&k>>l);8>l?this.modules[8][this.moduleCount-l-1]=m:9>l?this.modules[8][15-l-1+1]=m:this.modules[8][15-l-1]=m}this.modules[this.moduleCount-8][8]=!f},mapData:function(f,l){for(var m=-1,n=this.moduleCount-1,o=7,p=0,q=this.moduleCount-1;q>0;q-=2){for(6==q&&q--;;){for(var r=0;2>r;r++){if(null==this.modules[n][q-r]){var s=!1;p<f.length&&(s=1==(1&f[p]>>>o));var M=y.getMask(l,n,q-r);M&&(s=!s),this.modules[n][q-r]=s,o--,-1==o&&(p++,o=7)}}if(n+=m,0>n||this.moduleCount<=n){n-=m,m=-m;break}}}}},u.PAD0=236,u.PAD1=17,u.createData=function(b,f,j){for(var k=C.getRSBlocks(b,f),m=new D,n=0;n<j.length;n++){var o=j[n];m.put(o.mode,4),m.put(o.getLength(),y.getLengthInBits(o.mode,b)),o.write(m)}for(var p=0,n=0;n<k.length;n++){p+=k[n].dataCount}if(m.getLengthInBits()>8*p){throw new Error("code length overflow. ("+m.getLengthInBits()+">"+8*p+")")}for(m.getLengthInBits()+4<=8*p&&m.put(0,4);0!=m.getLengthInBits()%8;){m.putBit(!1)}for(;;){if(m.getLengthInBits()>=8*p){break}if(m.put(u.PAD0,8),m.getLengthInBits()>=8*p){break}m.put(u.PAD1,8)}return u.createBytes(m,k)},u.createBytes=function(f,M){for(var N=0,O=0,P=0,R=new Array(M.length),S=new Array(M.length),T=0;T<M.length;T++){var U=M[T].dataCount,V=M[T].totalCount-U;O=Math.max(O,U),P=Math.max(P,V),R[T]=new Array(U);for(var W=0;W<R[T].length;W++){R[T][W]=255&f.buffer[W+N]}N+=U;var X=y.getErrorCorrectPolynomial(V),Y=new B(R[T],X.getLength()-1),Z=Y.mod(X);S[T]=new Array(X.getLength()-1);for(var W=0;W<S[T].length;W++){var aa=W+Z.getLength()-S[T].length;S[T][W]=aa>=0?Z.get(aa):0}}for(var ab=0,W=0;W<M.length;W++){ab+=M[W].totalCount}for(var ac=new Array(ab),ad=0,W=0;O>W;W++){for(var T=0;T<M.length;T++){W<R[T].length&&(ac[ad++]=R[T][W])}}for(var W=0;P>W;W++){for(var T=0;T<M.length;T++){W<S[T].length&&(ac[ad++]=S[T][W])}}return ac};for(var v={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},w={L:1,M:0,Q:3,H:2},x={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},y={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(c){for(var d=c<<10;y.getBCHDigit(d)-y.getBCHDigit(y.G15)>=0;){d^=y.G15<<y.getBCHDigit(d)-y.getBCHDigit(y.G15)}return(c<<10|d)^y.G15_MASK},getBCHTypeNumber:function(c){for(var d=c<<12;y.getBCHDigit(d)-y.getBCHDigit(y.G18)>=0;){d^=y.G18<<y.getBCHDigit(d)-y.getBCHDigit(y.G18)}return c<<12|d},getBCHDigit:function(c){for(var d=0;0!=c;){d++,c>>>=1}return d},getPatternPosition:function(b){return y.PATTERN_POSITION_TABLE[b-1]},getMask:function(d,e,f){switch(d){case x.PATTERN000:return 0==(e+f)%2;case x.PATTERN001:return 0==e%2;case x.PATTERN010:return 0==f%3;case x.PATTERN011:return 0==(e+f)%3;case x.PATTERN100:return 0==(Math.floor(e/2)+Math.floor(f/3))%2;case x.PATTERN101:return 0==e*f%2+e*f%3;case x.PATTERN110:return 0==(e*f%2+e*f%3)%2;case x.PATTERN111:return 0==(e*f%3+(e+f)%2)%2;default:throw new Error("bad maskPattern:"+d)}},getErrorCorrectPolynomial:function(d){for(var e=new B([1],0),f=0;d>f;f++){e=e.multiply(new B([1,z.gexp(f)],0))}return e},getLengthInBits:function(c,d){if(d>=1&&10>d){switch(c){case v.MODE_NUMBER:return 10;case v.MODE_ALPHA_NUM:return 9;case v.MODE_8BIT_BYTE:return 8;case v.MODE_KANJI:return 8;default:throw new Error("mode:"+c)}}else{if(27>d){switch(c){case v.MODE_NUMBER:return 12;case v.MODE_ALPHA_NUM:return 11;case v.MODE_8BIT_BYTE:return 16;case v.MODE_KANJI:return 10;default:throw new Error("mode:"+c)}}else{if(!(41>d)){throw new Error("type:"+d)}switch(c){case v.MODE_NUMBER:return 14;case v.MODE_ALPHA_NUM:return 13;case v.MODE_8BIT_BYTE:return 16;case v.MODE_KANJI:return 12;default:throw new Error("mode:"+c)}}}},getLostPoint:function(m){for(var n=m.getModuleCount(),o=0,p=0;n>p;p++){for(var q=0;n>q;q++){for(var r=0,s=m.isDark(p,q),M=-1;1>=M;M++){if(!(0>p+M||p+M>=n)){for(var N=-1;1>=N;N++){0>q+N||q+N>=n||(0!=M||0!=N)&&s==m.isDark(p+M,q+N)&&r++}}}r>5&&(o+=3+r-5)}}for(var p=0;n-1>p;p++){for(var q=0;n-1>q;q++){var O=0;m.isDark(p,q)&&O++,m.isDark(p+1,q)&&O++,m.isDark(p,q+1)&&O++,m.isDark(p+1,q+1)&&O++,(0==O||4==O)&&(o+=3)}}for(var p=0;n>p;p++){for(var q=0;n-6>q;q++){m.isDark(p,q)&&!m.isDark(p,q+1)&&m.isDark(p,q+2)&&m.isDark(p,q+3)&&m.isDark(p,q+4)&&!m.isDark(p,q+5)&&m.isDark(p,q+6)&&(o+=40)}}for(var q=0;n>q;q++){for(var p=0;n-6>p;p++){m.isDark(p,q)&&!m.isDark(p+1,q)&&m.isDark(p+2,q)&&m.isDark(p+3,q)&&m.isDark(p+4,q)&&!m.isDark(p+5,q)&&m.isDark(p+6,q)&&(o+=40)}}for(var P=0,q=0;n>q;q++){for(var p=0;n>p;p++){m.isDark(p,q)&&P++}}var R=Math.abs(100*P/n/n-50)/5;return o+=10*R}},z={glog:function(b){if(1>b){throw new Error("glog("+b+")")}return z.LOG_TABLE[b]},gexp:function(b){for(;0>b;){b+=255}for(;b>=256;){b-=255}return z.EXP_TABLE[b]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},A=0;8>A;A++){z.EXP_TABLE[A]=1<<A}for(var A=8;256>A;A++){z.EXP_TABLE[A]=z.EXP_TABLE[A-4]^z.EXP_TABLE[A-5]^z.EXP_TABLE[A-6]^z.EXP_TABLE[A-8]}for(var A=0;255>A;A++){z.LOG_TABLE[z.EXP_TABLE[A]]=A}B.prototype={get:function(b){return this.num[b]},getLength:function(){return this.num.length},multiply:function(e){for(var f=new Array(this.getLength()+e.getLength()-1),g=0;g<this.getLength();g++){for(var h=0;h<e.getLength();h++){f[g+h]^=z.gexp(z.glog(this.get(g))+z.glog(e.get(h)))}}return new B(f,0)},mod:function(e){if(this.getLength()-e.getLength()<0){return this}for(var f=z.glog(this.get(0))-z.glog(e.get(0)),g=new Array(this.getLength()),h=0;h<this.getLength();h++){g[h]=this.get(h)}for(var h=0;h<e.getLength();h++){g[h]^=z.gexp(z.glog(e.get(h))+f)}return new B(g,0).mod(e)}},C.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],C.getRSBlocks=function(j,l){var m=C.getRsBlockTable(j,l);if(void 0==m){throw new Error("bad rs block @ typeNumber:"+j+"/errorCorrectLevel:"+l)}for(var n=m.length/3,o=[],p=0;n>p;p++){for(var q=m[3*p+0],r=m[3*p+1],s=m[3*p+2],M=0;q>M;M++){o.push(new C(r,s))}}return o},C.getRsBlockTable=function(c,d){switch(d){case w.L:return C.RS_BLOCK_TABLE[4*(c-1)+0];case w.M:return C.RS_BLOCK_TABLE[4*(c-1)+1];case w.Q:return C.RS_BLOCK_TABLE[4*(c-1)+2];case w.H:return C.RS_BLOCK_TABLE[4*(c-1)+3];default:return void 0}},D.prototype={get:function(c){var d=Math.floor(c/8);return 1==(1&this.buffer[d]>>>7-c%8)},put:function(d,e){for(var f=0;e>f;f++){this.putBit(1==(1&d>>>e-f-1))}},getLengthInBits:function(){return this.length},putBit:function(c){var d=Math.floor(this.length/8);this.buffer.length<=d&&this.buffer.push(0),c&&(this.buffer[d]|=128>>>this.length%8),this.length++}};var E=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],H=function(){var b=function(c,d){this._el=c,this._htOption=d};return b.prototype.draw=function(e){function n(g,h){var j=document.createElementNS("http://www.w3.org/2000/svg",g);for(var k in h){h.hasOwnProperty(k)&&j.setAttribute(k,h[k])}return j}var f=this._htOption,l=this._el,m=e.getModuleCount();Math.floor(f.width/m),Math.floor(f.height/m),this.clear();var o=n("svg",{viewBox:"0 0 "+String(m)+" "+String(m),width:"100%",height:"100%",fill:f.colorLight});o.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),l.appendChild(o),o.appendChild(n("rect",{fill:f.colorDark,width:"1",height:"1",id:"template"}));for(var p=0;m>p;p++){for(var q=0;m>q;q++){if(e.isDark(p,q)){var r=n("use",{x:String(p),y:String(q)});r.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),o.appendChild(r)}}}},b.prototype.clear=function(){for(;this._el.hasChildNodes();){this._el.removeChild(this._el.lastChild)}},b}(),I="svg"===document.documentElement.tagName.toLowerCase(),J=I?H:F()?function(){function f(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}function j(l,m){var n=this;if(n._fFail=m,n._fSuccess=l,null===n._bSupportDataURI){var o=document.createElement("img"),p=function(){n._bSupportDataURI=!1,n._fFail&&_fFail.call(n)},q=function(){n._bSupportDataURI=!0,n._fSuccess&&n._fSuccess.call(n)};return o.onabort=p,o.onerror=p,o.onload=q,o.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",void 0}n._bSupportDataURI===!0&&n._fSuccess?n._fSuccess.call(n):n._bSupportDataURI===!1&&n._fFail&&n._fFail.call(n)}if(this._android&&this._android<=2.1){var g=1/window.devicePixelRatio,h=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(b,c,m,n,o,p,q,r){if("nodeName" in b&&/img/i.test(b.nodeName)){for(var s=arguments.length-1;s>=1;s--){arguments[s]=arguments[s]*g}}else{"undefined"==typeof r&&(arguments[1]*=g,arguments[2]*=g,arguments[3]*=g,arguments[4]*=g)}h.apply(this,arguments)}}var k=function(c,d){this._bIsPainted=!1,this._android=G(),this._htOption=d,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=d.width,this._elCanvas.height=d.height,c.appendChild(this._elCanvas),this._el=c,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return k.prototype.draw=function(o){var p=this._elImage,q=this._oContext,r=this._htOption,s=o.getModuleCount(),M=r.width/s,N=r.height/s,O=Math.round(M),P=Math.round(N);p.style.display="none",this.clear();for(var R=0;s>R;R++){for(var S=0;s>S;S++){var T=o.isDark(R,S),U=S*M,V=R*N;q.strokeStyle=T?r.colorDark:r.colorLight,q.lineWidth=1,q.fillStyle=T?r.colorDark:r.colorLight,q.fillRect(U,V,M,N),q.strokeRect(Math.floor(U)+0.5,Math.floor(V)+0.5,O,P),q.strokeRect(Math.ceil(U)-0.5,Math.ceil(V)-0.5,O,P)}}this._bIsPainted=!0},k.prototype.makeImage=function(){this._bIsPainted&&j.call(this,f)},k.prototype.isPainted=function(){return this._bIsPainted},k.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},k.prototype.round=function(b){return b?Math.floor(1000*b)/1000:b},k}():function(){var b=function(c,d){this._el=c,this._htOption=d};return b.prototype.draw=function(m){for(var n=this._htOption,o=this._el,p=m.getModuleCount(),q=Math.floor(n.width/p),r=Math.floor(n.height/p),s=['<table style="border:0;border-collapse:collapse;">'],M=0;p>M;M++){s.push("<tr>");for(var N=0;p>N;N++){s.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:'+q+"px;height:"+r+"px;background-color:"+(m.isDark(M,N)?n.colorDark:n.colorLight)+';"></td>')}s.push("</tr>")}s.push("</table>"),o.innerHTML=s.join("");var O=o.childNodes[0],P=(n.width-O.offsetWidth)/2,R=(n.height-O.offsetHeight)/2;P>0&&R>0&&(O.style.margin=R+"px "+P+"px")},b.prototype.clear=function(){this._el.innerHTML=""},b}();QRCode=function(d,e){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:w.H},"string"==typeof e&&(e={text:e}),e){for(var f in e){this._htOption[f]=e[f]}}"string"==typeof d&&(d=document.getElementById(d)),this._android=G(),this._el=d,this._oQRCode=null,this._oDrawing=new J(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},QRCode.prototype.makeCode=function(b){this._oQRCode=new u(K(b,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(b),this._oQRCode.make(),this._el.title=b,this._oDrawing.draw(this._oQRCode),this.makeImage()},QRCode.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},QRCode.prototype.clear=function(){this._oDrawing.clear()},QRCode.CorrectLevel=w}();"use strict";var args;var powerStatetable=["","Powered","Sleep","Sleep","Sleep","Hibernating","Power off","Present"];var StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel® AMT Connected"];var sort=0;var searchFocus=0;var mapSearchFocus=0;var userSearchFocus=0;var consoleFocus=0;var showRealNames=false;var meshserver=null;var meshes={};var meshcount=0;var nodes=[];var filetree={};var userinfo=null;var serverinfo=null;var events=[];var users=null;var wssessions=null;var nodeShortIdent=0;var desktop;var desktopsettings={encoding:2,showfocus:false,showmouse:true,showcad:true,quality:40,scaling:1024,framerate:50};var multidesktopsettings={quality:20,scaling:128,framerate:1000};var terminal;var files;var debugLevel=parseInt("{{{debuglevel}}}");var features=parseInt("{{{features}}}");var sessionTime=parseInt("{{{sessiontime}}}");var domain="{{{domain}}}";var domainUrl="{{{domainurl}}}";var multiDesktop={};var multiDesktopFilter=null;var serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}";var amtScanResults=null;var debugmode=0;var clickOnce=(((features&256)!=0)&&detectClickOnce());var attemptWebRTC=((features&128)!=0);var webPageFullScreen=getstore("webPageFullScreen",true);if(webPageFullScreen=="false"){webPageFullScreen=false}if(webPageFullScreen=="true"){webPageFullScreen=true}var passRequirements="{{{passRequirements}}}";if(passRequirements!=""){passRequirements=JSON.parse(decodeURIComponent(passRequirements))}function startup(){if((features&32)==0){var g=null;try{g=top.location.toString().toLowerCase()}catch(b){}if(top!=self&&(g==null||top.active==false)){top.location=self.location;return}}toggleFullScreen();args=parseUriArgs();debugmode=args.debug;if(args.webrtc!=null){attemptWebRTC=(args.webrtc==1)}QV("p13AutoConnect",debugmode);QV("autoconnectbutton2",debugmode);QV("autoconnectbutton1",debugmode);if(args.hide){var d=parseInt(args.hide);QV("masthead",!(d&1));QV("topbarmaster",!(d&2));QV("page_leftbar",!(d&2));QV("footer",!(d&4));QV("p10title",!(d&8));QV("p11title",!(d&8));QV("p12title",!(d&8));QV("p13title",!(d&8));QV("p14title",!(d&8));QV("p15title",!(d&8));QV("p16title",!(d&8))}p1updateInfo();document.onclick=function(c){hideContextMenu()};document.onkeypress=ondockeypress;document.onkeydown=ondockeydown;document.onkeyup=ondockeyup;window.onresize=function(){masterUpdate(512)};masterUpdate(512);meshserver=MeshServerCreateControl(domainUrl);meshserver.onStateChanged=onStateChanged;meshserver.onMessage=onMessage;meshserver.Start();Q("sortselect").selectedIndex=sort=getstore("sort",0);Q("sizeselect").selectedIndex=getstore("viewsize",1);Q("SearchInput").value=getstore("search","");showRealNames=(getstore("showRealNames",0)==1);Q("RealNameCheckBox").checked=showRealNames;Q("viewselect").value=getstore("deviceView",1);Q("DeskControl").checked=(getstore("DeskControl",1)==1);masterUpdate(3);for(var f=1;f<5;f++){Q("devViewButton"+f).classList.remove("viewSelectorSel")}Q("devViewButton"+Q("viewselect").value).classList.add("viewSelectorSel");Q("p5filetable").addEventListener("drop",p5fileDragDrop,false);Q("p5filetable").addEventListener("dragover",p5fileDragOver,false);Q("p5filetable").addEventListener("dragleave",p5fileDragLeave,false);Q("p13filetable").addEventListener("drop",p13fileDragDrop,false);Q("p13filetable").addEventListener("dragover",p13fileDragOver,false);Q("p13filetable").addEventListener("dragleave",p13fileDragLeave,false);setInterval(updateDeviceTimeline,120000);var h=localStorage.getItem("desktopsettings");if(h!=null){desktopsettings=JSON.parse(h)}h=localStorage.getItem("multidesktopsettings");if(h!=null){multidesktopsettings=JSON.parse(h)}applyDesktopSettings();var k="";for(var a=1;a<27;a++){k+="<option value='"+a+"'>Ctrl-"+String.fromCharCode(64+a)+" ("+a+")</option>"}QH("specialkeylist",k);setupServerStats()}function toggleFullScreen(a){if(a===1){webPageFullScreen=!webPageFullScreen;putstore("webPageFullScreen",webPageFullScreen)}if(webPageFullScreen==false){QS("container").width="960px";QS("container")["border-right"]="1px solid #b7b7b7";QS("container")["border-left"]="1px solid #b7b7b7";QS("container")["min-width"]="960px";QS("container")["overflow"]="";QS("column_l").width="930px";QS("column_l").height="";QS("column_l")["margin-left"]="";QS("column_l")["overflow-y"]="";QS("column_l")["max-height"]=(xxcurrentView>=10)?"calc(100vh - 159px)":"calc(100vh - 135px)";QS("container").position="";QS("page_content").position="";QV("MainMenuSpan",true);QV("UserDummyMenuSpan",false);QV("page_leftbar",false)}else{QS("container").position="absolute";QS("container").width="100%";QS("container").top="0px";QS("container").bottom="0px";QS("container")["border-right"]="0";QS("container")["border-left"]="0";QS("container")["min-width"]="700px";QS("container")["overflow"]="hidden";QS("page_content").position="absolute";QS("page_content").top="66px";QS("page_content").left="90px";QS("page_content").right="0px";QS("page_content").bottom="0px";QS("column_l").height="calc(100vh - 135px)";QS("column_l").width="calc(100% - 30px)";QS("column_l")["overflow-y"]="auto";QS("column_l")["max-height"]="calc(100vh - 135px)";QV("MainMenuSpan",false);QV("UserDummyMenuSpan",(xxcurrentView<10)&&webPageFullScreen);QV("page_leftbar",true)}masterUpdate(512);QV("body",true)}function getNodeFromId(b){for(var a in nodes){if(nodes[a]._id==b){return nodes[a]}}return null}function reload(){window.location.href=window.location.href}function onStateChanged(a,b){if(b==0){setDialogMode(0);go(0);powerTimeline=null;powerTimelineReq=null;powerTimelineNode=null;powerTimelineUpdate=null;deleteAllNotifications();hideContextMenu();QV("verifyEmailId2",false);QV("logoutControl",false);setTimeout(serverPoll,5000)}else{if(b==2){meshserver.send({action:"meshes"});meshserver.send({action:"nodes"});meshserver.send({action:"files"})}}}function serverPoll(){var b=null;try{b=new XDomainRequest()}catch(a){}if(!b){b=new XMLHttpRequest()}b.open("HEAD",window.location.href);b.timeout=15000;b.onload=function(){reload()};b.onerror=b.ontimeout=function(){setTimeout(serverPoll,10000)};b.send()}function detectClickOnce(){for(var a in window.navigator.mimeTypes){if(window.navigator.mimeTypes[a].type=="application/x-ms-application"){return true}}var b=window.navigator.userAgent.toUpperCase();return(b.indexOf(".NET CLR 3.5")>=0)||(b.indexOf("(WINDOWS NT ")>=0)}function updateSiteAdmin(){var a="{{{noServerBackup}}}";var b=userinfo.siteadmin;if(a==1){b&=4294967290}QV("p2AccountActions",((features&4)==0)&&(serverinfo.domainauth==false));QV("p2ServerActions",b&21);QV("LeftMenuMyServer",b&21);QV("MainMenuMyServer",b&21);QV("p2ServerActionsBackup",b&1);QV("p2ServerActionsRestore",b&4);QV("p2ServerActionsVersion",b&16);QV("MainMenuMyFiles",b&8);QV("LeftMenuMyFiles",b&8);if(((b&8)==0)&&(xxcurrentView==5)){setDialogMode(0);go(1)}if(currentNode!=null){gotoDevice(currentNode._id,xxcurrentView,true)}if((userinfo.siteadmin&2)!=0){if(users==null){meshserver.send({action:"users"})}if(wssessions==null){meshserver.send({action:"wssessioncount"})}}else{users=null;wssessions=null;updateUsers();if(xxcurrentView==4||((xxcurrentView>=30)&&(xxcurrentView<40))){setDialogMode(0);go(1);currentUser=null}}meshserver.send({action:"events",limit:parseInt(p3limitdropdown.value)});QV("p2deleteall",userinfo.siteadmin==4294967295);if((b&21)!=0){meshserver.send({action:"serverstats",interval:10000})}}var updateNaggleTimer=null;var updateNaggleFlags=0;function masterUpdate(a){updateNaggleFlags|=a;if(updateNaggleTimer==null){updateNaggleTimer=setTimeout(function(){if(updateNaggleFlags&512){center()}if(updateNaggleFlags&1){onSearchInputChanged()}if(updateNaggleFlags&2){onSortSelectChange(true)}if(updateNaggleFlags&128){updateMeshes()}if(updateNaggleFlags&4){updateDevices()}if(updateNaggleFlags&8){drawNotifications()}if(updateNaggleFlags&16){updateMapMarkers()}if(updateNaggleFlags&32){eventsUpdate()}if(updateNaggleFlags&64){refreshMap(false,true)}if(updateNaggleFlags&256){drawDeviceTimeline()}if(updateNaggleFlags&1024){deviceEventsUpdate()}if(updateNaggleFlags&2048){userEventsUpdate()}updateNaggleTimer=null;updateNaggleFlags=0},150)}}function onMessage(v,f){switch(f.action){case"serverstats":updateServerStats(f);break;case"serverinfo":serverinfo=f.serverinfo;break;case"userinfo":userinfo=f.userinfo;updateSiteAdmin();QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("verifyEmailId2",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("otpAuth",((features&4096)!=0)&&(userinfo.otpsecret!=1));QV("otpAuthRemove",((features&4096)!=0)&&(userinfo.otpsecret==1));break;case"users":users={};for(var e in f.users){users[f.users[e]._id]=f.users[e]}updateUsers();break;case"wssessioncount":wssessions=f.wssessions;updateUsers();break;case"meshes":meshes={};for(var e in f.meshes){meshes[f.meshes[e]._id]=f.meshes[e]}masterUpdate(4+128);break;case"files":filetree=setupBackPointers(f.filetree);updateFiles();d3updatefiles();break;case"nodes":nodes=[];for(var e in f.nodes){if(!meshes[e]){console.log("Invalid mesh (1): "+e);continue}for(var g in f.nodes[e]){if(f.nodes[e][g]._id==null){console.log("Invalid node ("+g+"): "+JSON.stringify(f.nodes));continue}f.nodes[e][g].namel=f.nodes[e][g].name.toLowerCase();if(f.nodes[e][g].rname){f.nodes[e][g].rnamel=f.nodes[e][g].rname.toLowerCase()}else{f.nodes[e][g].rnamel=f.nodes[e][g].namel}f.nodes[e][g].meshnamel=meshes[e].name.toLowerCase();f.nodes[e][g].meshid=e;f.nodes[e][g].state=(f.nodes[e][g].state)?(f.nodes[e][g].state):0;f.nodes[e][g].desc=f.nodes[e][g].desc;if(!f.nodes[e][g].icon){f.nodes[e][g].icon=1}f.nodes[e][g].ident=++nodeShortIdent;nodes.push(f.nodes[e][g])}}masterUpdate(1|2|4|64);if(xxcurrentView==0){if("{{viewmode}}"!=""){go(parseInt("{{viewmode}}"))}else{setDialogMode(0);go(1)}}if("{{currentNode}}"!=""){gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"))}break;case"powertimeline":if(f.nodeid!=powerTimelineReq){break}powerTimelineNode=f.nodeid;powerTimeline=f.timeline;powerTimelineUpdate=Date.now()+300000;if(currentNode._id==f.nodeid){masterUpdate(256)}break;case"lastconnect":var o=getNodeFromId(f.nodeid);if(o!=null){o.lastconnect=f.time;if((currentNode._id==o._id)&&(Q("MainComputerState").innerHTML=="")){QH("MainComputerState","<span style=font-size:12px>Last seen:<br />"+new Date(o.lastconnect).toLocaleDateString()+", "+new Date(o.lastconnect).toLocaleTimeString()+"</span>")}}break;case"msg":if(f.nodeid!=null){var d=-1;for(var c in nodes){if(nodes[c]._id==f.nodeid){d=c;break}}if(d!=-1){if(f.type=="console"){p15consoleReceive(nodes[d],f.value)}else{if(f.type=="notify"){var g={text:f.value};if(f.nodeid!=null){g.nodeid=f.nodeid}if(f.tag!=null){g.tag=f.tag}if(f.username!=null){g.username=f.username}addNotification(g)}else{if(f.type=="ps"){showDeskToolsProcesses(f)}}}}}else{if(f.type=="notify"){var g={text:f.value};if(f.tag!=null){g.tag=f.tag}if(f.username!=null){g.username=f.username}addNotification(g)}}break;case"getnetworkinfo":if((currentNode._id==f.nodeid)&&(xxdialogMode==2)&&(xxdialogTag=="if"+f.nodeid)){if(f.netif==null){QH("d2netinfo","No network interface information available for this device.")}else{var z="<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>";z+=addHtmlValue2("Last Updated",new Date(f.updateTime).toLocaleString());if(currentNode.publicip){z+=addHtmlValue2("Public IP address",currentNode.publicip)}for(var c in f.netif){var h=f.netif[c];z+="<hr />";if(h.name){z+=addHtmlValue2("Name","<b>"+EscapeHtml(h.name)+"</b>")}if(h.desc){z+=addHtmlValue2("Description",EscapeHtml(h.desc).replace("(R)","®").replace("(r)","®"))}if(h.dnssuffix){z+=addHtmlValue2("DNS suffix",EscapeHtml(h.dnssuffix))}if(h.mac){z+=addHtmlValue2("MAC address",EscapeHtml(h.mac.toUpperCase()))}if(h.v4addr){z+=addHtmlValue2("IPv4 address",EscapeHtml(h.v4addr))}if(h.v4mask){z+=addHtmlValue2("IPv4 mask",EscapeHtml(h.v4mask))}if(h.v4gateway){z+=addHtmlValue2("IPv4 gateway",EscapeHtml(h.v4gateway))}if(h.gatewaymac){z+=addHtmlValue2("Gateway MAC",EscapeHtml(h.gatewaymac))}}z+="</div>";QH("d2netinfo",z)}}break;case"serverversion":if((xxdialogMode==2)&&(xxdialogTag=="MeshCentralServerUpdate")){var z="<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>";if(!f.current){f.current="Unknown"}if(!f.latest){f.latest="Unknown"}z+=addHtmlValue2("Current Version","<b>"+EscapeHtml(f.current)+"</b>");z+=addHtmlValue2("Latest Version","<b>"+EscapeHtml(f.latest)+"</b>");z+="</div>";if((f.latest.indexOf(".")==-1)||(f.current==f.latest)||((features&2048)==0)){setDialogMode(2,"MeshCentral Version",1,null,z)}else{setDialogMode(2,"MeshCentral Version",3,server_showVersionDlgEx,z+"<br /><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> Check and click OK to start server self-update.");server_showVersionDlgUpdate()}}break;case"servererrors":if((xxdialogMode==2)&&(xxdialogTag=="MeshCentralServerErrors")){if(f.data==null){setDialogMode(2,"MeshCentral Server Errors",1,null,"Server has no error log.")}else{var z="<div style=width:100%;max-height:260px;overflow-x:hidden;overflow:auto;line-height:160%;font-size:10px><pre>"+f.data+"<pre></div>";setDialogMode(2,"MeshCentral Server Errors",3,server_showErrorsDlgEx,z+"<br /><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> Check and click OK to clear error log.");server_showVersionDlgUpdate()}}break;case"events":if((f.nodeid!=null)&&(f.nodeid==currentNode._id)){currentDeviceEvents=f.events;masterUpdate(1024)}else{if((f.user!=null)&&(f.user==currentUser.name)){currentUserEvents=f.events;masterUpdate(2048)}else{events=f.events;masterUpdate(32)}}break;case"getcookie":if(f.tag=="clickonce"){var a="{{{serverRedirPort}}}"==""?"{{{serverPublicPort}}}":"{{{serverRedirPort}}}";var s="http://"+window.location.hostname+":"+a+"/clickonce/minirouter/MeshMiniRouter.application?WS=wss%3A%2F%2F"+window.location.hostname+"%2Fmeshrelay.ashx%3Fauth="+f.cookie+"&CH={{{webcerthash}}}&AP="+f.protocol+((debugmode==1)?"":"&HOL=1");var l=window.open(s,"_blank");l.opener=null}break;case"getNotes":var g=Q("d2devNotes");if(g&&(f.id==decodeURIComponent(g.attributes.noteid.value))){if(f.notes){QH("d2devNotes",decodeURIComponent(f.notes))}else{QH("d2devNotes","")}var t=g.attributes.ro.value=="true";if(t==false){g.removeAttribute("readonly");QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",true);focusTextBox("d2devNotes")}}break;case"otpauth-request":if((xxdialogMode==2)&&(xxdialogTag=="otpauth-request")){var u=f.secret;if(u.length==52){u=u.split(/(.............)/).filter(Boolean).join(" ")}else{if(u.length==32){u=u.split(/(....)/).filter(Boolean).join(" ");u=u.substring(0,20)+"<br/>"+u.substring(20)}}QH("d2optinfo",'<table style=width:380px><tr><td style=vertical-align:top>Install <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" rel="noreferrer noopener" target=_blank>Google Authenticator</a> or a compatible application and scan the barcode, use <a href="'+f.url+'" rel="noreferrer noopener" target=_blank> this link</a> or enter the secret. Then, enter the current 6 digit token below to activate 2-Step login.<br /><br />Secret<br /><tt id=d2optsecret secret="'+f.secret+'" style=font-size:12px>'+u+'</tt><br /><br /></td><td style=width:1px;vertical-align:top><a href="'+f.url+'" rel="noreferrer noopener" target=_blank><div id="qrcode"></div></a></td><tr><td colspan=2 style="text-align:center;border-top:1px solid black"><br />Enter the token here for 2-step login: <input type=text onkeypress="return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text></td></table>');new QRCode(Q("qrcode"),{text:f.url,width:128,height:128,colorDark:"#000000",colorLight:"#EEE",correctLevel:QRCode.CorrectLevel.H});QV("idx_dlgOkButton",true);QE("idx_dlgOkButton",false);Q("d2otpauthinput").focus()}break;case"otpauth-setup":if(xxdialogMode){return}setDialogMode(2,"Add 2-Step Login",1,null,f.success?"<b style=color:green>2-step login activation successful</b>. You will now need a valid token to login again.":"<b style=color:red>2-step login activation failed</b>. Clear the secret from the application and try again. You only have a few minutes to enter the proper code.");break;case"otpauth-clear":if(xxdialogMode){return}setDialogMode(2,"Remove 2-Step Login",1,null,f.success?"<b style=color:green>2-step login activation removed</b>. You can reactivate this feature at any time.":"<b style=color:red>2-step login activation removal failed</b>. Try again.");break;case"event":if(!f.event.nolog){events.unshift(f.event);var b=parseInt(p3limitdropdown.value);while(events.length>b){events.pop()}masterUpdate(32)}switch(f.event.action){case"accountcreate":case"accountchange":if(userinfo.name==f.event.account.name){var k=f.event.account.siteadmin?f.event.account.siteadmin:0;var p=userinfo.siteadmin?userinfo.siteadmin:0;if((f.event.account.quota!=userinfo.quota)||(((userinfo.siteadmin&8)==0)&&((f.event.account.siteadmin&8)!=0))){meshserver.send({action:"files"})}userinfo=f.event.account;if(p!=k){updateSiteAdmin()}QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("verifyEmailId2",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true))}if(users==null){break}users[f.event.account._id]=f.event.account;updateUsers();break;case"accountremove":if(users==null){break}delete users["user/"+domain+"/"+f.event.username.toLowerCase()];updateUsers();break;case"createmesh":if(f.event.links["user/"+domain+"/"+userinfo.name.toLowerCase()]!=null){meshes[f.event.meshid]={_id:f.event.meshid,name:f.event.name,mtype:f.event.mtype,desc:f.event.desc,links:f.event.links};masterUpdate(4+128);meshserver.send({action:"files"})}break;case"meshchange":if(meshes[f.event.meshid]==null){meshes[f.event.meshid]={_id:f.event.meshid,name:f.event.name,mtype:f.event.mtype,desc:f.event.desc,links:f.event.links};meshserver.send({action:"nodes"})}else{meshes[f.event.meshid].name=f.event.name;meshes[f.event.meshid].desc=f.event.desc;meshes[f.event.meshid].flags=f.event.flags;meshes[f.event.meshid].links=f.event.links;if(meshes[f.event.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()]==null){if((xxcurrentView==20)&&(currentMesh==meshes[f.event.meshid])){go(2)}delete meshes[f.event.meshid];var j=[];for(var c in nodes){if(nodes[c].meshid!=f.event.meshid){j.push(nodes[c])}}nodes=j;if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==f.event.meshid){setDialogMode(0);go(1)}}}masterUpdate(4+128);meshserver.send({action:"files"});if(xxcurrentView==20&¤tMesh._id==f.event.meshid){p20updateMesh()}break;case"deletemesh":if(meshes[f.event.meshid]){delete meshes[f.event.meshid];masterUpdate(128);meshserver.send({action:"files"})}var j=[];for(var c in nodes){if(nodes[c].meshid!=f.event.meshid){j.push(nodes[c])}}nodes=j;masterUpdate(4);if(xxcurrentView>=20&&xxcurrentView<30&¤tMesh._id==f.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==f.event.meshid){setDialogMode(0);go(1)}break;case"addnode":var o=f.event.node;if(!meshes[o.meshid]){break}o.namel=o.name.toLowerCase();if(o.rname){o.rnamel=o.rname.toLowerCase()}else{o.rnamel=o.namel}o.meshnamel=meshes[o.meshid].name.toLowerCase();o.state=0;if(!o.icon){o.icon=1}o.ident=++nodeShortIdent;nodes.push(o);masterUpdate(1|2|4|16);break;case"removenode":var d=-1;for(var c in nodes){if(nodes[c]._id==f.event.nodeid){d=c;break}}if(d!=-1){var o=nodes[d];if(currentNode==o){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(1)}currentNode=null}nodes.splice(d,1);masterUpdate(4|16)}break;case"changenode":var d=-1;for(var c in nodes){if(nodes[c]._id==f.event.nodeid){d=c;break}}if(d!=-1){var o=nodes[d];o.name=f.event.node.name;o.rname=f.event.node.rname;o.users=f.event.node.users;o.host=f.event.node.host;o.desc=f.event.node.desc;o.osdesc=f.event.node.osdesc;o.publicip=f.event.node.publicip;o.iploc=f.event.node.iploc;o.wifiloc=f.event.node.wifiloc;o.gpsloc=f.event.node.gpsloc;o.tags=f.event.node.tags;o.userloc=f.event.node.userloc;if(f.event.node.agent!=null){if(o.agent==null){o.agent={}}if(f.event.node.agent.ver!=null){o.agent.ver=f.event.node.agent.ver}if(f.event.node.agent.id!=null){o.agent.id=f.event.node.agent.id}if(f.event.node.agent.caps!=null){o.agent.caps=f.event.node.agent.caps}if(f.event.node.agent.core!=null){o.agent.core=f.event.node.agent.core}else{if(o.agent.core){delete o.agent.core}}o.agent.tag=f.event.node.agent.tag}if(f.event.node.intelamt!=null){if(o.intelamt==null){o.intelamt={}}if(f.event.node.intelamt.host!=null){o.intelamt.user=f.event.node.intelamt.host}if(f.event.node.intelamt.user!=null){o.intelamt.user=f.event.node.intelamt.user}if(f.event.node.intelamt.tls!=null){o.intelamt.tls=f.event.node.intelamt.tls}if(f.event.node.intelamt.ver!=null){o.intelamt.ver=f.event.node.intelamt.ver}if(f.event.node.intelamt.state!=null){o.intelamt.state=f.event.node.intelamt.state}}o.namel=o.name.toLowerCase();if(o.rname){o.rnamel=o.rname.toLowerCase()}else{o.rnamel=o.namel}if(f.event.node.icon){o.icon=f.event.node.icon}masterUpdate(2|4|8|16);refreshDevice(o._id);if((currentNode==o)&&(xxdialogMode!=null)&&(xxdialogTag=="@xxmap")){p10showNodeLocationDialog()}}break;case"nodeconnect":var d=-1;for(var c in nodes){if(nodes[c]._id==f.event.nodeid){d=c;break}}if(d!=-1){var o=nodes[d];o.conn=f.event.conn;o.pwr=f.event.pwr;masterUpdate(4|16);refreshDevice(o._id)}break;case"wssessioncount":if(wssessions!=null){if(f.event.count==0&&wssessions["user/"+domain+"/"+f.event.username.toLowerCase()]){delete wssessions["user/"+domain+"/"+f.event.username.toLowerCase()]}else{wssessions["user/"+domain+"/"+f.event.username.toLowerCase()]=f.event.count}updateUsers()}break;case"clearevents":events=[];masterUpdate(32);break;case"login":if(users!=null&&users["user/"+domain+"/"+f.event.username.toLowerCase()]){users["user/"+domain+"/"+f.event.username.toLowerCase()].login=f.event.time}break;case"scanamtdevice":if((xxdialogMode==null)||(!Q("dp1range"))||(Q("dp1range").value!=f.event.range)){return}var z="";if(f.event.results==null){z="<div style=width:100%;text-align:center;margin-top:12px>Unable to scan this address range.</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>"}else{amtScanResults=f.event.results;for(var c in f.event.results){var q=f.event.results[c],w=q.hostname;if(w.length>20){w=w.substring(0,20)+"..."}var y='<b title="'+EscapeHtml(q.hostname)+'">'+EscapeHtml(w)+"</b> - v"+q.ver;if(q.state==2){if(q.tls==1){y+=" with TLS."}else{y+=" without TLS."}}else{y+=" not activated."}z+='<div style=width:100%;margin-bottom:2px;background-color:lightgray><div style=padding:4px><div style=display:inline-block;margin-right:5px><input class=DevScanCheckbox name=dp1checkbox tag="'+EscapeHtml(c)+'" type=checkbox onclick=addAmtScanToMeshCheckbox() /></div><div class=j1 style=display:inline-block></div><div style=display:inline-block;margin-left:5px;overflow-x:auto;white-space:nowrap>'+y+"</div></div></div>"}if(z==""){z="<div style=width:100%;text-align:center;margin-top:12px>Scan returned no results.</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>"}}QH("dp1results",z);QE("dp1range",true);QE("dp1rangebutton",true);break;case"notify":var g={text:f.event.value};if(f.event.tag!=null){g.tag=f.event.tag}addNotification(g);break;default:break}break;default:console.log("Unknown message.action",f.action);break}}function onRealNameCheckBox(){showRealNames=Q("RealNameCheckBox").checked;putstore("showRealNames",showRealNames?1:0);masterUpdate(6);return}function onDeviceViewChange(a){if(a!=null){Q("viewselect").value=a}for(var b=1;b<5;b++){Q("devViewButton"+b).classList.remove("viewSelectorSel")}Q("devViewButton"+Q("viewselect").value).classList.add("viewSelectorSel");putstore("deviceView",Q("viewselect").value);putstore("viewsize",Q("sizeselect").value);masterUpdate(4)}function ondockeypress(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeys(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==15){return agentConsoleHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==4){if(a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}var b=0;if(a.key){if(a.key.length===1&&userSearchFocus==0){Q("UserSearchInput").value=((Q("UserSearchInput").value+a.key));b=1}if(a.keyCode==8&&userSearchFocus==0){var c=Q("UserSearchInput").value;Q("UserSearchInput").value=c.substring(0,c.length-1);b=1}if(a.keyCode==27){Q("UserSearchInput").value="";b=1}}else{if(a.charCode!=0&&userSearchFocus==0){Q("UserSearchInput").value=((Q("UserSearchInput").value+String.fromCharCode(a.charCode)));b=1}}if(b>0){if(b==1){onUserSearchInputChanged()}return haltEvent(a)}}if(xxdialogMode||xxcurrentView!=1){return}if(a.ctrlKey==true&&a.charCode==96){showRealNames=!showRealNames;Q("RealNameCheckBox").value=showRealNames;putstore("showRealNames",showRealNames?1:0);masterUpdate(6);return}if(a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}if(Q("viewselect").value<3){var b=0;if(a.key){if(a.key.length===1&&searchFocus==0){Q("SearchInput").value=((Q("SearchInput").value+a.key));b=1}if(a.keyCode==8&&searchFocus==0){var c=Q("SearchInput").value;Q("SearchInput").value=c.substring(0,c.length-1);b=1}if(a.keyCode==27){Q("SearchInput").value="";b=1}}else{if(a.charCode!=0&&searchFocus==0){Q("SearchInput").value=((Q("SearchInput").value+String.fromCharCode(a.charCode)));b=1}}if(b>0){if(b==1){masterUpdate(5)}return haltEvent(a)}}if(Q("viewselect").value==3){if(a.key){if(a.key.length===1&&mapSearchFocus==0){Q("mapSearchLocation").value=((Q("mapSearchLocation").value+a.key));b=1}if(a.keyCode==27){Q("mapSearchLocation").value="";mapCloseSearchWindow();b=1}if(a.keyCode==13){getSearchLocation()}}else{if(a.charCode!=0&&mapSearchFocus==0){Q("mapSearchLocation").value=((Q("mapSearchLocation").value+String.fromCharCode(a.charCode)));b=1}}}}function ondockeydown(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeyDown(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeyDown(a)}if(!xxdialogMode&&xxcurrentView==13&&a.keyCode==116&&p13filetree!=null){haltEvent(a);return false}if(!xxdialogMode&&xxcurrentView==15){return agentConsoleHandleKeys(a)}if(!xxdialogMode&&xxcurrentView==4){if(a.keyCode===8&&userSearchFocus==0){var c=Q("UserSearchInput").value;Q("UserSearchInput").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("UserSearchInput").value="";b=1}if(b>0){if(b==1){masterUpdate(5)}return haltEvent(a)}}if(xxdialogMode||xxcurrentView!=1||a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}var b=0;if(Q("viewselect").value<3){if(a.keyCode===8&&searchFocus==0){var c=Q("SearchInput").value;Q("SearchInput").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("SearchInput").value="";b=1}if(b>0){if(b==1){masterUpdate(5)}return haltEvent(a)}}if(Q("viewselect").value==3){if(a.keyCode===8&&mapSearchFocus==0){var c=Q("mapSearchLocation").value;Q("mapSearchLocation").value=(c.substring(0,c.length-1));b=1}if(a.keyCode===27){Q("mapSearchLocation").value="";mapCloseSearchWindow();b=1}}}function ondockeyup(a){if(!xxdialogMode&&xxcurrentView==11&&desktop&&Q("DeskControl").checked){return desktop.m.handleKeyUp(a)}if(!xxdialogMode&&xxcurrentView==12&&terminal&&terminal.State==3){return terminal.m.TermHandleKeyUp(a)}if(!xxdialogMode&&xxcurrentView==13&&a.keyCode==116&&p13filetree!=null){p13folderup(9999);haltEvent(a);return false}if(!xxdialogMode&&xxcurrentView==4){if((a.keyCode===8&&searchFocus==0)||a.keyCode===27){return haltEvent(a)}}if(xxdialogMode&&a.keyCode==27){dialogclose(0)}if(xxdialogMode||xxcurrentView!=0||a.ctrlKey==true||a.altKey==true||a.metaKey==true){return}if(Q("viewselect").value<3){if((a.keyCode===8&&searchFocus==0)||a.keyCode===27){return haltEvent(a)}}if(Q("viewselect").value==3){if((a.keyCode===8&&mapSearchFocus==0)||a.keyCode===27){return haltEvent(a)}}}function devMouseHover(b,c){var d=Q("viewselect").value;if(d==1){var a=b.children[1].children[1];a.children[0].classList.remove("g1s");a.children[1].classList.remove("e2s");a.children[2].classList.remove("g2s");if(c==1){a.children[0].classList.add("g1s");a.children[1].classList.add("e2s");a.children[2].classList.add("g2s")}}else{if(d==2){var a=b;a.children[2].classList.remove("g1s");a.children[4].classList.remove("e2s");a.children[3].classList.remove("g2s");if(c==1){a.children[2].classList.add("g1s");a.children[4].classList.add("e2s");a.children[3].classList.add("g2s")}}}}var deviceHeaderId=0;var deviceHeaderTotal=0;var deviceHeadersTitles={};var deviceHeaderCount;var deviceHeaders={};var oldviewmode=0;function updateDevices(){var G="",a=0,f=null,e=0,k={},N=Q("viewselect").value,q={},o={};QV("xdevices",N<4);QV("xdevicesmap",N==4);QV("devListToolbar",N<3);QV("kvmListToolbar",N==3);QV("devMapToolbar",N==4);QV("devListToolbarSize",N==3);QV("NoMeshesPanel",meshcount==0);QV("devListToolbarViewIcons",(meshcount!=0)&&(nodes.length>0));QV("devListToolbarSort",(meshcount!=0)&&(nodes.length>0)&&(N<4));if((meshcount==0)||(nodes.length==0)){N=1;sort=0}if(N==4){setTimeout(function(){if(xxmap.map!=null){xxmap.map.updateSize()}},200)}else{deviceHeaderId=0;deviceHeaderCount={};deviceHeaderTotal=0;deviceHeaders={};deviceHeadersTitles={};var w=[];if(sort==0){nodes.sort(meshSort)}else{if(sort==1){nodes.sort(powerSort)}else{if(sort==2){if(showRealNames==true){nodes.sort(deviceHostSort)}else{nodes.sort(deviceSort)}}}}var d=[],l=document.getElementsByClassName("DeviceCheckbox"),b=0;for(var s=0;s<l.length;s++){if(l[s].checked){d.push(l[s].value)}}if((oldviewmode<3)&&(N==3)){multiDesktopFilter=d}else{if((oldviewmode==3)&&(N<3)){d=multiDesktopFilter}}var L=Q("column_l").clientWidth-60;var h=Math.floor(L/301);h=301+Math.floor((L-(h*301))/h);for(var s in nodes){if(nodes[s].v==false){continue}var y=meshes[nodes[s].meshid],A=y.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(A==null){continue}var B=A.rights;if((N==3)&&(y.mtype==1)){continue}if(sort==0){if(nodes[s].meshid!=f){deviceHeaderSet();var n="";if(meshes[nodes[s].meshid].mtype==1){n="<span class=devHeaderx>, Intel® AMT only</span>"}if((N==1)&&(f!=null)){if(a==2){G+="<td><div style=width:301px></div></td>"}if(G!=""){G+="</tr></table>"}}G+="<div class=DevSt style=width:100%;padding-top:4px><span style=float:right>";G+=getMeshActions(y,B);G+='</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("'+nodes[s].meshid+'")>'+EscapeHtml(meshes[nodes[s].meshid].name)+"</span>"+n+"<span id=DevxHeader"+deviceHeaderId+" class=devHeaderx></span></div>";f=nodes[s].meshid;k[f]=1;a=0}}else{if(sort==1){var F=nodes[s].pwr?nodes[s].pwr:0;if(F!==f){deviceHeaderSet();if((N==1)&&(f!==null)){if(a==2){G+="<td><div style=width:301px></div></td>"}if(G!=""){G+="</tr></table>"}}G+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[s].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+' class="devHeaderx"></span></div>';f=F;a=0}}else{if(sort==2){if(f==null){f="1"}}}}e++;var K=EscapeHtml(nodes[s].name);if(K.length==0){K="<i>None</i>"}if((nodes[s].rname!=null)&&(nodes[s].rname.length>0)){K+=" / "+EscapeHtml(nodes[s].rname)}var C=EscapeHtml(nodes[s].name);if(showRealNames==true&&nodes[s].rname!=null){C=EscapeHtml(nodes[s].rname)}if(C.length==0){C="<i>None</i>"}var t=nodes[s].icon;var E=NodeStateStr(nodes[s]);if((!nodes[s].conn)||(nodes[s].conn==0)){t+=" gray"}if(N==1){G+="<div id=devs onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=display:inline-block;width:"+h+'px;height:50px;padding-top:1px;padding-bottom:1px><div style=width:22px;height:50%;float:left;padding-top:12px><input class="'+nodes[s].meshid+' DeviceCheckbox" onclick=p1updateInfo() value=devid_'+nodes[s]._id+" type=checkbox></div><div style=height:100%;cursor:pointer onclick=gotoDevice('"+nodes[s]._id+"')><div class=\"i"+t+'" style=width:50px;float:left></div><div style=height:100%><div class=g1></div><div class=e2><div class=e1 style=width:'+(h-100)+'px title="'+K+'">'+C+"</div><div>"+E+"</div></div><div class=g2></div></div></div></div>"}else{if(N==2){G+="<tr><td><div id=devs class=bar18 onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=height:18px;width:100%;font-size:medium>";G+='<div style=width:22px;float:left;background-color:white><input class="'+nodes[s].meshid+' DeviceCheckbox" onclick=p1updateInfo() value=devid_'+nodes[s]._id+" type=checkbox></div>";G+="<div style=float:left;height:18px;width:18px;background-color:white onclick=gotoDevice('"+nodes[s]._id+"')><div class=j"+t+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";G+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";G+='<div style=cursor:pointer;font-size:14px title="'+K+"\" onclick=gotoDevice('"+nodes[s]._id+"')><span style=float:right>"+E+"</span><span style=width:300px>"+C+"</span></div></div></td></tr>"}else{if((N==3)&&(nodes[s].conn&1)&&(((B&8)||(B&256))!=0)&&((nodes[s].agent.caps&1)!=0)){if((multiDesktopFilter.length==0)||(multiDesktopFilter.indexOf("devid_"+nodes[s]._id)>=0)){G+="<div id=devs style=display:inline-block;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div style=padding:3px;cursor:pointer onclick=gotoDevice('"+nodes[s]._id+"',11)>";G+='<div class="j'+t+'" style=width:16px;float:left></div> '+C+"</div>";G+="<span onclick=gotoDevice('"+nodes[s]._id+"')></span><div id=xkvmid_"+nodes[s]._id.split("/")[2]+"><div id=skvmid_"+nodes[s]._id.split("/")[2]+' style="position:absolute;color:white;left:5px;top:27px;text-shadow:0px 0px 5px #000;z-index:1000;cursor:default" onclick=toggleKvmDevice(\''+nodes[s]._id+"')>Disconnected</div></div>";G+="</div>";w.push(nodes[s]._id)}}}}if((sort==3)&&(G!="")){if(nodes[s].tags){for(var v in nodes[s].tags){var J=nodes[s].tags[v];if(q[J]==null){q[J]=G;o[J]=1}else{q[J]+=G;o[J]+=1}if(N==3){break}}}G=""}deviceHeaderTotal++;if(typeof deviceHeaderCount[nodes[s].state]=="undefined"){deviceHeaderCount[nodes[s].state]=1}else{deviceHeaderCount[nodes[s].state]++}}if(sort==3){var p=[];for(var s in q){p.push(s)}p.sort(function(c,j){return c.toLowerCase().localeCompare(j.toLowerCase())});for(var v in p){var s=p[v];G+="<div class=DevSt style=width:100%;padding-top:4px><span>"+s+'</span><span class="devHeaderx">, '+o[s]+" device"+((o[s]>1)?"s":"")+"</span></div>"+q[s]}}if((G=="")&&(meshcount>0)&&(Q("SearchInput").value!="")){if(sort==3){G='<div style="margin:30px">No devices are included in any groups, click on a device\'s "Groups" to add to a group.</div>'}else{G='<div style="margin:30px">No devices matching this search.</div>'}}if((N==1)&&(a==2)){G+="<td><div style=width:301px></div></td>"}if((sort==0)&&(Q("SearchInput").value=="")&&(N<3)){for(var s in meshes){var x=meshes[s],z=x.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(z!=null){var B=z.rights;if(k[x._id]==null){if((f!="")&&(G!="")){G+="</tr></table>"}G+="<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr><td colspan=3 class=DevSt><span style=float:right>";G+=getMeshActions(x,B);G+='</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("'+x._id+'")>'+EscapeHtml(x.name)+"</span></td></tr><tr>";if(x.mtype==1){G+="<td><div style=padding:10px><i>No Intel® AMT devices in this mesh";if((B&4)!=0){G+=', <a style=cursor:pointer onclick=addDeviceToMesh("'+x._id+'")>add one</a>'}}if(x.mtype==2){G+="<td><div style=padding:10px><i>No devices in this mesh";if((B&4)!=0){G+=', <a style=cursor:pointer onclick=addAgentToMesh("'+x._id+'")>add one</a>'}}G+=".</i></div></td>";f=x._id;e++}}}}G+="</tr></table><div style=height:1px></div>";G+="<div style=border-top-style:solid;border-top-width:1px;border-top-color:#DDDDDD;cursor:pointer;font-size:10px>";if((N<3)&&(sort==0)&&(meshcount>0)){G+='<a onclick=account_createMesh() title="Create a new group of devices." style=cursor:pointer>Add Device Group</a> '}G+='<a onclick=p10showMeshCmdDialog(0) style=cursor:pointer title="Download MeshCmd, a command line tool that performs many functions.">MeshCmd</a></div>';G+="</div><br/>";QH("xdevices",G);deviceHeaderSet();var l=document.getElementsByClassName("DeviceCheckbox"),b=0;for(var s=0;s<l.length;s++){l[s].checked=(d.indexOf(l[s].value)>=0)}for(var s in deviceHeaders){QH(s,deviceHeaders[s])}for(var s in deviceHeadersTitles){Q(s).title=deviceHeadersTitles[s]}p1updateInfo();if(N==3){var O=[{x:180,y:101},{x:302,y:169},{x:454,y:255}][Q("sizeselect").selectedIndex];var H=O.x+2,M=L-5,P=Math.floor(M/H);P=H+Math.floor((M-(P*H))/P);O.y=O.y*(P/O.x);O.x=P;for(var s in multiDesktop){multiDesktop[s].xxdelete=true}for(var s in w){var u=w[s],I=u.split("/")[2],g=multiDesktop[u];if(g!=null){g.m.CanvasId.setAttribute("style","background-color:black;width:"+O.x+"px;height:"+O.y+"px");Q("xkvmid_"+I).appendChild(g.m.CanvasId);delete g.xxdelete;QH("skvmid_"+I,["Disconnected","Connecting...","Setup...","",""][((g.m.State==null)?g.m.state:g.m.State)])}else{var D=getNodeFromId(u);if((desktopNode==D)&&(desktop!=null)){var a=desktop.m.CanvasId;a.setAttribute("id","kvmid_"+I);a.setAttribute("style","background-color:black;width:"+O.x+"px;height:"+O.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+u+"')");a.removeAttribute("onmousedown");a.removeAttribute("onmouseup");a.removeAttribute("onmousemove");Q("xkvmid_"+I).appendChild(a);QH("skvmid_"+I,["Disconnected","Connecting...","Setup...","",""][((desktop.m.State==null)?desktop.m.state:desktop.m.State)]);if(desktop.m.SendCompressionLevel){desktop.m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}desktop.shortid=I;desktop.onStateChanged=onMultiDesktopStateChange;multiDesktop[u]=desktop;desktop=desktopNode=currentNode=null;QH("DeskParent",'<canvas id="Desk" width="640" height="480" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>')}else{var a=document.createElement("canvas");a.setAttribute("id","kvmid_"+I);a.setAttribute("width",640);a.setAttribute("height",480);a.setAttribute("oncontextmenu","return false");a.setAttribute("style","background-color:black;width:"+O.x+"px;height:"+O.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+u+"')");try{Q("xkvmid_"+I).appendChild(a)}catch(m){}if(Q("autoConnectDesktopCheckbox").checked==true){setTimeout(function(){connectMultiDesktop(D,1)},100)}}}}for(var s in multiDesktop){if(multiDesktop[s].xxdelete==true){multiDesktop[s].Stop();delete multiDesktop[s]}else{if(debugmode&&multiDesktop[s].m&&multiDesktop[s].m.onScreenSizeChange){mdeskAdjust(multiDesktop[s].m,multiDesktop[s].m.ScreenWidth,multiDesktop[s].m.ScreenHeight,multiDesktop[s].m.CanvasId)}}}deskAdjust()}else{disconnectAllKvmFunction();Q("autoConnectDesktopCheckbox").checked=false}}oldviewmode=N}function toggleKvmDevice(d){var c=getNodeFromId(d),a=meshes[c.meshid],b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&8)||(b&256)){if(c.conn&1){connectMultiDesktop(c,1)}}}function autoConnectDesktops(){if(Q("autoConnectDesktopCheckbox").checked==true){connectAllKvmFunction()}}function connectAllKvmFunction(){for(var a in nodes){if(multiDesktop[nodes[a]._id]==null){toggleKvmDevice(nodes[a]._id)}}}function disconnectAllKvmFunction(){for(var a in multiDesktop){multiDesktop[a].Stop()}multiDesktop={}}function onMultiDesktopStateChange(a,c){try{QH("skvmid_"+a.shortid,["Disconnected","Connecting...","Setup...","",""][c])}catch(b){}}function showMultiDesktopSettings(){QV("d7amtkvm",false);QV("d7meshkvm",true);d7bitmapquality.value=multidesktopsettings.quality;d7bitmapscaling.value=multidesktopsettings.scaling;if(multidesktopsettings.framerate){d7framelimiter.value=multidesktopsettings.framerate}else{d7framelimiter.value=1000}setDialogMode(7,"Remote Desktop Settings",3,showMultiDesktopSettingsChanged)}function showMultiDesktopSettingsChanged(){multidesktopsettings.quality=d7bitmapquality.value;multidesktopsettings.scaling=d7bitmapscaling.value;multidesktopsettings.framerate=d7framelimiter.value;localStorage.setItem("multidesktopsettings",JSON.stringify(multidesktopsettings));for(var a in multiDesktop){multiDesktop[a].m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}}function connectMultiDesktop(c,a){var d=c._id,e=d.split("/")[2];var b=multiDesktop[d];if(b==null){if(Q("kvmid_"+e)==null){return}if(a==2){if((c.intelamt.user==null)||(c.intelamt.user=="")){return}b=CreateAmtRedirect(CreateAmtRemoteDesktop("kvmid_"+e));b.shortid=e;b.onStateChanged=onMultiDesktopStateChange;b.m.bpp=1;b.m.useZRLE=true;b.m.showmouse=true;b.m.onKvmData=function(f){console.log("KVM Data received in multi-desktop mode, this is not supported.")};if(debugmode>0){b.m.onScreenSizeChange=mdeskAdjust}b.Start(d,16994,"*","*",0);b.contype=2;multiDesktop[d]=b}else{if(a==1){b=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("kvmid_"+e),serverPublicNamePort);b.shortid=e;b.attemptWebRTC=attemptWebRTC;b.onStateChanged=onMultiDesktopStateChange;b.m.CompressionLevel=multidesktopsettings.quality;b.m.ScalingLevel=multidesktopsettings.scaling;b.m.FrameRateTimer=multidesktopsettings.framerate;if(debugmode>0){b.m.onScreenSizeChange=mdeskAdjust}b.Start(d);b.contype=1;multiDesktop[d]=b}}}else{b.Stop();delete multiDesktop[d]}}function getMeshActions(a,b){if((b&4)==0){return""}var c="";if((features&1024)==0){c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel® AMT computer that is located on the internet." onclick=addCiraDeviceToMesh("'+a._id+'")>Add CIRA</a>'}if(a.mtype==1){if((features&1)==0){c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel® AMT computer that is located on the local network." onclick=addDeviceToMesh("'+a._id+'")>Add Local</a>';c+=' <a style=cursor:pointer;font-size:10px title="Add a new Intel® AMT computer by scanning the local network." onclick=addAmtScanToMesh("'+a._id+'")>Scan Network</a>'}}if(a.mtype==2){c+=' <a style=cursor:pointer;font-size:10px title="Add a new computer to this mesh by installing the mesh agent." onclick=addAgentToMesh("'+a._id+'")>Add Agent</a>';if(features&64){c+=' <a style=cursor:pointer;font-size:10px title="Invite someone to install the mesh agent on this mesh." onclick=inviteAgentToMesh("'+a._id+'")>Invite</a>'}}return c}function addDeviceToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c='Add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+'".<br /><br />';c+=addHtmlValue("Device Name","<input id=dp1devicename style=width:230px maxlength=32 autocomplete=off onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />");c+=addHtmlValue("Hostname",'<input id=dp1hostname style=width:230px maxlength=32 autocomplete=off placeholder="Same as device name" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');c+=addHtmlValue("Username",'<input id=dp1username style=width:230px maxlength=32 autocomplete=off placeholder="admin" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');c+=addHtmlValue("Password","<input id=dp1password type=password style=width:230px autocomplete=off maxlength=32 onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />");c+=addHtmlValue("Security","<select id=dp1tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");setDialogMode(2,"Add Intel® AMT device",3,addDeviceToMeshEx,c,b);validateDeviceToMesh();Q("dp1devicename").focus()}function addAmtScanToMesh(a){if(xxdialogMode){return}var b="Enter a range of IP addresses to scan for Intel AMT devices.<br /><br />";b+=addHtmlValue("IP Range",'<input id=dp1range style=width:184px value="192.168.1.0/24" onkeyup=addAmtScanToMeshKeyUp(event) /><input id=dp1rangebutton type=button value=Scan onclick=addAmtScanToMeshButton()></input>');b+='<div id=dp1results style="width:100%;height:200px;background-color:white;border:1px gray solid;overflow-y:scroll"></div>';setDialogMode(2,"Scan for Intel® AMT devices",3,addAmtScanToMeshEx,b,a);QE("idx_dlgOkButton",false);QH("dp1results","<div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>");focusTextBox("dp1range")}function addAmtScanToMeshKeyUp(a){if(a.keyCode==13){haltEvent(a);addAmtScanToMeshButton()}}function addAmtScanToMeshEx(b,g){var d=document.getElementsByClassName("DevScanCheckbox"),c=0;for(var e=0;e<d.length;e++){if(d[e].checked){var f=d[e].getAttribute("tag");var a=amtScanResults[f];meshserver.send({action:"addamtdevice",meshid:g,devicename:f,hostname:a.hostname,amtusername:"",amtpassword:"",amttls:a.tls})}}}function addAmtScanToMeshButton(){QE("dp1range",false);QE("dp1rangebutton",false);QH("dp1results","<div style=width:100%;text-align:center;margin-top:12px>Scanning...</div>");meshserver.send({action:"scanamtdevice",range:Q("dp1range").value})}function addAmtScanToMeshCheckbox(){var b=document.getElementsByClassName("DevScanCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked){a++}}QE("idx_dlgOkButton",a>0)}function addCiraDeviceToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c=b.split("/")[2].replace(/\@/g,"X").replace(/\$/g,"X");var e="<select id=dlgAddCiraSel onclick=dlgAddCiraSelClick() style=width:230px><option value=0>MeshCommander Script</option><option value=1>Manual Username/Password</option>";if((features&16)==0){e+="<option value=2>Manual Certificate</option></select>"}var d="";d+=addHtmlValue("Setup Method",e);d+="<hr>";d+='<div id=dlgAddCira0>To add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+"\" with CIRA, download the following script files and use <a href='http://meshcommander.com' rel='noreferrer noopener' target='_blank'>MeshCommander</a> to run the script to configure computers.<br /><br />";d+=addHtmlValue("Setup CIRA",'<a href="mescript.ashx?type=1&meshid='+c.substring(0,16)+'" rel="noreferrer noopener" target="_blank">cira_setup.mescript</a>');d+=addHtmlValue("Cleanup CIRA",'<a href="mescript.ashx?type=2" rel="noreferrer noopener" target="_blank">cira_clean.mescript</a>');d+="</div>";d+='<div id=dlgAddCira1 style=display:none>To add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+'" with CIRA, load the following certificate as trusted root within Intel AMT';if(serverinfo.mpspass){d+=" and authenticate to the server using this username and password.<br /><br />"}else{d+=" and authenticate to the server using this username and any password.<br /><br />"}d+=addHtmlValue("Root Certificate",'<a href="MeshServerRootCert.cer" rel="noreferrer noopener" target="_blank">Root Certificate File</a>');d+=addHtmlValue("Username",'<input style=width:230px readonly value="'+c.substring(0,16)+'" />');if(serverinfo.mpspass){d+=addHtmlValue("Password",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpspass)+'" />')}if(serverinfo!=null){d+=addHtmlValue("MPS Server",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpsname)+":"+serverinfo.mpsport+'" />')}d+="</div>";if((features&16)==0){d+='<div id=dlgAddCira2 style=display:none>To add a new Intel® AMT device to device group "'+EscapeHtml(a.name)+'" with CIRA, load the following certificate as trusted root within Intel AMT, authenticate using a client certificate with the following common name and connect to the following server.<br /><br />';d+=addHtmlValue("Root Certificate",'<a href="MeshServerRootCert.cer" rel="noreferrer noopener" target="_blank">Root Certificate File</a>');d+=addHtmlValue("Organization",'<input style=width:230px readonly value="'+c+'" />');if(serverinfo!=null){d+=addHtmlValue("MPS Server",'<input style=width:230px readonly value="'+EscapeHtml(serverinfo.mpsname)+":"+serverinfo.mpsport+'" />')}d+="</div>"}setDialogMode(2,"Add Intel® AMT CIRA device",1,null,d)}function dlgAddCiraSelClick(){var a=Q("dlgAddCiraSel").value;QV("dlgAddCira0",a==0);QV("dlgAddCira1",a==1);QV("dlgAddCira2",a==2)}function checkEmail(c){var d=c.split("@");var b=((d.length==2)&&(d[0].length>0)&&(d[1].split(".").length>1)&&(d[1].length>2));if(b==true){var e=d[1].split(".");for(var a in e){if(e[a].length==0){b=false}}}return b}function inviteAgentToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c="Invite someone to install the mesh agent. An email with be sent with the link to the mesh agent installation for "+EscapeHtml(a.name)+".<br /><br />";c+=addHtmlValue("Name (optional)",'<input id=agentInviteName value="" style=width:230px maxlength=64 />');c+=addHtmlValue("Email",'<input id=agentInviteEmail style=width:230px placeholder="example@email.com" onkeyup=validateAgentInvite()></input>');c+=addHtmlValue("Operating System","<select id=agentInviteNameOs style=width:236px><option value=0>Any supported</option><option value=1>Windows only</option><option value=3>Apple OSX only</option><option value=2>Linux only</option></select>");c+=addHtmlValue("Installation Type","<select id=agentInviteType style=width:236px><option value=0>Background and interactive</option><option value=2>Background only</option><option value=1>Interactive only</option></select>");c+=addHtmlValue("Message<br />(optional)",'<textarea id=agentInviteMessage value="" style=width:230px;height:100px;resize:none maxlength=1024 /></textarea>');setDialogMode(2,"Invite",3,performAgentInvite,c,b);validateAgentInvite()}function validateAgentInvite(){QE("idx_dlgOkButton",checkEmail(Q("agentInviteEmail").value))}function performAgentInvite(a,b){meshserver.send({action:"inviteAgent",meshid:b,email:Q("agentInviteEmail").value,name:Q("agentInviteName").value,os:Q("agentInviteNameOs").value,flags:Q("agentInviteType").value,msg:Q("agentInviteMessage").value})}function addAgentToMesh(c){if(xxdialogMode){return}var b=meshes[c],f="",a=0;f+=addHtmlValue("Operating System","<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>Windows</option><option value=1>Linux</option><option value=2>Apple OSX</option><option value=3>Windows (UnInstall)</option><option value=4>Linux (UnInstall)</option></select>");f+="<div id=aginsTypeDiv>";f+=addHtmlValue("Installation Type","<select id=aginsType onchange=addAgentToMeshClick() style=width:236px><option value=0>Background & interactive</option><option value=2>Background only</option><option value=1>Interactive only</option></select>");f+="</div><hr>";f+='<div id=agins_windows>To add a new computer to device group "'+EscapeHtml(b.name)+'", download the mesh agent and install it the computer to manage. This agent has server and mesh information embedded within it.<br /><br />';f+=addHtmlValue("Mesh Agent",'<a id=aginsw32lnk href="meshagents?id=3&meshid='+c.split("/")[2]+'&installflags=0" rel="noreferrer noopener" target="_blank" title="32bit version of the MeshAgent">Windows (.exe)</a>');f+=addHtmlValue("Mesh Agent",'<a id=aginsw64lnk href="meshagents?id=4&meshid='+c.split("/")[2]+'&installflags=0" rel="noreferrer noopener" target="_blank" title="64bit version of the MeshAgent">Windows x64 (.exe)</a>');if(debugmode>0){f+=addHtmlValue("Settings File",'<a id=aginswmshlnk href="meshsettings?id='+c.split("/")[2]+'&installflags=0" rel="noreferrer noopener" target="_blank">'+EscapeHtml(b.name)+" settings (.msh)</a>")}f+="</div>";f+="<div id=agins_linux style=display:none>To add a computer to "+EscapeHtml(b.name)+" run the following command. Root credentials will be needed.<br />";f+="<textarea id=agins_linux_area rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>";f+="</div>";f+='<div id=agins_osx style=display:none>To add a new computer to device group "'+EscapeHtml(b.name)+'", download the mesh agent and install it the computer to manage. This agent installer has server and mesh information embedded within it.<br /><br />';f+=addHtmlValue("Mesh Agent",'<a href="meshosxagent?id=16&meshid='+c.split("/")[2]+'" rel="noreferrer noopener" target="_blank" title="64bit version of OSX Mesh Agent">OSX Agent (64bit)</a>');f+="</div>";f+='<div id=agins_windows_un style=display:none>To remove a mesh agent, download the file below, run it and click "uninstall".<br /><br />';f+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=3" rel="noreferrer noopener" target="_blank" title="32bit version of the MeshAgent">Windows (.exe)</a>');f+=addHtmlValue("Mesh Agent",'<a href="meshagents?id=3" rel="noreferrer noopener" target="_blank" title="64bit version of the MeshAgent">Windows x64 (.exe)</a>');f+="</div>";f+="<div id=agins_linux_un style=display:none>To remove a mesh agent, run the following command. Root credentials will be needed.<br />";f+="<textarea id=agins_linux_area_un rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>";f+="</div>";setDialogMode(2,"Add Mesh Agent",9,null,f);var e=serverinfo.name;if((e=="un-configured")||((features&2)!=0)){e=window.location.hostname}if(serverinfo.https==true){var d=(serverinfo.port==443)?"":(":"+serverinfo.port);Q("agins_linux_area").value="wget https://"+e+d+"/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://"+e+d+" '"+c.split("/")[2]+"'\r\n";Q("agins_linux_area_un").value="wget https://"+e+d+"/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"}else{var d=(serverinfo.port==80)?"":(":"+serverinfo.port);Q("agins_linux_area").value="wget http://"+e+d+"/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://"+e+d+" '"+c.split("/")[2]+"'\r\n";Q("agins_linux_area_un").value="wget http://"+e+d+"/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"}Q("aginsSelect").focus();addAgentToMeshClick()}function addAgentToMeshClick(){var a=Q("aginsSelect").value;QV("agins_windows",a==0);QV("agins_linux",a==1);QV("agins_osx",a==2);QV("agins_windows_un",a==3);QV("agins_linux_un",a==4);QV("aginsTypeDiv",a==0);Q("aginsw32lnk").href=(Q("aginsw32lnk").href.split("installflags=")[0])+"installflags="+Q("aginsType").value;Q("aginsw64lnk").href=(Q("aginsw64lnk").href.split("installflags=")[0])+"installflags="+Q("aginsType").value;if(debugmode>0){Q("aginswmshlnk").href=(Q("aginswmshlnk").href.split("installflags=")[0])+"installflags="+Q("aginsType").value}}function validateDeviceToMesh(){QE("idx_dlgOkButton",(Q("dp1devicename").value.length>0)&&(passwordcheck(Q("dp1password").value)))}function addDeviceToMeshEx(b,d){var a=Q("dp1username").value;if(a==""){a="admin"}var c=Q("dp1hostname").value;if(c==""){c=Q("dp1devicename").value}meshserver.send({action:"addamtdevice",meshid:d,devicename:Q("dp1devicename").value,hostname:c,amtusername:a,amtpassword:Q("dp1password").value,amttls:Q("dp1tls").value})}function deviceHeaderSet(){if(deviceHeaderId==0){deviceHeaderId=1;return}deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+((deviceHeaderTotal==1)?" node":" nodes");deviceHeaderId++;deviceHeaderCount={};deviceHeaderTotal=0}var powerStateStrings=["",'<span title="Device is powered on.">Powered</span>','<span title="Device is in sleep state (S1).">Sleeping</span>','<span title="Device is in sleep state (S2).">Sleeping</span>','<span title="Device is in deep sleep state (S3).">Deep Sleep</span>','<span title="Device is in hibernating state (S4).">Hibernating</span>','<span title="Device is in powered off state (S5).">Soft-Off</span>','<span title="Device is detected but power state could not be obtained.">Present</span>'];var powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"];var powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(a){var b=[];if(a.state>0&&a.state<powerStatetable.length){state.push(powerStatetable[a.state])}if(a.conn){if((a.conn&1)!=0){b.push('<span title="Mesh agent is connected and ready for use.">Agent</span>')}if((a.conn&2)!=0){b.push('<span title="Intel® AMT CIRA is connected and ready for use.">CIRA</span>')}if((a.conn&4)!=0){b.push('<span title="Intel® AMT is routable.">Intel® AMT</span>')}if((a.conn&8)!=0){b.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>')}}if((a.pwr!=null)&&(a.pwr!=0)){b.push(powerStateStrings[a.pwr])}return b.join(", ")}function PowerStateStr(a){if(a<powerStatetable.length){return powerStatetable[a]}return""}function PowerStateStr2(a){if((a!=0)&&(a<powerStatetable.length)){return powerStatetable[a]}return"Unknown"}function selectallButtonFunction(){var b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked===true){a++}}for(var c=0;c<b.length;c++){b[c].checked=(a==0)}p1updateInfo()}function p1updateInfo(){var b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked===true){a++}}if(a>0){QE("GroupActionButton",true);Q("SelectAllButton").value="Select None";QV("cxmgroupsplit",true);QV("cxmdesktop",true)}else{QE("GroupActionButton",false);Q("SelectAllButton").value="Select All";QV("cxmgroupsplit",false);QV("cxmdesktop",false)}}function groupActionFunction(){var a="Select an operation to perform on all selected devices. Actions will be performed only with proper rights.<br /><br />";a+=addHtmlValue("Operation","<select id=d2groupop style=float:right;width:250px><option value=100>Wake-up devices</option><option value=4>Sleep devices</option><option value=3>Reset devices</option><option value=2>Power off devices</option><option value=101>Delete devices</option></select>");setDialogMode(2,"Group Action",3,groupActionFunctionEx,a)}function getCheckedDevices(){var e=[],b=document.getElementsByClassName("DeviceCheckbox"),a=0;for(var c=0;c<b.length;c++){if(b[c].checked){if(b[c].value){var d=b[c].value.substring(6);if(e.indexOf(d)==-1){e.push(d)}}}}return e}function groupActionFunctionEx(){var a=Q("d2groupop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:getCheckedDevices()})}else{if(a==101){var b="Confirm delete selected devices(s)?<br /><br />";b+="<input id=d2check type=checkbox onchange=d2groupActionFunctionDelEx() />Confirm";setDialogMode(2,"Delete Nodes",3,groupActionFunctionDelEx,b);QE("idx_dlgOkButton",false)}else{meshserver.send({action:"poweraction",nodeids:getCheckedDevices(),actiontype:a})}}}function d2groupActionFunctionDelEx(){QE("idx_dlgOkButton",Q("d2check").checked)}function groupActionFunctionDelEx(){meshserver.send({action:"removedevices",nodeids:getCheckedDevices()})}function onSortSelectChange(a){sort=document.getElementById("sortselect").selectedIndex;if(!a){putstore("sort",sort)}}function meshSort(c,d){if(c.meshnamel>d.meshnamel){return 1}if(c.meshnamel<d.meshnamel){return -1}if(c.meshid==d.meshid){if(showRealNames==true){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}else{if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}}return 0}function powerSort(c,e){var d=c.pwr?c.pwr:0;var f=e.pwr?e.pwr:0;if(d>f){return -1}if(d<f){return 1}if(d==f){if(showRealNames==true){if(c.rnamel>e.rnamel){return 1}if(c.rnamel<e.rnamel){return -1}return 0}else{if(c.namel>e.namel){return 1}if(c.namel<e.namel){return -1}return 0}}return 0}function deviceSort(c,d){if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}function deviceHostSort(c,d){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}function onSearchFocus(a){searchFocus=a}function onMapSearchFocus(a){mapSearchFocus=a}function onUserSearchFocus(a){userSearchFocus=a}function onConsoleFocus(a){consoleFocus=a}function onSearchInputChanged(){var g=Q("SearchInput").value.toLowerCase().trim();putstore("search",g);if(g==""){for(var a in nodes){nodes[a].v=true}}else{try{var c=g.split(/\s+/).join("|"),e=new RegExp(c);for(var a in nodes){nodes[a].v=(e.test(nodes[a].name.toLowerCase()))||(nodes[a].rnamel!=null&&e.test(nodes[a].rnamel.toLowerCase()));if((nodes[a].v==false)&&nodes[a].tags){for(var f in nodes[a].tags){if(e.test(nodes[a].tags[f].toLowerCase())){nodes[a].v=true;break}else{nodes[a].v=false}}}}}catch(b){for(var a in nodes){nodes[a].v=true}}}}var contextelement=null;function handleContextMenu(d){hideContextMenu();var k=(window.pageXOffset!==null)?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft;var l=(window.pageYOffset!==null)?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;var c=document.elementFromPoint(d.pageX-k,d.pageY-l);if(c&&c!=null&&c.id=="MxMESH"){contextelement=c;var b=document.getElementById("meshContextMenu");b.style.left=d.pageX+"px";b.style.top=d.pageY+"px";b.style.display="block"}else{while(c&&c!=null&&c.id!="devs"){c=c.parentElement}if(!c||c==null){return true}contextelement=c;var b=document.getElementById("contextMenu");b.style.left=d.pageX+"px";b.style.top=d.pageY+"px";b.style.display="block"}var j=contextelement.children[1].attributes.onclick.value;var h=getNodeFromId(j.substring(12,j.length-2));var e=meshes[h.meshid];var f=e.links["user/"+domain+"/"+userinfo.name.toLowerCase()];var g=f.rights;var a=((g&16)!=0);QV("cxdesktop",((e.mtype==1)||(h.agent==null)||(h.agent.caps==null)||((h.agent.caps&1)!=0)||(h.intelamt&&(h.intelamt.state==2)))&&((g&8)||(g&256)));QV("cxterminal",((e.mtype==1)||(h.agent==null)||(h.agent.caps==null)||((h.agent.caps&2)!=0)||(h.intelamt&&(h.intelamt.state==2)))&&(g&8));QV("cxfiles",((e.mtype==2)&&((h.agent==null)||(h.agent.caps==null)||((h.agent.caps&4)!=0)))&&(g&8));QV("cxevents",(h.intelamt!=null)&&((h.intelamt.state==2)||(h.conn&2))&&(g&8));QV("cxconsole",(a&&(e.mtype==2)&&((h.agent==null)||(h.agent.caps==null)||((h.agent.caps&8)!=0)))&&(g&8));return haltEvent(d)}function cmaction(a){var b=contextelement.children[1].attributes.onclick.value;b=b.substring(12,b.length-2);if(a==1){gotoDevice(b,10)}if(a==2){gotoDevice(b,12)}if(a==3){gotoDevice(b,11)}if(a==4){gotoDevice(b,13)}if(a==5){gotoDevice(b,16)}if(a==6){gotoDevice(b,15)}if(a==7){Q("viewselect").value=3;Q("viewselect").onchange();Q("autoConnectDesktopCheckbox").checked=true;Q("autoConnectDesktopCheckbox").onclick()}}function cmmeshaction(a){var d=contextelement.attributes.onclick.value.substring(32,(32+69));var b=document.getElementsByClassName("DeviceCheckbox");if(a==1){for(var c=0;c<b.length;c++){if((b[c].attributes)&&(b[c].attributes["class"]["value"].substring(0,69)==d)){b[c].checked=true}}}if(a==2){for(var c=0;c<b.length;c++){if((b[c].attributes)&&(b[c].attributes["class"]["value"].substring(0,69)==d)){b[c].checked=false}}}p1updateInfo()}function hideContextMenu(){QV("contextMenu",false);QV("meshContextMenu",false);contextelement=null}var xxmap={map:null,contextmenu:null,activeInteractions:[],showindex:0,markersSource:null,markersLayer:null,mapLayer:null,mapView:null,};function updateMapMarkers(h){if((xxmap!=null)&&(xxmap.map==null)){try{loadmap()}catch(b){console.error("loadmap() exception",b)}}if(xxmap==null){return}var a=null;for(var d in nodes){try{var f=map_parseNodeLoc(nodes[d]),c=xxmap.markersSource.getFeatureById(nodes[d]._id);if((f!=null)&&((nodes[d].meshid==h)||(h==null))){var e=f[0],g=f[1],j=f[2];if(a==null){a=[e,g,e,g,0]}else{if(e<a[0]){a[0]=e}if(g<a[1]){a[1]=g}if(e>a[2]){a[2]=e}if(g>a[3]){a[3]=g}}if(c==null){addFeature(nodes[d]);a[4]=1}else{updateFeature(nodes[d],c);c.setStyle(markerStyle(nodes[d],f[2]))}}else{if(c){xxmap.markersSource.removeFeature(c)}}}catch(b){console.error("updateMapMarkers() exception",b,JSON.stringify(nodes[d]))}}return a}var map_cm_popup=new ol.Overlay({element:Q("xmap-info-window"),positioning:"bottom-center",stopEvent:false});var map_cm_editMarker={text:"Modify node location",callback:function(a){modifyMarkerloc(a.data)}};var map_cm_clearMarker={text:"Remove node location",callback:function(a){meshserver.send({action:"changedevice",nodeid:a.data.a,userloc:[]})}};var map_cm_saveMarker={text:"Save node location",callback:function(a){saveMarkerloc(a.data)}};var map_cm_nodemenu_items=[{text:"General information",callback:function(a){if(a.data!=null){gotoDevice(a.data,10)}}},{text:"Desktop",callback:function(a){if(a.data!=null){gotoDevice(a.data,11)}}},{text:"Terminal",callback:function(a){if(a.data!=null){gotoDevice(a.data,12)}}},{text:"Intel® AMT",callback:function(a){if(a.data!=null){gotoDevice(a.data,14)}}},"-",{text:"Zoom-in to extent",callback:function(b){var a=b.data.getGeometry().getCoordinates();zoomToLocation(a,19)}},{text:"Zoom-out to extent",callback:function(b){var a=b.data.getGeometry().getCoordinates();zoomToLocation(a,2)}}];var contextmenu_items=[{text:"Refresh",callback:function(){refreshMap(true,true)}},{text:"Zoom to fit extent",callback:function(){zoomToFitExtent()}},{text:"Center map here",callback:function(a){xxmap.mapView.animate({center:a.coordinate})}},{text:"Place node here",callback:function(a){placeNode(a.coordinate)}}];function stringToIntHash(c){var a=0,b;for(b=0;b<c.length;b++){a=((a<<5)-a)+c.charCodeAt(b);a|=0}return a}function map_parseNodeLoc(b){var a=null,c=0;if(b.iploc){a=b.iploc;c=1}if(b.wifiloc){a=b.wifiloc;c=2}if(b.gpsloc){a=b.gpsloc;c=3}if(b.userloc){a=b.userloc;c=4}if((a==null)||(typeof a!="string")){return null}a=a.split(",");if(c==1){return[parseFloat(a[0])+(stringToIntHash(b._id.substring(0,20))/100000000000),parseFloat(a[1])+(stringToIntHash(b._id.substring(20))/100000000000),c]}else{return[parseFloat(a[0]),parseFloat(a[1]),c]}}function loadmap(){if(xxmap==null){return}try{xxmap.markersSource=new ol.source.Vector();xxmap.markersLayer=new ol.layer.Vector({source:xxmap.markersSource});xxmap.mapLayer=new ol.layer.Tile({source:new ol.source.OSM()});xxmap.mapView=new ol.View({center:ol.proj.transform([0,0],"EPSG:4326","EPSG:3857"),zoom:2,minZoom:2,maxZoom:20,extent:ol.proj.transformExtent([-100000,-69.55,100000,69.55],"EPSG:4326","EPSG:3857")});xxmap.map=new ol.Map({target:"xdevicesmap",layers:[xxmap.mapLayer,xxmap.markersLayer],view:xxmap.mapView});xxmap.map.addOverlay(map_cm_popup);xxmap.map.on("click",function(c){var d=xxmap.map.forEachFeatureAtPixel(c.pixel,function(g,h){return g});if(d){var f=d.getId();if(f!=null){gotoDevice(f,10)}else{var e=getCorrespondingFeature(d);gotoDevice(e.getId(),10)}}});xxmap.map.on("pointermove",function(d){var f=xxmap.map.forEachFeatureAtPixel(d.pixel,function(h,j){return h});if(f){xxmap.map.getTargetElement().style.cursor="pointer";var c=f.getGeometry().getCoordinates();map_cm_popup.setPosition(c);var e=f.getId();if(e){QH("xmap-info-window",f.get("name"))}else{var g=getCorrespondingFeature(f);QH("xmap-info-window",g.get("name"))}}else{xxmap.map.getTargetElement().style.cursor="";QH("xmap-info-window","")}});var a=new ContextMenu({width:160,defaultItems:false,items:contextmenu_items});a.on("open",function(c){var e=xxmap.map.forEachFeatureAtPixel(c.pixel,function(g,h){return g});xxmap.contextmenu.clear();if(e){var d=e.getId();if(d){addContextMenuItems(e)}else{var f=getCorrespondingFeature(e);if(f){addContextMenuItems(f)}else{xxmap.contextmenu.extend(contextmenu_items)}}}else{xxmap.contextmenu.extend(contextmenu_items)}});if(xxmap.contextmenu==null){xxmap.contextmenu=a}xxmap.map.addControl(xxmap.contextmenu)}catch(b){console.log(b);QV("viewselectmapoption",false);QV("devViewButton4",false);xxmap=null}}function addFeature(f,c,e){var a=getModifiedFeature(f._id);if(a){xxmap.markersSource.addFeature(a)}else{if(!c&&!e){var d=map_parseNodeLoc(f);c=d[0];e=d[1]}if(e>180){e=180-e;meshserver.send({action:"changedevice",nodeid:f._id,userloc:[c,e]})}if((c<90)&&(c>-90)&&(e<180)&&(e>-180)){var b=new ol.Feature({geometry:new ol.geom.Point(ol.proj.transform([e,c],"EPSG:4326","EPSG:3857")),name:f.name,status:f.conn,lat:c,lon:e});b.setId(f._id);b.setStyle(markerStyle(f));xxmap.markersSource.addFeature(b)}}}function removeFeature(b){var a=xxmap.markersSource.getFeatureById(b._id);if(a){xxmap.markersSource.removeFeature(a)}}function updateFeature(f,a){if(f.conn!=a.get("status")){a.set("status",f.conn);a.setStyle(markerStyle(f))}var c=map_parseNodeLoc(f);if(c!=null){var b=c[0],d=c[1];if((b!=a.get("lat"))||(d!=a.get("lon"))){a.set("lat",b);a.set("lon",d);var e=ol.proj.transform([parseFloat(d),parseFloat(b)],"EPSG:4326","EPSG:3857");a.getGeometry().setCoordinates(e)}}if(f.name!=a.get("name")){a.set("name",f.name)}}function modifyMarkerloc(c){var b=c.getId();if(b){c.setStyle(markerStyle(getNodeFromId(c.a),4));if(!getActiveInteractions(c)){var a=new ol.interaction.Modify({features:new ol.Collection([c]),pixelTolerance:10});xxmap.activeInteractions.push({featureid:b,feature:c,interaction:a});xxmap.map.addInteraction(a)}}}function saveMarkerloc(d){var c=d.getId();if(c){var a=getActiveInteractions(d);if(a){xxmap.map.removeInteraction(a);removeInteraction(c);var b=d.getGeometry().getCoordinates();var e=ol.proj.transform(b,"EPSG:3857","EPSG:4326");if(e[0]>180){e[0]=180-e[0]}var f=[e[1],e[0]];meshserver.send({action:"changedevice",nodeid:c,userloc:f})}}}function markerStyle(b,d){if(d==null){d=0;if(b.iploc){d=1}if(b.wifiloc){d=2}if(b.gpsloc){d=3}if(b.userloc){d=4}}var e=["","-ip","-wifi","-gps","-user"];var a=connStateColor(b);var c=new ol.style.Style({image:new ol.style.Icon({color:a,anchor:[0.5,1],src:"images/mapmarker"+e[d]+".png"})});return[c]}function connStateColor(a){if(a.conn==1||a.conn==3||a.conn==5){return"#00ffdd"}return"#C70039"}function addContextMenuItems(a){if(getActiveInteractions(a)){map_cm_saveMarker.data=a;xxmap.contextmenu.push(map_cm_saveMarker)}else{map_cm_editMarker.data=a;xxmap.contextmenu.push(map_cm_editMarker);var b=getNodeFromId(a.a);if(b.userloc){map_cm_clearMarker.data=a;xxmap.contextmenu.push(map_cm_clearMarker)}}map_cm_nodemenu_items.forEach(function(c){if(c.text=="Zoom-in to extent"||c.text=="Zoom-out to extent"){c.data=a}else{if(c!="-"){c.data=a.getId()}}});xxmap.contextmenu.extend(map_cm_nodemenu_items)}function getActiveInteractions(b){var a=b.getId();for(var c=0;c<xxmap.activeInteractions.length;c++){if(xxmap.activeInteractions[c].featureid==a){return xxmap.activeInteractions[c].interaction}}return false}function getModifiedFeature(a){if(a){for(var b=0;b<xxmap.activeInteractions.length;b++){if(xxmap.activeInteractions[b].featureid==a){return xxmap.activeInteractions[b].feature}}}return null}function removeInteraction(a){var c=-1;for(var b=0;b<xxmap.activeInteractions.length;b++){if(xxmap.activeInteractions[b].featureid===a){c=b;break}}if(c>=0){xxmap.activeInteractions.splice(c,1)}}function getCorrespondingFeature(e){var d=e.getGeometry().getCoordinates();for(var b=0;b<xxmap.activeInteractions.length;b++){var c=xxmap.activeInteractions[b].feature;var a=c.getGeometry().getCoordinates();if(a[0].toFixed(5)==d[0].toFixed(5)&&a[1].toFixed(5)==d[1].toFixed(5)){return c}}return null}function refreshMap(h,g){if(h){xxmap.map.setTarget(null);xxmap.map=null;xxmap.markersSource=null;xxmap.mapView=null;xxmap.mapLayer=null;xxmap.activeInteractions=[]}var a=updateMapMarkers();if((a!=null)&&(g||(a[4]==1))){var b=(a[0]+a[2])/2;var c=(a[1]+a[3])/2;var d=Math.max(Math.abs(a[0]-a[2]),Math.abs(a[1]-a[3]));var k=xxmap.map.getView();k.setCenter(ol.proj.transform([c,b],"EPSG:4326","EPSG:3857"));var e=360,f=-2;while(e>d){f++;e=e/2}k.setZoom(f)}}function placeNode(a){if(xxdialogMode){return}var c='<div style=margin-bottom:6px><label for=selectnode-search>Search</label>  <input type=text placeholder="Device name" id="selectnode-search" onchange=onPlaceNodeInputChange() onkeyup=onPlaceNodeInputChange() autocomplete=off style=width:120px></div><div id=placenode style="height:254px;overflow-y:auto;width:100%;margin:12px 1px 4px 1px;"><div id=noNodesMapPlace style=text-align:center;width:100%;display:none>No devices found.</div>';for(var b in nodes){c+="<div class=noselect id="+nodes[b]._id+"-rowid onclick=selectNodeToPlace(event,'"+nodes[b]._id+"') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id="+nodes[b]._id+"-checkid type=checkbox style=width:16px;display:inline />";c+="<div class=j"+nodes[b].icon+" style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>"+nodes[b].name+"</div></div>"}setDialogMode(2,"Select a node to place",3,placeNodeEx,c+"</div>",a);onPlaceNodeInputChange()}function placeNodeEx(b,c){var d=document.getElementsByName("PlaceMapDeviceCheckbox");for(var f in d){if(d[f].checked){var g=getNodeFromId(d[f].id.substring(0,d[f].id.length-8));if(g){var e=xxmap.markersSource.getFeatureById(f);var h=ol.proj.transform(c,"EPSG:3857","EPSG:4326");var j=[h[1],h[0]];if(e){e.getGeometry().setCoordinates(c);var a=getActiveInteractions(e);if(a){saveMarkerloc(e)}else{meshserver.send({action:"changedevice",nodeid:g._id,userloc:j})}}else{meshserver.send({action:"changedevice",nodeid:g._id,userloc:j})}}}}}function onPlaceNodeInputChange(){updatePlaceNodeTable(Q("selectnode-search").value.trim().toLowerCase())}function updatePlaceNodeTable(d){var b=document.getElementsByName("PlaceMapDeviceCheckbox"),a=0;for(var c in nodes){var e=((nodes[c].namel.indexOf(d)>=0||d=="")||(nodes[c].rnamel!=null&&nodes[c].rnamel.indexOf(d)>=0));if(e){a++}QV(nodes[c]._id+"-rowid",e)}QV("noNodesMapPlace",a==0)}function selectNodeToPlace(b,f){if(b.target.name!="PlaceMapDeviceCheckbox"){var g=Q(f+"-checkid");g.checked=!g.checked}var c=document.getElementsByName("PlaceMapDeviceCheckbox"),a=0;for(var d in c){if(c[d].checked){a++}}QE("idx_dlgOkButton",a>0)}function addMeshOptions(a,b){}function meshOptionRmvMod(a,b){}function meshExists(){for(var a in meshes){if(meshes[a]){return true}}return false}function setMeshView(a){var c=Q("select-mesh");var b=c.selectedIndex;if(c[b].value==a){c[0].selected=true;onSelectMeshChange()}}function clearMeshOptions(){}function getSearchLocation(){try{var b=Q("mapSearchLocation").value.trim();if(b.length>0){var c=new XMLHttpRequest();c.onreadystatechange=function(){if(c.readyState==4&&c.status==200){formatSearchData(c.responseText)}};c.open("GET","https://nominatim.openstreetmap.org/search?q="+b+"&format=json",true);c.send()}}catch(a){}}function formatSearchData(c){try{QH("xmapSearchResults","");var d=JSON.parse(c),b=0,j='<div style="overflow-y:auto;width:100%;max-height:240px">';for(var h=0;h<d.length;h++){if(d[h].display_name&&d[h].boundingbox[0]&&d[h].boundingbox[1]&&d[h].boundingbox[2]&&d[h].boundingbox[3]){b++;var a=(h%2==0)?"F5F5F5":"EBEBEB";j+="<div style=cursor:pointer;padding:5px;background-color:#"+a+" onclick=mapGotoSelectedLocation(this)><div>"+d[h].display_name+"</div><div style=display:none>"+d[h].boundingbox[0]+"!#!"+d[h].boundingbox[1]+"!#!"+d[h].boundingbox[2]+"!#!"+d[h].boundingbox[3]+"</div></div>"}}j+="</div>";if(b==1){var g=[parseFloat(d[0].boundingbox[2]),parseFloat(d[0].boundingbox[0]),parseFloat(d[0].boundingbox[3]),parseFloat(d[0].boundingbox[1])];zoomToExtent(g)}else{if(b==0){j="<div style=width:200px>No location found.<div>"}QV("xmapSearchResultsDlg",true)}QH("xmapSearchResults",j)}catch(f){}}function mapGotoSelectedLocation(c){var d=c.children;var a=d[1].innerHTML.split("!#!");var b=[parseFloat(a[2]),parseFloat(a[0]),parseFloat(a[3]),parseFloat(a[1])];zoomToExtent(b);mapCloseSearchWindow()}function mapCloseSearchWindow(){QH("xmapSearchResults","");QV("xmapSearchResultsDlg",false)}function zoomToLocation(a,c){var b=xxmap.map.getView();b.setCenter(a);b.setZoom(c)}function zoomToFitExtent(){var b=xxmap.markersSource.getFeatures();if(b.length>0){var a=xxmap.markersSource.getExtent();xxmap.map.getView().fit(a,xxmap.map.getSize())}}function zoomToExtent(b){var a=ol.proj.transformExtent(b,ol.proj.get("EPSG:4326"),ol.proj.get("EPSG:3857"));xxmap.map.getView().fit(a,xxmap.map.getSize())}function refreshDevice(a){if(!currentNode||currentNode._id!=a){return}gotoDevice(a,xxcurrentView,true)}function getNodeRights(c){var b=getNodeFromId(c),a=meshes[b.meshid];return a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights}var currentNode;var powerTimelineNode=null;var powerTimelineReq=null;var powerTimelineUpdate=null;var powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(n,p,s){var m=getNodeFromId(n);var j=meshes[m.meshid];var k=j.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(!currentNode||currentNode._id!=m._id||s==true){currentNode=m;var l=EscapeHtml(m.name);if(l.length==0){l="<i>None</i>"}if((k&4)!=0){l='<span title="Click here to edit the server-side device name" onclick=showEditNodeValueDialog(0) style=cursor:pointer>'+l+' <img class=hoverButton src="images/link5.png" /></span>'}QH("p10deviceName",l);QH("p11deviceName",l);QH("p12deviceName",l);QH("p13deviceName",l);QH("p14deviceName",l);QH("p15deviceName",l);QH("p16deviceName",l);var v="<table style=width:100%>";v+=addDeviceAttribute('<span title="The name of the device group this computer belong to.">Group</span>','<a title="The name of the device group this computer belong to" onclick=gotoMesh("'+m.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[m.meshid].name)+"</a>");if((m.rname!=null)&&(m.name!=m.rname)){v+=addDeviceAttribute('<span title="The name of this computer as set in the operating system">Name</span>','<span title="The name of this computer as set in the operating system">'+EscapeHtml(m.rname)+"</span>")}if((features&1)==0){if((k&4)!=0){if(m.host){v+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(m.host)+"</span>")}else{v+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>")}}else{v+=addDeviceAttribute("Hostname",EscapeHtml(m.host))}}var f=m.desc?EscapeHtml(m.desc):"<i>None</i>";if((k&4)!=0){v+=addDeviceAttribute("Description","<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+f+' <img class=hoverButton src="images/link5.png" /></span>')}else{v+=addDeviceAttribute("Description",f)}var a=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","OSX 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","OSX 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l"];if((m.agent!=null)&&(m.agent.id!=null)&&(m.agent.ver!=null)){var t="";if(m.agent.id<=a.length){t=a[m.agent.id]}else{t=a[0]}if(m.agent.ver!=0){t+=" v"+m.agent.ver}v+=addDeviceAttribute("Mesh Agent",t)}if(m.intelamt!=null){var t="";var r={0:"Not Activated (Pre)",1:"Not Activated (In)",2:"Activated"};if(m.intelamt.ver!=null&&m.intelamt.state==null){t+="<i>Unknown State</i>, v"+m.intelamt.ver}else{if((m.intelamt.ver==null)&&(m.intelamt.state==2)){t+="<i>Activated</i>"}else{if((m.intelamt.ver==null)||(m.intelamt.state==null)){t+="<i>Unknown Version & State</i>"}else{t+=r[m.intelamt.state];if(m.intelamt.flags){if(m.intelamt.flags&2){t+=' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'}else{if(m.intelamt.flags&4){t+=' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'}}}t+=(", v"+m.intelamt.ver)}}}if(m.intelamt.tls==1){t+=', <span title="Intel AMT is setup with TLS network security">TLS</span>'}if(m.intelamt.state==2){if(m.intelamt.user==null||m.intelamt.user==""){if((k&4)!=0){t+=', <i style=color:#FF0000;cursor:pointer title="Edit Intel® AMT credentials" onclick=editDeviceAmtSettings("'+m._id+'")>No Credentials</i>'}else{t+=", <i style=color:#FF0000>No Credentials</i>"}}t+=" ";if((k&4)!=0){t+='<img src=images/link4.png height=10 width=10 title="Edit Intel® AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("'+m._id+'")>'}}v+=addDeviceAttribute("Intel® AMT",t)}if((m.agent!=null)&&(m.agent.tag!=null)&&(m.agent.tag!="mailto:")){var u=EscapeHtml(m.agent.tag);if(u.startsWith("mailto:")){u='<a href="'+u+'">'+u.substring(7)+"</a>"}v+=addDeviceAttribute("Agent Tag",u)}if(m.osdesc){v+=addDeviceAttribute("Operating System",m.osdesc)}if(m.users&&m.conn&&(m.users.length>0)&&(m.conn&1)){v+=addDeviceAttribute("Active User"+((m.users.length>1)?"s":""),m.users.join(", "))}var c=m.conn;if(c&&c>1){var e=[];if((m.conn&1)!=0){e.push('<span title="Mesh agent is connected and ready for use.">Mesh Agent</span>')}if((m.conn&2)!=0){e.push('<span title="Intel® AMT CIRA is connected and ready for use.">Intel® AMT CIRA</span>')}if((m.conn&4)!=0){e.push('<span title="Intel® AMT is routable and ready for use.">Intel® AMT</span>')}if((m.conn&8)!=0){e.push('<span title="Mesh agent is reachable using another agent as relay.">Mesh Relay</span>')}v+=addDeviceAttribute("Connectivity",e.join(", "))}var g="<i>None</i>";if(m.tags!=null){g="";for(var h in m.tags){g+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+m.tags[h]+"</span>"}}v+=addDeviceAttribute("Tags","<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+g+' <img class=hoverButton src="images/link5.png" /></span>');v+="</table><br />";if((k&76)!=0){v+='<input type=button value=Actions title="Perform power actions on the device" onclick=deviceActionFunction() />'}v+='<input type=button value=Notes title="View notes about this device" onclick=showNotes('+((k&128)==0)+',"'+encodeURIComponent(m._id)+'") />';QH("p10html",v);masterUpdate(256);v="<div style=float:right;font-size:x-small>";if((k&4)!=0){v+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+m._id+'") title="Remove this device">Delete Device</a>'}v+="</div><div style=font-size:x-small>";if(j.mtype==2){v+='<a style=cursor:pointer onclick=p10showNodeNetInfoDialog("'+m._id+'") title="Show device network interface information">Interfaces</a> '}if(xxmap!=null){v+='<a style=cursor:pointer onclick=p10showNodeLocationDialog("'+m._id+'") title="Show device locations information">Location</a> '}if(((k&8)!=0)&&(j.mtype==2)){v+='<a style=cursor:pointer onclick=p10showMeshCmdDialog(1,"'+m._id+'") title="Traffic router used to connect to a device thru this server.">Router</a> '}if(((c&1)!=0)&&(clickOnce==true)&&(j.mtype==2)&&((k&8)!=0)){if((m.agent.id>0)&&(m.agent.id<5)){v+='<a style=cursor:pointer onclick=p10clickOnce("'+m._id+'","RDP2",3389) title="Requires Microsoft ClickOnce support in your browser.">RDP</a> '}if(m.agent.id>4){v+='<a style=cursor:pointer onclick=p10clickOnce("'+m._id+'","PSSH",22) title="Requires Microsoft ClickOnce support in your browser.">Putty</a> ';v+='<a style=cursor:pointer onclick=p10clickOnce("'+m._id+'","WSCP",22) title="Requires Microsoft ClickOnce support in your browser.">WinSCP</a> '}}v+="</div><br>";QH("p10html3",v);var q=PowerStateStr(m.state);if((c&1)!=0){if(q.length>0){q+="<br/>"}q+='<span style=font-size:12px title="Agent connected">Agent connected</span>'}if((c&2)!=0){if(q.length>0){q+="<br/>"}q+='<span style=font-size:12px title="Intel® AMT connected">Intel® AMT connected</span>'}if((c&4)!=0){if(q.length>0){q+="<br/>"}q+='<span style=font-size:12px title="Intel® AMT detected">Intel® AMT detected</span>'}if((q=="")&&m.lastconnect){q="<span style=font-size:12px>Last seen:<br />"+new Date(m.lastconnect).toLocaleDateString()+", "+new Date(m.lastconnect).toLocaleTimeString()+"</span>"}QH("MainComputerState",q);Q("MainComputerImage").setAttribute("src","images/icons200-"+m.icon+"-1.jpg");Q("MainComputerImage").className=((!m.conn)||(m.conn==0)?"gray":"");setupTerminal();setupFiles();var d=((k&16)!=0);if(d){setupConsole()}else{if(p==15){p=10}}QV("MainDevDesktop",((j.mtype==1)||(m.agent==null)||(m.agent.caps==null)||((m.agent.caps&1)!=0)||(m.intelamt&&(m.intelamt.state==2)))&&((k&8)||(k&256)));QV("MainDevTerminal",((j.mtype==1)||(m.agent==null)||(m.agent.caps==null)||((m.agent.caps&2)!=0)||(m.intelamt&&(m.intelamt.state==2)))&&(k&8));QV("MainDevFiles",((j.mtype==2)&&((m.agent==null)||(m.agent.caps==null)||((m.agent.caps&4)!=0)))&&(k&8));QV("MainDevAmt",(m.intelamt!=null)&&((m.intelamt.state==2)||(m.conn&2))&&(k&8));QV("MainDevConsole",(d&&(j.mtype==2)&&((m.agent==null)||(m.agent.caps==null)||((m.agent.caps&8)!=0)))&&(k&8));QV("p15uploadCore",(m.agent!=null)&&(m.agent.caps!=null)&&((m.agent.caps&16)!=0)&&(userinfo.siteadmin==4294967295));QH("p15coreName",((m.agent!=null)&&(m.agent.core!=null))?m.agent.core:"");var b=Q("p14iframe").contentWindow.getCurrentMeshNode();if((b!=null)&&(b._id!=currentNode._id)){Q("p14iframe").contentWindow.disconnect()}var o=((m.conn&6)!=0)?true:false;Q("p14iframe").contentWindow.setConnectionState(o);Q("p14iframe").contentWindow.setFrameHeight("650px");Q("p14iframe").contentWindow.setAuthCallback(updateAmtCredentials);QV("deskActionsBtn",(k&72)!=0);QV("termActionsBtn",(k&72)!=0);QV("filesActionsBtn",(k&72)!=0);if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id});meshserver.send({action:"lastconnect",nodeid:currentNode._id})}QV("DeskTools",false);showDeskToolsProcesses();refreshDeviceEvents()}setupDesktop();if(!p){p=10}go(p)}function showNotes(b,a){if(xxdialogMode){return}setDialogMode(2,"Notes",2,showNotesEx,"<textarea id=d2devNotes ro="+b+" noteid="+a+" readonly style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea><span style=font-size:10px>Notes can be viewed and changed by other administrators.<span>",a);meshserver.send({action:"getNotes",id:decodeURIComponent(a)})}function showNotesEx(a,b){meshserver.send({action:"setNotes",id:decodeURIComponent(b),notes:encodeURIComponent(Q("d2devNotes").value)})}function deviceChat(){if(xxdialogMode){return}window.open("/messenger?id=meshmessenger/"+encodeURIComponent(currentNode._id)+"/"+encodeURIComponent(userinfo._id)+"&title="+currentNode.name,"meshmessenger:"+currentNode._id);meshserver.send({action:"meshmessenger",nodeid:decodeURIComponent(currentNode._id)})}function deviceUrlFunction(){if(xxdialogMode){return}setDialogMode(2,"Open Page on Device",3,deviceUrlFunctionEx,'<input id=d2devurl placeholder="http://server.com" style=width:100%;overflow-y:scroll></input>')}function deviceUrlFunctionEx(){meshserver.send({action:"msg",type:"openUrl",nodeid:currentNode._id,url:Q("d2devurl").value})}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Notification",3,deviceToastFunctionEx,"<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var b="Select an operation to perform on this device.<br /><br />";var c="<select id=d2deviceop style=float:right;width:250px>";if((a&64)!=0){c+="<option value=100>Wake-up</option>"}if((a&8)!=0){c+="<option value=4>Sleep</option><option value=3>Reset</option><option value=2>Power off</option>"}c+="</select>";b+=addHtmlValue("Operation",c);setDialogMode(2,"Device Action",3,deviceActionFunctionEx,b)}function deviceActionFunctionEx(){var a=Q("d2deviceop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:[currentNode._id]})}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:a})}}function updateAmtCredentials(a){var b=getNodeFromId(currentNode._id);if((a==true)||(b.intelamt.user==null)||(b.intelamt.user=="")){editDeviceAmtSettings(currentNode._id,updateAmtCredentialsEx)}else{Q("p14iframe").contentWindow.connectButtonfunctionEx()}}function updateAmtCredentialsEx(a,b){Q("p14iframe").contentWindow.connectButtonfunctionEx()}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate<Date.now())){powerTimelineUpdate=null;meshserver.send({action:"powertimeline",nodeid:currentNode._id});meshserver.send({action:"lastconnect",nodeid:currentNode._id})}}function drawDeviceTimeline(){if((currentNode==null)||(xxcurrentView<10)||(xxcurrentView>19)){return}var r=null,n=Date.now();if(currentNode._id==powerTimelineNode){r=powerTimeline}var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var t=e.getTime();var s=[];if(r!=null&&r.length>1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l<r.length;l+=2){var o=r[l],h=n;if(r.length>(l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var z="",b=1,g=new Date();var v=Q("masthead").offsetWidth-(160+9+9+14);g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var w=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var y=Math.round(((q-w)*v)/86400000);if(y>0){var u=powerStateStrings2[a[2]]+" from "+new Date(w).toLocaleTimeString()+" to "+new Date(q).toLocaleTimeString()+".";f+='<div title="'+u+'" style=display:table-cell;width:'+y+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}z+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div> "+g.toLocaleDateString()+"<div></div></div></td><td><div>"+f+"</div></td></tr>";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p10html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>Day</th><th scope=col style=text-align:center>7 Day Power State</th></tr>'+z+"</tbody></table>")}function powerColor(a){if(a<powerColorTable.length){return powerColorTable[a]}return"yellow"}function isTimeBlockInside(d,c,b,a){if((b<d)&&(a>c)){return true}if((b>d)&&(b<c)){return true}if((a>d)&&(a<c)){return true}return false}function addDeviceAttribute(a,b){return"<tr><td class=style7 style=width:180px>"+a+"</td><td class=style9 style=max-width:400px;overflow:hidden>"+b+"</td></tr>"}function editDeviceAmtSettings(e,b){if(xxdialogMode){return}var f="",d=getNodeFromId(e),a=3,c=getNodeRights(e);if((c&4)==0){return}f+=addHtmlValue("Username",'<input id=dp10username style=width:230px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');f+=addHtmlValue("Password","<input id=dp10password type=password style=width:230px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />");f+=addHtmlValue("Security","<select id=dp10tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");if((d.intelamt.user!=null)&&(d.intelamt.user!="")){a=7}setDialogMode(2,"Edit Intel® AMT credentials",a,editDeviceAmtSettingsEx,f,{node:d,func:b});if((d.intelamt.user!=null)&&(d.intelamt.user!="")){Q("dp10username").value=d.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=d.intelamt.tls;validateDeviceAmtSettings()}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(c,d){if(c==2){meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:"",pass:""}})}else{var b=Q("dp10username").value;if(b==""){b="admin"}var a=Q("dp10password").value;if(a==""){b=""}meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:b,pass:a,tls:Q("dp10tls").value}});d.node.intelamt.user=b;d.node.intelamt.tls=Q("dp10tls").value;if(d.func){setTimeout(d.func,300)}}}function p10showDeleteNodeDialog(a){if(xxdialogMode){return}var b='Are you sure you want to delete node "'+EscapeHtml(currentNode.name)+'"?<br /><br />';b+="<input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm";setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,b,a);p10validateDeleteNodeDialog()}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(a,b){meshserver.send({action:"removedevices",nodeids:[b]})}function p10clickOnce(a,c,b){meshserver.send({action:"getcookie",nodeid:a,tcpport:b,tag:"clickonce",protocol:c})}var d2map=null;function p10showNodeLocationDialog(){if((xxdialogMode!=null)&&(xxdialogTag=="@xxmap")){setDialogMode(0)}else{if(xxdialogMode){return}}var l=[],m=["iploc","wifiloc","gpsloc","userloc"],a=null;for(var j in m){if(currentNode[m[j]]!=null){var h=currentNode[m[j]].split(","),g=parseFloat(h[0]),k=parseFloat(h[1]);if((g<90)&&(g>-90)&&(k<180)&&(k>-180)){var e=new ol.Feature({geometry:new ol.geom.Point(ol.proj.fromLonLat([k,g]))});e.setStyle(markerStyle(currentNode,parseInt(j)+1));l.push(e);if(a==null){a=[g,k,g,k,0]}else{if(g<a[0]){a[0]=g}if(k<a[1]){a[1]=k}if(g>a[2]){a[2]=g}if(k>a[3]){a[3]=k}}}}}var o=new ol.source.Vector({features:l});var n=new ol.layer.Vector({source:o});var p="<div id=d2map style=width:100%;height:300px></div>";setDialogMode(2,"Device Location",1,null,p,"@xxmap");var c=0,b=0,q=8;if(a!=null){var b=(a[0]+a[2])/2;var c=(a[1]+a[3])/2;var d=Math.max(Math.abs(a[0]-a[2]),Math.abs(a[1]-a[3]));var f=360,q=-2;while(f>d){q++;f=f/2}}if(l.length==1){q=8}d2map=new ol.Map({target:"d2map",interactions:ol.interaction.defaults({dragPan:false,mouseWheelZoom:false}),layers:[new ol.layer.Tile({source:new ol.source.OSM()}),n],view:new ol.View({center:ol.proj.fromLonLat([c,b]),zoom:q})})}function p10showNodeNetInfoDialog(){if(xxdialogMode){return}setDialogMode(2,"Network Interfaces",1,null,"<div id=d2netinfo>Loading...</div>","if"+currentNode._id);meshserver.send({action:"getnetworkinfo",nodeid:currentNode._id})}function p10showMeshCmdDialog(a,b){if(xxdialogMode){return}var d="<select id=aginsSelect onclick=meshCmdOsClick() style=width:236px>";d+="<option value=3>Windows (32bit)</option>";d+="<option value=4>Windows (64bit)</option>";d+="<option value=5>Linux x86 (32bit)</option>";d+="<option value=6>Linux x86 (64bit)</option>";d+="<option value=25>Linux ARM, Raspberry Pi (32bit)</option>";d+="</select>";var c="";if(a==0){c+="<div>MeshCmd is a command line tool that performs lots of different operations. The action file can optionally be downloaded and edited to provide server information and credentials.<br /><br />"}if(a==1){c+='<div>Download "meshcmd" with an action file to route traffic thru this server to this device. Make sure to edit meshaction.txt and add your account password or make any changes needed.<br /><br />'}c+=addHtmlValue("Operating System",d);c+=addHtmlValue("MeshCmd",'<a id=meshcmddownloadid href="meshagents?meshcmd=3" rel="noreferrer noopener" target="_blank"></a>');if(a==0){c+=addHtmlValue("Action File",'<a href="meshagents?meshaction=generic" rel="noreferrer noopener" target="_blank">MeshAction (.txt)</a>')}if(a==1){c+=addHtmlValue("Action File",'<a href="meshagents?meshaction=route&nodeid='+b+'" rel="noreferrer noopener" target="_blank">MeshAction (.txt)</a>')}c+="</div>";setDialogMode(2,["Download MeshCmd","Network Router"][a],9,null,c);meshCmdOsClick()}function meshCmdOsClick(){var a=Q("aginsSelect").value,b="";Q("meshcmddownloadid").href="meshagents?meshcmd="+a;if(a==3){b="MeshCmd (Win32 executable)"}if(a==4){b="MeshCmd (Win64 executable)"}if(a==5){b="MeshCmd (Linux x86, 32bit)"}if(a==6){b="MeshCmd (Linux x86, 64bit)"}if(a==25){b="MeshCmd (Linux ARM, 32bit)"}QH("meshcmddownloadid",b)}function p10showiconselector(){if(xxdialogMode){return}var a=meshes[currentNode.meshid];var b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&4)==0){return}var c="<br><div style=display:inline-block;width:40px></div>";c+="<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>";c+="<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>";c+="<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div>";c+="<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>";c+="<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>";c+="<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div><br><br>";setDialogMode(2,"Icon Selection",0,null,c);QV("id_dialogclose",true)}function p10setIcon(a){setDialogMode(0);meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:a})}var showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Tags"];var showEditNodeValueDialog_modes2=["name","host","desc","tags"];var showEditNodeValueDialog_modes3=["","","","Tag1, Tag2, Tag3"];function showEditNodeValueDialog(a){if(xxdialogMode){return}var c=addHtmlValue(showEditNodeValueDialog_modes[a],'<input id=dp10devicevalue style=width:230px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[a]+'" onchange=p10editdevicevalueValidate('+a+",event) onkeyup=p10editdevicevalueValidate("+a+",event) />");setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,c,a);var b=currentNode[showEditNodeValueDialog_modes2[a]];if(b==null){b=""}if(Array.isArray(b)){b=b.join(", ")}Q("dp10devicevalue").value=b;p10editdevicevalueValidate();Q("dp10devicevalue").focus()}function showEditNodeValueDialogEx(a,b){var c={action:"changedevice",nodeid:currentNode._id};c[showEditNodeValueDialog_modes2[b]]=Q("dp10devicevalue").value;meshserver.send(c)}function p10editdevicevalueValidate(b,a){var c=((b>1)||(Q("dp10devicevalue").value.length>0));QE("idx_dlgOkButton",c);if((a!=null)&&(c==true)&&(a.keyCode==13)){dialogclose(1)}}var desktopNode;function setupDesktop(){if((desktopNode!=currentNode)&&(desktop!=null)){desktop.Stop();desktopNode=null;desktop=null}if((desktopNode!=currentNode)||(desktop==null)){var b=multiDesktop[currentNode._id];if(b!=null){QH("DeskParent","");var a=b.m.CanvasId;a.setAttribute("id","Desk");a.setAttribute("style","width:100%;-ms-touch-action:none;margin-left:0px");a.setAttribute("onmousedown","dmousedown(event)");a.setAttribute("onmouseup","dmouseup(event)");a.setAttribute("onmousemove","dmousemove(event)");a.removeAttribute("onclick");Q("DeskParent").appendChild(a);desktop=b;if(desktop.m.SendCompressionLevel){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}desktop.onStateChanged=onDesktopStateChange;desktopNode=currentNode;onDesktopStateChange(desktop,desktop.State);delete multiDesktop[currentNode._id]}else{QH("DeskParent",'<canvas id=Desk width=640 height=480 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');desktopNode=currentNode}Q("Desk").addEventListener("DOMMouseScroll",function(c){return dmousewheel(c)});Q("Desk").addEventListener("mousewheel",function(c){return dmousewheel(c)})}desktopNode=currentNode;updateDesktopButtons();deskAdjust();if(!Q("Desk")["toBlob"]){QV("deskSaveBtn",false)}}function updateDesktopButtons(){var c=meshes[currentNode.meshid];var a=0;if(desktop!=null){a=desktop.State}var d=c.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;QV("disconnectbutton1span",(a!=0));QV("connectbutton1span",(a==0)&&((d&8)||(d&256))&&(c.mtype==2)&&(currentNode.agent.caps&1));QV("connectbutton1hspan",(a==0)&&(d&8)&&((currentNode.intelamt!=null)&&(c.mtype==1||currentNode.intelamt.state==2)&&((currentNode.intelamt.ver!=null)||(c.mtype==1))));QV("d7amtkvm",(currentNode.intelamt!=null&&((currentNode.intelamt.ver!=null)||(c.mtype==1)))&&((a==0)||(desktop.contype==2)));QV("d7meshkvm",(webRtcDesktop)||((c.mtype==2)&&(currentNode.agent.caps&1)&&((a==false)||(desktop.contype==1))));var e=((currentNode.conn&1)!=0);QE("connectbutton1",e);var b=((currentNode.conn&6)!=0);QE("connectbutton1h",b);QE("deskSaveBtn",a==3);QV("deskFocusBtn",(desktop!=null)&&(desktop.contype==2)&&(a!=0)&&(desktopsettings.showfocus));QV("DeskCAD",d&8);QE("DeskCAD",a==3);QV("DeskWD",(currentNode.agent)&&(currentNode.agent.id<5)&&(d&8));QE("DeskWD",a==3);QV("deskkeys",(currentNode.agent)&&(currentNode.agent.id<5)&&(d&8));QE("deskkeys",a==3);QV("DeskToolsButton",(d&8)&&(c.mtype==2)&&e);QV("DeskChatButton",(browserfullscreen==false)&&(d&8)&&(c.mtype==2)&&e);QV("DeskNotifyButton",(browserfullscreen==false)&&(currentNode.agent)&&(currentNode.agent.id<5)&&(d&8)&&(c.mtype==2)&&e);QV("DeskOpenWebButton",(browserfullscreen==false)&&(d&8)&&(c.mtype==2)&&e);QV("DeskControlSpan",d&8);QV("deskActionsBtn",(browserfullscreen==false));QV("deskActionsSettings",(browserfullscreen==false));if(d&8){Q("DeskControl").checked=(getstore("DeskControl",1)==1)}else{Q("DeskControl").checked=false}if(e==false){QV("DeskTools",false)}}var autoConnectDesktopTimer=null;function autoConnectDesktop(a){if(autoConnectDesktopTimer==null){autoConnectDesktopTimer=setInterval(connectDesktop,100)}else{clearInterval(autoConnectDesktopTimer);autoConnectDesktopTimer=null}}function connectDesktop(b,a){if(desktop==null){desktopNode=currentNode;if(a==2){if((desktopNode.intelamt.user==null)||(desktopNode.intelamt.user=="")){editDeviceAmtSettings(desktopNode._id,connectDesktop);return}desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"));desktop.debugmode=debugmode;desktop.onStateChanged=onDesktopStateChange;desktop.m.bpp=(desktopsettings.encoding==1||desktopsettings.encoding==3)?1:2;desktop.m.useZRLE=(desktopsettings.encoding<3);desktop.m.showmouse=desktopsettings.showmouse;desktop.m.onScreenSizeChange=deskAdjust;desktop.m.onKvmData=function(g){if(g.length==0){if(!desktop.m._sentPresence){desktop.m._sentPresence=true;desktop.m.sendKvmData(JSON.stringify({action:"present",ver:1}))}return}var d=null;try{d=JSON.parse(g)}catch(f){}if((d!=null)&&(d.action!=null)){if(d.action=="restart"){webRtcDesktopReset();desktop.m.sendKvmData(JSON.stringify({action:"present",ver:1}))}else{if((d.action=="present")&&(webRtcDesktop==null)){webRtcDesktop={platform:d.platform};var c=null;if(typeof RTCPeerConnection!=="undefined"){webRtcDesktop.webrtc=new RTCPeerConnection(c)}else{if(typeof webkitRTCPeerConnection!=="undefined"){webRtcDesktop.webrtc=new webkitRTCPeerConnection(c)}}webRtcDesktop.webchannel=webRtcDesktop.webrtc.createDataChannel("DataChannel",{});webRtcDesktop.webchannel.onopen=function(){console.log("WebRTC Data Channel Open");Q("deskstatus").textContent=StatusStrs[desktop.State]+", Soft-KVM";desktop.m.hold(true);webRtcDesktop.webRtcActive=true;webRtcDesktop.softdesktop=CreateKvmDataChannel(webRtcDesktop.webchannel,CreateAgentRemoteDesktop("Desk",Q("id_mainarea")),desktop.m);webRtcDesktop.softdesktop.m.setRotation(desktop.m.rotation);webRtcDesktop.softdesktop.m.onScreenSizeChange=deskAdjust;if(desktopsettings.quality){webRtcDesktop.softdesktop.m.CompressionLevel=desktopsettings.quality}if(desktopsettings.scaling){webRtcDesktop.softdesktop.m.ScalingLevel=desktopsettings.scaling}webRtcDesktop.softdesktop.Start()};webRtcDesktop.webchannel.onclose=function(e){console.log("WebRTC Data Channel Closed");webRtcDesktopReset()};webRtcDesktop.webrtc.onicecandidate=function(h){if(h.candidate==null){desktop.m.sendKvmData(JSON.stringify({action:"offer",ver:1,sdp:webRtcDesktop.webrtcoffer.sdp}))}else{webRtcDesktop.webrtcoffer.sdp+=("a="+h.candidate.candidate+"\r\n")}};webRtcDesktop.webrtc.oniceconnectionstatechange=function(){if((webRtcDesktop!=null)&&(webRtcDesktop.webrtc!=null)&&((webRtcDesktop.webrtc.iceConnectionState=="disconnected")||(webRtcDesktop.webrtc.iceConnectionState=="failed"))){webRtcDesktopReset()}};webRtcDesktop.webrtc.createOffer(function(e){webRtcDesktop.webrtcoffer=e;webRtcDesktop.webrtc.setLocalDescription(e,function(){},webRtcDesktopReset)},webRtcDesktopReset,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}else{if((d.action=="answer")&&(webRtcDesktop!=null)){webRtcDesktop.webrtc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:d.sdp}),function(){},webRtcDesktopReset)}}}}};desktop.Start(desktopNode._id,16994,"*","*",0);desktop.contype=2}else{desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort);desktop.debugmode=debugmode;desktop.m.debugmode=debugmode;desktop.attemptWebRTC=attemptWebRTC;desktop.onStateChanged=onDesktopStateChange;desktop.m.CompressionLevel=desktopsettings.quality;desktop.m.ScalingLevel=desktopsettings.scaling;desktop.m.FrameRateTimer=desktopsettings.framerate;desktop.m.onDisplayinfo=deskDisplayInfo;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id);desktop.contype=1}}else{desktop.Stop();webRtcDesktopReset();desktopNode=desktop=null}}var webRtcDesktop=null;function webRtcDesktopReset(){if(webRtcDesktop==null){return}if(webRtcDesktop.softdesktop!=null){webRtcDesktop.softdesktop.Stop();webRtcDesktop.softdesktop=null}if(webRtcDesktop.webchannel!=null){try{webRtcDesktop.webchannel.close()}catch(a){}webRtcDesktop.webchannel=null}if(webRtcDesktop.webrtc!=null){try{webRtcDesktop.webrtc.close()}catch(a){}webRtcDesktop.webrtc=null}webRtcDesktop=null;if(desktop&&desktop.m){desktop.m.hold(false);Q("deskstatus").textContent=StatusStrs[desktop.State]}}function onDesktopStateChange(c,a){var d=a;if((d==3)&&(c.contype==2)){d++}var b=StatusStrs[d];if((desktop!=null)&&(desktop.webRtcActive==true)){b+=", WebRTC"}QH("deskstatus",b);switch(a){case 0:desktop.Stop();desktopNode=desktop=null;QV("DeskFocus",false);QV("termdisplays",false);deskFocusBtn.value="All Focus";if(fullscreen==true){deskToggleFull()}webRtcDesktopReset();break;case 2:break;default:break}updateDesktopButtons();deskAdjust();setTimeout(deskAdjust,50)}function showDesktopSettings(){if(xxdialogMode){return}applyDesktopSettings();updateDesktopButtons();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value;desktopsettings.showfocus=d7showfocus.checked;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;desktopsettings.framerate=d7framelimiter.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();if(desktop){if(desktop.contype==1){if(desktop.State!=0){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}}if(desktop.contype==2){if(desktopsettings.showfocus==false){desktop.m.focusmode=0;deskFocusBtn.value="All Focus"}if(desktop.State!=0){desktop.Stop();setTimeout(function(){connectDesktop(null,2)},50)}}}}function applyDesktopSettings(){var c="",b=(features&512)?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];for(var a in b){c+="<option value="+b[a]+">"+b[a]+"%</option>"}QH("d7bitmapquality",c);d7desktopmode.value=desktopsettings.encoding;d7showfocus.checked=desktopsettings.showfocus;d7showcursor.checked=desktopsettings.showmouse;d7bitmapquality.value=40;if(b.indexOf(parseInt(desktopsettings.quality))>=0){d7bitmapquality.value=desktopsettings.quality}d7bitmapscaling.value=desktopsettings.scaling;if(desktopsettings.framerate){d7framelimiter.value=desktopsettings.framerate}QV("deskFocusBtn",(desktop!=null)&&(desktop.contype==2)&&(desktop.state!=0)&&(desktopsettings.showfocus))}function enterBrowserFullscreen(a){if(a.requestFullscreen){a.requestFullscreen()}else{if(a.msRequestFullscreen){a.msRequestFullscreen()}else{if(a.mozRequestFullScreen){a.mozRequestFullScreen()}else{if(a.webkitRequestFullscreen){a.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}}}}function exitBrowserFullscreen(){if(document.exitFullscreen){document.exitFullscreen()}else{if(document.msExitFullscreen){document.msExitFullscreen()}else{if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else{if(document.webkitExitFullscreen){document.webkitExitFullscreen()}}}}}function isBrowserFullscreen(){if(!document.fullscreenElement&&!document.mozFullScreenElement&&!document.webkitFullscreenElement&&!document.msFullscreenElement){return false}else{return true}}var fullscreen=false;var browserfullscreen=false;function deskToggleFull(a){fullscreen=!fullscreen;QV("mastheadx",!fullscreen);QV("masthead",!fullscreen);QV("topbar",!fullscreen);QV("p11deviceNameHeader",!fullscreen);QV("footer",!fullscreen);QV("column_l_bottomgap",!fullscreen);QV("idx_deskFullBtn2",fullscreen);QV("deskFullBtn",!fullscreen);QV("page_leftbar",!fullscreen);if(fullscreen){if(a.shiftKey==true){enterBrowserFullscreen(Q("deskarea0"));browserfullscreen=true}QS("column_l").width="930px";QS("column_l").height="";QS("column_l")["margin-left"]="";QS("column_l")["overflow-y"]="";QS("container").position="";QS("page_content").position="";QV("MainMenuSpan",true);QS("container").width="100%";QS("container")["border-right"]="0";QS("container")["border-left"]="0";QS("column_l").padding="0";QS("column_l").width="100%";QS("column_l")["max-height"]=""}else{exitBrowserFullscreen();browserfullscreen=false;QS("container").width="960px";QS("container")["border-right"]="1px solid #b7b7b7";QS("container")["border-left"]="1px solid #b7b7b7";QS("column_l").padding="0 15px";QS("column_l").width="930px";toggleFullScreen()}deskAdjust();deskAdjust();updateDesktopButtons()}function deskToggleFocus(){desktop.m.focusmode=(desktop.m.focusmode+64)%192;Q("deskFocusBtn").value=["All Focus","Small Focus","Large Focus"][desktop.m.focusmode/64]}function deskAdjust(){var c=(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(Q("deskarea1").clientHeight+Q("deskarea2").clientHeight+Q("Desk").clientHeight+Q("deskarea4").clientHeight+2))/2;if(fullscreen){document.documentElement.style.overflow="hidden";QS("deskarea3x").height=null;if(c<0){var a=(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(Q("deskarea1").clientHeight+Q("deskarea2").clientHeight+Q("deskarea4").clientHeight));var b=9999;if(desktop){b=(desktop.m.width/desktop.m.height)*a}if(webRtcDesktop&&webRtcDesktop.softdesktop){b=(webRtcDesktop.softdesktop.m.width/webRtcDesktop.softdesktop.m.height)*a}QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";c=0}else{QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null}QS("Desk")["margin-top"]=c+"px";QS("Desk")["margin-bottom"]=c+"px"}else{var b=9999,a=(Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(webPageFullScreen?276:290));if(desktop){b=(desktop.m.width/desktop.m.height)*a}if(webRtcDesktop&&webRtcDesktop.softdesktop){b=(webRtcDesktop.softdesktop.m.width/webRtcDesktop.softdesktop.m.height)*a}document.documentElement.style.overflow="auto";QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";QS("Desk")["margin-top"]="0";QS("Desk")["margin-bottom"]="0"}}function mdeskAdjust(c,g,f,a){if(!c||!g||!f||!a){return}if(a.id=="Desk"){deskAdjust();return}var j=[{x:180,y:101},{x:302,y:169},{x:454,y:255}][Q("sizeselect").selectedIndex];var e=j.x+2,h=Q("xdevices").clientWidth-30,k=Math.floor(h/e);k=e+Math.floor((h-(k*e))/k);j.y=j.y*(k/j.x);j.x=k;var b=j.y,d=j.x;if(c.State!=0){b=j.y;d=(g/f)*j.y}QS(a.id)["max-height"]=b+"px";QS(a.id)["max-width"]=d+"px";QS(a.id)["margin-top"]="0";QS(a.id)["margin-bottom"]="0"}function deskSendKeys(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=Q("deskkeys").value;if(a==0){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65364,1],[65364,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==1){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65362,1],[65362,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==2){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[108,1],[108,0],[65511,0]])}else{desktop.sendCtrlMsg('{"action":"lock"}')}}else{if(a==3){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[109,1],[109,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==4){if(desktop.contype==2){desktop.m.sendkey([[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91],[desktop.m.KeyAction.UP,16]])}}else{if(a==5){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.EXUP,91]])}}else{if(a==6){if(desktop.contype==2){desktop.m.sendkey([[65511,1],[114,1],[114,0],[65511,0]])}else{desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,82],[desktop.m.KeyAction.UP,82],[desktop.m.KeyAction.EXUP,91]])}}}}}}}}}function sendCAD(){if(xxdialogMode||desktop==null||desktop.State!=3){return}desktop.m.sendcad()}function toggleDeskTools(){if(xxdialogMode){return}if(QS("DeskTools").display=="none"){QV("DeskTools",true);Q("DeskTools").nodeid=currentNode._id;refreshDeskTools()}else{QV("DeskTools",false)}}function refreshDeskTools(){QV("DeskToolsRefreshButton",false);setTimeout(refreshDeskToolsEx,500);meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",true)}var deskTools={sort:1,msg:null};function sortProcess(a){deskTools.sort=a;showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(c,d){if(c.p>d.p){return 1}if(c.p<d.p){return(-1)}return 0}function sortProcessName(c,d){if(c.d>d.d){return 1}if(c.d<d.d){return(-1)}return 0}function showDeskToolsProcesses(c){deskTools.msg=c;if(c==null){QH("DeskToolsProcesses","");return}if(Q("DeskTools").nodeid!=c.nodeid){return}var d=[],g=null;try{g=JSON.parse(c.value)}catch(a){}if(g!=null){for(var f in g){d.push({p:parseInt(f),c:g[f].cmd,d:g[f].cmd.toLowerCase(),u:g[f].user})}if(deskTools.sort==0){d.sort(sortProcessPid)}else{if(deskTools.sort==1){d.sort(sortProcessName)}}var h="";for(var b in d){if(d[b].p!=0){h+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+d[b].p+'</div><a style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=stopProcess('+d[b].p+',"'+d[b].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(d[b].u?d[b].u:"")+"</div><div>"+d[b].c+"</div></div>"}}QH("DeskToolsProcesses",h)}}function toggleKvmControl(){putstore("DeskControl",(Q("DeskControl").checked?1:0))}function deskSaveImage(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=new Date(),b="Desktop-"+currentNode.name+"-"+a.getFullYear()+"-"+("0"+(a.getMonth()+1)).slice(-2)+"-"+("0"+a.getDate()).slice(-2)+"-"+("0"+a.getHours()).slice(-2)+"-"+("0"+a.getMinutes()).slice(-2);Q("Desk")["toBlob"](function(c){saveAs(c,b+".jpg")})}function deskDisplayInfo(e,a,c,d){var f=Q("termdisplays").value;if(a.length>0){var b="";for(var g in a){b+="<option"+((f==a[g])?" selected":"")+">"+a[g]+"</option>"}QH("termdisplays",b)}QV("termdisplays",a.length>0)}function deskGetDisplayNumbers(a){desktop.m.GetDisplayNumbers()}function deskSetDisplay(b){var a=0,c=Q("termdisplays").value;if(c=="All Displays"){a=65535}else{a=parseInt(c.substring(8))}desktop.m.SetDisplay(a)}var dblClickDetectArgs={t:0,x:0,y:0};function dblClickDetect(a){if(a.buttons!=1){return}var b=Date.now();if(((b-dblClickDetectArgs.t)<250)&&(Math.abs(a.clientX-dblClickDetectArgs.x)<2)&&(Math.abs(a.clientY-dblClickDetectArgs.y)<2)){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){if((webRtcDesktop!=null)&&(webRtcDesktop.softdesktop!=null)){webRtcDesktop.softdesktop.m.mousedblclick(a);desktop.m.sendKeepAlive()}else{desktop.m.mousedblclick(a)}}}dblClickDetectArgs.t=b;dblClickDetectArgs.x=a.clientX;dblClickDetectArgs.y=a.clientY}function dmousedown(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){if((webRtcDesktop!=null)&&(webRtcDesktop.softdesktop!=null)){webRtcDesktop.softdesktop.m.mousedown(a);desktop.m.sendKeepAlive()}else{desktop.m.mousedown(a)}}dblClickDetect(a)}function dmouseup(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){if((webRtcDesktop!=null)&&(webRtcDesktop.softdesktop!=null)){webRtcDesktop.softdesktop.m.mouseup(a);desktop.m.sendKeepAlive()}else{desktop.m.mouseup(a)}}}function dmousemove(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){if((webRtcDesktop!=null)&&(webRtcDesktop.softdesktop!=null)){webRtcDesktop.softdesktop.m.mousemove(a);desktop.m.sendKeepAlive()}else{desktop.m.mousemove(a)}}}function dmousewheel(a){if(!xxdialogMode&&desktop!=null&&Q("DeskControl").checked){if((webRtcDesktop!=null)&&(webRtcDesktop.softdesktop!=null)){webRtcDesktop.softdesktop.m.mousewheel(a);desktop.m.sendKeepAlive()}else{if(desktop.m.mousewheel){desktop.m.mousewheel(a)}}haltEvent(a);return true}return false}function drotate(a){if(!xxdialogMode&&desktop!=null){desktop.m.setRotation(desktop.m.rotation+a);deskAdjust();deskAdjust()}}function stopProcess(a,b){setDialogMode(2,"Process Control",3,stopProcessEx,"Stop process #"+a+' "'+b+'"?',a)}function stopProcessEx(a,b){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:b});setTimeout(refreshDeskTools,300)}var terminalNode;function setupTerminal(){if((terminalNode!=currentNode)&&(terminal!=null)){terminal.Stop();terminal=null}terminalNode=currentNode;updateTerminalButtons()}function updateTerminalButtons(){var b=meshes[terminalNode.meshid];var d=((terminal!=null)&&(terminal.state!=0));QV("disconnectbutton2span",(d==true));QV("connectbutton2span",(d==false)&&(b.mtype==2)&&(currentNode.agent.caps&2));QV("connectbutton2hspan",(d==false)&&((terminalNode.intelamt!=null)&&(b.mtype==1||terminalNode.intelamt.state==2)&&((terminalNode.intelamt.ver!=null)||(b.mtype==1))));var c=((terminalNode.conn&1)!=0);QE("connectbutton2",c);var a=((terminalNode.conn&6)!=0);QE("connectbutton2h",a);QE("ctrlcbutton",d);QE("ctrlxbutton",d);QE("escbutton",d);QE("bsbutton",d);QE("pastebutton",d);QE("specialkeylist",d);QE("specialkeylistinput",d);QV("terminalSettingsButtons",(terminal)&&(terminal.contype==2));if(terminal){Q("id_ttypebutton").value=terminalEmulations[terminal.m.terminalEmulation];Q("id_tfxkeysbutton").value=fxEmulations[terminal.m.fxEmulation];Q("id_tcrbutton").value=(terminal.m.lineFeed=="\r\n")?"CR+LF":"LF"}}function onTerminalStateChange(d,a){var c=a;if((c==3)&&(d.contype==2)){c++}var b=StatusStrs[c];if(terminal.webRtcActive==true){b+=", WebRTC"}QH("termstatus",b);switch(a){case 0:d.m.TermResetScreen();d.m.TermDraw();if(terminal!=null){terminal.Stop();terminal=null}break;case 3:break;default:break}updateTerminalButtons()}var autoConnectTerminalTimer=null;function autoConnectTerminal(a){if(autoConnectTerminalTimer==null){autoConnectTerminalTimer=setInterval(connectTerminal,100)}else{clearInterval(autoConnectTerminalTimer);autoConnectTerminalTimer=null}}function connectTerminal(b,a){if(!terminal){if(a==2){if((terminalNode.intelamt.user==null)||(terminalNode.intelamt.user=="")){editDeviceAmtSettings(terminalNode._id,connectTerminal);return}terminal=CreateAmtRedirect(CreateAmtRemoteTerminal("Term"));terminal.debugmode=debugmode;terminal.m.debugmode=debugmode;terminal.onStateChanged=onTerminalStateChange;terminal.Start(terminalNode._id,16994,"*","*",0);terminal.contype=2;Q("id_ttypebutton").value=terminalEmulations[terminal.m.terminalEmulation]}else{terminal=CreateAgentRedirect(meshserver,CreateAmtRemoteTerminal("Term"),serverPublicNamePort);terminal.debugmode=debugmode;terminal.m.debugmode=debugmode;terminal.m.lineFeed=([1,2,3,4,21,22].indexOf(currentNode.agent.id)>=0)?"\r\n":"\n";terminal.attemptWebRTC=attemptWebRTC;terminal.onStateChanged=onTerminalStateChange;terminal.Start(terminalNode._id);terminal.contype=1;terminal.m.terminalEmulation=0;terminal.m.fxEmulation=0;Q("id_ttypebutton").value=terminalEmulations[0]}}else{terminal.Stop();terminal=null}Q("connectbutton2").blur()}var terminalEmulations=["UTF8 Terminal","Extended ASCII","Intel ASCII"];function termToggleType(){if(!terminal||xxdialogMode){return}terminal.m.terminalEmulation=(terminal.m.terminalEmulation+1)%3;Q("id_ttypebutton").value=terminalEmulations[terminal.m.terminalEmulation];Q("id_ttypebutton").blur()}var fxEmulations=["Intel (F10 = ESC+[OM)","Alternate (F10 = ESC+0)","VT100+ (F10 = ESC+[OY)"];function termToggleFx(){if(!terminal||xxdialogMode){return}terminal.m.fxEmulation=(terminal.m.fxEmulation+1)%3;Q("id_tfxkeysbutton").value=fxEmulations[terminal.m.fxEmulation];Q("id_tfxkeysbutton").blur()}function termToggleCr(){if(!terminal||xxdialogMode){return}if(terminal.m.lineFeed=="\n"){terminal.m.lineFeed="\r\n"}else{terminal.m.lineFeed="\n"}Q("id_tcrbutton").value=(terminal.m.lineFeed=="\r\n")?"CR+LF":"LF"}function termSendKey(b,a){if(!terminal||xxdialogMode){return}terminal.m.TermSendKey(b);Q(a).blur()}function showTermPasteDialog(){if(!terminal||xxdialogMode){return}Q("pastebutton").blur();setDialogMode(2,"Paste",3,showTermPasteDialogEx,'<textarea id=d2pasteText style="width:100%;height:184px;resize:none"></textarea>');Q("d2pasteText").focus()}function showTermPasteDialogEx(){if(!terminal){return}terminal.m.TermSendKeys(Q("d2pasteText").value)}function sendSpecialKey(){terminal.m.TermSendKey(Q("specialkeylist").value);Q("specialkeylist").blur();Q("specialkeylistinput").blur()}var filesNode;function setupFiles(){var b=(filesNode==currentNode);filesNode=currentNode;var a=((filesNode.conn&1)!=0)?true:false;QE("p13Connect",a);if(((b==false)||(a==false))&&files){files.Stop();files=null}}function onFilesStateChange(c,a){p13Connect.value=(a==0)?"Connect":"Disconnect";var b=StatusStrs[a];if(files.webRtcActive==true){b+=", WebRTC"}Q("p13Status").textContent=b;switch(a){case 0:QH("p13files","");p13filetree=null;p13filetreelocation=[];QH("p13currentpath","");QE("p13FolderUp",false);p13setActions();if(files!=null){files.Stop();files=null}break;case 3:p13targetpath="";files.sendText({action:"ls",reqid:1,path:""});break;default:break}}function CreateRemoteFiles(b){var a={protocol:5};a.onFileUpdate=b;a.xxStateChange=function(c){};a.ProcessData=function(c){a.onFileUpdate(c)};return a}var autoConnectFilesTimer=null;function autoConnectFiles(a){if(autoConnectFilesTimer==null){autoConnectFilesTimer=setInterval(connectFiles,100)}else{clearInterval(autoConnectFilesTimer);autoConnectFilesTimer=null}}function connectFiles(a){if(!files){files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort);files.attemptWebRTC=attemptWebRTC;files.onStateChanged=onFilesStateChange;files.Start(filesNode._id)}else{files.Stop();files=null}p13clipboard=p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}var p13filetree=null;var p13targetpath=null;var p13filetreelocation=[];function p13gotFiles(b){if((b.length>0)&&(b.charCodeAt(0)!=123)){p13gotDownloadBinaryData(b);return}b=JSON.parse(decode_utf8(b));if(b.action=="download"){p13gotDownloadCommand(b);return}b.path=b.path.replace(/\//g,"\\");if((p13filetree!=null)&&(b.path==p13filetree.path)){var a=p13getCheckedNames();p13filetree=b;p13updateFiles(a)}else{var c=b.path.replace(/\//g,"\\"),d=p13targetpath.replace(/\//g,"\\");while((c.length>0)&&(c[0]=="\\")){c=c.substring(1)}while((d.length>0)&&(d[0]=="\\")){d=d.substring(1)}if((c==d)||((b.path=="\\")&&(p13targetpath==""))){p13filetree=b;p13updateFiles()}}}function p13getCheckedNames(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}return b}function p13updateFiles(b){var n="",o="",c="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",l="Root";var w=p13filetree.path.split("\\");p13filetreelocation=[];for(var p in w){if(w[p]!=""){p13filetreelocation.push(w[p])}}for(var p in p13filetreelocation){c+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(p)+1)+")>"+p13filetreelocation[p]+"</a>"}var s=p13filetreelocation.join("/");var j=p13sort_files(p13filetree.dir);for(var p in j){var d=j[p],r=d.n,u;u=r;if(r.length>70){u='<span title="'+EscapeHtml(r)+'">'+EscapeHtml(r.substring(0,70))+"...</span>"}else{u=EscapeHtml(r)}r=EscapeHtml(r);var g="";if(d.d!=null){var e=new Date(d.d),g=(e.getMonth()+1)+"/"+(e.getDate())+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" "}var k="";if(d.s!=null){k=getFileSizeStr(d.s)}var m="";if(d.t<3){var t="",v="";m="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'> <span style=float:right title=\""+v+'">'+t+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+u+"</a></span></div>"}else{var q=u;if(d.s>0){q='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(s+"/"+r)+"','"+encodeURIComponent(r)+"',"+d.s+')">'+u+"</a>"}m="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'> <span class=fsize>"+g+"</span><span style=float:right>"+k+"</span><span><div class=fileIcon"+d.t+"></div>"+q+"</span></div>"}if(d.t<3){n+=m}else{o+=m}}QH("p13files",n+o);QH("p13currentpath",c);QE("p13FolderUp",p13filetreelocation.length!=0);if(b!=null){var a=document.getElementsByName("fd");for(var p=0;p<a.length;p++){if(b.indexOf(p13filetree.dir[a[p].value].n)>=0){a[p].checked=true}}}p13setActions()}function p13folderset(a){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[a].n).split("\\").join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(a){if(a==null){p13filetreelocation.pop()}else{while(p13filetreelocation.length>a){p13filetreelocation.pop()}}p13targetpath=p13filetreelocation.join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}var p13sortorder;function p13sort_filename(c,d){if(c.ln>d.ln){return(1*p13sortorder)}if(c.ln<d.ln){return(-1*p13sortorder)}return 0}function p13sort_timestamp(c,d){if(c.d>d.d){return(1*p13sortorder)}if(c.d<d.d){return(-1*p13sortorder)}return 0}function p13sort_bysize(c,d){if(c.s==d.s){return p13sort_filename(c,d)}return(((c.s-d.s))*p13sortorder)}function p13sort_files(a){var c=[],d=Q("p13sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].s==null){a[b].s=0}if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}p13sortorder=1;if(d>3){p13sortorder=-1;d-=3}if(d==1){c.sort(p13sort_filename)}else{if(d==2){c.sort(p13sort_bysize)}else{if(d==3){c.sort(p13sort_timestamp)}}}return c}function p13setActions(){if(p13filetree==null){QE("p13DeleteFileButton",false);QE("p13NewFolderButton",false);QE("p13UploadButton",false);QE("p13RenameFileButton",false);QE("p13SelectAllButton",false);Q("p13SelectAllButton").value="Select All";QE("p13RefreshButton",false);QE("p13CutButton",false);QE("p13CopyButton",false);QE("p13PasteButton",false)}else{var a=p13getFileSelCount(),c=p13getFileCount(),b=p13getFileSelCount(false);var d=((currentNode.agent.id>0)&&(currentNode.agent.id<5));QE("p13DeleteFileButton",(a>0)&&((p13filetreelocation.length>0)||(d==false)));QE("p13NewFolderButton",((p13filetreelocation.length>0)||(d==false)));QE("p13UploadButton",((p13filetreelocation.length>0)||(d==false)));QE("p13RenameFileButton",(a==1)&&((p13filetreelocation.length>0)||(d==false)));QE("p13SelectAllButton",c>0);Q("p13SelectAllButton").value=(a>0?"Select None":"Select All");QE("p13RefreshButton",true);QE("p13CutButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13CopyButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13PasteButton",((p13filetreelocation.length>0)||(d==false))&&((p13clipboard!=null)&&(p13clipboard.length>0)))}}function p13getFileSelCount(d){var a=0;var b=document.getElementsByName("fd");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function p13getFileSelDirCount(){var a=0,b=document.getElementsByName("fd");for(var c=0;c<b.length;c++){if((b[c].checked)&&(b[c].attributes.file.value=="999")){a++}}return a}function p13getFileCount(){var a=0;var b=document.getElementsByName("fd");return b.length}function p13selectallfile(){var c=(p13getFileSelCount()==0),a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){a[b].checked=c}p13setActions()}function p13createfolder(){setDialogMode(2,"New Folder",3,p13createfolderEx,"<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />");focusTextBox("p13renameinput");p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value});p13folderup(999)}function p13deletefile(){var a=p13getFileSelCount(),b=(p13getFileSelDirCount()>0)?"<br /><br /><input type=checkbox id=p13recdeleteinput>Recursive delete<br>":"<input type=checkbox id=p13recdeleteinput style='display:none'>";setDialogMode(2,"Delete",3,p13deletefileEx,(a>1)?("Delete "+a+" selected items?"+b):("Delete selected item?"+b))}function p13deletefileEx(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:b,rec:Q("p13recdeleteinput").checked});p13folderup(999)}function p13renamefile(){var c,a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){if(a[b].checked){c=p13filetree.dir[a[b].value].n}}setDialogMode(2,"Rename",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:c});focusTextBox("p13renameinput");p13fileNameCheck()}function p13renamefileEx(a,c){c.newname=Q("p13renameinput").value;files.sendText(c);p13folderup(999)}function p13fileNameCheck(a){var b=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p13uploadinput')\" />");updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}var p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(b){var a=document.getElementsByName("fd");p13clipboard=[];p13clipboardCut=b,p13clipboardFolder=p13targetpath;for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p13clipboard.push(p13filetree.dir[a[c].value].n)}}p13updateClipview()}function p13pasteFile(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Confim "+(p13clipboardCut==0?"copy":"move")+" of "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p13pasteFileEx,a)}function p13pasteFileEx(){files.sendText({action:(p13clipboardCut==0?"copy":"move"),reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard});p13folderup(999);if(p13clipboardCut==1){p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;p13updateClipview()}}function p13updateClipview(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Holding "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" for "+(p13clipboardCut==0?"copy":"move")+", <a onclick=p13clearClip() style=cursor:pointer>Clear</a>."}QH("p13bottomstatus",a);p13setActions()}function p13clearClip(){p13clipboard=null;p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}function p13fileDragDrop(a){haltEvent(a);QV("p13bigfail",false);QV("p13bigok",false);if(a.dataTransfer==null||a.dataTransfer.files.length==0||p13filetree==null){return}p13doUploadFiles(a.dataTransfer.files)}var p13dragtimer=null;function p13fileDragOver(b){haltEvent(b);if(p13dragtimer!=null){clearTimeout(p13dragtimer);p13dragtimer=null}var a=(p13filetree!=null);QV("p13bigok",a);QV("p13bigfail",!a)}function p13fileDragLeave(a){haltEvent(a);if(a.target.id!="p13filetable"){QV("p13bigfail",false);QV("p13bigok",false)}else{p13dragtimer=setTimeout(function(){QV("p13bigfail",false);QV("p13bigok",false);p13dragtimer=null},10)}}var downloadFile;function p13downloadfile(a,b,c){if(xxdialogMode||downloadFile||!files){return}downloadFile={path:decodeURIComponent(a),file:decodeURIComponent(b),size:c,tsize:0,data:"",state:0,id:Math.random()};files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path});setDialogMode(2,"Download File",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+c+" />")}function p13downloadFileCancel(){setDialogMode(0);files.sendText({action:"download",sub:"cancel",id:downloadFile.id});downloadFile=null}function p13gotDownloadCommand(a){if((downloadFile==null)||(a.id!=downloadFile.id)){return}if(a.sub=="start"){downloadFile.state=1;files.sendText({action:"download",sub:"startack",id:downloadFile.id})}else{if(a.sub=="cancel"){downloadFile=null;setDialogMode(0)}}}function p13gotDownloadBinaryData(a){if(!downloadFile||downloadFile.state==0){return}if(a.length>4){downloadFile.tsize+=(a.length-4);downloadFile.data+=a.substring(4);Q("d2progressBar").value=downloadFile.tsize}if((ReadInt(a,0)&1)!=0){saveAs(data2blob(downloadFile.data),downloadFile.file);downloadFile=null;setDialogMode(0)}else{files.sendText({action:"download",sub:"ack",id:downloadFile.id})}}var uploadFile;function p13doUploadFiles(a){if(xxdialogMode){return}uploadFile={};uploadFile.xpath=p13filetreelocation.join("/");uploadFile.xfiles=a;uploadFile.xfilePtr=-1;setDialogMode(2,"Upload File",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />");p13uploadReconnect()}function onFileUploadStateChange(b,a){switch(a){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break;default:console.log("Unknown onFileUploadStateChange state",a);break}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort);uploadFile.ws.attemptWebRTC=false;uploadFile.ws.ctrlMsgAllowed=false;uploadFile.ws.onStateChanged=onFileUploadStateChange;uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var a=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",a.name);Q("d2progressBar").max=a.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader();uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;uploadFile.ws.sendText(JSON.stringify({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:a.name,size:uploadFile.xdata.byteLength}))};uploadFile.xreader.readAsArrayBuffer(a)}else{p13uploadFileCancel()}}function p13uploadFileCancel(a,b){if(uploadFile!=null){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}uploadFile=null}setDialogMode(0)}function p13gotUploadData(b){var a=JSON.parse(b);if((uploadFile==null)||(parseInt(uploadFile.xfilePtr)!=parseInt(a.reqid))){return}if(a.action=="uploadstart"){p13uploadNextPart(false);for(var c=0;c<8;c++){p13uploadNextPart(true)}}else{if(a.action=="uploadack"){p13uploadNextPart(false)}else{if(a.action=="uploaderror"){p13uploadFileCancel()}}}}function p13uploadNextPart(c){var a=uploadFile.xdata;var e=uploadFile.xptr;var d=uploadFile.xptr+4096;if(d>a.byteLength){if(c==true){return}d=a.byteLength}if(e==a.byteLength){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}if(uploadFile.xfiles.length>uploadFile.xfilePtr+1){p13uploadReconnect()}else{p13uploadFileCancel()}}else{var b=a.slice(e,d);uploadFile.ws.send(b);uploadFile.xptr=d;Q("d2progressBar").value=d}}var currentDeviceEvents=null;function deviceEventsUpdate(){var g="",a=null;for(var c in currentDeviceEvents){var b=currentDeviceEvents[c];var f=new Date(b.time);if(f.toLocaleDateString()!=a){if(a!=null){g+="</table>"}g+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt colspan=4>"+f.toLocaleDateString()+"</td></tr>";a=f.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var e=b.msg.split("(R)").join("®");g+="<tr><td style=width:18px><div class="+d+"></div></td><td class=g1 style=float:none> </td><td style=background-color:#C9C9C9>"+f.toLocaleTimeString()+" - "+e+"</td><td class=g2 style=float:none> </td></tr><tr style=height:2px></tr>"}if(a!=null){g+="</table>"}if(g==""){g="<br><i>No Events Found</i><br><br>"}QH("p16events",g)}function refreshDeviceEvents(){meshserver.send({action:"events",nodeid:currentNode._id,limit:parseInt(p16limitdropdown.value)})}function agentConsoleHandleKeys(b){var d=0,a=Q("p15consoleText");if(b.key){if(b.keyCode==13&&consoleFocus==0){p15consoleSend(b);d=1}else{if(b.keyCode==8&&consoleFocus==0){var f=a.value;a.value=f.substring(0,f.length-1);d=1}else{if(b.keyCode==27){a.value="";d=1}else{if((b.keyCode==38)||(b.keyCode==40)){var c=consoleHistory.indexOf(a.value);if((b.keyCode==38)&&((consoleHistory.length-1)>c)){a.value=consoleHistory[c+1]}else{if((b.keyCode==40)&&(c>0)){a.value=consoleHistory[c-1]}else{if((b.keyCode==40)&&(c==0)){a.value=""}}}d=1}else{if(b.key.length===1){insertTextAtCursor(a,b.key);d=1}}}}}}else{if(b.charCode!=0&&consoleFocus==0){a.value=((a.value+String.fromCharCode(b.charCode)));d=1}}if(d>0){return haltEvent(b)}}function insertTextAtCursor(a,d){if(document.selection){a.focus();sel=document.selection.createRange();sel.text=d}else{if(a.selectionStart||a.selectionStart=="0"){var c=a.selectionStart,b=a.selectionEnd;a.value=a.value.substring(0,c)+d+a.value.substring(b,a.value.length);a.setSelectionRange(b+1,b+1)}else{a.value+=myValue}}}var consoleNode;function setupConsole(){var d=(consoleNode==currentNode);consoleNode=currentNode;var a=meshes[consoleNode.meshid];var b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&16)!=0){if(consoleNode.consoleText==null){consoleNode.consoleText=""}if(d==false){QH("p15agentConsoleText",consoleNode.consoleText);Q("p15agentConsoleText").scrollTop=Q("p15agentConsoleText").scrollHeight}var c=((consoleNode.conn&1)!=0)?true:false;QH("p15statetext",c?"Agent is online":"Agent is offline");QE("p15consoleText",c);QE("p15uploadCore",c)}else{QH("p15statetext","Access Denied");QE("p15consoleText",false);QE("p15uploadCore",false)}}function p15consoleClear(){QH("p15agentConsoleText","");Q("id_p15consoleClear").blur();consoleNode.consoleText=""}var consoleHistory=[];function p15consoleSend(a){if(a&&a.keyCode!=13){return}var d=Q("p15consoleText").value,c="<div style=color:green>> "+EscapeHtml(Q("p15consoleText").value)+"<br/></div>";Q("p15agentConsoleText").innerHTML+=c;consoleNode.consoleText+=c;Q("p15agentConsoleText").scrollTop=Q("p15agentConsoleText").scrollHeight;Q("p15consoleText").value="";meshserver.send({action:"msg",type:"console",nodeid:consoleNode._id,value:d});if(d.length>0){var b=consoleHistory.indexOf(d);if(b>=0){consoleHistory.splice(b,1)}consoleHistory.unshift(d);consoleHistory.splice(10)}}function p15consoleReceive(b,a){a="<div>"+a+"</div>";if(b.consoleText==null){b.consoleText=a}else{b.consoleText+=a}if(consoleNode==b){Q("p15agentConsoleText").innerHTML+=a;Q("p15agentConsoleText").scrollTop=Q("p15agentConsoleText").scrollHeight}}function p15uploadCore(a){if(xxdialogMode){return}if(a.shiftKey==true){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,path:"*"})}else{if(a.altKey==true){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id})}else{if(a.ctrlKey==true){p15uploadCore2()}else{setDialogMode(2,"Change Mesh Agent Core",3,p15uploadCoreEx,"<select id=d3coreMode style=float:right;width:260px><option value=1>Upload default server core</option><option value=2>Clear the core</option><option value=6>Upload recovery core</option><option value=3>Upload a core file</option><option value=4>Soft disconnect agent</option><option value=5>Hard disconnect agent</option></select><div>Change Core</div>")}}}}function p15uploadCoreEx(){if(Q("d3coreMode").value==1){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,type:"default"})}else{if(Q("d3coreMode").value==2){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,type:"clear"})}else{if(Q("d3coreMode").value==3){p15uploadCore2()}else{if(Q("d3coreMode").value==4){meshserver.send({action:"agentdisconnect",nodeid:consoleNode._id,disconnectMode:1})}else{if(Q("d3coreMode").value==5){meshserver.send({action:"agentdisconnect",nodeid:consoleNode._id,disconnectMode:2})}else{if(Q("d3coreMode").value==6){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,type:"recovery"})}}}}}}}function p15uploadCore2(){if(xxdialogMode){return}Q("d3localmodeform").action="uploadmeshcorefile.ashx";Q("d3attrib").value=currentNode._id;setDialogMode(3,"Upload Mesh Agent Core",3,p15uploadCoreEx2);d3init()}function p15uploadCoreEx2(){var b=Q("d3uploadMode").value;if(b==1){Q("d3submit").click()}else{var a=d3getFileSel();if(a.length==1){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,type:"custom",path:d3filetreelocation.join("/")+"/"+a[0]})}}}function account_addOtp(){if(xxdialogMode||(userinfo.otpsecret==1)||((features&4096)==0)){return}setDialogMode(2,"Add 2-Step Login",2,function(){meshserver.send({action:"otpauth-setup",secret:Q("d2optsecret").attributes.secret.value,token:Q("d2otpauthinput").value})},"<div id=d2optinfo>Loading...</div>","otpauth-request");meshserver.send({action:"otpauth-request"})}function account_addOtpCheck(a){var b=(Q("d2otpauthinput").value.length==6);QE("idx_dlgOkButton",b);if(a&&(a.keyCode==13)&&b){dialogclose(1)}}function account_removeOtp(){if(xxdialogMode||(userinfo.otpsecret!=1)||((features&4096)==0)){return}setDialogMode(2,"Remove 2-Step Login",3,function(){meshserver.send({action:"otpauth-clear"})},"Confirm removal of 2-step login?")}function account_showVerifyEmail(){if(xxdialogMode||(userinfo.emailVerified==true)||(serverinfo.emailcheck!=true)){return}var a="Click ok to send a verification mail to:<br /><div style=padding:8px><b>"+EscapeHtml(userinfo.email)+"</b></div>Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a)}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return}var a="Change your account email address here.<br /><br />";a+=addHtmlValue("Email","<input id=dp2email style=width:230px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp2email").value=userinfo.email}account_validateEmail();Q("dp2email").focus()}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp2email").value)&&(Q("dp2email").value!=userinfo.email));if((a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp2email").value})}function account_showDeleteAccount(){if(xxdialogMode){return}var a="To delete this account, type in the account password in both boxes below and hit ok.<br /><br />";a+="<form action='"+domainUrl+"deleteaccount' method=post><table style=margin-left:80px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr></table><br /><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_showChangePassword(){if(xxdialogMode){return}var a="Change your account password by entering the new password twice in the boxes below.<br /><br />";a+="<form action='"+domainUrl+"changepassword' method=post><table style=margin-left:60px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td>";a+="</tr><tr><td align=right>Password Hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off /></td>";a+="</tr></table><br /><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Change Password",0,null,a);Q("apassword1").focus();account_validateNewPassword()}function account_createMesh(){if(xxdialogMode){return}if((userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true)&&(userinfo.siteadmin!=4294967295)){setDialogMode(2,"New Device Group",1,null,'Unable to create a new device group until the email address is verified. Go to the "My Account" tab to change and verify an email address.');return}var a="Create a new device group using the options below.<br /><br />";a+=addHtmlValue("Name","<input id=dp2meshname style=width:230px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");a+=addHtmlValue("Type","<div style=width:230px;margin:0;padding:0><select id=dp2meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Manage using a software agent</option><option value=1>Intel® AMT only, no agent</option></select></div>");a+=addHtmlValue("Description","<div style=width:230px;margin:0;padding:0><textarea id=dp2meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"New Device Group",3,account_createMeshEx,a);account_validateMeshCreate();Q("dp2meshname").focus()}function account_validateMeshCreate(){QE("idx_dlgOkButton",Q("dp2meshname").value.length>0)}function account_createMeshEx(a,b){meshserver.send({action:"createmesh",meshname:Q("dp2meshname").value,meshtype:Q("dp2meshtype").value,desc:Q("dp2meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value))}function account_validateNewPassword(){var d="",a=(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value);if(Q("apassword1").value!=""){if(passRequirements==null||passRequirements==""){var c=checkPasswordStrength(Q("apassword1").value);if(c>=80){d="<span style=color:green>Strong<span>"}else{if(c>=60){d="<span style=color:blue>Good<span>"}else{d="<span style=color:red>Weak<span>"}}}else{var b=checkPasswordRequirements(Q("apassword1").value,passRequirements);if(b==false){a=false;d="<span style=color:red>Policy<span>"}}}QH("dxPassWarn",d);QE("account_dlgOkButton",a)}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}function checkPasswordRequirements(e,f){if((f==null)||(f=="")||(typeof f!="object")){return true}if(f.min){if(e.length<f.min){return false}}if(f.max){if(e.length>f.max){return false}}var d=0,b=0,g=0,c=0;for(var a=0;a<e.length;a++){if(/\d/.test(e[a])){d++}if(/[a-z]/.test(e[a])){b++}if(/[A-Z]/.test(e[a])){g++}if(/\W/.test(e[a])){c++}}if(f.num&&(d<f.num)){return false}if(f.lower&&(b<f.lower)){return false}if(f.upper&&(g<f.upper)){return false}if(f.nonalpha&&(c<f.nonalpha)){return false}return true}function updateMeshes(){var e="";var a=0,b=0;for(i in meshes){if(a>1){e+="</tr><tr>";a=0}a++;b++;var d=meshes[i].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var f="Partial Rights";if(d==4294967295){f="Full Administrator"}else{if(d==0){f="No Rights"}}e+="<div onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=display:inline-block;width:431px;height:50px;padding-top:1px;padding-bottom:1px;float:left><div style=float:left;width:30px;height:100%></div><div style=height:100%;cursor:pointer onclick=gotoMesh('"+i+"')><div class=mi style=float:left;width:50px;height:50px></div><div style=height:100%><div class=g1></div><div class=e2 style=width:300px><div class=e1>"+EscapeHtml(meshes[i].name)+"</div><div>"+f+"</div></div><div class=g2 style=float:left></div></div></div></div>"}meshcount=b;QH("p2meshes",e);QV("p2noMeshFound",b==0)}function gotoMesh(a){currentMesh=meshes[a];p20updateMesh();go(20)}function server_showRestoreDlg(){if(xxdialogMode){return}var a="Restore the server using a backup, <span style=color:red>this will delete the existing server data</span>. Only do this if you know what you are doing.<br /><br />";a+='<form action="/restoreserver.ashx" enctype="multipart/form-data" method="post"><div>';a+='<input id=account_dlgFileInput type=file name=datafile style=width:100% accept=".zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed" onchange=account_validateServerRestore()>';a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+="<input id=account_dlgOkButton type=submit value=OK style=float:right;width:80px onclick=dialogclose(1)>";a+="</div><br /><br /></form>";setDialogMode(2,"Restore Server",0,null,a);account_validateServerRestore()}function account_validateServerRestore(){QE("account_dlgOkButton",Q("account_dlgFileInput").files.length==1)}function server_showVersionDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Version",1,null,"Loading...","MeshCentralServerUpdate");meshserver.send({action:"serverversion"})}function server_showVersionDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showVersionDlgEx(){meshserver.send({action:"serverupdate"})}function server_showErrorsDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Errors",1,null,"Loading...","MeshCentralServerErrors");meshserver.send({action:"servererrors"})}function server_showErrorsDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showErrorsDlgEx(){meshserver.send({action:"serverclearerrorlog"})}var currentMesh;function p20updateMesh(){if(currentMesh==null){return}QH("p20meshName",EscapeHtml(currentMesh.name));var f="Unknown #"+currentMesh.mtype;var e=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(currentMesh.mtype==1){f="Intel® AMT only, no agent"}if(currentMesh.mtype==2){f="Managed using a software agent"}var l="";l+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(e&1)!=0));l+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&¤tMesh.desc!="")?EscapeHtml(currentMesh.desc):"<i>None</i>"),"p20editmesh(2)",(e&1)!=0));var d=[];if(currentMesh.flags){if(currentMesh.flags&1){d.push("Auto-Remove")}}d=d.join(", ");if(d==""){d="<i>None</i>"}l+=addHtmlValue("Features",addLinkConditional(d,"p20editmeshfeatures()",(e&1)!=0));l+=addHtmlValue("Type",f);if(e&1){l+='<br><input type=button value=Notes title="View notes about this device group" onclick=showNotes(false,"'+encodeURIComponent(currentMesh._id)+'") />'}l+="<br style=clear:both><br>";var b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(b&&((b.rights&2)!=0)){l+="<a onclick=p20showAddMeshUserDialog() style=cursor:pointer;margin-right:10px><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a>"}if((e&4)!=0){if(currentMesh.mtype==1){l+='<a onclick=addCiraDeviceToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new Intel® AMT computer that is located on the internet."><img src=images/icon-installmesh.png border=0 height=12 width=12> Install CIRA</a>';l+='<a onclick=addDeviceToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new Intel® AMT computer that is located on the local network."><img src=images/icon-installmesh.png border=0 height=12 width=12> Install local</a>'}if(currentMesh.mtype==2){l+='<a onclick=addAgentToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Add a new computer to this mesh by installing the mesh agent."><img src=images/icon-addnew.png border=0 height=12 width=12> Install</a>';if(features&64){l+='<a onclick=inviteAgentToMesh("'+currentMesh._id+'") style=cursor:pointer;margin-right:10px title="Invite someone to install the mesh agent on this mesh."><img src=images/icon-addnew.png border=0 height=12 width=12> Invite</a>'}}}l+='<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th><th scope=col style=text-align:left></th></tr>';var a=1,j=[];for(var c in currentMesh.links){j.push({id:c,name:c.split("/")[2],rights:currentMesh.links[c].rights})}j.sort(function(m,n){if(m.name>n.name){return 1}if(m.name<n.name){return -1}return 0});for(var c in j){var k="",h="Partial Rights",g=j[c].rights;if(g==4294967295){h="Full Administrator"}else{if(g==0){h="No Rights"}}if((c!=userinfo._id)&&(e==4294967295||(((e&2)!=0)))){k='<a onclick=p20deleteUser(event,"'+encodeURIComponent(j[c].id)+'") title="Remote user rights to this mesh" style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'}l+='<tr onclick=p20viewuser("'+encodeURIComponent(j[c].id)+'") style=cursor:pointer'+(((a%2)==0)?";background-color:#DDD":"")+'><td><div title="User" class=m2></div><div> '+j[c].name+"<div></div></div></td><td><div style=float:right>"+k+"</div><div>"+h+"</div></td></tr>";++a}l+="</tbody></table>";if(e==4294967295){l+="<div style=font-size:x-small;text-align:right><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Mesh</a></span></div>"}QH("p20info",l)}function p20showDeleteMeshDialog(){if(xxdialogMode){return}var a='Are you sure you want to delete mesh "'+EscapeHtml(currentMesh.name)+'"? Deleting the mesh will also delete all information about computers within this mesh.<br /><br />';a+="<input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm";setDialogMode(2,"Delete Mesh",3,p20showDeleteMeshDialogEx,a);p20validateDeleteMeshDialog()}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(a,b){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(a){if(xxdialogMode){return}var b=addHtmlValue("Name","<input id=dp20meshname style=width:230px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");b+=addHtmlValue("Description","<div style=width:230px;margin:0;padding:0><textarea id=dp20meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"Edit Device Group",3,p20editmeshEx,b);Q("dp20meshname").value=currentMesh.name;if(currentMesh.desc){Q("dp20meshdesc").value=currentMesh.desc}p20editmeshValidate();if(a==2){Q("dp20meshdesc").focus()}else{Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",Q("dp20meshname").value.length>0)}function p20editmeshfeatures(){if(xxdialogMode){return}var a=(currentMesh.flags)?currentMesh.flags:0;var b="<div><input type=checkbox id=d20flag1 "+((a&1)?"checked":"")+">Remove device on disconnect<br></div>";setDialogMode(2,"Edit Device Group Features",3,p20editmeshfeaturesEx,b)}function p20editmeshfeaturesEx(){var a=0;if(Q("d20flag1").checked){a+=1}meshserver.send({action:"editmesh",meshid:currentMesh._id,flags:a})}function p20showAddMeshUserDialog(){if(xxdialogMode){return}var a="Allow a user to manage this device group and devices in this group<br /><br />";a+=addHtmlValue("User Name","<input id=dp20username style=width:230px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");a+="<br><div>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Device Group<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Device Group Users<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Device Group Computers<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remoteview>Remote View Only<br>";a+="</div>";setDialogMode(2,"Add User to Device Group",3,p20showAddMeshUserDialogEx,a);p20validateAddMeshUserDialog();Q("dp20username").focus()}function p20validateAddMeshUserDialog(){var a=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;QE("idx_dlgOkButton",(Q("dp20username").value.length>0));QE("p20fulladmin",a==4294967295);QE("p20editmesh",(!Q("p20fulladmin").checked)&&(a==4294967295));QE("p20manageusers",!Q("p20fulladmin").checked);QE("p20managecomputers",!Q("p20fulladmin").checked);QE("p20remotecontrol",!Q("p20fulladmin").checked);QE("p20meshagentconsole",!Q("p20fulladmin").checked);QE("p20meshserverfiles",!Q("p20fulladmin").checked);QE("p20wakedevices",!Q("p20fulladmin").checked);QE("p20editnotes",!Q("p20fulladmin").checked);QE("p20remoteview",!Q("p20fulladmin").checked)}function p20showAddMeshUserDialogEx(){var a=0;if(Q("p20fulladmin").checked==true){a=4294967295}else{if(Q("p20editmesh").checked==true){a+=1}if(Q("p20manageusers").checked==true){a+=2}if(Q("p20managecomputers").checked==true){a+=4}if(Q("p20remotecontrol").checked==true){a+=8}if(Q("p20meshagentconsole").checked==true){a+=16}if(Q("p20meshserverfiles").checked==true){a+=32}if(Q("p20wakedevices").checked==true){a+=64}if(Q("p20editnotes").checked==true){a+=128}if(Q("p20remoteview").checked==true){a+=256}}meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:a})}function p20viewuser(e){if(xxdialogMode){return}e=decodeURIComponent(e);var d="",b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights,c=currentMesh.links[e].rights;if(c==4294967295){d=", Full Administrator (all rights)"}else{if((c&1)!=0){d+=", Edit Device Group"}if((c&2)!=0){d+=", Manage Device Group Users"}if((c&4)!=0){d+=", Manage Device Group Computers"}if((c&8)!=0){d+=", Remote Control"}if((c&16)!=0){d+=", Agent Console"}if((c&32)!=0){d+=", Server Files"}if((c&64)!=0){d+=", Wake Devices"}if((c&128)!=0){d+=", Edit Notes"}if((c&256)!=0){d+=", Remote View Only"}}d=d.substring(2);if(d==""){d="No Rights"}var a=1,f=addHtmlValue("User Name",e.split("/")[2]);f+=addHtmlValue("Permissions",d);if((("user/"+domain+"/"+userinfo.name.toLowerCase())!=e)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){a+=4}setDialogMode(2,"Device Group User",a,p20viewuserEx,f,e)}function p20viewuserEx(a,b){if(a!=2){return}setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,"Confirm removal of user "+b.split("/")[2]+"?",b)}function p20deleteUser(a,b){haltEvent(a);p20viewuserEx(2,decodeURIComponent(b))}function p20viewuserEx2(a,b){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:b})}var filetreelinkpath;var filetreelocation=[];function updateFiles(){QV("MainMenuMyFiles",((features&8)==0));if((features&8)!=0){return}var q="",r="",c="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",o="Root",y,k=filetree,m=1;var j=[],v=filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var s=0;s<a.length;s++){if(a[s].checked){b.push(a[s].value)}}filetreelinkpath="";for(var s in filetreelocation){if((k.f!=null)&&(k.f[filetreelocation[s]]!=null)){j.push(filetreelocation[s]);o+=" / "+filetreelocation[s];if((m==1)){var B=filetreelocation[s].split("/");y=window.location+B[0]+"files/"+B[2];filetreelinkpath+=filetreelocation[s]}else{if(filetreelinkpath!=""){filetreelinkpath+="/"+filetreelocation[s];if(m>2){y+="/"+filetreelocation[s]}}}k=k.f[filetreelocation[s]];c+=" / <a style=cursor:pointer onclick=p5folderup("+m+")>"+(k.n!=null?k.n:filetreelocation[s])+"</a>";m++}else{break}}filetreelocation=j;var w=o.toLowerCase().startsWith("root / "+userinfo._id+" / public");var l=p5sort_files(k.f);for(var s in l){var d=l[s],u=d.n,A;A=u;if(u.length>70){A='<span title="'+EscapeHtml(u)+'">'+EscapeHtml(u.substring(0,70))+"...</span>"}else{A=EscapeHtml(u)}u=EscapeHtml(u);var g="";if(d.d!=null){var e=new Date(d.d),g=(e.getMonth()+1)+"/"+(e.getDate())+"/"+e.getFullYear()+" "+e.toLocaleTimeString()+" "}var n="";if(d.s!=null){n=getFileSizeStr(d.s)}var p="";if(d.t<3||d.t==4){var z=(d.t==1||d.t==4)?p5getQuotabar(d):"",C="";p="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+u+"'> <span style=float:right title=\""+C+'">'+z+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(d.nx)+'")>'+A+"</a></span></div>"}else{var t=A;var x="";if(w){x=' (<a style=cursor:pointer title="Display public link" onclick=\'p5showPublicLink("'+y+"/"+d.nx+"\")'>Link</a>)"}if(d.s>0){t='<a rel="noreferrer noopener" target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+d.nx)+'">'+A+"</a>"+x}p="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+d.nx+"'> <span class=fsize>"+g+"</span><span style=float:right>"+n+"</span><span><div class=fileIcon"+d.t+"></div>"+t+"</span></div>"}if(d.t<3){q+=p}else{r+=p}}QH("p5rightOfButtons",p5getQuotabar(k));QH("p5files",q+r);QH("p5currentpath",c);QE("p5FolderUp",filetreelocation.length!=0);QV("p5PublicShare",w);if(v==filetreelinkpath){a=document.getElementsByName("fc");for(var s=0;s<a.length;s++){a[s].checked=(b.indexOf(a[s].value)>=0)}}p5setActions()}function getNiceSize(a){if(a<=0){return"Storage limit exceed"}if(a<2048){return a+" bytes remaining"}if(a<2097152){return Math.round(a/1024)+" kilobytes remaining"}if(a<2147483648){return Math.round(a/1024/1024)+" megabytes remaining"}return Math.round(a/1024/1024/1024)+" gigabytes remaining"}function getNiceSize2(a){if(a<=0){return"None"}if(a<2048){return a+" b"}if(a<2097152){return Math.round(a/1024)+" Kb"}if(a<2147483648){return Math.round(a/1024/1024)+" Mb"}return Math.round(a/1024/1024/1024)+" Gb"}function p5getQuotabar(a){while(a.t>1&&a.t!=4){a=a.parent}if((a.t!=1&&a.t!=4)||(a.maxbytes==null)){return""}var b=Math.floor(a.s/1024),c=(a.maxbytes-a.s);return'<span title="'+b+"k in "+a.c+" file"+(a.c>1?"s":"")+". "+(Math.floor(a.maxbytes/1024/1024))+'k maxinum">'+getNiceSize(c)+" <progress style=height:10px;width:100px value="+a.s+" max="+a.maxbytes+" /></span>"}function p5showPublicLink(a){setDialogMode(2,"Public Link",1,null,'<input type=text style=width:100% value="'+a+'" readonly />')}var sortorder;function p5sort_filename(c,d){if(c.ln>d.ln){return(1*sortorder)}if(c.ln<d.ln){return(-1*sortorder)}return 0}function p5sort_timestamp(c,d){if(c.d>d.d){return(1*sortorder)}if(c.d<d.d){return(-1*sortorder)}return 0}function p5sort_bysize(c,d){if(c.s==d.s){return p5sort_filename(c,d)}return(((c.s-d.s))*sortorder)}function p5sort_files(a){var c=[],d=Q("p5sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}sortorder=1;if(d>3){sortorder=-1;d-=3}if(d==1){c.sort(p5sort_filename)}else{if(d==2){c.sort(p5sort_bysize)}else{if(d==3){c.sort(p5sort_timestamp)}}}return c}function p5setActions(){var a=getFileSelCount(),c=getFileCount(),b=getFileSelCount(false);QE("p5DeleteFileButton",(a>0)&&(filetreelocation.length>0));QE("p5NewFolderButton",filetreelocation.length>0);QE("p5UploadButton",filetreelocation.length>0);QE("p5RenameFileButton",(a==1)&&(filetreelocation.length>0));QE("p5SelectAllButton",c>0);Q("p5SelectAllButton").value=(a>0?"Select None":"Select All");QE("p5CutButton",(b>0)&&(a==b));QE("p5CopyButton",(b>0)&&(a==b));QE("p5PasteButton",(p5clipboard!=null)&&(p5clipboard.length>0)&&(filetreelocation.length>0))}function getFileSelCount(d){var a=0,b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileSelDirCount(){var a=0,b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&(b[c].attributes.file.value=="999")){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}function p5selectallfile(){var c=(getFileSelCount()==0),a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){a[b].checked=c}p5setActions()}function setupBackPointers(d){if(d.f!=null){var b=0,a=0;for(var c in d.f){setupBackPointers(d.f[c]);d.f[c].parent=d;if(d.f[c].s){b+=d.f[c].s}if(d.f[c].c){a+=d.f[c].c}if(d.f[c].t==3){a++}}d.s=b;d.c=a}return d}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function p5folderup(a){if(a==null){filetreelocation.pop()}else{while(filetreelocation.length>a){filetreelocation.pop()}}updateFiles()}function p5folderset(a){filetreelocation.push(decodeURIComponent(a));updateFiles()}function p5createfolder(){setDialogMode(2,"New Folder",3,p5createfolderEx,"<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />");focusTextBox("p5renameinput");p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var a=getFileSelCount(),b=(getFileSelDirCount()>0)?"<br /><br /><input type=checkbox id=p5recdeleteinput>Recursive delete<br>":"<input type=checkbox id=p5recdeleteinput style='display:none'>";setDialogMode(2,"Delete",3,p5deletefileEx,(a>1)?("Delete "+a+" selected items?"+b):("Delete selected item?"+b))}function p5deletefileEx(){var b=[],a=document.getElementsByName("fc");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(a[c].value)}}meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:b,rec:Q("p5recdeleteinput").checked})}function p5renamefile(){var c,a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){if(a[b].checked){c=a[b].value}}setDialogMode(2,"Rename",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:c});focusTextBox("p5renameinput");p5fileNameCheck()}function p5renamefileEx(a,c){c.newname=Q("p5renameinput").value;meshserver.send(c)}function p5fileNameCheck(a){var b=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a&&a.keyCode==13)){dialogclose(1)}}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value="'+encodeURIComponent(filetreelinkpath)+'" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=submit id=p5loginSubmit style=display:none /></form>');updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(b){var a=document.getElementsByName("fc");p5clipboard=[];p5clipboardCut=b,p5clipboardFolder=Clone(filetreelocation);for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p5clipboard.push(a[c].value)}}p5updateClipview()}function p5pasteFile(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Confim "+(p5clipboardCut==0?"copy":"move")+" of "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p5pasteFileEx,a)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:(p5clipboardCut==0?"copy":"move"),scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard});p5folderup(999);if(p5clipboardCut==1){p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;p5updateClipview()}}function p5updateClipview(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Holding "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" for "+(p5clipboardCut==0?"copy":"move")+", <a onclick=p5clearClip() style=cursor:pointer>Clear</a>."}QH("p5bottomstatus",a);p5setActions()}function p5clearClip(){p5clipboard=null;p5clipboardFolder=null;p5clipboardCut=0;p5updateClipview()}function p5fileDragDrop(b){if(xxdialogMode){return}haltEvent(b);QV("bigfail",false);QV("bigok",false);var c=0;p5uploadFile();try{Q("p5uploadinput").files=b.dataTransfer.files}catch(d){c=1}if(c==0){p5uploadFileEx()}setDialogMode(0);if(c==1){if(b.dataTransfer==null||b.dataTransfer.files.length==0||filetreelocation.length==0){return}var h=[],l=[],n=[],a=[],k=b.dataTransfer.files.length,m=0;for(var g=0;g<b.dataTransfer.files.length;g++){m+=b.dataTransfer.files[g].size}if(m>1300000){p5uploadFile();return}for(var g=0;g<b.dataTransfer.files.length;g++){var j=new FileReader(),f=b.dataTransfer.files[g];h.push(f.name);l.push(f.size);n.push(f.type);j.onload=function(e){a.push(e.target.result);if(--k==0){Q("p5fileDragName").value=h.join("*");Q("p5fileDragSize").value=l.join("*");Q("p5fileDragType").value=n.join("*");Q("p5fileDragData").value=a.join("*");Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath);Q("p5loginSubmit2").click()}};j.readAsDataURL(f)}}}var p5dragtimer=null;function p5fileDragOver(b){if(xxdialogMode){return}haltEvent(b);if(p5dragtimer!=null){clearTimeout(p5dragtimer);p5dragtimer=null}var a=true;if(filetreelocation.length==0){a=false}QV("bigok",a);QV("bigfail",!a)}function p5fileDragLeave(a){if(xxdialogMode){return}haltEvent(a);if(a.target.id!="p5filetable"){QV("bigfail",false);QV("bigok",false)}else{p5dragtimer=setTimeout(function(){QV("bigfail",false);QV("bigok",false);p5dragtimer=null},10)}}function eventMouseHover(a,b){a.children[1].classList.remove("g1s");a.children[2].style["background-color"]=((b==0)?"#c9c9c9":"#b9b9b9");a.children[3].classList.remove("g2s");if(b==1){a.children[1].classList.add("g1s");a.children[3].classList.add("g2s")}}function eventsUpdate(){var g="",a=null;for(var c in events){var b=events[c];var f=new Date(b.time);if(f.toLocaleDateString()!=a){if(a!=null){g+="</table>"}g+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td colspan=4 class=DevSt>"+f.toLocaleDateString()+"</td></tr>";a=f.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var e=b.msg.split("(R)").join("®");if(b.username&&b.username!=userinfo.name){e+=": "+b.username}g+="<tr onmouseover=eventMouseHover(this,1) onmouseout=eventMouseHover(this,0) style=cursor:pointer><td style=width:18px><div class="+d+"></div></td><td class=g1 style=float:none> </td><td style=background-color:#C9C9C9>"+f.toLocaleTimeString()+" - "+e+"</td><td class=g2 style=float:none> </td></tr><tr style=height:2px></tr>"}if(a!=null){g+="</table>"}if(g==""){g="<br><i>No Events Found</i><br><br>"}QH("p3events",g)}function showDeleteAllEventsDialog(){if(xxdialogMode){return}var a="Delete all events in the server event log?<br /><br />";a+="<input id=p3check type=checkbox onchange=validateDeleteAllEventsDialog() />Confirm";setDialogMode(2,"Delete All Events",3,showDeleteAllEventsDialogEx,a);validateDeleteAllEventsDialog()}function validateDeleteAllEventsDialog(){QE("idx_dlgOkButton",Q("p3check").checked)}function showDeleteAllEventsDialogEx(a,b){meshserver.send({action:"clearevents"})}function refreshEvents(){meshserver.send({action:"events",limit:parseInt(p3limitdropdown.value)})}function updateUsers(){QV("MainMenuMyUsers",(users!=null)&&((features&4)==0));QV("LeftMenuMyUsers",(users!=null)&&((features&4)==0));if((users==null)||((features&4)!=0)){QH("p3users","");return}var f=[],d=100,b=0;for(var c in users){f.push(c)}f.sort();var h=Q("UserSearchInput").value.toLowerCase();var j="<table style=width:100% cellpadding=0 cellspacing=0>",a=true;for(var c in f){var g=users[f[c]],e=null;if(wssessions!=null){e=wssessions[g._id]}if((e!=null)&&(g.name.toLowerCase().indexOf(h)>=0)){if(d>0){if(a){j+="<tr><td class=userTableHeader>Online Users";a=false}j+=addUserHtml(g,e);d--}else{b++}}}a=true;for(var c in f){var g=users[f[c]],e=null;if(wssessions!=null){e=wssessions[g._id]}if((e==null)&&(g.name.toLowerCase().indexOf(h)>=0)){if(d>0){if(a){j+="<tr><td class=userTableHeader>Offline Users";a=false}j+=addUserHtml(g,e);d--}else{b++}}}j+="</table>";if(b==1){j+="<br />1 more user not shown, use search box to look for users...<br />"}else{if(b>1){j+="<br />"+b+" more users not shown, use search box to look for users...<br />"}}if(d==100){j+="<br />No users found.<br />"}QH("p3users",j);if((currentUser!=null)&&(xxcurrentView==30)){gotoUser(encodeURIComponent(currentUser._id),true)}}function addUserHtml(h,g){var k="",b=" gray",c="m2",d="",e="",f=(h.name!=userinfo.name);if(g!=null){b="";if(f){e='<span style=float:right;margin-top:1px;margin-right:4px title=Chat><a onclick=userChat(event,"'+encodeURIComponent(h._id)+'","'+encodeURIComponent(h.name)+"\")><img src='images/icon-chat.png' height=16 width=16 style=padding-top:2px /></a></span>";e+='<span style=float:right;margin-top:1px;margin-left:4px;margin-right:4px title=Notify><a onclick=showUserAlertDialog(event,"'+encodeURIComponent(h._id)+"\")><img src='images/icon-notify.png' height=16 width=16 style=padding-top:2px /></a></span>"}if(g==1){d+="1 active session"}else{d+=g+" active sessions"}}else{if(h.login){d+='<span title="Last login: '+new Date(h.login).toLocaleString()+'">'+new Date(h.login).toLocaleDateString()+"</span>"}}if(d!=""){d+=", "}if(f){d+='<a onclick=showUserAdminDialog(event,"'+encodeURIComponent(h._id)+'")>'}if((h.siteadmin!=null)&&((h.siteadmin&32)!=0)&&(h.siteadmin!=4294967295)){d+="Locked, "}d+="<span title='Server Permissions'>";if((h.siteadmin==null)||(h.siteadmin==0)||(h.siteadmin==32)){d+="User"}else{if(h.siteadmin==8){d+="User with server files"}else{if(h.siteadmin==4294967295){d+="Administrator"}else{d+="Partial"}}}d+="</span>";if((h.quota!=null)&&((h.siteadmin&8)!=0)){d+=", "+(h.quota/1024)+" k"}if(f){d+="</a>"}var j=EscapeHtml(h.name),a="";if(serverinfo.emailcheck==true){a=((h.emailVerified!=true)?' <b style=color:red title="Email is not verified">🗴</b>':' <b style=color:green title="Email is verified">🗸</b>')}if(h.email!=null){j+=', <a onclick=doemail(event,"'+h.email+'")>'+h.email+"</a>"+a}k+='<tr onmouseover=userMouseHover(this,1) onmouseout=userMouseHover(this,0)><td style=cursor:pointer onclick=gotoUser("'+encodeURIComponent(h._id)+'")>';k+="<div class=bar style=height:24px;width:100%;font-size:medium>";k+='<div style=float:left;height:24px;width:24px;background-color:white><div class="'+c+b+'" style=width:16px;margin-top:4px;margin-left:2px;height:16px></div></div>';k+="<div class=g1 style=height:24px;float:left></div><div class=g2 style=height:24px;float:right></div>";k+="<div><span>"+j+"</span>"+e+"<span style=float:right>"+d+"</span></div></div>";return k}function userMouseHover(b,c){var a=b.children[0].children[0];a.children[1].classList.remove("g1s");a.children[2].classList.remove("g2s");if(c==1){a.children[1].classList.add("g1s");a.children[2].classList.add("g2s")}b.children[0].children[0].style["background-color"]=((c==0)?"#c9c9c9":"#b9b9b9")}function userChat(a,c,b){haltEvent(a);window.open("/messenger?id=meshmessenger/"+c+"/"+encodeURIComponent(userinfo._id)+"&title="+b,"meshmessenger:"+c);meshserver.send({action:"meshmessenger",userid:decodeURIComponent(c)});return false}function showUserAlertDialog(a,b){if(xxdialogMode){return}haltEvent(a);setDialogMode(2,"Notify "+EscapeHtml(users[decodeURIComponent(b)].name),3,showUserAlertDialogEx,'Send a text notification to this user.<textarea id=d2notifyText maxlength=2048 style="width:100%;height:184px;resize:none"></textarea>',b);Q("d2notifyText").focus();return false}function showUserAlertDialogEx(a,b){meshserver.send({action:"notifyuser",userid:decodeURIComponent(b),msg:Q("d2notifyText").value})}function doemail(b,a){if(xxdialogMode){return}haltEvent(b);window.open("mailto:"+a);return false}function showCreateNewAccountDialog(){if(xxdialogMode){return}var a="";a+=addHtmlValue("Name","<input id=p4name style=width:230px maxlength=64 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Email","<input id=p4email style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass1 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass2 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");setDialogMode(2,"Create Account",3,showCreateNewAccountDialogEx,a);showCreateNewAccountDialogValidate();Q("p4name").focus()}function showCreateNewAccountDialogValidate(){if((Q("p4email").value.length>0)&&(validateEmail(Q("p4email").value))==false){QE("idx_dlgOkButton",false);return}QE("idx_dlgOkButton",(!Q("p4name")||((Q("p4name").value.length>0)&&(Q("p4name").value.indexOf(" ")==-1)))&&Q("p4pass1").value.length>0&&Q("p4pass1").value==Q("p4pass2").value&&checkPasswordRequirements(Q("p4pass1").value,passRequirements))}function showCreateNewAccountDialogEx(){meshserver.send({action:"adduser",username:Q("p4name").value,email:Q("p4email").value,pass:Q("p4pass1").value})}function showUserAdminDialog(a,c){if(xxdialogMode){return}haltEvent(a);c=decodeURIComponent(c);var d="<div>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fileaccess>Server Files, <input type=number onchange=showUserAdminDialogValidate() maxlength=10 style=width:80px;text-align:right id=ua_fileaccessquota>k max, blank for default<br><hr/>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fulladmin>Full Administrator<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverbackup>Server Backup<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverrestore>Server Restore<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverupdate>Server Updates<br>";d+="<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_manageusers>Manage Users<br>";d+="<hr/><input type=checkbox onchange=showUserAdminDialogValidate() id=ua_lockedaccount>Lock Account<br>";d+="</div>";var b=users[c.toLowerCase()];setDialogMode(2,"Server Permissions",3,showUserAdminDialogEx,d,b);if(b.siteadmin&&b.siteadmin!=0){Q("ua_fulladmin").checked=(b.siteadmin==4294967295);Q("ua_serverbackup").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&1)!=0));Q("ua_manageusers").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&2)!=0));Q("ua_serverrestore").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&4)!=0));Q("ua_fileaccess").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&8)!=0));Q("ua_serverupdate").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&16)!=0));Q("ua_lockedaccount").checked=((b.siteadmin!=4294967295)&&((b.siteadmin&32)!=0))}QE("ua_fulladmin",userinfo.siteadmin==4294967295);QE("ua_serverbackup",userinfo.siteadmin==4294967295);QE("ua_manageusers",userinfo.siteadmin==4294967295);QE("ua_serverrestore",userinfo.siteadmin==4294967295);QE("ua_fileaccess",userinfo.siteadmin==4294967295);QE("ua_serverupdate",userinfo.siteadmin==4294967295);Q("ua_fileaccessquota").value=(b.quota!=null)?(b.quota/1024):"";showUserAdminDialogValidate();return false}function showUserAdminDialogValidate(){if(userinfo.siteadmin==4294967295){QE("ua_serverbackup",!Q("ua_fulladmin").checked);QE("ua_manageusers",!Q("ua_fulladmin").checked);QE("ua_serverrestore",!Q("ua_fulladmin").checked);QE("ua_fileaccess",!Q("ua_fulladmin").checked);QE("ua_serverupdate",!Q("ua_fulladmin").checked);QE("ua_fileaccessquota",Q("ua_fileaccess").checked&&!Q("ua_fulladmin").checked)}}function showUserAdminDialogEx(a,d){var c=0,b=parseInt(Q("ua_fileaccessquota").value);if(Q("ua_fulladmin").checked==true){c=4294967295}else{if(Q("ua_serverbackup").checked==true){c+=1}if(Q("ua_manageusers").checked==true){c+=2}if(Q("ua_serverrestore").checked==true){c+=4}if(Q("ua_fileaccess").checked==true){c+=8}if(Q("ua_serverupdate").checked==true){c+=16}if(Q("ua_lockedaccount").checked==true){c+=32}}var e={action:"edituser",name:d.name,siteadmin:c};if(isNaN(b)==false){e.quota=(b*1024)}meshserver.send(e)}function onUserSearchInputChanged(){updateUsers()}var currentUser=null;function gotoUser(j,e){if(xxdialogMode&&!e){return}var h=currentUser=users[decodeURIComponent(j)];if(h==null){setDialogMode(0);go(4);return}QH("p30userName",h.name);QH("p31userName",h.name);var g=(h.name==userinfo.name),a=0;if(wssessions!=null&&wssessions[h._id]){a=wssessions[h._id]}Q("MainUserImage").classList.remove("gray");if(a==0){Q("MainUserImage").classList.add("gray")}var f="";if((h.siteadmin!=null)&&((h.siteadmin&32)!=0)&&(h.siteadmin!=4294967295)){f+="Locked account, "}if((h.siteadmin==null)||(h.siteadmin==0)||(h.siteadmin==32)){f+="No server rights"}else{if(h.siteadmin==8){f+="Access to server files"}else{if(h.siteadmin==4294967295){f+="Full administrator"}else{f+="Partial rights"}}}var k="<div style=min-height:80px><table style=width:100%>";var c=h.email?EscapeHtml(h.email):"<i>Not set</i>",d="";if(serverinfo.emailcheck){d=((h.emailVerified==true)?'<b style=color:green;cursor:pointer title="Email is verified">🗸</b> ':'<b style=color:red;cursor:pointer title="Email not verified">🗴</b> ')}k+=addDeviceAttribute("Email",d+'<a style=cursor:pointer onclick=p30showUserEmailChangeDialog(event,"'+j+'")>'+c+'</a> <a style=cursor:pointer onclick=doemail(event,"'+h.email+'")><img src="images/link1.png" /></a>');k+=addDeviceAttribute("Server Rights",'<a style=cursor:pointer onclick=showUserAdminDialog(event,"'+j+'")>'+f+"</a>");if(h.quota){k+=addDeviceAttribute("Server Quota",EscapeHtml(parseInt(h.quota)/1024)+" k")}k+=addDeviceAttribute("Creation",new Date(h.creation).toLocaleString());if(h.login){k+=addDeviceAttribute("Last Login",new Date(h.login).toLocaleString())}k+="</table></div><br />";k+='<input type=button value=Notes title="View notes about this user" onclick=showNotes(false,"'+j+'") />';if(!g&&(a>0)){k+='<input type=button value=Notify title="Send user notification" onclick=showUserAlertDialog(event,"'+j+'") />'}QH("p30html",k);drawUserTimeline();var b=true;if(h._id==userinfo._id){b=false}if(h.siteadmin&&h.siteadmin>0&&userinfo.siteadmin!=4294967295){b=false}k="<div style=float:right;font-size:x-small>";if(b){k+='<a style=cursor:pointer onclick=p30showDeleteUserDialog() title="Remove this user">Delete User</a>'}k+="</div><div style=font-size:x-small>";if(userinfo.siteadmin==4294967295){k+='<a style=cursor:pointer onclick=p30showUserChangePassDialog() title="Change the password for this user">Change Password</a>'}k+="</div><br>";QH("p30html3",k);k="";if(a==1){k="1 active session"}else{if(a>1){k=a+" active sessions"}}QH("MainUserState",k);go(30);QH("p31events","");refreshUsersEvents()}function p30showUserEmailChangeDialog(a){if(xxdialogMode){return}var b="";b+=addHtmlValue("Email","<input id=dp30email style=width:230px maxlength=32 onchange=p30validateEmail() onkeyup=p30validateEmail() />");if(serverinfo.emailcheck){b+=addHtmlValue("Status","<select id=dp30verified style=width:230px onchange=p30validateEmail()><option value=0>Not verified</option><option value=1>Verified</option></select>")}setDialogMode(2,"Change Email for "+EscapeHtml(currentUser.name),3,p30showUserEmailChangeDialogEx,b);Q("dp30email").focus();Q("dp30email").value=currentUser.email;if(serverinfo.emailcheck){Q("dp30verified").value=currentUser.emailVerified?1:0}p30validateEmail()}function p30validateEmail(){var a=Q("dp30email").value,b=a.split("@");b=(b.length==2)&&(b[0].length>0)&&(b[1].split(".").length>1)&&(b[1].length>2)&&(a.length<1024)&&((a!=userinfo.email)||((serverinfo.emailcheck==true)&&(Q("dp30verified").value!=(userinfo.emailVerified?1:0))));QE("idx_dlgOkButton",b)}function p30showUserEmailChangeDialogEx(){var a={action:"edituser",name:currentUser.name,email:Q("dp30email").value};if(serverinfo.emailcheck){a.emailVerified=(Q("dp30verified").value==1)}meshserver.send(a)}function p30showUserChangePassDialog(){if(xxdialogMode){return}var a="";a+=addHtmlValue("Password","<input id=p4pass1 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");a+=addHtmlValue("Password","<input id=p4pass2 type=password style=width:230px maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />");setDialogMode(2,"Change Password for "+EscapeHtml(currentUser.name),3,p30showUserChangePassDialogEx,a);showCreateNewAccountDialogValidate();Q("p4pass1").focus()}function p30showUserChangePassDialogEx(){if(Q("p4pass1").value==Q("p4pass2").value){meshserver.send({action:"changeuserpass",user:currentUser.name,pass:Q("p4pass1").value})}}function p30showDeleteUserDialog(){if(xxdialogMode){return}setDialogMode(2,"Delete User "+EscapeHtml(currentUser.name),3,p30showDeleteUserDialogEx,"Confirm deletion of user "+EscapeHtml(currentUser.name)+"?")}function p30showDeleteUserDialogEx(){meshserver.send({action:"deleteuser",userid:currentUser._id,username:currentUser.name})}function drawUserTimeline(){var r=null,n=Date.now();r=[];var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var t=e.getTime();var s=[];if(r!=null&&r.length>1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l<r.length;l+=2){var o=r[l],h=n;if(r.length>(l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var y="",b=1,g=new Date();g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var v=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var w=Math.round((q-v)/112794);if(w>0){var u=powerStateStrings2[a[2]]+" from "+new Date(v).toLocaleTimeString()+" to "+new Date(q).toLocaleTimeString()+".";f+='<div title="'+u+'" style=display:table-cell;width:'+w+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}y+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div> "+g.toLocaleDateString()+"<div></div></div></td><td><div>"+f+"</div></td></tr>";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p30html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>Day</th><th scope=col style=text-align:center>7 Day Login State</th></tr>'+y+"</tbody></table>")}var currentUserEvents=null;function userEventsUpdate(){var g="",a=null;for(var c in currentUserEvents){var b=currentUserEvents[c];var f=new Date(b.time);if(f.toLocaleDateString()!=a){if(a!=null){g+="</table>"}g+="<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>"+f.toLocaleDateString()+"</td></tr>";a=f.toLocaleDateString()}var d="si3";if(b.etype=="user"){d="m2"}if(b.etype=="server"){d="si3"}var e=b.msg.split("(R)").join("®");if(b.username&&b.username!=userinfo.name){e+=": "+b.username}g+="<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>";g+="<div style=float:left;height:18px;width:18px;background-color:white><div class="+d+" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>";g+="<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>";g+="<div style=font-size:14px><span style=width:300px>"+f.toLocaleTimeString()+" - "+e+"</span></div></div></td></tr>"}if(a!=null){g+="</table>"}if(g==""){g="<br><i>No Events Found</i><br><br>"}QH("p31events",g)}function refreshUsersEvents(){meshserver.send({action:"events",limit:parseInt(p31limitdropdown.value),user:currentUser.name})}function d3init(){Q("d3localFile").value="";d3modechange()}function d3modechange(){var a=Q("d3uploadMode").value;QV("d3localmode",a==1);QV("d3servermode",a==2);if(a==1){d3setActions()}else{d3updatefiles()}}var d3filetreelinkpath;var d3filetreelocation=[];function d3updatefiles(){if(Q("d3uploadMode").value==1){return}var m="",n="",e=filetree,j=1;var c=[],r=d3filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var o=0;o<a.length;o++){if(a[o].checked){b.push(a[o].value)}}d3filetreelinkpath="";for(var o in d3filetreelocation){if((e.f!=null)&&(e.f[d3filetreelocation[o]]!=null)){c.push(d3filetreelocation[o]);if((j==1)){var t=d3filetreelocation[o].split("/");publicPath=window.location+t[0]+"files/"+t[2];if(d3filetreelocation[o]===userinfo._id){d3filetreelinkpath+="self"}else{d3filetreelinkpath+=(t[0]+"/"+t[2])}}else{if(d3filetreelinkpath!=""){d3filetreelinkpath+="/"+d3filetreelocation[o];if(j>2){publicPath+="/"+d3filetreelocation[o]}}}e=e.f[d3filetreelocation[o]];j++}else{break}}d3filetreelocation=c;var g=p5sort_files(e.f);for(var o in g){var d=g[o],q=d.n,s;s=q;if(q.length>70){s='<span title="'+EscapeHtml(q)+'">'+EscapeHtml(q.substring(0,70))+"...</span>"}else{s=EscapeHtml(q)}q=EscapeHtml(q);var k="";if(d.s!=null){k=getFileSizeStr(d.s)}var l="";if(d.t<3){var u="";l='<div class=filelist file=999><span style=float:right title="'+u+'"></span><span><div class=fileIcon'+d.t+'></div> <a style=cursor:pointer onclick=d3folderset("'+encodeURIComponent(d.nx)+'")>'+s+"</a></span></div>"}else{var p=s;l="<div class=filelist file=3><input style=float:left name=fcx class=fcb type=checkbox onchange=d3setActions() value='"+d.nx+"'> <span style=float:right>"+k+"</span><span><div class=fileIcon"+d.t+"></div>"+p+"</span></div>"}if(d.t<3){m+=l}else{n+=l}}QH("d3serverfiles",m+n);QE("p3FolderUp",d3filetreelocation.length>0);d3setActions()}function d3folderset(a){d3filetreelocation.push(decodeURIComponent(a));d3updatefiles()}function d3folderup(a){if(a==null){d3filetreelocation.pop()}else{while(d3filetreelocation.length>a){d3filetreelocation.pop()}}d3updatefiles()}function d3getFileSel(){var a=[];var b=document.getElementsByName("fcx");for(var c=0;c<b.length;c++){if(b[c].checked){a.push(b[c].value)}}return a}function d3setActions(){var a=Q("d3uploadMode").value;if(a==1){QE("idx_dlgOkButton",Q("d3localFile").value.length>0)}else{QE("idx_dlgOkButton",d3getFileSel().length==1)}}var notifications=[];function clickNotificationIcon(a){if(a==true){QV("notifiyBox",true)}else{if(a==false){QV("notifiyBox",false)}else{QV("notifiyBox",QS("notifiyBox")["display"]=="none")}}drawNotifications()}function setNotificationCount(a){if(parseInt(Q("notificationCount").innerHTML)==a){return}QH("notificationCount",a);QS("notificationCount")["background-color"]=(a==0)?"lightblue":"orange";QV("notificationCount",a>0)}function drawNotifications(){var h="";if(notifications.length==0){h="<div style=margin:5px>There are currently no notifications</div>"}else{for(var c in notifications){var f=notifications[c];var j="";var a=new Date(f.time);var e=0;if(f.nodeid!=null){var g=getNodeFromId(f.nodeid);if(g!=null){e=g.icon;j="<b>"+g.name+"</b>: "}}h+='<div title="Occured at '+a.toLocaleString()+'" id="notifyx'+f.id+'" class=notification style="cursor:pointer;border-top:1px solid '+((h=="")?"transparent":"orange")+'"><div class=j'+e+' onclick="notificationSelected('+f.id+')" style=margin:5px;float:left></div><div onclick="notificationDelete('+f.id+')" class=unselectable title="Clear this notification" style=margin:5px;float:right;color:orange><b>X</b></div><div onclick="notificationSelected('+f.id+')" style=margin:5px>'+j+f.text+"</div></div>"}}var b="";if(notifications.length>1){b='<div id="notifyRemoveAll" onclick="deleteAllNotifications()" style="cursor:pointer;border-top:1px solid orange;margin:5px;color:orange;text-align:right;padding-right:3px">Clear all</div>'}QH("notifiyBox",'<div class=customScroll style="max-height:170px;overflow-y:auto;margin:5px">'+h+"</div>"+b)}function notificationSelected(b){var c=-1;for(var a in notifications){if(notifications[a].id==b){c=a}}if(c!=-1){var d=notifications[c];if(d.nodeid!=null){if(d.tag=="desktop"){gotoDevice(d.nodeid,12)}else{if(d.tag=="terminal"){gotoDevice(d.nodeid,11)}else{if(d.tag=="files"){gotoDevice(d.nodeid,13)}else{if(d.tag=="intelamt"){gotoDevice(d.nodeid,14)}else{if(d.tag=="console"){gotoDevice(d.nodeid,15)}else{gotoDevice(d.nodeid,10)}}}}}}else{if(d.tag.startsWith("meshmessenger/")){window.open("/messenger?id="+d.tag+"&title="+encodeURIComponent(d.username),d.tag.split("/")[2]);notificationDelete(b)}}}}function notificationDelete(c){var d=-1,a=Q("notifyx"+c);if(a!=null){for(var b in notifications){if(notifications[b].id==c){d=b}}if(d!=-1){notifications.splice(d,1);a.parentNode.removeChild(a);setNotificationCount(notifications.length);if(notifications.length==0){QV("notifiyBox",false)}if(notifications.length==1){QV("notifyRemoveAll",false)}if((notifications.length>0)&&(d==0)){var f=notifications[0];QS("notifyx"+f.id)["border-top"]="1px solid transparent"}}}}function addNotification(a){if(a.time==null){a.time=Date.now()}if(a.id==null){a.id=Math.random()}notifications.unshift(a);setNotificationCount(notifications.length);Q("chimes").play();clickNotificationIcon(true)}function deleteAllNotifications(){notifications=[];setNotificationCount(0);drawNotifications();QV("notifiyBox",false)}function setupServerStats(){window.serverStatCpu=new Chart(document.getElementById("serverCpuChart").getContext("2d"),{type:"doughnut",data:{datasets:[{data:[0,0],backgroundColor:["#AAAAAA","#00AA00"]}],labels:["Used","Free"]},options:{responsive:true,legend:{position:"none",},animation:{animateScale:true,animateRotate:true},width:"60px"}});window.serverStatMemory=new Chart(document.getElementById("serverMemoryChart").getContext("2d"),{type:"doughnut",data:{datasets:[{data:[0,0],backgroundColor:["#AAAAAA","#00AA00"]}],labels:["Used","Free"]},options:{responsive:true,legend:{position:"none",},animation:{animateScale:true,animateRotate:true},width:"60px"}})}var lastServerStats=null;function updateServerStats(d){if(d!=null){lastServerStats=d}else{d=lastServerStats}if(d==null){return}if(typeof d.cpuavg=="object"){var c=Math.min(d.cpuavg[0],1);window.serverStatCpu.config.data.datasets[0].data=[c,1-c];QH("serverCpuChartText",'<div style=margin-bottom:5px>CPU Load</div><div><b title="CPU load in the last minute">'+(Math.round(d.cpuavg[0]*100)/100)+'</b>, <b title="CPU load in the last 5 minutes">'+(Math.round(d.cpuavg[1]*100)/100)+'</b>, <b title="CPU load in the 15 minutes">'+(Math.round(d.cpuavg[2]*100)/100)+"</b></div>");QS("serverCpuChartView")["display"]="inline-block";window.serverStatCpu.update()}if((typeof d.totalmem=="number")&&(typeof d.freemem=="number")){window.serverStatMemory.config.data.datasets[0].data=[d.totalmem-d.freemem,d.freemem];QH("serverMemoryChartText","<div style=margin-bottom:5px>Memory</div><div><b>"+getNiceSize2(d.freemem)+"</b> free, <b>"+getNiceSize2(d.totalmem)+"</b> total</div>");QS("serverMemoryChartView")["display"]="inline-block";window.serverStatMemory.update()}var e="<div style=width:100% cellpadding=0 cellspacing=0>";if(typeof d.values=="object"){for(var a in d.values){e+="<div class=userTableHeader style=margin-bottom:4px;width:200px>"+a+"</div>";for(var b in d.values[a]){e+="<div style=display:inline-block><table style=width:300px;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0><tr><td class=h1></td><td><span>"+b+"</span><span style=float:right>"+d.values[a][b]+"</span></td><td class=h2></td></tr></table></div>"}}}e+="</div>";QH("serverStatsTable",e)}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;var xxcurrentView=0;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgDeleteButton",a&4);QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc,a=xxdialogButtons,d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){if(xxcurrentView==11){deskAdjust()}else{if(xxcurrentView==10){masterUpdate(256)}else{if(xxcurrentView==1){masterUpdate(4)}}}}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function goBack(){if(xxdialogMode){return}if((xxcurrentView>=10)&&(xxcurrentView<20)){go(1)}if((xxcurrentView>=20)&&(xxcurrentView<30)){go(2)}if((xxcurrentView>=30)&&(xxcurrentView<40)){go(4)}}function go(d){if(xxdialogMode||xxcurrentView==d){return}for(var a=0;a<32;a++){QV("p"+a,a==d)}xxcurrentView=d;var b=["LeftMenuMyDevices","LeftMenuMyAccount","LeftMenuMyEvents","LeftMenuMyFiles","LeftMenuMyUsers","LeftMenuMyServer"];for(var a in b){Q(b[a]).classList.remove("lbbuttonsel");Q(b[a]).classList.remove("lbbuttonsel2")}QV("topbar",d!=0);if(d>=10&&d<20){QS("MainMenuMyDevices").backgroundColor="#606060"}else{QS("MainMenuMyDevices").backgroundColor=((d==1)?"#003366":"#808080")}if(d==1||(d>=10&&d<20)){Q("LeftMenuMyDevices").classList.add("lbbuttonsel")}if(d==1){Q("LeftMenuMyDevices").classList.add("lbbuttonsel2")}if(d>=20&&d<30){QS("MainMenuMyAccount").backgroundColor="#606060"}else{QS("MainMenuMyAccount").backgroundColor=((d==2)?"#003366":"#808080")}if(d==2||(d>=20&&d<30)){Q("LeftMenuMyAccount").classList.add("lbbuttonsel")}if(d==2){Q("LeftMenuMyAccount").classList.add("lbbuttonsel2")}QS("MainMenuMyEvents").backgroundColor=((d==3)?"#003366":"#808080");if(d==3){Q("LeftMenuMyEvents").classList.add("lbbuttonsel","lbbuttonsel2")}if(d>=30&&d<40){QS("MainMenuMyUsers").backgroundColor="#606060"}else{QS("MainMenuMyUsers").backgroundColor=((d==4)?"#003366":"#808080")}if(d==4||(d>=30&&d<40)){Q("LeftMenuMyUsers").classList.add("lbbuttonsel")}if(d==4){Q("LeftMenuMyUsers").classList.add("lbbuttonsel2")}QS("MainMenuMyFiles").backgroundColor=((d==5)?"#003366":"#808080");if(d==5){Q("LeftMenuMyFiles").classList.add("lbbuttonsel","lbbuttonsel2")}QS("MainMenuMyServer").backgroundColor=((d==6)?"#003366":"#808080");if(d==6){Q("LeftMenuMyServer").classList.add("lbbuttonsel","lbbuttonsel2")}if(webPageFullScreen){QS("column_l")["max-height"]="calc(100vh - 135px)"}else{QS("column_l")["max-height"]=(d>=10)?"calc(100vh - 159px)":"calc(100vh - 135px)"}if((d==0)&&(webPageFullScreen)){QS("page_content").position="";QV("page_leftbar",false);QS("column_l").height="calc(100vh - 110px)";QS("column_l")["max-height"]=""}QV("MainSubMenuSpan",d>=10&&d<20);QV("UserDummyMenuSpan",(d<10)&&webPageFullScreen);QV("MeshSubMenuSpan",d>=20&&d<30);QV("UserSubMenuSpan",d>=30&&d<40);var c={10:"MainDev",11:"MainDevDesktop",12:"MainDevTerminal",13:"MainDevFiles",14:"MainDevAmt",15:"MainDevConsole",20:"MeshGeneral",30:"UserGeneral",31:"UserEvents"};for(var a in c){Q(c[a]).classList.remove("style3x");Q(c[a]).classList.remove("style3sel");Q(c[a]).classList.add((d==a)?"style3sel":"style3x")}if(d==1){masterUpdate(4)}}function joinPaths(){var c=[];for(var a in arguments){var b=arguments[a];if((b!=null)&&(b!="")){while(b.endsWith("/")||b.endsWith("\\")){b=b.substring(0,b.length-1)}while(b.startsWith("/")||b.startsWith("\\")){b=b.substring(1)}c.push(b)}}return c.join("/")}function putstore(b,c){try{if(typeof(localStorage)==="undefined"){return}localStorage.setItem(b,c)}catch(a){}}function getstore(b,d){try{if(typeof(localStorage)==="undefined"){return d}var c=localStorage.getItem(b);if((c==null)||(c==null)){return d}return c}catch(a){return d}}function addLink(b,a){return"<span style=cursor:pointer;text-decoration:none onclick='"+a+"'>"+b+" <img class=hoverButton src=images/link5.png></span>"}function addLinkConditional(d,b,a){if(a){return addLink(d,b)}return d}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function addOption(c,d,a){var b=document.createElement("option");b.text=d;b.value=a;Q(c).add(b)}function passwordcheck(a){return(a.length>7)&&(/\d/.test(a))&&(/[a-z]/.test(a))&&(/[A-Z]/.test(a))&&(/\W/.test(a))}function methodcheck(a){if(a&&a!=null&&a.Body&&a.Body.ReturnValueStr!="SUCCESS"){messagebox("Call Error",a.Header.Method+": "+a.Body.ReturnValueStr.replace("_"," "));return true}return false}function TableStart(){return"<table cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=200px><p><td>"}function TableStart2(){return"<table cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><p><td>"}function TableEntry(a,b){return"<tr><td><p>"+a+"<td>"+b}function FullTable(c,a){var b=TableStart();for(i in c){if(i&&c[i]){b+=TableEntry(i,c[i])}}return b+TableEnd(a)}function TableEnd(a){return"<tr><td colspan=2><p>"+(a?a:"")+"</table>"}function AddButton(b,a){return"<input type=button value='"+b+"' onclick='"+a+"' style=margin:4px>"}function AddButton2(b,a){return"<input type=button value='"+b+"' onclick='"+a+"'>"}function AddRefreshButton(a){return"<input type=button name=refreshbtn value=Refresh onclick='refreshButtons(false);"+a+"' style=margin:4px "+(refreshButtonsState==false?"disabled":"")+">"}function MoreStart(){return'<a style=cursor:pointer;color:blue id=morexxx1 onclick=QV("morexxx1",false);QV("morexxx2",true)>▼ More</a><div id=morexxx2 style=display:none><br><hr>'}function MoreEnd(){return'<a style=cursor:pointer;color:blue onclick=QV("morexxx2",false);QV("morexxx1",true)>▲ Less</a></div>'}function getSelectedOptions(e){var d=[],c;for(var a=0,b=e.options.length;a<b;a++){c=e.options[a];if(c.selected){d.push(c.value)}}return d}function getInstance(b,c){for(var a in b){if(b[a]["InstanceID"]==c){return b[a]}}return null}function getItem(b,c,d){for(var a in b){if(b[a][c]==d){return b[a]}}return null}function guidToStr(a){return a.substring(6,8)+a.substring(4,6)+a.substring(2,4)+a.substring(0,2)+"-"+a.substring(10,12)+a.substring(8,10)+"-"+a.substring(14,16)+a.substring(12,14)+"-"+a.substring(16,20)+"-"+a.substring(20)}function getUrlVars(){var d,a,e=[],b=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(var c=0;c<b.length;c++){d=b[c].indexOf("=");if(d>0){e[b[c].substring(0,d)]=b[c].substring(d+1,b[c].length)}}return e}function addHtmlValue(a,b){return"<table><td style=width:120px>"+a+"<td><b>"+b+"</b></table>"}function addHtmlValue2(a,b){return"<div><div style=display:inline-block;float:right>"+b+"</div><div style=display:inline-block>"+a+"</div></div>"}function parseUriArgs(){var a,c={},b=window.document.location.href.split(/[\?&|\=]/);b.splice(0,1);for(d in b){switch(d%2){case 0:a=decodeURIComponent(b[d]);break;case 1:c[a]=decodeURIComponent(b[d]);var d=parseInt(c[a]);if(d==c[a]){c[a]=d}break;default:break}}return c}function focusTextBox(a){setTimeout(function(){Q(a).selectionStart=Q(a).selectionEnd=65535;Q(a).focus()},0)}function validateEmail(b){var a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return a.test(b)};</script></body></html>
\ No newline at end of file
views/default-mobile-min.handlebars
+1
-1
@@ -1 +1 @@
1
-<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <script type="text/javascript" src="scripts/filesaver.1.1.20151003.js"></script> <title>MeshCentral</title> <style> a{color:#036;text-decoration:underline;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;border:none;}.m0{background:url(../images/images16.png) -32px 0px;height:16px;width:16px;border:none;float:left;}.m1{background:url(../images/images16.png) -16px 0px;height:16px;width:16px;border:none;float:left;}.m2{background:url(../images/images16.png) -96px 0px;height:16px;width:16px;border:none;float:left;}.m3{background:url(../images/images16.png) -112px 0px;height:16px;width:16px;border:none;float:left;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.DevSt{padding-left:5px;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}</style> </head> <body onload="if (typeof(startup) !== 'undefined') startup();" style="overflow-y:hidden;margin:0;padding:0;border:0;color:black;font-size:13px;font-family:\'Trebuchet MS\', Arial, Helvetica, sans-serif"> <div id="container"> <div id="mastheadx"></div> <div id="masthead" style="background:url(logo.png) 0px 0px;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"> <div style="width:calc(100% - 50px);overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px"> <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px"> <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> </div> <img class="noselect" style="position:absolute;right:0;top:10px;bottom:50px;color:#c8c8c8;font-size:44px;margin-right:8px;cursor:pointer" onclick="topMenu()" src="/images/3bars-30.png" width="30" height="30"> </div> <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%"> <div id="column_l" style="width:100%;padding:0;position:absolute;bottom:0px;top:0px"> <div id="p0" style="display:none;width:100%;height:100%"> <div style="display:flex;align-items:center;width:100%;height:100%"> <div id="p0message" style="text-align:center;width:100%">Server disconnected, <href onclick="reload()" style="cursor:pointer"><u>click to reconnect</u></href>.</div> </div> </div> <div id="p1" style="display:none;width:100%;height:100%"> <div style="display:flex;align-items:center;width:100%;height:100%"> <div id="p1message" style="text-align:center;width:100%"></div> </div> </div> <div id="p2" style="display:none"> <div id="xdevices"></div> </div> <div id="p3" style="display:none;position:absolute;bottom:0;top:0;width:100%"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div> </td> <td> <img src="/images/user-50.png" width="50" height="50"> </td> <td> <div style="margin-left:5px"> <strong style="font-size:large"><span id="p3userName"></span></strong><br> </div> </td> </tr> </table> <div id="p3info" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <div style="margin-left:8px"> <div id="p3AccountActions"> <p><strong>Account actions</strong></p> <div style="margin-left:9px;margin-bottom:8px"> <div style="margin-top:5px"><span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a></span></div> <div style="margin-top:5px"> <span id="otpAuth" style="display:none"><a onclick="account_addOtp()" style="cursor:pointer">Add 2-step login</a><br></span> <span id="otpAuthRemove" style="display:none"><a onclick="account_removeOtp()" style="cursor:pointer">Remove 2-step login</a><br></span> </div> <div style="margin-top:5px"><a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a></div> <div style="margin-top:5px"><a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a></div> <div style="margin-top:5px"><a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a></div> </div> <br style="clear:both"> </div> <strong>Device Groups</strong> ( <a onclick="account_createMesh()" style="cursor:pointer"><img height="12" src="images/icon-addnew.png" width="12" border="0"> New</a> ) <br><br> <div id="p3meshes"></div> <div id="p3noMeshFound" style="margin-left:9px;display:none">No device groups. <a onclick="account_createMesh()" style="cursor:pointer"><strong>Get started here!</strong></a></div> <br style="clear:both"> </div> </div> </div> <div id="p5" style="display:none"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div> </td> <td> <img src="/images/user-50.png" width="50" height="50"> </td> <td> <div style="margin-left:5px"> <strong style="font-size:large">My Files</strong><br> </div> </td> </tr> </table> <div id="p5myfiles" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <table id="p5toolbar" style="width:100%;height:78px" cellpadding="0" cellspacing="0"> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5FolderUp" disabled="disabled" onclick="p5folderup()" value="Up"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile()" value="SelectAll" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5RenameFileButton" disabled="disabled" value="Rename" onclick="p5renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5DeleteFileButton" disabled="disabled" value="Delete" onclick="p5deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5NewFolderButton" disabled="disabled" value="Folder" onclick="p5createfolder()" onkeypress="return false" onkeydown="return false"> </div> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5UploadButton" disabled="disabled" value="Upload" onclick="p5uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5CutButton" disabled="disabled" value="Cut" onclick="p5copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5CopyButton" disabled="disabled" value="Copy" onclick="p5copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5PasteButton" disabled="disabled" value="Paste" onclick="p5pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5RefreshButton" value="Refresh" onclick="p5refreshFiles()" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <table style="width:100%"> <tr> <td id="p5currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td> <td style="text-align:right;padding-right:4px"> <select id="p5sortdropdown" onchange="updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </td> </tr> </table> </td> </tr> </table> <div id="p5filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"> <span id="p5files"></span> </div> <table id="p5toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px;background-color:#D3D9D6" cellpadding="0" cellspacing="0"> <tr> <td style="text-align:left;padding:3px"> <span id="p5bottomstatus"></span></td> <td id="p5rightOfButtons" style="text-align:right;padding:3px"></td> </tr> </table> </div> </div> <div id="p10" style="display:none;position:absolute;bottom:0;top:0;width:100%;overflow:hidden"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;position:absolute;top:0"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div> </td> <td> <a id="MainComputerImage" style="cursor:pointer" onclick="p10showiconselector()"></a> </td> <td> <div style="margin-left:5px"> <strong><span id="p10deviceName"></span></strong><br> <span id="MainComputerState"></span> </div> </td> </tr> </table> <div id="p10general" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <div id="p10html" style="margin-left:8px;margin-right:8px"></div> <div id="p10html2"></div> <div id="p10html3"></div> </div> <div id="p10desktop" style="overflow:hidden;position:absolute;top:55px;bottom:0px;width:100%;display:none"> <div id="deskarea1" style="position:absolute;top:0px;width:100%;height:25px"> <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <span id="p14power"></span> </div> <div style="margin-left:3px"> <input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"> <input type="button" id="connectbutton1h" value="HW Connect" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"> <input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"> <span id="deskstatus">Disconnected</span> </div> </div> </div> <div id="deskarea3" style="position:absolute;top:25px;width:100%;height:calc(100% - 50px)"> <div id="deskarea3x" style="background:black;text-align:center;height:100%;position:relative"> <div id="DeskParent" style="height:100%"> <canvas id="Desk" width="640" height="200" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)" onmousewheel="dmousewheel(event)"></canvas> </div> <div id="DeskTools" style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none"> <a id="DeskToolsRefreshButton" style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a> <div id="DeskToolsBar" style="position:absolute;padding:3px;border-radius:3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div> <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left"> <div style="border-bottom:1px solid darkgray;padding:3px"><a style="width:50px;padding-right:5px;float:left;cursor:pointer" title="Sort by process id" onclick="sortProcess(0)">PID</a><a style="cursor:pointer" title="Sort by name" onclick="sortProcess(1)">Name</a></div> <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div> </div> </div> </div> </div> <div id="deskarea4" style="position:absolute;bottom:0px;width:100%;height:25px"> <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onclick="deskGetDisplayNumbers(event)"></select> <input id="DeskToastButton" type="button" value="Toast" title="Display a notification message on the remote computer" onkeypress="return false" onkeydown="return false" onclick="deviceToastFunction()"> </div> <div> <input id="deskActionsBtn" type="button" style="margin-left:3px" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()"> <input type="button" value="Settings..." style="margin-left:3px" title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="display:none;margin-left:3px"> <span id="DeskControlSpan" style="margin-left:3px;display:none" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false">Input</span> </div> </div> </div> </div> <div id="p10files" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%;display:none"> <table id="p13toolbar" style="width:100%;height:111px" cellpadding="0" cellspacing="0"> <tr> <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px"> <div style="float:right;text-align:right"> <input id="filesActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:2px"> </div> <div style="margin-left:2px"> <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" onkeypress="return false" onkeydown="return false" type="button" style="display:none"> <input id="p13Connect" value="Connect" onclick="connectFiles(event)" onkeypress="return false" onkeydown="return false" type="button"> <span id="p13Status">Disconnected</span> </div> </td> </tr> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Up"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="SelectAll" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13RenameFileButton" disabled="disabled" value="Rename" onclick="p13renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13DeleteFileButton" disabled="disabled" value="Delete" onclick="p13deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13NewFolderButton" disabled="disabled" value="Folder" onclick="p13createfolder()" onkeypress="return false" onkeydown="return false"> </div> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13UploadButton" disabled="disabled" value="Upload" onclick="p13uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13CutButton" disabled="disabled" value="Cut" onclick="p13copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13CopyButton" disabled="disabled" value="Copy" onclick="p13copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13PasteButton" disabled="disabled" value="Paste" onclick="p13pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13RefreshButton" disabled="disabled" value="Refresh" onclick="p13folderup(9999)" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <table style="width:100%"> <tr> <td id="p13currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td> <td style="text-align:right;padding-right:4px"> <select id="p13sortdropdown" onchange="p13updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </td> </tr> </table> </td> </tr> </table> <div id="p13filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"> <span id="p13files"></span> </div> <table id="p13toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px" cellpadding="0" cellspacing="0"> <tr><td style="text-align:left;padding:3px;text-align:center;background-color:#D3D9D6"> <span id="p13bottomstatus"></span></td></tr> </table> </div> </div> <div id="p20" style="display:none;position:absolute;bottom:0;top:0;width:100%"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div> </td> <td onclick="p20editmesh(1)"> <img src="/images/meshicon50.png" width="50" height="50"> </td> <td onclick="p20editmesh(1)"> <div style="margin-left:5px"> <strong style="font-size:large"><span id="p20meshName"></span></strong><br> </div> </td> </tr> </table> <div id="p20info" style="margin-left:8px;margin-right:8px"></div> </div> </div> </div> <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px"> <table id="footerMenu" cellpadding="0" cellspacing="0" style="height:32px;width:100%;color:white;cursor:pointer;table-layout:fixed"></table> </div> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:90px;width:300px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> <div id="dialog7" style="margin:auto;margin:3px"> <div id="d7meshkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Agent Remote Desktop</h4> <div style="margin:3px 0 3px 0"> <select id="d7bitmapquality" style="float:right;width:200px;height:20px" dir="rtl"></select> <div style="height:20px">Quality</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7bitmapscaling" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="1024">100% <option value="896">87.5% <option value="768">75% <option value="640">62.5% <option value="512">50% <option value="384">37.5% <option value="256">25% <option value="128">12.5% </select> <div style="height:20px">Scaling</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7framelimiter" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="50">Fast <option value="100">Medium <option value="400">Slow <option value="1000">Very slow </select> <div style="height:20px">Rate</div> </div> </div> <div id="d7amtkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Intel® AMT Hardware KVM</h4> <div style='height:26px'> <select id="d7desktopmode" style="float:right;width:200px"> <option value="1">RLE8, Fastest <option value="2">RLE16, Recommended <option value="3">RAW8, Slow <option value="4">RAW16, Very Slow </select> <div>Encoding</div> </div> <div style="height:60px"> <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white"> <input type="checkbox" id='d7showfocus'>Show Focus Tool<br> <input type="checkbox" id='d7showcursor'>Show Local Mouse Cursor<br> </div> <div>Other</div> </div> </div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> </div> </div> <div id="topMenu" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:0px 0px 5px 5px;position:fixed;top:50px;right:5px;width:170px;display:none"> <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(2)">My Files</div> <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(1)">My Account</div> <div id="logoutMenuOption"><a href="/logout"><div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer">Logout</div></a></div> </div> <iframe name="fileUploadFrame" style="display:none"></iframe> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g," ")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"®").replace(/\(TM\)/g,"™")}var MeshServerCreateControl=function(a){var b={};b.State=0;b.connectstate=0;b.pingTimer=null;b.xxStateChange=function(c){if(b.State==c){return}b.State=c;if(b.onStateChanged){b.onStateChanged(b,b.State)}};b.Start=function(){b.connectstate=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+a+"control.ashx");b.socket.onopen=function(){b.connectstate=1;b.xxStateChange(2)};b.socket.onmessage=b.xxOnMessage;b.socket.onclose=function(){b.Stop()};b.xxStateChange(1);if(b.pingTimer!=null){clearInterval(b.pingTimer)}b.pingTimer=setInterval(function(){b.send({action:"ping"})},29000)};b.Stop=function(){b.connectstate=0;if(b.socket){b.socket.close();delete b.socket}if(b.pingTimer!=null){clearInterval(b.pingTimer);b.pingTimer=null}b.xxStateChange(0)};b.xxOnMessage=function(c){var d;try{d=JSON.parse(c.data)}catch(c){return}if(d.action=="pong"){return}if(b.onMessage){b.onMessage(b,d)}};b.send=function(c){if(b.socket!=null&&b.connectstate==1){b.socket.send(JSON.stringify(c))}};return b};var CreateAgentRedirect=function(a,b,e){var c={};c.m=b;b.parent=c;c.meshserver=a;c.State=0;c.nodeid=null;c.socket=null;c.connectstate=-1;c.tunnelid=Math.random().toString(36).substring(2);c.protocol=b.protocol;c.onStateChanged=null;c.ctrlMsgAllowed=true;c.attemptWebRTC=false;c.webRtcActive=false;c.webSwitchOk=false;c.webchannel=null;c.webrtc=null;c.debugmode=0;c.Start=function(f){var h,g=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+c.tunnelid;c.nodeid=f;c.connectstate=0;c.socket=new WebSocket(g);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onerror=function(j){console.error(j)};c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1);c.meshserver.send({action:"msg",type:"tunnel",nodeid:c.nodeid,value:"*/meshrelay.ashx?id="+c.tunnelid})};c.xxOnSocketConnected=function(){if(c.debugmode==1){console.log("onSocketConnected")}c.xxStateChange(2)};c.xxOnControlCommand=function(h){var f;try{f=JSON.parse(h)}catch(g){return}if(f.ctrlChannel!="102938"){c.xxOnSocketData(h);return}if(c.webrtc!=null){if(f.type=="answer"){c.webrtc.setRemoteDescription(new RTCSessionDescription(f),function(){},c.xxCloseWebRTC)}else{if(f.type=="webrtc0"){c.webSwitchOk=true;d()}else{if(f.type=="webrtc1"){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}')}else{if(f.type=="webrtc2"){}}}}}};c.sendCtrlMsg=function(g){if(c.ctrlMsgAllowed==true){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof g,g)}try{c.socket.send(g)}catch(f){}}};function d(){if((c.webSwitchOk==true)&&(c.webRtcActive==true)){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}');c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}');if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}}}c.xxOnMessage=function(k){if(c.State<3){if(k.data=="c"){try{c.socket.send(c.protocol)}catch(l){}c.xxStateChange(3);if(c.attemptWebRTC==true){var j=null;if(typeof RTCPeerConnection!=="undefined"){c.webrtc=new RTCPeerConnection(j)}else{if(typeof webkitRTCPeerConnection!=="undefined"){c.webrtc=new webkitRTCPeerConnection(j)}}if(c.webrtc!=null){c.webchannel=c.webrtc.createDataChannel("DataChannel",{});c.webchannel.onmessage=function(f){c.xxOnMessage({data:f.data})};c.webchannel.onopen=function(){c.webRtcActive=true;d()};c.webchannel.onclose=function(f){if(c.webRtcActive){c.Stop()}};c.webrtc.onicecandidate=function(f){if(f.candidate==null){try{c.socket.send(JSON.stringify(c.webrtcoffer))}catch(p){}}else{c.webrtcoffer.sdp+=("a="+f.candidate.candidate+"\r\n")}};c.webrtc.oniceconnectionstatechange=function(){if(c.webrtc!=null){if(c.webrtc.iceConnectionState=="disconnected"){if(c.webRtcActive==true){c.Stop()}else{c.xxCloseWebRTC()}}else{if(c.webrtc.iceConnectionState=="failed"){c.xxCloseWebRTC()}}}};c.webrtc.createOffer(function(f){c.webrtcoffer=f;c.webrtc.setLocalDescription(f,function(){},c.xxCloseWebRTC)},c.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}}return}}if(typeof k.data=="string"){c.xxOnControlCommand(k.data);return}if(typeof k.data=="object"){var m=new FileReader();if(m.readAsBinaryString){m.onload=function(f){c.xxOnSocketData(f.target.result)};m.readAsBinaryString(new Blob([k.data]))}else{if(m.readAsArrayBuffer){m.onloadend=function(f){c.xxOnSocketData(f.target.result)};m.readAsArrayBuffer(k.data)}else{var g="";var h=new Uint8Array(k.data);var o=h.byteLength;for(var n=0;n<o;n++){g+=String.fromCharCode(h[n])}c.xxOnSocketData(g)}}}else{c.xxOnSocketData(k.data)}};c.xxOnSocketData=function(h){if(!h||c.connectstate==-1){return}if(typeof h==="object"){var f="",g=new Uint8Array(h),k=g.byteLength;for(var j=0;j<k;j++){f+=String.fromCharCode(g[j])}h=f}else{if(typeof h!=="string"){return}}if((typeof args!="undefined")&&args.redirtrace){console.log("RedirRecv",typeof h,h.length,h)}return c.m.ProcessData(h)};c.sendText=function(f){if(typeof f!="string"){f=JSON.stringify(f)}c.send(encode_utf8(f))};c.send=function(k){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof k,k.length,k)}try{if(c.socket!=null&&c.socket.readyState==WebSocket.OPEN){if(typeof k=="string"){if(c.debugmode==1){var f=new Uint8Array(k.length),g=[];for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j);g.push(k.charCodeAt(j))}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}else{var f=new Uint8Array(k.length);for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j)}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}}else{if(c.webRtcActive==true){c.webchannel.send(k)}else{c.socket.send(k)}}}}catch(h){}};c.xxOnSocketClosed=function(){c.Stop(1)};c.xxStateChange=function(f){if(c.State==f){return}c.State=f;c.m.xxStateChange(c.State);if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}};c.xxCloseWebRTC=function(){if(c.webchannel!=null){try{c.webchannel.close()}catch(f){}c.webchannel=null}if(c.webrtc!=null){try{c.webrtc.close()}catch(f){}c.webrtc=null}c.webRtcActive=false};c.Stop=function(g){if(c.debugmode==1){console.log("stop",g)}c.xxCloseWebRTC();c.connectstate=-1;if(c.socket!=null){try{if(c.socket.readyState==1){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}');c.socket.close()}}catch(f){}c.socket=null}c.xxStateChange(0)};return c};var CreateAgentRemoteDesktop=function(a,e){var d={};d.CanvasId=a;if(typeof a==="string"){d.CanvasId=Q(a)}d.Canvas=d.CanvasId.getContext("2d");d.scrolldiv=e;d.State=0;d.PendingOperations=[];d.tilesReceived=0;d.TilesDrawn=0;d.KillDraw=0;d.ipad=false;d.tabletKeyboardVisible=false;d.LastX=0;d.LastY=0;d.touchenabled=0;d.submenuoffset=0;d.touchtimer=null;d.TouchArray={};d.connectmode=0;d.connectioncount=0;d.rotation=0;d.protocol=2;d.debugmode=0;d.firstUpKeys=[];d.stopInput=false;d.sessionid=0;d.username;d.oldie=false;d.CompressionLevel=50;d.ScalingLevel=1024;d.FrameRateTimer=50;d.FirstDraw=false;d.ScreenWidth=960;d.ScreenHeight=700;d.width=960;d.height=960;d.onScreenSizeChange=null;d.onMessage=null;d.onConnectCountChanged=null;d.onDebugMessage=null;d.onTouchEnabledChanged=null;d.onDisplayinfo=null;d.Start=function(){d.State=0};d.Stop=function(){d.setRotation(0);d.UnGrabKeyInput();d.UnGrabMouseInput();d.touchenabled=0;if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}d.Canvas.clearRect(0,0,d.CanvasId.width,d.CanvasId.height)};d.xxStateChange=function(f){if(d.State==f){return}d.State=f;switch(f){case 0:d.Stop();break;case 3:break}};d.send=function(f){if(d.debugmode>1){console.log("KSend("+f.length+"): "+rstr2hex(f))}d.parent.send(f)};d.ProcessPictureMsg=function(g,j,k){var h=new Image();h.xcount=d.tilesReceived++;var f=d.tilesReceived;h.src="data:image/jpeg;base64,"+btoa(g.substring(4,g.length));h.onload=function(){if(d.Canvas!=null&&d.KillDraw<f&&d.State!=0){d.PendingOperations.push([f,2,h,j,k]);while(d.DoPendingOperations()){}}};h.error=function(){console.log("DecodeTileError")}};d.DoPendingOperations=function(){if(d.PendingOperations.length==0){return false}for(var f=0;f<d.PendingOperations.length;f++){var g=d.PendingOperations[f];if(g[0]==(d.TilesDrawn+1)){if(g[1]==1){d.ProcessCopyRectMsg(g[2])}else{if(g[1]==2){d.Canvas.drawImage(g[2],d.rotX(g[3],g[4]),d.rotY(g[3],g[4]));delete g[2]}}d.PendingOperations.splice(f,1);delete g;d.TilesDrawn++;if(d.TilesDrawn==d.tilesReceived&&d.KillDraw<d.TilesDrawn){d.KillDraw=d.TilesDrawn=d.tilesReceived=0}return true}}if(d.oldie&&d.PendingOperations.length>0){d.TilesDrawn++}return false};d.ProcessCopyRectMsg=function(j){var k=((j.charCodeAt(0)&255)<<8)+(j.charCodeAt(1)&255);var l=((j.charCodeAt(2)&255)<<8)+(j.charCodeAt(3)&255);var f=((j.charCodeAt(4)&255)<<8)+(j.charCodeAt(5)&255);var g=((j.charCodeAt(6)&255)<<8)+(j.charCodeAt(7)&255);var m=((j.charCodeAt(8)&255)<<8)+(j.charCodeAt(9)&255);var h=((j.charCodeAt(10)&255)<<8)+(j.charCodeAt(11)&255);d.Canvas.drawImage(Canvas.canvas,k,l,m,h,f,g,m,h)};d.SendUnPause=function(){d.send(String.fromCharCode(0,8,0,5,0))};d.SendPause=function(){d.send(String.fromCharCode(0,8,0,5,1))};d.SendCompressionLevel=function(j,g,h,f){if(g){d.CompressionLevel=g}if(h){d.ScalingLevel=h}if(f){d.FrameRateTimer=f}d.send(String.fromCharCode(0,5,0,10,j,d.CompressionLevel)+d.shortToStr(d.ScalingLevel)+d.shortToStr(d.FrameRateTimer))};d.SendRefresh=function(){d.send(String.fromCharCode(0,6,0,4))};d.ProcessScreenMsg=function(g,f){if(d.debugmode>0){console.log("ScreenSize: "+g+" x "+f)}d.Canvas.setTransform(1,0,0,1,0,0);d.rotation=0;d.FirstDraw=true;d.ScreenWidth=d.width=g;d.ScreenHeight=d.height=f;d.KillDraw=d.tilesReceived;while(d.PendingOperations.length>0){d.PendingOperations.shift()}d.SendCompressionLevel(1);d.SendUnPause();if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}};d.ProcessData=function(g){var f=0;while(f<g.length){f+=d.ProcessDataEx(g.substring(f))}};d.ProcessDataEx=function(p){if(d.debugmode>1){console.log("KRecv("+p.length+"): "+rstr2hex(p.substring(0,Math.min(p.length,40))))}if(p.length<4){return}var f=null,q=0,r=0,h=ReadShort(p,0),g=ReadShort(p,2);if((g!=p.length)&&(d.debugmode>0)){console.log(g,p.length,g==p.length)}if(h>=18){if(h==65){console.error(p);alert(p)}else{console.error("Invalid KVM command "+h+" of size "+g);console.log("Invalid KVM data",p.length,p,rstr2hex(p));return}}if(g>p.length){console.error("KVM invalid command size",g,p.length);return}if(h==3||h==4||h==7){f=p.substring(4,g);q=((f.charCodeAt(0)&255)<<8)+(f.charCodeAt(1)&255);r=((f.charCodeAt(2)&255)<<8)+(f.charCodeAt(3)&255);if(d.debugmode>0){console.log("CMD"+h+" at X="+q+" Y="+r)}}switch(h){case 3:if(d.FirstDraw){d.onResize()}d.ProcessPictureMsg(f,q,r);break;case 4:if(d.FirstDraw){d.onResize()}if(d.TilesDrawn==d.tilesReceived){d.ProcessCopyRectMsg(f)}else{d.PendingOperations.push([++tilesReceived,1,f])}break;case 7:d.ProcessScreenMsg(q,r);d.SendKeyMsgKC(d.KeyAction.UP,16);d.SendKeyMsgKC(d.KeyAction.UP,17);d.SendKeyMsgKC(d.KeyAction.UP,18);d.SendKeyMsgKC(d.KeyAction.UP,91);d.SendKeyMsgKC(d.KeyAction.UP,92);d.SendKeyMsgKC(d.KeyAction.UP,16);d.send(String.fromCharCode(0,14,0,4));break;case 11:var m=[],j=((p.charCodeAt(4)&255)<<8)+(p.charCodeAt(5)&255);if(j>0){var o=0,n=((p.charCodeAt(6+(j*2))&255)<<8)+(p.charCodeAt(7+(j*2))&255);for(var l=0;l<j;l++){var k=((p.charCodeAt(6+(l*2))&255)<<8)+(p.charCodeAt(7+(l*2))&255);if(k==65535){m.push("All Displays")}else{m.push("Display "+k)}if(k==n){o=l}}}if(d.onDisplayinfo!=null){d.onDisplayinfo(d,m,o)}break;case 12:break;case 14:d.touchenabled=1;d.TouchArray={};if(d.onTouchEnabledChanged!=null){d.onTouchEnabledChanged(d.touchenabled)}break;case 15:d.TouchArray={};break;case 16:d.connectioncount=ReadInt(p,4);if(d.onConnectCountChanged!=null){d.onConnectCountChanged(d.connectioncount,d)}break;case 17:if(d.onMessage!=null){d.onMessage(p.substring(4,g),d)}break}return g};d.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};d.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5};d.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};d.Alternate=0;var c={Pause:19,CapsLock:20,Space:32,Quote:222,Minus:189,NumpadMultiply:106,NumpadAdd:107,PrintScreen:44,Comma:188,NumpadSubtract:109,NumpadDecimal:110,Period:190,Slash:191,NumpadDivide:111,Semicolon:186,Equal:187,OSLeft:91,BracketLeft:219,OSRight:91,Backslash:220,BracketRight:221,ContextMenu:93,Backquote:192,NumLock:144,ScrollLock:145,Backspace:8,Tab:9,Enter:13,NumpadEnter:13,Escape:27,Delete:46,Home:36,PageUp:33,PageDown:34,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,End:35,Insert:45,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,VolumeMute:181};function b(f){if(f.code.startsWith("Key")&&f.code.length==4){return f.code.charCodeAt(3)}if(f.code.startsWith("Digit")&&f.code.length==6){return f.code.charCodeAt(5)}if(f.code.startsWith("Numpad")&&f.code.length==7){return f.code.charCodeAt(6)+48}return c[f.code]}d.SendKeyMsg=function(f,g){if(f==null){return}if(!g){g=window.event}if(g.code){var h=b(g);if(h!=null){d.SendKeyMsgKC(f,h)}}else{var h=g.keyCode;if(h==59){h=186}d.SendKeyMsgKC(f,h)}};d.SendMessage=function(f){if(d.State==3){d.send(String.fromCharCode(0,17)+d.shortToStr(4+f.length)+f)}};d.SendKeyMsgKC=function(f,h){if(d.State!=3){return}if(typeof f=="object"){for(var g in f){d.SendKeyMsgKC(f[g][0],f[g][1])}}else{d.send(String.fromCharCode(0,d.InputType.KEY,0,6,(f-1),h))}};d.sendcad=function(){d.SendCtrlAltDelMsg()};d.SendCtrlAltDelMsg=function(){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.CTRLALTDEL,0,4))}};d.SendEscKey=function(){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.KEY,0,6,0,27,0,d.InputType.KEY,0,6,1,27))}};d.SendStartMsg=function(){d.SendKeyMsgKC(d.KeyAction.EXDOWN,91);d.SendKeyMsgKC(d.KeyAction.EXUP,91)};d.SendCharmsMsg=function(){d.SendKeyMsgKC(d.KeyAction.EXDOWN,91);d.SendKeyMsgKC(d.KeyAction.DOWN,67);d.SendKeyMsgKC(d.KeyAction.UP,67);d.SendKeyMsgKC(d.KeyAction.EXUP,91)};d.SendTouchMsg1=function(g,f,h,j){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.TOUCH)+d.shortToStr(14)+String.fromCharCode(1,g)+d.intToStr(f)+d.shortToStr(h)+d.shortToStr(j))}};d.SendTouchMsg2=function(h,f){var l="";var g;var m="TOUCHSEND: ";for(var j in d.TouchArray){if(j==h){g=f}else{if(d.TouchArray[j].f==1){g=65536|2|4;d.TouchArray[j].f=3;m+="START"+j}else{if(d.TouchArray[j].f==2){g=262144;m+="STOP"+j}else{g=2|4|131072}}}l+=String.fromCharCode(j)+d.intToStr(g)+d.shortToStr(d.TouchArray[j].x)+d.shortToStr(d.TouchArray[j].y);if(d.TouchArray[j].f==2){delete d.TouchArray[j]}}if(d.State==3){d.send(String.fromCharCode(0,d.InputType.TOUCH)+d.shortToStr(5+l.length)+String.fromCharCode(2)+l)}if(Object.keys(d.TouchArray).length==0&&d.touchtimer!=null){clearInterval(d.touchtimer);d.touchtimer=null}};d.SendMouseMsg=function(f,j){if(d.State!=3){return}if(f!=null&&d.Canvas!=null){if(!j){var j=window.event}var m=(d.Canvas.canvas.height/d.CanvasId.clientHeight);var n=(d.Canvas.canvas.width/d.CanvasId.clientWidth);var l=d.GetPositionOfControl(d.Canvas.canvas);var o=((j.pageX-l[0])*n);var p=((j.pageY-l[1])*m);if(o>=0&&o<=d.Canvas.canvas.width&&p>=0&&p<=d.Canvas.canvas.height){var g=0;var h=0;if(f==d.KeyAction.UP||f==d.KeyAction.DOWN){if(j.which){((j.which==1)?(g=d.MouseButton.LEFT):((j.which==2)?(g=d.MouseButton.MIDDLE):(g=d.MouseButton.RIGHT)))}else{if(j.button){((j.button==0)?(g=d.MouseButton.LEFT):((j.button==1)?(g=d.MouseButton.MIDDLE):(g=d.MouseButton.RIGHT)))}}}else{if(f==d.KeyAction.SCROLL){if(j.detail){h=(-1*(j.detail*120))}else{if(j.wheelDelta){h=(j.wheelDelta*3)}}}}var k="";if(f==d.KeyAction.SCROLL){k=String.fromCharCode(0,d.InputType.MOUSE,0,12,0,((f==d.KeyAction.DOWN)?g:((g*2)&255)),((o/256)&255),(o&255),((p/256)&255),(p&255),((h/256)&255),(h&255))}else{k=String.fromCharCode(0,d.InputType.MOUSE,0,10,0,((f==d.KeyAction.DOWN)?g:((g*2)&255)),((o/256)&255),(o&255),((p/256)&255),(p&255))}if(d.Action==d.KeyAction.NONE){if(d.Alternate==0||d.ipad){d.send(k);d.Alternate=1}else{d.Alternate=0}}else{d.send(k)}}}};d.GetDisplayNumbers=function(){d.send(String.fromCharCode(0,11,0,4))};d.SetDisplay=function(f){d.send(String.fromCharCode(0,12,0,6,f>>8,f&255))};d.intToStr=function(f){return String.fromCharCode((f>>24)&255,(f>>16)&255,(f>>8)&255,f&255)};d.shortToStr=function(f){return String.fromCharCode((f>>8)&255,f&255)};d.onResize=function(){if(d.ScreenWidth==0||d.ScreenHeight==0){return}if(d.Canvas.canvas.width==d.ScreenWidth&&d.Canvas.canvas.height==d.ScreenHeight){return}if(d.FirstDraw){d.Canvas.canvas.width=d.ScreenWidth;d.Canvas.canvas.height=d.ScreenHeight;d.Canvas.fillRect(0,0,d.ScreenWidth,d.ScreenHeight);if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}}d.FirstDraw=false};d.xxMouseInputGrab=false;d.xxKeyInputGrab=false;d.xxMouseMove=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.NONE,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxMouseUp=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.UP,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxMouseDown=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.DOWN,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxDOMMouseScroll=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.SCROLL,f);return false}return true};d.xxMouseWheel=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.SCROLL,f);return false}return true};d.xxKeyUp=function(f){if(d.State==3){d.SendKeyMsg(d.KeyAction.UP,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxKeyDown=function(f){if(d.State==3){d.SendKeyMsg(d.KeyAction.DOWN,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxKeyPress=function(f){if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.handleKeys=function(f){if(d.stopInput==true||desktop.State!=3){return false}return d.xxKeyPress(f)};d.handleKeyUp=function(f){if(d.stopInput==true||desktop.State!=3){return false}if(d.firstUpKeys.length<5){d.firstUpKeys.push(f.keyCode);if((d.firstUpKeys.length==5)){var g=d.firstUpKeys.join(",");if((g=="16,17,91,91,16")||(g=="16,17,18,91,92")){d.stopInput=true}}}return d.xxKeyUp(f)};d.handleKeyDown=function(f){if(d.stopInput==true||desktop.State!=3){return false}return d.xxKeyDown(f)};d.mousedown=function(f){if(d.stopInput==true){return false}return d.xxMouseDown(f)};d.mouseup=function(f){if(d.stopInput==true){return false}return d.xxMouseUp(f)};d.mousemove=function(f){if(d.stopInput==true){return false}return d.xxMouseMove(f)};d.mousewheel=function(f){if(d.stopInput==true){return false}return d.xxMouseWheel(f)};d.xxMsTouchEvent=function(f){if(f.originalEvent.pointerType==4){return}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}if(f.type=="MSPointerDown"||f.type=="MSPointerMove"||f.type=="MSPointerUp"){var g=0;var h=f.originalEvent.pointerId%256;var j=f.offsetX*(Canvas.canvas.width/d.CanvasId.clientWidth);var k=f.offsetY*(Canvas.canvas.height/d.CanvasId.clientHeight);if(f.type=="MSPointerDown"){g=65536|2|4}else{if(f.type=="MSPointerMove"){g=131072|2|4}else{if(f.type=="MSPointerUp"){g=262144}}}if(!d.TouchArray[h]){d.TouchArray[h]={x:j,y:k}}d.SendTouchMsg2(h,g);if(f.type=="MSPointerUp"){delete d.TouchArray[h]}}else{alert(f.type)}return true};d.xxTouchStart=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}var k=f.originalEvent.touches[0];f.which=1;d.LastX=f.pageX=k.pageX;d.LastY=f.pageY=k.pageY;d.SendMouseMsg(KeyAction.DOWN,f)}else{var j=d.GetPositionOfControl(Canvas.canvas);for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(!d.TouchArray[h]){d.TouchArray[h]={x:(f.originalEvent.touches[g].pageX-j[0])*(Canvas.canvas.width/d.CanvasId.clientWidth),y:(f.originalEvent.touches[g].pageY-j[1])*(Canvas.canvas.height/d.CanvasId.clientHeight),f:1}}}if(Object.keys(d.TouchArray).length>0&&touchtimer==null){d.touchtimer=setInterval(function(){d.SendTouchMsg2(256,0)},50)}}};d.xxTouchMove=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}var k=f.originalEvent.touches[0];f.which=1;d.LastX=f.pageX=k.pageX;d.LastY=f.pageY=k.pageY;d.SendMouseMsg(d.KeyAction.NONE,f)}else{var j=d.GetPositionOfControl(Canvas.canvas);for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(d.TouchArray[h]){d.TouchArray[h].x=(f.originalEvent.touches[g].pageX-j[0])*(d.Canvas.canvas.width/d.CanvasId.clientWidth);d.TouchArray[h].y=(f.originalEvent.touches[g].pageY-j[1])*(d.Canvas.canvas.height/d.CanvasId.clientHeight)}}}};d.xxTouchEnd=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}f.which=1;f.pageX=LastX;f.pageY=LastY;d.SendMouseMsg(KeyAction.UP,f)}else{for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(d.TouchArray[h]){d.TouchArray[h].f=2}}}};d.GrabMouseInput=function(){if(d.xxMouseInputGrab==true){return}var f=d.CanvasId;f.onmousemove=d.xxMouseMove;f.onmouseup=d.xxMouseUp;f.onmousedown=d.xxMouseDown;f.touchstart=d.xxTouchStart;f.touchmove=d.xxTouchMove;f.touchend=d.xxTouchEnd;f.MSPointerDown=d.xxMsTouchEvent;f.MSPointerMove=d.xxMsTouchEvent;f.MSPointerUp=d.xxMsTouchEvent;if(navigator.userAgent.match(/mozilla/i)){f.DOMMouseScroll=d.xxDOMMouseScroll}else{f.onmousewheel=d.xxMouseWheel}d.xxMouseInputGrab=true};d.UnGrabMouseInput=function(){if(d.xxMouseInputGrab==false){return}var f=d.CanvasId;f.onmousemove=null;f.onmouseup=null;f.onmousedown=null;f.touchstart=null;f.touchmove=null;f.touchend=null;f.MSPointerDown=null;f.MSPointerMove=null;f.MSPointerUp=null;if(navigator.userAgent.match(/mozilla/i)){f.DOMMouseScroll=null}else{f.onmousewheel=null}d.xxMouseInputGrab=false};d.GrabKeyInput=function(){if(d.xxKeyInputGrab==true){return}document.onkeyup=d.xxKeyUp;document.onkeydown=d.xxKeyDown;document.onkeypress=d.xxKeyPress;d.xxKeyInputGrab=true};d.UnGrabKeyInput=function(){if(d.xxKeyInputGrab==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d.xxKeyInputGrab=false};d.GetPositionOfControl=function(f){var g=Array(2);g[0]=g[1]=0;while(f){g[0]+=f.offsetLeft;g[1]+=f.offsetTop;f=f.offsetParent}return g};d.crotX=function(f,g){if(d.rotation==0){return f}if(d.rotation==1){return g}if(d.rotation==2){return d.Canvas.canvas.width-f}if(d.rotation==3){return d.Canvas.canvas.height-g}};d.crotY=function(f,g){if(d.rotation==0){return g}if(d.rotation==1){return d.Canvas.canvas.width-f}if(d.rotation==2){return d.Canvas.canvas.height-g}if(d.rotation==3){return f}};d.rotX=function(f,g){if(d.rotation==0||d.rotation==1){return f}if(d.rotation==2){return f-d.Canvas.canvas.width}if(d.rotation==3){return f-d.Canvas.canvas.height}};d.rotY=function(f,g){if(d.rotation==0||d.rotation==3){return g}if(d.rotation==1){return g-d.Canvas.canvas.width}if(d.rotation==2){return g-d.Canvas.canvas.height}};d.tcanvas=null;d.setRotation=function(k){while(k<0){k+=4}var f=k%4;if(f==d.rotation){return true}var h=d.Canvas.canvas.width;var g=d.Canvas.canvas.height;if(d.rotation==1||d.rotation==3){h=d.Canvas.canvas.height;g=d.Canvas.canvas.width}if(d.tcanvas==null){d.tcanvas=document.createElement("canvas")}var j=d.tcanvas.getContext("2d");j.setTransform(1,0,0,1,0,0);j.canvas.width=h;j.canvas.height=g;j.rotate((d.rotation*-90)*Math.PI/180);if(d.rotation==0){j.drawImage(d.Canvas.canvas,0,0)}if(d.rotation==1){j.drawImage(d.Canvas.canvas,-d.Canvas.canvas.width,0)}if(d.rotation==2){j.drawImage(d.Canvas.canvas,-d.Canvas.canvas.width,-d.Canvas.canvas.height)}if(d.rotation==3){j.drawImage(d.Canvas.canvas,0,-d.Canvas.canvas.height)}if(d.rotation==0||d.rotation==2){d.Canvas.canvas.height=h;d.Canvas.canvas.width=g}if(d.rotation==1||d.rotation==3){d.Canvas.canvas.height=g;d.Canvas.canvas.width=h}d.Canvas.setTransform(1,0,0,1,0,0);d.Canvas.rotate((f*90)*Math.PI/180);d.rotation=f;d.Canvas.drawImage(d.tcanvas,d.rotX(0,0),d.rotY(0,0));d.ScreenWidth=d.Canvas.canvas.width;d.ScreenHeight=d.Canvas.canvas.height;if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}return true};d.MuchTheSame=function(f,g){return(Math.abs(f-g)<4)};d.Debug=function(f){console.log(f)};d.getIEVersion=function(){var f=-1;if(navigator.appName=="Microsoft Internet Explorer"){var h=navigator.userAgent;var g=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(g.exec(h)!=null){f=parseFloat(RegExp.$1)}}return f};d.haltEvent=function(f){if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};return d};function AmtStackCreateService(s){var r=new Object();r.wsman=s;r.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];r.PendingEnums=[];r.PendingBatchOperations=0;r.ActiveEnumsCount=0;r.MaxActiveEnumsCount=1;r.onProcessChanged=null;var m=0;var l=0;r.GetPendingActions=function(){return(r.PendingEnums.length*2)+(r.ActiveEnumsCount)+r.wsman.comm.PendingAjax.length+r.wsman.comm.ActiveAjaxCount+r.PendingBatchOperations};function q(){var t=r.GetPendingActions();if(m<t){m=t}if(r.onProcessChanged!=null&&l!=t){l=t;r.onProcessChanged(t,m)}if(t==0){m=0}}r.Subscribe=function(v,u,B,t,A,y,z,w,C,x){r.wsman.ExecSubscribe(r.CompleteName(v),u,B,function(F,E,D,G){q();t(r,v,D,G,A)},0,y,z,w,C,x);q()};r.UnSubscribe=function(u,t,x,v,w){r.wsman.ExecUnSubscribe(r.CompleteName(u),function(A,z,y,B){q();t(r,u,y,B,x)},0,v,w);q()};r.Get=function(u,t,w,v){r.wsman.ExecGet(r.CompleteName(u),function(z,y,x,A){q();t(r,u,x,A,w)},0,v);q()};r.Put=function(u,w,t,y,v,x){r.wsman.ExecPut(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v,x);q()};r.Create=function(u,w,t,x,v){r.wsman.ExecCreate(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Delete=function(u,w,t,x,v){r.wsman.ExecDelete(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Exec=function(w,v,t,u,z,x,y){r.wsman.ExecMethod(r.CompleteName(w),v,t,function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.ExecWithXml=function(w,v,t,u,z,x,y){r.wsman.ExecMethodXml(r.CompleteName(w),v,execArgumentsToXml(t),function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.Enum=function(u,t,w,v){if(r.ActiveEnumsCount<r.MaxActiveEnumsCount){r.ActiveEnumsCount++;r.wsman.ExecEnum(r.CompleteName(u),function(A,y,x,B,z){q();d(u,x,t,y,B,z)},w,v)}else{r.PendingEnums.push([u,t,w,v])}q()};function d(v,x,t,y,z,A,w){if(z!=200){t(r,v,null,z,A);c(1);return}if(x==null||x.Header.Method!="EnumerateResponse"||!x.Body.EnumerationContext){t(r,v,null,603,A);c(1);return}var u=x.Body.EnumerationContext;r.wsman.ExecPull(y,u,function(D,C,B,E){b(v,B,t,C,[],E,A,w)})}function b(y,A,t,B,w,C,D,z){if(C!=200){t(r,y,null,C,D);c(1);return}if(A==null||A.Header.Method!="PullResponse"){t(r,y,null,604,D);c(1);return}for(var v in A.Body.Items){if(A.Body.Items[v] instanceof Array){for(var x in A.Body.Items[v]){w.push(A.Body.Items[v][x])}}else{w.push(A.Body.Items[v])}}if(A.Body.EnumerationContext){var u=A.Body.EnumerationContext;r.wsman.ExecPull(B,u,function(G,F,E,H){b(y,E,t,F,w,H,D,1)})}else{c(1);t(r,y,w,C,D);q()}}function c(t){r.ActiveEnumsCount-=t;if(r.ActiveEnumsCount>=r.MaxActiveEnumsCount||r.PendingEnums.length==0){return}var u=r.PendingEnums.shift();r.Enum(u[0],u[1],u[2]);c(0)}r.BatchEnum=function(t,w,u,y,v,x){r.PendingBatchOperations+=(w.length*2);a(t,Clone(w),u,y,{},v,x);q()};function a(t,y,u,B,A,v,z){r.PendingBatchOperations-=2;var x=y.shift(),w=r.Enum;if(x[0]=="*"){w=r.Get;x=x.substring(1)}w(x,function(E,C,D,F,G){G[2][C]={response:(D==null?null:D.Body),responses:D,status:F};if(G[1].length==0||F==401||(v!=true&&F!=200&&F!=400)){r.PendingBatchOperations-=(y.length*2);q();u(r,t,G[2],F,B)}else{q();a(t,y,u,B,G[2],z)}},[t,y,A],z);q()}r.BatchGet=function(t,v,u,x,w){g({name:t,names:v,callback:u,current:0,responses:{},tag:x,pri:w});q()};function g(t){if(t.names.length<=t.current){t.callback(r,t.name,t.responses,200,t.tag)}else{r.wsman.ExecGet(r.CompleteName(t.names[t.current]),function(w,v,u,x){f(t,u,x)},t.pri);t.current++}q()}function f(t,u,v){if(u==null||v!=200){t.callback(r,t.name,null,v,t.tag)}else{t.responses[u.Header.Method]=u;g(t)}}r.CompleteName=function(t){if(t.indexOf("AMT_")==0){return r.pfx[0]+t}if(t.indexOf("CIM_")==0){return r.pfx[1]+t}if(t.indexOf("IPS_")==0){return r.pfx[2]+t}};r.CompleteExecResponse=function(t){if(t&&t!=null&&t.Body&&t.Body.ReturnValue){t.Body.ReturnValueStr=r.AmtStatusToStr(t.Body.ReturnValue)}return t};r.RequestPowerStateChange=function(u,t){r.CIM_PowerManagementService_RequestPowerStateChange(u,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',null,null,t)};r.SetBootConfigRole=function(u,t){r.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',u,t)};r.CancelAllQueries=function(t){r.wsman.CancelAllQueries(t)};r.AMT_AgentPresenceWatchdog_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdog_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AddAction=function(y,x,w,u,t,v,B,z,A){r.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:y,NewState:x,EventOnTransition:w,ActionSd:u,ActionEac:t},v,B,z,A)};r.AMT_AgentPresenceWatchdog_DeleteAllActions=function(t,w,u,v){r.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},t,w,u,v)};r.AMT_AgentPresenceWatchdogAction_GetActionEac=function(t){r.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},t)};r.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdogVA_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AddAction=function(y,x,w,u,t,v){r.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:y,NewState:x,EventOnTransition:w,ActionSd:u,ActionEac:t},v)};r.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(t,u){r.Exec("AMT_AgentPresenceWatchdogVA","DeleteAllActions",{_method_dummy:t},u)};r.AMT_AuditLog_ClearLog=function(t){r.Exec("AMT_AuditLog","ClearLog",{},t)};r.AMT_AuditLog_RequestStateChange=function(u,v,t){r.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_AuditLog_ReadRecords=function(u,t,v){r.Exec("AMT_AuditLog","ReadRecords",{StartIndex:u},t,v)};r.AMT_AuditLog_SetAuditLock=function(w,u,v,t){r.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:w,Flag:u,Handle:v},t)};r.AMT_AuditLog_ExportAuditLogSignature=function(u,t){r.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:u},t)};r.AMT_AuditLog_SetSigningKeyMaterial=function(x,w,v,u,t){r.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:x,SigningKey:w,LengthOfCertificates:v,Certificates:u},t)};r.AMT_AuditPolicyRule_SetAuditPolicy=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicyBulk",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuthorizationService_AddUserAclEntryEx=function(w,v,x,t,y,u){r.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:w,DigestPassword:v,KerberosUserSid:x,AccessPermission:t,Realms:y},u)};r.AMT_AuthorizationService_EnumerateUserAclEntries=function(u,t){r.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:u},t)};r.AMT_AuthorizationService_GetUserAclEntryEx=function(u,t,v){r.Exec("AMT_AuthorizationService","GetUserAclEntryEx",{Handle:u},t,v)};r.AMT_AuthorizationService_UpdateUserAclEntryEx=function(x,w,v,y,t,z,u){r.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:x,DigestUsername:w,DigestPassword:v,KerberosUserSid:y,AccessPermission:t,Realms:z},u)};r.AMT_AuthorizationService_RemoveUserAclEntry=function(u,t){r.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:u},t)};r.AMT_AuthorizationService_SetAdminAclEntryEx=function(v,u,t){r.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",{Username:v,DigestPassword:u},t)};r.AMT_AuthorizationService_GetAdminAclEntry=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},t)};r.AMT_AuthorizationService_GetAdminAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},t)};r.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},t)};r.AMT_AuthorizationService_SetAclEnabledState=function(v,u,t,w){r.Exec("AMT_AuthorizationService","SetAclEnabledState",{Handle:v,Enabled:u},t,w)};r.AMT_AuthorizationService_GetAclEnabledState=function(u,t,v){r.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:u},t,v)};r.AMT_EndpointAccessControlService_RequestStateChange=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_EndpointAccessControlService_GetPosture=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:u},t)};r.AMT_EndpointAccessControlService_GetPostureHash=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:u},t)};r.AMT_EndpointAccessControlService_UpdatePostureState=function(u,t){r.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:u},t)};r.AMT_EndpointAccessControlService_GetEacOptions=function(t){r.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},t)};r.AMT_EndpointAccessControlService_SetEacOptions=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:u,PostureHashAlgorithm:v},t)};r.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:u},t)};r.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:u},t)};r.AMT_EthernetPortSettings_SetLinkPreference=function(u,v,t){r.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:u,Timeout:v},t)};r.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=function(u,t){r.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:u},t)};r.AMT_KerberosSettingData_GetCredentialCacheState=function(t){r.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},t)};r.AMT_KerberosSettingData_SetCredentialCacheState=function(u,t){r.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:u},t)};r.AMT_MessageLog_CancelIteration=function(u,t){r.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:u},t)};r.AMT_MessageLog_RequestStateChange=function(u,v,t){r.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_MessageLog_ClearLog=function(t){r.Exec("AMT_MessageLog","ClearLog",{},t)};r.AMT_MessageLog_GetRecords=function(u,v,t,w){r.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:u,MaxReadRecords:v},t,w)};r.AMT_MessageLog_GetRecord=function(u,v,t){r.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:u,PositionToNext:v},t)};r.AMT_MessageLog_PositionAtRecord=function(u,v,w,t){r.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:u,MoveAbsolute:v,RecordNumber:w},t)};r.AMT_MessageLog_PositionToFirstRecord=function(t,u){r.Exec("AMT_MessageLog","PositionToFirstRecord",{},t,u)};r.AMT_MessageLog_FreezeLog=function(u,t){r.Exec("AMT_MessageLog","FreezeLog",{Freeze:u},t)};r.AMT_PublicKeyManagementService_AddCRL=function(v,u,t){r.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:v,SerialNumbers:u},t)};r.AMT_PublicKeyManagementService_ResetCRLList=function(t,u){r.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:t},u)};r.AMT_PublicKeyManagementService_AddCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddKey=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:u},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(v,u,w,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:v,DNName:u,Usage:w},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(u,w,v,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:u,SigningAlgorithm:w,NullSignedCertificateRequest:v},t)};r.AMT_PublicKeyManagementService_GenerateKeyPair=function(u,v,t){r.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:u,KeyLength:v},t)};r.AMT_RedirectionService_RequestStateChange=function(u,t){r.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:u},t)};r.AMT_RedirectionService_TerminateSession=function(u,t){r.Exec("AMT_RedirectionService","TerminateSession",{SessionType:u},t)};r.AMT_RemoteAccessService_AddMpServer=function(t,y,A,u,w,B,z,x,v){r.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:t,InfoFormat:y,Port:A,AuthMethod:u,Certificate:w,Username:B,Password:z,CN:x},v)};r.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(w,x,u,v,t){r.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:w,TunnelLifeTime:x,ExtendedData:u,MpServer:v},t)};r.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(t,u){r.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_CommitChanges=function(t,u){r.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_Unprovision=function(u,t){r.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:u},t)};r.AMT_SetupAndConfigurationService_PartialUnprovision=function(t,u){r.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(t,u){r.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(u,t){r.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:u},t)};r.AMT_SetupAndConfigurationService_SetMEBxPassword=function(u,t){r.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:u},t)};r.AMT_SetupAndConfigurationService_SetTLSPSK=function(u,v,t){r.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:u,PPS:v},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},t)};r.AMT_SetupAndConfigurationService_GetUuid=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUuid",{},t)};r.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},t)};r.AMT_SystemDefensePolicy_GetTimeout=function(t){r.Exec("AMT_SystemDefensePolicy","GetTimeout",{},t)};r.AMT_SystemDefensePolicy_SetTimeout=function(u,t){r.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:u},t)};r.AMT_SystemDefensePolicy_UpdateStatistics=function(u,w,t,y,v,x){r.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:u,ResetOnRead:w},t,y,v,x)};r.AMT_SystemPowerScheme_SetPowerScheme=function(t,u,v){r.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},t,v,0,{InstanceID:u})};r.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(t,u){r.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},t,u)};r.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(u,w,x,t,v){r.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:u,Tm1:w,Tm2:x},t,v)};r.AMT_UserInitiatedConnectionService_RequestStateChange=function(u,v,t){r.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WebUIService_RequestStateChange=function(u,v,t){r.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:x,WiFiEndpointSettingsInput:y,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:x,WiFiEndpointSettingsInput:y,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:t},u)};r.CIM_Account_RequestStateChange=function(u,v,t){r.Exec("CIM_Account","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_AccountManagementService_CreateAccount=function(v,t,u){r.Exec("CIM_AccountManagementService","CreateAccount",{System:v,AccountTemplate:t},u)};r.CIM_BootConfigSetting_ChangeBootOrder=function(u,t){r.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:u},t)};r.CIM_BootService_SetBootConfigRole=function(t,v,u){r.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:t,Role:v},u,0,1)};r.CIM_Card_ConnectorPower=function(u,v,t){r.Exec("CIM_Card","ConnectorPower",{Connector:u,PoweredOn:v},t)};r.CIM_Card_IsCompatible=function(u,t){r.Exec("CIM_Card","IsCompatible",{ElementToCheck:u},t)};r.CIM_Chassis_IsCompatible=function(u,t){r.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:u},t)};r.CIM_Fan_SetSpeed=function(u,t){r.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:u},t)};r.CIM_KVMRedirectionSAP_RequestStateChange=function(u,v,t){r.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:u},t)};r.CIM_MediaAccessDevice_LockMedia=function(u,t){r.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:u},t)};r.CIM_MediaAccessDevice_SetPowerState=function(u,v,t){r.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_MediaAccessDevice_Reset=function(t){r.Exec("CIM_MediaAccessDevice","Reset",{},t)};r.CIM_MediaAccessDevice_EnableDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:u},t)};r.CIM_MediaAccessDevice_OnlineDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:u},t)};r.CIM_MediaAccessDevice_QuiesceDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:u},t)};r.CIM_MediaAccessDevice_SaveProperties=function(t){r.Exec("CIM_MediaAccessDevice","SaveProperties",{},t)};r.CIM_MediaAccessDevice_RestoreProperties=function(t){r.Exec("CIM_MediaAccessDevice","RestoreProperties",{},t)};r.CIM_MediaAccessDevice_RequestStateChange=function(u,v,t){r.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_PhysicalFrame_IsCompatible=function(u,t){r.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:u},t)};r.CIM_PhysicalPackage_IsCompatible=function(u,t){r.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:u},t)};r.CIM_PowerManagementService_RequestPowerStateChange=function(v,u,w,x,t){r.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:v,ManagedElement:u,Time:w,TimeoutPeriod:x},t,0,1)};r.CIM_PowerSupply_SetPowerState=function(u,v,t){r.Exec("CIM_PowerSupply","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_PowerSupply_Reset=function(t){r.Exec("CIM_PowerSupply","Reset",{},t)};r.CIM_PowerSupply_EnableDevice=function(u,t){r.Exec("CIM_PowerSupply","EnableDevice",{Enabled:u},t)};r.CIM_PowerSupply_OnlineDevice=function(u,t){r.Exec("CIM_PowerSupply","OnlineDevice",{Online:u},t)};r.CIM_PowerSupply_QuiesceDevice=function(u,t){r.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:u},t)};r.CIM_PowerSupply_SaveProperties=function(t){r.Exec("CIM_PowerSupply","SaveProperties",{},t)};r.CIM_PowerSupply_RestoreProperties=function(t){r.Exec("CIM_PowerSupply","RestoreProperties",{},t)};r.CIM_PowerSupply_RequestStateChange=function(u,v,t){r.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Processor_SetPowerState=function(u,v,t){r.Exec("CIM_Processor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Processor_Reset=function(t){r.Exec("CIM_Processor","Reset",{},t)};r.CIM_Processor_EnableDevice=function(u,t){r.Exec("CIM_Processor","EnableDevice",{Enabled:u},t)};r.CIM_Processor_OnlineDevice=function(u,t){r.Exec("CIM_Processor","OnlineDevice",{Online:u},t)};r.CIM_Processor_QuiesceDevice=function(u,t){r.Exec("CIM_Processor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Processor_SaveProperties=function(t){r.Exec("CIM_Processor","SaveProperties",{},t)};r.CIM_Processor_RestoreProperties=function(t){r.Exec("CIM_Processor","RestoreProperties",{},t)};r.CIM_Processor_RequestStateChange=function(u,v,t){r.Exec("CIM_Processor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RecordLog_ClearLog=function(t){r.Exec("CIM_RecordLog","ClearLog",{},t)};r.CIM_RecordLog_RequestStateChange=function(u,v,t){r.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RedirectionService_RequestStateChange=function(u,v,t){r.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Sensor_SetPowerState=function(u,v,t){r.Exec("CIM_Sensor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Sensor_Reset=function(t){r.Exec("CIM_Sensor","Reset",{},t)};r.CIM_Sensor_EnableDevice=function(u,t){r.Exec("CIM_Sensor","EnableDevice",{Enabled:u},t)};r.CIM_Sensor_OnlineDevice=function(u,t){r.Exec("CIM_Sensor","OnlineDevice",{Online:u},t)};r.CIM_Sensor_QuiesceDevice=function(u,t){r.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Sensor_SaveProperties=function(t){r.Exec("CIM_Sensor","SaveProperties",{},t)};r.CIM_Sensor_RestoreProperties=function(t){r.Exec("CIM_Sensor","RestoreProperties",{},t)};r.CIM_Sensor_RequestStateChange=function(u,v,t){r.Exec("CIM_Sensor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_StatisticalData_ResetSelectedStats=function(u,t){r.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:u},t)};r.CIM_Watchdog_KeepAlive=function(t){r.Exec("CIM_Watchdog","KeepAlive",{},t)};r.CIM_Watchdog_SetPowerState=function(u,v,t){r.Exec("CIM_Watchdog","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Watchdog_Reset=function(t){r.Exec("CIM_Watchdog","Reset",{},t)};r.CIM_Watchdog_EnableDevice=function(u,t){r.Exec("CIM_Watchdog","EnableDevice",{Enabled:u},t)};r.CIM_Watchdog_OnlineDevice=function(u,t){r.Exec("CIM_Watchdog","OnlineDevice",{Online:u},t)};r.CIM_Watchdog_QuiesceDevice=function(u,t){r.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:u},t)};r.CIM_Watchdog_SaveProperties=function(t){r.Exec("CIM_Watchdog","SaveProperties",{},t)};r.CIM_Watchdog_RestoreProperties=function(t){r.Exec("CIM_Watchdog","RestoreProperties",{},t)};r.CIM_Watchdog_RequestStateChange=function(u,v,t){r.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_WiFiPort_SetPowerState=function(u,v,t){r.Exec("CIM_WiFiPort","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_WiFiPort_Reset=function(t){r.Exec("CIM_WiFiPort","Reset",{},t)};r.CIM_WiFiPort_EnableDevice=function(u,t){r.Exec("CIM_WiFiPort","EnableDevice",{Enabled:u},t)};r.CIM_WiFiPort_OnlineDevice=function(u,t){r.Exec("CIM_WiFiPort","OnlineDevice",{Online:u},t)};r.CIM_WiFiPort_QuiesceDevice=function(u,t){r.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:u},t)};r.CIM_WiFiPort_SaveProperties=function(t){r.Exec("CIM_WiFiPort","SaveProperties",{},t)};r.CIM_WiFiPort_RestoreProperties=function(t){r.Exec("CIM_WiFiPort","RestoreProperties",{},t)};r.CIM_WiFiPort_RequestStateChange=function(u,v,t){r.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_HostBasedSetupService_Setup=function(x,y,w,u,z,v,t){r.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:x,NetworkAdminPassword:y,McNonce:w,Certificate:u,SigningAlgorithm:z,DigitalSignature:v},t)};r.IPS_HostBasedSetupService_AddNextCertInChain=function(w,u,v,t){r.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:w,IsLeafCertificate:u,IsRootCertificate:v},t)};r.IPS_HostBasedSetupService_AdminSetup=function(w,x,v,y,u,t){r.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:w,NetworkAdminPassword:x,McNonce:v,SigningAlgorithm:y,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(v,w,u,t){r.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:v,SigningAlgorithm:w,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_DisableClientControlMode=function(t,u){r.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:t},u)};r.IPS_KVMRedirectionSettingData_TerminateSession=function(t){r.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},t)};r.IPS_OptInService_StartOptIn=function(t){r.Exec("IPS_OptInService","StartOptIn",{},t)};r.IPS_OptInService_CancelOptIn=function(t){r.Exec("IPS_OptInService","CancelOptIn",{},t)};r.IPS_OptInService_SendOptInCode=function(u,t){r.Exec("IPS_OptInService","SendOptInCode",{OptInCode:u},t)};r.IPS_OptInService_StartService=function(t){r.Exec("IPS_OptInService","StartService",{},t)};r.IPS_OptInService_StopService=function(t){r.Exec("IPS_OptInService","StopService",{},t)};r.IPS_OptInService_RequestStateChange=function(u,v,t){r.Exec("IPS_OptInService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_RequestStateChange=function(u,v,t){r.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_ClearLog=function(t,u){r.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:t},u)};r.IPS_SecIOService_RequestStateChange=function(u,v,t){r.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AmtStatusToStr=function(t){if(r.AmtStatusCodes[t]){return r.AmtStatusCodes[t]}else{return"UNKNOWN_ERROR"}};r.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};r.GetMessageLog=function(t,u){r.AMT_MessageLog_PositionToFirstRecord(j,[t,u,[]])};function j(v,t,u,w,x){if(w!=200||u.Body.ReturnValue!="0"){x[0](r,null,x[2]);return}r.AMT_MessageLog_GetRecords(u.Body.IterationIdentifier,390,k,x)}function k(D,A,C,E,G){if(E!=200||C.Body.ReturnValue!="0"){G[0](r,null,G[2]);return}var y,z,I,v,u=G[2],F=new Date(),H,B=C.Body.RecordArray;if(typeof B==="string"){C.Body.RecordArray=[C.Body.RecordArray]}for(y in B){v=null;try{v=window.atob(B[y])}catch(w){}if(v!=null){H=ReadIntX(v,0);if((H>0)&&(H<4294967295)){I={DeviceAddress:v.charCodeAt(4),EventSensorType:v.charCodeAt(5),EventType:v.charCodeAt(6),EventOffset:v.charCodeAt(7),EventSourceType:v.charCodeAt(8),EventSeverity:v.charCodeAt(9),SensorNumber:v.charCodeAt(10),Entity:v.charCodeAt(11),EntityInstance:v.charCodeAt(12),EventData:[],Time:new Date((H+(F.getTimezoneOffset()*60))*1000)};for(z=13;z<21;z++){I.EventData.push(v.charCodeAt(z))}I.EntityStr=n[I.Entity];I.Desc=h(I.EventSensorType,I.EventOffset,I.EventData,I.Entity);if(!I.EntityStr){I.EntityStr="Unknown"}u.push(I)}}}if(C.Body.NoMoreRecords!=true){r.AMT_MessageLog_GetRecords(C.Body.IterationIdentifier,390,k,[G[0],u,G[2]])}else{G[0](r,u,G[2])}}var e="Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split("|");var o="Unspecified.|No system memory is physically installed in the system.|No usable system memory, all installed memory has experienced an unrecoverable failure.|Unrecoverable hard-disk/ATAPI/IDE device failure.|Unrecoverable system-board failure.|Unrecoverable diskette subsystem failure.|Unrecoverable hard-disk controller failure.|Unrecoverable PS/2 or USB keyboard failure.|Removable boot media not found.|Unrecoverable video controller failure.|No video device detected.|Firmware (BIOS) ROM corruption detected.|CPU voltage mismatch (processors that share same supply have mismatched voltage requirements)|CPU speed matching failure".split("|");var p="Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split("|");var n="Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split("|");r.RealmNames="||Redirection|PT Administration|Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split("|");r.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};function h(w,v,u,t){if(w==15){if(u[0]==235){return"Invalid Data"}if(v==0){return o[u[1]]}return p[u[1]]}if(w==18&&u[0]==170){return"Agent watchdog "+char2hex(u[4])+char2hex(u[3])+char2hex(u[2])+char2hex(u[1])+"-"+char2hex(u[6])+char2hex(u[5])+"-... changed to "+r.WatchdogCurrentStates[u[7]]}if(w==6){return"Authentication failed "+(u[1]+(u[2]<<8))+" times. The system may be under attack."}if(w==30){return"No bootable media"}if(w==32){return"Operating system lockup or power interrupt"}if(w==35){return"System boot failure"}if(w==37){return"System firmware started (at least one CPU is properly executing)."}return"Unknown Sensor Type #"+w}return r}var md5_k=[];for(var i=0;i<64;){md5_k[i]=0|(Math.abs(Math.sin(++i))*4294967296)}function hex_md5(o){var f,g,k,n,q=[],p=unescape(encodeURI(o)),e=p.length,l=[f=1732584193,g=-271733879,~f,~g],m=0;for(;m<=e;){q[m>>2]|=(p.charCodeAt(m)||128)<<8*(m++%4)}q[o=(e+8>>6)*16+14]=e*8;m=0;for(;m<o;m+=16){e=l;n=0;for(;n<64;){e=[k=e[3],((f=e[1]|0)+((k=((e[0]+[f&(g=e[2])|~f&k,k&f|~k&g,f^g^k,g^(f|~k)][e=n>>4])+(md5_k[n]+(q[[n,5*n+1,3*n+5,7*n][e]%16+m]|0))))<<(e=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*e+n++%4])|k>>>32-e)),f,g]}for(n=4;n;){l[--n]=l[n]+e[n]}}o="";for(;n<32;){o+=((l[n>>3]>>((1^n++&7)*4))&15).toString(16)}return o}function rstr_md5(a){return hex2rstr(hex_md5(a))}function execArgumentsToXml(c){if(c===undefined||c===null){return null}var d="";for(var b in c){var a=c[b];if(!a){continue}if(a.__parameterType==="reference"){d+=referenceToXml(b,a)}else{d+=instanceToXml(b,a)}}return d}function instanceToXml(d,c){if(c===undefined||c===null){return null}var b=!!c.__namespace;var h=b?"<q:":"<";var a=b?"</q:":"</";var e=b?(' xmlns:q="'+c.__namespace+'"'):"";var g="<r:"+d+e+">";for(var f in c){if(!c.hasOwnProperty(f)||f.indexOf("__")===0){continue}if(typeof c[f]==="function"||Array.isArray(c[f])){continue}if(typeof c[f]==="object"){console.error("only convert one level down...")}else{g+=h+f+">"+c[f].toString()+a+f+">"}}g+="</r:"+d+">";return g}function referenceToXml(b,a){if(a===undefined||a===null){return null}var c="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+a.__resourceUri+"</w:ResourceURI><w:SelectorSet>";for(var d in a){if(!a.hasOwnProperty(d)||d.indexOf("__")===0){continue}if(typeof a[d]==="function"||typeof a[d]==="object"||Array.isArray(a[d])){continue}c+='<w:Selector Name="'+d+'">'+a[d].toString()+"</w:Selector>"}c+="</w:SelectorSet></a:ReferenceParameters></r:"+b+">";return c}function GetSidString(c){var b="S-"+c.charCodeAt(0)+"-"+c.charCodeAt(7);for(var a=2;a<(c.length/4);a++){b+="-"+ReadIntX(c,a*4)}return b}function GetSidByteArray(d){if(!d||d==null){return null}var c=d.split("-");if(c.length<4||(c[0]!="s"&&c[0]!="S")){return null}for(var a=1;a<c.length;a++){var e=parseInt(c[a]);if(e!=c[a]){return null}c[a]=e}var b=String.fromCharCode(c[1])+String.fromCharCode(c.length-3)+ShortToStr(Math.floor(c[2]/Math.pow(2,32)))+IntToStr((c[2])&65535);for(var a=3;a<c.length;a++){b+=IntToStrX(c[a])}return b}var CreateAmtRedirect=function(a){var b={};b.m=a;a.parent=b;b.State=0;b.socket=null;b.host=null;b.port=0;b.user=null;b.pass=null;b.authuri="/RedirectionService";b.tlsv1only=0;b.inDataCount=0;b.connectstate=0;b.protocol=a.protocol;b.debugmode=0;b.amtaccumulator="";b.amtsequence=1;b.amtkeepalivetimer=null;b.onStateChanged=null;b.Start=function(c,e,g,d,f){b.host=c;b.port=e;b.user=g;b.pass=d;b.connectstate=0;b.inDataCount=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+c+"&port="+e+"&tls="+f+((g=="*")?"&serverauth=1":"")+((typeof d==="undefined")?("&serverauth=1&user="+g):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed;b.xxStateChange(1)};b.xxOnSocketConnected=function(){if(b.debugmode==1){console.log("onSocketConnected")}b.xxStateChange(2);if(b.protocol==1){b.xxSend(b.RedirectStartSol)}if(b.protocol==2){b.xxSend(b.RedirectStartKvm)}if(b.protocol==3){b.xxSend(b.RedirectStartIder)}};b.xxOnMessage=function(g){if(b.debugmode==1){console.log("Recv",g.data)}b.inDataCount++;if(typeof g.data=="object"){var h=new FileReader();if(h.readAsBinaryString){h.onload=function(f){b.xxOnSocketData(f.target.result)};h.readAsBinaryString(new Blob([g.data]))}else{if(h.readAsArrayBuffer){h.onloadend=function(f){b.xxOnSocketData(f.target.result)};h.readAsArrayBuffer(g.data)}else{var c="";var d=new Uint8Array(g.data);var k=d.byteLength;for(var j=0;j<k;j++){c+=String.fromCharCode(d[j])}b.xxOnSocketData(c)}}}else{b.xxOnSocketData(g.data)}};b.xxOnSocketData=function(o){if(!o||b.connectstate==-1){return}if(typeof o==="object"){var g="";var j=new Uint8Array(o);var t=j.byteLength;for(var s=0;s<t;s++){g+=String.fromCharCode(j[s])}o=g}else{if(typeof o!=="string"){return}}if((b.protocol==2||b.protocol==3)&&b.connectstate==1){return b.m.ProcessData(o)}b.amtaccumulator+=o;while(b.amtaccumulator.length>=1){var k=0;switch(b.amtaccumulator.charCodeAt(0)){case 17:if(b.amtaccumulator.length<4){return}var G=b.amtaccumulator.charCodeAt(1);switch(G){case 0:if(b.amtaccumulator.length<13){return}var x=b.amtaccumulator.charCodeAt(12);if(b.amtaccumulator.length<13+x){return}b.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));k=(13+x);break;default:b.Stop(1);break}break;case 20:if(b.amtaccumulator.length<9){return}var e=ReadIntX(b.amtaccumulator,5);if(b.amtaccumulator.length<9+e){return}var F=b.amtaccumulator.charCodeAt(1);var f=b.amtaccumulator.charCodeAt(4);var c=[];for(s=0;s<e;s++){c.push(b.amtaccumulator.charCodeAt(9+s))}var d=b.amtaccumulator.substring(9,9+e);k=9+e;if(f==0){if(c.indexOf(4)>=0){b.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(b.user.length+b.authuri.length+8)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0,0))}else{if(c.indexOf(3)>=0){b.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(b.user.length+b.authuri.length+7)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0))}else{if(c.indexOf(1)>=0){b.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(b.user.length+b.pass.length+2)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(b.pass.length)+b.pass)}else{b.Stop(2)}}}}else{if((f==3||f==4)&&F==1){var n=0;var B=d.charCodeAt(n);var A=d.substring(n+1,n+1+B);n+=(B+1);var w=d.charCodeAt(n);var v=d.substring(n+1,n+1+w);n+=(w+1);var z=0;var y=null;var l=b.xxRandomNonce(32);var E="00000002";var q="";if(f==4){z=d.charCodeAt(n);y=d.substring(n+1,n+1+z);n+=(z+1);q=E+":"+l+":"+y+":"}var p=hex_md5(hex_md5(b.user+":"+A+":"+b.pass)+":"+v+":"+q+hex_md5("POST:"+b.authuri));var H=b.user.length+A.length+v.length+b.authuri.length+l.length+E.length+p.length+7;if(f==4){H+=(y.length+1)}var h=String.fromCharCode(19,0,0,0,f)+IntToStrX(H)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(A.length)+A+String.fromCharCode(v.length)+v+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(l.length)+l+String.fromCharCode(E.length)+E+String.fromCharCode(p.length)+p;if(f==4){h+=(String.fromCharCode(y.length)+y)}b.xxSend(h)}else{if(F==0){if(b.protocol==1){var u=10000;var J=100;var I=0;var D=10000;var C=100;var r=0;b.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(u)+ShortToStrX(J)+ShortToStrX(I)+ShortToStrX(D)+ShortToStrX(C)+ShortToStrX(r)+IntToStrX(0))}if(b.protocol==2){b.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0))}if(b.protocol==3){b.connectstate=1;b.xxStateChange(3)}}else{b.Stop(3)}}}break;case 33:if(b.amtaccumulator.length<23){break}k=23;b.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(b.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));if(b.protocol==1){b.amtkeepalivetimer=setInterval(b.xxSendAmtKeepAlive,2000)}b.connectstate=1;b.xxStateChange(3);break;case 41:if(b.amtaccumulator.length<10){break}k=10;break;case 42:if(b.amtaccumulator.length<10){break}var m=(10+((b.amtaccumulator.charCodeAt(9)&255)<<8)+(b.amtaccumulator.charCodeAt(8)&255));if(b.amtaccumulator.length<m){break}b.m.ProcessData(b.amtaccumulator.substring(10,m));k=m;break;case 43:if(b.amtaccumulator.length<8){break}k=8;break;case 65:if(b.amtaccumulator.length<8){break}b.connectstate=1;b.m.Start();if(b.amtaccumulator.length>8){b.m.ProcessData(b.amtaccumulator.substring(8))}k=b.amtaccumulator.length;break;default:console.log("Unknown Intel AMT command: "+b.amtaccumulator.charCodeAt(0)+" acclen="+b.amtaccumulator.length);b.Stop(4);return}if(k==0){return}b.amtaccumulator=b.amtaccumulator.substring(k)}};b.xxSend=function(e){if(b.socket!=null&&b.socket.readyState==WebSocket.OPEN){if(b.debugmode==1){console.log("Send",e)}var c=new Uint8Array(e.length);for(var d=0;d<e.length;++d){c[d]=e.charCodeAt(d)}b.socket.send(c.buffer)}};b.send=function(c){if(b.socket==null||b.connectstate!=1){return}if(b.protocol==1){b.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(c.length)+c)}else{b.xxSend(c)}};b.xxSendAmtKeepAlive=function(){if(b.socket==null){return}b.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(b.amtsequence++))};b.xxRandomNonceX="abcdef0123456789";b.xxRandomNonce=function(d){var e="";for(var c=0;c<d;c++){e+=b.xxRandomNonceX.charAt(Math.floor(Math.random()*b.xxRandomNonceX.length))}return e};b.xxOnSocketClosed=function(){if(b.debugmode==1){console.log("onSocketClosed")}if((b.inDataCount==0)&&(b.tlsv1only==0)){b.tlsv1only=1;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+b.host+"&port="+b.port+"&tls="+b.tls+"&tls1only=1"+((b.user=="*")?"&serverauth=1":"")+((typeof pass==="undefined")?("&serverauth=1&user="+b.user):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed}else{b.Stop(5)}};b.xxStateChange=function(c){if(b.State==c){return}b.State=c;b.m.xxStateChange(b.State);if(b.onStateChanged!=null){b.onStateChanged(b,b.State)}};b.Stop=function(c){if(b.debugmode==1){console.log("onSocketStop",c)}b.xxStateChange(0);b.connectstate=-1;b.amtaccumulator="";if(b.socket!=null){b.socket.close();b.socket=null}if(b.amtkeepalivetimer!=null){clearInterval(b.amtkeepalivetimer);b.amtkeepalivetimer=null}};b.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);b.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);b.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return b};var CreateAmtRemoteDesktop=function(l,o){var n={};n.canvasid=l;n.CanvasId=Q(l);n.scrolldiv=o;n.canvas=Q(l).getContext("2d");n.protocol=2;n.state=0;n.acc="";n.ScreenWidth=960;n.ScreenHeight=700;n.width=0;n.height=0;n.rwidth=0;n.rheight=0;n.bpp=2;n.useZRLE=true;n.showmouse=true;n.buttonmask=0;n.spare=null;n.sparew=0;n.spareh=0;n.sparew2=0;n.spareh2=0;n.sparecache={};n.ZRLEfirst=1;n.onScreenSizeChange=null;n.frameRateDelay=0;n.kvmDataSupported=false;n.onKvmData=null;n.onKvmDataPending=[];n.onKvmDataAck=-1;n.holding=false;n.lastKeepAlive=Date.now();n.Debug=function(p){console.log(p)};n.xxStateChange=function(p){if(p==0){n.canvas.fillStyle="#000000";n.canvas.fillRect(0,0,n.width,n.height);n.canvas.canvas.width=n.rwidth=n.width=640;n.canvas.canvas.height=n.rheight=n.height=400;QS(n.canvasid).cursor="auto"}else{if(!n.showmouse){QS(n.canvasid).cursor="none"}}};n.ProcessData=function(r){if(!r){return}n.acc+=r;while(n.acc.length>0){var p=0;if(n.state==0&&n.acc.length>=12){p=12;n.state=1;n.send("RFB 003.008\n")}else{if(n.state==1&&n.acc.length>=1){p=n.acc.charCodeAt(0)+1;n.send(String.fromCharCode(1));n.state=2}else{if(n.state==2&&n.acc.length>=4){p=4;if(ReadInt(n.acc,0)!=0){return n.Stop()}n.send(String.fromCharCode(1));n.state=3}else{if(n.state==3&&n.acc.length>=24){var C=ReadInt(n.acc,20);if(n.acc.length<24+C){return}p=24+C;n.canvas.canvas.width=n.rwidth=n.width=n.ScreenWidth=ReadShort(n.acc,0);n.canvas.canvas.height=n.rheight=n.height=n.ScreenHeight=ReadShort(n.acc,2);var F="";if(n.useZRLE){F+=IntToStr(16)}F+=IntToStr(0);F+=IntToStr(1092);n.send(String.fromCharCode(2,0)+ShortToStr((F.length/4)+1)+F+IntToStr(-223));if(n.bpp==1){n.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0))}n.state=4;n.parent.xxStateChange(3);g();if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}else{if(n.state==4){switch(n.acc.charCodeAt(0)){case 0:if(n.acc.length<4){return}n.state=100+ReadShort(n.acc,2);p=4;break;case 2:p=1;break;case 3:if(n.acc.length<8){return}var B=ReadInt(n.acc,4)+8;if(n.acc.length<B){return}p=m(n.acc);break}}else{if(n.state>100&&n.acc.length>=12){var H=ReadShort(n.acc,0),J=ReadShort(n.acc,2),G=ReadShort(n.acc,4),z=ReadShort(n.acc,6),E=G*z,w=ReadInt(n.acc,8);if(w<17){if(G<1||G>64||z<1||z>64){console.log("Invalid tile size ("+G+","+z+"), disconnecting.");return n.Stop()}if(n.sparew!=G||n.spareh!=z){n.sparew=n.sparew2=G;n.spareh=n.spareh2=z;var I=n.sparew2+"x"+n.spareh2;n.spare=n.sparecache[I];if(!n.spare){n.sparecache[I]=n.spare=n.canvas.createImageData(n.sparew2,n.spareh2)}}}if(w==4294967073){n.canvas.canvas.width=n.rwidth=n.width=G;n.canvas.canvas.height=n.rheight=n.height=z;n.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(n.width)+ShortToStr(n.height));p=12;if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}else{if(w==0){var D=12,q=12+(E*n.bpp);if(n.acc.length<q){return}p=q;for(var A=0;A<E;A++){h(n.acc.charCodeAt(D++)+((n.bpp==2)?(n.acc.charCodeAt(D++)<<8):0),A)}f(n.spare,H,J)}else{if(w==16){if(n.acc.length<16){return}var t=ReadInt(n.acc,12);if(n.acc.length<(16+t)){return}var D=16,u=5,v=0;if(t>5&&n.acc.charCodeAt(D)==0&&ReadShortX(n.acc,D+1)==(t-u)){a(n.acc,D+5,H,J,G,z,E,t)}p=16+t}else{n.Debug("Unknown Encoding: "+w);return n.Stop()}}}if(--n.state==100){n.state=4;if(n.frameRateDelay==0){g()}else{setTimeout(g,n.frameRateDelay)}}}}}}}}if(p==0){return}n.acc=n.acc.substring(p)}};function a(r,B,J,K,I,u,F,t){var G=r.charCodeAt(B++),z,H,E,A={},C=0,D=0,w;if(G==0){for(w=0;w<F;w++){h(r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0),w)}f(n.spare,J,K)}else{if(G==1){H=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0);n.canvas.fillStyle="rgb("+((n.bpp==1)?((H&224)+","+((H&28)<<3)+","+b((H&3)<<6)):(((H>>8)&248)+","+((H>>3)&252)+","+((H&31)<<3)))+")";n.canvas.fillRect(J,K,I,u)}else{if(G>1&&G<17){var q=4,p=15;for(w=0;w<G;w++){A[w]=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0)}if(G==2){q=1;p=1}else{if(G<=4){q=2;p=3}}while(C<F&&B<r.length){H=r.charCodeAt(B++);for(w=(8-q);w>=0;w-=q){h(A[(H>>w)&p],C++)}}f(n.spare,J,K)}else{if(G==128){while(C<F&&B<r.length){H=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0);D=1;do{D+=(E=r.charCodeAt(B++))}while(E==255);while(--D>=0){h(H,C++)}}f(n.spare,J,K)}else{if(G>129){for(w=0;w<(G-128);w++){A[w]=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0)}while(C<F&&B<r.length){D=1;z=r.charCodeAt(B++);H=A[z%128];if(z>127){do{D+=(E=r.charCodeAt(B++))}while(E==255)}while(--D>=0){h(H,C++)}}f(n.spare,J,K)}}}}}}n.hold=function(p){if(n.holding==p){return}n.holding=p;n.canvas.fillStyle="#000000";n.canvas.fillRect(0,0,n.width,n.height);if(n.holding==false){if((n.canvas.canvas.width!=n.width)||(n.canvas.canvas.height!=n.height)){n.canvas.canvas.width=n.width;n.canvas.canvas.height=n.height;if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}n.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(n.width)+ShortToStr(n.height))}else{n.UnGrabMouseInput();n.UnGrabKeyInput()}};function f(p,q,r){if(n.holding==true){return}n.canvas.putImageData(p,q,r)}function h(s,q){var r=q*4;if(n.bpp==1){n.spare.data[r++]=s&224;n.spare.data[r++]=(s&28)<<3;n.spare.data[r++]=b((s&3)<<6)}else{n.spare.data[r++]=(s>>8)&248;n.spare.data[r++]=(s>>3)&252;n.spare.data[r++]=(s&31)<<3}n.spare.data[r]=255}function b(p){return(p>127)?(p+32):p}function g(){if(n.holding==true){return}n.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(n.rwidth)+ShortToStr(n.rheight))}n.Start=function(){n.state=0;n.acc="";n.ZRLEfirst=1;n.onKvmDataPending=[];n.onKvmDataAck=-1;n.kvmDataSupported=false;for(var p in n.sparecache){delete n.sparecache[p]}};n.Stop=function(){n.UnGrabMouseInput();n.UnGrabKeyInput();n.parent.Stop()};n.send=function(p){n.parent.send(p)};var k={Pause:19,CapsLock:20,Space:32,Quote:39,Minus:45,NumpadMultiply:42,NumpadAdd:43,PrintScreen:44,Comma:44,NumpadSubtract:45,NumpadDecimal:46,Period:46,Slash:47,NumpadDivide:47,Semicolon:59,Equal:61,OSLeft:91,BracketLeft:91,OSRight:91,Backslash:92,BracketRight:93,ContextMenu:93,Backquote:96,NumLock:144,ScrollLock:145,Backspace:65288,Tab:65289,Enter:65293,NumpadEnter:65293,Escape:65307,Delete:65535,Home:65360,PageUp:65365,PageDown:65366,ArrowLeft:65361,ArrowUp:65362,ArrowRight:65363,ArrowDown:65364,End:65367,Insert:65379,F1:65470,F2:65471,F3:65472,F4:65473,F5:65474,F6:65475,F7:65476,F8:65477,F9:65478,F10:65479,F11:65480,F12:65481,ShiftLeft:65505,ShiftRight:65506,ControlLeft:65507,ControlRight:65508,AltLeft:65513,AltRight:65514,MetaLeft:65511,MetaRight:65512};function j(p){if(p.code.startsWith("Key")&&p.code.length==4){return p.code.charCodeAt(3)+((p.shiftKey==false)?32:0)}if(p.code.startsWith("Digit")&&p.code.length==6){return p.code.charCodeAt(5)}if(p.code.startsWith("Numpad")&&p.code.length==7){return p.code.charCodeAt(6)}return k[p.code]}function c(p,q){if(!q){q=window.event}if(q.code){var r=j(q);if(r!=null){n.sendkey(r,p)}}else{var r=q.keyCode,s=r;if(q.shiftKey==false&&r>=65&&r<=90){s=r+32}if(r>=112&&r<=124){s=r+65358}if(r==8){s=65288}if(r==9){s=65289}if(r==13){s=65293}if(r==16){s=65505}if(r==17){s=65507}if(r==18){s=65513}if(r==27){s=65307}if(r==33){s=65365}if(r==34){s=65366}if(r==35){s=65367}if(r==36){s=65360}if(r==37){s=65361}if(r==38){s=65362}if(r==39){s=65363}if(r==40){s=65364}if(r==45){s=65379}if(r==46){s=65535}if(r>=96&&r<=105){s=r-48}if(r==106){s=42}if(r==107){s=43}if(r==109){s=45}if(r==110){s=46}if(r==111){s=47}if(r==186){s=59}if(r==187){s=61}if(r==188){s=44}if(r==189){s=45}if(r==190){s=46}if(r==191){s=47}if(r==192){s=96}if(r==219){s=91}if(r==220){s=92}if(r==221){s=93}if(r==222){s=39}n.sendkey(s,p)}return n.haltEvent(q)}n.sendkey=function(r,p){if(typeof r=="object"){for(var q in r){n.sendkey(r[q][0],r[q][1])}}else{n.send(String.fromCharCode(4,p,0,0)+IntToStr(r))}};function m(p){if(p.length<8){return 0}var r=ReadInt(n.acc,4)+8;if(p.length<r){return 0}if(n.onKvmData!=null){var q=p.substring(8,r);if((q.length>=16)&&(q.substring(0,15)=="\0KvmDataChannel")){if(n.kvmDataSupported==false){n.kvmDataSupported=true;console.log("KVM Data Channel Supported.")}if(((n.onKvmDataAck==-1)&&(q.length==16))||(q.charCodeAt(15)!=0)){n.onKvmDataAck=true}if(q.length>=16){n.onKvmData(q.substring(16))}if((n.onKvmDataAck==true)&&(n.onKvmDataPending.length>0)){n.sendKvmData(n.onKvmDataPending.shift())}}}return r}n.sendKvmData=function(p){if(n.onKvmDataAck!==true){n.onKvmDataPending.push(p)}else{p="\0KvmDataChannel\0"+p;n.send(String.fromCharCode(6,0,0,0)+IntToStr(p.length)+p);n.onKvmDataAck=false}};n.sendKeepAlive=function(){if(n.lastKeepAlive<Date.now()-5000){n.lastKeepAlive=Date.now();n.send(String.fromCharCode(6,0,0,0)+IntToStr(16)+"\0KvmDataChannel\0")}};n.SendCtrlAltDelMsg=function(){n.sendcad()};n.sendcad=function(){n.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var e=false;var d=false;n.GrabMouseInput=function(){if(e==true){return}var p=n.canvas.canvas;p.onmouseup=n.mouseup;p.onmousedown=n.mousedown;p.onmousemove=n.mousemove;e=true};n.UnGrabMouseInput=function(){if(e==false){return}var p=n.canvas.canvas;p.onmousemove=null;p.onmouseup=null;p.onmousedown=null;e=false};n.GrabKeyInput=function(){if(d==true){return}document.onkeyup=n.handleKeyUp;document.onkeydown=n.handleKeyDown;document.onkeypress=n.handleKeys;d=true};n.UnGrabKeyInput=function(){if(d==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d=false};n.handleKeys=function(p){return n.haltEvent(p)};n.handleKeyUp=function(p){return c(0,p)};n.handleKeyDown=function(p){return c(1,p)};n.haltEvent=function(p){if(p.preventDefault){p.preventDefault()}if(p.stopPropagation){p.stopPropagation()}return false};n.mousedown=function(p){n.buttonmask|=(1<<p.button);return n.mousemove(p)};n.mouseup=function(p){n.buttonmask&=(65535-(1<<p.button));return n.mousemove(p)};n.mousemove=function(p){if(n.state!=4){return true}var q=n.getPositionOfControl(Q(n.canvasid));n.mx=(p.pageX-q[0])*(n.canvas.canvas.height/Q(n.canvasid).offsetHeight);n.my=((p.pageY-q[1]+(o?o.scrollTop:0))*(n.canvas.canvas.width/Q(n.canvasid).offsetWidth));n.send(String.fromCharCode(5,n.buttonmask)+ShortToStr(n.mx)+ShortToStr(n.my));return n.haltEvent(p)};n.getPositionOfControl=function(p){var q=Array(2);q[0]=q[1]=0;while(p){q[0]+=p.offsetLeft;q[1]+=p.offsetTop;p=p.offsetParent}return q};return n};var ZLIB=(ZLIB||{});if(typeof ZLIB.common_initialized==="undefined"){ZLIB.Z_NO_FLUSH=0;ZLIB.Z_PARTIAL_FLUSH=1;ZLIB.Z_SYNC_FLUSH=2;ZLIB.Z_FULL_FLUSH=3;ZLIB.Z_FINISH=4;ZLIB.Z_BLOCK=5;ZLIB.Z_TREES=6;ZLIB.Z_OK=0;ZLIB.Z_STREAM_END=1;ZLIB.Z_NEED_DICT=2;ZLIB.Z_ERRNO=(-1);ZLIB.Z_STREAM_ERROR=(-2);ZLIB.Z_DATA_ERROR=(-3);ZLIB.Z_MEM_ERROR=(-4);ZLIB.Z_BUF_ERROR=(-5);ZLIB.Z_VERSION_ERROR=(-6);ZLIB.Z_DEFLATED=8;ZLIB.z_stream=function(){this.next_in=0;this.avail_in=0;this.total_in=0;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg=null;this.state=null;this.data_type=0;this.adler=0;this.input_data="";this.output_data="";this.error=0;this.checksum_function=null};ZLIB.gz_header=function(){this.text=0;this.time=0;this.xflags=0;this.os=255;this.extra=null;this.extra_len=0;this.extra_max=0;this.name=null;this.name_max=0;this.comment=null;this.comm_max=0;this.hcrc=0;this.done=0};ZLIB.common_initialized=true}if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js")}(function(){var n=15;var F=0;var C=1;var al=2;var ae=3;var z=4;var A=5;var ab=6;var h=7;var E=8;var p=9;var o=10;var am=11;var an=12;var ai=13;var k=14;var j=15;var ak=16;var V=17;var f=18;var R=19;var P=20;var S=21;var q=22;var r=23;var Z=24;var X=25;var d=26;var U=27;var u=28;var a=29;var aa=30;var aj=31;var y=852;var x=592;var w=(y+x);var g=0;var W=1;var t=2;var M=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var N=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69];var K=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var L=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ZLIB.inflate_copyright=" inflate 1.2.6 Copyright 1995-2012 Mark Adler ";function J(aQ,aU){var aL=15;var aT=aQ.next;var ar=(aU==t?aQ.distbits:aQ.lenbits);var aW=aQ.work;var aG=aQ.lens;var aH=(aU==t?aQ.nlen:0);var aR=aQ.codes;var at;if(aU==W){at=aQ.nlen}else{if(aU==t){at=aQ.ndist}else{at=19}}var aF;var aS;var aM,aK;var aP;var av;var aw;var aE;var aV;var aC;var aD;var aA;var aI;var aJ;var aB;var aN;var ap;var aq;var ay;var az;var ax;var au=new Array(aL+1);var aO=new Array(aL+1);for(aF=0;aF<=aL;aF++){au[aF]=0}for(aS=0;aS<at;aS++){au[aG[aH+aS]]++}aP=ar;for(aK=aL;aK>=1;aK--){if(au[aK]!=0){break}}if(aP>aK){aP=aK}if(aK==0){aB={op:64,bits:1,val:0};aR[aT++]=aB;aR[aT++]=aB;if(aU==t){aQ.distbits=1}else{aQ.lenbits=1}aQ.next=aT;return 0}for(aM=1;aM<aK;aM++){if(au[aM]!=0){break}}if(aP<aM){aP=aM}aE=1;for(aF=1;aF<=aL;aF++){aE<<=1;aE-=au[aF];if(aE<0){return -1}}if(aE>0&&(aU==g||aK!=1)){aQ.next=aT;return -1}aO[1]=0;for(aF=1;aF<aL;aF++){aO[aF+1]=aO[aF]+au[aF]}for(aS=0;aS<at;aS++){if(aG[aH+aS]!=0){aW[aO[aG[aH+aS]]++]=aS}}switch(aU){case g:ap=ay=aW;aq=0;az=0;ax=19;break;case W:ap=M;aq=-257;ay=N;az=-257;ax=256;break;default:ap=K;ay=L;aq=0;az=0;ax=-1}aC=0;aS=0;aF=aM;aN=aT;av=aP;aw=0;aI=-1;aV=1<<aP;aJ=aV-1;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}for(;;){aB={op:0,bits:aF-aw,val:0};if(aW[aS]<ax){aB.val=aW[aS]}else{if(aW[aS]>ax){aB.op=ay[az+aW[aS]];aB.val=ap[aq+aW[aS]]}else{aB.op=32+64}}aD=1<<(aF-aw);aA=1<<av;aM=aA;do{aA-=aD;aR[aN+(aC>>>aw)+aA]=aB}while(aA!=0);aD=1<<(aF-1);while(aC&aD){aD>>>=1}if(aD!=0){aC&=aD-1;aC+=aD}else{aC=0}aS++;if(--(au[aF])==0){if(aF==aK){break}aF=aG[aH+aW[aS]]}if(aF>aP&&(aC&aJ)!=aI){if(aw==0){aw=aP}aN+=aM;av=aF-aw;aE=(1<<av);while(av+aw<aK){aE-=au[av+aw];if(aE<=0){break}av++;aE<<=1}aV+=1<<av;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}aI=aC&aJ;aR[aT+aI]={op:av,bits:aP,val:aN-aT}}}if(aC!=0){aR[aN+aC]={op:64,bits:aF-aw,val:0}}aQ.next=aT+aV;if(aU==t){aQ.distbits=aP}else{aQ.lenbits=aP}return 0}function G(aM,aK){var aL;var aB;var aH;var aC;var aJ;var ap;var aw;var aQ;var aN;var aP;var aO;var aA;var aq;var ar;var aD;var at;var aG;var av;var az;var aI;var aE;var au;var ay=-1;var ax=-1;aL=aM.state;aB=aM.input_data;aH=aM.next_in;aC=aH+aM.avail_in-5;aJ=aM.next_out;ap=aJ-(aK-aM.avail_out);aw=aJ+(aM.avail_out-257);aQ=aL.wsize;aN=aL.whave;aP=aL.wnext;aO=aL.window;aA=aL.hold;aq=aL.bits;ar=aL.codes;aD=aL.lencode;at=aL.distcode;aG=(1<<aL.lenbits)-1;av=(1<<aL.distbits)-1;loop:do{if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[aD+(aA&aG)];dolen:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI==0){aM.output_data+=String.fromCharCode(az.val);aJ++}else{if(aI&16){aE=az.val;aI&=15;if(aI){if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}aE+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI}if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[at+(aA&av)];dodist:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI&16){au=az.val;aI&=15;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}}au+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI;aI=aJ-ap;if(au>aI){aI=au-aI;if(aI>aN){if(aL.sane){aM.msg="invalid distance too far back";aL.mode=a;break loop}}ay=0;ax=-1;if(aP==0){ay+=aQ-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;aI=0;ay=-1;ax=aJ-au}}else{ay+=aP-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;ay=-1;ax=aJ-au}}}else{ay=-1;ax=aJ-au}if(ay>=0){aM.output_data+=aO.substring(ay,ay+aE);aJ+=aE;ay+=aE}else{var aF=aE;if(aF>aJ-ax){aF=aJ-ax}aM.output_data+=aM.output_data.substring(ax,ax+aF);aJ+=aF;aE-=aF;ax+=aF;aJ+=aE;while(aE>2){aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aE-=3}if(aE){aM.output_data+=aM.output_data.charAt(ax++);if(aE>1){aM.output_data+=aM.output_data.charAt(ax++)}}}}else{if((aI&64)==0){az=ar[at+(az.val+(aA&((1<<aI)-1)))];continue dodist}else{aM.msg="invalid distance code";aL.mode=a;break loop}}break dodist}}else{if((aI&64)==0){az=ar[aD+(az.val+(aA&((1<<aI)-1)))];continue dolen}else{if(aI&32){aL.mode=am;break loop}else{aM.msg="invalid literal/length code";aL.mode=a;break loop}}}}break dolen}}while(aH<aC&&aJ<aw);aE=aq>>>3;aH-=aE;aq-=aE<<3;aA&=(1<<aq)-1;aM.next_in=aH;aM.next_out=aJ;aM.avail_in=(aH<aC?5+(aC-aH):5-(aH-aC));aM.avail_out=(aJ<aw?257+(aw-aJ):257-(aJ-aw));aL.hold=aA;aL.bits=aq}function ad(ar){var aq;var ap=new Array(ar);for(aq=0;aq<ar;aq++){ap[aq]=0}return ap}function D(ar,aq,ap){return(ar&&(aq in ar))?ar[aq]:ap}function e(){return 0}function I(){var aq;this.mode=0;this.last=0;this.wrap=0;this.havedict=0;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=0;this.distcode=0;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=0;this.lens=ad(320);this.work=ad(288);this.codes=new Array(w);var ap={op:0,bits:0,val:0};for(aq=0;aq<w;aq++){this.codes[aq]=ap}this.sane=0;this.back=0;this.was=0}ZLIB.inflateResetKeep=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;aq.total_in=aq.total_out=ap.total=0;aq.msg=null;if(ap.wrap){aq.adler=ap.wrap&1}ap.mode=F;ap.last=0;ap.havedict=0;ap.dmax=32768;ap.head=null;ap.hold=0;ap.bits=0;ap.lencode=0;ap.distcode=0;ap.next=0;ap.sane=1;ap.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(aq,ar){var at;var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;if(typeof ar==="undefined"){ar=n}if(ar<0){at=0;ar=-ar}else{at=(ar>>>4)+1;if(ar<48){ar&=15}}if(at==1&&(typeof ZLIB.adler32==="function")){aq.checksum_function=ZLIB.adler32}else{if(at==2&&(typeof ZLIB.crc32==="function")){aq.checksum_function=ZLIB.crc32}else{aq.checksum_function=e}}if(ar&&(ar<8||ar>15)){return ZLIB.Z_STREAM_ERROR}if(ap.window&&ap.wbits!=ar){ap.window=null}ap.wrap=at;ap.wbits=ar;ap.wsize=0;ap.whave=0;ap.wnext=0;return ZLIB.inflateResetKeep(aq)};ZLIB.inflateInit=function(aq){var ap=new ZLIB.z_stream();ap.state=new I();ZLIB.inflateReset(ap,aq);return ap};ZLIB.inflatePrime=function(ar,ap,at){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;if(ap<0){aq.hold=0;aq.bits=0;return ZLIB.Z_OK}if(ap>16||aq.bits+ap>32){return ZLIB.Z_STREAM_ERROR}at&=(1<<ap)-1;aq.hold+=at<<aq.bits;aq.bits+=ap;return ZLIB.Z_OK};var T=null;var s=null;function B(aq){var ap;if(!T){T=[{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:192},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:160},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:224},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:144},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:208},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:176},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:240},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:200},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:168},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:232},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:152},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:216},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:184},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:248},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:196},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:164},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:228},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:148},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:212},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:180},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:244},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:204},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:172},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:236},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:156},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:220},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:188},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:252},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:194},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:162},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:226},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:146},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:210},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:178},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:242},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:202},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:170},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:234},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:154},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:218},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:186},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:250},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:198},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:166},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:230},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:150},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:214},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:182},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:246},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:206},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:174},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:238},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:158},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:222},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:190},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:254},{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:193},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:161},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:225},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:145},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:209},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:177},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:241},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:201},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:169},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:233},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:153},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:217},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:185},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:249},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:197},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:165},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:229},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:149},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:213},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:181},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:245},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:205},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:173},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:237},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:157},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:221},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:189},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:253},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:195},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:163},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:227},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:147},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:211},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:243},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:203},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:171},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:235},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:155},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:219},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:187},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:251},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:199},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:167},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:231},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:151},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:215},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:183},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:247},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:207},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:175},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:239},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:159},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:223},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:191},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:255}]}if(!s){s=[{op:16,bits:5,val:1},{op:23,bits:5,val:257},{op:19,bits:5,val:17},{op:27,bits:5,val:4097},{op:17,bits:5,val:5},{op:25,bits:5,val:1025},{op:21,bits:5,val:65},{op:29,bits:5,val:16385},{op:16,bits:5,val:3},{op:24,bits:5,val:513},{op:20,bits:5,val:33},{op:28,bits:5,val:8193},{op:18,bits:5,val:9},{op:26,bits:5,val:2049},{op:22,bits:5,val:129},{op:64,bits:5,val:0},{op:16,bits:5,val:2},{op:23,bits:5,val:385},{op:19,bits:5,val:25},{op:27,bits:5,val:6145},{op:17,bits:5,val:7},{op:25,bits:5,val:1537},{op:21,bits:5,val:97},{op:29,bits:5,val:24577},{op:16,bits:5,val:4},{op:24,bits:5,val:769},{op:20,bits:5,val:49},{op:28,bits:5,val:12289},{op:18,bits:5,val:13},{op:26,bits:5,val:3073},{op:22,bits:5,val:193},{op:64,bits:5,val:0}]}aq.lencode=0;aq.distcode=512;for(ap=0;ap<512;ap++){aq.codes[ap]=T[ap]}for(ap=0;ap<32;ap++){aq.codes[ap+512]=s[ap]}aq.lenbits=9;aq.distbits=5}function ao(ar){var aq=ar.state;var ap=ar.output_data.length;if(aq.window===null){aq.window=""}if(aq.wsize==0){aq.wsize=1<<aq.wbits}if(ap>=aq.wsize){aq.window=ar.output_data.substring(ap-aq.wsize)}else{if(aq.whave+ap<aq.wsize){aq.window+=ar.output_data}else{aq.window=aq.window.substring(aq.whave-(aq.wsize-ap))+ar.output_data}}aq.whave=aq.window.length;if(aq.whave<aq.wsize){aq.wnext=aq.whave}else{aq.wnext=0}return 0}function l(aq,ar){var ap=[ar&255,(ar>>>8)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,2)}function m(aq,ar){var ap=[ar&255,(ar>>>8)&255,(ar>>>16)&255,(ar>>>24)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,4)}function Y(aq,ap){ap.strm=aq;ap.left=aq.avail_out;ap.next=aq.next_in;ap.have=aq.avail_in;ap.hold=aq.state.hold;ap.bits=aq.state.bits;return ap}function ag(ap){var aq=ap.strm;aq.next_in=ap.next;aq.avail_out=ap.left;aq.avail_in=ap.have;aq.state.hold=ap.hold;aq.state.bits=ap.bits}function O(ap){ap.hold=0;ap.bits=0}function af(ap){if(ap.have==0){return false}ap.have--;ap.hold+=(ap.strm.input_data.charCodeAt(ap.next++)&255)<<ap.bits;ap.bits+=8;return true}function ac(aq,ap){while(aq.bits<ap){if(!af(aq)){return false}}return true}function b(aq,ap){return aq.hold&((1<<ap)-1)}function v(aq,ap){aq.hold>>>=ap;aq.bits-=ap}function c(ap){ap.hold>>>=ap.bits&7;ap.bits-=ap.bits&7}function ah(ap){return((ap>>>24)&255)+((ap>>>8)&65280)+((ap&65280)<<8)+((ap&255)<<24)}var H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(aC,ar){var aB;var aA;var ap,ay;var aq;var au=-1;var at=-1;var av;var aw;var ax;var az;if(!aC||!aC.state||(!aC.input_data&&aC.avail_in!=0)){return ZLIB.Z_STREAM_ERROR}aB=aC.state;if(aB.mode==am){aB.mode=an}aA={};Y(aC,aA);ap=aA.have;ay=aA.left;az=ZLIB.Z_OK;inf_leave:for(;;){switch(aB.mode){case F:if(aB.wrap==0){aB.mode=an;break}if(!ac(aA,16)){break inf_leave}if((aB.wrap&2)&&aA.hold==35615){aB.check=aC.checksum_function(0,null,0,0);l(aC,aA.hold);O(aA);aB.mode=C;break}aB.flags=0;if(aB.head!==null){aB.head.done=-1}if(!(aB.wrap&1)||((b(aA,8)<<8)+(aA.hold>>>8))%31){aC.msg="incorrect header check";aB.mode=a;break}if(b(aA,4)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}v(aA,4);ax=b(aA,4)+8;if(aB.wbits==0){aB.wbits=ax}else{if(ax>aB.wbits){aC.msg="invalid window size";aB.mode=a;break}}aB.dmax=1<<ax;aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=aA.hold&512?p:am;O(aA);break;case C:if(!ac(aA,16)){break inf_leave}aB.flags=aA.hold;if((aB.flags&255)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}if(aB.flags&57344){aC.msg="unknown header flags set";aB.mode=a;break}if(aB.head!==null){aB.head.text=(aA.hold>>>8)&1}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=al;case al:if(!ac(aA,32)){break inf_leave}if(aB.head!==null){aB.head.time=aA.hold}if(aB.flags&512){m(aC,aA.hold)}O(aA);aB.mode=ae;case ae:if(!ac(aA,16)){break inf_leave}if(aB.head!==null){aB.head.xflags=aA.hold&255;aB.head.os=aA.hold>>>8}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=z;case z:if(aB.flags&1024){if(!ac(aA,16)){break inf_leave}aB.length=aA.hold;if(aB.head!==null){aB.head.extra_len=aA.hold}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.head.extra=""}else{if(aB.head!==null){aB.head.extra=null}}aB.mode=A;case A:if(aB.flags&1024){aq=aB.length;if(aq>aA.have){aq=aA.have}if(aq){if(aB.head!==null&&aB.head.extra!==null){ax=aB.head.extra_len-aB.length;aB.head.extra+=aC.input_data.substring(aA.next,aA.next+(ax+aq>aB.head.extra_max?aB.head.extra_max-ax:aq))}if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;aB.length-=aq}if(aB.length){break inf_leave}}aB.length=0;aB.mode=ab;case ab:if(aB.flags&2048){if(aA.have==0){break inf_leave}if(aB.head!==null&&aB.head.name===null){aB.head.name=""}aq=0;do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.name_max){aB.head.name+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.name=null}}aB.length=0;aB.mode=h;case h:if(aB.flags&4096){if(aA.have==0){break inf_leave}aq=0;if(aB.head!==null&&aB.head.comment===null){aB.head.comment=""}do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.comm_max){aB.head.comment+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.comment=null}}aB.mode=E;case E:if(aB.flags&512){if(!ac(aA,16)){break inf_leave}if(aA.hold!=(aB.check&65535)){aC.msg="header crc mismatch";aB.mode=a;break}O(aA)}if(aB.head!==null){aB.head.hcrc=(aB.flags>>>9)&1;aB.head.done=1}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;break;case p:if(!ac(aA,32)){break inf_leave}aC.adler=aB.check=ah(aA.hold);O(aA);aB.mode=o;case o:if(aB.havedict==0){ag(aA);return ZLIB.Z_NEED_DICT}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;case am:if(ar==ZLIB.Z_BLOCK||ar==ZLIB.Z_TREES){break inf_leave}case an:if(aB.last){c(aA);aB.mode=d;break}if(!ac(aA,3)){break inf_leave}aB.last=b(aA,1);v(aA,1);switch(b(aA,2)){case 0:aB.mode=ai;break;case 1:B(aB);aB.mode=R;if(ar==ZLIB.Z_TREES){v(aA,2);break inf_leave}break;case 2:aB.mode=ak;break;case 3:aC.msg="invalid block type";aB.mode=a}v(aA,2);break;case ai:c(aA);if(!ac(aA,32)){break inf_leave}if((aA.hold&65535)!=(((aA.hold>>>16)&65535)^65535)){aC.msg="invalid stored block lengths";aB.mode=a;break}aB.length=aA.hold&65535;O(aA);aB.mode=k;if(ar==ZLIB.Z_TREES){break inf_leave}case k:aB.mode=j;case j:aq=aB.length;if(aq){if(aq>aA.have){aq=aA.have}if(aq>aA.left){aq=aA.left}if(aq==0){break inf_leave}aC.output_data+=aC.input_data.substring(aA.next,aA.next+aq);aC.next_out+=aq;aA.have-=aq;aA.next+=aq;aA.left-=aq;aB.length-=aq;break}aB.mode=am;break;case ak:if(!ac(aA,14)){break inf_leave}aB.nlen=b(aA,5)+257;v(aA,5);aB.ndist=b(aA,5)+1;v(aA,5);aB.ncode=b(aA,4)+4;v(aA,4);if(aB.nlen>286||aB.ndist>30){aC.msg="too many length or distance symbols";aB.mode=a;break}aB.have=0;aB.mode=V;case V:while(aB.have<aB.ncode){if(!ac(aA,3)){break inf_leave}var aD=b(aA,3);aB.lens[H[aB.have++]]=aD;v(aA,3)}while(aB.have<19){aB.lens[H[aB.have++]]=0}aB.next=0;aB.lencode=0;aB.lenbits=7;az=J(aB,g);if(az){aC.msg="invalid code lengths set";aB.mode=a;break}aB.have=0;aB.mode=f;case f:while(aB.have<aB.nlen+aB.ndist){for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.val<16){v(aA,av.bits);aB.lens[aB.have++]=av.val}else{if(av.val==16){if(!ac(aA,av.bits+2)){break inf_leave}v(aA,av.bits);if(aB.have==0){aC.msg="invalid bit length repeat";aB.mode=a;break}ax=aB.lens[aB.have-1];aq=3+b(aA,2);v(aA,2)}else{if(av.val==17){if(!ac(aA,av.bits+3)){break inf_leave}v(aA,av.bits);ax=0;aq=3+b(aA,3);v(aA,3)}else{if(!ac(aA,av.bits+7)){break inf_leave}v(aA,av.bits);ax=0;aq=11+b(aA,7);v(aA,7)}}if(aB.have+aq>aB.nlen+aB.ndist){aC.msg="invalid bit length repeat";aB.mode=a;break}while(aq--){aB.lens[aB.have++]=ax}}}if(aB.mode==a){break}if(aB.lens[256]==0){aC.msg="invalid code -- missing end-of-block";aB.mode=a;break}aB.next=0;aB.lencode=aB.next;aB.lenbits=9;az=J(aB,W);if(az){aC.msg="invalid literal/lengths set";aB.mode=a;break}aB.distcode=aB.next;aB.distbits=6;az=J(aB,t);if(az){aC.msg="invalid distances set";aB.mode=a;break}aB.mode=R;if(ar==ZLIB.Z_TREES){break inf_leave}case R:aB.mode=P;case P:if(aA.have>=6&&aA.left>=258){ag(aA);G(aC,ay);Y(aC,aA);if(aB.mode==am){aB.back=-1}break}aB.back=0;for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.op&&(av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.lencode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if(aw.bits+av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;aB.length=av.val;if(av.op==0){aB.mode=X;break}if(av.op&32){aB.back=-1;aB.mode=am;break}if(av.op&64){aC.msg="invalid literal/length code";aB.mode=a;break}aB.extra=av.op&15;aB.mode=S;case S:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.length+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.was=aB.length;aB.mode=q;case q:for(;;){av=aB.codes[aB.distcode+b(aA,aB.distbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if((av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.distcode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if((aw.bits+av.bits)<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;if(av.op&64){aC.msg="invalid distance code";aB.mode=a;break}aB.offset=av.val;aB.extra=av.op&15;aB.mode=r;case r:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.offset+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.mode=Z;case Z:if(aA.left==0){break inf_leave}aq=ay-aA.left;if(aB.offset>aq){aq=aB.offset-aq;if(aq>aB.whave){if(aB.sane){aC.msg="invalid distance too far back";aB.mode=a;break}}if(aq>aB.wnext){aq-=aB.wnext;au=aB.wsize-aq;at=-1}else{au=aB.wnext-aq;at=-1}if(aq>aB.length){aq=aB.length}}else{au=-1;at=aC.next_out-aB.offset;aq=aB.length}if(aq>aA.left){aq=aA.left}aA.left-=aq;aB.length-=aq;if(au>=0){aC.output_data+=aB.window.substring(au,au+aq);aC.next_out+=aq;aq=0}else{aC.next_out+=aq;do{aC.output_data+=aC.output_data.charAt(at++)}while(--aq)}if(aB.length==0){aB.mode=P}break;case X:if(aA.left==0){break inf_leave}aC.output_data+=String.fromCharCode(aB.length);aC.next_out++;aA.left--;aB.mode=P;break;case d:if(aB.wrap){if(!ac(aA,32)){break inf_leave}ay-=aA.left;aC.total_out+=ay;aB.total+=ay;if(ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,aC.output_data.length-ay,ay)}ay=aA.left;if((aB.flags?aA.hold:ah(aA.hold))!=aB.check){aC.msg="incorrect data check";aB.mode=a;break}O(aA)}aB.mode=U;case U:if(aB.wrap&&aB.flags){if(!ac(aA,32)){break inf_leave}if(aA.hold!=(aB.total&4294967295)){aC.msg="incorrect length check";aB.mode=a;break}O(aA)}aB.mode=u;case u:az=ZLIB.Z_STREAM_END;break inf_leave;case a:az=ZLIB.Z_DATA_ERROR;break inf_leave;case aa:return ZLIB.Z_MEM_ERROR;case aj:default:return ZLIB.Z_STREAM_ERROR}}inf_leave:ag(aA);if(aB.wsize||(ay!=aC.avail_out&&aB.mode<a&&(aB.mode<d||ar!=ZLIB.Z_FINISH))){if(ao(aC)){aB.mode=aa;return ZLIB.Z_MEM_ERROR}}ap-=aC.avail_in;ay-=aC.avail_out;aC.total_in+=ap;aC.total_out+=ay;aB.total+=ay;if(aB.wrap&&ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,0,aC.output_data.length)}aC.data_type=aB.bits+(aB.last?64:0)+(aB.mode==am?128:0)+(aB.mode==R||aB.mode==k?256:0);if(((ap==0&&ay==0)||ar==ZLIB.Z_FINISH)&&az==ZLIB.Z_OK){az=ZLIB.Z_BUF_ERROR}return az};ZLIB.inflateEnd=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;ap.window=null;aq.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(at,au){var ar;var ap;var aq=16384;this.input_data=at;this.next_in=D(au,"next_in",0);this.avail_in=D(au,"avail_in",at.length-this.next_in);ar=D(au,"flush",ZLIB.Z_SYNC_FLUSH);ap=D(au,"avail_out",-1);var av="";do{this.avail_out=(ap>=0?ap:aq);this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,ar);if(ap>=0){return this.output_data}av+=this.output_data;if(this.avail_out>0){break}}while(this.error==ZLIB.Z_OK);return av};ZLIB.z_stream.prototype.inflateReset=function(ap){return ZLIB.inflateReset(this,ap)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js")}(function(){var c=65521;var d=5552;function b(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f.charCodeAt(j)&255;if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f.charCodeAt(j++)&255;k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(g--){e+=f.charCodeAt(j++)&255;k+=e}e%=c;k%=c}return e|(k<<16)}function a(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f[j];if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f[j++];k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(g--){e+=f[j++];k+=e}e%=c;k%=c}return e|(k<<16)}ZLIB.adler32=function(e,f,h,g){if(typeof f==="string"){return b(e,f,h,g)}else{return a(e,f,h,g)}};ZLIB.adler32_combine=function(e,f,g){var j;var k;var h;if(g<0){return 4294967295}g%=c;h=g;j=e&65535;k=h*j;k%=c;j+=(f&65535)+c-1;k+=((e>>16)&65535)+((f>>16)&65535)+c-h;if(j>=c){j-=c}if(j>=c){j-=c}if(k>=(c<<1)){k-=(c<<1)}if(k>=c){k-=c}return j|(k<<16)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js")}(function(){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function c(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g.charCodeAt(k++))&255]^(h>>>8)}while(--j)}return h^4294967295}function b(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g[k++])&255]^(h>>>8)}while(--j)}return h^4294967295}ZLIB.crc32=function(h,g,k,j){if(typeof g==="string"){return c(h,g,k,j)}else{return b(h,g,k,j)}};var d=32;function f(g,k){var j;var h=0;j=0;while(k){if(k&1){j^=g[h]}k>>=1;h++}return j}function e(j,g){var h;for(h=0;h<d;h++){j[h]=f(g,g[h])}}ZLIB.crc32_combine=function(g,h,k){var l;var o;var j;var m;if(k<=0){return g}j=new Array(d);m=new Array(d);m[0]=3988292384;o=1;for(l=1;l<d;l++){m[l]=o;o<<=1}e(j,m);e(m,j);do{e(j,m);if(k&1){g=f(j,g)}k>>=1;if(k==0){break}e(m,j);if(k&1){g=f(m,g)}k>>=1}while(k!=0);g^=h;return g}}());"use strict";var debugLevel=parseInt("{{{debuglevel}}}");var features=parseInt("{{{features}}}");var sessionTime=parseInt("{{{sessiontime}}}");var domain="{{{domain}}}";var domainUrl="{{{domainurl}}}";var meshserver=null;var xdr=null;var serverinfo=null;var nodes=[];var meshes={};var filetree={};var userinfo=null;var serverinfo=null;var users=null;var nodeShortIdent=0;var serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}";var debugmode=false;var attemptWebRTC=((features&128)!=0);var StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel® AMT Connected"];var files;var passRequirements="{{{passRequirements}}}";if(passRequirements!=""){passRequirements=JSON.parse(decodeURIComponent(passRequirements))}function startup(){if((features&32)==0){var b=null;try{b=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(b==null||top.active==false)){top.location=self.location;return}}window.onresize=center;center();QH("p1message","Connecting...");go(1);meshserver=MeshServerCreateControl(domainUrl);meshserver.onStateChanged=onStateChanged;meshserver.onMessage=onMessage;meshserver.Start();var c=localStorage.getItem("desktopsettings");if(c!=null){desktopsettings=JSON.parse(c)}applyDesktopSettings()}function onStateChanged(a,b){if(b==0){setDialogMode(0);go(0);setTimeout(serverPoll,5000)}else{if(b==2){meshserver.send({action:"meshes"});meshserver.send({action:"nodes"});meshserver.send({action:"files"});if(xxcurrentView<2){go(2)}}}}function serverPoll(){xdr=null;try{xdr=new XDomainRequest()}catch(a){}if(!xdr){xdr=new XMLHttpRequest()}xdr.open("HEAD",window.location.href);xdr.timeout=15000;xdr.onload=function(){reload()};xdr.onerror=xdr.ontimeout=function(){setTimeout(serverPoll,10000)};xdr.send()}function onMessage(l,d){switch(d.action){case"serverinfo":serverinfo=d.serverinfo;QV("p3AccountActions",((features&4)==0)&&(serverinfo.domainauth==false));QV("logoutMenuOption",((features&4)==0)&&(serverinfo.domainauth==false));break;case"userinfo":userinfo=d.userinfo;QH("p3userName",userinfo.name);QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("otpAuth",((features&4096)!=0)&&(userinfo.otpsecret!=1));QV("otpAuthRemove",((features&4096)!=0)&&(userinfo.otpsecret==1));break;case"users":users={};for(var c in d.users){users[d.users[c]._id]=d.users[c]}updateUsers();break;case"wssessioncount":wssessions=d.wssessions;updateUsers();break;case"meshes":meshes={};for(var c in d.meshes){meshes[d.meshes[c]._id]=d.meshes[c]}updateMeshes();updateDevices();break;case"files":filetree=setupBackPointers(d.filetree);updateFiles();break;case"nodes":nodes=[];for(var c in d.nodes){for(var e in d.nodes[c]){if(!meshes[c]){console.log("Invalid mesh (1): "+c);continue}d.nodes[c][e].namel=d.nodes[c][e].name.toLowerCase();if(d.nodes[c][e].rname){d.nodes[c][e].rnamel=d.nodes[c][e].rname.toLowerCase()}else{d.nodes[c][e].rnamel=d.nodes[c][e].namel}d.nodes[c][e].meshnamel=meshes[c].name.toLowerCase();d.nodes[c][e].meshid=c;d.nodes[c][e].state=(d.nodes[c][e].state)?(d.nodes[c][e].state):0;d.nodes[c][e].desc=d.nodes[c][e].desc;if(!d.nodes[c][e].icon){d.nodes[c][e].icon=1}d.nodes[c][e].ident=++nodeShortIdent;nodes.push(d.nodes[c][e])}}updateDevices();if(xxcurrentView==0){if("{{viewmode}}"!=""){go(parseInt("{{viewmode}}"))}else{setDialogMode(0);go(1)}}if("{{currentNode}}"!=""){gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"))}break;case"powertimeline":if(d.nodeid!=powerTimelineReq){break}powerTimelineNode=d.nodeid;powerTimeline=d.timeline;powerTimelineUpdate=Date.now()+300000;if(currentNode._id==d.nodeid){drawDeviceTimeline()}break;case"otpauth-request":if((xxdialogMode==2)&&(xxdialogTag=="otpauth-request")){var k=d.secret;if(k.length==52){k=k.split(/(.............)/).filter(Boolean).join(" ")}else{if(k.length==32){k=k.split(/(....)/).filter(Boolean).join(" ");k=k.substring(0,20)+"<br/>"+k.substring(20)}}QH("d2optinfo",'Install <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" rel="noreferrer noopener" target=_blank>Google Authenticator</a> or a compatible application, use <a href="'+d.url+'" rel="noreferrer noopener" target=_blank> this link</a> or enter the secret below. Then, enter the current 6 digit token to activate 2-Step login.<br /><br /><div style=width:100%;text-align:center><tt id=d2optsecret secret="'+d.secret+'" style=font-size:15px>'+k+'</tt><br /><br />Token: <input type=text onkeypress="return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text></div>');QV("idx_dlgOkButton",true);QE("idx_dlgOkButton",false);Q("d2otpauthinput").focus()}break;case"otpauth-setup":if(xxdialogMode){return}setDialogMode(2,"Add 2-Step Login",1,null,d.success?"<b style=color:green>2-step login activation successful</b>. You will now need a valid token to login again.":"<b style=color:red>2-step login activation failed</b>. Clear the secret from the application and try again. You only have a few minutes to enter the proper code.");break;case"otpauth-clear":if(xxdialogMode){return}setDialogMode(2,"Remove 2-Step Login",1,null,d.success?"<b style=color:green>2-step login activation removed</b>. You can reactivate this feature at any time.":"<b style=color:red>2-step login activation removal failed</b>. Try again.");break;case"event":switch(d.event.action){case"accountchange":if(userinfo.name==d.event.account.name){var g=d.event.account.siteadmin?d.event.account.siteadmin:0;var j=userinfo.siteadmin?userinfo.siteadmin:0;if((d.event.account.quota!=userinfo.quota)||(((userinfo.siteadmin&8)==0)&&((d.event.account.siteadmin&8)!=0))){meshserver.send({action:"files"})}userinfo=d.event.account;if(j!=g){updateSiteAdmin()}QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true))}break;case"createmesh":if(d.event.links["user/"+domain+"/"+userinfo.name.toLowerCase()]!=null){meshes[d.event.meshid]={_id:d.event.meshid,name:d.event.name,mtype:d.event.mtype,desc:d.event.desc,links:d.event.links};updateMeshes();updateDevices();meshserver.send({action:"files"})}break;case"meshchange":if(meshes[d.event.meshid]==null){meshes[d.event.meshid]={_id:d.event.meshid,name:d.event.name,mtype:d.event.mtype,desc:d.event.desc,links:d.event.links};meshserver.send({action:"nodes"})}else{meshes[d.event.meshid].name=d.event.name;meshes[d.event.meshid].desc=d.event.desc;meshes[d.event.meshid].links=d.event.links;if(meshes[d.event.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()]==null){if((xxcurrentView==20)&&(currentMesh==meshes[d.event.meshid])){go(2)}delete meshes[d.event.meshid];var f=[];for(var a in nodes){if(nodes[a].meshid!=d.event.meshid){f.push(nodes[a])}}nodes=f;if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==d.event.meshid){setDialogMode(0);go(1)}}}updateMeshes();updateDevices();meshserver.send({action:"files"});if(xxcurrentView==20&¤tMesh._id==d.event.meshid){p20updateMesh()}break;case"deletemesh":if(meshes[d.event.meshid]){delete meshes[d.event.meshid];updateMeshes();meshserver.send({action:"files"})}var f=[];for(var a in nodes){if(nodes[a].meshid!=d.event.meshid){f.push(nodes[a])}}nodes=f;updateDevices();if(xxcurrentView>=20&&xxcurrentView<30&¤tMesh._id==d.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==d.event.meshid){setDialogMode(0);go(1)}break;case"addnode":var h=d.event.node;if(!meshes[h.meshid]){break}h.namel=h.name.toLowerCase();if(h.rname){h.rnamel=h.rname.toLowerCase()}else{h.rnamel=h.namel}h.meshnamel=meshes[h.meshid].name.toLowerCase();h.state=0;if(!h.icon){h.icon=1}h.ident=++nodeShortIdent;nodes.push(h);updateDevices();break;case"removenode":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var h=nodes[b];if(currentNode==h){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(1)}currentNode=null}nodes.splice(b,1);updateDevices();updateMapMarkers()}break;case"changenode":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var h=nodes[b];h.name=d.event.node.name;h.rname=d.event.node.rname;h.host=d.event.node.host;h.desc=d.event.node.desc;h.publicip=d.event.node.publicip;h.iploc=d.event.node.iploc;h.wifiloc=d.event.node.wifiloc;h.gpsloc=d.event.node.gpsloc;h.tags=d.event.node.tags;h.userloc=d.event.node.userloc;if(d.event.node.agent!=null){if(h.agent==null){h.agent={}}if(d.event.node.agent.ver!=null){h.agent.ver=d.event.node.agent.ver}if(d.event.node.agent.id!=null){h.agent.id=d.event.node.agent.id}if(d.event.node.agent.caps!=null){h.agent.caps=d.event.node.agent.caps}if(d.event.node.agent.core!=null){h.agent.core=d.event.node.agent.core}else{if(h.agent.core){delete h.agent.core}}h.agent.tag=d.event.node.agent.tag}if(d.event.node.intelamt!=null){if(h.intelamt==null){h.intelamt={}}if(d.event.node.intelamt.host!=null){h.intelamt.user=d.event.node.intelamt.host}if(d.event.node.intelamt.user!=null){h.intelamt.user=d.event.node.intelamt.user}if(d.event.node.intelamt.tls!=null){h.intelamt.tls=d.event.node.intelamt.tls}if(d.event.node.intelamt.ver!=null){h.intelamt.ver=d.event.node.intelamt.ver}if(d.event.node.intelamt.state!=null){h.intelamt.state=d.event.node.intelamt.state}}h.namel=h.name.toLowerCase();if(h.rname){h.rnamel=h.rname.toLowerCase()}else{h.rnamel=h.namel}if(d.event.node.icon){h.icon=d.event.node.icon}refreshDevice(h._id);updateDevices()}break;case"nodeconnect":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var h=nodes[b];h.conn=d.event.conn;h.pwr=d.event.pwr;updateDevices()}break;case"clearevents":break;case"login":if(users!=null&&users["user/"+domain+"/"+d.event.username.toLowerCase()]){users["user/"+domain+"/"+d.event.username.toLowerCase()].login=d.event.time}break;case"notify":break;default:console.log("Unknown message.event.action",d.event.action);break}break;default:console.log("Unknown message.action",d.action);break}}function topMenu(a){if((xxdialogMode!=null)&&(xxdialogMode!=0)&&(xxdialogMode!=999)){return}if(a===undefined){var b=(QS("topMenu").display=="none");if(b==true){if((xxdialogMode==0)||(xxdialogMode==null)){QV("topMenu",true);xxdialogMode=999}}else{QV("topMenu",false);xxdialogMode=0}}else{QV("topMenu",false);xxdialogMode=0;if((a==1)&&(xxcurrentView!=3)){goForward("account")}if((a==2)&&(xxcurrentView!=5)){goForward("files")}}}var backStack=[];function goBack(){if(xxdialogMode){return}if(backStack.length>0){backStack.pop()}goStack()}function goForward(a){if(xxdialogMode){return}backStack.push(a);goStack()}function goStack(){if(backStack.length==0){go(2);return}var a=backStack[backStack.length-1],b=a.split("/")[0];if(b=="node"){setupDeviceMenu(0);gotoDevice(a)}if(b=="mesh"){gotoMesh(a)}if(b=="account"){go(3)}if(b=="devices"){go(2)}if(b=="files"){go(5)}}function updateFooterMenu(b){while(b!=null&&b.length<3){b.push({n:""})}var d="",c="";if(b!=null){for(var a in b){d+='<td style="cursor:pointer'+((c=="")?"":";border-left:solid 1px white")+'" onclick="'+b[a].f+'">'+b[a].n;c=b[a].n}}QH("footerMenu","<tr>"+d)}function account_addOtp(){if(xxdialogMode||(userinfo.otpsecret==1)||((features&4096)==0)){return}setDialogMode(2,"Add 2-Step Login",2,function(){meshserver.send({action:"otpauth-setup",secret:Q("d2optsecret").attributes.secret.value,token:Q("d2otpauthinput").value})},"<div id=d2optinfo>Loading...</div>","otpauth-request");meshserver.send({action:"otpauth-request"})}function account_addOtpCheck(a){var b=(Q("d2otpauthinput").value.length==6);QE("idx_dlgOkButton",b);if(a&&(a.keyCode==13)&&b){dialogclose(1)}}function account_removeOtp(){if(xxdialogMode||(userinfo.otpsecret!=1)||((features&4096)==0)){return}setDialogMode(2,"Remove 2-Step Login",3,function(){meshserver.send({action:"otpauth-clear"})},"Confirm removal of 2-step login?")}function account_showVerifyEmail(){if(xxdialogMode||(userinfo.emailVerified==true)||(serverinfo.emailcheck!=true)){return}var a="Click ok to send a verification mail to:<br /><div style=padding:8px><b>"+EscapeHtml(userinfo.email)+"</b></div>Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a)}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return}var a=addHtmlValue("Email","<input id=dp3email style=width:170px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp3email").value=userinfo.email}account_validateEmail();Q("dp3email").focus()}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp3email").value)&&(Q("dp3email").value!=userinfo.email));if((a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp3email").value})}function account_showDeleteAccount(){if(xxdialogMode){return}var a="<form action='"+domainUrl+"deleteaccount' method=post><table style=margin-left:10px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr></table><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_showChangePassword(){if(xxdialogMode){return}var a="<form action='"+domainUrl+"changepassword' method=post><table style=margin-left:10px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td>";a+="</tr><tr><td align=right>Hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off /></td>";a+="</tr></table><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Change Password",0,null,a);account_validateNewPassword();Q("apassword1").focus()}function account_createMesh(){if(xxdialogMode){return}if((userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true)&&(userinfo.siteadmin!=4294967295)){setDialogMode(2,"New Device Group",1,null,'Unable to create a new device group until the email address is verified. Go to the "My Account" menu option to change and verify an email address.');return}var a=addHtmlValue("Name","<input id=dp3meshname style=width:170px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");a+=addHtmlValue("Type","<div style=width:170px;margin:0;padding:0><select id=dp3meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Software Agent Group</option><option value=1>Intel® AMT only</option></select></div>");a+=addHtmlValue("Description","<div style=width:170px;margin:0;padding:0><textarea id=dp3meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"Create Device Group",3,account_createMeshEx,a);account_validateMeshCreate();Q("dp3meshname").focus()}function account_validateMeshCreate(){QE("idx_dlgOkButton",Q("dp3meshname").value.length>0)}function account_createMeshEx(a,b){meshserver.send({action:"createmesh",meshname:Q("dp3meshname").value,meshtype:Q("dp3meshtype").value,desc:Q("dp3meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value))}function account_validateNewPassword(){var d="",a=(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value);if(Q("apassword1").value!=""){if(passRequirements==null||passRequirements==""){var c=checkPasswordStrength(Q("apassword1").value);if(c>=80){d="<span style=color:green>●<span>"}else{if(c>=60){d="<span style=color:blue>●<span>"}else{d="<span style=color:red>●<span>"}}}else{var b=checkPasswordRequirements(Q("apassword1").value,passRequirements);if(b==false){a=false;d="<span style=color:red>●<span>"}}}QH("dxPassWarn",d);QE("account_dlgOkButton",a)}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}function checkPasswordRequirements(e,f){if((f==null)||(f=="")||(typeof f!="object")){return true}if(f.min){if(e.length<f.min){return false}}if(f.max){if(e.length>f.max){return false}}var d=0,b=0,g=0,c=0;for(var a=0;a<e.length;a++){if(/\d/.test(e[a])){d++}if(/[a-z]/.test(e[a])){b++}if(/[A-Z]/.test(e[a])){g++}if(/\W/.test(e[a])){c++}}if(f.num&&(d<f.num)){return false}if(f.lower&&(b<f.lower)){return false}if(f.upper&&(g<f.upper)){return false}if(f.nonalpha&&(c<f.nonalpha)){return false}return true}function updateMeshes(){var c="",a=0;for(i in meshes){a++;var b=meshes[i].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var d="Partial Rights";if(b==4294967295){d="Full Administrator"}else{if(b==0){d="No Rights"}}c+="<div style=cursor:pointer onclick=goForward('"+i+"')>";c+='<div style="float:left;margin-left:4px"><img src="/images/meshicon50.png" width=50 height=50 /></div>';c+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">';c+="<div><div style=padding-left:12px;padding-top:2px><b>"+EscapeHtml(meshes[i].name)+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+d+"</div></div>";c+="</div></div>"}QH("p3meshes",c);QV("p3noMeshFound",a==0)}function gotoMesh(a){currentMesh=meshes[a];if(currentMesh==null){goBack()}p20updateMesh();go(20)}function server_showRestoreDlg(){if(xxdialogMode){return}var a="Restore the server using a backup, <span style=color:red>this will delete the existing server data</span>. Only do this if you know what you are doing.<br /><br />";a+='<form action="/restoreserver.ashx" enctype="multipart/form-data" method="post"><div>';a+='<input id=account_dlgFileInput type=file name=datafile style=width:100% accept=".zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed" onchange=account_validateServerRestore()>';a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+="<input id=account_dlgOkButton type=submit value=OK style=float:right;width:80px onclick=dialogclose(1)>";a+="</div><br /><br /></form>";setDialogMode(2,"Restore Server",0,null,a);account_validateServerRestore()}function account_validateServerRestore(){QE("account_dlgOkButton",Q("account_dlgFileInput").files.length==1)}function server_showVersionDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Version",1,null,"Loading...","MeshCentralServerUpdate");meshserver.send({action:"serverversion"})}function server_showVersionDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showVersionDlgEx(){meshserver.send({action:"serverupdate"})}var filetreelinkpath;var filetreelocation=[];function p5refreshFiles(){meshserver.send({action:"files"})}function updateFiles(){QV("MainMenuMyFiles",((features&8)==0));if((features&8)!=0){return}var o="",p="",c="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",m="Root",w,g=filetree,k=1;var e=[],t=filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var q=0;q<a.length;q++){if(a[q].checked){b.push(a[q].value)}}filetreelinkpath="";for(var q in filetreelocation){if((g.f!=null)&&(g.f[filetreelocation[q]]!=null)){e.push(filetreelocation[q]);m+=" / "+filetreelocation[q];if((k==1)){var z=filetreelocation[q].split("/");w=window.location+z[0]+"files/"+z[2];filetreelinkpath+=filetreelocation[q]}else{if(filetreelinkpath!=""){filetreelinkpath+="/"+filetreelocation[q];if(k>2){w+="/"+filetreelocation[q]}}}g=g.f[filetreelocation[q]];c+=" / <a style=cursor:pointer onclick=p5folderup("+k+")>"+(g.n!=null?g.n:filetreelocation[q])+"</a>";k++}else{break}}filetreelocation=e;var u=m.toLowerCase().startsWith("root / "+userinfo._id+" / public");var j=p5sort_files(g.f);for(var q in j){var d=j[q],s=d.n,y;y=s;if(s.length>40){y='<span title="'+EscapeHtml(s)+'">'+EscapeHtml(s.substring(0,40))+"...</span>"}else{y=EscapeHtml(s)}s=EscapeHtml(s);var l="";if(d.s!=null){l=getFileSizeStr(d.s)}var n="";if(d.t<3||d.t==4){var x=(d.t==1||d.t==4)?p5getQuotabar(d):"",A="";n="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+s+"'> <span style=float:right;padding-right:4px title=\""+A+'">'+x+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(d.nx)+'")>'+y+"</a></span></div>"}else{var r=y;var v="";if(u){v=' (<a style=cursor:pointer title="Display public link" onclick=\'p5showPublicLink("'+w+"/"+d.nx+"\")'>Link</a>)"}if(d.s>0){r='<a rel="noreferrer noopener" target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+d.nx)+'">'+y+"</a>"+v}n="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+d.nx+"'> <span style=float:right;padding-right:4px>"+l+"</span><span><div class=fileIcon"+d.t+"></div>"+r+"</span></div>"}if(d.t<3){o+=n}else{p+=n}}QH("p5rightOfButtons",p5getQuotabar(g));QH("p5files",o+p);QH("p5currentpath",c);QE("p5FolderUp",filetreelocation.length!=0);QV("p5PublicShare",u);if(t==filetreelinkpath){a=document.getElementsByName("fc");for(var q=0;q<a.length;q++){a[q].checked=(b.indexOf(a[q].value)>=0)}}p5setActions()}function p5getQuotabar(a){while(a.t>1&&a.t!=4){a=a.parent}if((a.t!=1&&a.t!=4)||(a.maxbytes==null)){return""}var b=Math.floor(a.s/1024),c=Math.floor((a.maxbytes-a.s)/1024);return'<span title="'+b+"k in "+a.c+" file"+(a.c>1?"s":"")+". "+(Math.floor(a.maxbytes/1024))+'k maxinum">'+((c<0)?("Storage limit exceed"):(c+"k remaining"))+" <progress style=height:10px;width:100px value="+a.s+" max="+a.maxbytes+" /></span>"}function p5showPublicLink(a){setDialogMode(2,"Public Link",1,null,'<input type=text style=width:100% value="'+a+'" readonly />')}var sortorder;function p5sort_filename(c,d){if(c.ln>d.ln){return(1*sortorder)}if(c.ln<d.ln){return(-1*sortorder)}return 0}function p5sort_timestamp(c,d){if(c.d>d.d){return(1*sortorder)}if(c.d<d.d){return(-1*sortorder)}return 0}function p5sort_bysize(c,d){if(c.s==d.s){return p5sort_filename(c,d)}return(((c.s-d.s))*sortorder)}function p5sort_files(a){var c=[],d=Q("p5sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}sortorder=1;if(d>3){sortorder=-1;d-=3}if(d==1){c.sort(p5sort_filename)}else{if(d==2){c.sort(p5sort_bysize)}else{if(d==3){c.sort(p5sort_timestamp)}}}return c}function p5setActions(){var a=getFileSelCount(),c=getFileCount(),b=getFileSelCount(false);QE("p5DeleteFileButton",(a>0)&&(filetreelocation.length>0));QE("p5NewFolderButton",filetreelocation.length>0);QE("p5UploadButton",filetreelocation.length>0);QE("p5RenameFileButton",(a==1)&&(filetreelocation.length>0));QE("p5SelectAllButton",c>0);Q("p5SelectAllButton").value=(a>0?"None":"All");QE("p5CutButton",(b>0)&&(a==b));QE("p5CopyButton",(b>0)&&(a==b));QE("p5PasteButton",(p5clipboard!=null)&&(p5clipboard.length>0)&&(filetreelocation.length>0))}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}function p5selectallfile(){var c=(getFileSelCount()==0),a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){a[b].checked=c}p5setActions()}function setupBackPointers(d){if(d.f!=null){var b=0,a=0;for(var c in d.f){setupBackPointers(d.f[c]);d.f[c].parent=d;if(d.f[c].s){b+=d.f[c].s}if(d.f[c].c){a+=d.f[c].c}if(d.f[c].t==3){a++}}d.s=b;d.c=a}return d}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function p5folderup(a){if(a==null){filetreelocation.pop()}else{while(filetreelocation.length>a){filetreelocation.pop()}}updateFiles()}function p5folderset(a){filetreelocation.push(decodeURIComponent(a));updateFiles()}function p5createfolder(){setDialogMode(2,"New Folder",3,p5createfolderEx,"<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />");focusTextBox("p5renameinput");p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p5deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p5deletefileEx(){var b=[],a=document.getElementsByName("fc");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(a[c].value)}}meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:b})}function p5renamefile(){var c,a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){if(a[b].checked){c=a[b].value}}setDialogMode(2,"Rename",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:c});focusTextBox("p5renameinput");p5fileNameCheck()}function p5renamefileEx(a,c){c.newname=Q("p5renameinput").value;meshserver.send(c)}function p5fileNameCheck(a){var b=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a.keyCode==13)){dialogclose(1)}}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value="'+encodeURIComponent(filetreelinkpath)+'" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=submit id=p5loginSubmit style=display:none /></form>');updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(b){var a=document.getElementsByName("fc");p5clipboard=[];p5clipboardCut=b,p5clipboardFolder=Clone(filetreelocation);for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p5clipboard.push(a[c].value)}}p5updateClipview()}function p5pasteFile(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Confim "+(p5clipboardCut==0?"copy":"move")+" of "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p5pasteFileEx,a)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:(p5clipboardCut==0?"copy":"move"),scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard});p5folderup(999);if(p5clipboardCut==1){p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;p5updateClipview()}}function p5updateClipview(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Holding "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" for "+(p5clipboardCut==0?"copy":"move")+", <a onclick=p5clearClip() style=cursor:pointer>Clear</a>."}QH("p5bottomstatus",a);p5setActions()}function p5clearClip(){p5clipboard=null;p5clipboardFolder=null;p5clipboardCut=0;p5updateClipview()}function p5fileDragDrop(b){haltEvent(b);QV("bigfail",false);QV("bigok",false);if(b.dataTransfer==null||b.dataTransfer.files.length==0||filetreelocation.length==0){return}var f=[],j=[],k=[],a=[],h=b.dataTransfer.files.length;for(var d=0;d<b.dataTransfer.files.length;d++){var g=new FileReader(),c=b.dataTransfer.files[d];f.push(c.name);j.push(c.size);k.push(c.type);g.onload=function(e){a.push(e.target.result);if(--h==0){Q("p5fileDragName").value=f.join("*");Q("p5fileDragSize").value=j.join("*");Q("p5fileDragType").value=k.join("*");Q("p5fileDragData").value=a.join("*");Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath);Q("p5loginSubmit2").click()}};g.readAsDataURL(c)}}var p5dragtimer=null;function p5fileDragOver(b){haltEvent(b);if(p5dragtimer!=null){clearTimeout(p5dragtimer);p5dragtimer=null}var a=true;if(filetreelocation.length==0){a=false}QV("bigok",a);QV("bigfail",!a)}function p5fileDragLeave(a){haltEvent(a);if(a.target.id!="p5filetable"){QV("bigfail",false);QV("bigok",false)}else{p5dragtimer=setTimeout("QV('bigfail',false);QV('bigok',false);p5dragtimer=null;",200)}}var updateDevicesTimer=null;function updateDevices(){if(updateDevicesTimer!=null){return}updateDevicesTimer=setTimeout(updateDevicesEx,200)}var sort=0;var deviceHeaderId=0;var deviceHeaderCount;var deviceHeaders={};var showRealNames=false;var deviceHeaderTotal=0;var deviceHeaders={};var deviceHeadersTitles={};function updateDevicesEx(){if(updateDevicesTimer!=null){clearTimeout(updateDevicesTimer);updateDevicesTimer=null}var t="",a=0,d=null,b=0,e={},h={},g={};deviceHeaderId=0;deviceHeaderCount={};deviceHeaderTotal=0;deviceHeaders={};deviceHeadersTitles={};var d;if(sort==0){nodes.sort(meshSort)}else{if(sort==1){nodes.sort(powerSort)}else{if(sort==2){if(showRealNames==true){nodes.sort(deviceHostSort)}else{nodes.sort(deviceSort)}}}}for(var j in nodes){if(nodes[j].v==false){continue}var m=meshes[nodes[j].meshid],o=m.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(o==null){continue}var p=o.rights;if(sort==0){nodes.sort(meshSort);if(nodes[j].meshid!=d){deviceHeaderSet();var f="";if(meshes[nodes[j].meshid].mtype==1){f="<span style=color:lightgray>, Intel® AMT only</span>"}if(d!=null){if(a==2){t+="<td><div style=width:301px></div></td>"}if(t!=""){t+="</tr></table>"}}t+="<div class=DevSt style=padding-top:4px><span style=float:right>";t+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+nodes[j].meshid+'")>'+EscapeHtml(meshes[nodes[j].meshid].name)+"</span>"+f+"<span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>";d=nodes[j].meshid;e[d]=1;a=0}}else{if(sort==1){if(nodes[j].pwr!==d){deviceHeaderSet();if(d!==null){if(a==2){t+="<td><div style=width:301px></div></td>"}if(t!=""){t+="</tr></table>"}}t+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[j].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>";d=nodes[j].pwr;a=0}}else{if(sort==2){if(d==null){d="1"}}}}b++;var u=EscapeHtml(nodes[j].name);if(u.length==0){u="<i>None</i>"}if((nodes[j].rname!=null)&&(nodes[j].rname.length>0)){u+=" / "+EscapeHtml(nodes[j].rname)}var q=EscapeHtml(nodes[j].name);if(showRealNames==true&&nodes[j].rname!=null){q=EscapeHtml(nodes[j].rname)}if(q.length==0){q="<i>None</i>"}var k=nodes[j].icon,s=NodeStateStr(nodes[j]);if((!nodes[j].conn)||(nodes[j].conn==0)){k+=" gray"}t+="<div style=cursor:pointer onclick=goForward('"+nodes[j]._id+"')>";t+='<div class="i'+k+'" style="float:left;margin-left:4px"></div>';t+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">';t+="<div><div style=padding-left:12px;padding-top:2px><b>"+q+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+s+"</div></div>";t+="</div></div>";deviceHeaderTotal++;if(typeof deviceHeaderCount[nodes[j].state]=="undefined"){deviceHeaderCount[nodes[j].state]=1}else{deviceHeaderCount[nodes[j].state]++}}if(sort==0){for(var j in meshes){var l=meshes[j],n=l.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(n!=null){var p=n.rights;if(e[l._id]==null){if((d!="")&&(t!="")){t+="</tr></table>"}t+="<div><div colspan=3 class=DevSt><span style=float:right>";t+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+l._id+'")>'+EscapeHtml(l.name)+"</span></div>";if(l.mtype==1){t+="<div style=padding:10px><i>No Intel® AMT devices in this mesh"}if(l.mtype==2){t+="<div style=padding:10px><i>No devices in this mesh"}t+=".</i></div></div>";d=l._id;b++}}}}if(b==0){QH("xdevices",'<div style="margin-top:50px;text-align:center"><span style="font-size:30px">No devices</span><br /><br />Use the desktop version of this website to add devices.</div>')}else{QH("xdevices",t)}deviceHeaderSet();for(var j in deviceHeaders){QH(j,deviceHeaders[j])}for(var j in deviceHeadersTitles){Q(j).title=deviceHeadersTitles[j]}}var powerStatetable=["","Powered","Sleep","Sleep","Sleep","Hibernating","Power off","Present"];var powerStateStrings=["",'<span title="Device is powered on.">Powered</span>','<span title="Device is in sleep state (S1).">Sleeping</span>','<span title="Device is in sleep state (S2).">Sleeping</span>','<span title="Device is in deep sleep state (S3).">Deep Sleep</span>','<span title="Device is in hibernating state (S4).">Hibernating</span>','<span title="Device is in powered off state (S5).">Soft-Off</span>','<span title="Device is detected but power state could not be obtained.">Present</span>'];var powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"];var powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(a){var b=[];if(a.state>0&&a.state<powerStatetable.length){state.push(powerStatetable[a.state])}if(a.conn){if((a.conn&1)!=0){b.push('<span title="Mesh agent is connected and ready for use.">Agent</span>')}if((a.conn&2)!=0){b.push('<span title="Intel® AMT CIRA is connected and ready for use.">CIRA</span>')}if((a.conn&4)!=0){b.push('<span title="Intel® AMT is routable.">Intel® AMT</span>')}if((a.conn&8)!=0){b.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>')}}if((a.pwr!=null)&&(a.pwr!=0)){b.push(powerStateStrings[a.pwr])}return b.join(", ")}function PowerStateStr(a){if(a<powerStatetable.length){return powerStatetable[a]}return""}function PowerStateStr2(a){if((a!=0)&&(a<powerStatetable.length)){return powerStatetable[a]}return"Unknown"}function onSortSelectChange(a){sort=document.getElementById("sortselect").selectedIndex;if(!a){putstore("sort",sort)}updateDevicesEx()}function deviceHeaderSet(){if(deviceHeaderId==0){deviceHeaderId=1;return}deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+((deviceHeaderTotal==1)?" node":" nodes");var a="";for(var b in deviceHeaderCount){if(a.length>0){a+=", "}a+=deviceHeaderCount[b]+" "+PowerStateStr2(b)}deviceHeadersTitles["DevxHeader"+deviceHeaderId]=a;deviceHeaderId++;deviceHeaderCount={};deviceHeaderTotal=0}function meshSort(c,d){if(c.meshnamel>d.meshnamel){return 1}if(c.meshnamel<d.meshnamel){return -1}if(c.meshid==d.meshid){if(showRealNames==true){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}else{if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}}return 0}function powerSort(c,e){var d=c.pwr?c.pwr:0;var f=e.pwr?e.pwr:0;if(d==f){if(showRealNames==true){if(c.rnamel>e.rnamel){return 1}if(c.rnamel<e.rnamel){return -1}return 0}else{if(c.namel>e.namel){return 1}if(c.namel<e.namel){return -1}return 0}}if(d>f){return 1}if(d<f){return -1}return 0}function deviceSort(c,d){if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}function deviceHostSort(c,d){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}function refreshDevice(a){if(!currentNode||currentNode._id!=a){return}gotoDevice(a,xxcurrentView,true)}function getNodeRights(c){var b=getNodeFromId(c),a=meshes[b.meshid];return a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights}var currentDevicePanel=0;var currentNode;var powerTimelineNode=null;var powerTimelineReq=null;var powerTimelineUpdate=null;var powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(l,m,p){var k=getNodeFromId(l);if(k==null){goBack()}var g=meshes[k.meshid];if(g==null){goBack()}var h=g.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(!currentNode||currentNode._id!=k._id||p==true){currentNode=k;var j=EscapeHtml(k.name);if(j.length==0){j="<i>None</i>"}if((h&4)!=0){j="<span onclick=showEditNodeValueDialog(0) style=cursor:pointer>"+j+"</span>"}QH("p10deviceName",j);var s="<table style=width:100%>";s+=addDeviceAttribute('<span title="The name of the device group this computer belong to">Group</span>','<a title="The name of the device group this computer belong to" onclick=goForward("'+k.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[k.meshid].name)+"</a>");if(k.rname!=null){s+=addDeviceAttribute('<span title="The name of this computer as set in the operating system">Name</span>','<span title="The name of this computer as set in the operating system">'+EscapeHtml(k.rname)+"</span>")}if((g.mtype==1)||(k.name!=k.host)){if((h&4)!=0){if(k.host){s+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(k.host)+"</span>")}else{s+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>")}}else{s+=addDeviceAttribute("Hostname",EscapeHtml(k.host))}}var d=k.desc?EscapeHtml(k.desc):"<i>None</i>";if((h&4)!=0){s+=addDeviceAttribute("Description","<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+d+"</span>")}else{s+=addDeviceAttribute("Description",d)}var a=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","OSX 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","OSX 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l"];if((k.agent!=null)&&(k.agent.id!=null)&&(k.agent.ver!=null)){var q="";if(k.agent.id<=a.length){q=a[k.agent.id]}else{q=a[0]}if(k.agent.ver!=0){q+=" v"+k.agent.ver}s+=addDeviceAttribute("Agent",q)}if(k.intelamt!=null){var q="";var o={0:"Not Activated (Pre)",1:"Not Activated (In)",2:"Activated"};if(k.intelamt.ver!=null&&k.intelamt.state==null){q+="<i>Unknown State</i>, v"+k.intelamt.ver}else{if((k.intelamt.ver==null)&&(k.intelamt.state==2)){q+="<i>Activated</i>"}else{if((k.intelamt.ver==null)||(k.intelamt.state==null)){q+="<i>Unknown Version & State</i>"}else{q+=o[k.intelamt.state];if(k.intelamt.flags){if(k.intelamt.flags&2){q=' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'}else{if(k.intelamt.flags&4){q=' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'}}}q+=(", v"+k.intelamt.ver)}}}if(k.intelamt.tls==1){q+=', <span title="Intel AMT is setup with TLS network security">TLS</span>'}if(k.intelamt.state==2){if(k.intelamt.user==null||k.intelamt.user==""){if((h&4)!=0){q+=', <i style=color:#FF0000;cursor:pointer title="Edit Intel® AMT credentials" onclick=editDeviceAmtSettings("'+k._id+'")>No Credentials</i>'}else{q+=", <i style=color:#FF0000>No Credentials</i>"}}q+=" ";if((h&4)!=0){q+='<img src=images/link4.png height=10 width=10 title="Edit Intel® AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("'+k._id+'")>'}}s+=addDeviceAttribute("Intel® AMT",q)}if((k.agent!=null)&&(k.agent.tag!=null)&&(k.agent.tag!="mailto:")){var r=EscapeHtml(k.agent.tag);if(r.startsWith("mailto:")){r='<a href="'+r+'">'+r.substring(7)+"</a>"}s+=addDeviceAttribute("Agent Tag",r)}var b=k.conn;if(b&&b>1){var c=[];if((k.conn&1)!=0){c.push('<span title="Software agent is connected and ready for use.">Agent</span>')}if((k.conn&2)!=0){c.push('<span title="Intel® AMT CIRA is connected and ready for use.">Intel® AMT CIRA</span>')}if((k.conn&4)!=0){c.push('<span title="Intel® AMT is routable and ready for use.">Intel® AMT</span>')}if((k.conn&8)!=0){c.push('<span title="Software agent is reachable using another agent as relay.">Agent Relay</span>')}s+=addDeviceAttribute("Connectivity",c.join(", "))}var e="<i>None</i>";if(k.tags!=null){e="";for(var f in k.tags){e+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+k.tags[f]+"</span>"}}s+=addDeviceAttribute("Tags","<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+e+"</span>");s+="</table><br />";if((h&76)!=0){s+='<input type=button value=Actions title="Perform power actions on the device" onclick=deviceActionFunction() />'}QH("p10html",s);setupFiles();s="<div style=float:right;font-size:x-small;margin-right:10px>";if((h&4)!=0){s+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+k._id+'") title="Remove this device">Delete Device</a>'}s+="</div><div style=font-size:x-small>";s+="</div><br>";QH("p10html3",s);var n=PowerStateStr(k.state);if((b&1)!=0){if(n.length>0){n+=", "}n+='<span style=font-size:10px title="Agent connected">Mesh Agent</span>'}if((b&2)!=0){if(n.length>0){n+=", "}n+='<span style=font-size:10px title="Intel® AMT connected">Intel® AMT connected</span>'}else{if((b&4)!=0){if(n.length>0){n+=", "}n+='<span style=font-size:10px title="Intel® AMT detected">Intel® AMT detected</span>'}}QH("MainComputerState",n);QH("MainComputerImage",'<div class="i'+k.icon+'"></div>');if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}setupDesktop();if(!m){m=10}go(m);setupDeviceMenu()}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Toast",3,deviceToastFunctionEx,"<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function setupDeviceMenu(d,c){var b=0;if(currentNode){b=meshes[currentNode.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights}if(d!=null){currentDevicePanel=d}QV("p10general",currentDevicePanel==0);QV("p10desktop",currentDevicePanel==1);QV("p10files",currentDevicePanel==2);var a=[];if(currentDevicePanel!=0){a.push({n:"General",f:"setupDeviceMenu(0)"})}if((currentDevicePanel!=1)&&(currentNode!=null)&&((b&8)||(b&256))&&((currentNode.mtype==1)||(currentNode.agent.caps&1))){a.push({n:"Desktop",f:"setupDeviceMenu(1)"})}if((currentDevicePanel!=2)&&(currentNode!=null)&&(b&8)&&((currentNode.mtype==2)&&(currentNode.agent.caps&4))){a.push({n:"Files",f:"setupDeviceMenu(2)"})}updateFooterMenu(a)}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var b="Select an operation to perform on this device.<br /><br />";var c="<select id=d2deviceop style=float:right;width:170px>";if((a&64)!=0){c+="<option value=100>Wake-up</option>"}if((a&8)!=0){c+="<option value=4>Sleep</option><option value=3>Reset</option><option value=2>Power off</option>"}c+="</select>";b+=addHtmlValue("Operation",c);setDialogMode(2,"Device Action",3,deviceActionFunctionEx,b)}function deviceActionFunctionEx(){var a=Q("d2deviceop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:[currentNode._id]})}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:a})}}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate<Date.now())){powerTimelineUpdate=null;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}function drawDeviceTimeline(){var r=null,n=Date.now();if(currentNode._id==powerTimelineNode){r=powerTimeline}var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var t=e.getTime();var s=[];if(r!=null&&r.length>1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l<r.length;l+=2){var o=r[l],h=n;if(r.length>(l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var z="",b=1,g=new Date();var v=Q("masthead").offsetWidth-(90+9+9+14);g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var w=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var y=Math.round(((q-w)*v)/86400000);if(y>0){var u=powerStateStrings2[a[2]]+" from "+new Date(w).toLocaleTimeString()+" to "+new Date(q).toLocaleTimeString()+".";f+='<div title="'+u+'" style=display:table-cell;width:'+y+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}z+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div> "+g.toLocaleDateString()+"<div></div></div></td><td><div>"+f+"</div></td></tr>";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p10html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse;width:calc(100% - 18px);margin:9px" border=0 cellpadding=2 cellspacing=0><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:90px>Day</th><th scope=col style=text-align:center>Power State</th></tr>'+z+"</tbody></table>")}function powerColor(a){if(a<powerColorTable.length){return powerColorTable[a]}return"yellow"}function isTimeBlockInside(d,c,b,a){if((b<d)&&(a>c)){return true}if((b>d)&&(b<c)){return true}if((a>d)&&(a<c)){return true}return false}function addDeviceAttribute(a,b){return"<tr><td style=width:100px;color:gray>"+a+"</td><td style=overflow:hidden>"+b+"</td></tr>"}function editDeviceAmtSettings(e,b){if(xxdialogMode){return}var f="",d=getNodeFromId(e),a=3,c=getNodeRights(e);if((c&4)==0){return}f+=addHtmlValue("Username",'<input id=dp10username style=width:170px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');f+=addHtmlValue("Password","<input id=dp10password type=password style=width:170px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />");f+=addHtmlValue("Security","<select id=dp10tls style=width:176px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");if((d.intelamt.user!=null)&&(d.intelamt.user!="")){a=7}setDialogMode(2,"Edit Intel® AMT credentials",a,editDeviceAmtSettingsEx,f,{node:d,func:b});if((d.intelamt.user!=null)&&(d.intelamt.user!="")){Q("dp10username").value=d.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=d.intelamt.tls;validateDeviceAmtSettings()}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(c,d){if(c==2){meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:"",pass:""}})}else{var b=Q("dp10username").value;if(b==""){b="admin"}var a=Q("dp10password").value;if(a==""){b=""}meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:b,pass:a,tls:Q("dp10tls").value}});d.node.intelamt.user=b;d.node.intelamt.tls=Q("dp10tls").value;if(d.func){setTimeout(d.func,300)}}}function p10showDeleteNodeDialog(a){if(xxdialogMode){return}setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,'Delete "'+EscapeHtml(currentNode.name)+'"?<br /><br /><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm',a);p10validateDeleteNodeDialog()}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(a,b){meshserver.send({action:"removedevices",nodeids:[b]})}function p10showiconselector(){if(xxdialogMode){return}var a=meshes[currentNode.meshid];var b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&4)==0){return}var c="<table align=center><td>";c+="<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>";c+="<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>";c+="<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br>";c+="<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>";c+="<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>";c+="<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>";setDialogMode(2,"Icon Selection",0,null,c);QV("id_dialogclose",true)}function p10setIcon(a){setDialogMode(0);meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:a})}var showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Tags"];var showEditNodeValueDialog_modes2=["name","host","desc","tags"];var showEditNodeValueDialog_modes3=["","","","Group1, Group2, Group3"];function showEditNodeValueDialog(a){if(xxdialogMode){return}var c=addHtmlValue(showEditNodeValueDialog_modes[a],'<input id=dp10devicevalue style=width:170px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[a]+'" onchange=p10editdevicevalueValidate('+a+",event) onkeyup=p10editdevicevalueValidate("+a+",event) />");setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,c,a);var b=currentNode[showEditNodeValueDialog_modes2[a]];if(b==null){b=""}if(Array.isArray(b)){b=b.join(", ")}Q("dp10devicevalue").value=b;p10editdevicevalueValidate();Q("dp10devicevalue").focus()}function showEditNodeValueDialogEx(a,b){var c={action:"changedevice",nodeid:currentNode._id};c[showEditNodeValueDialog_modes2[b]]=Q("dp10devicevalue").value;meshserver.send(c)}function p10editdevicevalueValidate(b,a){var c=((b>1)||(Q("dp10devicevalue").value.length>0));QE("idx_dlgOkButton",c);if((a!=null)&&(c==true)&&(a.keyCode==13)){dialogclose(1)}}var desktop;var desktopNode;var desktopsettings={encoding:2,showfocus:false,showmouse:true,showcad:true,quality:40,scaling:1024,framerate:50};function setupDesktop(){if((desktopNode!=currentNode)&&(desktop!=null)){desktop.Stop();desktopNode=null;desktop=null}if((desktopNode!=currentNode)||(desktop==null)){QH("DeskParent",'<canvas id=Desk width=640 height=200 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');desktopNode=currentNode;Q("Desk").addEventListener("DOMMouseScroll",function(a){return dmousewheel(a)});Q("Desk").addEventListener("mousewheel",function(a){return dmousewheel(a)})}desktopNode=currentNode;updateDesktopButtons();if(!Q("Desk")["toBlob"]){QV("deskSaveBtn",false)}}function updateDesktopButtons(){var c=meshes[currentNode.meshid];var a=0;if(desktop!=null){a=desktop.State}var d=c.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;QV("disconnectbutton1",(a!=0));QV("connectbutton1",(a==0)&&(c.mtype==2)&&((d&8)||(d&256)));QV("connectbutton1h",(a==0)&&((currentNode.intelamt!=null)&&(d&8)&&(c.mtype==1||currentNode.intelamt.state==2)&&((currentNode.intelamt.ver!=null)||(c.mtype==1))));QV("d7amtkvm",(currentNode.intelamt!=null&&((currentNode.intelamt.ver!=null)||(c.mtype==1)))&&((a==0)||(desktop.contype==2)));QV("d7meshkvm",(c.mtype==2)&&((a==false)||(desktop.contype==1)));var e=((currentNode.conn&1)!=0);QE("connectbutton1",e);var b=((currentNode.conn&6)!=0);QE("connectbutton1h",b);QV("DeskToastButton",(currentNode.agent)&&(currentNode.agent.id<5)&&(d&8));QE("DeskToastButton",e);QV("deskActionsBtn",d&8);Q("DeskControl").checked=((d&8)!=0);if(e==false){QV("DeskTools",false)}}function connectDesktop(b,a){if(desktop==null){desktopNode=currentNode;if(a==2){if((desktopNode.intelamt.user==null)||(desktopNode.intelamt.user=="")){editDeviceAmtSettings(desktopNode._id,connectDesktop);return}desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"));desktop.debugmode=debugmode;desktop.onStateChanged=onDesktopStateChange;desktop.m.bpp=(desktopsettings.encoding==1||desktopsettings.encoding==3)?1:2;desktop.m.useZRLE=(desktopsettings.encoding<3);desktop.m.showmouse=desktopsettings.showmouse;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id,16994,"*","*",0);desktop.contype=2}else{desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort);desktop.debugmode=debugmode;desktop.m.debugmode=debugmode;desktop.attemptWebRTC=attemptWebRTC;desktop.onStateChanged=onDesktopStateChange;desktop.m.CompressionLevel=desktopsettings.quality;desktop.m.ScalingLevel=desktopsettings.scaling;desktop.m.FrameRateTimer=desktopsettings.framerate;desktop.m.onDisplayinfo=deskDisplayInfo;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id);desktop.contype=1}}else{desktop.Stop();desktopNode=desktop=null}}function onDesktopStateChange(c,a){var d=a;if((d==3)&&(c.contype==2)){d++}var b=StatusStrs[d];if((desktop!=null)&&(desktop.webRtcActive==true)){b+=", WebRTC"}QH("deskstatus",b);switch(a){case 0:desktop.Stop();desktopNode=desktop=null;QV("termdisplays",false);if(fullscreen==true){deskToggleFull()}break;case 2:break;default:console.log("Unknown onDesktopStateChange state",a);break}updateDesktopButtons();deskAdjust();setTimeout(deskAdjust,50)}function showDesktopSettings(){if(xxdialogMode){return}applyDesktopSettings();updateDesktopButtons();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value;desktopsettings.showfocus=d7showfocus.checked;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;desktopsettings.framerate=d7framelimiter.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();if(desktop){if(desktop.contype==1){if(desktop.State!=0){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}}if(desktop.contype==2){if(desktop.State!=0){desktop.Stop();setTimeout(function(){connectDesktop(null,2)},50)}}}}function applyDesktopSettings(){var c="",b=(features&512)?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];for(var a in b){c+="<option value="+b[a]+">"+b[a]+"%</option>"}QH("d7bitmapquality",c);d7desktopmode.value=desktopsettings.encoding;d7showfocus.checked=desktopsettings.showfocus;d7showcursor.checked=desktopsettings.showmouse;d7bitmapquality.value=40;if(b.indexOf(parseInt(desktopsettings.quality))>=0){d7bitmapquality.value=desktopsettings.quality}d7bitmapscaling.value=desktopsettings.scaling;if(desktopsettings.framerate){d7framelimiter.value=desktopsettings.framerate}}var fullscreen=false;function deskAdjust(){var c=(Q("DeskParent").clientHeight-Q("Desk").clientHeight)/2;if(c<0){var a=Q("DeskParent").clientHeight,b=9999;if(desktop){b=(desktop.m.width/desktop.m.height)*a}QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";c=0}else{QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null}QS("Desk")["margin-top"]=c+"px";QS("Desk")["margin-bottom"]=c+"px"}function toggleDeskTools(){if(xxdialogMode){return}if(QS("DeskTools").display=="none"){QV("DeskTools",true);Q("DeskTools").nodeid=currentNode._id;refreshDeskTools()}else{QV("DeskTools",false)}}function refreshDeskTools(){QV("DeskToolsRefreshButton",false);setTimeout(refreshDeskToolsEx,500);meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",true)}var deskTools={sort:1,msg:null};function sortProcess(a){deskTools.sort=a;showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(c,d){if(c.p>d.p){return 1}if(c.p<d.p){return(-1)}return 0}function sortProcessName(c,d){if(c.d>d.d){return 1}if(c.d<d.d){return(-1)}return 0}function showDeskToolsProcesses(c){deskTools.msg=c;if(c==null){QH("DeskToolsProcesses","");return}if(Q("DeskTools").nodeid!=c.nodeid){return}var d=[],g=null;try{g=JSON.parse(c.value)}catch(a){}console.log(g);if(g!=null){for(var f in g){d.push({p:parseInt(f),c:g[f].cmd,d:g[f].cmd.toLowerCase(),u:g[f].user})}if(deskTools.sort==0){d.sort(sortProcessPid)}else{if(deskTools.sort==1){d.sort(sortProcessName)}}var h="";for(var b in d){if(d[b].p!=0){h+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+d[b].p+'</div><a style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=stopProcess('+d[b].p+',"'+d[b].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(d[b].u?d[b].u:"")+"</div><div>"+d[b].c+"</div></div>"}}QH("DeskToolsProcesses",h)}}function deskSaveImage(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=new Date(),b="Desktop-"+currentNode.name+"-"+a.getFullYear()+"-"+("0"+(a.getMonth()+1)).slice(-2)+"-"+("0"+a.getDate()).slice(-2)+"-"+("0"+a.getHours()).slice(-2)+"-"+("0"+a.getMinutes()).slice(-2);Q("Desk")["toBlob"](function(c){saveAs(c,b+".jpg")})}function deskDisplayInfo(e,a,c,d){var f=Q("termdisplays").value;if(a.length>0){var b="";for(var g in a){b+="<option"+((f==a[g])?" selected":"")+">"+a[g]+"</option>"}QH("termdisplays",b)}QV("termdisplays",a.length>0)}function deskGetDisplayNumbers(a){desktop.m.GetDisplayNumbers()}function deskSetDisplay(b){var a=0,c=Q("termdisplays").value;if(c=="All Displays"){a=65535}else{a=parseInt(c.substring(8))}desktop.m.SetDisplay(a)}function dmousedown(a){if((!xxdialogMode&&desktop!=null)&&Q("DeskControl").checked){desktop.m.mousedown(a)}}function dmouseup(a){if((!xxdialogMode&&desktop!=null)&&Q("DeskControl").checked){desktop.m.mouseup(a)}}function dmousemove(a){if((!xxdialogMode&&desktop!=null)&&Q("DeskControl").checked){desktop.m.mousemove(a)}}function dmousewheel(a){if((!xxdialogMode&&desktop!=null)&&Q("DeskControl").checked&&desktop.m.mousewheel){desktop.m.mousewheel(a);haltEvent(a);return true}return false}function drotate(a){if(!xxdialogMode&&desktop!=null){desktop.m.setRotation(desktop.m.rotation+a);deskAdjust();deskAdjust()}}function stopProcess(a,b){setDialogMode(2,"Process Control",3,stopProcessEx,"Stop process #"+a+' "'+b+'"?',a)}function stopProcessEx(a,b){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:b});setTimeout(refreshDeskTools,300)}var filesNode;function setupFiles(){var b=(filesNode==currentNode);filesNode=currentNode;var a=((filesNode.conn&1)!=0)?true:false;QE("p13Connect",a);if(((b==false)||(a==false))&&files){files.Stop();files=null}}function onFilesStateChange(c,a){p13Connect.value=(a==0)?"Connect":"Disconnect";var b=StatusStrs[a];if(files.webRtcActive==true){b+=", WebRTC"}Q("p13Status").textContent=b;switch(a){case 0:QH("p13files","");p13filetree=null;p13filetreelocation=[];QH("p13currentpath","");QE("p13FolderUp",false);p13setActions();if(files!=null){files.Stop();files=null}break;case 3:p13targetpath="";files.sendText({action:"ls",reqid:1,path:""});break;default:console.log("Unknown onFilesStateChange state",a);break}}function CreateRemoteFiles(b){var a={protocol:5};a.onFileUpdate=b;a.xxStateChange=function(c){};a.ProcessData=function(c){a.onFileUpdate(c)};return a}var autoConnectFilesTimer=null;function autoConnectFiles(a){if(autoConnectFilesTimer==null){autoConnectFilesTimer=setInterval(connectFiles,100)}else{clearInterval(autoConnectFilesTimer);autoConnectFilesTimer=null}}function connectFiles(a){if(!files){files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort);files.attemptWebRTC=attemptWebRTC;files.onStateChanged=onFilesStateChange;files.Start(filesNode._id)}else{files.Stop();files=null}p13clipboard=p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}var p13filetree=null;var p13targetpath=null;var p13filetreelocation=[];function p13gotFiles(b){if((b.length>0)&&(b.charCodeAt(0)!=123)){p13gotDownloadBinaryData(b);return}b=JSON.parse(decode_utf8(b));if(b.action=="download"){p13gotDownloadCommand(b);return}b.path=b.path.replace(/\//g,"\\");if((p13filetree!=null)&&(b.path==p13filetree.path)){var a=p13getCheckedNames();p13filetree=b;p13updateFiles(a)}else{var c=b.path.replace(/\//g,"\\"),d=p13targetpath.replace(/\//g,"\\");while((c.length>0)&&(c[0]=="\\")){c=c.substring(1)}while((d.length>0)&&(d[0]=="\\")){d=d.substring(1)}if((c==d)||((b.path=="\\")&&(p13targetpath==""))){p13filetree=b;p13updateFiles()}}}function p13getCheckedNames(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}return b}function p13updateFiles(b){var l="",m="",c="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",j="Root";var u=p13filetree.path.split("\\");p13filetreelocation=[];for(var n in u){if(u[n]!=""){p13filetreelocation.push(u[n])}}for(var n in p13filetreelocation){c+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(n)+1)+")>"+p13filetreelocation[n]+"</a>"}var q=p13filetreelocation.join("/");var e=p13sort_files(p13filetree.dir);for(var n in e){var d=e[n],p=d.n,s;s=p;if(p.length>70){s='<span title="'+EscapeHtml(p)+'">'+EscapeHtml(p.substring(0,70))+"...</span>"}else{s=EscapeHtml(p)}p=EscapeHtml(p);var g="";if(d.s!=null){g=getFileSizeStr(d.s)}var k="";if(d.t<3){var r="",t="";k="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'> <span style=float:right title=\""+t+'">'+r+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+s+"</a></span></div>"}else{var o=s;if(d.s>0){o='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(q+"/"+p)+"','"+encodeURIComponent(p)+"',"+d.s+')">'+s+"</a>"}k="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'> <span style=float:right;padding-right:4px>"+g+"</span><span><div class=fileIcon"+d.t+"></div>"+o+"</span></div>"}if(d.t<3){l+=k}else{m+=k}}QH("p13files",l+m);QH("p13currentpath",c);QE("p13FolderUp",p13filetreelocation.length!=0);if(b!=null){var a=document.getElementsByName("fd");for(var n=0;n<a.length;n++){if(b.indexOf(p13filetree.dir[a[n].value].n)>=0){a[n].checked=true}}}p13setActions()}function p13folderset(a){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[a].n).split("\\").join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(a){if(a==null){p13filetreelocation.pop()}else{while(p13filetreelocation.length>a){p13filetreelocation.pop()}}p13targetpath=p13filetreelocation.join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}var p13sortorder;function p13sort_filename(c,d){if(c.ln>d.ln){return(1*p13sortorder)}if(c.ln<d.ln){return(-1*p13sortorder)}return 0}function p13sort_timestamp(c,d){if(c.d>d.d){return(1*p13sortorder)}if(c.d<d.d){return(-1*p13sortorder)}return 0}function p13sort_bysize(c,d){if(c.s==d.s){return p13sort_filename(c,d)}return(((c.s-d.s))*p13sortorder)}function p13sort_files(a){var c=[],d=Q("p13sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].s==null){a[b].s=0}if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}p13sortorder=1;if(d>3){p13sortorder=-1;d-=3}if(d==1){c.sort(p13sort_filename)}else{if(d==2){c.sort(p13sort_bysize)}else{if(d==3){c.sort(p13sort_timestamp)}}}return c}function p13setActions(){if(p13filetree==null){QE("p13DeleteFileButton",false);QE("p13NewFolderButton",false);QE("p13UploadButton",false);QE("p13RenameFileButton",false);QE("p13SelectAllButton",false);Q("p13SelectAllButton").value="All";QE("p13RefreshButton",false);QE("p13CutButton",false);QE("p13CopyButton",false);QE("p13PasteButton",false)}else{var a=p13getFileSelCount(),c=p13getFileCount(),b=p13getFileSelCount(false);var d=((currentNode.agent.id>0)&&(currentNode.agent.id<5));QE("p13DeleteFileButton",(a>0)&&((p13filetreelocation.length>0)||(d==false)));QE("p13NewFolderButton",((p13filetreelocation.length>0)||(d==false)));QE("p13UploadButton",((p13filetreelocation.length>0)||(d==false)));QE("p13RenameFileButton",(a==1)&&((p13filetreelocation.length>0)||(d==false)));QE("p13SelectAllButton",c>0);Q("p13SelectAllButton").value=(a>0?"None":"All");QE("p13RefreshButton",true);QE("p13CutButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13CopyButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13PasteButton",((p13filetreelocation.length>0)||(d==false))&&((p13clipboard!=null)&&(p13clipboard.length>0)))}}function p13getFileSelCount(d){var a=0;var b=document.getElementsByName("fd");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function p13getFileCount(){var a=0;var b=document.getElementsByName("fd");return b.length}function p13selectallfile(){var c=(p13getFileSelCount()==0),a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){a[b].checked=c}p13setActions()}function p13createfolder(){setDialogMode(2,"New Folder",3,p13createfolderEx,"<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />");focusTextBox("p13renameinput");p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value});p13folderup(999)}function p13deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p13deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p13deletefileEx(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:b});p13folderup(999)}function p13renamefile(){var c,a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){if(a[b].checked){c=p13filetree.dir[a[b].value].n}}setDialogMode(2,"Rename",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:c});focusTextBox("p13renameinput");p13fileNameCheck()}function p13renamefileEx(a,c){c.newname=Q("p13renameinput").value;files.sendText(c);p13folderup(999)}function p13fileNameCheck(a){var b=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p13uploadinput')\" />");updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}var p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(b){var a=document.getElementsByName("fd");p13clipboard=[];p13clipboardCut=b,p13clipboardFolder=p13targetpath;for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p13clipboard.push(p13filetree.dir[a[c].value].n)}}p13updateClipview()}function p13pasteFile(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Confim "+(p13clipboardCut==0?"copy":"move")+" of "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p13pasteFileEx,a)}function p13pasteFileEx(){files.sendText({action:(p13clipboardCut==0?"copy":"move"),reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard});p13folderup(999);if(p13clipboardCut==1){p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;p13updateClipview()}}function p13updateClipview(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Holding "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" for "+(p13clipboardCut==0?"copy":"move")+", <a onclick=p13clearClip() style=cursor:pointer>Clear</a>."}QH("p13bottomstatus",a);p13setActions()}function p13clearClip(){p13clipboard=null;p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}var downloadFile;function p13downloadfile(a,b,c){if(xxdialogMode||downloadFile||!files){return}downloadFile={path:decodeURIComponent(a),file:decodeURIComponent(b),size:c,tsize:0,data:"",state:0,id:Math.random()};files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path});setDialogMode(2,"Download File",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+c+" />")}function p13downloadFileCancel(){setDialogMode(0);files.sendText({action:"download",sub:"cancel",id:downloadFile.id});downloadFile=null}function p13gotDownloadCommand(a){if((downloadFile==null)||(a.id!=downloadFile.id)){return}if(a.sub=="start"){downloadFile.state=1;files.sendText({action:"download",sub:"startack",id:downloadFile.id})}else{if(a.sub=="cancel"){downloadFile=null;setDialogMode(0)}}}function p13gotDownloadBinaryData(a){if(!downloadFile||downloadFile.state==0){return}if(a.length>4){downloadFile.tsize+=(a.length-4);downloadFile.data+=a.substring(4);Q("d2progressBar").value=downloadFile.tsize}if((ReadInt(a,0)&1)!=0){saveAs(data2blob(downloadFile.data),downloadFile.file);downloadFile=null;setDialogMode(0)}else{files.sendText({action:"download",sub:"ack",id:downloadFile.id})}}var uploadFile;function p13doUploadFiles(a){if(xxdialogMode){return}uploadFile={};uploadFile.xpath=p13filetreelocation.join("/");uploadFile.xfiles=a;uploadFile.xfilePtr=-1;setDialogMode(2,"Upload File",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />");p13uploadReconnect()}function onFileUploadStateChange(b,a){switch(a){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break;default:console.log("Unknown onFileUploadStateChange state",a);break}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort);uploadFile.ws.attemptWebRTC=false;uploadFile.ws.ctrlMsgAllowed=false;uploadFile.ws.onStateChanged=onFileUploadStateChange;uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var a=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",a.name);Q("d2progressBar").max=a.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader();uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;uploadFile.ws.sendText({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:a.name,size:uploadFile.xdata.byteLength})};uploadFile.xreader.readAsArrayBuffer(a)}else{p13uploadFileCancel()}}function p13uploadFileCancel(a,b){if(uploadFile!=null){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}uploadFile=null}setDialogMode(0)}function p13gotUploadData(b){var a=JSON.parse(b);if((uploadFile==null)||(parseInt(uploadFile.xfilePtr)!=parseInt(a.reqid))){return}if(a.action=="uploadstart"){p13uploadNextPart(false);for(var c=0;c<8;c++){p13uploadNextPart(true)}}else{if(a.action=="uploadack"){p13uploadNextPart(false)}else{if(a.action=="uploaderror"){p13uploadFileCancel()}}}}function p13uploadNextPart(c){var a=uploadFile.xdata;var e=uploadFile.xptr;var d=uploadFile.xptr+4096;if(d>a.byteLength){if(c==true){return}d=a.byteLength}if(e==a.byteLength){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}if(uploadFile.xfiles.length>uploadFile.xfilePtr+1){p13uploadReconnect()}else{p13uploadFileCancel()}}else{var b=a.slice(e,d);uploadFile.ws.send(b);uploadFile.xptr=d;Q("d2progressBar").value=d}}var currentMesh;function p20updateMesh(){if(currentMesh==null){return}QH("p20meshName",EscapeHtml(currentMesh.name));var e="Unknown #"+currentMesh.mtype;var d=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(currentMesh.mtype==1){e="Intel® AMT group"}if(currentMesh.mtype==2){e="Software agent group"}var k="";k+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(d&1)!=0));k+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&¤tMesh.desc!="")?EscapeHtml(currentMesh.desc):"<i>None</i>"),"p20editmesh(2)",(d&1)!=0));k+=addHtmlValue("Type",e);k+="<br style=clear:both><br>";var b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(b&&((b.rights&2)!=0)){k+="<div style=margin-bottom:6px><a onclick=p20showAddMeshUserDialog() style=cursor:pointer><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a></div>"}k+='<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th></tr>';var a=1,h=[];for(var c in currentMesh.links){h.push({id:c,name:c.split("/")[2],rights:currentMesh.links[c].rights})}h.sort(function(l,m){if(l.name>m.name){return 1}if(l.name<m.name){return -1}return 0});for(var c in h){var j="",g="Partial Rights",f=h[c].rights;if(f==4294967295){g="Full Administrator"}else{if(f==0){g="No Rights"}}if((c!=userinfo._id)&&(d==4294967295||(((d&2)!=0)))){j='<a onclick=p20deleteUser(event,"'+encodeURIComponent(h[c].id)+'") title="Remote user rights to this mesh" style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'}k+='<tr onclick=p20viewuser("'+encodeURIComponent(h[c].id)+'") style=height:32px;cursor:pointer'+(((a%2)==0)?";background-color:#DDD":"")+"><td>";k+="<div style=float:right>"+j+"</div><div style=float:right;padding-right:4px>"+g+"</div><div class=m2></div><div> "+h[c].name+"<div></div></div>";k+="</td></tr>";++a}k+="</tbody></table>";if(d==4294967295){k+="<div style=font-size:small;text-align:right;margin-top:6px><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Mesh</a></span></div>"}QH("p20info",k)}function p20showDeleteMeshDialog(){if(xxdialogMode){return}var a='Are you sure you want to delete mesh "'+EscapeHtml(currentMesh.name)+'"? Deleting the mesh will also delete all information about computers within this mesh.<br /><br />';a+="<input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm";setDialogMode(2,"Delete Mesh",3,p20showDeleteMeshDialogEx,a);p20validateDeleteMeshDialog()}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(a,b){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(a){if(xxdialogMode){return}var b=addHtmlValue("Name","<input id=dp20meshname style=width:170px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");b+=addHtmlValue("Description","<input id=dp20meshdesc style=width:170px maxlength=1024 onkeyup=p20editmeshValidate() />");setDialogMode(2,"Edit Device Group",3,p20editmeshEx,b);Q("dp20meshname").value=currentMesh.name;if(currentMesh.desc){Q("dp20meshdesc").value=currentMesh.desc}p20editmeshValidate();if(a==2){Q("dp20meshdesc").focus()}else{Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",Q("dp20meshname").value.length>0)}function p20showAddMeshUserDialog(){if(xxdialogMode){return}var a=addHtmlValue("User","<input id=dp20username style=width:170px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");a+='<div style="border:2px groove gray;background-color:white;max-height:80px;overflow-y:scroll">';a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Device Group<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Device Group Users<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Device Group Computers<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remoteview>Remote View Only<br>";a+="</div>";setDialogMode(2,"Add User to Mesh",3,p20showAddMeshUserDialogEx,a);p20validateAddMeshUserDialog();Q("dp20username").focus()}function p20validateAddMeshUserDialog(){var a=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;QE("idx_dlgOkButton",(Q("dp20username").value.length>0));QE("p20fulladmin",a==4294967295);QE("p20editmesh",(!Q("p20fulladmin").checked)&&(a==4294967295));QE("p20manageusers",!Q("p20fulladmin").checked);QE("p20managecomputers",!Q("p20fulladmin").checked);QE("p20remotecontrol",!Q("p20fulladmin").checked);QE("p20meshagentconsole",!Q("p20fulladmin").checked);QE("p20meshserverfiles",!Q("p20fulladmin").checked);QE("p20wakedevices",!Q("p20fulladmin").checked);QE("p20editnotes",!Q("p20fulladmin").checked);QE("p20remoteview",!Q("p20fulladmin").checked)}function p20showAddMeshUserDialogEx(){var a=0;if(Q("p20fulladmin").checked==true){a=4294967295}else{if(Q("p20editmesh").checked==true){a+=1}if(Q("p20manageusers").checked==true){a+=2}if(Q("p20managecomputers").checked==true){a+=4}if(Q("p20remotecontrol").checked==true){a+=8}if(Q("p20meshagentconsole").checked==true){a+=16}if(Q("p20meshserverfiles").checked==true){a+=32}if(Q("p20wakedevices").checked==true){a+=64}if(Q("p20editnotes").checked==true){a+=128}if(Q("p20remoteview").checked==true){a+=256}}meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:a})}function p20viewuser(e){if(xxdialogMode){return}e=decodeURIComponent(e);var d="",b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights,c=currentMesh.links[e].rights;if(c==4294967295){d=", Full Administrator"}else{if((c&1)!=0){d+=", Edit Device Group"}if((c&2)!=0){d+=", Manage Device Group Users"}if((c&4)!=0){d+=", Manage Device Group Computers"}if((c&8)!=0){d+=", Remote Control"}if((c&16)!=0){d+=", Agent Console"}if((c&32)!=0){d+=", Server Files"}if((c&64)!=0){d+=", Wake Devices"}if((c&128)!=0){d+=", Edit Notes"}if((c&256)!=0){d+=", Remote View Only"}}d=d.substring(2);if(d==""){d="No Rights"}var a=1,f=addHtmlValue("User",e.split("/")[2]);f+=addHtmlValue("Permissions",d);if((("user/"+domain+"/"+userinfo.name.toLowerCase())!=e)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){a+=4}setDialogMode(2,"Mesh User",a,p20viewuserEx,f,e)}function p20viewuserEx(a,b){if(a!=2){return}setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,"Confirm removal of user "+b.split("/")[2]+"?",b)}function p20deleteUser(a,b){haltEvent(a);p20viewuserEx(2,decodeURIComponent(b))}function p20viewuserEx2(a,b){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:b})}var xxcurrentView=-1;function go(b){if(xxdialogMode||xxcurrentView==b){return}updateFooterMenu();setDialogMode(0);for(var a=0;a<32;a++){QV("p"+a,a==b)}xxcurrentView=b}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-300)/2))+"px");deskAdjust();deskAdjust()}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return a.test(b)}function reload(){window.location.href=window.location.href}function getNodeFromId(b){for(var a in nodes){if(nodes[a]._id==b){return nodes[a]}}return null}function addHtmlValue(a,b){return"<table><td style=width:120px>"+a+"<td><b>"+b+"</b></table>"}function addHtmlValue2(a,b){return"<div><div style=display:inline-block;float:right>"+b+"</div><div style=display:inline-block>"+a+"</div></div>"}function addLink(b,a){return"<a style=cursor:pointer;color:darkblue;text-decoration:none onclick='"+a+"'>♦ "+b+"</a>"}function addLinkConditional(d,b,a){if(a){return addLink(d,b)}return d}function passwordcheck(a){var b=/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/;return b.test(a)}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function joinPaths(){var c=[];for(var a in arguments){var b=arguments[a];if((b!=null)&&(b!="")){while(b.endsWith("/")||b.endsWith("\\")){b=b.substring(0,b.length-1)}while(b.startsWith("/")||b.startsWith("\\")){b=b.substring(1)}c.push(b)}}return c.join("/")}function focusTextBox(a){setTimeout(function(){Q(a).selectionStart=Q(a).selectionEnd=65535;Q(a).focus()},0)}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();</script></body></html>
\ No newline at end of file
1
+<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <script type="text/javascript" src="scripts/filesaver.1.1.20151003.js"></script> <title>MeshCentral</title> <style> a{color:#036;text-decoration:underline;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;border:none;}.m0{background:url(../images/images16.png) -32px 0px;height:16px;width:16px;border:none;float:left;}.m1{background:url(../images/images16.png) -16px 0px;height:16px;width:16px;border:none;float:left;}.m2{background:url(../images/images16.png) -96px 0px;height:16px;width:16px;border:none;float:left;}.m3{background:url(../images/images16.png) -112px 0px;height:16px;width:16px;border:none;float:left;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.DevSt{padding-left:5px;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}</style> </head> <body onload="if (typeof(startup) !== 'undefined') startup();" style="overflow-y:hidden;margin:0;padding:0;border:0;color:black;font-size:13px;font-family:\'Trebuchet MS\', Arial, Helvetica, sans-serif"> <div id="container"> <div id="mastheadx"></div> <div id="masthead" style="background:url(logo.png) 0px 0px;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"> <div style="width:calc(100% - 50px);overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px"> <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px"> <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> </div> <img class="noselect" style="position:absolute;right:0;top:10px;bottom:50px;color:#c8c8c8;font-size:44px;margin-right:8px;cursor:pointer" onclick="topMenu()" src="/images/3bars-30.png" width="30" height="30"> </div> <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%"> <div id="column_l" style="width:100%;padding:0;position:absolute;bottom:0px;top:0px"> <div id="p0" style="display:none;width:100%;height:100%"> <div style="display:flex;align-items:center;width:100%;height:100%"> <div id="p0message" style="text-align:center;width:100%">Server disconnected, <href onclick="reload()" style="cursor:pointer"><u>click to reconnect</u></href>.</div> </div> </div> <div id="p1" style="display:none;width:100%;height:100%"> <div style="display:flex;align-items:center;width:100%;height:100%"> <div id="p1message" style="text-align:center;width:100%"></div> </div> </div> <div id="p2" style="display:none"> <div id="xdevices"></div> </div> <div id="p3" style="display:none;position:absolute;bottom:0;top:0;width:100%"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div> </td> <td> <img src="/images/user-50.png" width="50" height="50"> </td> <td> <div style="margin-left:5px"> <strong style="font-size:large"><span id="p3userName"></span></strong><br> </div> </td> </tr> </table> <div id="p3info" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <div style="margin-left:8px"> <div id="p3AccountActions"> <p><strong>Account actions</strong></p> <div style="margin-left:9px;margin-bottom:8px"> <div style="margin-top:5px"><span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a></span></div> <div style="margin-top:5px"> <span id="otpAuth" style="display:none"><a onclick="account_addOtp()" style="cursor:pointer">Add 2-step login</a><br></span> <span id="otpAuthRemove" style="display:none"><a onclick="account_removeOtp()" style="cursor:pointer">Remove 2-step login</a><br></span> </div> <div style="margin-top:5px"><a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a></div> <div style="margin-top:5px"><a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a></div> <div style="margin-top:5px"><a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a></div> </div> <br style="clear:both"> </div> <strong>Device Groups</strong> ( <a onclick="account_createMesh()" style="cursor:pointer"><img height="12" src="images/icon-addnew.png" width="12" border="0"> New</a> ) <br><br> <div id="p3meshes"></div> <div id="p3noMeshFound" style="margin-left:9px;display:none">No device groups. <a onclick="account_createMesh()" style="cursor:pointer"><strong>Get started here!</strong></a></div> <br style="clear:both"> </div> </div> </div> <div id="p5" style="display:none"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div> </td> <td> <img src="/images/user-50.png" width="50" height="50"> </td> <td> <div style="margin-left:5px"> <strong style="font-size:large">My Files</strong><br> </div> </td> </tr> </table> <div id="p5myfiles" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <table id="p5toolbar" style="width:100%;height:78px" cellpadding="0" cellspacing="0"> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5FolderUp" disabled="disabled" onclick="p5folderup()" value="Up"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile()" value="SelectAll" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5RenameFileButton" disabled="disabled" value="Rename" onclick="p5renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5DeleteFileButton" disabled="disabled" value="Delete" onclick="p5deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5NewFolderButton" disabled="disabled" value="Folder" onclick="p5createfolder()" onkeypress="return false" onkeydown="return false"> </div> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5UploadButton" disabled="disabled" value="Upload" onclick="p5uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5CutButton" disabled="disabled" value="Cut" onclick="p5copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5CopyButton" disabled="disabled" value="Copy" onclick="p5copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5PasteButton" disabled="disabled" value="Paste" onclick="p5pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p5RefreshButton" value="Refresh" onclick="p5refreshFiles()" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <table style="width:100%"> <tr> <td id="p5currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td> <td style="text-align:right;padding-right:4px"> <select id="p5sortdropdown" onchange="updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </td> </tr> </table> </td> </tr> </table> <div id="p5filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"> <span id="p5files"></span> </div> <table id="p5toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px;background-color:#D3D9D6" cellpadding="0" cellspacing="0"> <tr> <td style="text-align:left;padding:3px"> <span id="p5bottomstatus"></span></td> <td id="p5rightOfButtons" style="text-align:right;padding:3px"></td> </tr> </table> </div> </div> <div id="p10" style="display:none;position:absolute;bottom:0;top:0;width:100%;overflow:hidden"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;position:absolute;top:0"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div> </td> <td> <a id="MainComputerImage" style="cursor:pointer" onclick="p10showiconselector()"></a> </td> <td> <div style="margin-left:5px"> <strong><span id="p10deviceName"></span></strong><br> <span id="MainComputerState"></span> </div> </td> </tr> </table> <div id="p10general" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%"> <div id="p10html" style="margin-left:8px;margin-right:8px"></div> <div id="p10html2"></div> <div id="p10html3"></div> </div> <div id="p10desktop" style="overflow:hidden;position:absolute;top:55px;bottom:0px;width:100%;display:none"> <div id="deskarea1" style="position:absolute;top:0px;width:100%;height:25px"> <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <span id="p14power"></span> </div> <div style="margin-left:3px"> <input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"> <input type="button" id="connectbutton1h" value="HW Connect" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"> <input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"> <span id="deskstatus">Disconnected</span> </div> </div> </div> <div id="deskarea3" style="position:absolute;top:25px;width:100%;height:calc(100% - 50px)"> <div id="deskarea3x" style="background:black;text-align:center;height:100%;position:relative"> <div id="DeskParent" style="height:100%"> <canvas id="Desk" width="640" height="200" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)" onmousewheel="dmousewheel(event)"></canvas> </div> <div id="DeskTools" style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none"> <a id="DeskToolsRefreshButton" style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a> <div id="DeskToolsBar" style="position:absolute;padding:3px;border-radius:3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div> <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left"> <div style="border-bottom:1px solid darkgray;padding:3px"><a style="width:50px;padding-right:5px;float:left;cursor:pointer" title="Sort by process id" onclick="sortProcess(0)">PID</a><a style="cursor:pointer" title="Sort by name" onclick="sortProcess(1)">Name</a></div> <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div> </div> </div> </div> </div> <div id="deskarea4" style="position:absolute;bottom:0px;width:100%;height:25px"> <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <div style="float:right;text-align:right"> <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onclick="deskGetDisplayNumbers(event)"></select> <input id="DeskToastButton" type="button" value="Toast" title="Display a notification message on the remote computer" onkeypress="return false" onkeydown="return false" onclick="deviceToastFunction()"> </div> <div> <input id="deskActionsBtn" type="button" style="margin-left:3px" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()"> <input type="button" value="Settings..." style="margin-left:3px" title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="display:none;margin-left:3px"> <span id="DeskControlSpan" style="margin-left:3px;display:none" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false">Input</span> </div> </div> </div> </div> <div id="p10files" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%;display:none"> <table id="p13toolbar" style="width:100%;height:111px" cellpadding="0" cellspacing="0"> <tr> <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px"> <div style="float:right;text-align:right"> <input id="filesActionsBtn" type="button" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value="Actions" onclick="deviceActionFunction()" style="margin-right:2px"> </div> <div style="margin-left:2px"> <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" onkeypress="return false" onkeydown="return false" type="button" style="display:none"> <input id="p13Connect" value="Connect" onclick="connectFiles(event)" onkeypress="return false" onkeydown="return false" type="button"> <span id="p13Status">Disconnected</span> </div> </td> </tr> <tr> <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom"> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Up"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="SelectAll" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13RenameFileButton" disabled="disabled" value="Rename" onclick="p13renamefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13DeleteFileButton" disabled="disabled" value="Delete" onclick="p13deletefile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13NewFolderButton" disabled="disabled" value="Folder" onclick="p13createfolder()" onkeypress="return false" onkeydown="return false"> </div> <div style="width:100%;text-align:center"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13UploadButton" disabled="disabled" value="Upload" onclick="p13uploadFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13CutButton" disabled="disabled" value="Cut" onclick="p13copyFile(1)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13CopyButton" disabled="disabled" value="Copy" onclick="p13copyFile(0)" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13PasteButton" disabled="disabled" value="Paste" onclick="p13pasteFile()" onkeypress="return false" onkeydown="return false"> <input type="button" style="width:calc(100%/5 - 5px)" id="p13RefreshButton" disabled="disabled" value="Refresh" onclick="p13folderup(9999)" onkeypress="return false" onkeydown="return false"> </div> </td> </tr> <tr> <td style="background-color:#E4E9E7;height:28px"> <table style="width:100%"> <tr> <td id="p13currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td> <td style="text-align:right;padding-right:4px"> <select id="p13sortdropdown" onchange="p13updateFiles()"> <option value="1" selected="selected">Sort by name <option value="2">Sort by size <option value="3">Sort by date <option value="4">Descend by name <option value="5">Descend by size <option value="6">Descend by date </select> </td> </tr> </table> </td> </tr> </table> <div id="p13filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none"> <span id="p13files"></span> </div> <table id="p13toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px" cellpadding="0" cellspacing="0"> <tr><td style="text-align:left;padding:3px;text-align:center;background-color:#D3D9D6"> <span id="p13bottomstatus"></span></td></tr> </table> </div> </div> <div id="p20" style="display:none;position:absolute;bottom:0;top:0;width:100%"> <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;"> <tr style="padding:0"> <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()"> <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0"> <div style="background-color:white;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid white;border-bottom:1px solid white"></div> </div> <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div> </td> <td onclick="p20editmesh(1)"> <img src="/images/meshicon50.png" width="50" height="50"> </td> <td onclick="p20editmesh(1)"> <div style="margin-left:5px"> <strong style="font-size:large"><span id="p20meshName"></span></strong><br> </div> </td> </tr> </table> <div id="p20info" style="margin-left:8px;margin-right:8px"></div> </div> </div> </div> <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px"> <table id="footerMenu" cellpadding="0" cellspacing="0" style="height:32px;width:100%;color:white;cursor:pointer;table-layout:fixed"></table> </div> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:90px;width:300px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> <div id="dialog7" style="margin:auto;margin:3px"> <div id="d7meshkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Agent Remote Desktop</h4> <div style="margin:3px 0 3px 0"> <select id="d7bitmapquality" style="float:right;width:200px;height:20px" dir="rtl"></select> <div style="height:20px">Quality</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7bitmapscaling" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="1024">100% <option value="896">87.5% <option value="768">75% <option value="640">62.5% <option value="512">50% <option value="384">37.5% <option value="256">25% <option value="128">12.5% </select> <div style="height:20px">Scaling</div> </div> <div style="margin:3px 0 3px 0"> <select id="d7framelimiter" style="float:right;width:200px;height:20px" dir="rtl"> <option selected="selected" value="50">Fast <option value="100">Medium <option value="400">Slow <option value="1000">Very slow </select> <div style="height:20px">Rate</div> </div> </div> <div id="d7amtkvm"> <h4 style="width:100%;border-bottom:1px solid gray">Intel® AMT Hardware KVM</h4> <div style='height:26px'> <select id="d7desktopmode" style="float:right;width:200px"> <option value="1">RLE8, Fastest <option value="2">RLE16, Recommended <option value="3">RAW8, Slow <option value="4">RAW16, Very Slow </select> <div>Encoding</div> </div> <div style="height:60px"> <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white"> <input type="checkbox" id='d7showfocus'>Show Focus Tool<br> <input type="checkbox" id='d7showcursor'>Show Local Mouse Cursor<br> </div> <div>Other</div> </div> </div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> </div> </div> <div id="topMenu" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:0px 0px 5px 5px;position:fixed;top:50px;right:5px;width:170px;display:none"> <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(2)">My Files</div> <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(1)">My Account</div> <div id="logoutMenuOption"><a href="/logout"><div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer">Logout</div></a></div> </div> <iframe name="fileUploadFrame" style="display:none"></iframe> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g," ")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"®").replace(/\(TM\)/g,"™")}var MeshServerCreateControl=function(a){var b={};b.State=0;b.connectstate=0;b.pingTimer=null;b.xxStateChange=function(c){if(b.State==c){return}b.State=c;if(b.onStateChanged){b.onStateChanged(b,b.State)}};b.Start=function(){b.connectstate=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+a+"control.ashx");b.socket.onopen=function(){b.connectstate=1;b.xxStateChange(2)};b.socket.onmessage=b.xxOnMessage;b.socket.onclose=function(){b.Stop()};b.xxStateChange(1);if(b.pingTimer!=null){clearInterval(b.pingTimer)}b.pingTimer=setInterval(function(){b.send({action:"ping"})},29000)};b.Stop=function(){b.connectstate=0;if(b.socket){b.socket.close();delete b.socket}if(b.pingTimer!=null){clearInterval(b.pingTimer);b.pingTimer=null}b.xxStateChange(0)};b.xxOnMessage=function(c){var d;try{d=JSON.parse(c.data)}catch(c){return}if(d.action=="pong"){return}if(b.onMessage){b.onMessage(b,d)}};b.send=function(c){if(b.socket!=null&&b.connectstate==1){b.socket.send(JSON.stringify(c))}};return b};var CreateAgentRedirect=function(a,b,e){var c={};c.m=b;b.parent=c;c.meshserver=a;c.State=0;c.nodeid=null;c.socket=null;c.connectstate=-1;c.tunnelid=Math.random().toString(36).substring(2);c.protocol=b.protocol;c.onStateChanged=null;c.ctrlMsgAllowed=true;c.attemptWebRTC=false;c.webRtcActive=false;c.webSwitchOk=false;c.webchannel=null;c.webrtc=null;c.debugmode=0;c.Start=function(f){var h,g=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+c.tunnelid;c.nodeid=f;c.connectstate=0;c.socket=new WebSocket(g);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onerror=function(j){console.error(j)};c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1);c.meshserver.send({action:"msg",type:"tunnel",nodeid:c.nodeid,value:"*/meshrelay.ashx?id="+c.tunnelid})};c.xxOnSocketConnected=function(){if(c.debugmode==1){console.log("onSocketConnected")}c.xxStateChange(2)};c.xxOnControlCommand=function(h){var f;try{f=JSON.parse(h)}catch(g){return}if(f.ctrlChannel!="102938"){c.xxOnSocketData(h);return}if(c.webrtc!=null){if(f.type=="answer"){c.webrtc.setRemoteDescription(new RTCSessionDescription(f),function(){},c.xxCloseWebRTC)}else{if(f.type=="webrtc0"){c.webSwitchOk=true;d()}else{if(f.type=="webrtc1"){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}')}else{if(f.type=="webrtc2"){}}}}}};c.sendCtrlMsg=function(g){if(c.ctrlMsgAllowed==true){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof g,g)}try{c.socket.send(g)}catch(f){}}};function d(){if((c.webSwitchOk==true)&&(c.webRtcActive==true)){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}');c.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}');if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}}}c.xxOnMessage=function(k){if(c.State<3){if(k.data=="c"){try{c.socket.send(c.protocol)}catch(l){}c.xxStateChange(3);if(c.attemptWebRTC==true){var j=null;if(typeof RTCPeerConnection!=="undefined"){c.webrtc=new RTCPeerConnection(j)}else{if(typeof webkitRTCPeerConnection!=="undefined"){c.webrtc=new webkitRTCPeerConnection(j)}}if(c.webrtc!=null){c.webchannel=c.webrtc.createDataChannel("DataChannel",{});c.webchannel.onmessage=function(f){c.xxOnMessage({data:f.data})};c.webchannel.onopen=function(){c.webRtcActive=true;d()};c.webchannel.onclose=function(f){if(c.webRtcActive){c.Stop()}};c.webrtc.onicecandidate=function(f){if(f.candidate==null){try{c.socket.send(JSON.stringify(c.webrtcoffer))}catch(p){}}else{c.webrtcoffer.sdp+=("a="+f.candidate.candidate+"\r\n")}};c.webrtc.oniceconnectionstatechange=function(){if(c.webrtc!=null){if(c.webrtc.iceConnectionState=="disconnected"){if(c.webRtcActive==true){c.Stop()}else{c.xxCloseWebRTC()}}else{if(c.webrtc.iceConnectionState=="failed"){c.xxCloseWebRTC()}}}};c.webrtc.createOffer(function(f){c.webrtcoffer=f;c.webrtc.setLocalDescription(f,function(){},c.xxCloseWebRTC)},c.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:false,OfferToReceiveVideo:false}})}}return}}if(typeof k.data=="string"){c.xxOnControlCommand(k.data);return}if(typeof k.data=="object"){var m=new FileReader();if(m.readAsBinaryString){m.onload=function(f){c.xxOnSocketData(f.target.result)};m.readAsBinaryString(new Blob([k.data]))}else{if(m.readAsArrayBuffer){m.onloadend=function(f){c.xxOnSocketData(f.target.result)};m.readAsArrayBuffer(k.data)}else{var g="";var h=new Uint8Array(k.data);var o=h.byteLength;for(var n=0;n<o;n++){g+=String.fromCharCode(h[n])}c.xxOnSocketData(g)}}}else{c.xxOnSocketData(k.data)}};c.xxOnSocketData=function(h){if(!h||c.connectstate==-1){return}if(typeof h==="object"){var f="",g=new Uint8Array(h),k=g.byteLength;for(var j=0;j<k;j++){f+=String.fromCharCode(g[j])}h=f}else{if(typeof h!=="string"){return}}if((typeof args!="undefined")&&args.redirtrace){console.log("RedirRecv",typeof h,h.length,h)}return c.m.ProcessData(h)};c.sendText=function(f){if(typeof f!="string"){f=JSON.stringify(f)}c.send(encode_utf8(f))};c.send=function(k){if((typeof args!="undefined")&&args.redirtrace){console.log("RedirSend",typeof k,k.length,k)}try{if(c.socket!=null&&c.socket.readyState==WebSocket.OPEN){if(typeof k=="string"){if(c.debugmode==1){var f=new Uint8Array(k.length),g=[];for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j);g.push(k.charCodeAt(j))}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}else{var f=new Uint8Array(k.length);for(var j=0;j<k.length;++j){f[j]=k.charCodeAt(j)}if(c.webRtcActive==true){c.webchannel.send(f.buffer)}else{c.socket.send(f.buffer)}}}else{if(c.webRtcActive==true){c.webchannel.send(k)}else{c.socket.send(k)}}}}catch(h){}};c.xxOnSocketClosed=function(){c.Stop(1)};c.xxStateChange=function(f){if(c.State==f){return}c.State=f;c.m.xxStateChange(c.State);if(c.onStateChanged!=null){c.onStateChanged(c,c.State)}};c.xxCloseWebRTC=function(){if(c.webchannel!=null){try{c.webchannel.close()}catch(f){}c.webchannel=null}if(c.webrtc!=null){try{c.webrtc.close()}catch(f){}c.webrtc=null}c.webRtcActive=false};c.Stop=function(g){if(c.debugmode==1){console.log("stop",g)}c.xxCloseWebRTC();c.connectstate=-1;if(c.socket!=null){try{if(c.socket.readyState==1){c.sendCtrlMsg('{"ctrlChannel":"102938","type":"close"}');c.socket.close()}}catch(f){}c.socket=null}c.xxStateChange(0)};return c};var CreateAgentRemoteDesktop=function(a,e){var d={};d.CanvasId=a;if(typeof a==="string"){d.CanvasId=Q(a)}d.Canvas=d.CanvasId.getContext("2d");d.scrolldiv=e;d.State=0;d.PendingOperations=[];d.tilesReceived=0;d.TilesDrawn=0;d.KillDraw=0;d.ipad=false;d.tabletKeyboardVisible=false;d.LastX=0;d.LastY=0;d.touchenabled=0;d.submenuoffset=0;d.touchtimer=null;d.TouchArray={};d.connectmode=0;d.connectioncount=0;d.rotation=0;d.protocol=2;d.debugmode=0;d.firstUpKeys=[];d.stopInput=false;d.sessionid=0;d.username;d.oldie=false;d.CompressionLevel=50;d.ScalingLevel=1024;d.FrameRateTimer=50;d.FirstDraw=false;d.ScreenWidth=960;d.ScreenHeight=700;d.width=960;d.height=960;d.onScreenSizeChange=null;d.onMessage=null;d.onConnectCountChanged=null;d.onDebugMessage=null;d.onTouchEnabledChanged=null;d.onDisplayinfo=null;d.Start=function(){d.State=0};d.Stop=function(){d.setRotation(0);d.UnGrabKeyInput();d.UnGrabMouseInput();d.touchenabled=0;if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}d.Canvas.clearRect(0,0,d.CanvasId.width,d.CanvasId.height)};d.xxStateChange=function(f){if(d.State==f){return}d.State=f;switch(f){case 0:d.Stop();break;case 3:break}};d.send=function(f){if(d.debugmode>1){console.log("KSend("+f.length+"): "+rstr2hex(f))}d.parent.send(f)};d.ProcessPictureMsg=function(g,j,k){var h=new Image();h.xcount=d.tilesReceived++;var f=d.tilesReceived;h.src="data:image/jpeg;base64,"+btoa(g.substring(4,g.length));h.onload=function(){if(d.Canvas!=null&&d.KillDraw<f&&d.State!=0){d.PendingOperations.push([f,2,h,j,k]);while(d.DoPendingOperations()){}}};h.error=function(){console.log("DecodeTileError")}};d.DoPendingOperations=function(){if(d.PendingOperations.length==0){return false}for(var f=0;f<d.PendingOperations.length;f++){var g=d.PendingOperations[f];if(g[0]==(d.TilesDrawn+1)){if(g[1]==1){d.ProcessCopyRectMsg(g[2])}else{if(g[1]==2){d.Canvas.drawImage(g[2],d.rotX(g[3],g[4]),d.rotY(g[3],g[4]));delete g[2]}}d.PendingOperations.splice(f,1);delete g;d.TilesDrawn++;if(d.TilesDrawn==d.tilesReceived&&d.KillDraw<d.TilesDrawn){d.KillDraw=d.TilesDrawn=d.tilesReceived=0}return true}}if(d.oldie&&d.PendingOperations.length>0){d.TilesDrawn++}return false};d.ProcessCopyRectMsg=function(j){var k=((j.charCodeAt(0)&255)<<8)+(j.charCodeAt(1)&255);var l=((j.charCodeAt(2)&255)<<8)+(j.charCodeAt(3)&255);var f=((j.charCodeAt(4)&255)<<8)+(j.charCodeAt(5)&255);var g=((j.charCodeAt(6)&255)<<8)+(j.charCodeAt(7)&255);var m=((j.charCodeAt(8)&255)<<8)+(j.charCodeAt(9)&255);var h=((j.charCodeAt(10)&255)<<8)+(j.charCodeAt(11)&255);d.Canvas.drawImage(Canvas.canvas,k,l,m,h,f,g,m,h)};d.SendUnPause=function(){d.send(String.fromCharCode(0,8,0,5,0))};d.SendPause=function(){d.send(String.fromCharCode(0,8,0,5,1))};d.SendCompressionLevel=function(j,g,h,f){if(g){d.CompressionLevel=g}if(h){d.ScalingLevel=h}if(f){d.FrameRateTimer=f}d.send(String.fromCharCode(0,5,0,10,j,d.CompressionLevel)+d.shortToStr(d.ScalingLevel)+d.shortToStr(d.FrameRateTimer))};d.SendRefresh=function(){d.send(String.fromCharCode(0,6,0,4))};d.ProcessScreenMsg=function(g,f){if(d.debugmode>0){console.log("ScreenSize: "+g+" x "+f)}d.Canvas.setTransform(1,0,0,1,0,0);d.rotation=0;d.FirstDraw=true;d.ScreenWidth=d.width=g;d.ScreenHeight=d.height=f;d.KillDraw=d.tilesReceived;while(d.PendingOperations.length>0){d.PendingOperations.shift()}d.SendCompressionLevel(1);d.SendUnPause();if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}};d.ProcessData=function(g){var f=0;while(f<g.length){f+=d.ProcessDataEx(g.substring(f))}};d.ProcessDataEx=function(p){if(d.debugmode>1){console.log("KRecv("+p.length+"): "+rstr2hex(p.substring(0,Math.min(p.length,40))))}if(p.length<4){return}var f=null,q=0,r=0,h=ReadShort(p,0),g=ReadShort(p,2);if((g!=p.length)&&(d.debugmode>0)){console.log(g,p.length,g==p.length)}if((h>=18)&&(h!=65)){console.error("Invalid KVM command "+h+" of size "+g);console.log("Invalid KVM data",p.length,p,rstr2hex(p));return}if(g>p.length){console.error("KVM invalid command size",g,p.length);return}if(h==3||h==4||h==7){f=p.substring(4,g);q=((f.charCodeAt(0)&255)<<8)+(f.charCodeAt(1)&255);r=((f.charCodeAt(2)&255)<<8)+(f.charCodeAt(3)&255);if(d.debugmode>0){console.log("CMD"+h+" at X="+q+" Y="+r)}}switch(h){case 3:if(d.FirstDraw){d.onResize()}d.ProcessPictureMsg(f,q,r);break;case 4:if(d.FirstDraw){d.onResize()}if(d.TilesDrawn==d.tilesReceived){d.ProcessCopyRectMsg(f)}else{d.PendingOperations.push([++tilesReceived,1,f])}break;case 7:d.ProcessScreenMsg(q,r);d.SendKeyMsgKC(d.KeyAction.UP,16);d.SendKeyMsgKC(d.KeyAction.UP,17);d.SendKeyMsgKC(d.KeyAction.UP,18);d.SendKeyMsgKC(d.KeyAction.UP,91);d.SendKeyMsgKC(d.KeyAction.UP,92);d.SendKeyMsgKC(d.KeyAction.UP,16);d.send(String.fromCharCode(0,14,0,4));break;case 11:var m=[],j=((p.charCodeAt(4)&255)<<8)+(p.charCodeAt(5)&255);if(j>0){var o=0,n=((p.charCodeAt(6+(j*2))&255)<<8)+(p.charCodeAt(7+(j*2))&255);for(var l=0;l<j;l++){var k=((p.charCodeAt(6+(l*2))&255)<<8)+(p.charCodeAt(7+(l*2))&255);if(k==65535){m.push("All Displays")}else{m.push("Display "+k)}if(k==n){o=l}}}if(d.onDisplayinfo!=null){d.onDisplayinfo(d,m,o)}break;case 12:break;case 14:d.touchenabled=1;d.TouchArray={};if(d.onTouchEnabledChanged!=null){d.onTouchEnabledChanged(d.touchenabled)}break;case 15:d.TouchArray={};break;case 16:d.connectioncount=ReadInt(p,4);if(d.onConnectCountChanged!=null){d.onConnectCountChanged(d.connectioncount,d)}break;case 17:if(d.onMessage!=null){d.onMessage(p.substring(4,g),d)}break;case 65:p=p.substring(4);if(p[0]!="."){console.log(p);alert("KVM: "+p)}else{console.log("KVM: "+p.substring(1))}break}return g};d.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};d.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5,DBLCLICK:6};d.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};d.Alternate=0;var c={Pause:19,CapsLock:20,Space:32,Quote:222,Minus:189,NumpadMultiply:106,NumpadAdd:107,PrintScreen:44,Comma:188,NumpadSubtract:109,NumpadDecimal:110,Period:190,Slash:191,NumpadDivide:111,Semicolon:186,Equal:187,OSLeft:91,BracketLeft:219,OSRight:91,Backslash:220,BracketRight:221,ContextMenu:93,Backquote:192,NumLock:144,ScrollLock:145,Backspace:8,Tab:9,Enter:13,NumpadEnter:13,Escape:27,Delete:46,Home:36,PageUp:33,PageDown:34,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,End:35,Insert:45,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,VolumeMute:181};function b(f){if(f.code.startsWith("Key")&&f.code.length==4){return f.code.charCodeAt(3)}if(f.code.startsWith("Digit")&&f.code.length==6){return f.code.charCodeAt(5)}if(f.code.startsWith("Numpad")&&f.code.length==7){return f.code.charCodeAt(6)+48}return c[f.code]}d.SendKeyMsg=function(f,g){if(f==null){return}if(!g){g=window.event}if(g.code){var h=b(g);if(h!=null){d.SendKeyMsgKC(f,h)}}else{var h=g.keyCode;if(h==59){h=186}d.SendKeyMsgKC(f,h)}};d.SendMessage=function(f){if(d.State==3){d.send(String.fromCharCode(0,17)+d.shortToStr(4+f.length)+f)}};d.SendKeyMsgKC=function(f,h){if(d.State!=3){return}if(typeof f=="object"){for(var g in f){d.SendKeyMsgKC(f[g][0],f[g][1])}}else{d.send(String.fromCharCode(0,d.InputType.KEY,0,6,(f-1),h))}};d.sendcad=function(){d.SendCtrlAltDelMsg()};d.SendCtrlAltDelMsg=function(){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.CTRLALTDEL,0,4))}};d.SendEscKey=function(){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.KEY,0,6,0,27,0,d.InputType.KEY,0,6,1,27))}};d.SendStartMsg=function(){d.SendKeyMsgKC(d.KeyAction.EXDOWN,91);d.SendKeyMsgKC(d.KeyAction.EXUP,91)};d.SendCharmsMsg=function(){d.SendKeyMsgKC(d.KeyAction.EXDOWN,91);d.SendKeyMsgKC(d.KeyAction.DOWN,67);d.SendKeyMsgKC(d.KeyAction.UP,67);d.SendKeyMsgKC(d.KeyAction.EXUP,91)};d.SendTouchMsg1=function(g,f,h,j){if(d.State==3){d.send(String.fromCharCode(0,d.InputType.TOUCH)+d.shortToStr(14)+String.fromCharCode(1,g)+d.intToStr(f)+d.shortToStr(h)+d.shortToStr(j))}};d.SendTouchMsg2=function(h,f){var l="";var g;var m="TOUCHSEND: ";for(var j in d.TouchArray){if(j==h){g=f}else{if(d.TouchArray[j].f==1){g=65536|2|4;d.TouchArray[j].f=3;m+="START"+j}else{if(d.TouchArray[j].f==2){g=262144;m+="STOP"+j}else{g=2|4|131072}}}l+=String.fromCharCode(j)+d.intToStr(g)+d.shortToStr(d.TouchArray[j].x)+d.shortToStr(d.TouchArray[j].y);if(d.TouchArray[j].f==2){delete d.TouchArray[j]}}if(d.State==3){d.send(String.fromCharCode(0,d.InputType.TOUCH)+d.shortToStr(5+l.length)+String.fromCharCode(2)+l)}if(Object.keys(d.TouchArray).length==0&&d.touchtimer!=null){clearInterval(d.touchtimer);d.touchtimer=null}};d.SendMouseMsg=function(f,j){if(d.State!=3){return}if(f!=null&&d.Canvas!=null){if(!j){var j=window.event}var m=(d.Canvas.canvas.height/d.CanvasId.clientHeight);var n=(d.Canvas.canvas.width/d.CanvasId.clientWidth);var l=d.GetPositionOfControl(d.Canvas.canvas);var o=((j.pageX-l[0])*n);var p=((j.pageY-l[1])*m);if(o>=0&&o<=d.Canvas.canvas.width&&p>=0&&p<=d.Canvas.canvas.height){var g=0;var h=0;if(f==d.KeyAction.UP||f==d.KeyAction.DOWN){if(j.which){((j.which==1)?(g=d.MouseButton.LEFT):((j.which==2)?(g=d.MouseButton.MIDDLE):(g=d.MouseButton.RIGHT)))}else{if(j.button){((j.button==0)?(g=d.MouseButton.LEFT):((j.button==1)?(g=d.MouseButton.MIDDLE):(g=d.MouseButton.RIGHT)))}}}else{if(f==d.KeyAction.SCROLL){if(j.detail){h=(-1*(j.detail*120))}else{if(j.wheelDelta){h=(j.wheelDelta*3)}}}}var k="";if(f==d.KeyAction.DBLCLICK){k=String.fromCharCode(0,d.InputType.MOUSE,0,10,0,136,((o/256)&255),(o&255),((p/256)&255),(p&255))}else{if(f==d.KeyAction.SCROLL){k=String.fromCharCode(0,d.InputType.MOUSE,0,12,0,0,((o/256)&255),(o&255),((p/256)&255),(p&255),((h/256)&255),(h&255))}else{k=String.fromCharCode(0,d.InputType.MOUSE,0,10,0,((f==d.KeyAction.DOWN)?g:((g*2)&255)),((o/256)&255),(o&255),((p/256)&255),(p&255))}}if(d.Action==d.KeyAction.NONE){if(d.Alternate==0||d.ipad){d.send(k);d.Alternate=1}else{d.Alternate=0}}else{d.send(k)}}}};d.GetDisplayNumbers=function(){d.send(String.fromCharCode(0,11,0,4))};d.SetDisplay=function(f){d.send(String.fromCharCode(0,12,0,6,f>>8,f&255))};d.intToStr=function(f){return String.fromCharCode((f>>24)&255,(f>>16)&255,(f>>8)&255,f&255)};d.shortToStr=function(f){return String.fromCharCode((f>>8)&255,f&255)};d.onResize=function(){if(d.ScreenWidth==0||d.ScreenHeight==0){return}if(d.Canvas.canvas.width==d.ScreenWidth&&d.Canvas.canvas.height==d.ScreenHeight){return}if(d.FirstDraw){d.Canvas.canvas.width=d.ScreenWidth;d.Canvas.canvas.height=d.ScreenHeight;d.Canvas.fillRect(0,0,d.ScreenWidth,d.ScreenHeight);if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}}d.FirstDraw=false};d.xxMouseInputGrab=false;d.xxKeyInputGrab=false;d.xxMouseMove=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.NONE,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxMouseUp=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.UP,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxMouseDown=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.DOWN,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxMouseDblClick=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.DBLCLICK,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxDOMMouseScroll=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.SCROLL,f);return false}return true};d.xxMouseWheel=function(f){if(d.State==3){d.SendMouseMsg(d.KeyAction.SCROLL,f);return false}return true};d.xxKeyUp=function(f){if(d.State==3){d.SendKeyMsg(d.KeyAction.UP,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxKeyDown=function(f){if(d.State==3){d.SendKeyMsg(d.KeyAction.DOWN,f)}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.xxKeyPress=function(f){if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};d.handleKeys=function(f){if(d.stopInput==true||desktop.State!=3){return false}return d.xxKeyPress(f)};d.handleKeyUp=function(f){if(d.stopInput==true||desktop.State!=3){return false}if(d.firstUpKeys.length<5){d.firstUpKeys.push(f.keyCode);if((d.firstUpKeys.length==5)){var g=d.firstUpKeys.join(",");if((g=="16,17,91,91,16")||(g=="16,17,18,91,92")){d.stopInput=true}}}return d.xxKeyUp(f)};d.handleKeyDown=function(f){if(d.stopInput==true||desktop.State!=3){return false}return d.xxKeyDown(f)};d.mousedblclick=function(f){if(d.stopInput==true){return false}return d.xxMouseDblClick(f)};d.mousedown=function(f){if(d.stopInput==true){return false}return d.xxMouseDown(f)};d.mouseup=function(f){if(d.stopInput==true){return false}return d.xxMouseUp(f)};d.mousemove=function(f){if(d.stopInput==true){return false}return d.xxMouseMove(f)};d.mousewheel=function(f){if(d.stopInput==true){return false}return d.xxMouseWheel(f)};d.xxMsTouchEvent=function(f){if(f.originalEvent.pointerType==4){return}if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}if(f.type=="MSPointerDown"||f.type=="MSPointerMove"||f.type=="MSPointerUp"){var g=0;var h=f.originalEvent.pointerId%256;var j=f.offsetX*(Canvas.canvas.width/d.CanvasId.clientWidth);var k=f.offsetY*(Canvas.canvas.height/d.CanvasId.clientHeight);if(f.type=="MSPointerDown"){g=65536|2|4}else{if(f.type=="MSPointerMove"){g=131072|2|4}else{if(f.type=="MSPointerUp"){g=262144}}}if(!d.TouchArray[h]){d.TouchArray[h]={x:j,y:k}}d.SendTouchMsg2(h,g);if(f.type=="MSPointerUp"){delete d.TouchArray[h]}}else{alert(f.type)}return true};d.xxTouchStart=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}var k=f.originalEvent.touches[0];f.which=1;d.LastX=f.pageX=k.pageX;d.LastY=f.pageY=k.pageY;d.SendMouseMsg(KeyAction.DOWN,f)}else{var j=d.GetPositionOfControl(Canvas.canvas);for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(!d.TouchArray[h]){d.TouchArray[h]={x:(f.originalEvent.touches[g].pageX-j[0])*(Canvas.canvas.width/d.CanvasId.clientWidth),y:(f.originalEvent.touches[g].pageY-j[1])*(Canvas.canvas.height/d.CanvasId.clientHeight),f:1}}}if(Object.keys(d.TouchArray).length>0&&touchtimer==null){d.touchtimer=setInterval(function(){d.SendTouchMsg2(256,0)},50)}}};d.xxTouchMove=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}var k=f.originalEvent.touches[0];f.which=1;d.LastX=f.pageX=k.pageX;d.LastY=f.pageY=k.pageY;d.SendMouseMsg(d.KeyAction.NONE,f)}else{var j=d.GetPositionOfControl(Canvas.canvas);for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(d.TouchArray[h]){d.TouchArray[h].x=(f.originalEvent.touches[g].pageX-j[0])*(d.Canvas.canvas.width/d.CanvasId.clientWidth);d.TouchArray[h].y=(f.originalEvent.touches[g].pageY-j[1])*(d.Canvas.canvas.height/d.CanvasId.clientHeight)}}}};d.xxTouchEnd=function(f){if(d.State!=3){return}if(f.preventDefault){f.preventDefault()}if(d.touchenabled==0||d.touchenabled==1){if(f.originalEvent.touches.length>1){return}f.which=1;f.pageX=LastX;f.pageY=LastY;d.SendMouseMsg(KeyAction.UP,f)}else{for(var g in f.originalEvent.changedTouches){if(!f.originalEvent.changedTouches[g].identifier){continue}var h=f.originalEvent.changedTouches[g].identifier%256;if(d.TouchArray[h]){d.TouchArray[h].f=2}}}};d.GrabMouseInput=function(){if(d.xxMouseInputGrab==true){return}var f=d.CanvasId;f.onmousemove=d.xxMouseMove;f.onmouseup=d.xxMouseUp;f.onmousedown=d.xxMouseDown;f.touchstart=d.xxTouchStart;f.touchmove=d.xxTouchMove;f.touchend=d.xxTouchEnd;f.MSPointerDown=d.xxMsTouchEvent;f.MSPointerMove=d.xxMsTouchEvent;f.MSPointerUp=d.xxMsTouchEvent;if(navigator.userAgent.match(/mozilla/i)){f.DOMMouseScroll=d.xxDOMMouseScroll}else{f.onmousewheel=d.xxMouseWheel}d.xxMouseInputGrab=true};d.UnGrabMouseInput=function(){if(d.xxMouseInputGrab==false){return}var f=d.CanvasId;f.onmousemove=null;f.onmouseup=null;f.onmousedown=null;f.touchstart=null;f.touchmove=null;f.touchend=null;f.MSPointerDown=null;f.MSPointerMove=null;f.MSPointerUp=null;if(navigator.userAgent.match(/mozilla/i)){f.DOMMouseScroll=null}else{f.onmousewheel=null}d.xxMouseInputGrab=false};d.GrabKeyInput=function(){if(d.xxKeyInputGrab==true){return}document.onkeyup=d.xxKeyUp;document.onkeydown=d.xxKeyDown;document.onkeypress=d.xxKeyPress;d.xxKeyInputGrab=true};d.UnGrabKeyInput=function(){if(d.xxKeyInputGrab==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d.xxKeyInputGrab=false};d.GetPositionOfControl=function(f){var g=Array(2);g[0]=g[1]=0;while(f){g[0]+=f.offsetLeft;g[1]+=f.offsetTop;f=f.offsetParent}return g};d.crotX=function(f,g){if(d.rotation==0){return f}if(d.rotation==1){return g}if(d.rotation==2){return d.Canvas.canvas.width-f}if(d.rotation==3){return d.Canvas.canvas.height-g}};d.crotY=function(f,g){if(d.rotation==0){return g}if(d.rotation==1){return d.Canvas.canvas.width-f}if(d.rotation==2){return d.Canvas.canvas.height-g}if(d.rotation==3){return f}};d.rotX=function(f,g){if(d.rotation==0||d.rotation==1){return f}if(d.rotation==2){return f-d.Canvas.canvas.width}if(d.rotation==3){return f-d.Canvas.canvas.height}};d.rotY=function(f,g){if(d.rotation==0||d.rotation==3){return g}if(d.rotation==1){return g-d.Canvas.canvas.width}if(d.rotation==2){return g-d.Canvas.canvas.height}};d.tcanvas=null;d.setRotation=function(k){while(k<0){k+=4}var f=k%4;if(f==d.rotation){return true}var h=d.Canvas.canvas.width;var g=d.Canvas.canvas.height;if(d.rotation==1||d.rotation==3){h=d.Canvas.canvas.height;g=d.Canvas.canvas.width}if(d.tcanvas==null){d.tcanvas=document.createElement("canvas")}var j=d.tcanvas.getContext("2d");j.setTransform(1,0,0,1,0,0);j.canvas.width=h;j.canvas.height=g;j.rotate((d.rotation*-90)*Math.PI/180);if(d.rotation==0){j.drawImage(d.Canvas.canvas,0,0)}if(d.rotation==1){j.drawImage(d.Canvas.canvas,-d.Canvas.canvas.width,0)}if(d.rotation==2){j.drawImage(d.Canvas.canvas,-d.Canvas.canvas.width,-d.Canvas.canvas.height)}if(d.rotation==3){j.drawImage(d.Canvas.canvas,0,-d.Canvas.canvas.height)}if(d.rotation==0||d.rotation==2){d.Canvas.canvas.height=h;d.Canvas.canvas.width=g}if(d.rotation==1||d.rotation==3){d.Canvas.canvas.height=g;d.Canvas.canvas.width=h}d.Canvas.setTransform(1,0,0,1,0,0);d.Canvas.rotate((f*90)*Math.PI/180);d.rotation=f;d.Canvas.drawImage(d.tcanvas,d.rotX(0,0),d.rotY(0,0));d.ScreenWidth=d.Canvas.canvas.width;d.ScreenHeight=d.Canvas.canvas.height;if(d.onScreenSizeChange!=null){d.onScreenSizeChange(d,d.ScreenWidth,d.ScreenHeight,d.CanvasId)}return true};d.MuchTheSame=function(f,g){return(Math.abs(f-g)<4)};d.Debug=function(f){console.log(f)};d.getIEVersion=function(){var f=-1;if(navigator.appName=="Microsoft Internet Explorer"){var h=navigator.userAgent;var g=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(g.exec(h)!=null){f=parseFloat(RegExp.$1)}}return f};d.haltEvent=function(f){if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}return false};return d};function AmtStackCreateService(s){var r=new Object();r.wsman=s;r.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];r.PendingEnums=[];r.PendingBatchOperations=0;r.ActiveEnumsCount=0;r.MaxActiveEnumsCount=1;r.onProcessChanged=null;var m=0;var l=0;r.GetPendingActions=function(){return(r.PendingEnums.length*2)+(r.ActiveEnumsCount)+r.wsman.comm.PendingAjax.length+r.wsman.comm.ActiveAjaxCount+r.PendingBatchOperations};function q(){var t=r.GetPendingActions();if(m<t){m=t}if(r.onProcessChanged!=null&&l!=t){l=t;r.onProcessChanged(t,m)}if(t==0){m=0}}r.Subscribe=function(v,u,B,t,A,y,z,w,C,x){r.wsman.ExecSubscribe(r.CompleteName(v),u,B,function(F,E,D,G){q();t(r,v,D,G,A)},0,y,z,w,C,x);q()};r.UnSubscribe=function(u,t,x,v,w){r.wsman.ExecUnSubscribe(r.CompleteName(u),function(A,z,y,B){q();t(r,u,y,B,x)},0,v,w);q()};r.Get=function(u,t,w,v){r.wsman.ExecGet(r.CompleteName(u),function(z,y,x,A){q();t(r,u,x,A,w)},0,v);q()};r.Put=function(u,w,t,y,v,x){r.wsman.ExecPut(r.CompleteName(u),w,function(B,A,z,C){q();t(r,u,z,C,y)},0,v,x);q()};r.Create=function(u,w,t,x,v){r.wsman.ExecCreate(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Delete=function(u,w,t,x,v){r.wsman.ExecDelete(r.CompleteName(u),w,function(A,z,y,B){q();t(r,u,y,B,x)},0,v);q()};r.Exec=function(w,v,t,u,z,x,y){r.wsman.ExecMethod(r.CompleteName(w),v,t,function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.ExecWithXml=function(w,v,t,u,z,x,y){r.wsman.ExecMethodXml(r.CompleteName(w),v,execArgumentsToXml(t),function(C,B,A,D){q();u(r,w,r.CompleteExecResponse(A),D,z)},0,x,y);q()};r.Enum=function(u,t,w,v){if(r.ActiveEnumsCount<r.MaxActiveEnumsCount){r.ActiveEnumsCount++;r.wsman.ExecEnum(r.CompleteName(u),function(A,y,x,B,z){q();d(u,x,t,y,B,z)},w,v)}else{r.PendingEnums.push([u,t,w,v])}q()};function d(v,x,t,y,z,A,w){if(z!=200){t(r,v,null,z,A);c(1);return}if(x==null||x.Header.Method!="EnumerateResponse"||!x.Body.EnumerationContext){t(r,v,null,603,A);c(1);return}var u=x.Body.EnumerationContext;r.wsman.ExecPull(y,u,function(D,C,B,E){b(v,B,t,C,[],E,A,w)})}function b(y,A,t,B,w,C,D,z){if(C!=200){t(r,y,null,C,D);c(1);return}if(A==null||A.Header.Method!="PullResponse"){t(r,y,null,604,D);c(1);return}for(var v in A.Body.Items){if(A.Body.Items[v] instanceof Array){for(var x in A.Body.Items[v]){w.push(A.Body.Items[v][x])}}else{w.push(A.Body.Items[v])}}if(A.Body.EnumerationContext){var u=A.Body.EnumerationContext;r.wsman.ExecPull(B,u,function(G,F,E,H){b(y,E,t,F,w,H,D,1)})}else{c(1);t(r,y,w,C,D);q()}}function c(t){r.ActiveEnumsCount-=t;if(r.ActiveEnumsCount>=r.MaxActiveEnumsCount||r.PendingEnums.length==0){return}var u=r.PendingEnums.shift();r.Enum(u[0],u[1],u[2]);c(0)}r.BatchEnum=function(t,w,u,y,v,x){r.PendingBatchOperations+=(w.length*2);a(t,Clone(w),u,y,{},v,x);q()};function a(t,y,u,B,A,v,z){r.PendingBatchOperations-=2;var x=y.shift(),w=r.Enum;if(x[0]=="*"){w=r.Get;x=x.substring(1)}w(x,function(E,C,D,F,G){G[2][C]={response:(D==null?null:D.Body),responses:D,status:F};if(G[1].length==0||F==401||(v!=true&&F!=200&&F!=400)){r.PendingBatchOperations-=(y.length*2);q();u(r,t,G[2],F,B)}else{q();a(t,y,u,B,G[2],z)}},[t,y,A],z);q()}r.BatchGet=function(t,v,u,x,w){g({name:t,names:v,callback:u,current:0,responses:{},tag:x,pri:w});q()};function g(t){if(t.names.length<=t.current){t.callback(r,t.name,t.responses,200,t.tag)}else{r.wsman.ExecGet(r.CompleteName(t.names[t.current]),function(w,v,u,x){f(t,u,x)},t.pri);t.current++}q()}function f(t,u,v){if(u==null||v!=200){t.callback(r,t.name,null,v,t.tag)}else{t.responses[u.Header.Method]=u;g(t)}}r.CompleteName=function(t){if(t.indexOf("AMT_")==0){return r.pfx[0]+t}if(t.indexOf("CIM_")==0){return r.pfx[1]+t}if(t.indexOf("IPS_")==0){return r.pfx[2]+t}};r.CompleteExecResponse=function(t){if(t&&t!=null&&t.Body&&t.Body.ReturnValue){t.Body.ReturnValueStr=r.AmtStatusToStr(t.Body.ReturnValue)}return t};r.RequestPowerStateChange=function(u,t){r.CIM_PowerManagementService_RequestPowerStateChange(u,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',null,null,t)};r.SetBootConfigRole=function(u,t){r.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',u,t)};r.CancelAllQueries=function(t){r.wsman.CancelAllQueries(t)};r.AMT_AgentPresenceWatchdog_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdog_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdog_AddAction=function(y,x,w,u,t,v,B,z,A){r.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:y,NewState:x,EventOnTransition:w,ActionSd:u,ActionEac:t},v,B,z,A)};r.AMT_AgentPresenceWatchdog_DeleteAllActions=function(t,w,u,v){r.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},t,w,u,v)};r.AMT_AgentPresenceWatchdogAction_GetActionEac=function(t){r.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},t)};r.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(t){r.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},t)};r.AMT_AgentPresenceWatchdogVA_AssertPresence=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(u,t){r.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:u},t)};r.AMT_AgentPresenceWatchdogVA_AddAction=function(y,x,w,u,t,v){r.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:y,NewState:x,EventOnTransition:w,ActionSd:u,ActionEac:t},v)};r.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(t,u){r.Exec("AMT_AgentPresenceWatchdogVA","DeleteAllActions",{_method_dummy:t},u)};r.AMT_AuditLog_ClearLog=function(t){r.Exec("AMT_AuditLog","ClearLog",{},t)};r.AMT_AuditLog_RequestStateChange=function(u,v,t){r.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_AuditLog_ReadRecords=function(u,t,v){r.Exec("AMT_AuditLog","ReadRecords",{StartIndex:u},t,v)};r.AMT_AuditLog_SetAuditLock=function(w,u,v,t){r.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:w,Flag:u,Handle:v},t)};r.AMT_AuditLog_ExportAuditLogSignature=function(u,t){r.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:u},t)};r.AMT_AuditLog_SetSigningKeyMaterial=function(x,w,v,u,t){r.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:x,SigningKey:w,LengthOfCertificates:v,Certificates:u},t)};r.AMT_AuditPolicyRule_SetAuditPolicy=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(v,t,w,x,u){r.Exec("AMT_AuditPolicyRule","SetAuditPolicyBulk",{Enable:v,AuditedAppID:t,EventID:w,PolicyType:x},u)};r.AMT_AuthorizationService_AddUserAclEntryEx=function(w,v,x,t,y,u){r.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:w,DigestPassword:v,KerberosUserSid:x,AccessPermission:t,Realms:y},u)};r.AMT_AuthorizationService_EnumerateUserAclEntries=function(u,t){r.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:u},t)};r.AMT_AuthorizationService_GetUserAclEntryEx=function(u,t,v){r.Exec("AMT_AuthorizationService","GetUserAclEntryEx",{Handle:u},t,v)};r.AMT_AuthorizationService_UpdateUserAclEntryEx=function(x,w,v,y,t,z,u){r.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:x,DigestUsername:w,DigestPassword:v,KerberosUserSid:y,AccessPermission:t,Realms:z},u)};r.AMT_AuthorizationService_RemoveUserAclEntry=function(u,t){r.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:u},t)};r.AMT_AuthorizationService_SetAdminAclEntryEx=function(v,u,t){r.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",{Username:v,DigestPassword:u},t)};r.AMT_AuthorizationService_GetAdminAclEntry=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},t)};r.AMT_AuthorizationService_GetAdminAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},t)};r.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(t){r.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},t)};r.AMT_AuthorizationService_SetAclEnabledState=function(v,u,t,w){r.Exec("AMT_AuthorizationService","SetAclEnabledState",{Handle:v,Enabled:u},t,w)};r.AMT_AuthorizationService_GetAclEnabledState=function(u,t,v){r.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:u},t,v)};r.AMT_EndpointAccessControlService_RequestStateChange=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_EndpointAccessControlService_GetPosture=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:u},t)};r.AMT_EndpointAccessControlService_GetPostureHash=function(u,t){r.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:u},t)};r.AMT_EndpointAccessControlService_UpdatePostureState=function(u,t){r.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:u},t)};r.AMT_EndpointAccessControlService_GetEacOptions=function(t){r.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},t)};r.AMT_EndpointAccessControlService_SetEacOptions=function(u,v,t){r.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:u,PostureHashAlgorithm:v},t)};r.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:u},t)};r.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(u,t){r.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:u},t)};r.AMT_EthernetPortSettings_SetLinkPreference=function(u,v,t){r.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:u,Timeout:v},t)};r.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=function(u,t){r.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:u},t)};r.AMT_KerberosSettingData_GetCredentialCacheState=function(t){r.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},t)};r.AMT_KerberosSettingData_SetCredentialCacheState=function(u,t){r.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:u},t)};r.AMT_MessageLog_CancelIteration=function(u,t){r.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:u},t)};r.AMT_MessageLog_RequestStateChange=function(u,v,t){r.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_MessageLog_ClearLog=function(t){r.Exec("AMT_MessageLog","ClearLog",{},t)};r.AMT_MessageLog_GetRecords=function(u,v,t,w){r.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:u,MaxReadRecords:v},t,w)};r.AMT_MessageLog_GetRecord=function(u,v,t){r.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:u,PositionToNext:v},t)};r.AMT_MessageLog_PositionAtRecord=function(u,v,w,t){r.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:u,MoveAbsolute:v,RecordNumber:w},t)};r.AMT_MessageLog_PositionToFirstRecord=function(t,u){r.Exec("AMT_MessageLog","PositionToFirstRecord",{},t,u)};r.AMT_MessageLog_FreezeLog=function(u,t){r.Exec("AMT_MessageLog","FreezeLog",{Freeze:u},t)};r.AMT_PublicKeyManagementService_AddCRL=function(v,u,t){r.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:v,SerialNumbers:u},t)};r.AMT_PublicKeyManagementService_ResetCRLList=function(t,u){r.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:t},u)};r.AMT_PublicKeyManagementService_AddCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:u},t)};r.AMT_PublicKeyManagementService_AddKey=function(u,t){r.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:u},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(v,u,w,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:v,DNName:u,Usage:w},t)};r.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(u,w,v,t){r.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:u,SigningAlgorithm:w,NullSignedCertificateRequest:v},t)};r.AMT_PublicKeyManagementService_GenerateKeyPair=function(u,v,t){r.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:u,KeyLength:v},t)};r.AMT_RedirectionService_RequestStateChange=function(u,t){r.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:u},t)};r.AMT_RedirectionService_TerminateSession=function(u,t){r.Exec("AMT_RedirectionService","TerminateSession",{SessionType:u},t)};r.AMT_RemoteAccessService_AddMpServer=function(t,y,A,u,w,B,z,x,v){r.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:t,InfoFormat:y,Port:A,AuthMethod:u,Certificate:w,Username:B,Password:z,CN:x},v)};r.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(w,x,u,v,t){r.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:w,TunnelLifeTime:x,ExtendedData:u,MpServer:v},t)};r.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(t,u){r.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_CommitChanges=function(t,u){r.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_Unprovision=function(u,t){r.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:u},t)};r.AMT_SetupAndConfigurationService_PartialUnprovision=function(t,u){r.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(t,u){r.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:t},u)};r.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(u,t){r.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:u},t)};r.AMT_SetupAndConfigurationService_SetMEBxPassword=function(u,t){r.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:u},t)};r.AMT_SetupAndConfigurationService_SetTLSPSK=function(u,v,t){r.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:u,PPS:v},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},t)};r.AMT_SetupAndConfigurationService_GetUuid=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUuid",{},t)};r.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(t){r.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},t)};r.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(t){r.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},t)};r.AMT_SystemDefensePolicy_GetTimeout=function(t){r.Exec("AMT_SystemDefensePolicy","GetTimeout",{},t)};r.AMT_SystemDefensePolicy_SetTimeout=function(u,t){r.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:u},t)};r.AMT_SystemDefensePolicy_UpdateStatistics=function(u,w,t,y,v,x){r.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:u,ResetOnRead:w},t,y,v,x)};r.AMT_SystemPowerScheme_SetPowerScheme=function(t,u,v){r.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},t,v,0,{InstanceID:u})};r.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(t,u){r.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},t,u)};r.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(u,w,x,t,v){r.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:u,Tm1:w,Tm2:x},t,v)};r.AMT_UserInitiatedConnectionService_RequestStateChange=function(u,v,t){r.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WebUIService_RequestStateChange=function(u,v,t){r.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:x,WiFiEndpointSettingsInput:y,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(x,y,w,v,t,u){r.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:x,WiFiEndpointSettingsInput:y,IEEE8021xSettingsInput:w,ClientCredential:v,CACredential:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:t},u)};r.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(t,u){r.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:t},u)};r.CIM_Account_RequestStateChange=function(u,v,t){r.Exec("CIM_Account","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_AccountManagementService_CreateAccount=function(v,t,u){r.Exec("CIM_AccountManagementService","CreateAccount",{System:v,AccountTemplate:t},u)};r.CIM_BootConfigSetting_ChangeBootOrder=function(u,t){r.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:u},t)};r.CIM_BootService_SetBootConfigRole=function(t,v,u){r.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:t,Role:v},u,0,1)};r.CIM_Card_ConnectorPower=function(u,v,t){r.Exec("CIM_Card","ConnectorPower",{Connector:u,PoweredOn:v},t)};r.CIM_Card_IsCompatible=function(u,t){r.Exec("CIM_Card","IsCompatible",{ElementToCheck:u},t)};r.CIM_Chassis_IsCompatible=function(u,t){r.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:u},t)};r.CIM_Fan_SetSpeed=function(u,t){r.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:u},t)};r.CIM_KVMRedirectionSAP_RequestStateChange=function(u,v,t){r.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:u},t)};r.CIM_MediaAccessDevice_LockMedia=function(u,t){r.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:u},t)};r.CIM_MediaAccessDevice_SetPowerState=function(u,v,t){r.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_MediaAccessDevice_Reset=function(t){r.Exec("CIM_MediaAccessDevice","Reset",{},t)};r.CIM_MediaAccessDevice_EnableDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:u},t)};r.CIM_MediaAccessDevice_OnlineDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:u},t)};r.CIM_MediaAccessDevice_QuiesceDevice=function(u,t){r.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:u},t)};r.CIM_MediaAccessDevice_SaveProperties=function(t){r.Exec("CIM_MediaAccessDevice","SaveProperties",{},t)};r.CIM_MediaAccessDevice_RestoreProperties=function(t){r.Exec("CIM_MediaAccessDevice","RestoreProperties",{},t)};r.CIM_MediaAccessDevice_RequestStateChange=function(u,v,t){r.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_PhysicalFrame_IsCompatible=function(u,t){r.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:u},t)};r.CIM_PhysicalPackage_IsCompatible=function(u,t){r.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:u},t)};r.CIM_PowerManagementService_RequestPowerStateChange=function(v,u,w,x,t){r.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:v,ManagedElement:u,Time:w,TimeoutPeriod:x},t,0,1)};r.CIM_PowerSupply_SetPowerState=function(u,v,t){r.Exec("CIM_PowerSupply","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_PowerSupply_Reset=function(t){r.Exec("CIM_PowerSupply","Reset",{},t)};r.CIM_PowerSupply_EnableDevice=function(u,t){r.Exec("CIM_PowerSupply","EnableDevice",{Enabled:u},t)};r.CIM_PowerSupply_OnlineDevice=function(u,t){r.Exec("CIM_PowerSupply","OnlineDevice",{Online:u},t)};r.CIM_PowerSupply_QuiesceDevice=function(u,t){r.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:u},t)};r.CIM_PowerSupply_SaveProperties=function(t){r.Exec("CIM_PowerSupply","SaveProperties",{},t)};r.CIM_PowerSupply_RestoreProperties=function(t){r.Exec("CIM_PowerSupply","RestoreProperties",{},t)};r.CIM_PowerSupply_RequestStateChange=function(u,v,t){r.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Processor_SetPowerState=function(u,v,t){r.Exec("CIM_Processor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Processor_Reset=function(t){r.Exec("CIM_Processor","Reset",{},t)};r.CIM_Processor_EnableDevice=function(u,t){r.Exec("CIM_Processor","EnableDevice",{Enabled:u},t)};r.CIM_Processor_OnlineDevice=function(u,t){r.Exec("CIM_Processor","OnlineDevice",{Online:u},t)};r.CIM_Processor_QuiesceDevice=function(u,t){r.Exec("CIM_Processor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Processor_SaveProperties=function(t){r.Exec("CIM_Processor","SaveProperties",{},t)};r.CIM_Processor_RestoreProperties=function(t){r.Exec("CIM_Processor","RestoreProperties",{},t)};r.CIM_Processor_RequestStateChange=function(u,v,t){r.Exec("CIM_Processor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RecordLog_ClearLog=function(t){r.Exec("CIM_RecordLog","ClearLog",{},t)};r.CIM_RecordLog_RequestStateChange=function(u,v,t){r.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_RedirectionService_RequestStateChange=function(u,v,t){r.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_Sensor_SetPowerState=function(u,v,t){r.Exec("CIM_Sensor","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Sensor_Reset=function(t){r.Exec("CIM_Sensor","Reset",{},t)};r.CIM_Sensor_EnableDevice=function(u,t){r.Exec("CIM_Sensor","EnableDevice",{Enabled:u},t)};r.CIM_Sensor_OnlineDevice=function(u,t){r.Exec("CIM_Sensor","OnlineDevice",{Online:u},t)};r.CIM_Sensor_QuiesceDevice=function(u,t){r.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:u},t)};r.CIM_Sensor_SaveProperties=function(t){r.Exec("CIM_Sensor","SaveProperties",{},t)};r.CIM_Sensor_RestoreProperties=function(t){r.Exec("CIM_Sensor","RestoreProperties",{},t)};r.CIM_Sensor_RequestStateChange=function(u,v,t){r.Exec("CIM_Sensor","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_StatisticalData_ResetSelectedStats=function(u,t){r.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:u},t)};r.CIM_Watchdog_KeepAlive=function(t){r.Exec("CIM_Watchdog","KeepAlive",{},t)};r.CIM_Watchdog_SetPowerState=function(u,v,t){r.Exec("CIM_Watchdog","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_Watchdog_Reset=function(t){r.Exec("CIM_Watchdog","Reset",{},t)};r.CIM_Watchdog_EnableDevice=function(u,t){r.Exec("CIM_Watchdog","EnableDevice",{Enabled:u},t)};r.CIM_Watchdog_OnlineDevice=function(u,t){r.Exec("CIM_Watchdog","OnlineDevice",{Online:u},t)};r.CIM_Watchdog_QuiesceDevice=function(u,t){r.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:u},t)};r.CIM_Watchdog_SaveProperties=function(t){r.Exec("CIM_Watchdog","SaveProperties",{},t)};r.CIM_Watchdog_RestoreProperties=function(t){r.Exec("CIM_Watchdog","RestoreProperties",{},t)};r.CIM_Watchdog_RequestStateChange=function(u,v,t){r.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.CIM_WiFiPort_SetPowerState=function(u,v,t){r.Exec("CIM_WiFiPort","SetPowerState",{PowerState:u,Time:v},t)};r.CIM_WiFiPort_Reset=function(t){r.Exec("CIM_WiFiPort","Reset",{},t)};r.CIM_WiFiPort_EnableDevice=function(u,t){r.Exec("CIM_WiFiPort","EnableDevice",{Enabled:u},t)};r.CIM_WiFiPort_OnlineDevice=function(u,t){r.Exec("CIM_WiFiPort","OnlineDevice",{Online:u},t)};r.CIM_WiFiPort_QuiesceDevice=function(u,t){r.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:u},t)};r.CIM_WiFiPort_SaveProperties=function(t){r.Exec("CIM_WiFiPort","SaveProperties",{},t)};r.CIM_WiFiPort_RestoreProperties=function(t){r.Exec("CIM_WiFiPort","RestoreProperties",{},t)};r.CIM_WiFiPort_RequestStateChange=function(u,v,t){r.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_HostBasedSetupService_Setup=function(x,y,w,u,z,v,t){r.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:x,NetworkAdminPassword:y,McNonce:w,Certificate:u,SigningAlgorithm:z,DigitalSignature:v},t)};r.IPS_HostBasedSetupService_AddNextCertInChain=function(w,u,v,t){r.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:w,IsLeafCertificate:u,IsRootCertificate:v},t)};r.IPS_HostBasedSetupService_AdminSetup=function(w,x,v,y,u,t){r.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:w,NetworkAdminPassword:x,McNonce:v,SigningAlgorithm:y,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(v,w,u,t){r.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:v,SigningAlgorithm:w,DigitalSignature:u},t)};r.IPS_HostBasedSetupService_DisableClientControlMode=function(t,u){r.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:t},u)};r.IPS_KVMRedirectionSettingData_TerminateSession=function(t){r.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},t)};r.IPS_OptInService_StartOptIn=function(t){r.Exec("IPS_OptInService","StartOptIn",{},t)};r.IPS_OptInService_CancelOptIn=function(t){r.Exec("IPS_OptInService","CancelOptIn",{},t)};r.IPS_OptInService_SendOptInCode=function(u,t){r.Exec("IPS_OptInService","SendOptInCode",{OptInCode:u},t)};r.IPS_OptInService_StartService=function(t){r.Exec("IPS_OptInService","StartService",{},t)};r.IPS_OptInService_StopService=function(t){r.Exec("IPS_OptInService","StopService",{},t)};r.IPS_OptInService_RequestStateChange=function(u,v,t){r.Exec("IPS_OptInService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_RequestStateChange=function(u,v,t){r.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.IPS_ProvisioningRecordLog_ClearLog=function(t,u){r.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:t},u)};r.IPS_SecIOService_RequestStateChange=function(u,v,t){r.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:u,TimeoutPeriod:v},t)};r.AmtStatusToStr=function(t){if(r.AmtStatusCodes[t]){return r.AmtStatusCodes[t]}else{return"UNKNOWN_ERROR"}};r.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};r.GetMessageLog=function(t,u){r.AMT_MessageLog_PositionToFirstRecord(j,[t,u,[]])};function j(v,t,u,w,x){if(w!=200||u.Body.ReturnValue!="0"){x[0](r,null,x[2]);return}r.AMT_MessageLog_GetRecords(u.Body.IterationIdentifier,390,k,x)}function k(D,A,C,E,G){if(E!=200||C.Body.ReturnValue!="0"){G[0](r,null,G[2]);return}var y,z,I,v,u=G[2],F=new Date(),H,B=C.Body.RecordArray;if(typeof B==="string"){C.Body.RecordArray=[C.Body.RecordArray]}for(y in B){v=null;try{v=window.atob(B[y])}catch(w){}if(v!=null){H=ReadIntX(v,0);if((H>0)&&(H<4294967295)){I={DeviceAddress:v.charCodeAt(4),EventSensorType:v.charCodeAt(5),EventType:v.charCodeAt(6),EventOffset:v.charCodeAt(7),EventSourceType:v.charCodeAt(8),EventSeverity:v.charCodeAt(9),SensorNumber:v.charCodeAt(10),Entity:v.charCodeAt(11),EntityInstance:v.charCodeAt(12),EventData:[],Time:new Date((H+(F.getTimezoneOffset()*60))*1000)};for(z=13;z<21;z++){I.EventData.push(v.charCodeAt(z))}I.EntityStr=n[I.Entity];I.Desc=h(I.EventSensorType,I.EventOffset,I.EventData,I.Entity);if(!I.EntityStr){I.EntityStr="Unknown"}u.push(I)}}}if(C.Body.NoMoreRecords!=true){r.AMT_MessageLog_GetRecords(C.Body.IterationIdentifier,390,k,[G[0],u,G[2]])}else{G[0](r,u,G[2])}}var e="Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split("|");var o="Unspecified.|No system memory is physically installed in the system.|No usable system memory, all installed memory has experienced an unrecoverable failure.|Unrecoverable hard-disk/ATAPI/IDE device failure.|Unrecoverable system-board failure.|Unrecoverable diskette subsystem failure.|Unrecoverable hard-disk controller failure.|Unrecoverable PS/2 or USB keyboard failure.|Removable boot media not found.|Unrecoverable video controller failure.|No video device detected.|Firmware (BIOS) ROM corruption detected.|CPU voltage mismatch (processors that share same supply have mismatched voltage requirements)|CPU speed matching failure".split("|");var p="Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split("|");var n="Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split("|");r.RealmNames="||Redirection|PT Administration|Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split("|");r.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};function h(w,v,u,t){if(w==15){if(u[0]==235){return"Invalid Data"}if(v==0){return o[u[1]]}return p[u[1]]}if(w==18&&u[0]==170){return"Agent watchdog "+char2hex(u[4])+char2hex(u[3])+char2hex(u[2])+char2hex(u[1])+"-"+char2hex(u[6])+char2hex(u[5])+"-... changed to "+r.WatchdogCurrentStates[u[7]]}if(w==6){return"Authentication failed "+(u[1]+(u[2]<<8))+" times. The system may be under attack."}if(w==30){return"No bootable media"}if(w==32){return"Operating system lockup or power interrupt"}if(w==35){return"System boot failure"}if(w==37){return"System firmware started (at least one CPU is properly executing)."}return"Unknown Sensor Type #"+w}return r}var md5_k=[];for(var i=0;i<64;){md5_k[i]=0|(Math.abs(Math.sin(++i))*4294967296)}function hex_md5(o){var f,g,k,n,q=[],p=unescape(encodeURI(o)),e=p.length,l=[f=1732584193,g=-271733879,~f,~g],m=0;for(;m<=e;){q[m>>2]|=(p.charCodeAt(m)||128)<<8*(m++%4)}q[o=(e+8>>6)*16+14]=e*8;m=0;for(;m<o;m+=16){e=l;n=0;for(;n<64;){e=[k=e[3],((f=e[1]|0)+((k=((e[0]+[f&(g=e[2])|~f&k,k&f|~k&g,f^g^k,g^(f|~k)][e=n>>4])+(md5_k[n]+(q[[n,5*n+1,3*n+5,7*n][e]%16+m]|0))))<<(e=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*e+n++%4])|k>>>32-e)),f,g]}for(n=4;n;){l[--n]=l[n]+e[n]}}o="";for(;n<32;){o+=((l[n>>3]>>((1^n++&7)*4))&15).toString(16)}return o}function rstr_md5(a){return hex2rstr(hex_md5(a))}function execArgumentsToXml(c){if(c===undefined||c===null){return null}var d="";for(var b in c){var a=c[b];if(!a){continue}if(a.__parameterType==="reference"){d+=referenceToXml(b,a)}else{d+=instanceToXml(b,a)}}return d}function instanceToXml(d,c){if(c===undefined||c===null){return null}var b=!!c.__namespace;var h=b?"<q:":"<";var a=b?"</q:":"</";var e=b?(' xmlns:q="'+c.__namespace+'"'):"";var g="<r:"+d+e+">";for(var f in c){if(!c.hasOwnProperty(f)||f.indexOf("__")===0){continue}if(typeof c[f]==="function"||Array.isArray(c[f])){continue}if(typeof c[f]==="object"){console.error("only convert one level down...")}else{g+=h+f+">"+c[f].toString()+a+f+">"}}g+="</r:"+d+">";return g}function referenceToXml(b,a){if(a===undefined||a===null){return null}var c="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+a.__resourceUri+"</w:ResourceURI><w:SelectorSet>";for(var d in a){if(!a.hasOwnProperty(d)||d.indexOf("__")===0){continue}if(typeof a[d]==="function"||typeof a[d]==="object"||Array.isArray(a[d])){continue}c+='<w:Selector Name="'+d+'">'+a[d].toString()+"</w:Selector>"}c+="</w:SelectorSet></a:ReferenceParameters></r:"+b+">";return c}function GetSidString(c){var b="S-"+c.charCodeAt(0)+"-"+c.charCodeAt(7);for(var a=2;a<(c.length/4);a++){b+="-"+ReadIntX(c,a*4)}return b}function GetSidByteArray(d){if(!d||d==null){return null}var c=d.split("-");if(c.length<4||(c[0]!="s"&&c[0]!="S")){return null}for(var a=1;a<c.length;a++){var e=parseInt(c[a]);if(e!=c[a]){return null}c[a]=e}var b=String.fromCharCode(c[1])+String.fromCharCode(c.length-3)+ShortToStr(Math.floor(c[2]/Math.pow(2,32)))+IntToStr((c[2])&65535);for(var a=3;a<c.length;a++){b+=IntToStrX(c[a])}return b}var CreateAmtRedirect=function(a){var b={};b.m=a;a.parent=b;b.State=0;b.socket=null;b.host=null;b.port=0;b.user=null;b.pass=null;b.authuri="/RedirectionService";b.tlsv1only=0;b.inDataCount=0;b.connectstate=0;b.protocol=a.protocol;b.debugmode=0;b.amtaccumulator="";b.amtsequence=1;b.amtkeepalivetimer=null;b.onStateChanged=null;b.Start=function(c,e,g,d,f){b.host=c;b.port=e;b.user=g;b.pass=d;b.connectstate=0;b.inDataCount=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+c+"&port="+e+"&tls="+f+((g=="*")?"&serverauth=1":"")+((typeof d==="undefined")?("&serverauth=1&user="+g):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed;b.xxStateChange(1)};b.xxOnSocketConnected=function(){if(b.debugmode==1){console.log("onSocketConnected")}b.xxStateChange(2);if(b.protocol==1){b.xxSend(b.RedirectStartSol)}if(b.protocol==2){b.xxSend(b.RedirectStartKvm)}if(b.protocol==3){b.xxSend(b.RedirectStartIder)}};b.xxOnMessage=function(g){if(b.debugmode==1){console.log("Recv",g.data)}b.inDataCount++;if(typeof g.data=="object"){var h=new FileReader();if(h.readAsBinaryString){h.onload=function(f){b.xxOnSocketData(f.target.result)};h.readAsBinaryString(new Blob([g.data]))}else{if(h.readAsArrayBuffer){h.onloadend=function(f){b.xxOnSocketData(f.target.result)};h.readAsArrayBuffer(g.data)}else{var c="";var d=new Uint8Array(g.data);var k=d.byteLength;for(var j=0;j<k;j++){c+=String.fromCharCode(d[j])}b.xxOnSocketData(c)}}}else{b.xxOnSocketData(g.data)}};b.xxOnSocketData=function(o){if(!o||b.connectstate==-1){return}if(typeof o==="object"){var g="";var j=new Uint8Array(o);var t=j.byteLength;for(var s=0;s<t;s++){g+=String.fromCharCode(j[s])}o=g}else{if(typeof o!=="string"){return}}if((b.protocol==2||b.protocol==3)&&b.connectstate==1){return b.m.ProcessData(o)}b.amtaccumulator+=o;while(b.amtaccumulator.length>=1){var k=0;switch(b.amtaccumulator.charCodeAt(0)){case 17:if(b.amtaccumulator.length<4){return}var G=b.amtaccumulator.charCodeAt(1);switch(G){case 0:if(b.amtaccumulator.length<13){return}var x=b.amtaccumulator.charCodeAt(12);if(b.amtaccumulator.length<13+x){return}b.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));k=(13+x);break;default:b.Stop(1);break}break;case 20:if(b.amtaccumulator.length<9){return}var e=ReadIntX(b.amtaccumulator,5);if(b.amtaccumulator.length<9+e){return}var F=b.amtaccumulator.charCodeAt(1);var f=b.amtaccumulator.charCodeAt(4);var c=[];for(s=0;s<e;s++){c.push(b.amtaccumulator.charCodeAt(9+s))}var d=b.amtaccumulator.substring(9,9+e);k=9+e;if(f==0){if(c.indexOf(4)>=0){b.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(b.user.length+b.authuri.length+8)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0,0))}else{if(c.indexOf(3)>=0){b.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(b.user.length+b.authuri.length+7)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0))}else{if(c.indexOf(1)>=0){b.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(b.user.length+b.pass.length+2)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(b.pass.length)+b.pass)}else{b.Stop(2)}}}}else{if((f==3||f==4)&&F==1){var n=0;var B=d.charCodeAt(n);var A=d.substring(n+1,n+1+B);n+=(B+1);var w=d.charCodeAt(n);var v=d.substring(n+1,n+1+w);n+=(w+1);var z=0;var y=null;var l=b.xxRandomNonce(32);var E="00000002";var q="";if(f==4){z=d.charCodeAt(n);y=d.substring(n+1,n+1+z);n+=(z+1);q=E+":"+l+":"+y+":"}var p=hex_md5(hex_md5(b.user+":"+A+":"+b.pass)+":"+v+":"+q+hex_md5("POST:"+b.authuri));var H=b.user.length+A.length+v.length+b.authuri.length+l.length+E.length+p.length+7;if(f==4){H+=(y.length+1)}var h=String.fromCharCode(19,0,0,0,f)+IntToStrX(H)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(A.length)+A+String.fromCharCode(v.length)+v+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(l.length)+l+String.fromCharCode(E.length)+E+String.fromCharCode(p.length)+p;if(f==4){h+=(String.fromCharCode(y.length)+y)}b.xxSend(h)}else{if(F==0){if(b.protocol==1){var u=10000;var J=100;var I=0;var D=10000;var C=100;var r=0;b.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(u)+ShortToStrX(J)+ShortToStrX(I)+ShortToStrX(D)+ShortToStrX(C)+ShortToStrX(r)+IntToStrX(0))}if(b.protocol==2){b.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0))}if(b.protocol==3){b.connectstate=1;b.xxStateChange(3)}}else{b.Stop(3)}}}break;case 33:if(b.amtaccumulator.length<23){break}k=23;b.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(b.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));if(b.protocol==1){b.amtkeepalivetimer=setInterval(b.xxSendAmtKeepAlive,2000)}b.connectstate=1;b.xxStateChange(3);break;case 41:if(b.amtaccumulator.length<10){break}k=10;break;case 42:if(b.amtaccumulator.length<10){break}var m=(10+((b.amtaccumulator.charCodeAt(9)&255)<<8)+(b.amtaccumulator.charCodeAt(8)&255));if(b.amtaccumulator.length<m){break}b.m.ProcessData(b.amtaccumulator.substring(10,m));k=m;break;case 43:if(b.amtaccumulator.length<8){break}k=8;break;case 65:if(b.amtaccumulator.length<8){break}b.connectstate=1;b.m.Start();if(b.amtaccumulator.length>8){b.m.ProcessData(b.amtaccumulator.substring(8))}k=b.amtaccumulator.length;break;default:console.log("Unknown Intel AMT command: "+b.amtaccumulator.charCodeAt(0)+" acclen="+b.amtaccumulator.length);b.Stop(4);return}if(k==0){return}b.amtaccumulator=b.amtaccumulator.substring(k)}};b.xxSend=function(e){if(b.socket!=null&&b.socket.readyState==WebSocket.OPEN){if(b.debugmode==1){console.log("Send",e)}var c=new Uint8Array(e.length);for(var d=0;d<e.length;++d){c[d]=e.charCodeAt(d)}b.socket.send(c.buffer)}};b.send=function(c){if(b.socket==null||b.connectstate!=1){return}if(b.protocol==1){b.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(c.length)+c)}else{b.xxSend(c)}};b.xxSendAmtKeepAlive=function(){if(b.socket==null){return}b.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(b.amtsequence++))};b.xxRandomNonceX="abcdef0123456789";b.xxRandomNonce=function(d){var e="";for(var c=0;c<d;c++){e+=b.xxRandomNonceX.charAt(Math.floor(Math.random()*b.xxRandomNonceX.length))}return e};b.xxOnSocketClosed=function(){if(b.debugmode==1){console.log("onSocketClosed")}if((b.inDataCount==0)&&(b.tlsv1only==0)){b.tlsv1only=1;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+b.host+"&port="+b.port+"&tls="+b.tls+"&tls1only=1"+((b.user=="*")?"&serverauth=1":"")+((typeof pass==="undefined")?("&serverauth=1&user="+b.user):""));b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed}else{b.Stop(5)}};b.xxStateChange=function(c){if(b.State==c){return}b.State=c;b.m.xxStateChange(b.State);if(b.onStateChanged!=null){b.onStateChanged(b,b.State)}};b.Stop=function(c){if(b.debugmode==1){console.log("onSocketStop",c)}b.xxStateChange(0);b.connectstate=-1;b.amtaccumulator="";if(b.socket!=null){b.socket.close();b.socket=null}if(b.amtkeepalivetimer!=null){clearInterval(b.amtkeepalivetimer);b.amtkeepalivetimer=null}};b.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);b.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);b.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return b};var CreateAmtRemoteDesktop=function(l,o){var n={};n.canvasid=l;n.CanvasId=Q(l);n.scrolldiv=o;n.canvas=Q(l).getContext("2d");n.protocol=2;n.state=0;n.acc="";n.ScreenWidth=960;n.ScreenHeight=700;n.width=0;n.height=0;n.rwidth=0;n.rheight=0;n.bpp=2;n.useZRLE=true;n.showmouse=true;n.buttonmask=0;n.spare=null;n.sparew=0;n.spareh=0;n.sparew2=0;n.spareh2=0;n.sparecache={};n.ZRLEfirst=1;n.onScreenSizeChange=null;n.frameRateDelay=0;n.kvmDataSupported=false;n.onKvmData=null;n.onKvmDataPending=[];n.onKvmDataAck=-1;n.holding=false;n.lastKeepAlive=Date.now();n.Debug=function(p){console.log(p)};n.xxStateChange=function(p){if(p==0){n.canvas.fillStyle="#000000";n.canvas.fillRect(0,0,n.width,n.height);n.canvas.canvas.width=n.rwidth=n.width=640;n.canvas.canvas.height=n.rheight=n.height=400;QS(n.canvasid).cursor="auto"}else{if(!n.showmouse){QS(n.canvasid).cursor="none"}}};n.ProcessData=function(r){if(!r){return}n.acc+=r;while(n.acc.length>0){var p=0;if(n.state==0&&n.acc.length>=12){p=12;n.state=1;n.send("RFB 003.008\n")}else{if(n.state==1&&n.acc.length>=1){p=n.acc.charCodeAt(0)+1;n.send(String.fromCharCode(1));n.state=2}else{if(n.state==2&&n.acc.length>=4){p=4;if(ReadInt(n.acc,0)!=0){return n.Stop()}n.send(String.fromCharCode(1));n.state=3}else{if(n.state==3&&n.acc.length>=24){var C=ReadInt(n.acc,20);if(n.acc.length<24+C){return}p=24+C;n.canvas.canvas.width=n.rwidth=n.width=n.ScreenWidth=ReadShort(n.acc,0);n.canvas.canvas.height=n.rheight=n.height=n.ScreenHeight=ReadShort(n.acc,2);var F="";if(n.useZRLE){F+=IntToStr(16)}F+=IntToStr(0);F+=IntToStr(1092);n.send(String.fromCharCode(2,0)+ShortToStr((F.length/4)+1)+F+IntToStr(-223));if(n.bpp==1){n.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0))}n.state=4;n.parent.xxStateChange(3);g();if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}else{if(n.state==4){switch(n.acc.charCodeAt(0)){case 0:if(n.acc.length<4){return}n.state=100+ReadShort(n.acc,2);p=4;break;case 2:p=1;break;case 3:if(n.acc.length<8){return}var B=ReadInt(n.acc,4)+8;if(n.acc.length<B){return}p=m(n.acc);break}}else{if(n.state>100&&n.acc.length>=12){var H=ReadShort(n.acc,0),J=ReadShort(n.acc,2),G=ReadShort(n.acc,4),z=ReadShort(n.acc,6),E=G*z,w=ReadInt(n.acc,8);if(w<17){if(G<1||G>64||z<1||z>64){console.log("Invalid tile size ("+G+","+z+"), disconnecting.");return n.Stop()}if(n.sparew!=G||n.spareh!=z){n.sparew=n.sparew2=G;n.spareh=n.spareh2=z;var I=n.sparew2+"x"+n.spareh2;n.spare=n.sparecache[I];if(!n.spare){n.sparecache[I]=n.spare=n.canvas.createImageData(n.sparew2,n.spareh2)}}}if(w==4294967073){n.canvas.canvas.width=n.rwidth=n.width=G;n.canvas.canvas.height=n.rheight=n.height=z;n.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(n.width)+ShortToStr(n.height));p=12;if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}else{if(w==0){var D=12,q=12+(E*n.bpp);if(n.acc.length<q){return}p=q;for(var A=0;A<E;A++){h(n.acc.charCodeAt(D++)+((n.bpp==2)?(n.acc.charCodeAt(D++)<<8):0),A)}f(n.spare,H,J)}else{if(w==16){if(n.acc.length<16){return}var t=ReadInt(n.acc,12);if(n.acc.length<(16+t)){return}var D=16,u=5,v=0;if(t>5&&n.acc.charCodeAt(D)==0&&ReadShortX(n.acc,D+1)==(t-u)){a(n.acc,D+5,H,J,G,z,E,t)}p=16+t}else{n.Debug("Unknown Encoding: "+w);return n.Stop()}}}if(--n.state==100){n.state=4;if(n.frameRateDelay==0){g()}else{setTimeout(g,n.frameRateDelay)}}}}}}}}if(p==0){return}n.acc=n.acc.substring(p)}};function a(r,B,J,K,I,u,F,t){var G=r.charCodeAt(B++),z,H,E,A={},C=0,D=0,w;if(G==0){for(w=0;w<F;w++){h(r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0),w)}f(n.spare,J,K)}else{if(G==1){H=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0);n.canvas.fillStyle="rgb("+((n.bpp==1)?((H&224)+","+((H&28)<<3)+","+b((H&3)<<6)):(((H>>8)&248)+","+((H>>3)&252)+","+((H&31)<<3)))+")";n.canvas.fillRect(J,K,I,u)}else{if(G>1&&G<17){var q=4,p=15;for(w=0;w<G;w++){A[w]=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0)}if(G==2){q=1;p=1}else{if(G<=4){q=2;p=3}}while(C<F&&B<r.length){H=r.charCodeAt(B++);for(w=(8-q);w>=0;w-=q){h(A[(H>>w)&p],C++)}}f(n.spare,J,K)}else{if(G==128){while(C<F&&B<r.length){H=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0);D=1;do{D+=(E=r.charCodeAt(B++))}while(E==255);while(--D>=0){h(H,C++)}}f(n.spare,J,K)}else{if(G>129){for(w=0;w<(G-128);w++){A[w]=r.charCodeAt(B++)+((n.bpp==2)?(r.charCodeAt(B++)<<8):0)}while(C<F&&B<r.length){D=1;z=r.charCodeAt(B++);H=A[z%128];if(z>127){do{D+=(E=r.charCodeAt(B++))}while(E==255)}while(--D>=0){h(H,C++)}}f(n.spare,J,K)}}}}}}n.hold=function(p){if(n.holding==p){return}n.holding=p;n.canvas.fillStyle="#000000";n.canvas.fillRect(0,0,n.width,n.height);if(n.holding==false){if((n.canvas.canvas.width!=n.width)||(n.canvas.canvas.height!=n.height)){n.canvas.canvas.width=n.width;n.canvas.canvas.height=n.height;if(n.onScreenSizeChange!=null){n.onScreenSizeChange(n,n.ScreenWidth,n.ScreenHeight)}}n.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(n.width)+ShortToStr(n.height))}else{n.UnGrabMouseInput();n.UnGrabKeyInput()}};function f(p,q,r){if(n.holding==true){return}n.canvas.putImageData(p,q,r)}function h(s,q){var r=q*4;if(n.bpp==1){n.spare.data[r++]=s&224;n.spare.data[r++]=(s&28)<<3;n.spare.data[r++]=b((s&3)<<6)}else{n.spare.data[r++]=(s>>8)&248;n.spare.data[r++]=(s>>3)&252;n.spare.data[r++]=(s&31)<<3}n.spare.data[r]=255}function b(p){return(p>127)?(p+32):p}function g(){if(n.holding==true){return}n.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(n.rwidth)+ShortToStr(n.rheight))}n.Start=function(){n.state=0;n.acc="";n.ZRLEfirst=1;n.onKvmDataPending=[];n.onKvmDataAck=-1;n.kvmDataSupported=false;for(var p in n.sparecache){delete n.sparecache[p]}};n.Stop=function(){n.UnGrabMouseInput();n.UnGrabKeyInput();n.parent.Stop()};n.send=function(p){n.parent.send(p)};var k={Pause:19,CapsLock:20,Space:32,Quote:39,Minus:45,NumpadMultiply:42,NumpadAdd:43,PrintScreen:44,Comma:44,NumpadSubtract:45,NumpadDecimal:46,Period:46,Slash:47,NumpadDivide:47,Semicolon:59,Equal:61,OSLeft:91,BracketLeft:91,OSRight:91,Backslash:92,BracketRight:93,ContextMenu:93,Backquote:96,NumLock:144,ScrollLock:145,Backspace:65288,Tab:65289,Enter:65293,NumpadEnter:65293,Escape:65307,Delete:65535,Home:65360,PageUp:65365,PageDown:65366,ArrowLeft:65361,ArrowUp:65362,ArrowRight:65363,ArrowDown:65364,End:65367,Insert:65379,F1:65470,F2:65471,F3:65472,F4:65473,F5:65474,F6:65475,F7:65476,F8:65477,F9:65478,F10:65479,F11:65480,F12:65481,ShiftLeft:65505,ShiftRight:65506,ControlLeft:65507,ControlRight:65508,AltLeft:65513,AltRight:65514,MetaLeft:65511,MetaRight:65512};function j(p){if(p.code.startsWith("Key")&&p.code.length==4){return p.code.charCodeAt(3)+((p.shiftKey==false)?32:0)}if(p.code.startsWith("Digit")&&p.code.length==6){return p.code.charCodeAt(5)}if(p.code.startsWith("Numpad")&&p.code.length==7){return p.code.charCodeAt(6)}return k[p.code]}function c(p,q){if(!q){q=window.event}if(q.code){var r=j(q);if(r!=null){n.sendkey(r,p)}}else{var r=q.keyCode,s=r;if(q.shiftKey==false&&r>=65&&r<=90){s=r+32}if(r>=112&&r<=124){s=r+65358}if(r==8){s=65288}if(r==9){s=65289}if(r==13){s=65293}if(r==16){s=65505}if(r==17){s=65507}if(r==18){s=65513}if(r==27){s=65307}if(r==33){s=65365}if(r==34){s=65366}if(r==35){s=65367}if(r==36){s=65360}if(r==37){s=65361}if(r==38){s=65362}if(r==39){s=65363}if(r==40){s=65364}if(r==45){s=65379}if(r==46){s=65535}if(r>=96&&r<=105){s=r-48}if(r==106){s=42}if(r==107){s=43}if(r==109){s=45}if(r==110){s=46}if(r==111){s=47}if(r==186){s=59}if(r==187){s=61}if(r==188){s=44}if(r==189){s=45}if(r==190){s=46}if(r==191){s=47}if(r==192){s=96}if(r==219){s=91}if(r==220){s=92}if(r==221){s=93}if(r==222){s=39}n.sendkey(s,p)}return n.haltEvent(q)}n.sendkey=function(r,p){if(typeof r=="object"){for(var q in r){n.sendkey(r[q][0],r[q][1])}}else{n.send(String.fromCharCode(4,p,0,0)+IntToStr(r))}};function m(p){if(p.length<8){return 0}var r=ReadInt(n.acc,4)+8;if(p.length<r){return 0}if(n.onKvmData!=null){var q=p.substring(8,r);if((q.length>=16)&&(q.substring(0,15)=="\0KvmDataChannel")){if(n.kvmDataSupported==false){n.kvmDataSupported=true;console.log("KVM Data Channel Supported.")}if(((n.onKvmDataAck==-1)&&(q.length==16))||(q.charCodeAt(15)!=0)){n.onKvmDataAck=true}if(q.length>=16){n.onKvmData(q.substring(16))}if((n.onKvmDataAck==true)&&(n.onKvmDataPending.length>0)){n.sendKvmData(n.onKvmDataPending.shift())}}}return r}n.sendKvmData=function(p){if(n.onKvmDataAck!==true){n.onKvmDataPending.push(p)}else{p="\0KvmDataChannel\0"+p;n.send(String.fromCharCode(6,0,0,0)+IntToStr(p.length)+p);n.onKvmDataAck=false}};n.sendKeepAlive=function(){if(n.lastKeepAlive<Date.now()-5000){n.lastKeepAlive=Date.now();n.send(String.fromCharCode(6,0,0,0)+IntToStr(16)+"\0KvmDataChannel\0")}};n.SendCtrlAltDelMsg=function(){n.sendcad()};n.sendcad=function(){n.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var e=false;var d=false;n.GrabMouseInput=function(){if(e==true){return}var p=n.canvas.canvas;p.onmouseup=n.mouseup;p.onmousedown=n.mousedown;p.onmousemove=n.mousemove;e=true};n.UnGrabMouseInput=function(){if(e==false){return}var p=n.canvas.canvas;p.onmousemove=null;p.onmouseup=null;p.onmousedown=null;e=false};n.GrabKeyInput=function(){if(d==true){return}document.onkeyup=n.handleKeyUp;document.onkeydown=n.handleKeyDown;document.onkeypress=n.handleKeys;d=true};n.UnGrabKeyInput=function(){if(d==false){return}document.onkeyup=null;document.onkeydown=null;document.onkeypress=null;d=false};n.handleKeys=function(p){return n.haltEvent(p)};n.handleKeyUp=function(p){return c(0,p)};n.handleKeyDown=function(p){return c(1,p)};n.haltEvent=function(p){if(p.preventDefault){p.preventDefault()}if(p.stopPropagation){p.stopPropagation()}return false};n.mousedblclick=function(p){};n.mousedown=function(p){n.buttonmask|=(1<<p.button);return n.mousemove(p)};n.mouseup=function(p){n.buttonmask&=(65535-(1<<p.button));return n.mousemove(p)};n.mousemove=function(p){if(n.state!=4){return true}var q=n.getPositionOfControl(Q(n.canvasid));n.mx=(p.pageX-q[0])*(n.canvas.canvas.height/Q(n.canvasid).offsetHeight);n.my=((p.pageY-q[1]+(o?o.scrollTop:0))*(n.canvas.canvas.width/Q(n.canvasid).offsetWidth));n.send(String.fromCharCode(5,n.buttonmask)+ShortToStr(n.mx)+ShortToStr(n.my));return n.haltEvent(p)};n.getPositionOfControl=function(p){var q=Array(2);q[0]=q[1]=0;while(p){q[0]+=p.offsetLeft;q[1]+=p.offsetTop;p=p.offsetParent}return q};return n};var ZLIB=(ZLIB||{});if(typeof ZLIB.common_initialized==="undefined"){ZLIB.Z_NO_FLUSH=0;ZLIB.Z_PARTIAL_FLUSH=1;ZLIB.Z_SYNC_FLUSH=2;ZLIB.Z_FULL_FLUSH=3;ZLIB.Z_FINISH=4;ZLIB.Z_BLOCK=5;ZLIB.Z_TREES=6;ZLIB.Z_OK=0;ZLIB.Z_STREAM_END=1;ZLIB.Z_NEED_DICT=2;ZLIB.Z_ERRNO=(-1);ZLIB.Z_STREAM_ERROR=(-2);ZLIB.Z_DATA_ERROR=(-3);ZLIB.Z_MEM_ERROR=(-4);ZLIB.Z_BUF_ERROR=(-5);ZLIB.Z_VERSION_ERROR=(-6);ZLIB.Z_DEFLATED=8;ZLIB.z_stream=function(){this.next_in=0;this.avail_in=0;this.total_in=0;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg=null;this.state=null;this.data_type=0;this.adler=0;this.input_data="";this.output_data="";this.error=0;this.checksum_function=null};ZLIB.gz_header=function(){this.text=0;this.time=0;this.xflags=0;this.os=255;this.extra=null;this.extra_len=0;this.extra_max=0;this.name=null;this.name_max=0;this.comment=null;this.comm_max=0;this.hcrc=0;this.done=0};ZLIB.common_initialized=true}if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js")}(function(){var n=15;var F=0;var C=1;var al=2;var ae=3;var z=4;var A=5;var ab=6;var h=7;var E=8;var p=9;var o=10;var am=11;var an=12;var ai=13;var k=14;var j=15;var ak=16;var V=17;var f=18;var R=19;var P=20;var S=21;var q=22;var r=23;var Z=24;var X=25;var d=26;var U=27;var u=28;var a=29;var aa=30;var aj=31;var y=852;var x=592;var w=(y+x);var g=0;var W=1;var t=2;var M=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var N=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69];var K=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var L=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ZLIB.inflate_copyright=" inflate 1.2.6 Copyright 1995-2012 Mark Adler ";function J(aQ,aU){var aL=15;var aT=aQ.next;var ar=(aU==t?aQ.distbits:aQ.lenbits);var aW=aQ.work;var aG=aQ.lens;var aH=(aU==t?aQ.nlen:0);var aR=aQ.codes;var at;if(aU==W){at=aQ.nlen}else{if(aU==t){at=aQ.ndist}else{at=19}}var aF;var aS;var aM,aK;var aP;var av;var aw;var aE;var aV;var aC;var aD;var aA;var aI;var aJ;var aB;var aN;var ap;var aq;var ay;var az;var ax;var au=new Array(aL+1);var aO=new Array(aL+1);for(aF=0;aF<=aL;aF++){au[aF]=0}for(aS=0;aS<at;aS++){au[aG[aH+aS]]++}aP=ar;for(aK=aL;aK>=1;aK--){if(au[aK]!=0){break}}if(aP>aK){aP=aK}if(aK==0){aB={op:64,bits:1,val:0};aR[aT++]=aB;aR[aT++]=aB;if(aU==t){aQ.distbits=1}else{aQ.lenbits=1}aQ.next=aT;return 0}for(aM=1;aM<aK;aM++){if(au[aM]!=0){break}}if(aP<aM){aP=aM}aE=1;for(aF=1;aF<=aL;aF++){aE<<=1;aE-=au[aF];if(aE<0){return -1}}if(aE>0&&(aU==g||aK!=1)){aQ.next=aT;return -1}aO[1]=0;for(aF=1;aF<aL;aF++){aO[aF+1]=aO[aF]+au[aF]}for(aS=0;aS<at;aS++){if(aG[aH+aS]!=0){aW[aO[aG[aH+aS]]++]=aS}}switch(aU){case g:ap=ay=aW;aq=0;az=0;ax=19;break;case W:ap=M;aq=-257;ay=N;az=-257;ax=256;break;default:ap=K;ay=L;aq=0;az=0;ax=-1}aC=0;aS=0;aF=aM;aN=aT;av=aP;aw=0;aI=-1;aV=1<<aP;aJ=aV-1;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}for(;;){aB={op:0,bits:aF-aw,val:0};if(aW[aS]<ax){aB.val=aW[aS]}else{if(aW[aS]>ax){aB.op=ay[az+aW[aS]];aB.val=ap[aq+aW[aS]]}else{aB.op=32+64}}aD=1<<(aF-aw);aA=1<<av;aM=aA;do{aA-=aD;aR[aN+(aC>>>aw)+aA]=aB}while(aA!=0);aD=1<<(aF-1);while(aC&aD){aD>>>=1}if(aD!=0){aC&=aD-1;aC+=aD}else{aC=0}aS++;if(--(au[aF])==0){if(aF==aK){break}aF=aG[aH+aW[aS]]}if(aF>aP&&(aC&aJ)!=aI){if(aw==0){aw=aP}aN+=aM;av=aF-aw;aE=(1<<av);while(av+aw<aK){aE-=au[av+aw];if(aE<=0){break}av++;aE<<=1}aV+=1<<av;if((aU==W&&aV>=y)||(aU==t&&aV>=x)){aQ.next=aT;return 1}aI=aC&aJ;aR[aT+aI]={op:av,bits:aP,val:aN-aT}}}if(aC!=0){aR[aN+aC]={op:64,bits:aF-aw,val:0}}aQ.next=aT+aV;if(aU==t){aQ.distbits=aP}else{aQ.lenbits=aP}return 0}function G(aM,aK){var aL;var aB;var aH;var aC;var aJ;var ap;var aw;var aQ;var aN;var aP;var aO;var aA;var aq;var ar;var aD;var at;var aG;var av;var az;var aI;var aE;var au;var ay=-1;var ax=-1;aL=aM.state;aB=aM.input_data;aH=aM.next_in;aC=aH+aM.avail_in-5;aJ=aM.next_out;ap=aJ-(aK-aM.avail_out);aw=aJ+(aM.avail_out-257);aQ=aL.wsize;aN=aL.whave;aP=aL.wnext;aO=aL.window;aA=aL.hold;aq=aL.bits;ar=aL.codes;aD=aL.lencode;at=aL.distcode;aG=(1<<aL.lenbits)-1;av=(1<<aL.distbits)-1;loop:do{if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[aD+(aA&aG)];dolen:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI==0){aM.output_data+=String.fromCharCode(az.val);aJ++}else{if(aI&16){aE=az.val;aI&=15;if(aI){if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}aE+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI}if(aq<15){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}az=ar[at+(aA&av)];dodist:while(true){aI=az.bits;aA>>>=aI;aq-=aI;aI=az.op;if(aI&16){au=az.val;aI&=15;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8;if(aq<aI){aA+=(aB.charCodeAt(aH++)&255)<<aq;aq+=8}}au+=aA&((1<<aI)-1);aA>>>=aI;aq-=aI;aI=aJ-ap;if(au>aI){aI=au-aI;if(aI>aN){if(aL.sane){aM.msg="invalid distance too far back";aL.mode=a;break loop}}ay=0;ax=-1;if(aP==0){ay+=aQ-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;aI=0;ay=-1;ax=aJ-au}}else{ay+=aP-aI;if(aI<aE){aE-=aI;aM.output_data+=aO.substring(ay,ay+aI);aJ+=aI;ay=-1;ax=aJ-au}}}else{ay=-1;ax=aJ-au}if(ay>=0){aM.output_data+=aO.substring(ay,ay+aE);aJ+=aE;ay+=aE}else{var aF=aE;if(aF>aJ-ax){aF=aJ-ax}aM.output_data+=aM.output_data.substring(ax,ax+aF);aJ+=aF;aE-=aF;ax+=aF;aJ+=aE;while(aE>2){aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aM.output_data+=aM.output_data.charAt(ax++);aE-=3}if(aE){aM.output_data+=aM.output_data.charAt(ax++);if(aE>1){aM.output_data+=aM.output_data.charAt(ax++)}}}}else{if((aI&64)==0){az=ar[at+(az.val+(aA&((1<<aI)-1)))];continue dodist}else{aM.msg="invalid distance code";aL.mode=a;break loop}}break dodist}}else{if((aI&64)==0){az=ar[aD+(az.val+(aA&((1<<aI)-1)))];continue dolen}else{if(aI&32){aL.mode=am;break loop}else{aM.msg="invalid literal/length code";aL.mode=a;break loop}}}}break dolen}}while(aH<aC&&aJ<aw);aE=aq>>>3;aH-=aE;aq-=aE<<3;aA&=(1<<aq)-1;aM.next_in=aH;aM.next_out=aJ;aM.avail_in=(aH<aC?5+(aC-aH):5-(aH-aC));aM.avail_out=(aJ<aw?257+(aw-aJ):257-(aJ-aw));aL.hold=aA;aL.bits=aq}function ad(ar){var aq;var ap=new Array(ar);for(aq=0;aq<ar;aq++){ap[aq]=0}return ap}function D(ar,aq,ap){return(ar&&(aq in ar))?ar[aq]:ap}function e(){return 0}function I(){var aq;this.mode=0;this.last=0;this.wrap=0;this.havedict=0;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=0;this.distcode=0;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=0;this.lens=ad(320);this.work=ad(288);this.codes=new Array(w);var ap={op:0,bits:0,val:0};for(aq=0;aq<w;aq++){this.codes[aq]=ap}this.sane=0;this.back=0;this.was=0}ZLIB.inflateResetKeep=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;aq.total_in=aq.total_out=ap.total=0;aq.msg=null;if(ap.wrap){aq.adler=ap.wrap&1}ap.mode=F;ap.last=0;ap.havedict=0;ap.dmax=32768;ap.head=null;ap.hold=0;ap.bits=0;ap.lencode=0;ap.distcode=0;ap.next=0;ap.sane=1;ap.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(aq,ar){var at;var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;if(typeof ar==="undefined"){ar=n}if(ar<0){at=0;ar=-ar}else{at=(ar>>>4)+1;if(ar<48){ar&=15}}if(at==1&&(typeof ZLIB.adler32==="function")){aq.checksum_function=ZLIB.adler32}else{if(at==2&&(typeof ZLIB.crc32==="function")){aq.checksum_function=ZLIB.crc32}else{aq.checksum_function=e}}if(ar&&(ar<8||ar>15)){return ZLIB.Z_STREAM_ERROR}if(ap.window&&ap.wbits!=ar){ap.window=null}ap.wrap=at;ap.wbits=ar;ap.wsize=0;ap.whave=0;ap.wnext=0;return ZLIB.inflateResetKeep(aq)};ZLIB.inflateInit=function(aq){var ap=new ZLIB.z_stream();ap.state=new I();ZLIB.inflateReset(ap,aq);return ap};ZLIB.inflatePrime=function(ar,ap,at){var aq;if(!ar||!ar.state){return ZLIB.Z_STREAM_ERROR}aq=ar.state;if(ap<0){aq.hold=0;aq.bits=0;return ZLIB.Z_OK}if(ap>16||aq.bits+ap>32){return ZLIB.Z_STREAM_ERROR}at&=(1<<ap)-1;aq.hold+=at<<aq.bits;aq.bits+=ap;return ZLIB.Z_OK};var T=null;var s=null;function B(aq){var ap;if(!T){T=[{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:192},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:160},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:224},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:144},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:208},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:176},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:240},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:200},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:168},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:232},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:152},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:216},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:184},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:248},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:196},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:164},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:228},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:148},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:212},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:180},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:244},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:204},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:172},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:236},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:156},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:220},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:188},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:252},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:194},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:162},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:226},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:146},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:210},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:178},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:242},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:202},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:170},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:234},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:154},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:218},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:186},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:250},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:198},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:166},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:230},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:150},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:214},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:182},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:246},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:206},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:174},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:238},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:158},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:222},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:190},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:254},{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:193},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:161},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,bits:9,val:225},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:145},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:209},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:177},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:241},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:201},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:169},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:233},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:153},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:217},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:185},{op:0,bits:8,val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:249},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:197},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:165},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:229},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:149},{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:213},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:181},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:245},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:205},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:173},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:237},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:157},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:221},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:189},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:253},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:195},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:163},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:227},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:147},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:211},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:243},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:203},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:171},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:235},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:155},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:219},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:187},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:251},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:199},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:167},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:231},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:151},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:215},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:183},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:247},{op:16,bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:207},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:175},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:239},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:159},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:223},{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:191},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:255}]}if(!s){s=[{op:16,bits:5,val:1},{op:23,bits:5,val:257},{op:19,bits:5,val:17},{op:27,bits:5,val:4097},{op:17,bits:5,val:5},{op:25,bits:5,val:1025},{op:21,bits:5,val:65},{op:29,bits:5,val:16385},{op:16,bits:5,val:3},{op:24,bits:5,val:513},{op:20,bits:5,val:33},{op:28,bits:5,val:8193},{op:18,bits:5,val:9},{op:26,bits:5,val:2049},{op:22,bits:5,val:129},{op:64,bits:5,val:0},{op:16,bits:5,val:2},{op:23,bits:5,val:385},{op:19,bits:5,val:25},{op:27,bits:5,val:6145},{op:17,bits:5,val:7},{op:25,bits:5,val:1537},{op:21,bits:5,val:97},{op:29,bits:5,val:24577},{op:16,bits:5,val:4},{op:24,bits:5,val:769},{op:20,bits:5,val:49},{op:28,bits:5,val:12289},{op:18,bits:5,val:13},{op:26,bits:5,val:3073},{op:22,bits:5,val:193},{op:64,bits:5,val:0}]}aq.lencode=0;aq.distcode=512;for(ap=0;ap<512;ap++){aq.codes[ap]=T[ap]}for(ap=0;ap<32;ap++){aq.codes[ap+512]=s[ap]}aq.lenbits=9;aq.distbits=5}function ao(ar){var aq=ar.state;var ap=ar.output_data.length;if(aq.window===null){aq.window=""}if(aq.wsize==0){aq.wsize=1<<aq.wbits}if(ap>=aq.wsize){aq.window=ar.output_data.substring(ap-aq.wsize)}else{if(aq.whave+ap<aq.wsize){aq.window+=ar.output_data}else{aq.window=aq.window.substring(aq.whave-(aq.wsize-ap))+ar.output_data}}aq.whave=aq.window.length;if(aq.whave<aq.wsize){aq.wnext=aq.whave}else{aq.wnext=0}return 0}function l(aq,ar){var ap=[ar&255,(ar>>>8)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,2)}function m(aq,ar){var ap=[ar&255,(ar>>>8)&255,(ar>>>16)&255,(ar>>>24)&255];aq.state.check=aq.checksum_function(aq.state.check,ap,0,4)}function Y(aq,ap){ap.strm=aq;ap.left=aq.avail_out;ap.next=aq.next_in;ap.have=aq.avail_in;ap.hold=aq.state.hold;ap.bits=aq.state.bits;return ap}function ag(ap){var aq=ap.strm;aq.next_in=ap.next;aq.avail_out=ap.left;aq.avail_in=ap.have;aq.state.hold=ap.hold;aq.state.bits=ap.bits}function O(ap){ap.hold=0;ap.bits=0}function af(ap){if(ap.have==0){return false}ap.have--;ap.hold+=(ap.strm.input_data.charCodeAt(ap.next++)&255)<<ap.bits;ap.bits+=8;return true}function ac(aq,ap){while(aq.bits<ap){if(!af(aq)){return false}}return true}function b(aq,ap){return aq.hold&((1<<ap)-1)}function v(aq,ap){aq.hold>>>=ap;aq.bits-=ap}function c(ap){ap.hold>>>=ap.bits&7;ap.bits-=ap.bits&7}function ah(ap){return((ap>>>24)&255)+((ap>>>8)&65280)+((ap&65280)<<8)+((ap&255)<<24)}var H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(aC,ar){var aB;var aA;var ap,ay;var aq;var au=-1;var at=-1;var av;var aw;var ax;var az;if(!aC||!aC.state||(!aC.input_data&&aC.avail_in!=0)){return ZLIB.Z_STREAM_ERROR}aB=aC.state;if(aB.mode==am){aB.mode=an}aA={};Y(aC,aA);ap=aA.have;ay=aA.left;az=ZLIB.Z_OK;inf_leave:for(;;){switch(aB.mode){case F:if(aB.wrap==0){aB.mode=an;break}if(!ac(aA,16)){break inf_leave}if((aB.wrap&2)&&aA.hold==35615){aB.check=aC.checksum_function(0,null,0,0);l(aC,aA.hold);O(aA);aB.mode=C;break}aB.flags=0;if(aB.head!==null){aB.head.done=-1}if(!(aB.wrap&1)||((b(aA,8)<<8)+(aA.hold>>>8))%31){aC.msg="incorrect header check";aB.mode=a;break}if(b(aA,4)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}v(aA,4);ax=b(aA,4)+8;if(aB.wbits==0){aB.wbits=ax}else{if(ax>aB.wbits){aC.msg="invalid window size";aB.mode=a;break}}aB.dmax=1<<ax;aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=aA.hold&512?p:am;O(aA);break;case C:if(!ac(aA,16)){break inf_leave}aB.flags=aA.hold;if((aB.flags&255)!=ZLIB.Z_DEFLATED){aC.msg="unknown compression method";aB.mode=a;break}if(aB.flags&57344){aC.msg="unknown header flags set";aB.mode=a;break}if(aB.head!==null){aB.head.text=(aA.hold>>>8)&1}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=al;case al:if(!ac(aA,32)){break inf_leave}if(aB.head!==null){aB.head.time=aA.hold}if(aB.flags&512){m(aC,aA.hold)}O(aA);aB.mode=ae;case ae:if(!ac(aA,16)){break inf_leave}if(aB.head!==null){aB.head.xflags=aA.hold&255;aB.head.os=aA.hold>>>8}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.mode=z;case z:if(aB.flags&1024){if(!ac(aA,16)){break inf_leave}aB.length=aA.hold;if(aB.head!==null){aB.head.extra_len=aA.hold}if(aB.flags&512){l(aC,aA.hold)}O(aA);aB.head.extra=""}else{if(aB.head!==null){aB.head.extra=null}}aB.mode=A;case A:if(aB.flags&1024){aq=aB.length;if(aq>aA.have){aq=aA.have}if(aq){if(aB.head!==null&&aB.head.extra!==null){ax=aB.head.extra_len-aB.length;aB.head.extra+=aC.input_data.substring(aA.next,aA.next+(ax+aq>aB.head.extra_max?aB.head.extra_max-ax:aq))}if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;aB.length-=aq}if(aB.length){break inf_leave}}aB.length=0;aB.mode=ab;case ab:if(aB.flags&2048){if(aA.have==0){break inf_leave}if(aB.head!==null&&aB.head.name===null){aB.head.name=""}aq=0;do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.name_max){aB.head.name+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.name=null}}aB.length=0;aB.mode=h;case h:if(aB.flags&4096){if(aA.have==0){break inf_leave}aq=0;if(aB.head!==null&&aB.head.comment===null){aB.head.comment=""}do{ax=aC.input_data.charAt(aA.next+aq);aq++;if(ax==="\0"){break}if(aB.head!==null&&aB.length<aB.head.comm_max){aB.head.comment+=ax;aB.length++}}while(aq<aA.have);if(aB.flags&512){aB.check=aC.checksum_function(aB.check,aC.input_data,aA.next,aq)}aA.have-=aq;aA.next+=aq;if(ax!=="\0"){break inf_leave}}else{if(aB.head!==null){aB.head.comment=null}}aB.mode=E;case E:if(aB.flags&512){if(!ac(aA,16)){break inf_leave}if(aA.hold!=(aB.check&65535)){aC.msg="header crc mismatch";aB.mode=a;break}O(aA)}if(aB.head!==null){aB.head.hcrc=(aB.flags>>>9)&1;aB.head.done=1}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;break;case p:if(!ac(aA,32)){break inf_leave}aC.adler=aB.check=ah(aA.hold);O(aA);aB.mode=o;case o:if(aB.havedict==0){ag(aA);return ZLIB.Z_NEED_DICT}aC.adler=aB.check=aC.checksum_function(0,null,0,0);aB.mode=am;case am:if(ar==ZLIB.Z_BLOCK||ar==ZLIB.Z_TREES){break inf_leave}case an:if(aB.last){c(aA);aB.mode=d;break}if(!ac(aA,3)){break inf_leave}aB.last=b(aA,1);v(aA,1);switch(b(aA,2)){case 0:aB.mode=ai;break;case 1:B(aB);aB.mode=R;if(ar==ZLIB.Z_TREES){v(aA,2);break inf_leave}break;case 2:aB.mode=ak;break;case 3:aC.msg="invalid block type";aB.mode=a}v(aA,2);break;case ai:c(aA);if(!ac(aA,32)){break inf_leave}if((aA.hold&65535)!=(((aA.hold>>>16)&65535)^65535)){aC.msg="invalid stored block lengths";aB.mode=a;break}aB.length=aA.hold&65535;O(aA);aB.mode=k;if(ar==ZLIB.Z_TREES){break inf_leave}case k:aB.mode=j;case j:aq=aB.length;if(aq){if(aq>aA.have){aq=aA.have}if(aq>aA.left){aq=aA.left}if(aq==0){break inf_leave}aC.output_data+=aC.input_data.substring(aA.next,aA.next+aq);aC.next_out+=aq;aA.have-=aq;aA.next+=aq;aA.left-=aq;aB.length-=aq;break}aB.mode=am;break;case ak:if(!ac(aA,14)){break inf_leave}aB.nlen=b(aA,5)+257;v(aA,5);aB.ndist=b(aA,5)+1;v(aA,5);aB.ncode=b(aA,4)+4;v(aA,4);if(aB.nlen>286||aB.ndist>30){aC.msg="too many length or distance symbols";aB.mode=a;break}aB.have=0;aB.mode=V;case V:while(aB.have<aB.ncode){if(!ac(aA,3)){break inf_leave}var aD=b(aA,3);aB.lens[H[aB.have++]]=aD;v(aA,3)}while(aB.have<19){aB.lens[H[aB.have++]]=0}aB.next=0;aB.lencode=0;aB.lenbits=7;az=J(aB,g);if(az){aC.msg="invalid code lengths set";aB.mode=a;break}aB.have=0;aB.mode=f;case f:while(aB.have<aB.nlen+aB.ndist){for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.val<16){v(aA,av.bits);aB.lens[aB.have++]=av.val}else{if(av.val==16){if(!ac(aA,av.bits+2)){break inf_leave}v(aA,av.bits);if(aB.have==0){aC.msg="invalid bit length repeat";aB.mode=a;break}ax=aB.lens[aB.have-1];aq=3+b(aA,2);v(aA,2)}else{if(av.val==17){if(!ac(aA,av.bits+3)){break inf_leave}v(aA,av.bits);ax=0;aq=3+b(aA,3);v(aA,3)}else{if(!ac(aA,av.bits+7)){break inf_leave}v(aA,av.bits);ax=0;aq=11+b(aA,7);v(aA,7)}}if(aB.have+aq>aB.nlen+aB.ndist){aC.msg="invalid bit length repeat";aB.mode=a;break}while(aq--){aB.lens[aB.have++]=ax}}}if(aB.mode==a){break}if(aB.lens[256]==0){aC.msg="invalid code -- missing end-of-block";aB.mode=a;break}aB.next=0;aB.lencode=aB.next;aB.lenbits=9;az=J(aB,W);if(az){aC.msg="invalid literal/lengths set";aB.mode=a;break}aB.distcode=aB.next;aB.distbits=6;az=J(aB,t);if(az){aC.msg="invalid distances set";aB.mode=a;break}aB.mode=R;if(ar==ZLIB.Z_TREES){break inf_leave}case R:aB.mode=P;case P:if(aA.have>=6&&aA.left>=258){ag(aA);G(aC,ay);Y(aC,aA);if(aB.mode==am){aB.back=-1}break}aB.back=0;for(;;){av=aB.codes[aB.lencode+b(aA,aB.lenbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if(av.op&&(av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.lencode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if(aw.bits+av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;aB.length=av.val;if(av.op==0){aB.mode=X;break}if(av.op&32){aB.back=-1;aB.mode=am;break}if(av.op&64){aC.msg="invalid literal/length code";aB.mode=a;break}aB.extra=av.op&15;aB.mode=S;case S:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.length+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.was=aB.length;aB.mode=q;case q:for(;;){av=aB.codes[aB.distcode+b(aA,aB.distbits)];if(av.bits<=aA.bits){break}if(!af(aA)){break inf_leave}}if((av.op&240)==0){aw=av;for(;;){av=aB.codes[aB.distcode+aw.val+(b(aA,aw.bits+aw.op)>>>aw.bits)];if((aw.bits+av.bits)<=aA.bits){break}if(!af(aA)){break inf_leave}}v(aA,aw.bits);aB.back+=aw.bits}v(aA,av.bits);aB.back+=av.bits;if(av.op&64){aC.msg="invalid distance code";aB.mode=a;break}aB.offset=av.val;aB.extra=av.op&15;aB.mode=r;case r:if(aB.extra){if(!ac(aA,aB.extra)){break inf_leave}aB.offset+=b(aA,aB.extra);v(aA,aB.extra);aB.back+=aB.extra}aB.mode=Z;case Z:if(aA.left==0){break inf_leave}aq=ay-aA.left;if(aB.offset>aq){aq=aB.offset-aq;if(aq>aB.whave){if(aB.sane){aC.msg="invalid distance too far back";aB.mode=a;break}}if(aq>aB.wnext){aq-=aB.wnext;au=aB.wsize-aq;at=-1}else{au=aB.wnext-aq;at=-1}if(aq>aB.length){aq=aB.length}}else{au=-1;at=aC.next_out-aB.offset;aq=aB.length}if(aq>aA.left){aq=aA.left}aA.left-=aq;aB.length-=aq;if(au>=0){aC.output_data+=aB.window.substring(au,au+aq);aC.next_out+=aq;aq=0}else{aC.next_out+=aq;do{aC.output_data+=aC.output_data.charAt(at++)}while(--aq)}if(aB.length==0){aB.mode=P}break;case X:if(aA.left==0){break inf_leave}aC.output_data+=String.fromCharCode(aB.length);aC.next_out++;aA.left--;aB.mode=P;break;case d:if(aB.wrap){if(!ac(aA,32)){break inf_leave}ay-=aA.left;aC.total_out+=ay;aB.total+=ay;if(ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,aC.output_data.length-ay,ay)}ay=aA.left;if((aB.flags?aA.hold:ah(aA.hold))!=aB.check){aC.msg="incorrect data check";aB.mode=a;break}O(aA)}aB.mode=U;case U:if(aB.wrap&&aB.flags){if(!ac(aA,32)){break inf_leave}if(aA.hold!=(aB.total&4294967295)){aC.msg="incorrect length check";aB.mode=a;break}O(aA)}aB.mode=u;case u:az=ZLIB.Z_STREAM_END;break inf_leave;case a:az=ZLIB.Z_DATA_ERROR;break inf_leave;case aa:return ZLIB.Z_MEM_ERROR;case aj:default:return ZLIB.Z_STREAM_ERROR}}inf_leave:ag(aA);if(aB.wsize||(ay!=aC.avail_out&&aB.mode<a&&(aB.mode<d||ar!=ZLIB.Z_FINISH))){if(ao(aC)){aB.mode=aa;return ZLIB.Z_MEM_ERROR}}ap-=aC.avail_in;ay-=aC.avail_out;aC.total_in+=ap;aC.total_out+=ay;aB.total+=ay;if(aB.wrap&&ay){aC.adler=aB.check=aC.checksum_function(aB.check,aC.output_data,0,aC.output_data.length)}aC.data_type=aB.bits+(aB.last?64:0)+(aB.mode==am?128:0)+(aB.mode==R||aB.mode==k?256:0);if(((ap==0&&ay==0)||ar==ZLIB.Z_FINISH)&&az==ZLIB.Z_OK){az=ZLIB.Z_BUF_ERROR}return az};ZLIB.inflateEnd=function(aq){var ap;if(!aq||!aq.state){return ZLIB.Z_STREAM_ERROR}ap=aq.state;ap.window=null;aq.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(at,au){var ar;var ap;var aq=16384;this.input_data=at;this.next_in=D(au,"next_in",0);this.avail_in=D(au,"avail_in",at.length-this.next_in);ar=D(au,"flush",ZLIB.Z_SYNC_FLUSH);ap=D(au,"avail_out",-1);var av="";do{this.avail_out=(ap>=0?ap:aq);this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,ar);if(ap>=0){return this.output_data}av+=this.output_data;if(this.avail_out>0){break}}while(this.error==ZLIB.Z_OK);return av};ZLIB.z_stream.prototype.inflateReset=function(ap){return ZLIB.inflateReset(this,ap)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js")}(function(){var c=65521;var d=5552;function b(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f.charCodeAt(j)&255;if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f.charCodeAt(j++)&255;k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e;e+=f.charCodeAt(j++)&255;k+=e}while(g--){e+=f.charCodeAt(j++)&255;k+=e}e%=c;k%=c}return e|(k<<16)}function a(e,f,j,g){var k;var h;k=(e>>>16)&65535;e&=65535;if(g==1){e+=f[j];if(e>=c){e-=c}k+=e;if(k>=c){k-=c}return e|(k<<16)}if(f===null){return 1}if(g<16){while(g--){e+=f[j++];k+=e}if(e>=c){e-=c}k%=c;return e|(k<<16)}while(g>=d){g-=d;h=d>>4;do{e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(--h);e%=c;k%=c}if(g){while(g>=16){g-=16;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e;e+=f[j++];k+=e}while(g--){e+=f[j++];k+=e}e%=c;k%=c}return e|(k<<16)}ZLIB.adler32=function(e,f,h,g){if(typeof f==="string"){return b(e,f,h,g)}else{return a(e,f,h,g)}};ZLIB.adler32_combine=function(e,f,g){var j;var k;var h;if(g<0){return 4294967295}g%=c;h=g;j=e&65535;k=h*j;k%=c;j+=(f&65535)+c-1;k+=((e>>16)&65535)+((f>>16)&65535)+c-h;if(j>=c){j-=c}if(j>=c){j-=c}if(k>=(c<<1)){k-=(c<<1)}if(k>=c){k-=c}return j|(k<<16)}}());if(typeof ZLIB==="undefined"){alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js")}(function(){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function c(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);h=a[(h^g.charCodeAt(k++))&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g.charCodeAt(k++))&255]^(h>>>8)}while(--j)}return h^4294967295}function b(h,g,k,j){if(g==null){return 0}h=h^4294967295;while(j>=8){h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);h=a[(h^g[k++])&255]^(h>>>8);j-=8}if(j){do{h=a[(h^g[k++])&255]^(h>>>8)}while(--j)}return h^4294967295}ZLIB.crc32=function(h,g,k,j){if(typeof g==="string"){return c(h,g,k,j)}else{return b(h,g,k,j)}};var d=32;function f(g,k){var j;var h=0;j=0;while(k){if(k&1){j^=g[h]}k>>=1;h++}return j}function e(j,g){var h;for(h=0;h<d;h++){j[h]=f(g,g[h])}}ZLIB.crc32_combine=function(g,h,k){var l;var o;var j;var m;if(k<=0){return g}j=new Array(d);m=new Array(d);m[0]=3988292384;o=1;for(l=1;l<d;l++){m[l]=o;o<<=1}e(j,m);e(m,j);do{e(j,m);if(k&1){g=f(j,g)}k>>=1;if(k==0){break}e(m,j);if(k&1){g=f(m,g)}k>>=1}while(k!=0);g^=h;return g}}());"use strict";var debugLevel=parseInt("{{{debuglevel}}}");var features=parseInt("{{{features}}}");var sessionTime=parseInt("{{{sessiontime}}}");var domain="{{{domain}}}";var domainUrl="{{{domainurl}}}";var meshserver=null;var xdr=null;var serverinfo=null;var nodes=[];var meshes={};var filetree={};var userinfo=null;var serverinfo=null;var users=null;var nodeShortIdent=0;var serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}";var debugmode=false;var attemptWebRTC=((features&128)!=0);var StatusStrs=["Disconnected","Connecting...","Setup...","Connected","Intel® AMT Connected"];var files;var passRequirements="{{{passRequirements}}}";if(passRequirements!=""){passRequirements=JSON.parse(decodeURIComponent(passRequirements))}function startup(){if((features&32)==0){var b=null;try{b=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(b==null||top.active==false)){top.location=self.location;return}}window.onresize=center;center();QH("p1message","Connecting...");go(1);meshserver=MeshServerCreateControl(domainUrl);meshserver.onStateChanged=onStateChanged;meshserver.onMessage=onMessage;meshserver.Start();var c=localStorage.getItem("desktopsettings");if(c!=null){desktopsettings=JSON.parse(c)}applyDesktopSettings()}function onStateChanged(a,b){if(b==0){setDialogMode(0);go(0);setTimeout(serverPoll,5000)}else{if(b==2){meshserver.send({action:"meshes"});meshserver.send({action:"nodes"});meshserver.send({action:"files"});if(xxcurrentView<2){go(2)}}}}function serverPoll(){xdr=null;try{xdr=new XDomainRequest()}catch(a){}if(!xdr){xdr=new XMLHttpRequest()}xdr.open("HEAD",window.location.href);xdr.timeout=15000;xdr.onload=function(){reload()};xdr.onerror=xdr.ontimeout=function(){setTimeout(serverPoll,10000)};xdr.send()}function onMessage(l,d){switch(d.action){case"serverinfo":serverinfo=d.serverinfo;QV("p3AccountActions",((features&4)==0)&&(serverinfo.domainauth==false));QV("logoutMenuOption",((features&4)==0)&&(serverinfo.domainauth==false));break;case"userinfo":userinfo=d.userinfo;QH("p3userName",userinfo.name);QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true));QV("otpAuth",((features&4096)!=0)&&(userinfo.otpsecret!=1));QV("otpAuthRemove",((features&4096)!=0)&&(userinfo.otpsecret==1));break;case"users":users={};for(var c in d.users){users[d.users[c]._id]=d.users[c]}updateUsers();break;case"wssessioncount":wssessions=d.wssessions;updateUsers();break;case"meshes":meshes={};for(var c in d.meshes){meshes[d.meshes[c]._id]=d.meshes[c]}updateMeshes();updateDevices();break;case"files":filetree=setupBackPointers(d.filetree);updateFiles();break;case"nodes":nodes=[];for(var c in d.nodes){for(var e in d.nodes[c]){if(!meshes[c]){console.log("Invalid mesh (1): "+c);continue}d.nodes[c][e].namel=d.nodes[c][e].name.toLowerCase();if(d.nodes[c][e].rname){d.nodes[c][e].rnamel=d.nodes[c][e].rname.toLowerCase()}else{d.nodes[c][e].rnamel=d.nodes[c][e].namel}d.nodes[c][e].meshnamel=meshes[c].name.toLowerCase();d.nodes[c][e].meshid=c;d.nodes[c][e].state=(d.nodes[c][e].state)?(d.nodes[c][e].state):0;d.nodes[c][e].desc=d.nodes[c][e].desc;if(!d.nodes[c][e].icon){d.nodes[c][e].icon=1}d.nodes[c][e].ident=++nodeShortIdent;nodes.push(d.nodes[c][e])}}updateDevices();if(xxcurrentView==0){if("{{viewmode}}"!=""){go(parseInt("{{viewmode}}"))}else{setDialogMode(0);go(1)}}if("{{currentNode}}"!=""){gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"))}break;case"powertimeline":if(d.nodeid!=powerTimelineReq){break}powerTimelineNode=d.nodeid;powerTimeline=d.timeline;powerTimelineUpdate=Date.now()+300000;if(currentNode._id==d.nodeid){drawDeviceTimeline()}break;case"otpauth-request":if((xxdialogMode==2)&&(xxdialogTag=="otpauth-request")){var k=d.secret;if(k.length==52){k=k.split(/(.............)/).filter(Boolean).join(" ")}else{if(k.length==32){k=k.split(/(....)/).filter(Boolean).join(" ");k=k.substring(0,20)+"<br/>"+k.substring(20)}}QH("d2optinfo",'Install <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" rel="noreferrer noopener" target=_blank>Google Authenticator</a> or a compatible application, use <a href="'+d.url+'" rel="noreferrer noopener" target=_blank> this link</a> or enter the secret below. Then, enter the current 6 digit token to activate 2-Step login.<br /><br /><div style=width:100%;text-align:center><tt id=d2optsecret secret="'+d.secret+'" style=font-size:15px>'+k+'</tt><br /><br />Token: <input type=text onkeypress="return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text></div>');QV("idx_dlgOkButton",true);QE("idx_dlgOkButton",false);Q("d2otpauthinput").focus()}break;case"otpauth-setup":if(xxdialogMode){return}setDialogMode(2,"Add 2-Step Login",1,null,d.success?"<b style=color:green>2-step login activation successful</b>. You will now need a valid token to login again.":"<b style=color:red>2-step login activation failed</b>. Clear the secret from the application and try again. You only have a few minutes to enter the proper code.");break;case"otpauth-clear":if(xxdialogMode){return}setDialogMode(2,"Remove 2-Step Login",1,null,d.success?"<b style=color:green>2-step login activation removed</b>. You can reactivate this feature at any time.":"<b style=color:red>2-step login activation removal failed</b>. Try again.");break;case"event":switch(d.event.action){case"accountchange":if(userinfo.name==d.event.account.name){var g=d.event.account.siteadmin?d.event.account.siteadmin:0;var j=userinfo.siteadmin?userinfo.siteadmin:0;if((d.event.account.quota!=userinfo.quota)||(((userinfo.siteadmin&8)==0)&&((d.event.account.siteadmin&8)!=0))){meshserver.send({action:"files"})}userinfo=d.event.account;if(j!=g){updateSiteAdmin()}QV("verifyEmailId",(userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true))}break;case"createmesh":if(d.event.links["user/"+domain+"/"+userinfo.name.toLowerCase()]!=null){meshes[d.event.meshid]={_id:d.event.meshid,name:d.event.name,mtype:d.event.mtype,desc:d.event.desc,links:d.event.links};updateMeshes();updateDevices();meshserver.send({action:"files"})}break;case"meshchange":if(meshes[d.event.meshid]==null){meshes[d.event.meshid]={_id:d.event.meshid,name:d.event.name,mtype:d.event.mtype,desc:d.event.desc,links:d.event.links};meshserver.send({action:"nodes"})}else{meshes[d.event.meshid].name=d.event.name;meshes[d.event.meshid].desc=d.event.desc;meshes[d.event.meshid].links=d.event.links;if(meshes[d.event.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()]==null){if((xxcurrentView==20)&&(currentMesh==meshes[d.event.meshid])){go(2)}delete meshes[d.event.meshid];var f=[];for(var a in nodes){if(nodes[a].meshid!=d.event.meshid){f.push(nodes[a])}}nodes=f;if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==d.event.meshid){setDialogMode(0);go(1)}}}updateMeshes();updateDevices();meshserver.send({action:"files"});if(xxcurrentView==20&¤tMesh._id==d.event.meshid){p20updateMesh()}break;case"deletemesh":if(meshes[d.event.meshid]){delete meshes[d.event.meshid];updateMeshes();meshserver.send({action:"files"})}var f=[];for(var a in nodes){if(nodes[a].meshid!=d.event.meshid){f.push(nodes[a])}}nodes=f;updateDevices();if(xxcurrentView>=20&&xxcurrentView<30&¤tMesh._id==d.event.meshid){setDialogMode(0);go(2)}if(xxcurrentView>=10&&xxcurrentView<20&¤tNode&¤tNode.meshid==d.event.meshid){setDialogMode(0);go(1)}break;case"addnode":var h=d.event.node;if(!meshes[h.meshid]){break}h.namel=h.name.toLowerCase();if(h.rname){h.rnamel=h.rname.toLowerCase()}else{h.rnamel=h.namel}h.meshnamel=meshes[h.meshid].name.toLowerCase();h.state=0;if(!h.icon){h.icon=1}h.ident=++nodeShortIdent;nodes.push(h);updateDevices();break;case"removenode":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var h=nodes[b];if(currentNode==h){if(xxcurrentView>=10&&xxcurrentView<20){setDialogMode(0);go(1)}currentNode=null}nodes.splice(b,1);updateDevices();updateMapMarkers()}break;case"changenode":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var h=nodes[b];h.name=d.event.node.name;h.rname=d.event.node.rname;h.host=d.event.node.host;h.desc=d.event.node.desc;h.publicip=d.event.node.publicip;h.iploc=d.event.node.iploc;h.wifiloc=d.event.node.wifiloc;h.gpsloc=d.event.node.gpsloc;h.tags=d.event.node.tags;h.userloc=d.event.node.userloc;if(d.event.node.agent!=null){if(h.agent==null){h.agent={}}if(d.event.node.agent.ver!=null){h.agent.ver=d.event.node.agent.ver}if(d.event.node.agent.id!=null){h.agent.id=d.event.node.agent.id}if(d.event.node.agent.caps!=null){h.agent.caps=d.event.node.agent.caps}if(d.event.node.agent.core!=null){h.agent.core=d.event.node.agent.core}else{if(h.agent.core){delete h.agent.core}}h.agent.tag=d.event.node.agent.tag}if(d.event.node.intelamt!=null){if(h.intelamt==null){h.intelamt={}}if(d.event.node.intelamt.host!=null){h.intelamt.user=d.event.node.intelamt.host}if(d.event.node.intelamt.user!=null){h.intelamt.user=d.event.node.intelamt.user}if(d.event.node.intelamt.tls!=null){h.intelamt.tls=d.event.node.intelamt.tls}if(d.event.node.intelamt.ver!=null){h.intelamt.ver=d.event.node.intelamt.ver}if(d.event.node.intelamt.state!=null){h.intelamt.state=d.event.node.intelamt.state}}h.namel=h.name.toLowerCase();if(h.rname){h.rnamel=h.rname.toLowerCase()}else{h.rnamel=h.namel}if(d.event.node.icon){h.icon=d.event.node.icon}refreshDevice(h._id);updateDevices()}break;case"nodeconnect":var b=-1;for(var a in nodes){if(nodes[a]._id==d.event.nodeid){b=a;break}}if(b!=-1){var h=nodes[b];h.conn=d.event.conn;h.pwr=d.event.pwr;updateDevices()}break;case"clearevents":break;case"login":if(users!=null&&users["user/"+domain+"/"+d.event.username.toLowerCase()]){users["user/"+domain+"/"+d.event.username.toLowerCase()].login=d.event.time}break;case"notify":break;default:console.log("Unknown message.event.action",d.event.action);break}break;default:console.log("Unknown message.action",d.action);break}}function topMenu(a){if((xxdialogMode!=null)&&(xxdialogMode!=0)&&(xxdialogMode!=999)){return}if(a===undefined){var b=(QS("topMenu").display=="none");if(b==true){if((xxdialogMode==0)||(xxdialogMode==null)){QV("topMenu",true);xxdialogMode=999}}else{QV("topMenu",false);xxdialogMode=0}}else{QV("topMenu",false);xxdialogMode=0;if((a==1)&&(xxcurrentView!=3)){goForward("account")}if((a==2)&&(xxcurrentView!=5)){goForward("files")}}}var backStack=[];function goBack(){if(xxdialogMode){return}if(backStack.length>0){backStack.pop()}goStack()}function goForward(a){if(xxdialogMode){return}backStack.push(a);goStack()}function goStack(){if(backStack.length==0){go(2);return}var a=backStack[backStack.length-1],b=a.split("/")[0];if(b=="node"){setupDeviceMenu(0);gotoDevice(a)}if(b=="mesh"){gotoMesh(a)}if(b=="account"){go(3)}if(b=="devices"){go(2)}if(b=="files"){go(5)}}function updateFooterMenu(b){while(b!=null&&b.length<3){b.push({n:""})}var d="",c="";if(b!=null){for(var a in b){d+='<td style="cursor:pointer'+((c=="")?"":";border-left:solid 1px white")+'" onclick="'+b[a].f+'">'+b[a].n;c=b[a].n}}QH("footerMenu","<tr>"+d)}function account_addOtp(){if(xxdialogMode||(userinfo.otpsecret==1)||((features&4096)==0)){return}setDialogMode(2,"Add 2-Step Login",2,function(){meshserver.send({action:"otpauth-setup",secret:Q("d2optsecret").attributes.secret.value,token:Q("d2otpauthinput").value})},"<div id=d2optinfo>Loading...</div>","otpauth-request");meshserver.send({action:"otpauth-request"})}function account_addOtpCheck(a){var b=(Q("d2otpauthinput").value.length==6);QE("idx_dlgOkButton",b);if(a&&(a.keyCode==13)&&b){dialogclose(1)}}function account_removeOtp(){if(xxdialogMode||(userinfo.otpsecret!=1)||((features&4096)==0)){return}setDialogMode(2,"Remove 2-Step Login",3,function(){meshserver.send({action:"otpauth-clear"})},"Confirm removal of 2-step login?")}function account_showVerifyEmail(){if(xxdialogMode||(userinfo.emailVerified==true)||(serverinfo.emailcheck!=true)){return}var a="Click ok to send a verification mail to:<br /><div style=padding:8px><b>"+EscapeHtml(userinfo.email)+"</b></div>Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a)}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return}var a=addHtmlValue("Email","<input id=dp3email style=width:170px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp3email").value=userinfo.email}account_validateEmail();Q("dp3email").focus()}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp3email").value)&&(Q("dp3email").value!=userinfo.email));if((a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp3email").value})}function account_showDeleteAccount(){if(xxdialogMode){return}var a="<form action='"+domainUrl+"deleteaccount' method=post><table style=margin-left:10px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";a+="</tr></table><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_showChangePassword(){if(xxdialogMode){return}var a="<form action='"+domainUrl+"changepassword' method=post><table style=margin-left:10px><tr>";a+="<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td>";a+="</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td>";a+="</tr><tr><td align=right>Hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off /></td>";a+="</tr></table><div style=padding:10px;margin-bottom:4px>";a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+='<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';a+="</div><br /></form>";setDialogMode(2,"Change Password",0,null,a);account_validateNewPassword();Q("apassword1").focus()}function account_createMesh(){if(xxdialogMode){return}if((userinfo.emailVerified!==true)&&(userinfo.email!=null)&&(serverinfo.emailcheck==true)&&(userinfo.siteadmin!=4294967295)){setDialogMode(2,"New Device Group",1,null,'Unable to create a new device group until the email address is verified. Go to the "My Account" menu option to change and verify an email address.');return}var a=addHtmlValue("Name","<input id=dp3meshname style=width:170px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");a+=addHtmlValue("Type","<div style=width:170px;margin:0;padding:0><select id=dp3meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Software Agent Group</option><option value=1>Intel® AMT only</option></select></div>");a+=addHtmlValue("Description","<div style=width:170px;margin:0;padding:0><textarea id=dp3meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>");setDialogMode(2,"Create Device Group",3,account_createMeshEx,a);account_validateMeshCreate();Q("dp3meshname").focus()}function account_validateMeshCreate(){QE("idx_dlgOkButton",Q("dp3meshname").value.length>0)}function account_createMeshEx(a,b){meshserver.send({action:"createmesh",meshname:Q("dp3meshname").value,meshtype:Q("dp3meshtype").value,desc:Q("dp3meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value))}function account_validateNewPassword(){var d="",a=(Q("apassword1").value.length>0)&&(Q("apassword1").value==Q("apassword2").value);if(Q("apassword1").value!=""){if(passRequirements==null||passRequirements==""){var c=checkPasswordStrength(Q("apassword1").value);if(c>=80){d="<span style=color:green>●<span>"}else{if(c>=60){d="<span style=color:blue>●<span>"}else{d="<span style=color:red>●<span>"}}}else{var b=checkPasswordRequirements(Q("apassword1").value,passRequirements);if(b==false){a=false;d="<span style=color:red>●<span>"}}}QH("dxPassWarn",d);QE("account_dlgOkButton",a)}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}function checkPasswordRequirements(e,f){if((f==null)||(f=="")||(typeof f!="object")){return true}if(f.min){if(e.length<f.min){return false}}if(f.max){if(e.length>f.max){return false}}var d=0,b=0,g=0,c=0;for(var a=0;a<e.length;a++){if(/\d/.test(e[a])){d++}if(/[a-z]/.test(e[a])){b++}if(/[A-Z]/.test(e[a])){g++}if(/\W/.test(e[a])){c++}}if(f.num&&(d<f.num)){return false}if(f.lower&&(b<f.lower)){return false}if(f.upper&&(g<f.upper)){return false}if(f.nonalpha&&(c<f.nonalpha)){return false}return true}function updateMeshes(){var c="",a=0;for(i in meshes){a++;var b=meshes[i].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var d="Partial Rights";if(b==4294967295){d="Full Administrator"}else{if(b==0){d="No Rights"}}c+="<div style=cursor:pointer onclick=goForward('"+i+"')>";c+='<div style="float:left;margin-left:4px"><img src="/images/meshicon50.png" width=50 height=50 /></div>';c+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">';c+="<div><div style=padding-left:12px;padding-top:2px><b>"+EscapeHtml(meshes[i].name)+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+d+"</div></div>";c+="</div></div>"}QH("p3meshes",c);QV("p3noMeshFound",a==0)}function gotoMesh(a){currentMesh=meshes[a];if(currentMesh==null){goBack()}p20updateMesh();go(20)}function server_showRestoreDlg(){if(xxdialogMode){return}var a="Restore the server using a backup, <span style=color:red>this will delete the existing server data</span>. Only do this if you know what you are doing.<br /><br />";a+='<form action="/restoreserver.ashx" enctype="multipart/form-data" method="post"><div>';a+='<input id=account_dlgFileInput type=file name=datafile style=width:100% accept=".zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed" onchange=account_validateServerRestore()>';a+="<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>";a+="<input id=account_dlgOkButton type=submit value=OK style=float:right;width:80px onclick=dialogclose(1)>";a+="</div><br /><br /></form>";setDialogMode(2,"Restore Server",0,null,a);account_validateServerRestore()}function account_validateServerRestore(){QE("account_dlgOkButton",Q("account_dlgFileInput").files.length==1)}function server_showVersionDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Version",1,null,"Loading...","MeshCentralServerUpdate");meshserver.send({action:"serverversion"})}function server_showVersionDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showVersionDlgEx(){meshserver.send({action:"serverupdate"})}var filetreelinkpath;var filetreelocation=[];function p5refreshFiles(){meshserver.send({action:"files"})}function updateFiles(){QV("MainMenuMyFiles",((features&8)==0));if((features&8)!=0){return}var o="",p="",c="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",m="Root",w,g=filetree,k=1;var e=[],t=filetreelinkpath,b=[],a=document.getElementsByName("fc");for(var q=0;q<a.length;q++){if(a[q].checked){b.push(a[q].value)}}filetreelinkpath="";for(var q in filetreelocation){if((g.f!=null)&&(g.f[filetreelocation[q]]!=null)){e.push(filetreelocation[q]);m+=" / "+filetreelocation[q];if((k==1)){var z=filetreelocation[q].split("/");w=window.location+z[0]+"files/"+z[2];filetreelinkpath+=filetreelocation[q]}else{if(filetreelinkpath!=""){filetreelinkpath+="/"+filetreelocation[q];if(k>2){w+="/"+filetreelocation[q]}}}g=g.f[filetreelocation[q]];c+=" / <a style=cursor:pointer onclick=p5folderup("+k+")>"+(g.n!=null?g.n:filetreelocation[q])+"</a>";k++}else{break}}filetreelocation=e;var u=m.toLowerCase().startsWith("root / "+userinfo._id+" / public");var j=p5sort_files(g.f);for(var q in j){var d=j[q],s=d.n,y;y=s;if(s.length>40){y='<span title="'+EscapeHtml(s)+'">'+EscapeHtml(s.substring(0,40))+"...</span>"}else{y=EscapeHtml(s)}s=EscapeHtml(s);var l="";if(d.s!=null){l=getFileSizeStr(d.s)}var n="";if(d.t<3||d.t==4){var x=(d.t==1||d.t==4)?p5getQuotabar(d):"",A="";n="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+s+"'> <span style=float:right;padding-right:4px title=\""+A+'">'+x+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(d.nx)+'")>'+y+"</a></span></div>"}else{var r=y;var v="";if(u){v=' (<a style=cursor:pointer title="Display public link" onclick=\'p5showPublicLink("'+w+"/"+d.nx+"\")'>Link</a>)"}if(d.s>0){r='<a rel="noreferrer noopener" target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+d.nx)+'">'+y+"</a>"+v}n="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+d.nx+"'> <span style=float:right;padding-right:4px>"+l+"</span><span><div class=fileIcon"+d.t+"></div>"+r+"</span></div>"}if(d.t<3){o+=n}else{p+=n}}QH("p5rightOfButtons",p5getQuotabar(g));QH("p5files",o+p);QH("p5currentpath",c);QE("p5FolderUp",filetreelocation.length!=0);QV("p5PublicShare",u);if(t==filetreelinkpath){a=document.getElementsByName("fc");for(var q=0;q<a.length;q++){a[q].checked=(b.indexOf(a[q].value)>=0)}}p5setActions()}function p5getQuotabar(a){while(a.t>1&&a.t!=4){a=a.parent}if((a.t!=1&&a.t!=4)||(a.maxbytes==null)){return""}var b=Math.floor(a.s/1024),c=Math.floor((a.maxbytes-a.s)/1024);return'<span title="'+b+"k in "+a.c+" file"+(a.c>1?"s":"")+". "+(Math.floor(a.maxbytes/1024))+'k maxinum">'+((c<0)?("Storage limit exceed"):(c+"k remaining"))+" <progress style=height:10px;width:100px value="+a.s+" max="+a.maxbytes+" /></span>"}function p5showPublicLink(a){setDialogMode(2,"Public Link",1,null,'<input type=text style=width:100% value="'+a+'" readonly />')}var sortorder;function p5sort_filename(c,d){if(c.ln>d.ln){return(1*sortorder)}if(c.ln<d.ln){return(-1*sortorder)}return 0}function p5sort_timestamp(c,d){if(c.d>d.d){return(1*sortorder)}if(c.d<d.d){return(-1*sortorder)}return 0}function p5sort_bysize(c,d){if(c.s==d.s){return p5sort_filename(c,d)}return(((c.s-d.s))*sortorder)}function p5sort_files(a){var c=[],d=Q("p5sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}sortorder=1;if(d>3){sortorder=-1;d-=3}if(d==1){c.sort(p5sort_filename)}else{if(d==2){c.sort(p5sort_bysize)}else{if(d==3){c.sort(p5sort_timestamp)}}}return c}function p5setActions(){var a=getFileSelCount(),c=getFileCount(),b=getFileSelCount(false);QE("p5DeleteFileButton",(a>0)&&(filetreelocation.length>0));QE("p5NewFolderButton",filetreelocation.length>0);QE("p5UploadButton",filetreelocation.length>0);QE("p5RenameFileButton",(a==1)&&(filetreelocation.length>0));QE("p5SelectAllButton",c>0);Q("p5SelectAllButton").value=(a>0?"None":"All");QE("p5CutButton",(b>0)&&(a==b));QE("p5CopyButton",(b>0)&&(a==b));QE("p5PasteButton",(p5clipboard!=null)&&(p5clipboard.length>0)&&(filetreelocation.length>0))}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}function p5selectallfile(){var c=(getFileSelCount()==0),a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){a[b].checked=c}p5setActions()}function setupBackPointers(d){if(d.f!=null){var b=0,a=0;for(var c in d.f){setupBackPointers(d.f[c]);d.f[c].parent=d;if(d.f[c].s){b+=d.f[c].s}if(d.f[c].c){a+=d.f[c].c}if(d.f[c].t==3){a++}}d.s=b;d.c=a}return d}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function p5folderup(a){if(a==null){filetreelocation.pop()}else{while(filetreelocation.length>a){filetreelocation.pop()}}updateFiles()}function p5folderset(a){filetreelocation.push(decodeURIComponent(a));updateFiles()}function p5createfolder(){setDialogMode(2,"New Folder",3,p5createfolderEx,"<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />");focusTextBox("p5renameinput");p5fileNameCheck()}function p5createfolderEx(){meshserver.send({action:"fileoperation",fileop:"createfolder",path:filetreelocation,newfolder:Q("p5renameinput").value})}function p5deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p5deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p5deletefileEx(){var b=[],a=document.getElementsByName("fc");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(a[c].value)}}meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:b})}function p5renamefile(){var c,a=document.getElementsByName("fc");for(var b=0;b<a.length;b++){if(a[b].checked){c=a[b].value}}setDialogMode(2,"Rename",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:c});focusTextBox("p5renameinput");p5fileNameCheck()}function p5renamefileEx(a,c){c.newname=Q("p5renameinput").value;meshserver.send(c)}function p5fileNameCheck(a){var b=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a.keyCode==13)){dialogclose(1)}}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();function p5uploadFile(){setDialogMode(2,"Upload File",3,p5uploadFileEx,'<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value="'+encodeURIComponent(filetreelinkpath)+'" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=submit id=p5loginSubmit style=display:none /></form>');updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(b){var a=document.getElementsByName("fc");p5clipboard=[];p5clipboardCut=b,p5clipboardFolder=Clone(filetreelocation);for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p5clipboard.push(a[c].value)}}p5updateClipview()}function p5pasteFile(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Confim "+(p5clipboardCut==0?"copy":"move")+" of "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p5pasteFileEx,a)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:(p5clipboardCut==0?"copy":"move"),scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard});p5folderup(999);if(p5clipboardCut==1){p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;p5updateClipview()}}function p5updateClipview(){var a="";if((p5clipboard!=null)&&(p5clipboard.length>0)){a="Holding "+p5clipboard.length+" entrie"+((p5clipboard.length>1)?"s":"")+" for "+(p5clipboardCut==0?"copy":"move")+", <a onclick=p5clearClip() style=cursor:pointer>Clear</a>."}QH("p5bottomstatus",a);p5setActions()}function p5clearClip(){p5clipboard=null;p5clipboardFolder=null;p5clipboardCut=0;p5updateClipview()}function p5fileDragDrop(b){haltEvent(b);QV("bigfail",false);QV("bigok",false);if(b.dataTransfer==null||b.dataTransfer.files.length==0||filetreelocation.length==0){return}var f=[],j=[],k=[],a=[],h=b.dataTransfer.files.length;for(var d=0;d<b.dataTransfer.files.length;d++){var g=new FileReader(),c=b.dataTransfer.files[d];f.push(c.name);j.push(c.size);k.push(c.type);g.onload=function(e){a.push(e.target.result);if(--h==0){Q("p5fileDragName").value=f.join("*");Q("p5fileDragSize").value=j.join("*");Q("p5fileDragType").value=k.join("*");Q("p5fileDragData").value=a.join("*");Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath);Q("p5loginSubmit2").click()}};g.readAsDataURL(c)}}var p5dragtimer=null;function p5fileDragOver(b){haltEvent(b);if(p5dragtimer!=null){clearTimeout(p5dragtimer);p5dragtimer=null}var a=true;if(filetreelocation.length==0){a=false}QV("bigok",a);QV("bigfail",!a)}function p5fileDragLeave(a){haltEvent(a);if(a.target.id!="p5filetable"){QV("bigfail",false);QV("bigok",false)}else{p5dragtimer=setTimeout("QV('bigfail',false);QV('bigok',false);p5dragtimer=null;",200)}}var updateDevicesTimer=null;function updateDevices(){if(updateDevicesTimer!=null){return}updateDevicesTimer=setTimeout(updateDevicesEx,200)}var sort=0;var deviceHeaderId=0;var deviceHeaderCount;var deviceHeaders={};var showRealNames=false;var deviceHeaderTotal=0;var deviceHeaders={};var deviceHeadersTitles={};function updateDevicesEx(){if(updateDevicesTimer!=null){clearTimeout(updateDevicesTimer);updateDevicesTimer=null}var t="",a=0,d=null,b=0,e={},h={},g={};deviceHeaderId=0;deviceHeaderCount={};deviceHeaderTotal=0;deviceHeaders={};deviceHeadersTitles={};var d;if(sort==0){nodes.sort(meshSort)}else{if(sort==1){nodes.sort(powerSort)}else{if(sort==2){if(showRealNames==true){nodes.sort(deviceHostSort)}else{nodes.sort(deviceSort)}}}}for(var j in nodes){if(nodes[j].v==false){continue}var m=meshes[nodes[j].meshid],o=m.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(o==null){continue}var p=o.rights;if(sort==0){nodes.sort(meshSort);if(nodes[j].meshid!=d){deviceHeaderSet();var f="";if(meshes[nodes[j].meshid].mtype==1){f="<span style=color:lightgray>, Intel® AMT only</span>"}if(d!=null){if(a==2){t+="<td><div style=width:301px></div></td>"}if(t!=""){t+="</tr></table>"}}t+="<div class=DevSt style=padding-top:4px><span style=float:right>";t+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+nodes[j].meshid+'")>'+EscapeHtml(meshes[nodes[j].meshid].name)+"</span>"+f+"<span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>";d=nodes[j].meshid;e[d]=1;a=0}}else{if(sort==1){if(nodes[j].pwr!==d){deviceHeaderSet();if(d!==null){if(a==2){t+="<td><div style=width:301px></div></td>"}if(t!=""){t+="</tr></table>"}}t+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[j].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>";d=nodes[j].pwr;a=0}}else{if(sort==2){if(d==null){d="1"}}}}b++;var u=EscapeHtml(nodes[j].name);if(u.length==0){u="<i>None</i>"}if((nodes[j].rname!=null)&&(nodes[j].rname.length>0)){u+=" / "+EscapeHtml(nodes[j].rname)}var q=EscapeHtml(nodes[j].name);if(showRealNames==true&&nodes[j].rname!=null){q=EscapeHtml(nodes[j].rname)}if(q.length==0){q="<i>None</i>"}var k=nodes[j].icon,s=NodeStateStr(nodes[j]);if((!nodes[j].conn)||(nodes[j].conn==0)){k+=" gray"}t+="<div style=cursor:pointer onclick=goForward('"+nodes[j]._id+"')>";t+='<div class="i'+k+'" style="float:left;margin-left:4px"></div>';t+='<div style="width:auto;height:40px;background-color:lightgray;margin-top:5px;margin-bottom:5px;margin-left:60px;padding-top:5px;padding-bottom:5px;border-radius:8px 0px 0px 8px">';t+="<div><div style=padding-left:12px;padding-top:2px><b>"+q+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+s+"</div></div>";t+="</div></div>";deviceHeaderTotal++;if(typeof deviceHeaderCount[nodes[j].state]=="undefined"){deviceHeaderCount[nodes[j].state]=1}else{deviceHeaderCount[nodes[j].state]++}}if(sort==0){for(var j in meshes){var l=meshes[j],n=l.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(n!=null){var p=n.rights;if(e[l._id]==null){if((d!="")&&(t!="")){t+="</tr></table>"}t+="<div><div colspan=3 class=DevSt><span style=float:right>";t+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+l._id+'")>'+EscapeHtml(l.name)+"</span></div>";if(l.mtype==1){t+="<div style=padding:10px><i>No Intel® AMT devices in this mesh"}if(l.mtype==2){t+="<div style=padding:10px><i>No devices in this mesh"}t+=".</i></div></div>";d=l._id;b++}}}}if(b==0){QH("xdevices",'<div style="margin-top:50px;text-align:center"><span style="font-size:30px">No devices</span><br /><br />Use the desktop version of this website to add devices.</div>')}else{QH("xdevices",t)}deviceHeaderSet();for(var j in deviceHeaders){QH(j,deviceHeaders[j])}for(var j in deviceHeadersTitles){Q(j).title=deviceHeadersTitles[j]}}var powerStatetable=["","Powered","Sleep","Sleep","Sleep","Hibernating","Power off","Present"];var powerStateStrings=["",'<span title="Device is powered on.">Powered</span>','<span title="Device is in sleep state (S1).">Sleeping</span>','<span title="Device is in sleep state (S2).">Sleeping</span>','<span title="Device is in deep sleep state (S3).">Deep Sleep</span>','<span title="Device is in hibernating state (S4).">Hibernating</span>','<span title="Device is in powered off state (S5).">Soft-Off</span>','<span title="Device is detected but power state could not be obtained.">Present</span>'];var powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"];var powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(a){var b=[];if(a.state>0&&a.state<powerStatetable.length){state.push(powerStatetable[a.state])}if(a.conn){if((a.conn&1)!=0){b.push('<span title="Mesh agent is connected and ready for use.">Agent</span>')}if((a.conn&2)!=0){b.push('<span title="Intel® AMT CIRA is connected and ready for use.">CIRA</span>')}if((a.conn&4)!=0){b.push('<span title="Intel® AMT is routable.">Intel® AMT</span>')}if((a.conn&8)!=0){b.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>')}}if((a.pwr!=null)&&(a.pwr!=0)){b.push(powerStateStrings[a.pwr])}return b.join(", ")}function PowerStateStr(a){if(a<powerStatetable.length){return powerStatetable[a]}return""}function PowerStateStr2(a){if((a!=0)&&(a<powerStatetable.length)){return powerStatetable[a]}return"Unknown"}function onSortSelectChange(a){sort=document.getElementById("sortselect").selectedIndex;if(!a){putstore("sort",sort)}updateDevicesEx()}function deviceHeaderSet(){if(deviceHeaderId==0){deviceHeaderId=1;return}deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+((deviceHeaderTotal==1)?" node":" nodes");var a="";for(var b in deviceHeaderCount){if(a.length>0){a+=", "}a+=deviceHeaderCount[b]+" "+PowerStateStr2(b)}deviceHeadersTitles["DevxHeader"+deviceHeaderId]=a;deviceHeaderId++;deviceHeaderCount={};deviceHeaderTotal=0}function meshSort(c,d){if(c.meshnamel>d.meshnamel){return 1}if(c.meshnamel<d.meshnamel){return -1}if(c.meshid==d.meshid){if(showRealNames==true){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}else{if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}}return 0}function powerSort(c,e){var d=c.pwr?c.pwr:0;var f=e.pwr?e.pwr:0;if(d==f){if(showRealNames==true){if(c.rnamel>e.rnamel){return 1}if(c.rnamel<e.rnamel){return -1}return 0}else{if(c.namel>e.namel){return 1}if(c.namel<e.namel){return -1}return 0}}if(d>f){return 1}if(d<f){return -1}return 0}function deviceSort(c,d){if(c.namel>d.namel){return 1}if(c.namel<d.namel){return -1}return 0}function deviceHostSort(c,d){if(c.rnamel>d.rnamel){return 1}if(c.rnamel<d.rnamel){return -1}return 0}function refreshDevice(a){if(!currentNode||currentNode._id!=a){return}gotoDevice(a,xxcurrentView,true)}function getNodeRights(c){var b=getNodeFromId(c),a=meshes[b.meshid];return a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights}var currentDevicePanel=0;var currentNode;var powerTimelineNode=null;var powerTimelineReq=null;var powerTimelineUpdate=null;var powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(l,m,p){var k=getNodeFromId(l);if(k==null){goBack()}var g=meshes[k.meshid];if(g==null){goBack()}var h=g.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(!currentNode||currentNode._id!=k._id||p==true){currentNode=k;var j=EscapeHtml(k.name);if(j.length==0){j="<i>None</i>"}if((h&4)!=0){j="<span onclick=showEditNodeValueDialog(0) style=cursor:pointer>"+j+"</span>"}QH("p10deviceName",j);var s="<table style=width:100%>";s+=addDeviceAttribute('<span title="The name of the device group this computer belong to">Group</span>','<a title="The name of the device group this computer belong to" onclick=goForward("'+k.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[k.meshid].name)+"</a>");if(k.rname!=null){s+=addDeviceAttribute('<span title="The name of this computer as set in the operating system">Name</span>','<span title="The name of this computer as set in the operating system">'+EscapeHtml(k.rname)+"</span>")}if((g.mtype==1)||(k.name!=k.host)){if((h&4)!=0){if(k.host){s+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(k.host)+"</span>")}else{s+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>")}}else{s+=addDeviceAttribute("Hostname",EscapeHtml(k.host))}}var d=k.desc?EscapeHtml(k.desc):"<i>None</i>";if((h&4)!=0){s+=addDeviceAttribute("Description","<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+d+"</span>")}else{s+=addDeviceAttribute("Description",d)}var a=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","OSX 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","OSX 64bit","ChromeOS","Linux Poky x86-64bit","Linux NoKVM x86-32bit","Linux NoKVM x86-64bit","Windows MinCore console","Windows MinCore service","NodeJS","ARM-Linaro","ARMv6l / ARMv7l"];if((k.agent!=null)&&(k.agent.id!=null)&&(k.agent.ver!=null)){var q="";if(k.agent.id<=a.length){q=a[k.agent.id]}else{q=a[0]}if(k.agent.ver!=0){q+=" v"+k.agent.ver}s+=addDeviceAttribute("Agent",q)}if(k.intelamt!=null){var q="";var o={0:"Not Activated (Pre)",1:"Not Activated (In)",2:"Activated"};if(k.intelamt.ver!=null&&k.intelamt.state==null){q+="<i>Unknown State</i>, v"+k.intelamt.ver}else{if((k.intelamt.ver==null)&&(k.intelamt.state==2)){q+="<i>Activated</i>"}else{if((k.intelamt.ver==null)||(k.intelamt.state==null)){q+="<i>Unknown Version & State</i>"}else{q+=o[k.intelamt.state];if(k.intelamt.flags){if(k.intelamt.flags&2){q=' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'}else{if(k.intelamt.flags&4){q=' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'}}}q+=(", v"+k.intelamt.ver)}}}if(k.intelamt.tls==1){q+=', <span title="Intel AMT is setup with TLS network security">TLS</span>'}if(k.intelamt.state==2){if(k.intelamt.user==null||k.intelamt.user==""){if((h&4)!=0){q+=', <i style=color:#FF0000;cursor:pointer title="Edit Intel® AMT credentials" onclick=editDeviceAmtSettings("'+k._id+'")>No Credentials</i>'}else{q+=", <i style=color:#FF0000>No Credentials</i>"}}q+=" ";if((h&4)!=0){q+='<img src=images/link4.png height=10 width=10 title="Edit Intel® AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("'+k._id+'")>'}}s+=addDeviceAttribute("Intel® AMT",q)}if((k.agent!=null)&&(k.agent.tag!=null)&&(k.agent.tag!="mailto:")){var r=EscapeHtml(k.agent.tag);if(r.startsWith("mailto:")){r='<a href="'+r+'">'+r.substring(7)+"</a>"}s+=addDeviceAttribute("Agent Tag",r)}var b=k.conn;if(b&&b>1){var c=[];if((k.conn&1)!=0){c.push('<span title="Software agent is connected and ready for use.">Agent</span>')}if((k.conn&2)!=0){c.push('<span title="Intel® AMT CIRA is connected and ready for use.">Intel® AMT CIRA</span>')}if((k.conn&4)!=0){c.push('<span title="Intel® AMT is routable and ready for use.">Intel® AMT</span>')}if((k.conn&8)!=0){c.push('<span title="Software agent is reachable using another agent as relay.">Agent Relay</span>')}s+=addDeviceAttribute("Connectivity",c.join(", "))}var e="<i>None</i>";if(k.tags!=null){e="";for(var f in k.tags){e+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+k.tags[f]+"</span>"}}s+=addDeviceAttribute("Tags","<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+e+"</span>");s+="</table><br />";if((h&76)!=0){s+='<input type=button value=Actions title="Perform power actions on the device" onclick=deviceActionFunction() />'}QH("p10html",s);setupFiles();s="<div style=float:right;font-size:x-small;margin-right:10px>";if((h&4)!=0){s+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+k._id+'") title="Remove this device">Delete Device</a>'}s+="</div><div style=font-size:x-small>";s+="</div><br>";QH("p10html3",s);var n=PowerStateStr(k.state);if((b&1)!=0){if(n.length>0){n+=", "}n+='<span style=font-size:10px title="Agent connected">Mesh Agent</span>'}if((b&2)!=0){if(n.length>0){n+=", "}n+='<span style=font-size:10px title="Intel® AMT connected">Intel® AMT connected</span>'}else{if((b&4)!=0){if(n.length>0){n+=", "}n+='<span style=font-size:10px title="Intel® AMT detected">Intel® AMT detected</span>'}}QH("MainComputerState",n);QH("MainComputerImage",'<div class="i'+k.icon+'"></div>');if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}setupDesktop();if(!m){m=10}go(m);setupDeviceMenu()}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Toast",3,deviceToastFunctionEx,"<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function setupDeviceMenu(d,c){var b=0;if(currentNode){b=meshes[currentNode.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights}if(d!=null){currentDevicePanel=d}QV("p10general",currentDevicePanel==0);QV("p10desktop",currentDevicePanel==1);QV("p10files",currentDevicePanel==2);var a=[];if(currentDevicePanel!=0){a.push({n:"General",f:"setupDeviceMenu(0)"})}if((currentDevicePanel!=1)&&(currentNode!=null)&&((b&8)||(b&256))&&((currentNode.mtype==1)||(currentNode.agent.caps&1))){a.push({n:"Desktop",f:"setupDeviceMenu(1)"})}if((currentDevicePanel!=2)&&(currentNode!=null)&&(b&8)&&((currentNode.mtype==2)&&(currentNode.agent.caps&4))){a.push({n:"Files",f:"setupDeviceMenu(2)"})}updateFooterMenu(a)}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var b="Select an operation to perform on this device.<br /><br />";var c="<select id=d2deviceop style=float:right;width:170px>";if((a&64)!=0){c+="<option value=100>Wake-up</option>"}if((a&8)!=0){c+="<option value=4>Sleep</option><option value=3>Reset</option><option value=2>Power off</option>"}c+="</select>";b+=addHtmlValue("Operation",c);setDialogMode(2,"Device Action",3,deviceActionFunctionEx,b)}function deviceActionFunctionEx(){var a=Q("d2deviceop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:[currentNode._id]})}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:a})}}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate<Date.now())){powerTimelineUpdate=null;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}}function drawDeviceTimeline(){var r=null,n=Date.now();if(currentNode._id==powerTimelineNode){r=powerTimeline}var e=new Date();e.setHours(0,0,0,0);e=new Date(e.getTime()-(1000*60*60*24*6));var t=e.getTime();var s=[];if(r!=null&&r.length>1){s.push([0,r[1],r[0]]);var c=r[1];for(var l=2;l<r.length;l+=2){var o=r[l],h=n;if(r.length>(l+1)){h=r[l+1]}s.push([c,c+h,o]);c=c+h}}var z="",b=1,g=new Date();var v=Q("masthead").offsetWidth-(90+9+9+14);g.setHours(0,0,0,0);for(var l=0;l<7;l++){var f="",p=g.getTime(),k=p+(1000*60*60*24);for(var m in s){var a=s[m];if(isTimeBlockInside(p,k,a[0],a[1])==true){var w=Math.max(p,a[0]);var q=Math.min(Math.min(k,a[1]),n);var y=Math.round(((q-w)*v)/86400000);if(y>0){var u=powerStateStrings2[a[2]]+" from "+new Date(w).toLocaleTimeString()+" to "+new Date(q).toLocaleTimeString()+".";f+='<div title="'+u+'" style=display:table-cell;width:'+y+"px;background-color:"+powerColor(a[2])+";height:16px></div>"}}}z+="<tr style="+(((b%2)==0)?"background-color:#DDD":"")+"><td><div> "+g.toLocaleDateString()+"<div></div></div></td><td><div>"+f+"</div></td></tr>";++b;g=new Date(g.getTime()-(1000*60*60*24))}QH("p10html2",'<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse;width:calc(100% - 18px);margin:9px" border=0 cellpadding=2 cellspacing=0><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:90px>Day</th><th scope=col style=text-align:center>Power State</th></tr>'+z+"</tbody></table>")}function powerColor(a){if(a<powerColorTable.length){return powerColorTable[a]}return"yellow"}function isTimeBlockInside(d,c,b,a){if((b<d)&&(a>c)){return true}if((b>d)&&(b<c)){return true}if((a>d)&&(a<c)){return true}return false}function addDeviceAttribute(a,b){return"<tr><td style=width:100px;color:gray>"+a+"</td><td style=overflow:hidden>"+b+"</td></tr>"}function editDeviceAmtSettings(e,b){if(xxdialogMode){return}var f="",d=getNodeFromId(e),a=3,c=getNodeRights(e);if((c&4)==0){return}f+=addHtmlValue("Username",'<input id=dp10username style=width:170px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');f+=addHtmlValue("Password","<input id=dp10password type=password style=width:170px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />");f+=addHtmlValue("Security","<select id=dp10tls style=width:176px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>");if((d.intelamt.user!=null)&&(d.intelamt.user!="")){a=7}setDialogMode(2,"Edit Intel® AMT credentials",a,editDeviceAmtSettingsEx,f,{node:d,func:b});if((d.intelamt.user!=null)&&(d.intelamt.user!="")){Q("dp10username").value=d.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=d.intelamt.tls;validateDeviceAmtSettings()}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(c,d){if(c==2){meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:"",pass:""}})}else{var b=Q("dp10username").value;if(b==""){b="admin"}var a=Q("dp10password").value;if(a==""){b=""}meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:b,pass:a,tls:Q("dp10tls").value}});d.node.intelamt.user=b;d.node.intelamt.tls=Q("dp10tls").value;if(d.func){setTimeout(d.func,300)}}}function p10showDeleteNodeDialog(a){if(xxdialogMode){return}setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,'Delete "'+EscapeHtml(currentNode.name)+'"?<br /><br /><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm',a);p10validateDeleteNodeDialog()}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(a,b){meshserver.send({action:"removedevices",nodeids:[b]})}function p10showiconselector(){if(xxdialogMode){return}var a=meshes[currentNode.meshid];var b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&4)==0){return}var c="<table align=center><td>";c+="<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>";c+="<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>";c+="<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br>";c+="<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>";c+="<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>";c+="<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>";setDialogMode(2,"Icon Selection",0,null,c);QV("id_dialogclose",true)}function p10setIcon(a){setDialogMode(0);meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:a})}var showEditNodeValueDialog_modes=["Device Name","Hostname","Description","Tags"];var showEditNodeValueDialog_modes2=["name","host","desc","tags"];var showEditNodeValueDialog_modes3=["","","","Group1, Group2, Group3"];function showEditNodeValueDialog(a){if(xxdialogMode){return}var c=addHtmlValue(showEditNodeValueDialog_modes[a],'<input id=dp10devicevalue style=width:170px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[a]+'" onchange=p10editdevicevalueValidate('+a+",event) onkeyup=p10editdevicevalueValidate("+a+",event) />");setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,c,a);var b=currentNode[showEditNodeValueDialog_modes2[a]];if(b==null){b=""}if(Array.isArray(b)){b=b.join(", ")}Q("dp10devicevalue").value=b;p10editdevicevalueValidate();Q("dp10devicevalue").focus()}function showEditNodeValueDialogEx(a,b){var c={action:"changedevice",nodeid:currentNode._id};c[showEditNodeValueDialog_modes2[b]]=Q("dp10devicevalue").value;meshserver.send(c)}function p10editdevicevalueValidate(b,a){var c=((b>1)||(Q("dp10devicevalue").value.length>0));QE("idx_dlgOkButton",c);if((a!=null)&&(c==true)&&(a.keyCode==13)){dialogclose(1)}}var desktop;var desktopNode;var desktopsettings={encoding:2,showfocus:false,showmouse:true,showcad:true,quality:40,scaling:1024,framerate:50};function setupDesktop(){if((desktopNode!=currentNode)&&(desktop!=null)){desktop.Stop();desktopNode=null;desktop=null}if((desktopNode!=currentNode)||(desktop==null)){QH("DeskParent",'<canvas id=Desk width=640 height=200 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');desktopNode=currentNode;Q("Desk").addEventListener("DOMMouseScroll",function(a){return dmousewheel(a)});Q("Desk").addEventListener("mousewheel",function(a){return dmousewheel(a)})}desktopNode=currentNode;updateDesktopButtons();if(!Q("Desk")["toBlob"]){QV("deskSaveBtn",false)}}function updateDesktopButtons(){var c=meshes[currentNode.meshid];var a=0;if(desktop!=null){a=desktop.State}var d=c.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;QV("disconnectbutton1",(a!=0));QV("connectbutton1",(a==0)&&(c.mtype==2)&&((d&8)||(d&256)));QV("connectbutton1h",(a==0)&&((currentNode.intelamt!=null)&&(d&8)&&(c.mtype==1||currentNode.intelamt.state==2)&&((currentNode.intelamt.ver!=null)||(c.mtype==1))));QV("d7amtkvm",(currentNode.intelamt!=null&&((currentNode.intelamt.ver!=null)||(c.mtype==1)))&&((a==0)||(desktop.contype==2)));QV("d7meshkvm",(c.mtype==2)&&((a==false)||(desktop.contype==1)));var e=((currentNode.conn&1)!=0);QE("connectbutton1",e);var b=((currentNode.conn&6)!=0);QE("connectbutton1h",b);QV("DeskToastButton",(currentNode.agent)&&(currentNode.agent.id<5)&&(d&8));QE("DeskToastButton",e);QV("deskActionsBtn",d&8);Q("DeskControl").checked=((d&8)!=0);if(e==false){QV("DeskTools",false)}}function connectDesktop(b,a){if(desktop==null){desktopNode=currentNode;if(a==2){if((desktopNode.intelamt.user==null)||(desktopNode.intelamt.user=="")){editDeviceAmtSettings(desktopNode._id,connectDesktop);return}desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"));desktop.debugmode=debugmode;desktop.onStateChanged=onDesktopStateChange;desktop.m.bpp=(desktopsettings.encoding==1||desktopsettings.encoding==3)?1:2;desktop.m.useZRLE=(desktopsettings.encoding<3);desktop.m.showmouse=desktopsettings.showmouse;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id,16994,"*","*",0);desktop.contype=2}else{desktop=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("Desk"),serverPublicNamePort);desktop.debugmode=debugmode;desktop.m.debugmode=debugmode;desktop.attemptWebRTC=attemptWebRTC;desktop.onStateChanged=onDesktopStateChange;desktop.m.CompressionLevel=desktopsettings.quality;desktop.m.ScalingLevel=desktopsettings.scaling;desktop.m.FrameRateTimer=desktopsettings.framerate;desktop.m.onDisplayinfo=deskDisplayInfo;desktop.m.onScreenSizeChange=deskAdjust;desktop.Start(desktopNode._id);desktop.contype=1}}else{desktop.Stop();desktopNode=desktop=null}}function onDesktopStateChange(c,a){var d=a;if((d==3)&&(c.contype==2)){d++}var b=StatusStrs[d];if((desktop!=null)&&(desktop.webRtcActive==true)){b+=", WebRTC"}QH("deskstatus",b);switch(a){case 0:desktop.Stop();desktopNode=desktop=null;QV("termdisplays",false);if(fullscreen==true){deskToggleFull()}break;case 2:break;default:console.log("Unknown onDesktopStateChange state",a);break}updateDesktopButtons();deskAdjust();setTimeout(deskAdjust,50)}function showDesktopSettings(){if(xxdialogMode){return}applyDesktopSettings();updateDesktopButtons();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}function showDesktopSettingsChanged(){desktopsettings.encoding=d7desktopmode.value;desktopsettings.showfocus=d7showfocus.checked;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;desktopsettings.framerate=d7framelimiter.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();if(desktop){if(desktop.contype==1){if(desktop.State!=0){desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate)}}if(desktop.contype==2){if(desktop.State!=0){desktop.Stop();setTimeout(function(){connectDesktop(null,2)},50)}}}}function applyDesktopSettings(){var c="",b=(features&512)?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];for(var a in b){c+="<option value="+b[a]+">"+b[a]+"%</option>"}QH("d7bitmapquality",c);d7desktopmode.value=desktopsettings.encoding;d7showfocus.checked=desktopsettings.showfocus;d7showcursor.checked=desktopsettings.showmouse;d7bitmapquality.value=40;if(b.indexOf(parseInt(desktopsettings.quality))>=0){d7bitmapquality.value=desktopsettings.quality}d7bitmapscaling.value=desktopsettings.scaling;if(desktopsettings.framerate){d7framelimiter.value=desktopsettings.framerate}}var fullscreen=false;function deskAdjust(){var c=(Q("DeskParent").clientHeight-Q("Desk").clientHeight)/2;if(c<0){var a=Q("DeskParent").clientHeight,b=9999;if(desktop){b=(desktop.m.width/desktop.m.height)*a}QS("Desk")["max-height"]=a+"px";QS("Desk")["max-width"]=b+"px";c=0}else{QS("Desk")["max-height"]=null;QS("Desk")["max-width"]=null}QS("Desk")["margin-top"]=c+"px";QS("Desk")["margin-bottom"]=c+"px"}function toggleDeskTools(){if(xxdialogMode){return}if(QS("DeskTools").display=="none"){QV("DeskTools",true);Q("DeskTools").nodeid=currentNode._id;refreshDeskTools()}else{QV("DeskTools",false)}}function refreshDeskTools(){QV("DeskToolsRefreshButton",false);setTimeout(refreshDeskToolsEx,500);meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",true)}var deskTools={sort:1,msg:null};function sortProcess(a){deskTools.sort=a;showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(c,d){if(c.p>d.p){return 1}if(c.p<d.p){return(-1)}return 0}function sortProcessName(c,d){if(c.d>d.d){return 1}if(c.d<d.d){return(-1)}return 0}function showDeskToolsProcesses(c){deskTools.msg=c;if(c==null){QH("DeskToolsProcesses","");return}if(Q("DeskTools").nodeid!=c.nodeid){return}var d=[],g=null;try{g=JSON.parse(c.value)}catch(a){}console.log(g);if(g!=null){for(var f in g){d.push({p:parseInt(f),c:g[f].cmd,d:g[f].cmd.toLowerCase(),u:g[f].user})}if(deskTools.sort==0){d.sort(sortProcessPid)}else{if(deskTools.sort==1){d.sort(sortProcessName)}}var h="";for(var b in d){if(d[b].p!=0){h+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+d[b].p+'</div><a style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=stopProcess('+d[b].p+',"'+d[b].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(d[b].u?d[b].u:"")+"</div><div>"+d[b].c+"</div></div>"}}QH("DeskToolsProcesses",h)}}function deskSaveImage(){if(xxdialogMode||desktop==null||desktop.State!=3){return}var a=new Date(),b="Desktop-"+currentNode.name+"-"+a.getFullYear()+"-"+("0"+(a.getMonth()+1)).slice(-2)+"-"+("0"+a.getDate()).slice(-2)+"-"+("0"+a.getHours()).slice(-2)+"-"+("0"+a.getMinutes()).slice(-2);Q("Desk")["toBlob"](function(c){saveAs(c,b+".jpg")})}function deskDisplayInfo(e,a,c,d){var f=Q("termdisplays").value;if(a.length>0){var b="";for(var g in a){b+="<option"+((f==a[g])?" selected":"")+">"+a[g]+"</option>"}QH("termdisplays",b)}QV("termdisplays",a.length>0)}function deskGetDisplayNumbers(a){desktop.m.GetDisplayNumbers()}function deskSetDisplay(b){var a=0,c=Q("termdisplays").value;if(c=="All Displays"){a=65535}else{a=parseInt(c.substring(8))}desktop.m.SetDisplay(a)}function dmousedown(a){if((!xxdialogMode&&desktop!=null)&&Q("DeskControl").checked){desktop.m.mousedown(a)}}function dmouseup(a){if((!xxdialogMode&&desktop!=null)&&Q("DeskControl").checked){desktop.m.mouseup(a)}}function dmousemove(a){if((!xxdialogMode&&desktop!=null)&&Q("DeskControl").checked){desktop.m.mousemove(a)}}function dmousewheel(a){if((!xxdialogMode&&desktop!=null)&&Q("DeskControl").checked&&desktop.m.mousewheel){desktop.m.mousewheel(a);haltEvent(a);return true}return false}function drotate(a){if(!xxdialogMode&&desktop!=null){desktop.m.setRotation(desktop.m.rotation+a);deskAdjust();deskAdjust()}}function stopProcess(a,b){setDialogMode(2,"Process Control",3,stopProcessEx,"Stop process #"+a+' "'+b+'"?',a)}function stopProcessEx(a,b){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:b});setTimeout(refreshDeskTools,300)}var filesNode;function setupFiles(){var b=(filesNode==currentNode);filesNode=currentNode;var a=((filesNode.conn&1)!=0)?true:false;QE("p13Connect",a);if(((b==false)||(a==false))&&files){files.Stop();files=null}}function onFilesStateChange(c,a){p13Connect.value=(a==0)?"Connect":"Disconnect";var b=StatusStrs[a];if(files.webRtcActive==true){b+=", WebRTC"}Q("p13Status").textContent=b;switch(a){case 0:QH("p13files","");p13filetree=null;p13filetreelocation=[];QH("p13currentpath","");QE("p13FolderUp",false);p13setActions();if(files!=null){files.Stop();files=null}break;case 3:p13targetpath="";files.sendText({action:"ls",reqid:1,path:""});break;default:break}}function CreateRemoteFiles(b){var a={protocol:5};a.onFileUpdate=b;a.xxStateChange=function(c){};a.ProcessData=function(c){a.onFileUpdate(c)};return a}var autoConnectFilesTimer=null;function autoConnectFiles(a){if(autoConnectFilesTimer==null){autoConnectFilesTimer=setInterval(connectFiles,100)}else{clearInterval(autoConnectFilesTimer);autoConnectFilesTimer=null}}function connectFiles(a){if(!files){files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort);files.attemptWebRTC=attemptWebRTC;files.onStateChanged=onFilesStateChange;files.Start(filesNode._id)}else{files.Stop();files=null}p13clipboard=p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}var p13filetree=null;var p13targetpath=null;var p13filetreelocation=[];function p13gotFiles(b){if((b.length>0)&&(b.charCodeAt(0)!=123)){p13gotDownloadBinaryData(b);return}b=JSON.parse(decode_utf8(b));if(b.action=="download"){p13gotDownloadCommand(b);return}b.path=b.path.replace(/\//g,"\\");if((p13filetree!=null)&&(b.path==p13filetree.path)){var a=p13getCheckedNames();p13filetree=b;p13updateFiles(a)}else{var c=b.path.replace(/\//g,"\\"),d=p13targetpath.replace(/\//g,"\\");while((c.length>0)&&(c[0]=="\\")){c=c.substring(1)}while((d.length>0)&&(d[0]=="\\")){d=d.substring(1)}if((c==d)||((b.path=="\\")&&(p13targetpath==""))){p13filetree=b;p13updateFiles()}}}function p13getCheckedNames(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}return b}function p13updateFiles(b){var l="",m="",c="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",j="Root";var u=p13filetree.path.split("\\");p13filetreelocation=[];for(var n in u){if(u[n]!=""){p13filetreelocation.push(u[n])}}for(var n in p13filetreelocation){c+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(n)+1)+")>"+p13filetreelocation[n]+"</a>"}var q=p13filetreelocation.join("/");var e=p13sort_files(p13filetree.dir);for(var n in e){var d=e[n],p=d.n,s;s=p;if(p.length>70){s='<span title="'+EscapeHtml(p)+'">'+EscapeHtml(p.substring(0,70))+"...</span>"}else{s=EscapeHtml(p)}p=EscapeHtml(p);var g="";if(d.s!=null){g=getFileSizeStr(d.s)}var k="";if(d.t<3){var r="",t="";k="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'> <span style=float:right title=\""+t+'">'+r+"</span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+s+"</a></span></div>"}else{var o=s;if(d.s>0){o='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(q+"/"+p)+"','"+encodeURIComponent(p)+"',"+d.s+')">'+s+"</a>"}k="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='"+d.nx+"'> <span style=float:right;padding-right:4px>"+g+"</span><span><div class=fileIcon"+d.t+"></div>"+o+"</span></div>"}if(d.t<3){l+=k}else{m+=k}}QH("p13files",l+m);QH("p13currentpath",c);QE("p13FolderUp",p13filetreelocation.length!=0);if(b!=null){var a=document.getElementsByName("fd");for(var n=0;n<a.length;n++){if(b.indexOf(p13filetree.dir[a[n].value].n)>=0){a[n].checked=true}}}p13setActions()}function p13folderset(a){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[a].n).split("\\").join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(a){if(a==null){p13filetreelocation.pop()}else{while(p13filetreelocation.length>a){p13filetreelocation.pop()}}p13targetpath=p13filetreelocation.join("/");files.sendText({action:"ls",reqid:1,path:p13targetpath})}var p13sortorder;function p13sort_filename(c,d){if(c.ln>d.ln){return(1*p13sortorder)}if(c.ln<d.ln){return(-1*p13sortorder)}return 0}function p13sort_timestamp(c,d){if(c.d>d.d){return(1*p13sortorder)}if(c.d<d.d){return(-1*p13sortorder)}return 0}function p13sort_bysize(c,d){if(c.s==d.s){return p13sort_filename(c,d)}return(((c.s-d.s))*p13sortorder)}function p13sort_files(a){var c=[],d=Q("p13sortdropdown").value;for(var b in a){a[b].nx=b;if(a[b].s==null){a[b].s=0}if(a[b].n==null){a[b].n=b}a[b].ln=a[b].n.toLowerCase();c.push(a[b])}p13sortorder=1;if(d>3){p13sortorder=-1;d-=3}if(d==1){c.sort(p13sort_filename)}else{if(d==2){c.sort(p13sort_bysize)}else{if(d==3){c.sort(p13sort_timestamp)}}}return c}function p13setActions(){if(p13filetree==null){QE("p13DeleteFileButton",false);QE("p13NewFolderButton",false);QE("p13UploadButton",false);QE("p13RenameFileButton",false);QE("p13SelectAllButton",false);Q("p13SelectAllButton").value="All";QE("p13RefreshButton",false);QE("p13CutButton",false);QE("p13CopyButton",false);QE("p13PasteButton",false)}else{var a=p13getFileSelCount(),c=p13getFileCount(),b=p13getFileSelCount(false);var d=((currentNode.agent.id>0)&&(currentNode.agent.id<5));QE("p13DeleteFileButton",(a>0)&&((p13filetreelocation.length>0)||(d==false)));QE("p13NewFolderButton",((p13filetreelocation.length>0)||(d==false)));QE("p13UploadButton",((p13filetreelocation.length>0)||(d==false)));QE("p13RenameFileButton",(a==1)&&((p13filetreelocation.length>0)||(d==false)));QE("p13SelectAllButton",c>0);Q("p13SelectAllButton").value=(a>0?"None":"All");QE("p13RefreshButton",true);QE("p13CutButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13CopyButton",(a>0)&&(a==b)&&((p13filetreelocation.length>0)||(d==false)));QE("p13PasteButton",((p13filetreelocation.length>0)||(d==false))&&((p13clipboard!=null)&&(p13clipboard.length>0)))}}function p13getFileSelCount(d){var a=0;var b=document.getElementsByName("fd");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function p13getFileCount(){var a=0;var b=document.getElementsByName("fd");return b.length}function p13selectallfile(){var c=(p13getFileSelCount()==0),a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){a[b].checked=c}p13setActions()}function p13createfolder(){setDialogMode(2,"New Folder",3,p13createfolderEx,"<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />");focusTextBox("p13renameinput");p13fileNameCheck()}function p13createfolderEx(){files.sendText({action:"mkdir",reqid:1,path:p13filetreelocation.join("/")+"/"+Q("p13renameinput").value});p13folderup(999)}function p13deletefile(){var a=getFileSelCount();setDialogMode(2,"Delete",3,p13deletefileEx,(a>1)?("Delete "+a+" selected items?"):("Delete selected item?"))}function p13deletefileEx(){var b=[],a=document.getElementsByName("fd");for(var c=0;c<a.length;c++){if(a[c].checked){b.push(p13filetree.dir[a[c].value].n)}}files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:b});p13folderup(999)}function p13renamefile(){var c,a=document.getElementsByName("fd");for(var b=0;b<a.length;b++){if(a[b].checked){c=p13filetree.dir[a[b].value].n}}setDialogMode(2,"Rename",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+c+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:c});focusTextBox("p13renameinput");p13fileNameCheck()}function p13renamefileEx(a,c){c.newname=Q("p13renameinput").value;files.sendText(c);p13folderup(999)}function p13fileNameCheck(a){var b=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",b);if((b==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function p13uploadFile(){setDialogMode(2,"Upload File",3,p13uploadFileEx,"<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p13uploadinput')\" />");updateUploadDialogOk("p13uploadinput")}function p13uploadFileEx(){p13doUploadFiles(Q("p13uploadinput").files)}var p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(b){var a=document.getElementsByName("fd");p13clipboard=[];p13clipboardCut=b,p13clipboardFolder=p13targetpath;for(var c=0;c<a.length;c++){if((a[c].checked)&&(a[c].attributes.file.value=="3")){p13clipboard.push(p13filetree.dir[a[c].value].n)}}p13updateClipview()}function p13pasteFile(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Confim "+(p13clipboardCut==0?"copy":"move")+" of "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" to this location?"}setDialogMode(2,"Paste",3,p13pasteFileEx,a)}function p13pasteFileEx(){files.sendText({action:(p13clipboardCut==0?"copy":"move"),reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard});p13folderup(999);if(p13clipboardCut==1){p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;p13updateClipview()}}function p13updateClipview(){var a="";if((p13clipboard!=null)&&(p13clipboard.length>0)){a="Holding "+p13clipboard.length+" entrie"+((p13clipboard.length>1)?"s":"")+" for "+(p13clipboardCut==0?"copy":"move")+", <a onclick=p13clearClip() style=cursor:pointer>Clear</a>."}QH("p13bottomstatus",a);p13setActions()}function p13clearClip(){p13clipboard=null;p13clipboardFolder=null;p13clipboardCut=0;p13updateClipview()}function updateUploadDialogOk(a){QE("idx_dlgOkButton",Q(a).value!="")}function getFileSelCount(d){var a=0;var b=document.getElementsByName("fc");for(var c=0;c<b.length;c++){if((b[c].checked)&&((d!=false)||(b[c].attributes.file.value=="3"))){a++}}return a}function getFileCount(){var a=0;var b=document.getElementsByName("fc");return b.length}var downloadFile;function p13downloadfile(a,b,c){if(xxdialogMode||downloadFile||!files){return}downloadFile={path:decodeURIComponent(a),file:decodeURIComponent(b),size:c,tsize:0,data:"",state:0,id:Math.random()};files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path});setDialogMode(2,"Download File",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+c+" />")}function p13downloadFileCancel(){setDialogMode(0);files.sendText({action:"download",sub:"cancel",id:downloadFile.id});downloadFile=null}function p13gotDownloadCommand(a){if((downloadFile==null)||(a.id!=downloadFile.id)){return}if(a.sub=="start"){downloadFile.state=1;files.sendText({action:"download",sub:"startack",id:downloadFile.id})}else{if(a.sub=="cancel"){downloadFile=null;setDialogMode(0)}}}function p13gotDownloadBinaryData(a){if(!downloadFile||downloadFile.state==0){return}if(a.length>4){downloadFile.tsize+=(a.length-4);downloadFile.data+=a.substring(4);Q("d2progressBar").value=downloadFile.tsize}if((ReadInt(a,0)&1)!=0){saveAs(data2blob(downloadFile.data),downloadFile.file);downloadFile=null;setDialogMode(0)}else{files.sendText({action:"download",sub:"ack",id:downloadFile.id})}}var uploadFile;function p13doUploadFiles(a){if(xxdialogMode){return}uploadFile={};uploadFile.xpath=p13filetreelocation.join("/");uploadFile.xfiles=a;uploadFile.xfilePtr=-1;setDialogMode(2,"Upload File",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />");p13uploadReconnect()}function onFileUploadStateChange(b,a){switch(a){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break;default:console.log("Unknown onFileUploadStateChange state",a);break}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort);uploadFile.ws.attemptWebRTC=false;uploadFile.ws.ctrlMsgAllowed=false;uploadFile.ws.onStateChanged=onFileUploadStateChange;uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var a=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",a.name);Q("d2progressBar").max=a.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader();uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;uploadFile.ws.sendText({action:"upload",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:a.name,size:uploadFile.xdata.byteLength})};uploadFile.xreader.readAsArrayBuffer(a)}else{p13uploadFileCancel()}}function p13uploadFileCancel(a,b){if(uploadFile!=null){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}uploadFile=null}setDialogMode(0)}function p13gotUploadData(b){var a=JSON.parse(b);if((uploadFile==null)||(parseInt(uploadFile.xfilePtr)!=parseInt(a.reqid))){return}if(a.action=="uploadstart"){p13uploadNextPart(false);for(var c=0;c<8;c++){p13uploadNextPart(true)}}else{if(a.action=="uploadack"){p13uploadNextPart(false)}else{if(a.action=="uploaderror"){p13uploadFileCancel()}}}}function p13uploadNextPart(c){var a=uploadFile.xdata;var e=uploadFile.xptr;var d=uploadFile.xptr+4096;if(d>a.byteLength){if(c==true){return}d=a.byteLength}if(e==a.byteLength){if(uploadFile.ws!=null){uploadFile.ws.Stop();uploadFile.ws=null}if(uploadFile.xfiles.length>uploadFile.xfilePtr+1){p13uploadReconnect()}else{p13uploadFileCancel()}}else{var b=a.slice(e,d);uploadFile.ws.send(b);uploadFile.xptr=d;Q("d2progressBar").value=d}}var currentMesh;function p20updateMesh(){if(currentMesh==null){return}QH("p20meshName",EscapeHtml(currentMesh.name));var e="Unknown #"+currentMesh.mtype;var d=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(currentMesh.mtype==1){e="Intel® AMT group"}if(currentMesh.mtype==2){e="Software agent group"}var k="";k+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(d&1)!=0));k+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&¤tMesh.desc!="")?EscapeHtml(currentMesh.desc):"<i>None</i>"),"p20editmesh(2)",(d&1)!=0));k+=addHtmlValue("Type",e);k+="<br style=clear:both><br>";var b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()];if(b&&((b.rights&2)!=0)){k+="<div style=margin-bottom:6px><a onclick=p20showAddMeshUserDialog() style=cursor:pointer><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a></div>"}k+='<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th></tr>';var a=1,h=[];for(var c in currentMesh.links){h.push({id:c,name:c.split("/")[2],rights:currentMesh.links[c].rights})}h.sort(function(l,m){if(l.name>m.name){return 1}if(l.name<m.name){return -1}return 0});for(var c in h){var j="",g="Partial Rights",f=h[c].rights;if(f==4294967295){g="Full Administrator"}else{if(f==0){g="No Rights"}}if((c!=userinfo._id)&&(d==4294967295||(((d&2)!=0)))){j='<a onclick=p20deleteUser(event,"'+encodeURIComponent(h[c].id)+'") title="Remote user rights to this mesh" style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'}k+='<tr onclick=p20viewuser("'+encodeURIComponent(h[c].id)+'") style=height:32px;cursor:pointer'+(((a%2)==0)?";background-color:#DDD":"")+"><td>";k+="<div style=float:right>"+j+"</div><div style=float:right;padding-right:4px>"+g+"</div><div class=m2></div><div> "+h[c].name+"<div></div></div>";k+="</td></tr>";++a}k+="</tbody></table>";if(d==4294967295){k+="<div style=font-size:small;text-align:right;margin-top:6px><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Mesh</a></span></div>"}QH("p20info",k)}function p20showDeleteMeshDialog(){if(xxdialogMode){return}var a='Are you sure you want to delete mesh "'+EscapeHtml(currentMesh.name)+'"? Deleting the mesh will also delete all information about computers within this mesh.<br /><br />';a+="<input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm";setDialogMode(2,"Delete Mesh",3,p20showDeleteMeshDialogEx,a);p20validateDeleteMeshDialog()}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(a,b){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(a){if(xxdialogMode){return}var b=addHtmlValue("Name","<input id=dp20meshname style=width:170px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");b+=addHtmlValue("Description","<input id=dp20meshdesc style=width:170px maxlength=1024 onkeyup=p20editmeshValidate() />");setDialogMode(2,"Edit Device Group",3,p20editmeshEx,b);Q("dp20meshname").value=currentMesh.name;if(currentMesh.desc){Q("dp20meshdesc").value=currentMesh.desc}p20editmeshValidate();if(a==2){Q("dp20meshdesc").focus()}else{Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",Q("dp20meshname").value.length>0)}function p20showAddMeshUserDialog(){if(xxdialogMode){return}var a=addHtmlValue("User","<input id=dp20username style=width:170px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");a+='<div style="border:2px groove gray;background-color:white;max-height:80px;overflow-y:scroll">';a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Device Group<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Device Group Users<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Device Group Computers<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes<br>";a+="<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remoteview>Remote View Only<br>";a+="</div>";setDialogMode(2,"Add User to Mesh",3,p20showAddMeshUserDialogEx,a);p20validateAddMeshUserDialog();Q("dp20username").focus()}function p20validateAddMeshUserDialog(){var a=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;QE("idx_dlgOkButton",(Q("dp20username").value.length>0));QE("p20fulladmin",a==4294967295);QE("p20editmesh",(!Q("p20fulladmin").checked)&&(a==4294967295));QE("p20manageusers",!Q("p20fulladmin").checked);QE("p20managecomputers",!Q("p20fulladmin").checked);QE("p20remotecontrol",!Q("p20fulladmin").checked);QE("p20meshagentconsole",!Q("p20fulladmin").checked);QE("p20meshserverfiles",!Q("p20fulladmin").checked);QE("p20wakedevices",!Q("p20fulladmin").checked);QE("p20editnotes",!Q("p20fulladmin").checked);QE("p20remoteview",!Q("p20fulladmin").checked)}function p20showAddMeshUserDialogEx(){var a=0;if(Q("p20fulladmin").checked==true){a=4294967295}else{if(Q("p20editmesh").checked==true){a+=1}if(Q("p20manageusers").checked==true){a+=2}if(Q("p20managecomputers").checked==true){a+=4}if(Q("p20remotecontrol").checked==true){a+=8}if(Q("p20meshagentconsole").checked==true){a+=16}if(Q("p20meshserverfiles").checked==true){a+=32}if(Q("p20wakedevices").checked==true){a+=64}if(Q("p20editnotes").checked==true){a+=128}if(Q("p20remoteview").checked==true){a+=256}}meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,username:Q("dp20username").value,meshadmin:a})}function p20viewuser(e){if(xxdialogMode){return}e=decodeURIComponent(e);var d="",b=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights,c=currentMesh.links[e].rights;if(c==4294967295){d=", Full Administrator"}else{if((c&1)!=0){d+=", Edit Device Group"}if((c&2)!=0){d+=", Manage Device Group Users"}if((c&4)!=0){d+=", Manage Device Group Computers"}if((c&8)!=0){d+=", Remote Control"}if((c&16)!=0){d+=", Agent Console"}if((c&32)!=0){d+=", Server Files"}if((c&64)!=0){d+=", Wake Devices"}if((c&128)!=0){d+=", Edit Notes"}if((c&256)!=0){d+=", Remote View Only"}}d=d.substring(2);if(d==""){d="No Rights"}var a=1,f=addHtmlValue("User",e.split("/")[2]);f+=addHtmlValue("Permissions",d);if((("user/"+domain+"/"+userinfo.name.toLowerCase())!=e)&&(b==4294967295||(((b&2)!=0)&&(c!=4294967295)))){a+=4}setDialogMode(2,"Mesh User",a,p20viewuserEx,f,e)}function p20viewuserEx(a,b){if(a!=2){return}setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,"Confirm removal of user "+b.split("/")[2]+"?",b)}function p20deleteUser(a,b){haltEvent(a);p20viewuserEx(2,decodeURIComponent(b))}function p20viewuserEx2(a,b){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:b})}var xxcurrentView=-1;function go(b){if(xxdialogMode||xxcurrentView==b){return}updateFooterMenu();setDialogMode(0);for(var a=0;a<32;a++){QV("p"+a,a==b)}xxcurrentView=b}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-300)/2))+"px");deskAdjust();deskAdjust()}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return a.test(b)}function reload(){window.location.href=window.location.href}function getNodeFromId(b){for(var a in nodes){if(nodes[a]._id==b){return nodes[a]}}return null}function addHtmlValue(a,b){return"<table><td style=width:120px>"+a+"<td><b>"+b+"</b></table>"}function addHtmlValue2(a,b){return"<div><div style=display:inline-block;float:right>"+b+"</div><div style=display:inline-block>"+a+"</div></div>"}function addLink(b,a){return"<a style=cursor:pointer;color:darkblue;text-decoration:none onclick='"+a+"'>♦ "+b+"</a>"}function addLinkConditional(d,b,a){if(a){return addLink(d,b)}return d}function passwordcheck(a){var b=/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/;return b.test(a)}function getFileSizeStr(a){if(a==1){return"1 byte"}return""+a+" bytes"}function joinPaths(){var c=[];for(var a in arguments){var b=arguments[a];if((b!=null)&&(b!="")){while(b.endsWith("/")||b.endsWith("\\")){b=b.substring(0,b.length-1)}while(b.startsWith("/")||b.startsWith("\\")){b=b.substring(1)}c.push(b)}}return c.join("/")}function focusTextBox(a){setTimeout(function(){Q(a).selectionStart=Q(a).selectionEnd=65535;Q(a).focus()},0)}var isFilenameValid=(function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,d=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function a(e){return b.test(e)&&!c.test(e)&&!d.test(e)&&(e[0]!=".")}})();</script></body></html>
\ No newline at end of file
views/default-morecss.handlebars
deleted
-6639
@@ -1,6639 +0,0 @@
1
-<!DOCTYPE html>
2
-<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
3
-<head>
4
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
5
- <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
6
- <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0" />
7
- <meta name="apple-mobile-web-app-capable" content="yes" />
8
- <meta name="format-detection" content="telephone=no" />
9
- <link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS" />
10
- <link type="text/css" href="styles/ol.css" media="screen" rel="stylesheet" title="CSS" />
11
- <link type="text/css" href="styles/ol3-contextmenu.min.css" media="screen" rel="stylesheet" title="CSS" />
12
- <script type="text/javascript" src="scripts/common-0.0.1.js"></script>
13
- <script type="text/javascript" src="scripts/meshcentral.js"></script>
14
- <script type="text/javascript" src="scripts/amt-0.2.0.js"></script>
15
- <script type="text/javascript" src="scripts/amt-wsman-0.2.0.js"></script>
16
- <script type="text/javascript" src="scripts/amt-desktop-0.0.2.js"></script>
17
- <script type="text/javascript" src="scripts/amt-terminal-0.0.2.js"></script>
18
- <script type="text/javascript" src="scripts/zlib.js"></script>
19
- <script type="text/javascript" src="scripts/zlib-inflate.js"></script>
20
- <script type="text/javascript" src="scripts/zlib-adler32.js"></script>
21
- <script type="text/javascript" src="scripts/zlib-crc32.js"></script>
22
- <script type="text/javascript" src="scripts/amt-redir-ws-0.1.0.js"></script>
23
- <script type="text/javascript" src="scripts/amt-wsman-ws-0.2.0.js"></script>
24
- <script type="text/javascript" src="scripts/agent-redir-ws-0.1.0.js"></script>
25
- <script type="text/javascript" src="scripts/agent-redir-rtc-0.1.0.js"></script>
26
- <script type="text/javascript" src="scripts/agent-desktop-0.0.2.js"></script>
27
- <script type="text/javascript" src="scripts/qrcode.min.js"></script>
28
- <script keeplink=1 type="text/javascript" src="scripts/charts.js"></script>
29
- <script keeplink=1 type="text/javascript" src="scripts/filesaver.1.1.20151003.js"></script>
30
- <script keeplink=1 type="text/javascript" src="scripts/ol.js"></script>
31
- <script keeplink=1 type="text/javascript" src="scripts/ol3-contextmenu.js"></script>
32
- <title>MeshCentral</title>
33
-</head>
34
-<body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none">
35
- <!-- right click menu -->
36
- <div id="contextMenu" class="contextMenu" style="display:none">
37
- <div id="cxinfo" class="cmtext" onclick="cmaction(1)"><b>Information</b></div>
38
- <div id="cxdesktop" class="cmtext" onclick="cmaction(3)">Desktop</div>
39
- <div id="cxterminal" class="cmtext" onclick="cmaction(2)">Terminal</div>
40
- <div id="cxfiles" class="cmtext" onclick="cmaction(4)">Files</div>
41
- <div id="cxevents" class="cmtext" onclick="cmaction(5)">Events</div>
42
- <div id="cxconsole" class="cmtext" onclick="cmaction(6)">Console</div>
43
- <hr id="cxmgroupsplit" />
44
- <div id="cxmdesktop" class="cmtext" onclick="cmaction(7)" style=display:none>Multi-Desktop</div>
45
- </div>
46
- <div id="meshContextMenu" class="contextMenu" style="display: none; min-width: 0px">
47
- <div id="cxselectall" class="cmtext" onclick="cmmeshaction(1)">Select All</div>
48
- <div id="cxselectnone" class="cmtext" onclick="cmmeshaction(2)">Select None</div>
49
- <hr id="cxmgroupsplit2" style=display:none />
50
- <div id="cxmmdesktop" class="cmtext" style=display:none onclick="cmmeshaction(3)">Multi-Desktop</div>
51
- </div>
52
- <!-- main page -->
53
- <div id=container style=max-height:100vh;position:relative>
54
- <div id="notifiyBox" class="notifiyBox" style="display:none"></div>
55
- <div id=mastheadx></div>
56
- <div id=masthead class=noselect style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden">
57
- <div style="float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px">
58
- <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong>
59
- </div>
60
- <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px">
61
- <strong><font style="font-size:14px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong>
62
- </div>
63
- <div style="float:right">
64
- <div id=notificationCount onclick="clickNotificationIcon()" class="unselectable" style="display:none;min-width:28px;font-size:20px;border-radius:5px;background-color:lightblue;text-align:center;margin:8px;cursor:pointer;padding:4px" title="Click to view current notifications">0</div>
65
- </div>
66
- <p id="logoutControl">{{{logoutControl}}}</p>
67
- </div>
68
- <div id="page_leftbar" style="height:calc(100vh - 66px);width:90px;position:absolute;z-index:1000;background:#113962;background:linear-gradient(to bottom, #104893 0%,#113962 100%);color:white;display:none">
69
- <div style="height:16px"></div>
70
- <div id=LeftMenuMyDevices class="lbbutton lbbuttonsel" title="My Devices" onclick=go(1)>
71
- <div class="lb2" style="position:absolute;top:6px;left:6px"></div>
72
- </div>
73
- <div id=LeftMenuMyAccount class="lbbutton" title="My Account" onclick=go(2)>
74
- <div class="lb1" style="position:absolute;top:6px;left:6px"></div>
75
- </div>
76
- <div id=LeftMenuMyEvents class="lbbutton" title="My Events" onclick=go(3)>
77
- <div class="lb3" style="position:absolute;top:6px;left:6px"></div>
78
- </div>
79
- <div id=LeftMenuMyFiles class="lbbutton" title="My Files" onclick=go(5)>
80
- <div class="lb4" style="position:absolute;top:6px;left:6px"></div>
81
- </div>
82
- <div id=LeftMenuMyUsers class="lbbutton" title="My Users" onclick=go(4)>
83
- <div class="lb5" style="position:absolute;top:6px;left:6px"></div>
84
- </div>
85
- <div id=LeftMenuMyServer class="lbbutton" title="My Server" onclick=go(6) style="display:none">
86
- <div class="lb6" style="position:absolute;top:6px;left:6px"></div>
87
- </div>
88
- </div>
89
- <div id="page_content" style="max-height:calc(100vh - 130px)">
90
- <div id=topbarmaster>
91
- <div id=topbar class=noselect>
92
- <div>
93
- <div style="position:relative">
94
- <div style="position:absolute;top:3px;right:6px">
95
- <span title="Toggle full width" style="cursor:pointer;color:white" onclick="toggleFullScreen(1)">↔</span>
96
- </div>
97
- <table id=MainMenuSpan style=width:100%;height:22px cellpadding=0 cellspacing=0 class=style1>
98
- <tr>
99
- <td id=MainMenuMyDevices style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(1)>My Devices</td>
100
- <td id=MainMenuMyAccount style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(2)>My Account</td>
101
- <td id=MainMenuMyEvents style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(3)>My Events</td>
102
- <td id=MainMenuMyFiles style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(5)>My Files</td>
103
- <td id=MainMenuMyUsers style=width:100px;height:24px;cursor:pointer;display:none class=style3x onclick=go(4)>My Users</td>
104
- <td id=MainMenuMyServer style=width:100px;height:24px;cursor:pointer;display:none class=style3x onclick=go(6)>My Server</td>
105
- <td class=style3 style="text-align:right;height:24px"> </td>
106
- </tr>
107
- </table>
108
- <div id=MainSubMenuSpan style=display:none>
109
- <table id=MainSubMenu style=width:100%;height:22px cellpadding=0 cellspacing=0 class=style1>
110
- <tr>
111
- <td id=MainDev style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(10)>General</td>
112
- <td id=MainDevDesktop style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(11)>Desktop</td>
113
- <td id=MainDevTerminal style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(12)>Terminal</td>
114
- <td id=MainDevFiles style=width:100px;height:24px;cursor:pointer;display:none class=style3x onclick=go(13)>Files</td>
115
- <td id=MainDevEvents style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(16)>Events</td>
116
- <td id=MainDevAmt style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(14)>Intel® AMT</td>
117
- <td id=MainDevConsole style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(15)>Console</td>
118
- <td class=style3 style=height:24px> </td>
119
- </tr>
120
- </table>
121
- </div>
122
- <div id=MeshSubMenuSpan style=display:none>
123
- <table id=MeshSubMenu style=width:100%;height:22px cellpadding=0 cellspacing=0 class=style1>
124
- <tr>
125
- <td id=MeshGeneral style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(20)>General</td>
126
- <td class=style3 style=height:24px> </td>
127
- </tr>
128
- </table>
129
- </div>
130
- <div id=UserSubMenuSpan style=display:none>
131
- <table id=UserSubMenu style=width:100%;height:22px cellpadding=0 cellspacing=0 class=style1>
132
- <tr>
133
- <td id=UserGeneral style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(30)>General</td>
134
- <td id=UserEvents style=width:100px;height:24px;cursor:pointer class=style3x onclick=go(31)>Events</td>
135
- <td class=style3 style=height:24px> </td>
136
- </tr>
137
- </table>
138
- </div>
139
- <div id=UserDummyMenuSpan>
140
- <table id=UserDummyMenu style=width:100%;height:22px cellpadding=0 cellspacing=0 class=style1>
141
- <tr><td class=style3 style="text-align:right;height:24px"> </td></tr>
142
- </table>
143
- </div>
144
- </div>
145
- </div>
146
- </div>
147
- </div>
148
- <div id="column_l">
149
- <div id=p0 style=display:none>
150
- <div id=p0message style=margin:50px;text-align:center>Server disconnected, <href onclick=reload() style=cursor:pointer><u>click to reconnect</u></href>.</div>
151
- </div>
152
- <div id=p1 style=display:none>
153
- <div style="float:right" id="devListToolbarViewIcons">
154
- <div id=devViewButton1 class="viewSelector" onclick=onDeviceViewChange(1) title="Columns"><div class="viewSelector2"></div></div>
155
- <div id=devViewButton2 class=viewSelector onclick=onDeviceViewChange(2) title="List"><div class="viewSelector1"></div></div>
156
- <div id=devViewButton3 class=viewSelector onclick=onDeviceViewChange(3) title="Desktops"><div class="viewSelector3"></div></div>
157
- <div id=devViewButton4 class=viewSelector onclick=onDeviceViewChange(4) title="Map"><div class="viewSelector4"></div></div>
158
- </div><div><h1>My Devices</h1></div>
159
- <table style=width:100%;height:24px;background-color:#d3d9d6;vertical-align:middle;border-spacing:0>
160
- <tr>
161
- <td class=h1></td>
162
- <td id=devListToolbar class=style14>
163
- <input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All" />
164
- <input type=button id=GroupActionButton disabled="disabled" value="Group Action" onclick=groupActionFunction() />
165
- <input id=SearchInput type=text style=width:120px placeholder=Filter onchange=masterUpdate(5) onkeyup=masterUpdate(5) autocomplete=off onfocus=onSearchFocus(1) onblur=onSearchFocus(0) />
166
- <input type=checkbox id=RealNameCheckBox onclick=onRealNameCheckBox() /><span title="Show devices operating system name">OS Name</span>
167
- </td>
168
- <td id=kvmListToolbar class=style14 style=height:100%>
169
- <input type="button" onclick="connectAllKvmFunction()" value="Connect All" />
170
- <input type="button" onclick="disconnectAllKvmFunction()" value="Disconnect All" />
171
- <input type="checkbox" id="autoConnectDesktopCheckbox" onclick="autoConnectDesktops(event)" title="Automatic connect" />Auto
172
- <input type="button" onclick="showMultiDesktopSettings()" value="Settings" />
173
- </td>
174
- <td id=devMapToolbar class=style14 style=height:100%>
175
- <input type=text id=mapSearchLocation placeholder="Search Location" onfocus=onMapSearchFocus(1) onblur=onMapSearchFocus(0) />
176
- <input type=button value=Search title="Search for location" onclick=getSearchLocation() />
177
- <input type=button id=refreshmap title="Reset map view" value=Reset style=margin-left:5px onclick=refreshMap(false,true) />
178
- </td>
179
- <td class="auto-style1" style=height:100%>
180
- <div style="float:right;display:none" id=devListToolbarView>
181
- View
182
- <select id=viewselect onchange=onDeviceViewChange()>
183
- <option value=1>Columns</option>
184
- <option value=2>List</option>
185
- <option value=3>Desktops</option>
186
- <option id=viewselectmapoption value=4>Map</option>
187
- </select>
188
- </div>
189
- <div style=float:right id=devListToolbarSort>
190
- Sort
191
- <select id=sortselect onchange=masterUpdate(6)>
192
- <option>Group</option>
193
- <option>Power</option>
194
- <option>Device</option>
195
- <option>Tags</option>
196
- </select>
197
-
198
- </div>
199
- <div style=float:right id=devListToolbarSize>
200
- Size
201
- <select id=sizeselect onchange=onDeviceViewChange()>
202
- <option value=0>Small</option>
203
- <option value=1>Medium</option>
204
- <option value=2>Large</option>
205
- </select>
206
-
207
- </div>
208
- </td>
209
- <td class=h2></td>
210
- </tr>
211
- </table>
212
- <div id=NoMeshesPanel style=display:none>
213
- <table style="width:100%;padding:20px">
214
- <tr>
215
- <td valign="top" style="width: 50px">
216
- <img src="images/info.png" height="48" width="47" />
217
- </td>
218
- <td>
219
- To get started, <a onclick=account_createMesh() style=cursor:pointer><strong>click here to create a device group</strong></a>.
220
- </td>
221
- </tr>
222
- </table>
223
- </div>
224
- <div id="xdevices" style="max-height:calc(100vh - 239px);overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch"></div>
225
- <div id="xdevicesmap" style="height:calc(100vh - 239px);width:100%;overflow:hidden;position:relative">
226
- <div id=xmapSearchResultsDlg style="position:absolute;display:none;max-height:280px;left:5px;top:5px;max-width:250px;z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666">
227
- <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0">
228
- <div id=xmapSearchClose style=float:right;padding:5px;cursor:pointer onclick=mapCloseSearchWindow()><b>X</b></div>
229
- <div style=padding:5px>Location Results</div>
230
- <div style=width:100%;margin:6px></div>
231
- </div>
232
- <div id=xmapSearchResults style=margin:6px></div>
233
- </div>
234
- </div>
235
- <div id="xmap-info-window" style="text-shadow: 0px 0px 15px #FFF"></div>
236
- </div>
237
- <div id=p2 style="display:none">
238
- <h1>My Account</h1>
239
- <div id="p2AccountActions">
240
- <p><strong><img alt="" width=150 height=103 src=images/mainaccount.jpg style=margin-bottom:10px;margin-right:20px;float:right />Account actions</strong></p>
241
- <p style="margin-left:40px">
242
- <span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a><br /></span>
243
- <span id="otpAuth" style="display:none"><a onclick="account_addOtp()" style="cursor:pointer">Add 2-step login</a><br /></span>
244
- <span id="otpAuthRemove" style="display:none"><a onclick="account_removeOtp()" style="cursor:pointer">Remove 2-step login</a><br /></span>
245
- <a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a><br />
246
- <a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><br />
247
- <a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a><br />
248
- </p>
249
- <br style=clear:both />
250
- </div>
251
- <strong>Device Groups</strong>
252
- ( <a onclick=account_createMesh() style=cursor:pointer><img height=12 src="images/icon-addnew.png" width=12 border=0 /> New</a> )
253
- <br /><br />
254
- <div id=p2meshes></div>
255
- <div id=p2noMeshFound style=margin-left:40px;display:none>No device groups. <a onclick=account_createMesh() style=cursor:pointer><strong>Get started here!</strong></a></div>
256
- <br style=clear:both />
257
- </div>
258
- <div id=p3 style=display:none>
259
- <h1>My Events</h1>
260
- <table style=width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0>
261
- <tr>
262
- <td class=h1></td>
263
- <td> <input id=p2deleteall type=button onclick=showDeleteAllEventsDialog() style=display:none value="Delete All..." /></td>
264
- <td class=auto-style1>
265
- Show
266
- <select id=p3limitdropdown onchange=refreshEvents()>
267
- <option value=60>Last 60</option>
268
- <option value=120>Last 120</option>
269
- <option value=250>Last 250</option>
270
- <option value=500>Last 500</option>
271
- <option value=1000>Last 1000</option>
272
- </select>
273
- </td>
274
- <td class=h2></td>
275
- </tr>
276
- </table>
277
- <div id=p3events style="height:calc(100vh - 243px);overflow-y:scroll"></div>
278
- </div>
279
- <div id=p4 style=display:none>
280
- <h1>My Users</h1>
281
- <table style=width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0>
282
- <tr>
283
- <td class=h1></td>
284
- <td class=style14>
285
-
286
- <input type=button onclick=showCreateNewAccountDialog() value="New Account..." />
287
- <input id=UserSearchInput type=text style=width:120px placeholder=Filter onchange=onUserSearchInputChanged() onkeyup=onUserSearchInputChanged() autocomplete=off onfocus=onUserSearchFocus(1) onblur=onUserSearchFocus(0) />
288
- </td>
289
- <td class=h2></td>
290
- </tr>
291
- </table>
292
- <div id="p3users" style="max-height:calc(100vh - 243px);overflow-y:auto"></div>
293
- </div>
294
- <div id=p5 style=display:none>
295
- <h1>My Files</h1>
296
- <table id="p5toolbar" style="width:100%" cellpadding="0" cellspacing="0">
297
- <tr>
298
- <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign=bottom>
299
- <div id="p5rightOfButtons" style="float:right;margin-top:3px"></div>
300
- <div>
301
- <input type=button id=p5FolderUp disabled="disabled" onclick="p5folderup();" value="Up" />
302
- <input type=button id=p5SelectAllButton disabled="disabled" onclick="p5selectallfile();" value="Select All" onkeypress="return false;" onkeydown="return false;" />
303
- <input type=button id=p5RenameFileButton disabled="disabled" value="Rename" onclick="p5renamefile();" onkeypress="return false;" onkeydown="return false;" />
304
- <input type=button id=p5DeleteFileButton disabled="disabled" value="Delete" onclick="p5deletefile();" onkeypress="return false;" onkeydown="return false;" />
305
- <input type=button id=p5NewFolderButton disabled="disabled" value="New Folder" onclick="p5createfolder();" onkeypress="return false;" onkeydown="return false;" />
306
- <input type=button id=p5UploadButton disabled="disabled" value="Upload" onclick="p5uploadFile()" onkeypress="return false;" onkeydown="return false;" />
307
- <input type=button id=p5CutButton disabled="disabled" value="Cut" onclick="p5copyFile(1)" onkeypress="return false" onkeydown="return false" />
308
- <input type=button id=p5CopyButton disabled="disabled" value="Copy" onclick="p5copyFile(0)" onkeypress="return false" onkeydown="return false" />
309
- <input type=button id=p5PasteButton disabled="disabled" value="Paste" onclick="p5pasteFile()" onkeypress="return false" onkeydown="return false" />
310
- </div>
311
- </td>
312
- </tr>
313
- <tr>
314
- <td style="background-color:#E4E9E7;height:28px">
315
- <div style=float:right>
316
- <select id=p5sortdropdown onchange=updateFiles()>
317
- <option value="1" selected="selected">Sort by name</option>
318
- <option value="2">Sort by size</option>
319
- <option value="3">Sort by date</option>
320
- <option value="4">Descend by name</option>
321
- <option value="5">Descend by size</option>
322
- <option value="6">Descend by date</option>
323
- </select>
324
- </div>
325
- <div> <span id="p5currentpath"></span></div>
326
- </td>
327
- </tr>
328
- </table>
329
- <div id="p5filetable" style="width:100%;height:calc(100vh - 294px);overflow:auto;-webkit-user-select:none;position:relative">
330
- <!--
331
- <form id=p5fileCatchAll method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame>
332
- <input type=file id=p5fileCatchAllInput name=files style="position:absolute;left:0;width:100%;top:0;bottom:0;opacity:0;display:none" onchange="p5fileCatchAllInputChanged(event)" />
333
- <input id=p5fileDragLink2 name="link" style="display:none" />
334
- <input type=submit id=p5fileCatchAllSubmit style="display:none" />
335
- </form>
336
- -->
337
- <div id="p5PublicShare" style="display:none;width:100%;overflow:auto;-webkit-user-select:none;background-color:lightsteelblue"><div style="padding:4px">These files are shared publicly, click "link" to get public url.</div></div>
338
- <div id="bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✓</b></div>
339
- <div id="bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✗</b></div>
340
- <span id="p5files"></span>
341
- </div>
342
- <table id="p5toolbarBottom" style=width:100% cellpadding=0 cellspacing=0>
343
- <tr><td class=style6 style="text-align:left;padding:3px"> <span id="p5bottomstatus"></span></td></tr>
344
- </table>
345
- </div>
346
- <div id=p6 style=display:none>
347
- <img id=MainMeshImage src="serverpic.ashx" style=border-width:0px;height:200px;width:200px;float:right>
348
- <h1>My Server</h1>
349
- <p id="p2ServerActions"><strong>Server actions</strong></p>
350
- <p style="margin-left:40px">
351
- <a id="p2ServerActionsBackup" href="/backup.zip" rel="noreferrer noopener" target="_blank" style="cursor:pointer">Download server backup</a><br />
352
- <a id="p2ServerActionsRestore" onclick="server_showRestoreDlg()" style="cursor:pointer">Restore server with backup</a><br />
353
- <a id="p2ServerActionsVersion" onclick="server_showVersionDlg()" style="cursor:pointer">Check server version</a><br />
354
- <a id="p2ServerActionsErrors" onclick="server_showErrorsDlg()" style="cursor:pointer">Show server error log</a><br />
355
- </p>
356
- <br /><strong>Server Statistics</strong><br /><br />
357
- <div id="serverStats" style="margin-left:40px">
358
- <div id="serverCpuChartView" style="display:none">
359
- <div style="width:60px;display:inline-block"><canvas id="serverCpuChart" style="width:60px;height:60px"></canvas></div>
360
- <div style="width:160px;display:inline-block" id="serverCpuChartText"></div>
361
- </div>
362
- <div id="serverMemoryChartView" style="display:none">
363
- <div style="width:60px;display:inline-block"><canvas id="serverMemoryChart" style="width:60px;height:60px"></canvas></div>
364
- <div style="width:160px;display:inline-block" id="serverMemoryChartText"></div>
365
- </div><br /><br />
366
- <div id="serverStatsTable"></div>
367
- </div>
368
- </div>
369
- <div id=p10 style="display:none">
370
- <table style="width:100%" cellpadding="0" cellspacing="0">
371
- <tr>
372
- <td style=width:auto valign=top>
373
- <div id=p10title>
374
- <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
375
- <h1>General - <span id=p10deviceName></span></h1>
376
- </div>
377
- <div id=p10html></div>
378
- </td>
379
- <td style=width:20px></td>
380
- <td style=width:200px>
381
- <a style=cursor:pointer onclick=p10showiconselector()><img id=MainComputerImage style=border-width:0px;height:200px;width:200px></a>
382
- <div style="width:100%;text-align:center"><strong><span id=MainComputerState></span></strong></div>
383
- </td>
384
- </tr>
385
- </table><br>
386
- <div id=p10html2></div>
387
- <div id=p10html3></div>
388
- </div>
389
- <div id=p11 class=noselect style=display:none>
390
- <div id="p11title">
391
- <div id=p11deviceNameHeader>
392
- <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
393
- <div style="float:right" id="devListToolbarViewIcons"><div class="viewSelector" onclick=deskToggleFull(event) title="Full Screen. Hold shift to browser full screen."><div class="viewSelector5"></div></div></div>
394
- <h1>Desktop - <span id=p11deviceName></span></h1>
395
- </div>
396
- </div>
397
- <div id="p14warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showFeaturesDlg()">
398
- <div class=icon2 style="float:left;margin:7px"></div>
399
- <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel® AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div>
400
- </div>
401
- <div id="p14warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showPowerActionDlg()">
402
- <div class=icon2 style="float:left;margin:7px"></div>
403
- <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div>
404
- </div>
405
- <table id=deskarea0 cellpadding=0 cellspacing=0 style="width:100%;padding:0px;padding:0px;margin-top:0px">
406
- <tr id=deskarea1>
407
- <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
408
- <div style="float:right;text-align:right">
409
- <span id="p14power"></span>
410
- <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Left" onclick="drotate(-1)">↺</div>
411
- <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Right" onclick="drotate(1)">↻</div>
412
- <input id="deskFocusBtn" type="button" title="Toggle focus mode, when active only the region around the mouse is updated" onkeypress="return false" onkeydown="return false" value="Focus All" onclick="deskToggleFocus()" style="margin-right:3px;display:none">
413
- <input id="deskSaveBtn" type="button" title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value="Save..." onclick=deskSaveImage() style=margin-right:3px>
414
- <input id="deskActionsBtn" type=button title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value=Actions onclick=deviceActionFunction() style=margin-right:3px />
415
- <input id="deskActionsSettings" type="button" value="Settings..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()" style="margin-right:3px">
416
- <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="margin-right:3px;display:none">
417
- </div>
418
- <div>
419
- <div id="idx_deskFullBtn2" onclick=deskToggleFull(event) style="float:left;font-size:large;cursor:pointer;display:none"> ✖</div>
420
- <input type="button" id="autoconnectbutton1" value="AutoConnect" onclick=autoConnectDesktop(event) onkeypress="return false" onkeydown="return false" style="display:none">
421
- <span id=connectbutton1span> <input type=button id=connectbutton1 value="Connect" onclick=connectDesktop(event,1) onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
422
- <span id=connectbutton1hspan> <input type=button id=connectbutton1h value="HW Connect" onclick=connectDesktop(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
423
- <span id=disconnectbutton1span> <input type=button id=disconnectbutton1 value="Disconnect" onclick=connectDesktop(event,0) onkeypress="return false" onkeydown="return false"></span>
424
- <span id="deskstatus">Disconnected</span>
425
- </div>
426
- </td>
427
- </tr>
428
- <tr id=deskarea2>
429
- <td>
430
- <div style=background-color:gray><div id=progressbar style=height:2px;width:0%;background-color:red></div></div>
431
- </td>
432
- </tr>
433
- <tr id=deskarea3>
434
- <td id=deskarea3x style="background:black;text-align:center;position:relative;overflow:hidden">
435
- <div id=DeskFocus style="overflow:hidden;color:transparent;border:3px dotted rgba(255,0,0,.2);position:absolute;border-radius:5px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></div>
436
- <div id=DeskParent style="overflow:hidden">
437
- <canvas id=Desk width=640 height=480 style="overflow:hidden;width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event) onmousewheel=dmousewheel(event)></canvas>
438
- </div>
439
- <div id=DeskTools style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none">
440
- <a id=DeskToolsRefreshButton style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a>
441
- <div id=DeskToolsBar style="position:absolute;padding:3px;border-radius: 3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div>
442
- <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left">
443
- <div style="border-bottom:1px solid darkgray;padding:3px"><a style=width:50px;padding-right:5px;float:left;cursor:pointer title="Sort by process id" onclick=sortProcess(0)>PID</a><a style=cursor:pointer title="Sort by name" onclick=sortProcess(1)>Name</a></div>
444
- <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div>
445
- </div>
446
- </div>
447
- </td>
448
- </tr>
449
- <tr id=deskarea4>
450
- <td style=padding-top:2px;padding-bottom:2px;background:#C0C0C0>
451
- <div style=float:right;text-align:right>
452
- <select id=termdisplays style=display:none onchange=deskSetDisplay(event) onclick=deskGetDisplayNumbers(event)></select>
453
- <input id=DeskToolsButton type=button value=Tools title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()">
454
- <span id=DeskChatButton style="float:right;margin-top:1px;margin-right:4px;cursor:pointer" title="Open chat window to this computer"><img src='images/icon-chat.png' onclick=deviceChat() height=16 width=16 style=padding-top:2px /></span>
455
- <span id=DeskNotifyButton style="float:right;margin-top:1px;margin-right:4px;cursor:pointer" title="Display a notification on the remote computer"><img src='images/icon-notify.png' onclick=deviceToastFunction() height=16 width=16 style=padding-top:2px /></span>
456
- <span id=DeskOpenWebButton style="float:right;margin-top:1px;margin-right:4px;cursor:pointer" title="Open a web address on remote computer"><img src='images/icon-url2.png' onclick=deviceUrlFunction() height=16 width=16 style=padding-top:2px /></span>
457
- </div>
458
- <div>
459
- <select style="margin-left:6px" id="deskkeys">
460
- <option value=5>Win</option>
461
- <option value=0>Win+Down</option>
462
- <option value=1>Win+Up</option>
463
- <option value=2>Win+L</option>
464
- <option value=3>Win+M</option>
465
- <option value=4>Shift+Win+M</option>
466
- <option value=6>Win+R</option>
467
- </select>
468
- <input id="DeskWD" type=button value="Send" onkeypress="return false" onkeydown="return false" onclick="deskSendKeys()">
469
- <input id="DeskCAD" style="margin-left:6px" type="button" value="Ctrl-Alt-Del" onkeypress="return false" onkeydown="return false" onclick="sendCAD()">
470
- <span id="DeskControlSpan" style="margin-left:6px" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false" onclick="toggleKvmControl()">Input</span>
471
- </div>
472
- </td>
473
- </tr>
474
- </table>
475
- </div>
476
- <div id=p12 style="display:none">
477
- <div id="p12title">
478
- <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
479
- <h1>Terminal - <span id=p12deviceName></span></h1>
480
- </div>
481
- <div id="p12warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick=showFeaturesDlg()>
482
- <div class="icon2" style="float:left;margin:7px"></div>
483
- <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel® AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div>
484
- </div>
485
- <div id="p12warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick=showPowerActionDlg()>
486
- <div class="icon2" style="float:left;margin:7px"></div>
487
- <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div>
488
- </div>
489
- <table cellpadding=0 cellspacing=0 style="width:100%;padding:0px;padding:0px;margin-top:0px">
490
- <tr>
491
- <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
492
- <div style="float:right;text-align:right">
493
- <input id="termActionsBtn" type=button title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value=Actions onclick=deviceActionFunction() style=margin-right:3px />
494
- </div>
495
- <div>
496
- <input type="button" id="autoconnectbutton2" value="AutoConnect" onclick=autoConnectTerminal(event) onkeypress="return false" onkeydown="return false" style="display:none">
497
- <span id="connectbutton2span"> <input type="button" id="connectbutton2" value="Connect" onclick=connectTerminal(event,1) onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
498
- <span id="connectbutton2hspan"> <input type="button" id="connectbutton2h" value="HW Connect" onclick=connectTerminal(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
499
- <span id="disconnectbutton2span"> <input type="button" id="disconnectbutton2" value="Disconnect" onclick=connectTerminal(event,0) onkeypress="return false" onkeydown="return false"></span>
500
- <span id="termstatus">Disconnected</span>
501
- </div>
502
- </td>
503
- </tr>
504
- <tr>
505
- <td>
506
- <div style="background-color:gray"><div id="termprogressbar" style="height:2px;width:0%;background-color:red"></div></div>
507
- </td>
508
- </tr>
509
- <tr>
510
- <td style="background:black;text-align:center;height:500px;position:relative">
511
- <pre id="Term" style="background:black;margin:0;padding:0"></pre>
512
- </td>
513
- </tr>
514
- <tr>
515
- <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
516
- <div style="float:right;text-align:right">
517
- <span id="terminalSettingsButtons" style="display:none">
518
- <input id="id_tcrbutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="CR+LF" title="Toggle what the return key will send" onclick="termToggleCr()">
519
- <input id="id_tfxkeysbutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick="termToggleFx()">
520
- <input id="id_ttypebutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Extended Ascii" title="Toggle terminal emulation type" onclick="termToggleType()">
521
- </span>
522
- <select id="specialkeylist" onkeypress="return false" style="margin-left:5px"></select>
523
- <input id="specialkeylistinput" type="button" onkeypress="return false" class="bottombutton" value="Send" title="Send the selected special key" onclick="sendSpecialKey()" />
524
- </div>
525
- <div>
526
-
527
- <input type=button onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlcbutton" value="Ctl-C" onclick="termSendKey(3,'ctrlcbutton')" />
528
- <input type=button onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlxbutton" value="Ctl-X" onclick="termSendKey(24,'ctrlxbutton')" />
529
- <input type=button onkeypress="return false" onkeydown="return false" class="bottombutton" id="escbutton" value="ESC" onclick="termSendKey(27,'escbutton')" />
530
- <input type=button onkeypress="return false" onkeydown="return false" class="bottombutton" id="bsbutton" value="Backspace" onclick="termSendKey(8,'bsbutton')" />
531
- <input type=button onkeypress="return false" onkeydown="return false" class="bottombutton" id="pastebutton" value="Paste" title="Paste text into the terminal" onclick="showTermPasteDialog()" />
532
- </div>
533
- </td>
534
- </tr>
535
- </table>
536
- </div>
537
- <div id=p13 style=display:none>
538
- <div id="p13title">
539
- <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
540
- <h1>Files - <span id=p13deviceName></span></h1>
541
- </div>
542
- <table id="p13toolbar" style="width: 100%" cellpadding="0" cellspacing="0">
543
- <tr>
544
- <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px">
545
- <div style="float:right;text-align:right">
546
- <input id="filesActionsBtn" type=button title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value=Actions onclick=deviceActionFunction() style=margin-right:3px />
547
- </div>
548
- <div>
549
- <input id=p13AutoConnect value="AutoConnect" onclick=autoConnectFiles(event) onkeypress="return false" onkeydown="return false" type="button" style="display:none">
550
- <input id=p13Connect value="Connect" onclick=connectFiles(event) onkeypress="return false" onkeydown="return false" type="button">
551
- <span id=p13Status>Disconnected</span>
552
- </div>
553
- </td>
554
- </tr>
555
- <tr>
556
- <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign=bottom>
557
- <div id="p13rightOfButtons" style="float:right;margin-top:3px"></div>
558
- <div>
559
- <input type=button id=p13FolderUp disabled="disabled" onclick="p13folderup()" value="Up" />
560
- <input type=button id=p13SelectAllButton disabled="disabled" onclick="p13selectallfile()" value="Select All" onkeypress="return false" onkeydown="return false" />
561
- <input type=button id=p13RenameFileButton disabled="disabled" value="Rename" onclick="p13renamefile()" onkeypress="return false" onkeydown="return false" />
562
- <input type=button id=p13DeleteFileButton disabled="disabled" value="Delete" onclick="p13deletefile()" onkeypress="return false" onkeydown="return false" />
563
- <input type=button id=p13NewFolderButton disabled="disabled" value="New Folder" onclick="p13createfolder()" onkeypress="return false" onkeydown="return false" />
564
- <input type=button id=p13UploadButton disabled="disabled" value="Upload" onclick="p13uploadFile()" onkeypress="return false" onkeydown="return false" />
565
- <input type=button id=p13CutButton disabled="disabled" value="Cut" onclick="p13copyFile(1)" onkeypress="return false" onkeydown="return false" />
566
- <input type=button id=p13CopyButton disabled="disabled" value="Copy" onclick="p13copyFile(0)" onkeypress="return false" onkeydown="return false" />
567
- <input type=button id=p13PasteButton disabled="disabled" value="Paste" onclick="p13pasteFile()" onkeypress="return false" onkeydown="return false" />
568
- <input type=button id=p13RefreshButton disabled="disabled" value="Refresh" onclick="p13folderup(9999)" onkeypress="return false" onkeydown="return false" />
569
- </div>
570
- </td>
571
- </tr>
572
- <tr>
573
- <td style="background-color:#E4E9E7;height:28px">
574
- <div style=float:right>
575
- <select id=p13sortdropdown onchange=p13updateFiles()>
576
- <option value=1 selected="selected">Sort by name</option>
577
- <option value=2>Sort by size</option>
578
- <option value=3>Sort by date</option>
579
- <option value=4>Descend by name</option>
580
- <option value=5>Descend by size</option>
581
- <option value=6>Descend by date</option>
582
- </select>
583
- </div>
584
- <div> <span id="p13currentpath"></span></div>
585
- </td>
586
- </tr>
587
- </table>
588
- <div id="p13filetable" style="width:100%;height:calc(100vh - 346px);overflow:auto;-webkit-user-select:none">
589
- <div id="p13bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✓</b></div>
590
- <div id="p13bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✗</b></div>
591
- <span id="p13files"></span>
592
- </div>
593
- <table id="p13toolbarBottom" style=width:100% cellpadding=0 cellspacing=0>
594
- <tr><td class=style6 style="text-align:left;padding:3px"> <span id="p13bottomstatus"></span></td></tr>
595
- </table>
596
- </div>
597
- <div id=p14 style=display:none>
598
- <div id="p14title">
599
- <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
600
- <h1>Intel® AMT - <span id=p14deviceName></span></h1>
601
- </div>
602
- <iframe id=p14iframe style="width:100%;height:calc(100vh - 242px);border:0;overflow:hidden" src="/commander.htm"></iframe>
603
- </div>
604
- <div id=p15 style=display:none>
605
- <div id="p15title">
606
- <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
607
- <h1>Console - <span id=p15deviceName></span></h1>
608
- </div>
609
- <table cellpadding=0 cellspacing=0 style="width:100%;padding:0px;padding:0px;margin-top:0px">
610
- <tr>
611
- <td style=background:#C0C0C0>
612
- <div style=float:right;padding-right:4px>
613
- <div style=padding:4px;display:inline-block id=p15coreName title="Information about current core running on this agent"></div>
614
- <input type=button id=p15uploadCore value="Agent Action" onclick=p15uploadCore(event) title="Change the agent Java Script code module" />
615
- </div>
616
- <div id="p15statetext" style=padding:4px></div>
617
- </td>
618
- </tr>
619
- <tr>
620
- <td>
621
- <div style="background-color:gray"><div id="consoleprogressbar" style="height:2px;width:0%;background-color:red"></div></div>
622
- </td>
623
- </tr>
624
- <tr>
625
- <td id=p15agentConsole style="background:black;margin:0;padding:0;color:lightgray;width:100%;height:calc(100vh - 296px);max-height:500px;position:relative">
626
- <pre id=p15agentConsoleText style="position:absolute;margin:0;padding:0;top:0;bottom:0;left:0;right:0;overflow-y:scroll;overflow-x:auto"></pre>
627
- </td>
628
- </tr>
629
- <tr>
630
- <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
631
- <table style="width:100%">
632
- <tr>
633
- <td style="width:99%">
634
- <input id=p15consoleText style=width:100% onkeyup=p15consoleSend(event) onfocus=onConsoleFocus(1) onblur=onConsoleFocus(0) />
635
- </td>
636
- <td> </td>
637
- <td style="width:1%"><input id="id_p15consoleClear" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Clear" onclick="p15consoleClear()"></td>
638
- </tr>
639
- </table>
640
- </td>
641
- </tr>
642
- </table>
643
- </div>
644
- <div id=p16 style=display:none>
645
- <div id="p16title">
646
- <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
647
- <h1>Events - <span id=p16deviceName></span></h1>
648
- </div>
649
- <div style=width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px>
650
- <div class=style7 style=width:16px;height:100%;float:left> </div>
651
- <div class=h1 style=height:100%;float:left> </div>
652
- <!--<div class=style14 style=height:100%;float:left> <input id=p31deleteall type=button style=display:none value="Delete All..." /> </div>-->
653
- <div class=style14 style=height:100%;float:left> <input type=button value=Refresh onclick=refreshDeviceEvents() /> </div>
654
- <div class="auto-style1" style="height:100%;float:right">
655
- Show
656
- <select id=p16limitdropdown onchange=refreshDeviceEvents()>
657
- <option value=60>Last 60</option>
658
- <option value=120>Last 120</option>
659
- <option value=250>Last 250</option>
660
- <option value=500>Last 500</option>
661
- <option value=1000>Last 1000</option>
662
- </select>
663
- <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div>
664
- <div class=h2 style=height:100%;float:right> </div>
665
- </div>
666
- </div>
667
- <div id=p16events style="max-height:calc(100vh - 267px);overflow-y:auto"></div>
668
- </div>
669
- <div id=p20 style="display:none">
670
- <picture id=MainMeshImage style=border-width:0px;height:200px;width:200px;float:right>
671
- <source type="image/webp" width=200 height=200 srcset="images/webp/mesh-200.webp">
672
- <img alt="" width=200 height=200 src=images/mesh-200.jpg />
673
- </picture>
674
- <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
675
- <h1>General - <span id=p20meshName></span></h1>
676
- <p id=p20info></p>
677
- </div>
678
- <div id=p30 style=display:none>
679
- <table style="width:100%" cellpadding="0" cellspacing="0">
680
- <tr>
681
- <td style=width:auto valign=top>
682
- <div id="p30title">
683
- <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
684
- <h1>General - <span id=p30userName></span></h1>
685
- </div>
686
- <div id=p30html></div>
687
- </td>
688
- <td style=width:20px></td>
689
- <td style=width:200px>
690
- <picture id=MainUserImage style=border-width:0px;height:200px;width:200px;float:right>
691
- <source type="image/webp" width=200 height=200 srcset="images/webp/user-200.webp">
692
- <img alt="" width=200 height=200 src=images/user-200.jpg />
693
- </picture>
694
- <div style="width:100%;text-align:center"><strong><span id=MainUserState></span></strong></div>
695
- </td>
696
- </tr>
697
- </table><br>
698
- <div id=p30html2></div>
699
- <div id=p30html3></div>
700
- </div>
701
- <div id=p31 style=display:none>
702
- <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
703
- <h1>Events - <span id=p31userName></span></h1>
704
- <div style=width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px>
705
- <div class=style7 style=width:16px;height:100%;float:left> </div>
706
- <div class=h1 style=height:100%;float:left> </div>
707
- <!--<div class=style14 style=height:100%;float:left> <input id=p31deleteall type=button style=display:none value="Delete All..." /> </div>-->
708
- <div class=style14 style=height:100%;float:left> <input type=button value=Refresh onclick=refreshUsersEvents() /> </div>
709
- <div class="auto-style1" style="height:100%;float:right">
710
- Show
711
- <select id=p31limitdropdown onchange=refreshUsersEvents()>
712
- <option value=60>Last 60</option>
713
- <option value=120>Last 120</option>
714
- <option value=250>Last 250</option>
715
- <option value=500>Last 500</option>
716
- <option value=1000>Last 1000</option>
717
- </select>
718
- <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div>
719
- <div class="h2" style="height:100%;float:right;"> </div>
720
- </div>
721
- </div>
722
- <div id=p31events style="max-height:calc(100vh - 267px);overflow-y:scroll"></div>
723
- </div>
724
- <br id="column_l_bottomgap" />
725
- </div>
726
- <div id=footer class=noselect>
727
- <table cellpadding=0 cellspacing=10 style="width:100%">
728
- <tr>
729
- <td style="text-align:left;color:white">
730
- {{{footer}}}
731
- </td>
732
- <td style="text-align:right">
733
- <a id="verifyEmailId2" style="color:yellow;margin-left:3px;cursor:pointer;display:none" onclick="account_showVerifyEmail()">Verify Email</a>
734
- <a style="margin-left:3px" href="terms">Terms & Privacy</a>
735
- </td>
736
- </tr>
737
- </table>
738
- </div>
739
- <div id=dialog style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:160px;width:400px;left:calc((100% / 2) - 200px);display:none">
740
- <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0">
741
- <div id=id_dialogclose style=float:right;padding:3px;margin-right:3px;cursor:pointer onclick=setDialogMode()>✖</div>
742
- <div id=id_dialogtitle style=padding:5px></div>
743
- <div style=width:100%;margin:6px></div>
744
- </div>
745
- <div style="margin-right:16px;margin-left:8px">
746
- <div id=dialog1 style="margin:auto;text-align:center;margin:3px">
747
- <div id=id_dialogMessage style="padding:10px"></div>
748
- </div>
749
- <div id=dialog2 style="margin:auto;margin:3px">
750
- <div id=id_dialogOptions></div>
751
- </div>
752
- <div id=dialog3 style="margin:auto;margin:3px">
753
- <div style=height:26px>
754
- <select id=d3uploadMode style=float:right;width:260px onchange=d3modechange()>
755
- <option value=1>Local file upload</option>
756
- <option value=2>Server file selection</option>
757
- </select>
758
- <div>File Selection</div>
759
- </div>
760
- <div id=d3localmode style=height:26px;display:none>
761
- <form id=d3localmodeform method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame>
762
- <input type=text id=d3attrib name=attrib style=display:none />
763
- <input type=file id=d3localFile name=files style=float:right;width:260px onchange=d3setActions() />
764
- <input type=submit id=d3submit style=display:none />
765
- </form>
766
- <div>Upload File</div>
767
- </div>
768
- <div id=d3servermode>
769
- <div style="width:100%;background-color:#d3d9d6;text-align:left;padding:3px" valign=bottom>
770
- <input type=button id=p3FolderUp disabled="disabled" onclick=d3folderup() value="Up" />
771
- </div>
772
- <div id=d3serverfiles style="width:100%;height:150px;background-color:white;padding:2px;border:1px solid gray;overflow-y:scroll"></div>
773
- </div>
774
- </div>
775
- <div id=dialog7 style="margin:auto;margin:3px">
776
- <div id="d7meshkvm">
777
- <h4 style="width:100%;border-bottom:1px solid gray">Agent Remote Desktop</h4>
778
- <div style="margin:3px 0 3px 0">
779
- <select id="d7bitmapquality" style="float:right;width:200px;height:20px" dir="rtl"></select>
780
- <div style="height:20px">Quality</div>
781
- </div>
782
- <div style="margin:3px 0 3px 0">
783
- <select id="d7bitmapscaling" style="float:right;width:200px;height:20px" dir="rtl">
784
- <option selected=selected value=1024>100%</option>
785
- <option value=896>87.5%</option>
786
- <option value=768>75%</option>
787
- <option value=640>62.5%</option>
788
- <option value=512>50%</option>
789
- <option value=384>37.5%</option>
790
- <option value=256>25%</option>
791
- <option value=128>12.5%</option>
792
- </select>
793
- <div style="height:20px">Scaling</div>
794
- </div>
795
- <div style="margin:3px 0 3px 0">
796
- <select id="d7framelimiter" style="float:right;width:200px;height:20px" dir="rtl">
797
- <option selected=selected value=50>Fast</option>
798
- <option value=100>Medium</option>
799
- <option value=400>Slow</option>
800
- <option value=1000>Very slow</option>
801
- </select>
802
- <div style="height:20px">Frame rate</div>
803
- </div>
804
- </div>
805
- <div id="d7amtkvm">
806
- <h4 style="width:100%;border-bottom:1px solid gray">Intel® AMT Hardware KVM</h4>
807
- <div style='height:26px'>
808
- <select id="d7desktopmode" style="float:right;width:200px">
809
- <option value="1">RLE8, Fastest</option>
810
- <option value="2">RLE16, Recommended</option>
811
- <option value="3">RAW8, Slow</option>
812
- <option value="4">RAW16, Very Slow</option>
813
- </select>
814
- <div>Image Encoding</div>
815
- </div>
816
- <div style="height:60px">
817
- <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white">
818
- <input type="checkbox" id='d7showfocus'>Show Focus Tool<br>
819
- <input type="checkbox" id='d7showcursor'>Show Local Mouse Cursor<br>
820
- </div>
821
- <div>Other Settings</div>
822
- </div>
823
- </div>
824
- </div>
825
- </div>
826
- <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:4px">
827
- <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)">
828
- <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)">
829
- <div style="height:25px"><input id=idx_dlgDeleteButton type=button value=Delete style="width:80px;display:none" onclick="dialogclose(2)"></div>
830
- </div>
831
- </div>
832
- <iframe name="fileUploadFrame" style=display:none></iframe>
833
- <form style=display:none method=post action=uploadfile.ashx enctype=multipart/form-data target=fileUploadFrame><input id=p5fileDragName name="name"><input id=p5fileDragSize name="size"><input id=p5fileDragType name="type"><input id=p5fileDragData name="data"><input id=p5fileDragLink name="link"><input type=submit id=p5loginSubmit2 style=display:none /></form>
834
- <form style=display:none method=post action=uploadnodefile.ashx enctype=multipart/form-data target=fileUploadFrame><input id=p13fileDragName name="name"><input id=p13fileDragSize name="size"><input id=p13fileDragType name="type"><input id=p13fileDragData name="data"><input id=p13fileDragLink name="link"><input type=submit id=p13loginSubmit2 style=display:none /></form>
835
- <audio id="chimes"><source src="sounds/chimes.mp3" type="audio/mp3"></audio>
836
- </div>
837
- </div>
838
- <script type="text/javascript">
839
- 'use strict';
840
- var args;
841
- var powerStatetable = ['', 'Powered', 'Sleep', 'Sleep', 'Sleep', 'Hibernating', 'Power off', 'Present'];
842
- var StatusStrs = ['Disconnected', 'Connecting...', 'Setup...', 'Connected', 'Intel® AMT Connected'];
843
- var sort = 0;
844
- var searchFocus = 0;
845
- var mapSearchFocus = 0;
846
- var userSearchFocus = 0;
847
- var consoleFocus = 0;
848
- var showRealNames = false;
849
- var meshserver = null;
850
- var meshes = {};
851
- var meshcount = 0;
852
- var nodes = [];
853
- var filetree = {};
854
- var userinfo = null;
855
- var serverinfo = null;
856
- var events = [];
857
- var users = null;
858
- var wssessions = null;
859
- var nodeShortIdent = 0;
860
- var desktop;
861
- var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50 };
862
- var multidesktopsettings = { quality: 20, scaling: 128, framerate: 1000 };
863
- var terminal;
864
- var files;
865
- var debugLevel = parseInt("{{{debuglevel}}}");
866
- var features = parseInt("{{{features}}}");
867
- var sessionTime = parseInt("{{{sessiontime}}}");
868
- var domain = "{{{domain}}}";
869
- var domainUrl = "{{{domainurl}}}";
870
- var multiDesktop = {};
871
- var multiDesktopFilter = null;
872
- var serverPublicNamePort = "{{{serverDnsName}}}:{{{serverPublicPort}}}";
873
- var amtScanResults = null;
874
- var debugmode = 0;
875
- var clickOnce = (((features & 256) != 0) && detectClickOnce());
876
- var attemptWebRTC = ((features & 128) != 0);
877
- var webPageFullScreen = getstore('webPageFullScreen', true);
878
- if (webPageFullScreen == 'false') { webPageFullScreen = false; }
879
- if (webPageFullScreen == 'true') { webPageFullScreen = true; }
880
- var passRequirements = "{{{passRequirements}}}";
881
- if (passRequirements != "") { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); }
882
-
883
- function startup() {
884
- if ((features & 32) == 0) {
885
- // Guard against other site's top frames (web bugs).
886
- var loc = null;
887
- try { loc = top.location.toString().toLowerCase(); } catch (e) { }
888
- if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; }
889
- }
890
-
891
- toggleFullScreen();
892
-
893
- // Check if we are in debug mode
894
- args = parseUriArgs();
895
- debugmode = args.debug;
896
- if (args.webrtc != null) { attemptWebRTC = (args.webrtc == 1); }
897
- QV('p13AutoConnect', debugmode); // Files
898
- QV('autoconnectbutton2', debugmode); // Terminal
899
- QV('autoconnectbutton1', debugmode); // Desktop
900
-
901
- // Setup page visuals
902
- if (args.hide) {
903
- var hide = parseInt(args.hide);
904
- QV('masthead', !(hide & 1));
905
- QV('topbarmaster', !(hide & 2));
906
- QV('page_leftbar', !(hide & 2));
907
- QV('footer', !(hide & 4));
908
- QV('p10title', !(hide & 8));
909
- QV('p11title', !(hide & 8));
910
- QV('p12title', !(hide & 8));
911
- QV('p13title', !(hide & 8));
912
- QV('p14title', !(hide & 8));
913
- QV('p15title', !(hide & 8));
914
- QV('p16title', !(hide & 8));
915
- }
916
- p1updateInfo();
917
-
918
- // Setup the context menu
919
- document.onclick = function (e) { hideContextMenu(); }
920
- document.onkeypress = ondockeypress;
921
- document.onkeydown = ondockeydown;
922
- document.onkeyup = ondockeyup;
923
- window.onresize = function () { masterUpdate(512); } // TODO: Could fix dialog box to always be centered using CSS.
924
- masterUpdate(512);
925
-
926
- // Connect to the mesh server
927
- meshserver = MeshServerCreateControl(domainUrl);
928
- meshserver.onStateChanged = onStateChanged;
929
- meshserver.onMessage = onMessage;
930
- meshserver.Start();
931
-
932
- // Setup page controls
933
- Q('sortselect').selectedIndex = sort = getstore("sort", 0);
934
- Q('sizeselect').selectedIndex = getstore("viewsize", 1);
935
- Q('SearchInput').value = getstore("search", "");
936
- showRealNames = (getstore("showRealNames", 0) == 1);
937
- Q('RealNameCheckBox').checked = showRealNames;
938
- Q('viewselect').value = getstore("deviceView", 1);
939
- Q('DeskControl').checked = (getstore('DeskControl', 1) == 1);
940
-
941
- // Display the page devices
942
- masterUpdate(3)
943
- for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); }
944
- Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel');
945
-
946
-
947
- // Setup upload drag & drop
948
- Q('p5filetable').addEventListener("drop", p5fileDragDrop, false);
949
- Q('p5filetable').addEventListener("dragover", p5fileDragOver, false);
950
- Q('p5filetable').addEventListener("dragleave", p5fileDragLeave, false);
951
- //Q('p5fileCatchAllInput').addEventListener("drop", p5fileDragDrop, false);
952
- //Q('p5fileCatchAllInput').addEventListener("dragover", p5fileDragOver, false);
953
- //Q('p5fileCatchAllInput').addEventListener("dragleave", p5fileDragLeave, false);
954
-
955
- // Setup upload drag & drop
956
- Q('p13filetable').addEventListener("drop", p13fileDragDrop, false);
957
- Q('p13filetable').addEventListener("dragover", p13fileDragOver, false);
958
- Q('p13filetable').addEventListener("dragleave", p13fileDragLeave, false);
959
-
960
- // Timeline update interval
961
- setInterval(updateDeviceTimeline, 120000); // Check every 2 minutes
962
-
963
- // Load desktop settings
964
- var t = localStorage.getItem('desktopsettings');
965
- if (t != null) { desktopsettings = JSON.parse(t); }
966
- t = localStorage.getItem('multidesktopsettings');
967
- if (t != null) { multidesktopsettings = JSON.parse(t); }
968
- applyDesktopSettings();
969
-
970
- // Terminal special keys
971
- var x = '';
972
- for (var c = 1; c < 27; c++) x += "<option value='" + c + "'>Ctrl-" + String.fromCharCode(64 + c) + " (" + c + ")</option>";
973
- QH('specialkeylist', x);
974
-
975
- // Setup server stats panel
976
- setupServerStats();
977
- }
978
-
979
- // Toggle the web page to full screen
980
- function toggleFullScreen(toggle) {
981
- if (toggle === 1) { webPageFullScreen = !webPageFullScreen; putstore('webPageFullScreen', webPageFullScreen); }
982
- if (webPageFullScreen == false) {
983
- QS('container').width = '960px';
984
- QS('container')['border-right'] = '1px solid #b7b7b7';
985
- QS('container')['border-left'] = '1px solid #b7b7b7';
986
- QS('container')['min-width'] = '960px';
987
- QS('container')['overflow'] = '';
988
- QS('column_l').width = '930px';
989
- QS('column_l').height = '';
990
- QS('column_l')['margin-left'] = '';
991
- QS('column_l')["overflow-y"] = '';
992
- QS('column_l')["max-height"] = (xxcurrentView >= 10) ? 'calc(100vh - 159px)' : 'calc(100vh - 135px)';
993
- QS('container').position = '';
994
- QS('page_content').position = '';
995
- QV('MainMenuSpan', true);
996
- QV('UserDummyMenuSpan', false);
997
- QV('page_leftbar', false);
998
- } else {
999
- QS('container').position = 'absolute';
1000
- QS('container').width = '100%';
1001
- QS('container').top = '0px';
1002
- QS('container').bottom = '0px';
1003
- QS('container')['border-right'] = '0';
1004
- QS('container')['border-left'] = '0';
1005
- QS('container')['min-width'] = '700px';
1006
- QS('container')['overflow'] = 'hidden';
1007
- QS('page_content').position = 'absolute';
1008
- QS('page_content').top = '66px';
1009
- QS('page_content').left = '90px';
1010
- QS('page_content').right = '0px';
1011
- QS('page_content').bottom = '0px';
1012
- QS('column_l').height = 'calc(100vh - 135px)';
1013
- QS('column_l').width = 'calc(100% - 30px)';
1014
- QS('column_l')["overflow-y"] = 'auto';
1015
- QS('column_l')["max-height"] = 'calc(100vh - 135px)';
1016
- QV('MainMenuSpan', false);
1017
- QV('UserDummyMenuSpan', (xxcurrentView < 10) && webPageFullScreen);
1018
- QV('page_leftbar', true);
1019
- }
1020
- //center();
1021
- masterUpdate(512);
1022
- QV('body', true);
1023
- }
1024
-
1025
- function getNodeFromId(id) { for (var i in nodes) { if (nodes[i]._id == id) return nodes[i]; } return null; }
1026
- function reload() { window.location.href = window.location.href; }
1027
-
1028
- function onStateChanged(server, state) {
1029
- if (state == 0) {
1030
- // Control web socket disconnected
1031
- setDialogMode(0); // Close any dialog boxes if present
1032
- go(0); // Go to disconnection panel
1033
-
1034
- // Clean up
1035
- powerTimeline = null;
1036
- powerTimelineReq = null;
1037
- powerTimelineNode = null;
1038
- powerTimelineUpdate = null;
1039
- deleteAllNotifications(); // Close and clear notifications if present
1040
- hideContextMenu(); // Hide the context menu if present
1041
- QV('verifyEmailId2', false);
1042
- QV('logoutControl', false);
1043
- setTimeout(serverPoll, 5000);
1044
- } else if (state == 2) {
1045
- // Fetch list of meshes, nodes, files
1046
- meshserver.send({ action: 'meshes' });
1047
- meshserver.send({ action: 'nodes' });
1048
- meshserver.send({ action: 'files' });
1049
- }
1050
- }
1051
-
1052
- // Poll the server, if it responds, refresh the page.
1053
- function serverPoll() {
1054
- var xdr = null;
1055
- try { xdr = new XDomainRequest(); } catch (e) { }
1056
- if (!xdr) xdr = new XMLHttpRequest();
1057
- xdr.open("HEAD", window.location.href);
1058
- xdr.timeout = 15000;
1059
- xdr.onload = function () { reload(); };
1060
- xdr.onerror = xdr.ontimeout = function () { setTimeout(serverPoll, 10000); };
1061
- xdr.send();
1062
- }
1063
-
1064
- // Return true if this browser supports clickonce
1065
- function detectClickOnce() {
1066
- for (var i in window.navigator.mimeTypes) { if (window.navigator.mimeTypes[i].type == "application/x-ms-application") { return true; } }
1067
- var userAgent = window.navigator.userAgent.toUpperCase();
1068
- return (userAgent.indexOf('.NET CLR 3.5') >= 0) || (userAgent.indexOf('(WINDOWS NT ') >= 0);
1069
- }
1070
-
1071
- function updateSiteAdmin() {
1072
- var noServerBackup = "{{{noServerBackup}}}";
1073
- var siteRights = userinfo.siteadmin;
1074
- if (noServerBackup == 1) { siteRights &= 0xFFFFFFFA; } // If not server backups allowed, remove server backup and restore permissions
1075
-
1076
- // Update account actions
1077
- QV('p2AccountActions', ((features & 4) == 0) && (serverinfo.domainauth == false)); // Hide Account Actions if in single user mode or domain authentication
1078
- QV('p2ServerActions', siteRights & 21);
1079
- QV('LeftMenuMyServer', siteRights & 21);
1080
- QV('MainMenuMyServer', siteRights & 21);
1081
- QV('p2ServerActionsBackup', siteRights & 1);
1082
- QV('p2ServerActionsRestore', siteRights & 4);
1083
- QV('p2ServerActionsVersion', siteRights & 16);
1084
- QV('MainMenuMyFiles', siteRights & 8);
1085
- QV('LeftMenuMyFiles', siteRights & 8);
1086
- if (((siteRights & 8) == 0) && (xxcurrentView == 5)) { setDialogMode(0); go(1); }
1087
- if (currentNode != null) { gotoDevice(currentNode._id, xxcurrentView, true); }
1088
-
1089
- // Update user management state
1090
- if ((userinfo.siteadmin & 2) != 0)
1091
- {
1092
- // We are user administrator
1093
- if (users == null) { meshserver.send({ action: 'users' }); }
1094
- if (wssessions == null) { meshserver.send({ action: 'wssessioncount' }); }
1095
- } else {
1096
- // We are not user administrator
1097
- users = null;
1098
- wssessions = null;
1099
- updateUsers();
1100
- if (xxcurrentView == 4 || ((xxcurrentView >= 30) && (xxcurrentView < 40))) { setDialogMode(0); go(1); currentUser = null; }
1101
- }
1102
- meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value) });
1103
- QV('p2deleteall', userinfo.siteadmin == 0xFFFFFFFF);
1104
-
1105
- // If we are site administrator, register to get server statistics
1106
- if ((siteRights & 21) != 0) { meshserver.send({ action: 'serverstats', interval: 10000 }); }
1107
- }
1108
-
1109
- // To boost the speed of the web page when even floods occur, this method perform a delayed update on the web page.
1110
- var updateNaggleTimer = null;
1111
- var updateNaggleFlags = 0;
1112
- function masterUpdate(flags) {
1113
- updateNaggleFlags |= flags;
1114
- if (updateNaggleTimer == null) {
1115
- updateNaggleTimer = setTimeout(function () {
1116
- if (updateNaggleFlags & 512) { center(); }
1117
- if (updateNaggleFlags & 1) { onSearchInputChanged(); }
1118
- if (updateNaggleFlags & 2) { onSortSelectChange(true); }
1119
- if (updateNaggleFlags & 128) { updateMeshes(); }
1120
- if (updateNaggleFlags & 4) { updateDevices(); }
1121
- if (updateNaggleFlags & 8) { drawNotifications(); }
1122
- if (updateNaggleFlags & 16) { updateMapMarkers(); }
1123
- if (updateNaggleFlags & 32) { eventsUpdate(); }
1124
- if (updateNaggleFlags & 64) { refreshMap(false, true); }
1125
- if (updateNaggleFlags & 256) { drawDeviceTimeline(); }
1126
- if (updateNaggleFlags & 1024) { deviceEventsUpdate(); }
1127
- if (updateNaggleFlags & 2048) { userEventsUpdate(); }
1128
- updateNaggleTimer = null;
1129
- updateNaggleFlags = 0;
1130
- }, 150);
1131
- }
1132
- }
1133
-
1134
- function onMessage(server, message) {
1135
- switch (message.action) {
1136
- case 'serverstats': {
1137
- updateServerStats(message);
1138
- break;
1139
- }
1140
- case 'serverinfo': {
1141
- serverinfo = message.serverinfo;
1142
- break;
1143
- }
1144
- case 'userinfo': {
1145
- userinfo = message.userinfo;
1146
- updateSiteAdmin();
1147
- QV('verifyEmailId', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
1148
- QV('verifyEmailId2', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
1149
- QV('otpAuth', ((features & 4096) != 0) && (userinfo.otpsecret != 1));
1150
- QV('otpAuthRemove', ((features & 4096) != 0) && (userinfo.otpsecret == 1));
1151
- break;
1152
- }
1153
- case 'users': {
1154
- users = {};
1155
- for (var m in message.users) { users[message.users[m]._id] = message.users[m]; }
1156
- updateUsers();
1157
- break;
1158
- }
1159
- case 'wssessioncount': {
1160
- wssessions = message.wssessions;
1161
- updateUsers();
1162
- break;
1163
- }
1164
- case 'meshes': {
1165
- meshes = {};
1166
- for (var m in message.meshes) { meshes[message.meshes[m]._id] = message.meshes[m]; }
1167
- masterUpdate(4 + 128);
1168
- break;
1169
- }
1170
- case 'files': {
1171
- filetree = setupBackPointers(message.filetree);
1172
- updateFiles();
1173
- d3updatefiles();
1174
- break;
1175
- }
1176
- case 'nodes': {
1177
- nodes = [];
1178
- for (var m in message.nodes) {
1179
- if (!meshes[m]) { console.log('Invalid mesh (1): ' + m); continue; }
1180
- for (var n in message.nodes[m]) {
1181
- if (message.nodes[m][n]._id == null) { console.log('Invalid node (' + n + '): ' + JSON.stringify(message.nodes)); continue; }
1182
- message.nodes[m][n].namel = message.nodes[m][n].name.toLowerCase();
1183
- if (message.nodes[m][n].rname) { message.nodes[m][n].rnamel = message.nodes[m][n].rname.toLowerCase(); } else { message.nodes[m][n].rnamel = message.nodes[m][n].namel; }
1184
- message.nodes[m][n].meshnamel = meshes[m].name.toLowerCase();
1185
- message.nodes[m][n].meshid = m;
1186
- message.nodes[m][n].state = (message.nodes[m][n].state)?(message.nodes[m][n].state):0;
1187
- message.nodes[m][n].desc = message.nodes[m][n].desc;
1188
- if (!message.nodes[m][n].icon) message.nodes[m][n].icon = 1;
1189
- message.nodes[m][n].ident = ++nodeShortIdent;
1190
- nodes.push(message.nodes[m][n]);
1191
- }
1192
- }
1193
- masterUpdate(1 | 2 | 4 | 64);
1194
-
1195
- if (xxcurrentView == 0) { if ('{{viewmode}}' != '') { go(parseInt('{{viewmode}}')); } else { setDialogMode(0); go(1); } }
1196
- if ('{{currentNode}}' != '') { gotoDevice('{{currentNode}}',parseInt('{{viewmode}}'));}
1197
- break;
1198
- }
1199
- case 'powertimeline': {
1200
- if (message.nodeid != powerTimelineReq) break;
1201
- powerTimelineNode = message.nodeid;
1202
- powerTimeline = message.timeline;
1203
- powerTimelineUpdate = Date.now() + 300000; // Update every 5 minutes
1204
- if (currentNode._id == message.nodeid) { masterUpdate(256); }
1205
- break;
1206
- }
1207
- case 'lastconnect': {
1208
- var node = getNodeFromId(message.nodeid);
1209
- if (node != null) {
1210
- node.lastconnect = message.time;
1211
- if ((currentNode._id == node._id) && (Q('MainComputerState').innerHTML == '')) {
1212
- QH('MainComputerState', '<span style=font-size:12px>Last seen:<br />' + new Date(node.lastconnect).toLocaleDateString() + ', ' + new Date(node.lastconnect).toLocaleTimeString() + '</span>');
1213
- }
1214
- }
1215
- break;
1216
- }
1217
- case 'msg': {
1218
- // Check if this is a message from a node
1219
- if (message.nodeid != null) {
1220
- var index = -1;
1221
- for (var i in nodes) { if (nodes[i]._id == message.nodeid) { index = i; break; } }
1222
- if (index != -1) {
1223
- // Node was found, dispatch the message
1224
- if (message.type == 'console') { p15consoleReceive(nodes[index], message.value); } // This is a console message.
1225
- else if (message.type == 'notify') { // This is a notification message.
1226
- var n = { text:message.value };
1227
- if (message.nodeid != null) { n.nodeid = message.nodeid; }
1228
- if (message.tag != null) { n.tag = message.tag; }
1229
- if (message.username != null) { n.username = message.username; }
1230
- addNotification(n);
1231
- } else if (message.type == 'ps') {
1232
- showDeskToolsProcesses(message);
1233
- }
1234
- }
1235
- } else {
1236
- if (message.type == 'notify') { // This is a notification message.
1237
- var n = { text:message.value };
1238
- if (message.tag != null) { n.tag = message.tag; }
1239
- if (message.username != null) { n.username = message.username; }
1240
- addNotification(n);
1241
- }
1242
- }
1243
- break;
1244
- }
1245
- case 'getnetworkinfo': {
1246
- if ((currentNode._id == message.nodeid) && (xxdialogMode == 2) && (xxdialogTag == 'if' + message.nodeid)) {
1247
- if (message.netif == null) {
1248
- QH('d2netinfo', 'No network interface information available for this device.');
1249
- } else {
1250
- var x = '<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>';
1251
- x += addHtmlValue2('Last Updated', new Date(message.updateTime).toLocaleString());
1252
- if (currentNode.publicip) { x += addHtmlValue2('Public IP address', currentNode.publicip); }
1253
- for (var i in message.netif) {
1254
- var net = message.netif[i];
1255
- x += '<hr />'
1256
- if (net.name) { x += addHtmlValue2('Name', '<b>' + EscapeHtml(net.name) + '</b>'); }
1257
- if (net.desc) { x += addHtmlValue2('Description', EscapeHtml(net.desc).replace('(R)', '®').replace('(r)', '®')); }
1258
- if (net.dnssuffix) { x += addHtmlValue2('DNS suffix', EscapeHtml(net.dnssuffix)); }
1259
- if (net.mac) { x += addHtmlValue2('MAC address', EscapeHtml(net.mac.toUpperCase())); }
1260
- if (net.v4addr) { x += addHtmlValue2('IPv4 address', EscapeHtml(net.v4addr)); }
1261
- if (net.v4mask) { x += addHtmlValue2('IPv4 mask', EscapeHtml(net.v4mask)); }
1262
- if (net.v4gateway) { x += addHtmlValue2('IPv4 gateway', EscapeHtml(net.v4gateway)); }
1263
- if (net.gatewaymac) { x += addHtmlValue2('Gateway MAC', EscapeHtml(net.gatewaymac)); }
1264
- }
1265
- x += '</div>';
1266
- QH('d2netinfo', x);
1267
- }
1268
- }
1269
- break;
1270
- }
1271
- case 'serverversion': {
1272
- if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerUpdate')) {
1273
- var x = '<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>';
1274
- if (!message.current) { message.current = 'Unknown'; }
1275
- if (!message.latest) { message.latest = 'Unknown'; }
1276
- x += addHtmlValue2('Current Version', '<b>' + EscapeHtml(message.current) + '</b>');
1277
- x += addHtmlValue2('Latest Version', '<b>' + EscapeHtml(message.latest) + '</b>');
1278
- x += '</div>';
1279
- if ((message.latest.indexOf('.') == -1) || (message.current == message.latest) || ((features & 2048) == 0)) {
1280
- setDialogMode(2, "MeshCentral Version", 1, null, x);
1281
- } else {
1282
- setDialogMode(2, "MeshCentral Version", 3, server_showVersionDlgEx, x + '<br /><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> Check and click OK to start server self-update.');
1283
- server_showVersionDlgUpdate();
1284
- }
1285
- }
1286
- break;
1287
- }
1288
- case 'servererrors': {
1289
- if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerErrors')) {
1290
- if (message.data == null) {
1291
- setDialogMode(2, "MeshCentral Server Errors", 1, null, 'Server has no error log.');
1292
- } else {
1293
- var x = '<div style=width:100%;max-height:260px;overflow-x:hidden;overflow:auto;line-height:160%;font-size:10px><pre>' + message.data + '<pre></div>';
1294
- setDialogMode(2, "MeshCentral Server Errors", 3, server_showErrorsDlgEx, x + '<br /><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> Check and click OK to clear error log.');
1295
- server_showVersionDlgUpdate();
1296
- }
1297
- }
1298
- break;
1299
- }
1300
- case 'events': {
1301
- if ((message.nodeid != null) && (currentNode != null) && (message.nodeid == currentNode._id)) {
1302
- currentDeviceEvents = message.events;
1303
- masterUpdate(1024);
1304
- } else if ((message.user != null) && (message.user == currentUser.name)) {
1305
- currentUserEvents = message.events;
1306
- masterUpdate(2048);
1307
- } else {
1308
- events = message.events;
1309
- masterUpdate(32);
1310
- }
1311
- break;
1312
- }
1313
- case 'getcookie': {
1314
- if (message.tag == 'clickonce') {
1315
- var basicPort = "{{{serverRedirPort}}}" == "" ? "{{{serverPublicPort}}}" : "{{{serverRedirPort}}}";
1316
- var rdpurl = "http://" + window.location.hostname + ":" + basicPort + "/clickonce/minirouter/MeshMiniRouter.application?WS=wss%3A%2F%2F" + window.location.hostname + "%2Fmeshrelay.ashx%3Fauth=" + message.cookie + "&CH={{{webcerthash}}}&AP=" + message.protocol + ((debugmode == 1) ? "" : "&HOL=1");
1317
- var newWindow = window.open(rdpurl, '_blank');
1318
- newWindow.opener = null;
1319
- }
1320
- break;
1321
- }
1322
- case 'getNotes': {
1323
- var n = Q('d2devNotes');
1324
- if (n && (message.id == decodeURIComponent(n.attributes['noteid'].value))) {
1325
- if (message.notes) { QH('d2devNotes', decodeURIComponent(message.notes)); } else { QH('d2devNotes', ''); }
1326
- var ro = n.attributes['ro'].value == 'true';
1327
- if (ro == false) { // If we have permissions, set read/write on this note.
1328
- n.removeAttribute('readonly');
1329
- QE('idx_dlgOkButton', true);
1330
- QV('idx_dlgOkButton', true);
1331
- focusTextBox('d2devNotes');
1332
- }
1333
- }
1334
- break;
1335
- }
1336
- case 'otpauth-request': {
1337
- if ((xxdialogMode == 2) && (xxdialogTag == 'otpauth-request')) {
1338
- var secret = message.secret;
1339
- if (secret.length == 52) { secret = secret.split(/(.............)/).filter(Boolean).join(' '); }
1340
- else if (secret.length == 32) { secret = secret.split(/(....)/).filter(Boolean).join(' '); secret = secret.substring(0, 20) + '<br/>' + secret.substring(20) }
1341
- QH('d2optinfo', '<table style=width:380px><tr><td style=vertical-align:top>Install <a href=\"https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2\" rel=\"noreferrer noopener\" target=_blank>Google Authenticator</a> or a compatible application and scan the barcode, use <a href=\"' + message.url + '\" rel=\"noreferrer noopener\" target=_blank> this link</a> or enter the secret. Then, enter the current 6 digit token below to activate 2-Step login.<br /><br />Secret<br /><tt id=d2optsecret secret=\"' + message.secret + '\" style=font-size:12px>' + secret + '</tt><br /><br /></td><td style=width:1px;vertical-align:top><a href=\"' + message.url + '\" rel=\"noreferrer noopener\" target=_blank><div id="qrcode"></div></a></td><tr><td colspan=2 style="text-align:center;border-top:1px solid black"><br />Enter the token here for 2-step login: <input type=text onkeypress=\"return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)\" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text></td></table>');
1342
- new QRCode(Q("qrcode"), { text: message.url, width: 128, height: 128, colorDark: "#000000", colorLight: "#EEE", correctLevel: QRCode.CorrectLevel.H });
1343
- QV('idx_dlgOkButton', true);
1344
- QE('idx_dlgOkButton', false);
1345
- Q('d2otpauthinput').focus();
1346
- }
1347
- break;
1348
- }
1349
- case 'otpauth-setup': {
1350
- if (xxdialogMode) return;
1351
- setDialogMode(2, "Add 2-Step Login", 1, null, message.success ? "<b style=color:green>2-step login activation successful</b>. You will now need a valid token to login again." : "<b style=color:red>2-step login activation failed</b>. Clear the secret from the application and try again. You only have a few minutes to enter the proper code.");
1352
- break;
1353
- }
1354
- case 'otpauth-clear': {
1355
- if (xxdialogMode) return;
1356
- setDialogMode(2, "Remove 2-Step Login", 1, null, message.success ? "<b style=color:green>2-step login activation removed</b>. You can reactivate this feature at any time." : "<b style=color:red>2-step login activation removal failed</b>. Try again.");
1357
- break;
1358
- }
1359
- case 'event': {
1360
- if (!message.event.nolog) {
1361
- events.unshift(message.event);
1362
- var eventLimit = parseInt(p3limitdropdown.value);
1363
- while (events.length > eventLimit) { events.pop(); } // Remove element(s) at the end
1364
- masterUpdate(32);
1365
- }
1366
- switch (message.event.action) {
1367
- case 'accountcreate':
1368
- case 'accountchange': {
1369
- // An account was created or changed
1370
- if (userinfo.name == message.event.account.name) {
1371
- var newsiteadmin = message.event.account.siteadmin?message.event.account.siteadmin:0;
1372
- var oldsiteadmin = userinfo.siteadmin?userinfo.siteadmin:0;
1373
- if ((message.event.account.quota != userinfo.quota) || (((userinfo.siteadmin & 8) == 0) && ((message.event.account.siteadmin & 8) != 0))) { meshserver.send({ action: 'files' }); }
1374
- userinfo = message.event.account;
1375
- if (oldsiteadmin != newsiteadmin) updateSiteAdmin();
1376
- QV('verifyEmailId', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
1377
- QV('verifyEmailId2', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
1378
- }
1379
- if (users == null) break;
1380
- users[message.event.account._id] = message.event.account;
1381
- updateUsers();
1382
- break;
1383
- }
1384
- case 'accountremove': {
1385
- // An account was removed
1386
- if (users == null) break;
1387
- delete users['user/' + domain + '/' + message.event.username.toLowerCase()];
1388
- updateUsers();
1389
- break;
1390
- }
1391
- case 'createmesh': {
1392
- // A new mesh was created
1393
- if (message.event.links['user/' + domain + '/' + userinfo.name.toLowerCase()] != null) { // Check if this is a mesh create for a mesh we own. If site administrator, we get all messages so need to ignore some.
1394
- meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
1395
- masterUpdate(4 + 128);
1396
- meshserver.send({ action: 'files' });
1397
- }
1398
- break;
1399
- }
1400
- case 'meshchange': {
1401
- // Update mesh information
1402
- if (meshes[message.event.meshid] == null) {
1403
- // This is a new mesh for us
1404
- meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
1405
- meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
1406
- } else {
1407
- // This is an existing mesh
1408
- meshes[message.event.meshid].name = message.event.name;
1409
- meshes[message.event.meshid].desc = message.event.desc;
1410
- meshes[message.event.meshid].flags = message.event.flags;
1411
- meshes[message.event.meshid].links = message.event.links;
1412
-
1413
- // Check if we lost rights to this mesh in this change.
1414
- if (meshes[message.event.meshid].links['user/' + domain + '/' + userinfo.name.toLowerCase()] == null) {
1415
- if ((xxcurrentView == 20) && (currentMesh == meshes[message.event.meshid])) go(2);
1416
- delete meshes[message.event.meshid];
1417
-
1418
- // Delete all nodes in that mesh
1419
- var newnodes = [];
1420
- for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } }
1421
- nodes = newnodes;
1422
-
1423
- // If we are looking at a node in the deleted mesh, move back to "My Devices"
1424
- if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) { setDialogMode(0); go(1); }
1425
- }
1426
- }
1427
- masterUpdate(4 + 128);
1428
- meshserver.send({ action: 'files' });
1429
-
1430
- // If we are looking at a mesh that is now deleted, move back to "My Account"
1431
- if (xxcurrentView == 20 && currentMesh._id == message.event.meshid) { p20updateMesh(); }
1432
- break;
1433
- }
1434
- case 'deletemesh': {
1435
- // Delete the mesh
1436
- if (meshes[message.event.meshid]) {
1437
- delete meshes[message.event.meshid];
1438
- masterUpdate(128);
1439
- meshserver.send({ action: 'files' });
1440
- }
1441
-
1442
- // Delete all nodes in that mesh
1443
- var newnodes = [];
1444
- for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } }
1445
- nodes = newnodes;
1446
- masterUpdate(4);
1447
-
1448
- // If we are looking at a mesh that is now deleted, move back to "My Account"
1449
- if (xxcurrentView >= 20 && xxcurrentView < 30 && currentMesh._id == message.event.meshid) { setDialogMode(0); go(2); }
1450
- // If we are looking at a node in the deleted mesh, move back to "My Devices"
1451
- if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) { setDialogMode(0); go(1); }
1452
-
1453
- break;
1454
- }
1455
- case 'addnode': {
1456
- var node = message.event.node;
1457
- if (!meshes[node.meshid]) break; // This is a node for a mesh we don't know. Happens when we are site administrator, we get all messages.
1458
- node.namel = node.name.toLowerCase();
1459
- if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1460
- node.meshnamel = meshes[node.meshid].name.toLowerCase();
1461
- node.state = 0;
1462
- if (!node.icon) node.icon = 1;
1463
- node.ident = ++nodeShortIdent;
1464
- nodes.push(node);
1465
-
1466
- // Web page update
1467
- masterUpdate(1 | 2 | 4 | 16);
1468
-
1469
- break;
1470
- }
1471
- case 'removenode': {
1472
- var index = -1;
1473
- for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1474
- if (index != -1) {
1475
- var node = nodes[index];
1476
- if (currentNode == node) {
1477
- if (xxcurrentView >= 10 && xxcurrentView < 20) { setDialogMode(0); go(1); }
1478
- currentNode = null;
1479
- // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
1480
- }
1481
- nodes.splice(index, 1);
1482
-
1483
- // Web page update
1484
- masterUpdate(4 | 16);
1485
- }
1486
- break;
1487
- }
1488
- case 'changenode': {
1489
- var index = -1;
1490
- for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1491
- if (index != -1) {
1492
- var node = nodes[index];
1493
-
1494
- // Change the node
1495
- node.name = message.event.node.name;
1496
- node.rname = message.event.node.rname;
1497
- node.users = message.event.node.users;
1498
- node.host = message.event.node.host;
1499
- node.desc = message.event.node.desc;
1500
- node.osdesc = message.event.node.osdesc;
1501
- node.publicip = message.event.node.publicip;
1502
- node.iploc = message.event.node.iploc;
1503
- node.wifiloc = message.event.node.wifiloc;
1504
- node.gpsloc = message.event.node.gpsloc;
1505
- node.tags = message.event.node.tags;
1506
- node.userloc = message.event.node.userloc;
1507
- if (message.event.node.agent != null) {
1508
- if (node.agent == null) node.agent = {};
1509
- if (message.event.node.agent.ver != null) { node.agent.ver = message.event.node.agent.ver; }
1510
- if (message.event.node.agent.id != null) { node.agent.id = message.event.node.agent.id; }
1511
- if (message.event.node.agent.caps != null) { node.agent.caps = message.event.node.agent.caps; }
1512
- if (message.event.node.agent.core != null) { node.agent.core = message.event.node.agent.core; } else { if (node.agent.core) { delete node.agent.core; } }
1513
- node.agent.tag = message.event.node.agent.tag;
1514
- }
1515
- if (message.event.node.intelamt != null) {
1516
- if (node.intelamt == null) node.intelamt = {};
1517
- if (message.event.node.intelamt.host != null) { node.intelamt.user = message.event.node.intelamt.host; }
1518
- if (message.event.node.intelamt.user != null) { node.intelamt.user = message.event.node.intelamt.user; }
1519
- if (message.event.node.intelamt.tls != null) { node.intelamt.tls = message.event.node.intelamt.tls; }
1520
- if (message.event.node.intelamt.ver != null) { node.intelamt.ver = message.event.node.intelamt.ver; }
1521
- if (message.event.node.intelamt.state != null) { node.intelamt.state = message.event.node.intelamt.state; }
1522
- }
1523
- node.namel = node.name.toLowerCase();
1524
- if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1525
- if (message.event.node.icon) { node.icon = message.event.node.icon; }
1526
-
1527
- // Web page update
1528
- masterUpdate(2 | 4 | 8 | 16);
1529
- refreshDevice(node._id);
1530
-
1531
- if ((currentNode == node) && (xxdialogMode != null) && (xxdialogTag == '@xxmap')) { p10showNodeLocationDialog(); }
1532
- }
1533
- break;
1534
- }
1535
- case 'nodeconnect': {
1536
- // Indicated a node has changed connectivity state
1537
- var index = -1;
1538
- for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1539
- if (index != -1) {
1540
- var node = nodes[index];
1541
-
1542
- // Change the node connection state
1543
- node.conn = message.event.conn;
1544
- node.pwr = message.event.pwr;
1545
-
1546
- // Web page update
1547
- masterUpdate(4 | 16);
1548
- refreshDevice(node._id);
1549
- }
1550
- break;
1551
- }
1552
- case 'wssessioncount': {
1553
- // Update the active web socket session count for a user
1554
- if (wssessions != null) {
1555
- if (message.event.count == 0 && wssessions['user/' + domain + '/' + message.event.username.toLowerCase()]) {
1556
- delete wssessions['user/' + domain + '/' + message.event.username.toLowerCase()];
1557
- } else {
1558
- wssessions['user/' + domain + '/' + message.event.username.toLowerCase()] = message.event.count;
1559
- }
1560
- updateUsers();
1561
- }
1562
- break;
1563
- }
1564
- case 'clearevents': {
1565
- events = [];
1566
- masterUpdate(32);
1567
- break;
1568
- }
1569
- case 'login': {
1570
- // Update the last login time
1571
- if (users != null && users['user/' + domain + '/' + message.event.username.toLowerCase()]) { users['user/' + domain + '/' + message.event.username.toLowerCase()].login = message.event.time; }
1572
- break;
1573
- }
1574
- case 'scanamtdevice': {
1575
- // Populate the Intel AMT scan dialog box with the result of the RMCP scan
1576
- if ((xxdialogMode == null) || (!Q('dp1range')) || (Q('dp1range').value != message.event.range)) return;
1577
- var x = '';
1578
- if (message.event.results == null) {
1579
- // The scan could not occur because of an error. Likely the user range was invalid.
1580
- x = '<div style=width:100%;text-align:center;margin-top:12px>Unable to scan this address range.</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>';
1581
- } else {
1582
- // Go thru all the results and populate the dialog box
1583
- amtScanResults = message.event.results;
1584
- for (var i in message.event.results) {
1585
- var r = message.event.results[i], shortname = r.hostname;
1586
- if (shortname.length > 20) { shortname = shortname.substring(0, 20) + '...'; }
1587
- var str = '<b title="' + EscapeHtml(r.hostname) + '">' + EscapeHtml(shortname) + '</b> - v' + r.ver;
1588
- if (r.state == 2) { if (r.tls == 1) { str += ' with TLS.'; } else { str += ' without TLS.'; } } else { str += ' not activated.'; }
1589
- x += '<div style=width:100%;margin-bottom:2px;background-color:lightgray><div style=padding:4px><div style=display:inline-block;margin-right:5px><input class=DevScanCheckbox name=dp1checkbox tag="' + EscapeHtml(i) + '" type=checkbox onclick=addAmtScanToMeshCheckbox() /></div><div class=j1 style=display:inline-block></div><div style=display:inline-block;margin-left:5px;overflow-x:auto;white-space:nowrap>' + str + '</div></div></div>';
1590
- }
1591
- // If no results where found, display a nice message
1592
- if (x == '') { x = '<div style=width:100%;text-align:center;margin-top:12px>Scan returned no results.</div><div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>'; }
1593
- }
1594
- // Set the html in the dialog box and re-enable the scan button
1595
- QH('dp1results', x);
1596
- QE('dp1range', true);
1597
- QE('dp1rangebutton', true);
1598
- break;
1599
- }
1600
- case 'notify': {
1601
- var n = { text: message.event.value };
1602
- if (message.event.tag != null) { n.tag = message.event.tag; }
1603
- addNotification(n);
1604
- break;
1605
- }
1606
- default:
1607
- //console.log('Unknown message.event.action', message.event.action);
1608
- break;
1609
- }
1610
- break;
1611
- }
1612
- default:
1613
- console.log('Unknown message.action', message.action);
1614
- break;
1615
- }
1616
- }
1617
-
1618
- //
1619
- // MY DEVICES
1620
- //
1621
-
1622
- function onRealNameCheckBox() {
1623
- showRealNames = Q('RealNameCheckBox').checked;
1624
- putstore("showRealNames", showRealNames ? 1 : 0);
1625
- masterUpdate(6)
1626
- return;
1627
- }
1628
-
1629
- function onDeviceViewChange(i) {
1630
- if (i != null) { Q('viewselect').value = i; }
1631
- for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); }
1632
- Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel');
1633
- putstore("deviceView", Q('viewselect').value);
1634
- putstore("viewsize", Q('sizeselect').value);
1635
- masterUpdate(4);
1636
- }
1637
-
1638
- function ondockeypress(e) {
1639
- if (!xxdialogMode && xxcurrentView == 11 && desktop && Q("DeskControl").checked) return desktop.m.handleKeys(e);
1640
- if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) return terminal.m.TermHandleKeys(e);
1641
- if (!xxdialogMode && xxcurrentView == 15) return agentConsoleHandleKeys(e);
1642
- if (!xxdialogMode && xxcurrentView == 4) {
1643
- if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1644
- var processed = 0;
1645
- if (e.key) {
1646
- if (e.key.length === 1 && userSearchFocus == 0) { Q('UserSearchInput').value = ((Q('UserSearchInput').value + e.key)); processed = 1; }
1647
- if (e.keyCode == 8 && userSearchFocus == 0) { var x = Q('UserSearchInput').value; Q('UserSearchInput').value = x.substring(0, x.length - 1); processed = 1; }
1648
- if (e.keyCode == 27) { Q('UserSearchInput').value = ''; processed = 1; }
1649
- } else {
1650
- if (e.charCode != 0 && userSearchFocus == 0) { Q('UserSearchInput').value = ((Q('UserSearchInput').value + String.fromCharCode(e.charCode))); processed = 1; }
1651
- }
1652
- if (processed > 0) { if (processed == 1) { onUserSearchInputChanged(); } return haltEvent(e); }
1653
- }
1654
- if (xxdialogMode || xxcurrentView != 1) return;
1655
- if (e.ctrlKey == true && e.charCode == 96) {
1656
- showRealNames = !showRealNames;
1657
- Q('RealNameCheckBox').value = showRealNames;
1658
- putstore("showRealNames", showRealNames ? 1 : 0);
1659
- masterUpdate(6)
1660
- return;
1661
- }
1662
- if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1663
- if (Q('viewselect').value < 3) {
1664
- var processed = 0;
1665
- if (e.key) {
1666
- if (e.key.length === 1 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + e.key)); processed = 1; }
1667
- if (e.keyCode == 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = x.substring(0, x.length - 1); processed = 1; }
1668
- if (e.keyCode == 27) { Q('SearchInput').value = ''; processed = 1; }
1669
- } else {
1670
- if (e.charCode != 0 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + String.fromCharCode(e.charCode))); processed = 1; }
1671
- }
1672
- if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
1673
- }
1674
- if (Q('viewselect').value == 3) {
1675
- if (e.key) {
1676
- if (e.key.length === 1 && mapSearchFocus == 0) { Q('mapSearchLocation').value = ((Q('mapSearchLocation').value + e.key)); processed = 1; }
1677
- //if (e.keyCode == 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = x.substring(0, x.length - 1); processed = 1; }
1678
- if (e.keyCode == 27) { Q('mapSearchLocation').value = ''; mapCloseSearchWindow(); processed = 1; }
1679
- if (e.keyCode == 13) { getSearchLocation(); }
1680
- } else {
1681
- if (e.charCode != 0 && mapSearchFocus == 0) { Q('mapSearchLocation').value = ((Q('mapSearchLocation').value + String.fromCharCode(e.charCode))); processed = 1; }
1682
- }
1683
- }
1684
- }
1685
-
1686
- function ondockeydown(e) {
1687
- if (!xxdialogMode && xxcurrentView == 11 && desktop && Q("DeskControl").checked) { return desktop.m.handleKeyDown(e); }
1688
- if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) { return terminal.m.TermHandleKeyDown(e); }
1689
- if (!xxdialogMode && xxcurrentView == 13 && e.keyCode == 116 && p13filetree != null) { haltEvent(e); return false; } // F5 Refresh on files
1690
- if (!xxdialogMode && xxcurrentView == 15) { return agentConsoleHandleKeys(e); }
1691
- if (!xxdialogMode && xxcurrentView == 4) {
1692
- if (e.keyCode === 8 && userSearchFocus == 0) { var x = Q('UserSearchInput').value; Q('UserSearchInput').value = (x.substring(0, x.length - 1)); processed = 1; }
1693
- if (e.keyCode === 27) { Q('UserSearchInput').value = ''; processed = 1; }
1694
- if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
1695
- }
1696
- if (xxdialogMode || xxcurrentView != 1 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1697
- var processed = 0;
1698
- if (Q('viewselect').value < 3) {
1699
- if (e.keyCode === 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = (x.substring(0, x.length - 1)); processed = 1; }
1700
- if (e.keyCode === 27) { Q('SearchInput').value = ''; processed = 1; }
1701
- if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
1702
- }
1703
- if (Q('viewselect').value == 3) {
1704
- if (e.keyCode === 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = (x.substring(0, x.length - 1)); processed = 1; }
1705
- if (e.keyCode === 27) { Q('mapSearchLocation').value = ''; mapCloseSearchWindow(); processed = 1; }
1706
- }
1707
- }
1708
-
1709
- function ondockeyup(e) {
1710
- if (!xxdialogMode && xxcurrentView == 11 && desktop && Q("DeskControl").checked) return desktop.m.handleKeyUp(e);
1711
- if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) return terminal.m.TermHandleKeyUp(e);
1712
- if (!xxdialogMode && xxcurrentView == 13 && e.keyCode == 116 && p13filetree != null) { p13folderup(9999); haltEvent(e); return false; } // F5 Refresh on files
1713
- if (!xxdialogMode && xxcurrentView == 4) { if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
1714
- if (xxdialogMode && e.keyCode == 27) { dialogclose(0); }
1715
- if (xxdialogMode || xxcurrentView != 0 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1716
- if (Q('viewselect').value < 3) { if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
1717
- if (Q('viewselect').value == 3) { if ((e.keyCode === 8 && mapSearchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
1718
- }
1719
-
1720
- // Highlights the device being hovered
1721
- function devMouseHover(element, over) {
1722
- var view = Q('viewselect').value;
1723
- if (view == 1) {
1724
- var e = element.children[1].children[1];
1725
- e.classList.remove('f1s');
1726
- e.children[0].classList.remove('g1s');
1727
- //e.children[1].classList.remove('e2s');
1728
- e.children[2].classList.remove('g2s');
1729
- if (over == 1) {
1730
- e.classList.add('f1s');
1731
- e.children[0].classList.add('g1s');
1732
- //e.children[1].classList.add('e2s');
1733
- e.children[2].classList.add('g2s');
1734
- }
1735
- } else if (view == 2) {
1736
- var e = element;
1737
- e.children[2].classList.remove('g1s');
1738
- e.children[4].classList.remove('e2s');
1739
- e.children[3].classList.remove('g2s');
1740
- if (over == 1) {
1741
- e.children[2].classList.add('g1s');
1742
- e.children[4].classList.add('e2s');
1743
- e.children[3].classList.add('g2s');
1744
- }
1745
- }
1746
- }
1747
-
1748
- var deviceHeaderId = 0;
1749
- var deviceHeaderTotal = 0;
1750
- var deviceHeadersTitles = {};
1751
- var deviceHeaderCount;
1752
- var deviceHeaders = {};
1753
- var oldviewmode = 0;
1754
- function updateDevices() {
1755
- var r = '', c = 0, current = null, count = 0, displayedMeshes = {}, view = Q('viewselect').value, groups = {}, groupCount = {};
1756
- QV('xdevices', view < 4);
1757
- QV('xdevicesmap', view == 4);
1758
- QV('devListToolbar', view < 3);
1759
- QV('kvmListToolbar', view == 3);
1760
- QV('devMapToolbar', view == 4);
1761
- QV('devListToolbarSize', view == 3);
1762
- QV('NoMeshesPanel', meshcount == 0);
1763
- //QV('devListToolbarView', (meshcount != 0) && (nodes.length > 0));
1764
- QV('devListToolbarViewIcons', (meshcount != 0) && (nodes.length > 0));
1765
- QV('devListToolbarSort', (meshcount != 0) && (nodes.length > 0) && (view < 4));
1766
- if ((meshcount == 0) || (nodes.length == 0)) { view = 1; sort = 0; }
1767
- if (view == 4) {
1768
- setTimeout( function() { if (xxmap.map != null) { xxmap.map.updateSize(); } }, 200);
1769
- // TODO
1770
- } else {
1771
- // 3 wide, list view or desktop view
1772
- deviceHeaderId = 0;
1773
- deviceHeaderCount = {};
1774
- deviceHeaderTotal = 0;
1775
- deviceHeaders = {};
1776
- deviceHeadersTitles = {};
1777
- var kvmDivs = [];
1778
-
1779
- // Perform node sort
1780
- if (sort == 0) { nodes.sort(meshSort); }
1781
- else if (sort == 1) { nodes.sort(powerSort); }
1782
- else if (sort == 2) { if (showRealNames == true) { nodes.sort(deviceHostSort); } else { nodes.sort(deviceSort); } }
1783
-
1784
- // Save the list of currently checked nodeid's
1785
- var checkedNodeids = [], elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
1786
- for (var i=0;i<elements.length;i++) { if (elements[i].checked) { checkedNodeids.push(elements[i].value); } }
1787
- if ((oldviewmode < 3) && (view == 3)) { multiDesktopFilter = checkedNodeids; }
1788
- else if ((oldviewmode == 3) && (view < 3)) { checkedNodeids = multiDesktopFilter; }
1789
-
1790
- // Go thru the list of nodes and display them
1791
- for (var i in nodes) {
1792
- if (nodes[i].v == false) continue;
1793
- var mesh2 = meshes[nodes[i].meshid], meshlinks = mesh2.links['user/' + domain + '/' + userinfo.name.toLowerCase()];
1794
- if (meshlinks == null) continue;
1795
- var meshrights = meshlinks.rights;
1796
- if ((view == 3) && (mesh2.mtype == 1)) continue;
1797
- if (sort == 0) {
1798
- // Mesh header
1799
- if (nodes[i].meshid != current) {
1800
- if ((view == 1) && (current != null)) { r += '</div>' }
1801
- deviceHeaderSet();
1802
- var extra = '';
1803
- if (meshes[nodes[i].meshid].mtype == 1) { extra = '<span class=devHeaderx>, Intel® AMT only</span>'; }
1804
- if ((view == 1) && (current != null)) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } }
1805
- r += '<div class=DevSt style=width:100%;padding-top:4px><span style=float:right>';
1806
- r += getMeshActions(mesh2, meshrights);
1807
- r += '</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("' + nodes[i].meshid + '")>' + EscapeHtml(meshes[nodes[i].meshid].name) + '</span>' + extra + '<span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx></span></div>';
1808
- if (view == 1) { r += '<div class=devgrid-container>' }
1809
- current = nodes[i].meshid;
1810
- displayedMeshes[current] = 1;
1811
- c = 0;
1812
- }
1813
- } else if (sort == 1) {
1814
- // Power header
1815
- var pwr = nodes[i].pwr?nodes[i].pwr:0;
1816
- if (pwr !== current) {
1817
- if ((view == 1) && (current != null)) { r += '</div>' }
1818
- deviceHeaderSet();
1819
- if ((view == 1) && (current !== null)) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } }
1820
- r += '<div class=DevSt style=width:100%;padding-top:4px><span>' + PowerStateStr2(nodes[i].pwr) + '</span><span id=DevxHeader' + deviceHeaderId + ' class="devHeaderx"></span></div>';
1821
- if (view == 1) { r += '<div class=devgrid-container>' }
1822
- current = pwr;
1823
- c = 0;
1824
- }
1825
- } else if (sort == 2) {
1826
- // Device header
1827
- if ((view == 1) && (current != null)) { r += '</div>' }
1828
- if (current == null) { current = '1'; }
1829
- if (view == 1) { r += '<div class=devgrid-container>' }
1830
- }
1831
-
1832
- count++;
1833
- var title = EscapeHtml(nodes[i].name);
1834
- if (title.length == 0) { title = '<i>None</i>'; }
1835
- if ((nodes[i].rname != null) && (nodes[i].rname.length > 0)) { title += " / " + EscapeHtml(nodes[i].rname); }
1836
- var name = EscapeHtml(nodes[i].name);
1837
- if (showRealNames == true && nodes[i].rname != null) name = EscapeHtml(nodes[i].rname);
1838
- if (name.length == 0) { name = '<i>None</i>'; }
1839
-
1840
- // Node
1841
- var icon = nodes[i].icon;
1842
- var nodestate = NodeStateStr(nodes[i]);
1843
- if ((!nodes[i].conn) || (nodes[i].conn == 0)) { icon += ' gray'; }
1844
- if (view == 1) {
1845
- r += '<div id=devs onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=display:inline-block;min-width:300px;height:50px;padding-top:1px;padding-bottom:1px><div style=width:22px;height:100%;float:left;padding-top:12px;background-color:#FFF><input class="' + nodes[i].meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + nodes[i]._id + ' type=checkbox></div><div style=height:100%;cursor:pointer onclick=gotoDevice(\'' + nodes[i]._id + '\')><div class="i' + icon + '" style=width:50px;float:left;background-color:#FFF></div><div class=f1 style=height:100%><div class=g1></div><div class=e2><div class=e1 style="width:100%" title="' + title + '">' + name + '</div><div>' + nodestate + '</div></div><div class=g2></div></div></div></div>';
1846
- } else if (view == 2) {
1847
- r += '<tr><td><div id=devs class=bar18 onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=height:18px;width:100%;font-size:medium>';
1848
- r += '<div style=width:22px;float:left;background-color:white><input class="' + nodes[i].meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + nodes[i]._id + ' type=checkbox></div>';
1849
- r += '<div style=float:left;height:18px;width:18px;background-color:white onclick=gotoDevice(\'' + nodes[i]._id + '\')><div class=j' + icon + ' style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
1850
- r += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
1851
- r += '<div style=cursor:pointer;font-size:14px title="' + title + '" onclick=gotoDevice(\'' + nodes[i]._id + '\')><span style=float:right>' + nodestate + '</span><span style=width:300px>' + name + '</span></div></div></td></tr>';
1852
- } else if ((view == 3) && (nodes[i].conn & 1) && (((meshrights & 8) || (meshrights & 256)) != 0) && ((nodes[i].agent.caps & 1) != 0)) { // Check if we have rights and agent is capable of KVM.
1853
- if ((multiDesktopFilter.length == 0) || (multiDesktopFilter.indexOf('devid_' + nodes[i]._id) >= 0)) {
1854
- r += '<div id=devs style=display:inline-block;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div style=padding:3px;cursor:pointer onclick=gotoDevice(\'' + nodes[i]._id + '\',11)>';
1855
- //r += '<input class="' + nodes[i].meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + nodes[i]._id + ' type=checkbox style=float:left>';
1856
- r += '<div class="j' + icon + '" style=width:16px;float:left></div> ' + name + '</div>';
1857
- r += '<span onclick=gotoDevice(\'' + nodes[i]._id + '\')></span><div id=xkvmid_' + nodes[i]._id.split('/')[2] + '><div id=skvmid_' + nodes[i]._id.split('/')[2] + ' style="position:absolute;color:white;left:5px;top:27px;text-shadow:0px 0px 5px #000;z-index:1000;cursor:default" onclick=toggleKvmDevice(\'' + nodes[i]._id + '\')>Disconnected</div></div>';
1858
- r += '</div>';
1859
- kvmDivs.push(nodes[i]._id);
1860
- }
1861
- }
1862
-
1863
- // If we are displaying devices by group, put the device in the right group.
1864
- if ((sort == 3) && (r != '')) {
1865
- if (nodes[i].tags) {
1866
- for (var j in nodes[i].tags) {
1867
- var tag = nodes[i].tags[j];
1868
- if (groups[tag] == null) { groups[tag] = r; groupCount[tag] = 1; } else { groups[tag] += r; groupCount[tag] += 1; }
1869
- if (view == 3) break;
1870
- }
1871
- }
1872
- r = '';
1873
- }
1874
-
1875
- deviceHeaderTotal++;
1876
- if (typeof deviceHeaderCount[nodes[i].state] == 'undefined') { deviceHeaderCount[nodes[i].state] = 1; } else { deviceHeaderCount[nodes[i].state]++; }
1877
- }
1878
-
1879
- if (view == 1) {
1880
- r += '</div>';
1881
- }
1882
-
1883
- // If displaying devices by groups, sort the group names and display the devices.
1884
- if (sort == 3) {
1885
- var groupNames = [];
1886
- for (var i in groups) { groupNames.push(i); }
1887
- groupNames.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); });
1888
- for (var j in groupNames) {
1889
- var i = groupNames[j]; r += '<div class=DevSt style=width:100%;padding-top:4px><span>' + i + '</span><span class="devHeaderx">, ' + groupCount[i] + ' device' + ((groupCount[i] > 1)?'s':'') + '</span></div>' + groups[i];
1890
- }
1891
- }
1892
-
1893
- // If there is nothing to display, explain the problem
1894
- if ((r == '') && (meshcount > 0) && (Q('SearchInput').value != '')) {
1895
- if (sort == 3) {
1896
- r = '<div style="margin:30px">No devices are included in any groups, click on a device\'s \"Groups\" to add to a group.</div>';
1897
- } else {
1898
- r = '<div style="margin:30px">No devices matching this search.</div>';
1899
- }
1900
- }
1901
-
1902
- if ((view == 1) && (c == 2)) r += '<td><div style=width:301px></div></td>'; // Adds device padding
1903
-
1904
- // Display all empty meshes, we need to do this because users can add devices to these at any time.
1905
- if ((sort == 0) && (Q('SearchInput').value == '') && (view < 3)) {
1906
- for (var i in meshes) {
1907
- var mesh = meshes[i], meshlink = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()];
1908
- if (meshlink != null) {
1909
- var meshrights = meshlink.rights;
1910
- if (displayedMeshes[mesh._id] == null) {
1911
- if ((current != '') && (r != '')) { r += '</tr></table>'; }
1912
- r += '<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr><td colspan=3 class=DevSt><span style=float:right>';
1913
- r += getMeshActions(mesh, meshrights);
1914
- r += '</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("' + mesh._id + '")>' + EscapeHtml(mesh.name) + '</span></td></tr><tr>';
1915
- if (mesh.mtype == 1) {
1916
- r += '<td><div style=padding:10px><i>No Intel® AMT devices in this mesh';
1917
- if ((meshrights & 4) != 0) { r += ', <a style=cursor:pointer onclick=addDeviceToMesh(\"' + mesh._id + '\")>add one</a>'; }
1918
- }
1919
- if (mesh.mtype == 2) {
1920
- r += '<td><div style=padding:10px><i>No devices in this mesh';
1921
- if ((meshrights & 4) != 0) { r += ', <a style=cursor:pointer onclick=addAgentToMesh(\"' + mesh._id + '\")>add one</a>'; }
1922
- }
1923
- r += '.</i></div></td>';
1924
- current = mesh._id;
1925
- count++;
1926
- }
1927
- }
1928
- }
1929
- }
1930
- r += '</tr></table><div style=height:1px></div>'; // This height of 1 div fixes a problem in Linux firefox browsers
1931
-
1932
- // Add a "Add Device Group" option
1933
- r += '<div style=border-top-style:solid;border-top-width:1px;border-top-color:#DDDDDD;cursor:pointer;font-size:10px>';
1934
- if ((view < 3) && (sort == 0) && (meshcount > 0)) { r += '<a onclick=account_createMesh() title="Create a new group of devices." style=cursor:pointer>Add Device Group</a> '; }
1935
- r += '<a onclick=p10showMeshCmdDialog(0) style=cursor:pointer title="Download MeshCmd, a command line tool that performs many functions.">MeshCmd</a></div>';
1936
- r += '</div><br/>';
1937
-
1938
- QH('xdevices', r);
1939
- deviceHeaderSet();
1940
-
1941
- // Re-check nodeid's
1942
- var elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
1943
- for (var i=0;i<elements.length;i++) { elements[i].checked = (checkedNodeids.indexOf(elements[i].value) >= 0); }
1944
-
1945
- for (var i in deviceHeaders) { QH(i, deviceHeaders[i]); }
1946
- for (var i in deviceHeadersTitles) { Q(i).title = deviceHeadersTitles[i]; }
1947
- p1updateInfo();
1948
-
1949
- // Take care of KVM surfaces in desktop view mode
1950
- if (view == 3) {
1951
- // Figure out and adjust the size to fill the width of the div
1952
- var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex];
1953
- var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw);
1954
- xw = realw + Math.floor((tw - (xw * realw)) / xw);
1955
- vsize.y = vsize.y * (xw / vsize.x);
1956
- vsize.x = xw;
1957
-
1958
- for (var i in multiDesktop) { multiDesktop[i].xxdelete = true; }
1959
- for (var i in kvmDivs) {
1960
- var id = kvmDivs[i], shortid = id.split('/')[2], desk = multiDesktop[id];
1961
- if (desk != null) {
1962
- // This device already has a canvas, use it.
1963
- desk.m.CanvasId.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
1964
- Q('xkvmid_' + shortid).appendChild(desk.m.CanvasId);
1965
- delete desk.xxdelete;
1966
- QH('skvmid_' + shortid, ['Disconnected', 'Connecting...', 'Setup...', '', ''][((desk.m.State == null)?desk.m.state:desk.m.State)]);
1967
- } else {
1968
- var node = getNodeFromId(id);
1969
- if ((desktopNode == node) && (desktop != null)) { // Check if the main desktop is this device, if it is, use that.
1970
- // This device already has a canvas, use it.
1971
- var c = desktop.m.CanvasId;
1972
- c.setAttribute('id', 'kvmid_' + shortid);
1973
- c.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
1974
- c.setAttribute('onclick', 'toggleKvmDevice(\'' + id + '\')');
1975
- c.removeAttribute('onmousedown');
1976
- c.removeAttribute('onmouseup');
1977
- c.removeAttribute('onmousemove');
1978
- Q('xkvmid_' + shortid).appendChild(c);
1979
- QH('skvmid_' + shortid, ['Disconnected', 'Connecting...', 'Setup...', '', ''][((desktop.m.State == null)?desktop.m.state:desktop.m.State)]);
1980
- if (desktop.m.SendCompressionLevel) { desktop.m.SendCompressionLevel(1, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); }
1981
- desktop.shortid = shortid;
1982
- desktop.onStateChanged = onMultiDesktopStateChange;
1983
- multiDesktop[id] = desktop;
1984
- desktop = desktopNode = currentNode = null;
1985
- // Setup a replacement desktop
1986
- QH('DeskParent', '<canvas id="Desk" width="640" height="480" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');
1987
- } else {
1988
- // This is a new device, create a canvas for it.
1989
- var c = document.createElement('canvas');
1990
- c.setAttribute('id', 'kvmid_' + shortid);
1991
- c.setAttribute('width', 640);
1992
- c.setAttribute('height', 480);
1993
- c.setAttribute('oncontextmenu', 'return false');
1994
- c.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
1995
- c.setAttribute('onclick', 'toggleKvmDevice(\'' + id + '\')');
1996
- try { Q('xkvmid_' + shortid).appendChild(c); } catch (ex) {}
1997
- // Check if we need to auto-connect
1998
- if (Q('autoConnectDesktopCheckbox').checked == true) { setTimeout(function() { connectMultiDesktop(node, 1); }, 100); }
1999
- }
2000
- }
2001
- }
2002
- for (var i in multiDesktop) {
2003
- // If a device is no longer viewed, disconnect it.
2004
- if (multiDesktop[i].xxdelete == true) { multiDesktop[i].Stop(); delete multiDesktop[i]; }
2005
- else if (debugmode && multiDesktop[i].m && multiDesktop[i].m.onScreenSizeChange) {
2006
- mdeskAdjust(multiDesktop[i].m, multiDesktop[i].m.ScreenWidth, multiDesktop[i].m.ScreenHeight, multiDesktop[i].m.CanvasId); // Adjust screen size change
2007
- }
2008
- }
2009
- deskAdjust();
2010
- } else {
2011
- disconnectAllKvmFunction();
2012
- Q('autoConnectDesktopCheckbox').checked = false;
2013
- }
2014
- }
2015
- oldviewmode = view;
2016
- }
2017
-
2018
- function toggleKvmDevice(nodeid) {
2019
- var node = getNodeFromId(nodeid), mesh = meshes[node.meshid], meshrights = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
2020
- if ((meshrights & 8) || (meshrights & 256)) { // Requires remote control rights or desktop view only rights
2021
- //var conn = 0;
2022
- //if ((node.conn & 1) != 0) { conn = 1; } else if ((node.conn & 6) != 0) { conn = 2; } // Check what type of connect we can do (Agent vs AMT)
2023
- if (node.conn & 1) { connectMultiDesktop(node, 1); }
2024
- }
2025
- }
2026
-
2027
- function autoConnectDesktops() { if (Q('autoConnectDesktopCheckbox').checked == true) { connectAllKvmFunction(); } }
2028
- function connectAllKvmFunction() { for (var i in nodes) { if (multiDesktop[nodes[i]._id] == null) { toggleKvmDevice(nodes[i]._id); } } }
2029
- function disconnectAllKvmFunction() { for (var nodeid in multiDesktop) { multiDesktop[nodeid].Stop(); } multiDesktop = {}; }
2030
- function onMultiDesktopStateChange(desk, state) { try { QH('skvmid_' + desk.shortid, ['Disconnected', 'Connecting...', 'Setup...', '', ''][state]); } catch (ex) {} }
2031
-
2032
- function showMultiDesktopSettings() {
2033
- QV('d7amtkvm', false);
2034
- QV('d7meshkvm', true);
2035
- d7bitmapquality.value = multidesktopsettings.quality;
2036
- d7bitmapscaling.value = multidesktopsettings.scaling;
2037
- if (multidesktopsettings.framerate) { d7framelimiter.value = multidesktopsettings.framerate; } else { d7framelimiter.value = 1000; }
2038
- setDialogMode(7, "Remote Desktop Settings", 3, showMultiDesktopSettingsChanged);
2039
- }
2040
-
2041
- function showMultiDesktopSettingsChanged() {
2042
- multidesktopsettings.quality = d7bitmapquality.value;
2043
- multidesktopsettings.scaling = d7bitmapscaling.value;
2044
- multidesktopsettings.framerate = d7framelimiter.value;
2045
- localStorage.setItem('multidesktopsettings', JSON.stringify(multidesktopsettings));
2046
- // Make changes to all current connections
2047
- for (var i in multiDesktop) { multiDesktop[i].m.SendCompressionLevel(1, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); }
2048
- }
2049
-
2050
- function connectMultiDesktop(node, contype) {
2051
- var nodeid = node._id, shortid = nodeid.split('/')[2];
2052
- var desk = multiDesktop[nodeid];
2053
- if (desk == null) {
2054
- if (Q('kvmid_' + shortid) == null) return; // Check if this device is being displayed, if not, exit now.
2055
- if (contype == 2) {
2056
- // Setup the Intel AMT remote desktop
2057
- if ((node.intelamt.user == null) || (node.intelamt.user == '')) { return; }
2058
- desk = CreateAmtRedirect(CreateAmtRemoteDesktop('kvmid_' + shortid));
2059
- desk.shortid = shortid;
2060
- //desk.debugmode = debugmode;
2061
- desk.onStateChanged = onMultiDesktopStateChange;
2062
- desk.m.bpp = 1;
2063
- desk.m.useZRLE = true;
2064
- desk.m.showmouse = true;
2065
- desk.m.onKvmData = function (data) { console.log('KVM Data received in multi-desktop mode, this is not supported.'); }; // KVM Data Channel not supported in multi-desktop right now.
2066
- //desk.m.onScreenSizeChange = deskAdjust;
2067
- if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust
2068
- desk.Start(nodeid, 16994, '*', '*', 0);
2069
- desk.contype = 2;
2070
- multiDesktop[nodeid] = desk;
2071
- } else if (contype == 1) {
2072
- // Setup the Mesh Agent remote desktop
2073
- desk = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('kvmid_' + shortid), serverPublicNamePort);
2074
- desk.shortid = shortid;
2075
- desk.attemptWebRTC = attemptWebRTC;
2076
- desk.onStateChanged = onMultiDesktopStateChange;
2077
- desk.m.CompressionLevel = multidesktopsettings.quality;
2078
- desk.m.ScalingLevel = multidesktopsettings.scaling;
2079
- desk.m.FrameRateTimer = multidesktopsettings.framerate;
2080
- //desk.m.onDisplayinfo = deskDisplayInfo;
2081
- //desk.m.onScreenSizeChange = deskAdjust;
2082
- if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust
2083
- desk.Start(nodeid);
2084
- desk.contype = 1;
2085
- multiDesktop[nodeid] = desk;
2086
- }
2087
- } else {
2088
- // Disconnect and clean up the remote desktop
2089
- desk.Stop();
2090
- delete multiDesktop[nodeid];
2091
- }
2092
- }
2093
-
2094
- function getMeshActions(mesh, meshrights) {
2095
- if ((meshrights & 4) == 0) return '';
2096
- var r = '';
2097
- if ((features & 1024) == 0) { // If CIRA is allowed
2098
- r += ' <a style=cursor:pointer;font-size:10px title="Add a new Intel® AMT computer that is located on the internet." onclick=addCiraDeviceToMesh(\"' + mesh._id + '\")>Add CIRA</a>';
2099
- }
2100
- if (mesh.mtype == 1) {
2101
- if ((features & 1) == 0) { // If not WAN-Only
2102
- r += ' <a style=cursor:pointer;font-size:10px title="Add a new Intel® AMT computer that is located on the local network." onclick=addDeviceToMesh(\"' + mesh._id + '\")>Add Local</a>';
2103
- r += ' <a style=cursor:pointer;font-size:10px title="Add a new Intel® AMT computer by scanning the local network." onclick=addAmtScanToMesh(\"' + mesh._id + '\")>Scan Network</a>';
2104
- }
2105
- }
2106
- if (mesh.mtype == 2) {
2107
- r += ' <a style=cursor:pointer;font-size:10px title="Add a new computer to this mesh by installing the mesh agent." onclick=addAgentToMesh(\"' + mesh._id + '\")>Add Agent</a>';
2108
- if (features & 64) {
2109
- r += ' <a style=cursor:pointer;font-size:10px title="Invite someone to install the mesh agent on this mesh." onclick=inviteAgentToMesh(\"' + mesh._id + '\")>Invite</a>';
2110
- }
2111
- }
2112
- return r;
2113
- }
2114
-
2115
- function addDeviceToMesh(meshid) {
2116
- if (xxdialogMode) return;
2117
- var mesh = meshes[meshid];
2118
- var x = "Add a new Intel® AMT device to device group \"" + EscapeHtml(mesh.name) + "\".<br /><br />";
2119
- x += addHtmlValue('Device Name', '<input id=dp1devicename style=width:230px maxlength=32 autocomplete=off onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
2120
- x += addHtmlValue('Hostname', '<input id=dp1hostname style=width:230px maxlength=32 autocomplete=off placeholder="Same as device name" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
2121
- x += addHtmlValue('Username', '<input id=dp1username style=width:230px maxlength=32 autocomplete=off placeholder="admin" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
2122
- x += addHtmlValue('Password', '<input id=dp1password type=password style=width:230px autocomplete=off maxlength=32 onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
2123
- x += addHtmlValue('Security', '<select id=dp1tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>');
2124
- setDialogMode(2, "Add Intel® AMT device", 3, addDeviceToMeshEx, x, meshid);
2125
- validateDeviceToMesh();
2126
- Q('dp1devicename').focus();
2127
- }
2128
-
2129
- // Display the Intel AMT scanning dialog box
2130
- function addAmtScanToMesh(meshid) {
2131
- if (xxdialogMode) return;
2132
- var x = "Enter a range of IP addresses to scan for Intel AMT devices.<br /><br />";
2133
- x += addHtmlValue('IP Range', '<input id=dp1range style=width:184px value="192.168.1.0/24" onkeyup=addAmtScanToMeshKeyUp(event) /><input id=dp1rangebutton type=button value=Scan onclick=addAmtScanToMeshButton()></input>');
2134
- x += '<div id=dp1results style="width:100%;height:200px;background-color:white;border:1px gray solid;overflow-y:scroll"></div>';
2135
- setDialogMode(2, "Scan for Intel® AMT devices", 3, addAmtScanToMeshEx, x, meshid);
2136
- QE('idx_dlgOkButton', false);
2137
- QH('dp1results', '<div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>');
2138
- focusTextBox('dp1range');
2139
- }
2140
-
2141
- function addAmtScanToMeshKeyUp(e) {
2142
- if (e.keyCode == 13) { haltEvent(e); addAmtScanToMeshButton(); }
2143
- }
2144
-
2145
- // Called when OK is pressed on the Intel AMT scanning box
2146
- function addAmtScanToMeshEx(button, meshid) {
2147
- var elements = document.getElementsByClassName("DevScanCheckbox"), checkcount = 0;
2148
- for (var i=0;i<elements.length;i++) {
2149
- if (elements[i].checked) {
2150
- var ipaddr = elements[i].getAttribute('tag');
2151
- var amtinfo = amtScanResults[ipaddr];
2152
- meshserver.send({ action: 'addamtdevice', meshid: meshid, devicename: ipaddr, hostname: amtinfo.hostname, amtusername: '', amtpassword: '', amttls: amtinfo.tls });
2153
- }
2154
- }
2155
- }
2156
-
2157
- // If the user presses the "Scan" button on the Intel AMT scanning dialog box, start a scan.
2158
- function addAmtScanToMeshButton() {
2159
- QE('dp1range', false);
2160
- QE('dp1rangebutton', false);
2161
- QH('dp1results', '<div style=width:100%;text-align:center;margin-top:12px>Scanning...</div>');
2162
- meshserver.send({ action: 'scanamtdevice', range: Q('dp1range').value });
2163
- }
2164
-
2165
- // Called when a scanned computer is checked or unchecked.
2166
- function addAmtScanToMeshCheckbox() {
2167
- var elements = document.getElementsByClassName("DevScanCheckbox"), checkcount = 0;
2168
- for (var i=0;i<elements.length;i++) { if (elements[i].checked) checkcount++; }
2169
- QE('idx_dlgOkButton', checkcount > 0);
2170
- }
2171
-
2172
- function addCiraDeviceToMesh(meshid) {
2173
- if (xxdialogMode) return;
2174
- var mesh = meshes[meshid];
2175
-
2176
- // Replace non alphabetic characters (@ and $) with 'X' because MPS username cannot accept it.
2177
- var meshidx = meshid.split('/')[2].replace(/\@/g, 'X').replace(/\$/g, 'X');
2178
-
2179
- var y = '<select id=dlgAddCiraSel onclick=dlgAddCiraSelClick() style=width:230px><option value=0>MeshCommander Script</option><option value=1>Manual Username/Password</option>';
2180
- if ((features & 16) == 0) { y += '<option value=2>Manual Certificate</option></select>'; } // Only display this option if Intel AMT CIRA with Mutual-Auth is allowed.
2181
-
2182
- var x = '';
2183
- x += addHtmlValue('Setup Method', y);
2184
- x += '<hr>';
2185
-
2186
- // Setup CIRA using a MeshCommander script (Pretty Simple)
2187
- x += "<div id=dlgAddCira0>To add a new Intel® AMT device to device group \"" + EscapeHtml(mesh.name) + "\" with CIRA, download the following script files and use <a href='http://meshcommander.com' rel='noreferrer noopener' target='_blank'>MeshCommander</a> to run the script to configure computers.<br /><br />";
2188
- x += addHtmlValue('Setup CIRA', '<a href="mescript.ashx?type=1&meshid=' + meshidx.substring(0, 16) + '" rel="noreferrer noopener" target="_blank">cira_setup.mescript</a>');
2189
- x += addHtmlValue('Cleanup CIRA', '<a href="mescript.ashx?type=2" rel="noreferrer noopener" target="_blank">cira_clean.mescript</a>');
2190
- x += "</div>";
2191
-
2192
- // Setup CIRA with user/pass authentication (Somewhat difficult)
2193
- x += "<div id=dlgAddCira1 style=display:none>To add a new Intel® AMT device to device group \"" + EscapeHtml(mesh.name) + "\" with CIRA, load the following certificate as trusted root within Intel AMT";
2194
- if (serverinfo.mpspass) { x += " and authenticate to the server using this username and password.<br /><br />"; } else { x += " and authenticate to the server using this username and any password.<br /><br />"; }
2195
- x += addHtmlValue('Root Certificate', '<a href="MeshServerRootCert.cer" rel="noreferrer noopener" target="_blank">Root Certificate File</a>');
2196
- x += addHtmlValue('Username', '<input style=width:230px readonly value="' + meshidx.substring(0, 16) + '" />');
2197
- if (serverinfo.mpspass) { x += addHtmlValue('Password', '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpspass) + '" />'); }
2198
- if (serverinfo != null) { x += addHtmlValue('MPS Server', '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpsname) + ':' + serverinfo.mpsport + '" />'); }
2199
- x += "</div>";
2200
-
2201
- // Setup CIRA with certificate authentication (Really difficult, only if TLS offload is not used)
2202
- if ((features & 16) == 0) {
2203
- x += "<div id=dlgAddCira2 style=display:none>To add a new Intel® AMT device to device group \"" + EscapeHtml(mesh.name) + "\" with CIRA, load the following certificate as trusted root within Intel AMT, authenticate using a client certificate with the following common name and connect to the following server.<br /><br />";
2204
- x += addHtmlValue('Root Certificate', '<a href="MeshServerRootCert.cer" rel="noreferrer noopener" target="_blank">Root Certificate File</a>');
2205
- x += addHtmlValue('Organization', '<input style=width:230px readonly value="' + meshidx + '" />');
2206
- if (serverinfo != null) { x += addHtmlValue('MPS Server', '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpsname) + ':' + serverinfo.mpsport + '" />'); }
2207
- x += "</div>";
2208
- }
2209
-
2210
- setDialogMode(2, "Add Intel® AMT CIRA device", 1, null, x);
2211
- }
2212
-
2213
- function dlgAddCiraSelClick() {
2214
- var val = Q('dlgAddCiraSel').value;
2215
- QV('dlgAddCira0', val == 0);
2216
- QV('dlgAddCira1', val == 1);
2217
- QV('dlgAddCira2', val == 2);
2218
- }
2219
-
2220
- // Return true is the input string looks like an email address
2221
- function checkEmail(str) {
2222
- var x = str.split('@');
2223
- var ok = ((x.length == 2) && (x[0].length > 0) && (x[1].split('.').length > 1) && (x[1].length > 2));
2224
- if (ok == true) { var y = x[1].split('.'); for (var i in y) { if (y[i].length == 0) { ok = false; } } }
2225
- return ok;
2226
- }
2227
-
2228
- function inviteAgentToMesh(meshid) {
2229
- if (xxdialogMode) return;
2230
- var mesh = meshes[meshid];
2231
- var x = "Invite someone to install the mesh agent. An email with be sent with the link to the mesh agent installation for " + EscapeHtml(mesh.name) + ".<br /><br />";
2232
- x += addHtmlValue('Name (optional)', '<input id=agentInviteName value="" style=width:230px maxlength=64 />');
2233
- x += addHtmlValue('Email', '<input id=agentInviteEmail style=width:230px placeholder="example@email.com" onkeyup=validateAgentInvite()></input>');
2234
- x += addHtmlValue('Operating System', '<select id=agentInviteNameOs style=width:236px><option value=0>Any supported</option><option value=1>Windows only</option><option value=3>Apple OSX only</option><option value=2>Linux only</option></select>');
2235
- x += addHtmlValue('Installation Type', '<select id=agentInviteType style=width:236px><option value=0>Background and interactive</option><option value=2>Background only</option><option value=1>Interactive only</option></select>');
2236
- x += addHtmlValue('Message<br />(optional)', '<textarea id=agentInviteMessage value="" style=width:230px;height:100px;resize:none maxlength=1024 /></textarea>');
2237
- setDialogMode(2, "Invite", 3, performAgentInvite, x, meshid);
2238
- validateAgentInvite();
2239
- }
2240
-
2241
- function validateAgentInvite() {
2242
- QE('idx_dlgOkButton', checkEmail(Q('agentInviteEmail').value));
2243
- }
2244
-
2245
- function performAgentInvite(button, meshid) {
2246
- meshserver.send({ action: 'inviteAgent', meshid: meshid, email: Q('agentInviteEmail').value, name: Q('agentInviteName').value, os: Q('agentInviteNameOs').value, flags: Q('agentInviteType').value, msg: Q('agentInviteMessage').value });
2247
- }
2248
-
2249
- function addAgentToMesh(meshid) {
2250
- if (xxdialogMode) return;
2251
- var mesh = meshes[meshid], x = '', installType = 0;
2252
- x += addHtmlValue('Operating System', '<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>Windows</option><option value=1>Linux</option><option value=2>Apple OSX</option><option value=3>Windows (UnInstall)</option><option value=4>Linux (UnInstall)</option></select>');
2253
- x += '<div id=aginsTypeDiv>';
2254
- x += addHtmlValue('Installation Type', '<select id=aginsType onchange=addAgentToMeshClick() style=width:236px><option value=0>Background & interactive</option><option value=2>Background only</option><option value=1>Interactive only</option></select>');
2255
- x += '</div><hr>';
2256
-
2257
- // Windows agent install
2258
- //x += "<div id=agins_windows>To add a new computer to device group \"" + EscapeHtml(mesh.name) + "\", download the mesh agent and configuration file and install the agent on the computer to manage.<br /><br />";
2259
- x += "<div id=agins_windows>To add a new computer to device group \"" + EscapeHtml(mesh.name) + "\", download the mesh agent and install it the computer to manage. This agent has server and mesh information embedded within it.<br /><br />";
2260
- x += addHtmlValue('Mesh Agent', '<a id=aginsw32lnk href="meshagents?id=3&meshid=' + meshid.split('/')[2] + '&installflags=0" rel="noreferrer noopener" target="_blank" title="32bit version of the MeshAgent">Windows (.exe)</a>');
2261
- x += addHtmlValue('Mesh Agent', '<a id=aginsw64lnk href="meshagents?id=4&meshid=' + meshid.split('/')[2] + '&installflags=0" rel="noreferrer noopener" target="_blank" title="64bit version of the MeshAgent">Windows x64 (.exe)</a>');
2262
- if (debugmode > 0) { x += addHtmlValue('Settings File', '<a id=aginswmshlnk href="meshsettings?id=' + meshid.split('/')[2] + '&installflags=0" rel="noreferrer noopener" target="_blank">' + EscapeHtml(mesh.name) + ' settings (.msh)</a>'); }
2263
- x += "</div>";
2264
-
2265
- // Linux agent install
2266
- x += "<div id=agins_linux style=display:none>To add a computer to " + EscapeHtml(mesh.name) + " run the following command. Root credentials will be needed.<br />";
2267
- x += '<textarea id=agins_linux_area rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>';
2268
- x += "</div>";
2269
-
2270
- // OSX agent install
2271
- x += "<div id=agins_osx style=display:none>To add a new computer to device group \"" + EscapeHtml(mesh.name) + "\", download the mesh agent and install it the computer to manage. This agent installer has server and mesh information embedded within it.<br /><br />";
2272
- x += addHtmlValue('Mesh Agent', '<a href="meshosxagent?id=16&meshid=' + meshid.split('/')[2] + '" rel="noreferrer noopener" target="_blank" title="64bit version of OSX Mesh Agent">OSX Agent (64bit)</a>');
2273
- x += "</div>";
2274
-
2275
- // Windows agent uninstall
2276
- x += "<div id=agins_windows_un style=display:none>To remove a mesh agent, download the file below, run it and click \"uninstall\".<br /><br />";
2277
- x += addHtmlValue('Mesh Agent', '<a href="meshagents?id=3" rel="noreferrer noopener" target="_blank" title="32bit version of the MeshAgent">Windows (.exe)</a>');
2278
- x += addHtmlValue('Mesh Agent', '<a href="meshagents?id=3" rel="noreferrer noopener" target="_blank" title="64bit version of the MeshAgent">Windows x64 (.exe)</a>');
2279
- x += "</div>";
2280
-
2281
- // Linux agent uninstall
2282
- x += "<div id=agins_linux_un style=display:none>To remove a mesh agent, run the following command. Root credentials will be needed.<br />";
2283
- x += '<textarea id=agins_linux_area_un rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>';
2284
- x += "</div>";
2285
-
2286
- setDialogMode(2, "Add Mesh Agent", 9, null, x);
2287
- var servername = serverinfo.name;
2288
- if ((servername == 'un-configured') || ((features & 2) != 0)) { servername = window.location.hostname; } // If the server name is not set or it's in LAN-only mode, use the URL hostname as server name.
2289
-
2290
- if (serverinfo.https == true) {
2291
- var portStr = (serverinfo.port == 443)?'':(":" + serverinfo.port);
2292
- Q('agins_linux_area').value = "wget https://" + servername + portStr + "/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://" + servername + portStr + " '" + meshid.split('/')[2] + "'\r\n";
2293
- Q('agins_linux_area_un').value = "wget https://" + servername + portStr + "/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
2294
- } else {
2295
- var portStr = (serverinfo.port == 80)?'':(":" + serverinfo.port);
2296
- Q('agins_linux_area').value = "wget http://" + servername + portStr + "/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://" + servername + portStr + " '" + meshid.split('/')[2] + "'\r\n";
2297
- Q('agins_linux_area_un').value = "wget http://" + servername + portStr + "/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
2298
- }
2299
- Q('aginsSelect').focus();
2300
- addAgentToMeshClick();
2301
- }
2302
-
2303
- function addAgentToMeshClick() {
2304
- var v = Q('aginsSelect').value;
2305
- QV('agins_windows', v == 0);
2306
- QV('agins_linux', v == 1);
2307
- QV('agins_osx', v == 2);
2308
- QV('agins_windows_un', v == 3);
2309
- QV('agins_linux_un', v == 4);
2310
- QV('aginsTypeDiv', v == 0);
2311
-
2312
- // Fix the links if needed
2313
- Q('aginsw32lnk').href = (Q('aginsw32lnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value;
2314
- Q('aginsw64lnk').href = (Q('aginsw64lnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value;
2315
- if (debugmode > 0) { Q('aginswmshlnk').href = (Q('aginswmshlnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value; }
2316
- }
2317
-
2318
- function validateDeviceToMesh() {
2319
- QE('idx_dlgOkButton', (Q('dp1devicename').value.length > 0) && (passwordcheck(Q('dp1password').value)));
2320
- }
2321
-
2322
- function addDeviceToMeshEx(button, meshid) {
2323
- var amtuser = Q('dp1username').value;
2324
- if (amtuser == '') amtuser = 'admin';
2325
- var host = Q('dp1hostname').value;
2326
- if (host == '') host = Q('dp1devicename').value;
2327
- meshserver.send({ action: 'addamtdevice', meshid: meshid, devicename: Q('dp1devicename').value, hostname: host, amtusername: amtuser, amtpassword: Q('dp1password').value, amttls: Q('dp1tls').value });
2328
- }
2329
-
2330
- function deviceHeaderSet() {
2331
- if (deviceHeaderId == 0) { deviceHeaderId = 1; return; }
2332
- deviceHeaders["DevxHeader" + deviceHeaderId] = ', ' + deviceHeaderTotal + ((deviceHeaderTotal == 1) ? ' node' : ' nodes');
2333
- //var title = '';
2334
- //for (x in deviceHeaderCount) { if (title.length > 0) title += ', '; title += deviceHeaderCount[x] + ' ' + PowerStateStr2(x); }
2335
- //deviceHeadersTitles["DevxHeader" + deviceHeaderId] = title;
2336
- deviceHeaderId++;
2337
- deviceHeaderCount = {};
2338
- deviceHeaderTotal = 0;
2339
- }
2340
-
2341
- var powerStateStrings = ['', '<span title="Device is powered on.">Powered</span>', '<span title="Device is in sleep state (S1).">Sleeping</span>', '<span title="Device is in sleep state (S2).">Sleeping</span>', '<span title="Device is in deep sleep state (S3).">Deep Sleep</span>', '<span title="Device is in hibernating state (S4).">Hibernating</span>', '<span title="Device is in powered off state (S5).">Soft-Off</span>', '<span title="Device is detected but power state could not be obtained.">Present</span>'];
2342
- var powerStateStrings2 = ['', 'Device is powered', 'Device is in sleep state (S1)', 'Device is in sleep state (S2)', 'Device is in deep sleep state (S3)', 'Device is hibernating (S4)', 'Device is in soft-off state (S5)', 'Device is present, but power state cannot be determined'];
2343
- var powerColorTable = ['#00000000', 'black', 'blue', 'blue', 'lightblue', 'blueviolet', 'darkgreen', 'lightseagreen', 'lightseagreen'];
2344
- function NodeStateStr(node) {
2345
- var states = [];
2346
- if (node.state > 0 && node.state < powerStatetable.length) state.push(powerStatetable[node.state]);
2347
- if (node.conn) {
2348
- if ((node.conn & 1) != 0) states.push('<span title="Mesh agent is connected and ready for use.">Agent</span>');
2349
- if ((node.conn & 2) != 0) states.push('<span title="Intel® AMT CIRA is connected and ready for use.">CIRA</span>');
2350
- if ((node.conn & 4) != 0) states.push('<span title="Intel® AMT is routable.">Intel® AMT</span>');
2351
- if ((node.conn & 8) != 0) states.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>');
2352
- }
2353
- if ((node.pwr != null) && (node.pwr != 0)) { states.push(powerStateStrings[node.pwr]); }
2354
- return states.join(', ');
2355
- }
2356
-
2357
- function PowerStateStr(x) {
2358
- if (x < powerStatetable.length) return powerStatetable[x];
2359
- return '';
2360
- }
2361
-
2362
- function PowerStateStr2(x) {
2363
- if ((x != 0) && (x < powerStatetable.length)) return powerStatetable[x];
2364
- return 'Unknown';
2365
- }
2366
-
2367
- function selectallButtonFunction() {
2368
- var elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
2369
- for (var i=0;i<elements.length;i++) { if (elements[i].checked === true) checkcount++; }
2370
- for (var i=0;i<elements.length;i++) { elements[i].checked = (checkcount == 0); }
2371
- p1updateInfo();
2372
- }
2373
-
2374
- function p1updateInfo() {
2375
- var elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
2376
- for (var i=0;i<elements.length;i++) { if (elements[i].checked === true) { checkcount++; } }
2377
- if (checkcount > 0) {
2378
- QE('GroupActionButton', true);
2379
- Q('SelectAllButton').value = 'Select None';
2380
- QV('cxmgroupsplit', true);
2381
- QV('cxmdesktop', true);
2382
- } else {
2383
- QE('GroupActionButton', false);
2384
- Q('SelectAllButton').value = 'Select All';
2385
- QV('cxmgroupsplit', false);
2386
- QV('cxmdesktop', false);
2387
- }
2388
- }
2389
-
2390
- function groupActionFunction() {
2391
- var x = "Select an operation to perform on all selected devices. Actions will be performed only with proper rights.<br /><br />";
2392
- x += addHtmlValue('Operation', '<select id=d2groupop style=float:right;width:250px><option value=100>Wake-up devices</option><option value=4>Sleep devices</option><option value=3>Reset devices</option><option value=2>Power off devices</option><option value=101>Delete devices</option></select>');
2393
- setDialogMode(2, "Group Action", 3, groupActionFunctionEx, x);
2394
- }
2395
-
2396
- // Get the list of checked devices, removes any duplicates.
2397
- function getCheckedDevices() {
2398
- var nodeids = [], elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
2399
- for (var i=0;i<elements.length;i++) { if (elements[i].checked) { if (elements[i].value) { var nid = elements[i].value.substring(6); if (nodeids.indexOf(nid) == -1) { nodeids.push(nid); } } } }
2400
- return nodeids;
2401
- }
2402
-
2403
- function groupActionFunctionEx() {
2404
- var op = Q('d2groupop').value;
2405
- if (op == 100) {
2406
- // Group wake
2407
- meshserver.send({ action: 'wakedevices', nodeids: getCheckedDevices() });
2408
- } else if (op == 101) {
2409
- // Group delete, ask for confirmation
2410
- var x = "Confirm delete selected devices(s)?<br /><br />";
2411
- x += "<input id=d2check type=checkbox onchange=d2groupActionFunctionDelEx() />Confirm";
2412
- setDialogMode(2, "Delete Nodes", 3, groupActionFunctionDelEx, x);
2413
- QE('idx_dlgOkButton', false);
2414
- } else {
2415
- // Power operation
2416
- meshserver.send({ action: 'poweraction', nodeids: getCheckedDevices(), actiontype: op });
2417
- }
2418
- }
2419
-
2420
- function d2groupActionFunctionDelEx() { QE('idx_dlgOkButton', Q('d2check').checked); }
2421
- function groupActionFunctionDelEx() { meshserver.send({ action: 'removedevices', nodeids: getCheckedDevices() }); }
2422
-
2423
- function onSortSelectChange(skipsave) {
2424
- sort = document.getElementById("sortselect").selectedIndex;
2425
- if (!skipsave) { putstore("sort", sort); }
2426
- }
2427
-
2428
- function meshSort(a, b) { if (a.meshnamel > b.meshnamel) return 1; if (a.meshnamel < b.meshnamel) return -1; if (a.meshid == b.meshid) { if (showRealNames == true) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; } else { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; } } return 0; }
2429
- function powerSort(a, b) { var ap = a.pwr?a.pwr:0; var bp = b.pwr?b.pwr:0; if (ap > bp) return -1; if (ap < bp) return 1; if (ap == bp) { if (showRealNames == true) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; } else { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; } } return 0; }
2430
- function deviceSort(a, b) { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; }
2431
- function deviceHostSort(a, b) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; }
2432
- function onSearchFocus(x) { searchFocus = x; }
2433
- function onMapSearchFocus(x) { mapSearchFocus = x; }
2434
- function onUserSearchFocus(x) { userSearchFocus = x; }
2435
- function onConsoleFocus(x) { consoleFocus = x; }
2436
-
2437
- function onSearchInputChanged() {
2438
- var x = Q('SearchInput').value.toLowerCase().trim(); putstore("search", x);
2439
- if (x == '') {
2440
- for (var d in nodes) { nodes[d].v = true; }
2441
- } else {
2442
- try {
2443
- var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
2444
- for (var d in nodes) {
2445
- nodes[d].v = (rx.test(nodes[d].name.toLowerCase())) || (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase()));
2446
- if ((nodes[d].v == false) && nodes[d].tags) {
2447
- for (var s in nodes[d].tags) {
2448
- if (rx.test(nodes[d].tags[s].toLowerCase())) {
2449
- nodes[d].v = true;
2450
- break;
2451
- } else {
2452
- nodes[d].v = false;
2453
- }
2454
- }
2455
- }
2456
- }
2457
- } catch (ex) { for (var d in nodes) { nodes[d].v = true; } }
2458
- }
2459
- }
2460
-
2461
- var contextelement = null;
2462
- function handleContextMenu(event) {
2463
- hideContextMenu();
2464
- var scrollLeft = (window.pageXOffset !== null) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
2465
- var scrollTop = (window.pageYOffset !== null) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
2466
- var elem = document.elementFromPoint(event.pageX - scrollLeft, event.pageY - scrollTop);
2467
- if (elem && elem != null && elem.id == "MxMESH") {
2468
- contextelement = elem;
2469
- var contextmenudiv = document.getElementById("meshContextMenu");
2470
- contextmenudiv.style.left = event.pageX + "px";
2471
- contextmenudiv.style.top = event.pageY + "px";
2472
- contextmenudiv.style.display = "block";
2473
- } else {
2474
- while (elem && elem != null && elem.id != "devs") { elem = elem.parentElement; }
2475
- if (!elem || elem == null) return true;
2476
- contextelement = elem;
2477
- var contextmenudiv = document.getElementById("contextMenu");
2478
- contextmenudiv.style.left = event.pageX + "px";
2479
- contextmenudiv.style.top = event.pageY + "px";
2480
- contextmenudiv.style.display = "block";
2481
- }
2482
-
2483
- // Get the node and set the menu options
2484
- var nodeid = contextelement.children[1].attributes.onclick.value;
2485
- var node = getNodeFromId(nodeid.substring(12, nodeid.length - 2));
2486
- var mesh = meshes[node.meshid];
2487
- var meshlinks = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()];
2488
- var meshrights = meshlinks.rights;
2489
- var consoleRights = ((meshrights & 16) != 0);
2490
- QV('cxdesktop', ((mesh.mtype == 1) || (node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 1) != 0) || (node.intelamt && (node.intelamt.state == 2))) && ((meshrights & 8) || (meshrights & 256)));
2491
- QV('cxterminal', ((mesh.mtype == 1) || (node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 2) != 0) || (node.intelamt && (node.intelamt.state == 2))) && (meshrights & 8));
2492
- QV('cxfiles', ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 4) != 0))) && (meshrights & 8));
2493
- QV('cxevents', (node.intelamt != null) && ((node.intelamt.state == 2) || (node.conn & 2)) && (meshrights & 8));
2494
- QV('cxconsole', (consoleRights && (mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 8) != 0))) && (meshrights & 8));
2495
-
2496
- return haltEvent(event);
2497
- }
2498
-
2499
- function cmaction(action) {
2500
- var nodeid = contextelement.children[1].attributes.onclick.value;
2501
- nodeid = nodeid.substring(12, nodeid.length - 2);
2502
- if (action == 1) gotoDevice(nodeid, 10); // General
2503
- if (action == 2) gotoDevice(nodeid, 12); // Desktop
2504
- if (action == 3) gotoDevice(nodeid, 11); // Terminal
2505
- if (action == 4) gotoDevice(nodeid, 13); // Files
2506
- if (action == 5) gotoDevice(nodeid, 16); // Events
2507
- if (action == 6) gotoDevice(nodeid, 15); // Console
2508
- if (action == 7) { Q('viewselect').value = 3; Q('viewselect').onchange(); Q('autoConnectDesktopCheckbox').checked = true; Q('autoConnectDesktopCheckbox').onclick(); } // Multi-Desktop
2509
- }
2510
-
2511
- function cmmeshaction(action) {
2512
- var meshid = contextelement.attributes.onclick.value.substring(32, (32 + 69));
2513
- var elements = document.getElementsByClassName("DeviceCheckbox");
2514
- if (action == 1) { for (var i = 0; i < elements.length; i++) { if ( (elements[i].attributes) && (elements[i].attributes['class']['value'].substring(0, 69) == meshid)) { elements[i].checked = true; } } }
2515
- if (action == 2) { for (var i = 0; i < elements.length; i++) { if ( (elements[i].attributes) && (elements[i].attributes['class']['value'].substring(0, 69) == meshid)) { elements[i].checked = false; } } }
2516
- //if (action == 3) { window.location = "multidesktop.aspx?mesh=" + meshid + "&auto=1"; }
2517
- p1updateInfo();
2518
- }
2519
-
2520
- function hideContextMenu() {
2521
- QV('contextMenu', false);
2522
- QV('meshContextMenu', false);
2523
- contextelement = null;
2524
- }
2525
-
2526
- //
2527
- // DEVICES MAP
2528
- //
2529
-
2530
- // Maps code starts from here. Initialize all the variables
2531
- var xxmap = {
2532
- map: null,
2533
- contextmenu: null,
2534
- activeInteractions: [], // Save Modified features in this list
2535
- showindex: 0,
2536
- markersSource: null, // Initialize a Source Vector
2537
- markersLayer: null,
2538
- mapLayer: null, // Create a tile and use OSM source
2539
- mapView: null, // Sets the initial view
2540
- }
2541
-
2542
- // Add a feature for every Node and change style if connection status changes
2543
- function updateMapMarkers(selectedMesh) {
2544
- if ((xxmap != null) && (xxmap.map == null)) { try { loadmap(); } catch (ex) { console.error('loadmap() exception', ex); } }
2545
- if (xxmap == null) return;
2546
- var boundingBox = null;
2547
- for (var i in nodes) {
2548
- try {
2549
- var loc = map_parseNodeLoc(nodes[i]), feature = xxmap.markersSource.getFeatureById(nodes[i]._id);
2550
- if ((loc != null) && ((nodes[i].meshid == selectedMesh) || (selectedMesh == null))) { // Draw markers for devices with locations
2551
- var lat = loc[0], lon = loc[1], type = loc[2];
2552
- if (boundingBox == null) { boundingBox = [ lat, lon, lat, lon, 0 ]; } else { if (lat < boundingBox[0]) { boundingBox[0] = lat; } if (lon < boundingBox[1]) { boundingBox[1] = lon; } if (lat > boundingBox[2]) { boundingBox[2] = lat; } if (lon > boundingBox[3]) { boundingBox[3] = lon; } }
2553
- if (feature == null) { addFeature(nodes[i]); boundingBox[4] = 1; } else { updateFeature(nodes[i], feature); feature.setStyle(markerStyle(nodes[i], loc[2])); } // Update Feature
2554
- } else {
2555
- if (feature) { xxmap.markersSource.removeFeature(feature); }
2556
- }
2557
- } catch (ex) { console.error('updateMapMarkers() exception', ex, JSON.stringify(nodes[i])); }
2558
- }
2559
- return boundingBox;
2560
- }
2561
-
2562
- // Show node details on hovering over a feature
2563
- var map_cm_popup = new ol.Overlay({ element: Q('xmap-info-window'), positioning: 'bottom-center', stopEvent: false });
2564
-
2565
- // Edit Marker item
2566
- var map_cm_editMarker = { text: "Modify node location", callback: function (obj) { modifyMarkerloc(obj.data); } };
2567
-
2568
- // Clear Marker item
2569
- var map_cm_clearMarker = { text: "Remove node location", callback: function (obj) {
2570
- meshserver.send({ action: 'changedevice', nodeid: obj.data.a, userloc: [] }); // Clear the user position marker
2571
- }};
2572
-
2573
- // Save Marker item
2574
- var map_cm_saveMarker = { text: "Save node location", callback: function (obj) { saveMarkerloc(obj.data); } };
2575
-
2576
- // Build a context menu for a feature
2577
- var map_cm_nodemenu_items = [
2578
- { text: "General information", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 10); } } },
2579
- { text: "Desktop", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 11); } } },
2580
- { text: "Terminal", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 12); } } },
2581
- { text: "Intel® AMT", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 14); } } },
2582
- '-',
2583
- { text: 'Zoom-in to extent', callback: function(obj) { var coords = obj.data.getGeometry().getCoordinates(); zoomToLocation(coords, 19); } },
2584
- { text: 'Zoom-out to extent', callback: function(obj) { var coords = obj.data.getGeometry().getCoordinates(); zoomToLocation(coords, 2); } }
2585
- ];
2586
-
2587
- // Context menu for clicks other than on feature
2588
- var contextmenu_items = [
2589
- { text: 'Refresh', callback: function () { refreshMap(true, true); } },
2590
- { text: 'Zoom to fit extent', callback: function () { zoomToFitExtent(); } },
2591
- { text: 'Center map here', callback: function(obj) { xxmap.mapView.animate({ center: obj.coordinate } ); } },
2592
- { text: 'Place node here', callback: function(obj) { placeNode(obj.coordinate); } }
2593
- ];
2594
-
2595
- function stringToIntHash(str) {
2596
- var hash = 0, i;
2597
- for (i = 0; i < str.length; i++) { hash = ((hash << 5) - hash) + str.charCodeAt(i); hash |= 0; }
2598
- return hash;
2599
- };
2600
-
2601
- // Get the lat/lon from a node
2602
- function map_parseNodeLoc(node) {
2603
- var loc = null, t = 0;
2604
- if (node.iploc) { loc = node.iploc; t = 1; }
2605
- if (node.wifiloc) { loc = node.wifiloc; t = 2; }
2606
- if (node.gpsloc) { loc = node.gpsloc; t = 3; }
2607
- if (node.userloc) { loc = node.userloc; t = 4; }
2608
- if ((loc == null) || (typeof loc != 'string')) return null;
2609
- loc = loc.split(',');
2610
- if (t == 1) {
2611
- // If this is IP location, randomize the position a little.
2612
- return [ parseFloat(loc[0]) + (stringToIntHash(node._id.substring(0, 20)) / 100000000000), parseFloat(loc[1]) + (stringToIntHash(node._id.substring(20)) / 100000000000), t ];
2613
- } else {
2614
- // Return the real position
2615
- return [ parseFloat(loc[0]), parseFloat(loc[1]), t ];
2616
- }
2617
- }
2618
-
2619
- // Load the entire map
2620
- function loadmap() {
2621
- if (xxmap == null) return;
2622
- try {
2623
- // Initialize a Source Vector
2624
- xxmap.markersSource = new ol.source.Vector();
2625
-
2626
- xxmap.markersLayer = new ol.layer.Vector({
2627
- source: xxmap.markersSource
2628
- });
2629
-
2630
- // Create a tile and use OSM source
2631
- xxmap.mapLayer = new ol.layer.Tile({ source: new ol.source.OSM() });
2632
-
2633
- xxmap.mapView = new ol.View({ // Set the initial view
2634
- center: ol.proj.transform([0, 0], 'EPSG:4326', 'EPSG:3857'),
2635
- zoom: 2,
2636
- minZoom: 2,
2637
- maxZoom: 20,
2638
- extent: ol.proj.transformExtent([-100000, -69.55, 100000, 69.55], 'EPSG:4326', 'EPSG:3857')
2639
- });
2640
-
2641
- xxmap.map = new ol.Map({
2642
- target: 'xdevicesmap',
2643
- layers: [xxmap.mapLayer, xxmap.markersLayer],
2644
- view: xxmap.mapView
2645
- });
2646
-
2647
- xxmap.map.addOverlay(map_cm_popup);
2648
-
2649
- // Goto information tab if a user clicks on a feature
2650
- xxmap.map.on('click', function(evt) {
2651
- var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(feat, layer) { return feat; });
2652
- if (feature) {
2653
- var nodeid = feature.getId();
2654
- if (nodeid != null) { gotoDevice(nodeid, 10); } // Goto general info tab
2655
- else { // For pointer
2656
- var nodeFeatgoto = getCorrespondingFeature(feature); gotoDevice(nodeFeatgoto.getId(), 10);
2657
- }
2658
- }
2659
- });
2660
-
2661
- // On hover feature show the name of the node. Also add pointer style
2662
- xxmap.map.on('pointermove', function(evt) {
2663
- var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(feat, layer) { return feat; });
2664
- if (feature) {
2665
- xxmap.map.getTargetElement().style.cursor = 'pointer';
2666
- var coord = feature.getGeometry().getCoordinates();
2667
- // map_cm_popup.setPosition(evt.coordinate);
2668
- map_cm_popup.setPosition(coord);
2669
- var featid = feature.getId();
2670
- if (featid) {
2671
- QH('xmap-info-window', feature.get('name'));
2672
- } else {
2673
- var nodeFeat = getCorrespondingFeature(feature); // Return the node feature associated to pointer.
2674
- QH('xmap-info-window', nodeFeat.get('name'));
2675
- }
2676
- } else {
2677
- xxmap.map.getTargetElement().style.cursor = '';
2678
- QH('xmap-info-window', '');
2679
- }
2680
- });
2681
-
2682
- // Initialize context menu for openlayers
2683
- var contextmenu = new ContextMenu({
2684
- width: 160,
2685
- defaultItems: false, // defaultItems are Zoom In/Zoom Out
2686
- items: contextmenu_items
2687
- });
2688
-
2689
- // On right click open the context menu
2690
- contextmenu.on("open", function (evt) {
2691
- var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(ft, l){ return ft; });
2692
- xxmap.contextmenu.clear(); //Clear the context menu
2693
- if (feature) {
2694
- var featId = feature.getId();
2695
- if (featId) { addContextMenuItems(feature); } // Node feature will have an id
2696
- else { // If the feature is a pointer, Get its corresponding Node feature
2697
- var nodeFeature = getCorrespondingFeature(feature); //return the node feature associated to pointer.
2698
- if (nodeFeature) { addContextMenuItems(nodeFeature); }
2699
- else{ xxmap.contextmenu.extend(contextmenu_items); }
2700
- }
2701
- }
2702
- else { xxmap.contextmenu.extend(contextmenu_items); }
2703
- });
2704
- if (xxmap.contextmenu == null) { xxmap.contextmenu = contextmenu; }
2705
- xxmap.map.addControl(xxmap.contextmenu);
2706
- //addMeshOptions(); // Adds Mesh names to mesh dropdown
2707
- } catch (ex) {
2708
- console.log(ex);
2709
- QV('viewselectmapoption', false);
2710
- QV('devViewButton4', false);
2711
- xxmap = null;
2712
- }
2713
- }
2714
-
2715
- // Add feature on to Map for a Node
2716
- function addFeature(node, lat, lon) {
2717
- var existingfeature = getModifiedFeature(node._id); // Check if Corresponding feature was Modified ( Modifed feature are in active interactions list)
2718
- if (existingfeature) { xxmap.markersSource.addFeature(existingfeature); } // Add that existing feature
2719
- else { // Add new feature for this node
2720
- if (!lat && !lon) { var loc = map_parseNodeLoc(node); lat = loc[0]; lon = loc[1]; }
2721
-
2722
- // Fix the longiture and send an event to patch the db to correct coordinate format. It will cause second unnecessary updateFeature on this node to the map.
2723
- if (lon > 180) { lon = 180 - lon; meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: [ lat, lon ] }); }
2724
-
2725
- if ((lat < 90) && (lat > -90) && (lon < 180) && (lon > -180)) { // Check valid lat/lon
2726
- var feature = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.transform([lon, lat], 'EPSG:4326','EPSG:3857')), name: node.name, status: node.conn, lat: lat, lon: lon });
2727
- feature.setId(node._id); // Set id for the device as nodeid
2728
- feature.setStyle(markerStyle(node));
2729
- xxmap.markersSource.addFeature(feature); // Add the feature to Marker Source
2730
- }
2731
- }
2732
- }
2733
-
2734
- // Removing any feature from map
2735
- function removeFeature(node) {
2736
- var feature = xxmap.markersSource.getFeatureById(node._id);
2737
- if (feature) { xxmap.markersSource.removeFeature(feature); }
2738
- }
2739
-
2740
- // Update feature
2741
- function updateFeature(node, feature) {
2742
- if (node.conn != feature.get('status') ) { // Update status if changed
2743
- feature.set('status',node.conn)
2744
- feature.setStyle(markerStyle(node));
2745
- }
2746
-
2747
- // Since this is IP address location, add some fixed randomness to the location. Avoid pin pile-up.
2748
- var loc = map_parseNodeLoc(node);
2749
- if (loc != null) {
2750
- var lat = loc[0], lon = loc[1];
2751
- if ((lat != feature.get('lat')) || (lon != feature.get('lon'))) { // Update lat and lon if changed
2752
- feature.set('lat', lat); feature.set('lon', lon);
2753
- var modifiedCoordinates = ol.proj.transform([parseFloat(lon), parseFloat(lat)], 'EPSG:4326', 'EPSG:3857');
2754
- feature.getGeometry().setCoordinates(modifiedCoordinates);
2755
- }
2756
- }
2757
-
2758
- if (node.name != feature.get('name') ) { feature.set('name', node.name); } // Update name
2759
- }
2760
-
2761
- // Enable dragging of a marker after edit option is clicked in context menu
2762
- function modifyMarkerloc(ft){
2763
- var featid = ft.getId();
2764
- if (featid) {
2765
- ft.setStyle(markerStyle(getNodeFromId(ft.a), 4)); // Switch to a user marker
2766
- if ( !getActiveInteractions(ft)) {
2767
- var dragInteration = new ol.interaction.Modify({
2768
- features: new ol.Collection([ft]),
2769
- pixelTolerance: 10
2770
- });
2771
- xxmap.activeInteractions.push({ featureid: featid, feature:ft, interaction: dragInteration }); // Also keep track of Interactions
2772
- xxmap.map.addInteraction(dragInteration);
2773
- }
2774
- }
2775
- }
2776
-
2777
- // This will be called when save location option is clicked in context menu
2778
- function saveMarkerloc(ft){
2779
- var featid = ft.getId()
2780
- if (featid) {
2781
- var actInteraction = getActiveInteractions(ft);
2782
- if (actInteraction) { // Check if the interaction exists
2783
- xxmap.map.removeInteraction(actInteraction); //Clear Interaction for that node
2784
- removeInteraction(featid);
2785
- var coord = ft.getGeometry().getCoordinates();
2786
- var v = ol.proj.transform(coord, 'EPSG:3857', 'EPSG:4326');
2787
- if (v[0] > 180) { v[0] = 180 - v[0]; }
2788
- var vx = [ v[1], v[0] ]; // Flip the coordinates around, lat/long
2789
- meshserver.send({ action: 'changedevice', nodeid: featid, userloc: vx }); // Send them to server to save changes
2790
- }
2791
- }
2792
- }
2793
-
2794
- // Style the Markers
2795
- function markerStyle(node, type) {
2796
- if (type == null) {
2797
- type = 0;
2798
- if (node.iploc) { type = 1; }
2799
- if (node.wifiloc) { type = 2; }
2800
- if (node.gpsloc) { type = 3; }
2801
- if (node.userloc) { type = 4; }
2802
- }
2803
- var types = ['', '-ip','-wifi','-gps','-user'];
2804
- var color = connStateColor(node);
2805
- var style = new ol.style.Style({
2806
- image: new ol.style.Icon({ color: color, anchor: [0.5, 1], src: 'images/mapmarker' + types[type] + '.png' })
2807
- //stroke: new ol.style.Stroke({ color: '#000', width: 20 })
2808
- //text: new ol.style.Text({ text: 'bob!', textAlign: 'right', offsetX: -10, fill: new ol.style.Fill({ color: '#000' }), stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) })
2809
- });
2810
-
2811
- /*
2812
- deviceMark.setStyle(new ol.style.Style({
2813
- text: new ol.style.Text({
2814
- //font: '12px helvetica,sans-serif',
2815
- text: currentNode.name,
2816
- textAlign: 'right',
2817
- offsetX: -10,
2818
- fill: new ol.style.Fill({ color: '#000' }),
2819
- stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
2820
- }),
2821
- image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) }));
2822
- */
2823
-
2824
- return [ style ];
2825
- }
2826
-
2827
- // TODO: Add more connection status types. Currently we only change color if connection status changes
2828
- function connStateColor(nodeConn){
2829
- if (nodeConn.conn == 1 || nodeConn.conn == 3 || nodeConn.conn == 5) { return '#00ffdd'; } // Green for connected devices
2830
- return '#C70039'; // Red if the Agent is not connected
2831
- }
2832
-
2833
- // Add save/edit option to context menu
2834
- function addContextMenuItems(feature) {
2835
- if (getActiveInteractions(feature)) { // If this feature is modified then display save option in contextmenu
2836
- map_cm_saveMarker.data = feature;
2837
- xxmap.contextmenu.push(map_cm_saveMarker);
2838
- } else {
2839
- map_cm_editMarker.data = feature;
2840
- xxmap.contextmenu.push(map_cm_editMarker);
2841
- var node = getNodeFromId(feature.a);
2842
- if (node.userloc) {
2843
- map_cm_clearMarker.data = feature;
2844
- xxmap.contextmenu.push(map_cm_clearMarker);
2845
- }
2846
- }
2847
- map_cm_nodemenu_items.forEach(function (item){
2848
- if (item.text == 'Zoom-in to extent' || item.text == 'Zoom-out to extent') { item.data = feature; }
2849
- else { if (item != "-") { item.data = feature.getId(); } }
2850
- });
2851
- xxmap.contextmenu.extend(map_cm_nodemenu_items);
2852
- }
2853
-
2854
- // Return a active Interaction if it exists in activeInteractions list
2855
- function getActiveInteractions(feature) {
2856
- var featid = feature.getId();
2857
- for (var i = 0; i < xxmap.activeInteractions.length; i++) {
2858
- if (xxmap.activeInteractions[i].featureid == featid) { return xxmap.activeInteractions[i].interaction; }
2859
- }
2860
- return false;
2861
- }
2862
-
2863
- // Return Modified feature based on Id
2864
- function getModifiedFeature(featid) {
2865
- if (featid) {
2866
- for (var i = 0; i < xxmap.activeInteractions.length; i++) {
2867
- if (xxmap.activeInteractions[i].featureid == featid) { return xxmap.activeInteractions[i].feature; }
2868
- }
2869
- }
2870
- return null;
2871
- }
2872
-
2873
- // Remove Interaction
2874
- function removeInteraction(ftid) {
2875
- var index = -1;
2876
- for (var i = 0; i < xxmap.activeInteractions.length; i++) {
2877
- if (xxmap.activeInteractions[i].featureid === ftid) { index = i; break; }
2878
- }
2879
- if (index >= 0) { xxmap.activeInteractions.splice(index, 1); }
2880
- }
2881
-
2882
- // Check if pointer coordinates are equal to features and return node feature
2883
- function getCorrespondingFeature(pointerFeat) {
2884
- var pointerCoord = pointerFeat.getGeometry().getCoordinates();
2885
- for (var i = 0; i < xxmap.activeInteractions.length ; i++) {
2886
- var modifiedFeatures = xxmap.activeInteractions[i].feature;
2887
- var fearCoord = modifiedFeatures.getGeometry().getCoordinates();
2888
- if (fearCoord[0].toFixed(5) == pointerCoord[0].toFixed(5) && fearCoord[1].toFixed(5) == pointerCoord[1].toFixed(5) ) { return modifiedFeatures; }
2889
- }
2890
- return null;
2891
- }
2892
-
2893
- // Refresh the map and clear list
2894
- function refreshMap(reset, rebound){
2895
- if (reset) {
2896
- xxmap.map.setTarget(null);
2897
- xxmap.map = null;
2898
- xxmap.markersSource = null;
2899
- xxmap.mapView = null;
2900
- xxmap.mapLayer = null;
2901
- xxmap.activeInteractions = []; // Clear Active Interaction list
2902
- }
2903
- //clearMeshOptions();
2904
- //onSelectMeshChange();
2905
- var box = updateMapMarkers();
2906
- if ((box != null) && (rebound || (box[4] == 1))) {
2907
- var clat = (box[0] + box[2]) / 2;
2908
- var clon = (box[1] + box[3]) / 2;
2909
- var cscale = Math.max(Math.abs(box[0] - box[2]), Math.abs(box[1] - box[3]));
2910
- var view = xxmap.map.getView();
2911
- view.setCenter(ol.proj.transform([clon, clat], 'EPSG:4326', 'EPSG:3857'));
2912
- var i = 360, j = -2;
2913
- while (i > cscale) { j++; i = i / 2; }
2914
- view.setZoom(j);
2915
- }
2916
- }
2917
-
2918
- // Called When Place a node option is clicked from context menu
2919
- function placeNode(coords) {
2920
- if (xxdialogMode) return;
2921
- var x = '<div style=margin-bottom:6px><label for=selectnode-search>Search</label>  <input type=text placeholder="Device name" id="selectnode-search" onchange=onPlaceNodeInputChange() onkeyup=onPlaceNodeInputChange() autocomplete=off style=width:120px></div><div id=placenode style="height:254px;overflow-y:auto;width:100%;margin:12px 1px 4px 1px;"><div id=noNodesMapPlace style=text-align:center;width:100%;display:none>No devices found.</div>';
2922
- for (var i in nodes) {
2923
- x += '<div class=noselect id=' + nodes[i]._id + '-rowid onclick=selectNodeToPlace(event,\''+ nodes[i]._id +'\') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id=' + nodes[i]._id + '-checkid type=checkbox style=width:16px;display:inline />';
2924
- x += '<div class=j' + nodes[i].icon + ' style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>' + nodes[i].name + '</div></div>';
2925
- }
2926
- setDialogMode(2, "Select a node to place", 3, placeNodeEx, x + '</div>', coords);
2927
- onPlaceNodeInputChange();
2928
- }
2929
-
2930
- function placeNodeEx(button, coords) {
2931
- var elements = document.getElementsByName("PlaceMapDeviceCheckbox");
2932
- for (var i in elements) {
2933
- if (elements[i].checked) {
2934
- var node = getNodeFromId(elements[i].id.substring(0, elements[i].id.length - 8));
2935
- if (node) {
2936
- var feature = xxmap.markersSource.getFeatureById(i);
2937
- var v = ol.proj.transform(coords, 'EPSG:3857', 'EPSG:4326');
2938
- var vx = [ v[1], v[0] ]; // Flip the coordinates around, lat/long
2939
- if (feature) {
2940
- feature.getGeometry().setCoordinates(coords);
2941
- var activeInteraction = getActiveInteractions(feature);
2942
- if (activeInteraction) {
2943
- saveMarkerloc(feature);
2944
- } else { // If this feature is not saved after its location is changed, then send updated coords to server.
2945
- meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: vx }); // Send them to server to save changes
2946
- }
2947
- } else {
2948
- meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: vx }); // This Node is not yet added to maps.
2949
- }
2950
- }
2951
- }
2952
- }
2953
- }
2954
-
2955
- // Called when the user changes the search box
2956
- function onPlaceNodeInputChange() {
2957
- updatePlaceNodeTable(Q('selectnode-search').value.trim().toLowerCase());
2958
- }
2959
-
2960
- // Update the list of devices in the "place on map" table
2961
- function updatePlaceNodeTable(inputSearch) {
2962
- var elements = document.getElementsByName("PlaceMapDeviceCheckbox"), count = 0;
2963
- for (var i in nodes) {
2964
- var visible = ((nodes[i].namel.indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.indexOf(inputSearch) >= 0));
2965
- if (visible) { count++; }
2966
- QV(nodes[i]._id + '-rowid', visible);
2967
- }
2968
- QV('noNodesMapPlace', count == 0);
2969
- /*
2970
- console.log(selected);
2971
- for (var i in nodes) {
2972
- if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) {
2973
- console.log(selected.indexOf(nodes[i]._id));
2974
- x += '<div class=noselect id=' + nodes[i]._id + '-rowid onclick=selectNodeToPlace(event,\''+ nodes[i]._id +'\') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id=' + nodes[i]._id + '-checkid type=checkbox style=width:16px;display:inline ' + ((selected.indexOf(nodes[i]._id) >= 0)?'checked':'') + ' />';
2975
- x += '<div class=j' + nodes[i].icon + ' style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>' + nodes[i].name + '</div></div>';
2976
- }
2977
- }
2978
- if (x == '') { x = '<div style=text-align:center;width:100%>No devices found.</div>'; }
2979
- QH('placenode', '');
2980
- */
2981
- }
2982
-
2983
- // Called when a user clicks on a device to toggle selection for placement on map.
2984
- function selectNodeToPlace(e, id) {
2985
- // Toggle checkbox if needed
2986
- if (e.target.name != 'PlaceMapDeviceCheckbox') { var inputElement = Q(id + '-checkid'); inputElement.checked = !inputElement.checked; }
2987
-
2988
- // Check button state
2989
- var elements = document.getElementsByName("PlaceMapDeviceCheckbox"), checkcount = 0;
2990
- for (var i in elements) { if (elements[i].checked) checkcount++; }
2991
- QE('idx_dlgOkButton', checkcount > 0);
2992
- }
2993
-
2994
- // Add option for available meshes in mesh Dropdown
2995
- function addMeshOptions(addMeshid, meshName) {
2996
- /*
2997
- var meshOptions = Q('select-mesh');
2998
- if (addMeshid && meshName) {
2999
- var option = document.createElement('option');
3000
- option.value =addMeshid;
3001
- option.text = meshName;
3002
- meshOptions.add(option); // Add specific option
3003
- }
3004
- else {
3005
- for (var i in meshes) { // Add all options
3006
- var option = document.createElement('option');
3007
- option.value = i;
3008
- option.text = meshes[i].name;
3009
- meshOptions.add(option);
3010
- }
3011
- }
3012
- */
3013
- }
3014
-
3015
- // Remove/Modify options in Mesh dropdown (if modMeshname is defined then Modify else Remove)
3016
- function meshOptionRmvMod(delMeshid, modMeshname){
3017
- /*
3018
- var meshOptions = Q('select-mesh');
3019
- if (delMeshid) {
3020
- var index=-1;
3021
- for (var i = 1; i < meshOptions.options.length; i++) {
3022
- if (meshOptions[i].value === delMeshid) { index=i; }
3023
- }
3024
- if (index > 0) {
3025
- if (modMeshname) {
3026
- meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified
3027
- }
3028
- else { meshOptions.remove(index); }
3029
- }
3030
- }
3031
- */
3032
- }
3033
-
3034
- //Check if there is any mesh created
3035
- function meshExists() {
3036
- for (var i in meshes) { if (meshes[i]) { return true; } }
3037
- return false;
3038
- }
3039
-
3040
- // Reset Mesh dropdown option to 'All' when a current view mesh is deleted.
3041
- function setMeshView(emeshid) {
3042
- var selectMeshElement=Q("select-mesh");
3043
- var selectedIndex = selectMeshElement.selectedIndex;
3044
- if (selectMeshElement[selectedIndex].value == emeshid) { selectMeshElement[0].selected = true; onSelectMeshChange(); }
3045
- }
3046
-
3047
- // Clear all mesh options except 'All'
3048
- function clearMeshOptions() {
3049
- /*
3050
- var meshOptions=Q('select-mesh');
3051
- for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); }
3052
- */
3053
- }
3054
-
3055
- // Make a http get call- Replace this with AJAX get if jquery is used
3056
- function getSearchLocation() {
3057
- try {
3058
- var searchdata = Q('mapSearchLocation').value.trim();
3059
- if (searchdata.length > 0) {
3060
- var xmlhttp = new XMLHttpRequest(); // Compatible with Chrome, Opera, Safari, IE7+, Firefox.
3061
- xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { formatSearchData(xmlhttp.responseText); } }
3062
- xmlhttp.open("GET", 'https://nominatim.openstreetmap.org/search?q=' + searchdata + '&format=json', true); // Get request
3063
- xmlhttp.send();
3064
- }
3065
- } catch (e) {}
3066
- }
3067
-
3068
- // Format data recieved from nominatim API and display it on content window
3069
- function formatSearchData(data) {
3070
- try {
3071
- QH('xmapSearchResults','');
3072
- var dataInfo = JSON.parse(data), count = 0, x = '<div style="overflow-y:auto;width:100%;max-height:240px">';
3073
- for (var i = 0; i < dataInfo.length; i++) {
3074
- if (dataInfo[i].display_name && dataInfo[i].boundingbox[0] && dataInfo[i].boundingbox[1] && dataInfo[i].boundingbox[2] && dataInfo[i].boundingbox[3]) {
3075
- count++;
3076
- var color = (i % 2 == 0)?'F5F5F5':'EBEBEB';
3077
- x += '<div style=cursor:pointer;padding:5px;background-color:#' + color + ' onclick=mapGotoSelectedLocation(this)><div>' + dataInfo[i].display_name + '</div><div style=display:none>' + dataInfo[i].boundingbox[0] + '!#!' + dataInfo[i].boundingbox[1] + '!#!' + dataInfo[i].boundingbox[2] + '!#!' + dataInfo[i].boundingbox[3] + '</div></div>';
3078
- }
3079
- }
3080
- x += '</div>';
3081
- if (count == 1) {
3082
- // If only one result is returned then zoom to that location
3083
- var extent = [ parseFloat(dataInfo[0].boundingbox[2]), parseFloat(dataInfo[0].boundingbox[0]), parseFloat(dataInfo[0].boundingbox[3]), parseFloat(dataInfo[0].boundingbox[1]) ];
3084
- zoomToExtent(extent);
3085
- } else {
3086
- if (count == 0) { x = '<div style=width:200px>No location found.<div>'; }
3087
- QV('xmapSearchResultsDlg', true);
3088
- }
3089
- QH('xmapSearchResults', x);
3090
- }
3091
- catch (e) {}
3092
- }
3093
-
3094
- // Zoom into the bounding box
3095
- function mapGotoSelectedLocation(obj) {
3096
- var objchildren = obj.children;
3097
- var boundingBox = objchildren[1].innerHTML.split('!#!');
3098
- var extent = [parseFloat(boundingBox[2]), parseFloat(boundingBox[0]), parseFloat(boundingBox[3]), parseFloat(boundingBox[1])];
3099
- //Q('search-location').value = objchildren[0].innerHTML;
3100
- zoomToExtent(extent);
3101
- mapCloseSearchWindow();
3102
- }
3103
-
3104
- // Close the search window
3105
- function mapCloseSearchWindow() {
3106
- QH('xmapSearchResults', '');
3107
- QV('xmapSearchResultsDlg', false);
3108
- }
3109
-
3110
- // Zoom to specific cordinates
3111
- function zoomToLocation(coordinates, zoomVal) {
3112
- var view = xxmap.map.getView();
3113
- view.setCenter(coordinates);
3114
- view.setZoom(zoomVal);
3115
- }
3116
-
3117
- function zoomToFitExtent() {
3118
- var features = xxmap.markersSource.getFeatures();
3119
- if (features.length > 0) {
3120
- var extent = xxmap.markersSource.getExtent();
3121
- xxmap.map.getView().fit(extent, xxmap.map.getSize());
3122
- }
3123
- }
3124
-
3125
- function zoomToExtent(extent){
3126
- var boundingExtent = ol.proj.transformExtent(extent, ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857'));
3127
- xxmap.map.getView().fit(boundingExtent, xxmap.map.getSize());
3128
- }
3129
-
3130
-
3131
- //
3132
- // MY DEVICE
3133
- //
3134
-
3135
- function refreshDevice(nodeid) {
3136
- if (!currentNode || currentNode._id != nodeid) return;
3137
- gotoDevice(nodeid, xxcurrentView, true);
3138
- }
3139
-
3140
- function getNodeRights(nodeid) {
3141
- var node = getNodeFromId(nodeid), mesh = meshes[node.meshid];
3142
- return mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
3143
- }
3144
-
3145
- var currentNode;
3146
- var powerTimelineNode = null;
3147
- var powerTimelineReq = null;
3148
- var powerTimelineUpdate = null;
3149
- var powerTimeline = null;
3150
- function getCurrentNode() { return currentNode; };
3151
- function gotoDevice(nodeid, panel, refresh) {
3152
- //disconnectAllKvmFunction();
3153
- var node = getNodeFromId(nodeid);
3154
- var mesh = meshes[node.meshid];
3155
- var meshrights = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
3156
- if (!currentNode || currentNode._id != node._id || refresh == true) {
3157
- currentNode = node;
3158
-
3159
- // Add node name
3160
- var nname = EscapeHtml(node.name);
3161
- if (nname.length == 0) { nname = '<i>None</i>'; }
3162
- if ((meshrights & 4) != 0) { nname = '<span title="Click here to edit the server-side device name" onclick=showEditNodeValueDialog(0) style=cursor:pointer>' + nname + ' <img class=hoverButton src="images/link5.png" /></span>'; }
3163
- QH('p10deviceName', nname);
3164
- QH('p11deviceName', nname);
3165
- QH('p12deviceName', nname);
3166
- QH('p13deviceName', nname);
3167
- QH('p14deviceName', nname);
3168
- QH('p15deviceName', nname);
3169
- QH('p16deviceName', nname);
3170
-
3171
- // Node attributes
3172
- var x = '<table style=width:100%>';
3173
-
3174
- // Attribute: Mesh
3175
- x += addDeviceAttribute('<span title="The name of the device group this computer belong to.">Group</span>', '<a title="The name of the device group this computer belong to" onclick=gotoMesh("' + node.meshid + '") style=cursor:pointer>' + EscapeHtml(meshes[node.meshid].name) + '</a>');
3176
-
3177
- // Attribute: Name
3178
- if ((node.rname != null) && (node.name != node.rname)) { x += addDeviceAttribute('<span title="The name of this computer as set in the operating system">Name</span>', '<span title="The name of this computer as set in the operating system">' + EscapeHtml(node.rname) + '</span>'); }
3179
-
3180
- // Attribute: Host
3181
- if ((features & 1) == 0) { // If not WAN-only, local hostname is in use
3182
- if ((meshrights & 4) != 0) {
3183
- if (node.host) {
3184
- x += addDeviceAttribute('Hostname', '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>' + EscapeHtml(node.host) + '</span>');
3185
- } else {
3186
- x += addDeviceAttribute('Hostname', '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>');
3187
- }
3188
- } else {
3189
- x += addDeviceAttribute('Hostname', EscapeHtml(node.host));
3190
- }
3191
- }
3192
-
3193
- // Attribute: Description
3194
- var description = node.desc?EscapeHtml(node.desc):"<i>None</i>";
3195
- if ((meshrights & 4) != 0) {
3196
- x += addDeviceAttribute('Description', '<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>' + description + ' <img class=hoverButton src="images/link5.png" /></span>');
3197
- } else {
3198
- x += addDeviceAttribute('Description', description);
3199
- }
3200
-
3201
- // Attribute: Mesh Agent
3202
- var agentsStr = ['Unknown', 'Windows 32bit console', 'Windows 64bit console', 'Windows 32bit service', 'Windows 64bit service', 'Linux 32bit', 'Linux 64bit', 'MIPS', 'XENx86', 'Android ARM', 'Linux ARM', 'OSX 32bit', 'Android x86', 'PogoPlug ARM', 'Android APK', 'Linux Poky x86-32bit', 'OSX 64bit', 'ChromeOS', 'Linux Poky x86-64bit', 'Linux NoKVM x86-32bit', 'Linux NoKVM x86-64bit', 'Windows MinCore console', 'Windows MinCore service', 'NodeJS', 'ARM-Linaro', 'ARMv6l / ARMv7l' ];
3203
- if ((node.agent != null) && (node.agent.id != null) && (node.agent.ver != null)) {
3204
- var str = '';
3205
- if (node.agent.id <= agentsStr.length) { str = agentsStr[node.agent.id]; } else { str = agentsStr[0]; }
3206
- if (node.agent.ver != 0) { str += ' v' + node.agent.ver; }
3207
- x += addDeviceAttribute('Mesh Agent', str);
3208
- }
3209
-
3210
- // Attribute: Intel AMT
3211
- if (node.intelamt != null) {
3212
- var str = '';
3213
- var provisioningStates = { 0: 'Not Activated (Pre)', 1: 'Not Activated (In)', 2: 'Activated' };
3214
- if (node.intelamt.ver != null && node.intelamt.state == null) { str += '<i>Unknown State</i>, v' + node.intelamt.ver; } else
3215
-
3216
- if ((node.intelamt.ver == null) && (node.intelamt.state == 2)) { str += '<i>Activated</i>'; }
3217
- else if ((node.intelamt.ver == null) || (node.intelamt.state == null)) { str += '<i>Unknown Version & State</i>'; }
3218
- else {
3219
- str += provisioningStates[node.intelamt.state];
3220
- if (node.intelamt.flags) { if (node.intelamt.flags & 2) { str += ' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'; } else if (node.intelamt.flags & 4) { str += ' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'; } }
3221
- str += (', v' + node.intelamt.ver);
3222
- }
3223
-
3224
- if (node.intelamt.tls == 1) { str += ', <span title="Intel AMT is setup with TLS network security">TLS</span>'; }
3225
- if (node.intelamt.state == 2) {
3226
- if (node.intelamt.user == null || node.intelamt.user == '') {
3227
- if ((meshrights & 4) != 0) {
3228
- str += ', <i style=color:#FF0000;cursor:pointer title="Edit Intel® AMT credentials" onclick=editDeviceAmtSettings("' + node._id + '")>No Credentials</i>';
3229
- } else {
3230
- str += ', <i style=color:#FF0000>No Credentials</i>';
3231
- }
3232
- }
3233
- str += ' ';
3234
- if ((meshrights & 4) != 0) {
3235
- str += '<img src=images/link4.png height=10 width=10 title="Edit Intel® AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("' + node._id + '")>';
3236
- }
3237
- }
3238
- x += addDeviceAttribute('Intel® AMT', str);
3239
- }
3240
-
3241
- // Attribute: Mesh Agent Tag
3242
- if ((node.agent != null) && (node.agent.tag != null) && (node.agent.tag != 'mailto:')) {
3243
- var tag = EscapeHtml(node.agent.tag);
3244
- if (tag.startsWith('mailto:')) { tag = '<a href="' + tag + '">' + tag.substring(7) + '</a>'; }
3245
- x += addDeviceAttribute('Agent Tag', tag);
3246
- }
3247
-
3248
- // Attribute: Intel AMT
3249
- //if (node.intelamt && node.intelamt.user) { x += addDeviceAttribute('Intel® AMT', node.intelamt.user); }
3250
-
3251
- // Operating system description
3252
- if (node.osdesc) { x += addDeviceAttribute('Operating System', node.osdesc); }
3253
-
3254
- // Active Users
3255
- if (node.users && node.conn && (node.users.length > 0) && (node.conn & 1)) { x += addDeviceAttribute('Active User' + ((node.users.length > 1)?'s':''), node.users.join(', ')); }
3256
-
3257
- // Attribute: Connectivity (Only show this if more than just the agent is connected).
3258
- var connectivity = node.conn;
3259
- if (connectivity && connectivity > 1) {
3260
- var cstate = [];
3261
- if ((node.conn & 1) != 0) cstate.push('<span title="Mesh agent is connected and ready for use.">Mesh Agent</span>');
3262
- if ((node.conn & 2) != 0) cstate.push('<span title="Intel® AMT CIRA is connected and ready for use.">Intel® AMT CIRA</span>');
3263
- if ((node.conn & 4) != 0) cstate.push('<span title="Intel® AMT is routable and ready for use.">Intel® AMT</span>');
3264
- if ((node.conn & 8) != 0) cstate.push('<span title="Mesh agent is reachable using another agent as relay.">Mesh Relay</span>');
3265
- x += addDeviceAttribute('Connectivity', cstate.join(', '));
3266
- }
3267
-
3268
- // Node grouping tags
3269
- var groupingTags = '<i>None</i>';
3270
- if (node.tags != null) { groupingTags = ''; for (var i in node.tags) { groupingTags += '<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">' + node.tags[i] + '</span>'; } }
3271
- x += addDeviceAttribute('Tags', '<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>' + groupingTags + ' <img class=hoverButton src="images/link5.png" /></span>');
3272
-
3273
- x += '</table><br />';
3274
- // Show action button, only show if we have permissions 4, 8, 64
3275
- if ((meshrights & 76) != 0) { x += '<input type=button value=Actions title="Perform power actions on the device" onclick=deviceActionFunction() />'; }
3276
- x += '<input type=button value=Notes title="View notes about this device" onclick=showNotes(' + ((meshrights & 128) == 0) + ',"' + encodeURIComponent(node._id) + '") />';
3277
- //if ((connectivity & 1) && (meshrights & 8) && (node.agent.id < 5)) { x += '<input type=button value=Toast title="Display a text message of the remote device" onclick=deviceToastFunction() />'; }
3278
- QH('p10html', x);
3279
-
3280
- // Show node last 7 days timeline
3281
- masterUpdate(256);
3282
-
3283
- // Show bottom buttons
3284
- x = '<div style=float:right;font-size:x-small>';
3285
- if ((meshrights & 4) != 0) x += '<a style=cursor:pointer onclick=p10showDeleteNodeDialog("' + node._id + '") title="Remove this device">Delete Device</a>';
3286
- x += '</div><div style=font-size:x-small>';
3287
- if (mesh.mtype == 2) x += '<a style=cursor:pointer onclick=p10showNodeNetInfoDialog("' + node._id + '") title="Show device network interface information">Interfaces</a> ';
3288
- if (xxmap != null) x += '<a style=cursor:pointer onclick=p10showNodeLocationDialog("' + node._id + '") title="Show device locations information">Location</a> ';
3289
-
3290
- if (((meshrights & 8) != 0) && (mesh.mtype == 2)) x += '<a style=cursor:pointer onclick=p10showMeshCmdDialog(1,"' + node._id + '") title="Traffic router used to connect to a device thru this server.">Router</a> ';
3291
-
3292
- // RDP link, show this link only of the remote machine is Windows.
3293
- if (((connectivity & 1) != 0) && (clickOnce == true) && (mesh.mtype == 2) && ((meshrights & 8) != 0)) {
3294
- if ((node.agent.id > 0) && (node.agent.id < 5)) { x += '<a style=cursor:pointer onclick=p10clickOnce("' + node._id + '","RDP2",3389) title="Requires Microsoft ClickOnce support in your browser.">RDP</a> '; }
3295
- if (node.agent.id > 4) {
3296
- x += '<a style=cursor:pointer onclick=p10clickOnce("' + node._id + '","PSSH",22) title="Requires Microsoft ClickOnce support in your browser.">Putty</a> ';
3297
- x += '<a style=cursor:pointer onclick=p10clickOnce("' + node._id + '","WSCP",22) title="Requires Microsoft ClickOnce support in your browser.">WinSCP</a> ';
3298
- }
3299
- }
3300
- x += '</div><br>'
3301
-
3302
- QH('p10html3', x);
3303
-
3304
- // Set the node power state
3305
- var powerstate = PowerStateStr(node.state);
3306
- //if (node.state == 0) { powerstate = 'Unknown State'; }
3307
- if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Agent connected">Agent connected</span>'; }
3308
- if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT connected">Intel® AMT connected</span>'; }
3309
- if ((connectivity & 4) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT detected">Intel® AMT detected</span>'; }
3310
- if ((powerstate == '') && node.lastconnect) { powerstate = '<span style=font-size:12px>Last seen:<br />' + new Date(node.lastconnect).toLocaleDateString() + ', ' + new Date(node.lastconnect).toLocaleTimeString() + '</span>'; }
3311
- QH('MainComputerState', powerstate);
3312
-
3313
- // Set the node icon
3314
- Q('MainComputerImage').setAttribute("src", "images/icons200-" + node.icon + "-1.jpg");
3315
- Q('MainComputerImage').className = ((!node.conn) || (node.conn == 0)?'gray':'');
3316
-
3317
- // Setup/Refresh the desktop tab
3318
- setupTerminal();
3319
- setupFiles();
3320
- var consoleRights = ((meshrights & 16) != 0);
3321
- if (consoleRights) { setupConsole(); } else { if (panel == 15) { panel = 10; } }
3322
-
3323
- // Show or hide the tabs
3324
- // mesh.mtype: 1 = Intel AMT only, 2 = Mesh Agent
3325
- // node.agent.caps (bitmask): 1 = Desktop, 2 = Terminal, 4 = Files, 8 = Console
3326
- QV('MainDevDesktop', ((mesh.mtype == 1) || (node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 1) != 0) || (node.intelamt && (node.intelamt.state == 2))) && ((meshrights & 8) || (meshrights & 256)));
3327
- QV('MainDevTerminal', ((mesh.mtype == 1) || (node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 2) != 0) || (node.intelamt && (node.intelamt.state == 2))) && (meshrights & 8));
3328
- QV('MainDevFiles', ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 4) != 0))) && (meshrights & 8));
3329
- QV('MainDevAmt', (node.intelamt != null) && ((node.intelamt.state == 2) || (node.conn & 2)) && (meshrights & 8));
3330
- QV('MainDevConsole', (consoleRights && (mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 8) != 0))) && (meshrights & 8));
3331
- QV('p15uploadCore', (node.agent != null) && (node.agent.caps != null) && ((node.agent.caps & 16) != 0) && (userinfo.siteadmin == 0xFFFFFFFF));
3332
- QH('p15coreName', ((node.agent != null) && (node.agent.core != null))?node.agent.core:'');
3333
-
3334
- // Setup/Refresh Intel AMT tab
3335
- var amtFrameNode = Q('p14iframe').contentWindow.getCurrentMeshNode();
3336
- if ((amtFrameNode != null) && (amtFrameNode._id != currentNode._id)) { Q('p14iframe').contentWindow.disconnect(); }
3337
- var online = ((node.conn & 6) != 0)?true:false; // If CIRA (2) or AMT (4) connected, enable Commander
3338
- Q('p14iframe').contentWindow.setConnectionState(online);
3339
- Q('p14iframe').contentWindow.setFrameHeight('650px');
3340
- Q('p14iframe').contentWindow.setAuthCallback(updateAmtCredentials);
3341
-
3342
- // Display "action" button on desktop/terminal/files
3343
- QV('deskActionsBtn', (meshrights & 72) != 0); // 72 = Wake-up + Remote Control permissions
3344
- QV('termActionsBtn', (meshrights & 72) != 0);
3345
- QV('filesActionsBtn', (meshrights & 72) != 0);
3346
-
3347
- // Request the power timeline
3348
- if ((powerTimelineNode != currentNode._id) && (powerTimelineReq != currentNode._id)) {
3349
- QH('p10html2', '');
3350
- powerTimelineReq = currentNode._id;
3351
- meshserver.send({ action: 'powertimeline', nodeid: currentNode._id });
3352
- meshserver.send({ action: 'lastconnect', nodeid: currentNode._id });
3353
- }
3354
-
3355
- // Reset the desktop tools
3356
- QV('DeskTools', false);
3357
- showDeskToolsProcesses();
3358
-
3359
- // Ask for device events
3360
- refreshDeviceEvents();
3361
- }
3362
- setupDesktop(); // Always refresh the desktop, even if we are on the same device, we need to do some canvas switching.
3363
- if (!panel) panel = 10;
3364
- go(panel);
3365
- }
3366
-
3367
- function showNotes(readonly, noteid) {
3368
- if (xxdialogMode) return;
3369
- setDialogMode(2, "Notes", 2, showNotesEx, '<textarea id=d2devNotes ro=' + readonly + ' noteid=' + noteid + ' readonly style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea><span style=font-size:10px>Notes can be viewed and changed by other administrators.<span>', noteid);
3370
- meshserver.send({ action: 'getNotes', id: decodeURIComponent(noteid) });
3371
- }
3372
-
3373
- function showNotesEx(buttons, tag) { meshserver.send({ action: 'setNotes', id: decodeURIComponent(tag), notes: encodeURIComponent(Q('d2devNotes').value) }); }
3374
-
3375
- function deviceChat() {
3376
- if (xxdialogMode) return;
3377
- window.open('/messenger?id=meshmessenger/' + encodeURIComponent(currentNode._id) + '/' + encodeURIComponent(userinfo._id) + '&title=' + currentNode.name, 'meshmessenger:' + currentNode._id);
3378
- meshserver.send({ action: 'meshmessenger', nodeid: decodeURIComponent(currentNode._id) });
3379
- }
3380
-
3381
- function deviceUrlFunction() {
3382
- if (xxdialogMode) return;
3383
- setDialogMode(2, "Open Page on Device", 3, deviceUrlFunctionEx, '<input id=d2devurl placeholder="http://server.com" style=width:100%;overflow-y:scroll></input>');
3384
- }
3385
-
3386
- function deviceUrlFunctionEx() {
3387
- meshserver.send({ action: 'msg', type: 'openUrl', nodeid: currentNode._id, url: Q('d2devurl').value });
3388
- }
3389
-
3390
- function deviceToastFunction() {
3391
- if (xxdialogMode) return;
3392
- setDialogMode(2, "Device Notification", 3, deviceToastFunctionEx, '<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>');
3393
- }
3394
-
3395
- function deviceToastFunctionEx() {
3396
- meshserver.send({ action: 'toast', nodeids: [ currentNode._id ], title: 'MeshCentral', msg: Q('d2devToast').value });
3397
- }
3398
-
3399
- function deviceActionFunction() {
3400
- if (xxdialogMode) return;
3401
- var meshrights = meshes[currentNode.meshid].links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
3402
- var x = "Select an operation to perform on this device.<br /><br />";
3403
- var y = '<select id=d2deviceop style=float:right;width:250px>';
3404
- if ((meshrights & 64) != 0) { y += '<option value=100>Wake-up</option>'; } // Wake-up permission
3405
- if ((meshrights & 8) != 0) { y += '<option value=4>Sleep</option><option value=3>Reset</option><option value=2>Power off</option>'; } // Remote control permission
3406
- y += '</select>';
3407
- x += addHtmlValue('Operation', y);
3408
- setDialogMode(2, "Device Action", 3, deviceActionFunctionEx, x);
3409
- }
3410
-
3411
- function deviceActionFunctionEx() {
3412
- var op = Q('d2deviceop').value;
3413
- if (op == 100) {
3414
- // Device wake
3415
- meshserver.send({ action: 'wakedevices', nodeids: [ currentNode._id ] });
3416
- } else {
3417
- // Power operation
3418
- meshserver.send({ action: 'poweraction', nodeids: [ currentNode._id ], actiontype: op });
3419
- }
3420
- }
3421
-
3422
- // Called when MeshCommander needs new credentials or updated credentials.
3423
- function updateAmtCredentials(forceDialog) {
3424
- var node = getNodeFromId(currentNode._id);
3425
- if ((forceDialog == true) || (node.intelamt.user == null) || (node.intelamt.user == '')) {
3426
- editDeviceAmtSettings(currentNode._id, updateAmtCredentialsEx);
3427
- } else {
3428
- Q('p14iframe').contentWindow.connectButtonfunctionEx();
3429
- }
3430
- }
3431
-
3432
- function updateAmtCredentialsEx(button, tag) {
3433
- Q('p14iframe').contentWindow.connectButtonfunctionEx();
3434
- }
3435
-
3436
- // Look to see if we need to update the device timeline
3437
- function updateDeviceTimeline() {
3438
- if ((meshserver.State != 2) || (powerTimelineNode == null) || (powerTimelineUpdate == null) || (currentNode == null)) return;
3439
- if ((powerTimelineNode == powerTimelineReq) && (currentNode._id == powerTimelineNode) && (powerTimelineUpdate < Date.now())) {
3440
- powerTimelineUpdate = null;
3441
- meshserver.send({ action: 'powertimeline', nodeid: currentNode._id });
3442
- meshserver.send({ action: 'lastconnect', nodeid: currentNode._id });
3443
- }
3444
- }
3445
-
3446
- // Draw device power bars. The bars are 766px wide.
3447
- function drawDeviceTimeline() {
3448
- if ((currentNode == null) || (xxcurrentView < 10) || (xxcurrentView > 19)) return;
3449
- var timeline = null, now = Date.now();
3450
- if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; }
3451
-
3452
- // Calculate when the timeline starts
3453
- var d = new Date();
3454
- d.setHours(0, 0, 0, 0);
3455
- d = new Date(d.getTime() - (1000 * 60 * 60 * 24 * 6));
3456
- var timelineStart = d.getTime();
3457
-
3458
- // De-compact the timeline
3459
- var timeline2 = [];
3460
- if (timeline != null && timeline.length > 1) {
3461
- timeline2.push([ 0, timeline[1], timeline[0] ]); // Start, End, Power
3462
- var ct = timeline[1];
3463
- for (var i = 2; i < timeline.length; i += 2) {
3464
- var power = timeline[i], dt = now;
3465
- if (timeline.length > (i + 1)) { dt = timeline[i + 1]; }
3466
- timeline2.push([ ct, ct + dt, power ]); // Start, End, Power
3467
- ct = ct + dt;
3468
- }
3469
- }
3470
-
3471
- // Draw the timeline
3472
- var x = '', count = 1, date = new Date();
3473
- var totalWidth = Q('masthead').offsetWidth - (160 + 9 + 9 + 14); // Compute the total width of the power bar
3474
- date.setHours(0, 0, 0, 0);
3475
- for (var i = 0; i < 7; i++) {
3476
- var datavalue = '', start = date.getTime(), end = start + (1000 * 60 * 60 * 24);
3477
- for (var j in timeline2) {
3478
- var block = timeline2[j];
3479
- if (isTimeBlockInside(start, end, block[0], block[1]) == true) {
3480
- var ts = Math.max(start, block[0]);
3481
- var te = Math.min(Math.min(end, block[1]), now);
3482
- var width = Math.round(((te - ts) * totalWidth) / 86400000);
3483
- if (width > 0) {
3484
- var title = powerStateStrings2[block[2]] + ' from ' + new Date(ts).toLocaleTimeString() + ' to ' + new Date(te).toLocaleTimeString() + '.';
3485
- datavalue += '<div title="' + title + '" style=display:table-cell;width:' + width + 'px;background-color:' + powerColor(block[2]) + ';height:16px></div>';
3486
- }
3487
- }
3488
- }
3489
- x += '<tr style=' + (((count % 2) == 0)?'background-color:#DDD':'') + '><td><div> ' + date.toLocaleDateString() + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
3490
- ++count;
3491
- date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
3492
- }
3493
- QH('p10html2', '<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>Day</th><th scope=col style=text-align:center>7 Day Power State</th></tr>' + x + '</tbody></table>');
3494
- }
3495
-
3496
- // Return a color for the given power state
3497
- function powerColor(x) { if (x < powerColorTable.length) { return powerColorTable[x]; } return 'yellow'; }
3498
-
3499
- // Return true if the time block is visible within the start/end period
3500
- function isTimeBlockInside(start, end, blockStart, blockEnd) {
3501
- if ((blockStart < start) && (blockEnd > end)) return true; // Block is wider than timespan
3502
- if ((blockStart > start) && (blockStart < end)) return true;
3503
- if ((blockEnd > start) && (blockEnd < end)) return true;
3504
- return false;
3505
- }
3506
-
3507
- function addDeviceAttribute(name, value) { return '<tr><td class=style7 style=width:180px>' + name + '</td><td class=style9 style=max-width:400px;overflow:hidden>' + value + '</td></tr>'; }
3508
-
3509
- function editDeviceAmtSettings(nodeid, func) {
3510
- if (xxdialogMode) return;
3511
- var x = '', node = getNodeFromId(nodeid), buttons = 3, meshrights = getNodeRights(nodeid);
3512
- if ((meshrights & 4) == 0) return;
3513
- x += addHtmlValue('Username', '<input id=dp10username style=width:230px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
3514
- x += addHtmlValue('Password', '<input id=dp10password type=password style=width:230px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
3515
- x += addHtmlValue('Security', '<select id=dp10tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>');
3516
- if ((node.intelamt.user != null) && (node.intelamt.user != '')) { buttons = 7; }
3517
- setDialogMode(2, "Edit Intel® AMT credentials", buttons, editDeviceAmtSettingsEx, x, { node: node, func: func });
3518
- if ((node.intelamt.user != null) && (node.intelamt.user != '')) { Q('dp10username').value = node.intelamt.user; } else { Q('dp10username').value = 'admin'; }
3519
- Q('dp10tls').value = node.intelamt.tls;
3520
- validateDeviceAmtSettings();
3521
- }
3522
-
3523
- function validateDeviceAmtSettings() {
3524
- QE('idx_dlgOkButton', passwordcheck(Q('dp10password').value));
3525
- }
3526
-
3527
- function editDeviceAmtSettingsEx(button, tag) {
3528
- if (button == 2) {
3529
- // Delete button pressed, remove credentials
3530
- meshserver.send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: '', pass: '' } });
3531
- } else {
3532
- // Change Intel AMT credentials
3533
- var amtuser = Q('dp10username').value;
3534
- if (amtuser == '') amtuser = 'admin';
3535
- var amtpass = Q('dp10password').value;
3536
- if (amtpass == '') amtuser = '';
3537
- meshserver.send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: amtuser, pass: amtpass, tls: Q('dp10tls').value } });
3538
- tag.node.intelamt.user = amtuser;
3539
- tag.node.intelamt.tls = Q('dp10tls').value;
3540
- if (tag.func) { setTimeout(tag.func, 300); }
3541
- }
3542
- }
3543
-
3544
- function p10showDeleteNodeDialog(nodeid) {
3545
- if (xxdialogMode) return;
3546
- var x = "Are you sure you want to delete node \"" + EscapeHtml(currentNode.name) + "\"?<br /><br />";
3547
- x += "<input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm";
3548
- setDialogMode(2, "Delete Node", 3, p10showDeleteNodeDialogEx, x, nodeid);
3549
- p10validateDeleteNodeDialog();
3550
- }
3551
-
3552
- function p10validateDeleteNodeDialog() {
3553
- QE('idx_dlgOkButton', Q('p10check').checked);
3554
- }
3555
-
3556
- function p10showDeleteNodeDialogEx(buttons, nodeid) {
3557
- meshserver.send({ action: 'removedevices', nodeids: [ nodeid ] });
3558
- }
3559
-
3560
- function p10clickOnce(nodeid, protocol, port) {
3561
- meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'clickonce', protocol: protocol });
3562
- }
3563
-
3564
- // Show current location
3565
- var d2map = null;
3566
- function p10showNodeLocationDialog() {
3567
- if ((xxdialogMode != null) && (xxdialogTag == '@xxmap')) { setDialogMode(0); } else { if (xxdialogMode) return; }
3568
- var markers = [], types = ['iploc', 'wifiloc', 'gpsloc', 'userloc'], boundingBox = null;
3569
-
3570
- for (var loctype in types) {
3571
- if (currentNode[types[loctype]] != null) {
3572
- var loc = currentNode[types[loctype]].split(','), lat = parseFloat(loc[0]), lon = parseFloat(loc[1]);
3573
- if ((lat < 90) && (lat > -90) && (lon < 180) && (lon > -180)) { // Check valid lat/lon
3574
- var deviceMark = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.fromLonLat([lon, lat])) });
3575
- deviceMark.setStyle(markerStyle(currentNode, parseInt(loctype) + 1));
3576
- markers.push(deviceMark);
3577
-
3578
- if (boundingBox == null) { boundingBox = [ lat, lon, lat, lon, 0 ]; } else { if (lat < boundingBox[0]) { boundingBox[0] = lat; } if (lon < boundingBox[1]) { boundingBox[1] = lon; } if (lat > boundingBox[2]) { boundingBox[2] = lat; } if (lon > boundingBox[3]) { boundingBox[3] = lon; } }
3579
- }
3580
- }
3581
- }
3582
-
3583
- // Setup the device mark layer
3584
- var vectorSource = new ol.source.Vector({ features: markers });
3585
- var vectorLayer = new ol.layer.Vector({ source: vectorSource });
3586
-
3587
- //var x = '<div><a href="https://www.google.com/maps/preview/@' + lat + ',' + lng + ',12z" rel="noreferrer noopener" target=_blank>Open in Google maps</a></div>';
3588
- var x = '<div id=d2map style=width:100%;height:300px></div>';
3589
- setDialogMode(2, "Device Location", 1, null, x, '@xxmap');
3590
-
3591
- var clng = 0, clat = 0, zoom = 8;
3592
- if (boundingBox != null) {
3593
- var clat = (boundingBox[0] + boundingBox[2]) / 2;
3594
- var clng = (boundingBox[1] + boundingBox[3]) / 2;
3595
- var cscale = Math.max(Math.abs(boundingBox[0] - boundingBox[2]), Math.abs(boundingBox[1] - boundingBox[3]));
3596
- var i = 360, zoom = -2;
3597
- while (i > cscale) { zoom++; i = i / 2; }
3598
- }
3599
-
3600
- if (markers.length == 1) { zoom = 8; }
3601
-
3602
- // Setup the map
3603
- d2map = new ol.Map({
3604
- target: 'd2map',
3605
- interactions: ol.interaction.defaults({dragPan:false, mouseWheelZoom:false}),
3606
- layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }), vectorLayer ],
3607
- view: new ol.View({ center: ol.proj.fromLonLat([clng, clat]), zoom: zoom })
3608
- });
3609
- }
3610
-
3611
- // Show network interfaces
3612
- function p10showNodeNetInfoDialog() {
3613
- if (xxdialogMode) return;
3614
- setDialogMode(2, "Network Interfaces", 1, null, "<div id=d2netinfo>Loading...</div>", 'if' + currentNode._id );
3615
- meshserver.send({ action: 'getnetworkinfo', nodeid: currentNode._id });
3616
- }
3617
-
3618
- // Show router dialog
3619
- function p10showMeshCmdDialog(mode, nodeid) {
3620
- if (xxdialogMode) return;
3621
- var y = "<select id=aginsSelect onclick=meshCmdOsClick() style=width:236px>";
3622
- y += "<option value=3>Windows (32bit)</option>";
3623
- y += "<option value=4>Windows (64bit)</option>";
3624
- y += "<option value=5>Linux x86 (32bit)</option>";
3625
- y += "<option value=6>Linux x86 (64bit)</option>";
3626
- y += "<option value=25>Linux ARM, Raspberry Pi (32bit)</option>";
3627
- y += "</select>";
3628
-
3629
- var x = "";
3630
- if (mode == 0) { x += '<div>MeshCmd is a command line tool that performs lots of different operations. The action file can optionally be downloaded and edited to provide server information and credentials.<br /><br />'; }
3631
- if (mode == 1) { x += '<div>Download "meshcmd" with an action file to route traffic thru this server to this device. Make sure to edit meshaction.txt and add your account password or make any changes needed.<br /><br />'; }
3632
- x += addHtmlValue('Operating System', y);
3633
- x += addHtmlValue('MeshCmd', '<a id=meshcmddownloadid href="meshagents?meshcmd=3" rel="noreferrer noopener" target="_blank"></a>');
3634
- if (mode == 0) { x += addHtmlValue('Action File', '<a href="meshagents?meshaction=generic" rel="noreferrer noopener" target="_blank">MeshAction (.txt)</a>'); }
3635
- if (mode == 1) { x += addHtmlValue('Action File', '<a href="meshagents?meshaction=route&nodeid=' + nodeid + '" rel="noreferrer noopener" target="_blank">MeshAction (.txt)</a>'); }
3636
- x += "</div>";
3637
-
3638
- setDialogMode(2, ["Download MeshCmd","Network Router"][mode], 9, null, x);
3639
- meshCmdOsClick();
3640
- }
3641
-
3642
- function meshCmdOsClick() {
3643
- var os = Q('aginsSelect').value, osn = '';
3644
- Q('meshcmddownloadid').href = "meshagents?meshcmd=" + os;
3645
- if (os == 3) { osn = 'MeshCmd (Win32 executable)'; }
3646
- if (os == 4) { osn = 'MeshCmd (Win64 executable)'; }
3647
- if (os == 5) { osn = 'MeshCmd (Linux x86, 32bit)'; }
3648
- if (os == 6) { osn = 'MeshCmd (Linux x86, 64bit)'; }
3649
- if (os == 25) { osn = 'MeshCmd (Linux ARM, 32bit)'; }
3650
- QH('meshcmddownloadid', osn);
3651
- }
3652
-
3653
- function p10showiconselector() {
3654
- if (xxdialogMode) return;
3655
- var mesh = meshes[currentNode.meshid];
3656
- var meshrights = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
3657
- if ((meshrights & 4) == 0) return;
3658
-
3659
- var x = '<br><div style=display:inline-block;width:40px></div>';
3660
- x += '<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>';
3661
- x += '<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>';
3662
- x += '<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div>';
3663
- x += '<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>';
3664
- x += '<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>';
3665
- x += '<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div><br><br>';
3666
- setDialogMode(2, "Icon Selection", 0, null, x);
3667
- QV('id_dialogclose', true);
3668
- }
3669
-
3670
- function p10setIcon(icon) {
3671
- setDialogMode(0);
3672
- meshserver.send({ action: 'changedevice', nodeid: currentNode._id, icon: icon });
3673
- }
3674
-
3675
- var showEditNodeValueDialog_modes = ['Device Name', 'Hostname', 'Description', 'Tags'];
3676
- var showEditNodeValueDialog_modes2 = ['name', 'host', 'desc', 'tags'];
3677
- var showEditNodeValueDialog_modes3 = ['', '', '', 'Tag1, Tag2, Tag3'];
3678
- function showEditNodeValueDialog(mode) {
3679
- if (xxdialogMode) return;
3680
- var x = addHtmlValue(showEditNodeValueDialog_modes[mode], '<input id=dp10devicevalue style=width:230px maxlength=64 placeholder="' + showEditNodeValueDialog_modes3[mode] + '" onchange=p10editdevicevalueValidate(' + mode + ',event) onkeyup=p10editdevicevalueValidate(' + mode + ',event) />');
3681
- setDialogMode(2, "Edit Device", 3, showEditNodeValueDialogEx, x, mode);
3682
- var v = currentNode[showEditNodeValueDialog_modes2[mode]];
3683
- if (v == null) v = '';
3684
- if (Array.isArray(v)) { v = v.join(', '); }
3685
- Q('dp10devicevalue').value = v;
3686
- p10editdevicevalueValidate();
3687
- Q('dp10devicevalue').focus();
3688
- }
3689
-
3690
- function showEditNodeValueDialogEx(button, mode) {
3691
- var x = { action: 'changedevice', nodeid: currentNode._id };
3692
- x[showEditNodeValueDialog_modes2[mode]] = Q('dp10devicevalue').value;
3693
- meshserver.send(x);
3694
- }
3695
-
3696
- function p10editdevicevalueValidate(mode, e) {
3697
- var x = ((mode > 1) || (Q('dp10devicevalue').value.length > 0));
3698
- QE('idx_dlgOkButton', x);
3699
- if ((e != null) && (x == true) && (e.keyCode == 13)) { dialogclose(1); }
3700
- }
3701
-
3702
- //
3703
- // DESKTOP
3704
- //
3705
-
3706
- var desktopNode;
3707
- function setupDesktop() {
3708
- // Setup the remote desktop
3709
- if ((desktopNode != currentNode) && (desktop != null)) { desktop.Stop(); desktopNode = null; desktop = null; }
3710
-
3711
- // If the device desktop is already connected in multi-desktop, use that.
3712
- if ((desktopNode != currentNode) || (desktop == null)) {
3713
- var xdesk = multiDesktop[currentNode._id];
3714
- if (xdesk != null) {
3715
- // This device already has a canvas, use it.
3716
- QH('DeskParent', '');
3717
- var c = xdesk.m.CanvasId;
3718
- c.setAttribute('id', 'Desk');
3719
- c.setAttribute('style', 'width:100%;-ms-touch-action:none;margin-left:0px');
3720
- c.setAttribute('onmousedown', 'dmousedown(event)');
3721
- c.setAttribute('onmouseup', 'dmouseup(event)');
3722
- c.setAttribute('onmousemove', 'dmousemove(event)');
3723
- c.removeAttribute('onclick');
3724
- Q('DeskParent').appendChild(c);
3725
- desktop = xdesk;
3726
- if (desktop.m.SendCompressionLevel) { desktop.m.SendCompressionLevel(1, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate); }
3727
- desktop.onStateChanged = onDesktopStateChange;
3728
- desktopNode = currentNode;
3729
- onDesktopStateChange(desktop, desktop.State);
3730
- delete multiDesktop[currentNode._id];
3731
- } else {
3732
- // Device is not already connected, just setup a blank canvas
3733
- QH('DeskParent', '<canvas id=Desk width=640 height=480 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');
3734
- desktopNode = currentNode;
3735
- }
3736
- // Setup the mouse wheel
3737
- Q('Desk').addEventListener('DOMMouseScroll', function (e) { return dmousewheel(e); });
3738
- Q('Desk').addEventListener('mousewheel', function (e) { return dmousewheel(e); });
3739
- }
3740
- desktopNode = currentNode;
3741
- updateDesktopButtons();
3742
- deskAdjust();
3743
-
3744
- // On some browsers like IE, we can't save screen shots. Hide the scheenshot/capture buttons.
3745
- if (!Q('Desk')['toBlob']) { QV('deskSaveBtn', false); }
3746
- }
3747
-
3748
- // Show and enable the right buttons
3749
- function updateDesktopButtons() {
3750
- var mesh = meshes[currentNode.meshid];
3751
- var deskState = 0;
3752
- if (desktop != null) { deskState = desktop.State; }
3753
- var meshrights = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
3754
-
3755
- // Show the right buttons
3756
- QV('disconnectbutton1span', (deskState != 0));
3757
- QV('connectbutton1span', (deskState == 0) && ((meshrights & 8) || (meshrights & 256)) && (mesh.mtype == 2) && (currentNode.agent.caps & 1));
3758
- QV('connectbutton1hspan', (deskState == 0) && (meshrights & 8) && ((currentNode.intelamt != null) && (mesh.mtype == 1 || currentNode.intelamt.state == 2) && ((currentNode.intelamt.ver != null) || (mesh.mtype == 1))));
3759
-
3760
- // Show the right settings
3761
- QV('d7amtkvm', (currentNode.intelamt != null && ((currentNode.intelamt.ver != null) || (mesh.mtype == 1))) && ((deskState == 0) || (desktop.contype == 2)));
3762
- QV('d7meshkvm', (webRtcDesktop) || ((mesh.mtype == 2) && (currentNode.agent.caps & 1) && ((deskState == false) || (desktop.contype == 1))));
3763
-
3764
- // Enable buttons
3765
- var online = ((currentNode.conn & 1) != 0); // If Agent (1) connected, enable remote desktop
3766
- QE('connectbutton1', online);
3767
- var hwonline = ((currentNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal
3768
- QE('connectbutton1h', hwonline);
3769
- QE('deskSaveBtn', deskState == 3);
3770
- QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (deskState != 0) && (desktopsettings.showfocus));
3771
- QV('DeskCAD', meshrights & 8);
3772
- QE('DeskCAD', deskState == 3);
3773
- QV('DeskWD', (currentNode.agent) && (currentNode.agent.id < 5) && (meshrights & 8));
3774
- QE('DeskWD', deskState == 3);
3775
- QV('deskkeys', (currentNode.agent) && (currentNode.agent.id < 5) && (meshrights & 8));
3776
- QE('deskkeys', deskState == 3);
3777
-
3778
- QV('DeskToolsButton', (meshrights & 8) && (mesh.mtype == 2) && online);
3779
- QV('DeskChatButton', (browserfullscreen == false) && (meshrights & 8) && (mesh.mtype == 2) && online);
3780
- QV('DeskNotifyButton', (browserfullscreen == false) && (currentNode.agent) && (currentNode.agent.id < 5) && (meshrights & 8) && (mesh.mtype == 2) && online);
3781
- QV('DeskOpenWebButton', (browserfullscreen == false) && (meshrights & 8) && (mesh.mtype == 2) && online);
3782
-
3783
- QV('DeskControlSpan', meshrights & 8)
3784
- QV('deskActionsBtn', (browserfullscreen == false));
3785
- QV('deskActionsSettings', (browserfullscreen == false));
3786
- if (meshrights & 8) { Q('DeskControl').checked = (getstore('DeskControl', 1) == 1); } else { Q('DeskControl').checked = false; }
3787
- if (online == false) QV('DeskTools', false);
3788
- }
3789
-
3790
- // Debug
3791
- var autoConnectDesktopTimer = null;
3792
- function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(connectDesktop, 100); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } }
3793
-
3794
- function connectDesktop(e, contype) {
3795
- if (desktop == null) {
3796
- desktopNode = currentNode;
3797
- if (contype == 2) {
3798
- // Setup the Intel AMT remote desktop
3799
- if ((desktopNode.intelamt.user == null) || (desktopNode.intelamt.user == '')) { editDeviceAmtSettings(desktopNode._id, connectDesktop); return; }
3800
- desktop = CreateAmtRedirect(CreateAmtRemoteDesktop('Desk'));
3801
- desktop.debugmode = debugmode;
3802
- desktop.onStateChanged = onDesktopStateChange;
3803
- desktop.m.bpp = (desktopsettings.encoding == 1 || desktopsettings.encoding == 3) ? 1 : 2;
3804
- desktop.m.useZRLE = (desktopsettings.encoding < 3);
3805
- desktop.m.showmouse = desktopsettings.showmouse;
3806
- desktop.m.onScreenSizeChange = deskAdjust;
3807
- desktop.m.onKvmData = function (x) {
3808
- //console.log('onKvmData (' + x.length + '): ' + x);
3809
- // Send the presense probe only once if needed.
3810
- if (x.length == 0) { if (!desktop.m._sentPresence) { desktop.m._sentPresence = true; desktop.m.sendKvmData(JSON.stringify({ action: 'present', ver: 1 })); } return; }
3811
- var data = null;
3812
- try { data = JSON.parse(x); } catch (e) { }
3813
- if ((data != null) && (data.action != null)) {
3814
- if (data.action == 'restart') {
3815
- // Clear WebRTC channel
3816
- webRtcDesktopReset();
3817
- desktop.m.sendKvmData(JSON.stringify({ action: 'present', ver: 1 }));
3818
- } else if ((data.action == 'present') && (webRtcDesktop == null)) {
3819
- // Setup WebRTC channel
3820
- webRtcDesktop = { platform: data.platform };
3821
- var configuration = null; //{ "iceServers": [ { 'urls': 'stun:stun.services.mozilla.com' }, { 'urls': 'stun:stun.l.google.com:19302' } ] };
3822
- if (typeof RTCPeerConnection !== 'undefined') { webRtcDesktop.webrtc = new RTCPeerConnection(configuration); }
3823
- else if (typeof webkitRTCPeerConnection !== 'undefined') { webRtcDesktop.webrtc = new webkitRTCPeerConnection(configuration); }
3824
-
3825
- webRtcDesktop.webchannel = webRtcDesktop.webrtc.createDataChannel("DataChannel", {}); // { ordered: false, maxRetransmits: 2 }
3826
- webRtcDesktop.webchannel.onopen = function () {
3827
- // Switch to software KVM
3828
- //if (urlvars && urlvars['kvmdatatrace']) { console.log('WebRTC Data Channel Open'); }
3829
- console.log('WebRTC Data Channel Open');
3830
- Q('deskstatus').textContent = StatusStrs[desktop.State] + ', Soft-KVM';
3831
- desktop.m.hold(true);
3832
- webRtcDesktop.webRtcActive = true;
3833
- webRtcDesktop.softdesktop = CreateKvmDataChannel(webRtcDesktop.webchannel, CreateAgentRemoteDesktop('Desk', Q('id_mainarea')), desktop.m);
3834
- webRtcDesktop.softdesktop.m.setRotation(desktop.m.rotation);
3835
- webRtcDesktop.softdesktop.m.onScreenSizeChange = deskAdjust;
3836
- if (desktopsettings.quality) { webRtcDesktop.softdesktop.m.CompressionLevel = desktopsettings.quality; } // Number from 1 to 100. 50 or less is best.
3837
- if (desktopsettings.scaling) { webRtcDesktop.softdesktop.m.ScalingLevel = desktopsettings.scaling; }
3838
- webRtcDesktop.softdesktop.Start();
3839
-
3840
- // Check if we can get remote file access
3841
- // ###BEGIN###{DesktopInbandFiles}
3842
- /*
3843
- QV('go24', true); // Files
3844
- downloadFile = null;
3845
- p24files = webRtcDesktop.softdesktop;
3846
- p24targetpath = '';
3847
- webRtcDesktop.softdesktop.onControlMsg = onFilesControlData;
3848
- webRtcDesktop.softdesktop.sendCtrlMsg(JSON.stringify({ action: 'ls', reqid: 1, path: '' })); // Ask for the root folder
3849
- */
3850
- // ###END###{DesktopInbandFiles}
3851
- }
3852
- webRtcDesktop.webchannel.onclose = function (event) {
3853
- //if (urlvars['kvmdatatrace']) { console.log('WebRTC Data Channel Closed'); }
3854
- console.log('WebRTC Data Channel Closed');
3855
- webRtcDesktopReset();
3856
- }
3857
- webRtcDesktop.webrtc.onicecandidate = function (e) {
3858
- if (e.candidate == null) {
3859
- desktop.m.sendKvmData(JSON.stringify({ action: 'offer', ver: 1, sdp: webRtcDesktop.webrtcoffer.sdp }));
3860
- } else {
3861
- webRtcDesktop.webrtcoffer.sdp += ("a=" + e.candidate.candidate + "\r\n"); // New candidate, add it to the SDP
3862
- }
3863
- }
3864
- webRtcDesktop.webrtc.oniceconnectionstatechange = function () {
3865
- if ((webRtcDesktop != null) && (webRtcDesktop.webrtc != null) && ((webRtcDesktop.webrtc.iceConnectionState == 'disconnected') || (webRtcDesktop.webrtc.iceConnectionState == 'failed'))) { /*console.log('WebRTC ICE Failed');*/ webRtcDesktopReset(); }
3866
- }
3867
- webRtcDesktop.webrtc.createOffer(function (offer) {
3868
- // Got the offer
3869
- webRtcDesktop.webrtcoffer = offer;
3870
- webRtcDesktop.webrtc.setLocalDescription(offer, function () { }, webRtcDesktopReset);
3871
- }, webRtcDesktopReset, { mandatory: { OfferToReceiveAudio: false, OfferToReceiveVideo: false } });
3872
- } else if ((data.action == 'answer') && (webRtcDesktop != null)) {
3873
- // Complete the WebRTC channel
3874
- webRtcDesktop.webrtc.setRemoteDescription(new RTCSessionDescription({ type: 'answer', sdp: data.sdp }), function () { }, webRtcDesktopReset);
3875
- }
3876
- }
3877
- };
3878
- desktop.Start(desktopNode._id, 16994, '*', '*', 0);
3879
- desktop.contype = 2;
3880
- } else {
3881
- // Setup the Mesh Agent remote desktop
3882
- desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort);
3883
- desktop.debugmode = debugmode;
3884
- desktop.m.debugmode = debugmode;
3885
- desktop.attemptWebRTC = attemptWebRTC;
3886
- desktop.onStateChanged = onDesktopStateChange;
3887
- desktop.m.CompressionLevel = desktopsettings.quality; // Number from 1 to 100. 50 or less is best.
3888
- desktop.m.ScalingLevel = desktopsettings.scaling;
3889
- desktop.m.FrameRateTimer = desktopsettings.framerate;
3890
- desktop.m.onDisplayinfo = deskDisplayInfo;
3891
- desktop.m.onScreenSizeChange = deskAdjust;
3892
- desktop.Start(desktopNode._id);
3893
- desktop.contype = 1;
3894
- }
3895
- } else {
3896
- // Disconnect and clean up the remote desktop
3897
- desktop.Stop();
3898
- webRtcDesktopReset();
3899
- desktopNode = desktop = null;
3900
- }
3901
- }
3902
-
3903
- var webRtcDesktop = null;
3904
- function webRtcDesktopReset() {
3905
- if (webRtcDesktop == null) return;
3906
- if (webRtcDesktop.softdesktop != null) { webRtcDesktop.softdesktop.Stop(); webRtcDesktop.softdesktop = null; }
3907
- if (webRtcDesktop.webchannel != null) { try { webRtcDesktop.webchannel.close(); } catch (e) { } webRtcDesktop.webchannel = null; }
3908
- if (webRtcDesktop.webrtc != null) { try { webRtcDesktop.webrtc.close(); } catch (e) { } webRtcDesktop.webrtc = null; }
3909
- webRtcDesktop = null;
3910
- // Switch back to hardware KVM
3911
- if (desktop && desktop.m) {
3912
- desktop.m.hold(false);
3913
- Q('deskstatus').textContent = StatusStrs[desktop.State];
3914
- }
3915
- // ###BEGIN###{DesktopInbandFiles}
3916
- /*
3917
- p24files = null;
3918
- p24downloadFileCancel() // If any downloads are in process, cancel them.
3919
- p24uploadFileCancel(); // If any uploads are in process, cancel them.
3920
- QV('go24', false); // Files
3921
- if (currentView == 24) { go(14); }
3922
- */
3923
- // ###END###{DesktopInbandFiles}
3924
- }
3925
-
3926
- function onDesktopStateChange(xdesktop, state) {
3927
- var xstate = state;
3928
- if ((xstate == 3) && (xdesktop.contype == 2)) { xstate++; }
3929
- var str = StatusStrs[xstate];
3930
- if ((desktop != null) && (desktop.webRtcActive == true)) { str += ', WebRTC'; }
3931
- //if (desktop.m.stopInput == true) { str += ', Loopback'; }
3932
- QH('deskstatus', str);
3933
- switch (state) {
3934
- case 0:
3935
- // Disconnect and clean up the remote desktop
3936
- desktop.Stop();
3937
- desktopNode = desktop = null;
3938
- QV('DeskFocus', false);
3939
- QV('termdisplays', false);
3940
- deskFocusBtn.value = 'All Focus';
3941
- if (fullscreen == true) { deskToggleFull(); }
3942
- webRtcDesktopReset();
3943
- break;
3944
- case 2:
3945
- break;
3946
- default:
3947
- //console.log('Unknown onDesktopStateChange state', state);
3948
- break;
3949
- }
3950
- updateDesktopButtons();
3951
- deskAdjust();
3952
- setTimeout(deskAdjust, 50);
3953
- }
3954
-
3955
- function showDesktopSettings() {
3956
- if (xxdialogMode) return;
3957
- applyDesktopSettings();
3958
- updateDesktopButtons();
3959
- setDialogMode(7, "Remote Desktop Settings", 3, showDesktopSettingsChanged);
3960
- }
3961
-
3962
- function showDesktopSettingsChanged() {
3963
- desktopsettings.encoding = d7desktopmode.value;
3964
- desktopsettings.showfocus = d7showfocus.checked;
3965
- desktopsettings.showmouse = d7showcursor.checked;
3966
- desktopsettings.quality = d7bitmapquality.value;
3967
- desktopsettings.scaling = d7bitmapscaling.value;
3968
- desktopsettings.framerate = d7framelimiter.value;
3969
- localStorage.setItem('desktopsettings', JSON.stringify(desktopsettings));
3970
- applyDesktopSettings();
3971
- if (desktop) {
3972
- if (desktop.contype == 1) {
3973
- if (desktop.State != 0) { desktop.m.SendCompressionLevel(1, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate); }
3974
- }
3975
- if (desktop.contype == 2) {
3976
- if (desktopsettings.showfocus == false) { desktop.m.focusmode = 0; deskFocusBtn.value = 'All Focus'; }
3977
- if (desktop.State != 0) { desktop.Stop(); setTimeout(function () { connectDesktop(null, 2); }, 50); }
3978
- }
3979
- }
3980
- }
3981
-
3982
- function applyDesktopSettings() {
3983
- var r = '', ops = (features & 512)?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];
3984
- for (var i in ops) { r += '<option value=' + ops[i] + '>' + ops[i] + '%</option>'; }
3985
- QH('d7bitmapquality', r);
3986
- d7desktopmode.value = desktopsettings.encoding;
3987
- d7showfocus.checked = desktopsettings.showfocus;
3988
- d7showcursor.checked = desktopsettings.showmouse;
3989
- d7bitmapquality.value = 40; // Default value
3990
- if (ops.indexOf(parseInt(desktopsettings.quality)) >= 0) { d7bitmapquality.value = desktopsettings.quality; }
3991
- d7bitmapscaling.value = desktopsettings.scaling;
3992
- if (desktopsettings.framerate) { d7framelimiter.value = desktopsettings.framerate; }
3993
- QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (desktop.state != 0) && (desktopsettings.showfocus));
3994
- }
3995
-
3996
- // Enter browser fullscreen
3997
- function enterBrowserFullscreen(elem) {
3998
- if (elem.requestFullscreen) { elem.requestFullscreen(); }
3999
- else if (elem.msRequestFullscreen) { elem.msRequestFullscreen(); }
4000
- else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); }
4001
- else if (elem.webkitRequestFullscreen) { elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); }
4002
- }
4003
-
4004
- // Exit browser fullscreen
4005
- function exitBrowserFullscreen() {
4006
- if (document.exitFullscreen) { document.exitFullscreen(); }
4007
- else if (document.msExitFullscreen) { document.msExitFullscreen(); }
4008
- else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); }
4009
- else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); }
4010
- }
4011
-
4012
- // Return true if the browser is fullscreen. This is a delayed method that will return true/false late. Not very useful.
4013
- function isBrowserFullscreen() {
4014
- if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { return false; } else { return true; }
4015
- }
4016
-
4017
- var fullscreen = false;
4018
- var browserfullscreen = false;
4019
- function deskToggleFull(e) {
4020
- fullscreen = !fullscreen;
4021
- QV('mastheadx', !fullscreen);
4022
- QV('masthead', !fullscreen);
4023
- QV('topbar', !fullscreen);
4024
- QV('p11deviceNameHeader', !fullscreen);
4025
- QV('footer', !fullscreen);
4026
- QV('column_l_bottomgap', !fullscreen);
4027
- QV('idx_deskFullBtn2', fullscreen);
4028
- QV('deskFullBtn', !fullscreen);
4029
- QV('page_leftbar', !fullscreen);
4030
- if (fullscreen) {
4031
- // If shift is pressed, enter browser full screen.
4032
- if (e.shiftKey == true) { enterBrowserFullscreen(Q('deskarea0')); browserfullscreen = true; }
4033
- QS('column_l').width = '930px';
4034
- QS('column_l').height = '';
4035
- QS('column_l')['margin-left'] = '';
4036
- QS('column_l')['overflow-y'] = '';
4037
- QS('container').position = '';
4038
- QS('page_content').position = '';
4039
- QV('MainMenuSpan', true);
4040
- QS('container').width = '100%';
4041
- QS('container')['border-right'] = '0';
4042
- QS('container')['border-left'] = '0';
4043
- QS('column_l').padding = '0';
4044
- QS('column_l').width = '100%';
4045
- QS('column_l')["max-height"] = '';
4046
- } else {
4047
- exitBrowserFullscreen();
4048
- browserfullscreen = false;
4049
- QS('container').width = '960px';
4050
- QS('container')['border-right'] = '1px solid #b7b7b7';
4051
- QS('container')['border-left'] = '1px solid #b7b7b7';
4052
- QS('column_l').padding = '0 15px';
4053
- QS('column_l').width = '930px';
4054
- toggleFullScreen();
4055
- }
4056
- deskAdjust();
4057
- deskAdjust();
4058
- updateDesktopButtons();
4059
- }
4060
-
4061
- function deskToggleFocus() {
4062
- desktop.m.focusmode = (desktop.m.focusmode + 64) % 192;
4063
- Q('deskFocusBtn').value = ['All Focus', 'Small Focus', 'Large Focus'][desktop.m.focusmode / 64];
4064
- }
4065
-
4066
- function deskAdjust() {
4067
- var x = (Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - (Q('deskarea1').clientHeight + Q('deskarea2').clientHeight + Q('Desk').clientHeight + Q('deskarea4').clientHeight + 2)) / 2;
4068
- if (fullscreen) {
4069
- document.documentElement.style.overflow = 'hidden';
4070
- QS('deskarea3x').height = null;
4071
- if (x < 0) {
4072
- var mh = (Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - (Q('deskarea1').clientHeight + Q('deskarea2').clientHeight + Q('deskarea4').clientHeight));
4073
- var mw = 9999;
4074
- if (desktop) { mw = (desktop.m.width / desktop.m.height) * mh; }
4075
- if (webRtcDesktop && webRtcDesktop.softdesktop) { mw = (webRtcDesktop.softdesktop.m.width / webRtcDesktop.softdesktop.m.height) * mh; }
4076
- QS('Desk')['max-height'] = mh + 'px';
4077
- QS('Desk')['max-width'] = mw + 'px';
4078
- x = 0;
4079
- } else {
4080
- QS('Desk')['max-height'] = null;
4081
- QS('Desk')['max-width'] = null;
4082
- }
4083
- QS('Desk')['margin-top'] = x + 'px';
4084
- QS('Desk')['margin-bottom'] = x + 'px';
4085
- } else {
4086
- var mw = 9999, mh = (Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - (webPageFullScreen?276:290));
4087
- if (desktop) { mw = (desktop.m.width / desktop.m.height) * mh; }
4088
- if (webRtcDesktop && webRtcDesktop.softdesktop) { mw = (webRtcDesktop.softdesktop.m.width / webRtcDesktop.softdesktop.m.height) * mh; }
4089
- document.documentElement.style.overflow = 'auto';
4090
- QS('Desk')['max-height'] = mh + 'px';
4091
- QS('Desk')['max-width'] = mw + 'px';
4092
- QS('Desk')['margin-top'] = '0';
4093
- QS('Desk')['margin-bottom'] = '0';
4094
- }
4095
- }
4096
-
4097
- function mdeskAdjust(mod, sw, sh, cv) {
4098
- if (!mod || !sw || !sh || !cv) return;
4099
-
4100
- // Check if we are in single desktop mode
4101
- if (cv.id == "Desk") { deskAdjust(); return; }
4102
-
4103
- // Figure out and adjust the size to fill the width of the div
4104
- var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex];
4105
- var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw);
4106
- xw = realw + Math.floor((tw - (xw * realw)) / xw);
4107
- vsize.y = vsize.y * (xw / vsize.x);
4108
- vsize.x = xw;
4109
- var mh = vsize.y, mw = vsize.x;
4110
- if (mod.State != 0) { mh = vsize.y; mw = (sw / sh) * vsize.y; }
4111
- QS(cv.id)['max-height'] = mh + 'px';
4112
- QS(cv.id)['max-width'] = mw + 'px';
4113
- QS(cv.id)['margin-top'] = '0';
4114
- QS(cv.id)['margin-bottom'] = '0';
4115
- }
4116
-
4117
- // Remote desktop special key combos for Windows
4118
- function deskSendKeys() {
4119
- if (xxdialogMode || desktop == null || desktop.State != 3) return;
4120
- var ks = Q('deskkeys').value;
4121
- if (ks == 0) { // WIN+Down arrow
4122
- if (desktop.contype == 2) {
4123
- desktop.m.sendkey([[0xffe7,1],[0xff54,1],[0xff54,0],[0xffe7,0]]); // Intel AMT: Meta-left down, Down arrow press, Down arrow release, Meta-left release
4124
- } else {
4125
- desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,0x5B]]); // Agent: L-Winkey press, Down arrow press, Down arrow release, L-Winkey release
4126
- }
4127
- } else if (ks == 1) { // WIN+Up arrow
4128
- if (desktop.contype == 2) {
4129
- desktop.m.sendkey([[0xffe7,1],[0xff52,1],[0xff52,0],[0xffe7,0]]); // Intel AMT: Meta-left down, Up arrow press, Up arrow release, Meta-left release
4130
- } else {
4131
- desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, Up arrow press, Up arrow release, L-Winkey release
4132
- }
4133
- } else if (ks == 2) { // WIN+L arrow
4134
- if (desktop.contype == 2) {
4135
- desktop.m.sendkey([[0xffe7,1],[0x6c,1],[0x6c,0],[0xffe7,0]]); // Intel AMT: Meta-left down, 'l' press, 'l' release, Meta-left release
4136
- } else {
4137
- desktop.sendCtrlMsg('{"action":"lock"}');
4138
- //desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,76],[desktop.m.KeyAction.UP,76],[desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, 'L' press, 'L' release, L-Winkey release
4139
- //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.EXDOWN, 0x5B);
4140
- //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.DOWN, 76);
4141
- //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.UP, 76);
4142
- //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.EXUP, 0x5B);
4143
- }
4144
- } else if (ks == 3) { // WIN+M arrow
4145
- if (desktop.contype == 2) {
4146
- desktop.m.sendkey([[0xffe7,1],[0x6d,1],[0x6d,0],[0xffe7,0]]); // Intel AMT: Meta-left down, 'm' press, 'm' release, Meta-left release
4147
- } else {
4148
- desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, 'M' press, 'M' release, L-Winkey release
4149
- }
4150
- } else if (ks == 4) { // Shift+WIN+M arrow
4151
- if (desktop.contype == 2) {
4152
- desktop.m.sendkey([[0xffe1,1],[0xffe7,1],[0x6d,1],[0x6d,0],[0xffe7,0],[0xffe1,0]]); // Intel AMT: Shift-left down, Meta-left down, 'm' press, 'm' release, Meta-left release, Shift-left release
4153
- } else {
4154
- desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,0x5B],[desktop.m.KeyAction.UP, 16]]); // MeshAgent: L-shift press, L-Winkey press, 'M' press, 'M' release, L-Winkey release, L-shift release
4155
- }
4156
- } else if (ks == 5) { // WIN
4157
- if (desktop.contype == 2) {
4158
- desktop.m.sendkey([[0xffe7,1],[0xffe7,0]]); // Intel AMT: Meta-left down, Meta-left release
4159
- } else {
4160
- desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B], [desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, L-Winkey release
4161
- }
4162
- } else if (ks == 6) { // WIN+R
4163
- if (desktop.contype == 2) {
4164
- desktop.m.sendkey([[0xffe7, 1], [0x72, 1], [0x72, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, 'l' press, 'l' release, Meta-left release
4165
- } else {
4166
- desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.DOWN, 82], [desktop.m.KeyAction.UP, 82], [desktop.m.KeyAction.EXUP, 0x5B]]); // MeshAgent: L-Winkey press, 'R' press, 'R' release, L-Winkey release
4167
- }
4168
- }
4169
- }
4170
-
4171
- // Send CTRL-ALT-DEL
4172
- function sendCAD() {
4173
- if (xxdialogMode || desktop == null || desktop.State != 3) return;
4174
- desktop.m.sendcad();
4175
- }
4176
-
4177
- // Show process dialogs
4178
- function toggleDeskTools() {
4179
- if (xxdialogMode) return;
4180
- if (QS('DeskTools').display == 'none') {
4181
- QV('DeskTools', true);
4182
- Q('DeskTools').nodeid = currentNode._id;
4183
- refreshDeskTools();
4184
- } else {
4185
- QV('DeskTools', false);
4186
- }
4187
- }
4188
-
4189
- // Refresh all of the desktop tool panels
4190
- function refreshDeskTools() {
4191
- QV('DeskToolsRefreshButton', false);
4192
- setTimeout(refreshDeskToolsEx, 500);
4193
- meshserver.send({ action: 'msg', type:'ps', nodeid: currentNode._id });
4194
- }
4195
- function refreshDeskToolsEx() { QV('DeskToolsRefreshButton', true); }
4196
- var deskTools = { sort: 1, msg: null };
4197
- function sortProcess(sort) { deskTools.sort = sort; showDeskToolsProcesses(deskTools.msg); }
4198
- function sortProcessPid(a, b) { if (a.p > b.p) return 1; if (a.p < b.p) return (-1); return 0; }
4199
- function sortProcessName(a, b) { if (a.d > b.d) return 1; if (a.d < b.d) return (-1); return 0; }
4200
- function showDeskToolsProcesses(message) {
4201
- deskTools.msg = message;
4202
- if (message == null) { QH('DeskToolsProcesses', ''); return; }
4203
- if (Q('DeskTools').nodeid != message.nodeid) return;
4204
- var p = [], processes = null;
4205
- try { processes = JSON.parse(message.value); } catch (e) { }
4206
- if (processes != null) {
4207
- for (var pid in processes) { p.push( { p:parseInt(pid), c:processes[pid].cmd, d:processes[pid].cmd.toLowerCase(), u: processes[pid].user } ); }
4208
- if (deskTools.sort == 0) { p.sort(sortProcessPid); } else if (deskTools.sort == 1) { p.sort(sortProcessName); }
4209
- var x = '';
4210
- for (var i in p) { if (p[i].p != 0) { x += '<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>' + p[i].p + '</div><a style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=stopProcess(' + p[i].p + ',"' + p[i].c + '")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>' + (p[i].u?p[i].u:'') + '</div><div>' + p[i].c + '</div></div>'; } }
4211
- QH('DeskToolsProcesses', x);
4212
- }
4213
- }
4214
-
4215
- // Toggle mouse and keyboard input
4216
- function toggleKvmControl() { putstore('DeskControl', (Q("DeskControl").checked?1:0)); }
4217
-
4218
- // Save the desktop image to file
4219
- function deskSaveImage() {
4220
- if (xxdialogMode || desktop == null || desktop.State != 3) return;
4221
- var d = new Date(), n = 'Desktop-' + currentNode.name + '-' + d.getFullYear() + "-" + ("0" + (d.getMonth() + 1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2) + "-" + ("0" + d.getHours()).slice(-2) + "-" + ("0" + d.getMinutes()).slice(-2);
4222
- Q("Desk")['toBlob'](function (blob) { saveAs(blob, n + ".jpg"); });
4223
- }
4224
-
4225
- function deskDisplayInfo(sender, info, selDisplay, selItem) {
4226
- var txt = Q('termdisplays').value;
4227
- if (info.length > 0) { var options = ''; for (var x in info) { options += '<option' + ((txt == info[x])?' selected':'') + '>' + info[x] + '</option>'; } QH('termdisplays', options); }
4228
- QV('termdisplays', info.length > 0);
4229
- }
4230
-
4231
- function deskGetDisplayNumbers(e) { desktop.m.GetDisplayNumbers(); }
4232
-
4233
- function deskSetDisplay(e) {
4234
- var display = 0, txt = Q('termdisplays').value;
4235
- if (txt == "All Displays") display = 65535; else display = parseInt(txt.substring(8));
4236
- desktop.m.SetDisplay(display);
4237
- }
4238
-
4239
- // Double click detection. This is important for MacOS.
4240
- var dblClickDetectArgs = { t:0, x:0, y:0 };
4241
- function dblClickDetect(e) {
4242
- if (e.buttons != 1) return;
4243
- var t = Date.now();
4244
- if (((t - dblClickDetectArgs.t) < 250) && (Math.abs(e.clientX - dblClickDetectArgs.x) < 2) && (Math.abs(e.clientY - dblClickDetectArgs.y) < 2)) {
4245
- if (!xxdialogMode && desktop != null && Q('DeskControl').checked) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousedblclick(e); desktop.m.sendKeepAlive(); } else { desktop.m.mousedblclick(e); } }
4246
- }
4247
- dblClickDetectArgs.t = t;
4248
- dblClickDetectArgs.x = e.clientX;
4249
- dblClickDetectArgs.y = e.clientY;
4250
- }
4251
-
4252
- function dmousedown(e) { if (!xxdialogMode && desktop != null && Q('DeskControl').checked) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousedown(e); desktop.m.sendKeepAlive(); } else { desktop.m.mousedown(e); } } dblClickDetect(e); }
4253
- function dmouseup(e) { if (!xxdialogMode && desktop != null && Q('DeskControl').checked) if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mouseup(e); desktop.m.sendKeepAlive(); } else { desktop.m.mouseup(e); } }
4254
- function dmousemove(e) { if (!xxdialogMode && desktop != null && Q('DeskControl').checked) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousemove(e); desktop.m.sendKeepAlive(); } else { desktop.m.mousemove(e); } } }
4255
- function dmousewheel(e) { if (!xxdialogMode && desktop != null && Q('DeskControl').checked) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousewheel(e); desktop.m.sendKeepAlive(); } else { if (desktop.m.mousewheel) { desktop.m.mousewheel(e); } } haltEvent(e); return true; } return false; }
4256
- function drotate(x) { if (!xxdialogMode && desktop != null) { desktop.m.setRotation(desktop.m.rotation + x); deskAdjust(); deskAdjust(); } }
4257
- function stopProcess(id, name) { setDialogMode(2, "Process Control", 3, stopProcessEx, 'Stop process #' + id + ' "' + name + '"?', id); }
4258
- function stopProcessEx(buttons, tag) { meshserver.send({ action: 'msg', type:'pskill', nodeid: currentNode._id, value: tag }); setTimeout(refreshDeskTools, 300); }
4259
-
4260
- //
4261
- // TERMINAL
4262
- //
4263
-
4264
- var terminalNode;
4265
- function setupTerminal() {
4266
- // Setup the terminal
4267
- if ((terminalNode != currentNode) && (terminal != null)) { terminal.Stop(); terminal = null; }
4268
- terminalNode = currentNode;
4269
- updateTerminalButtons();
4270
- }
4271
-
4272
- // Show and enable the right buttons
4273
- function updateTerminalButtons() {
4274
- var mesh = meshes[terminalNode.meshid];
4275
- var termState = ((terminal != null) && (terminal.state != 0));
4276
-
4277
- // Show the right buttons
4278
- QV('disconnectbutton2span', (termState == true));
4279
- QV('connectbutton2span', (termState == false) && (mesh.mtype == 2) && (currentNode.agent.caps & 2));
4280
- QV('connectbutton2hspan', (termState == false) && ((terminalNode.intelamt != null) && (mesh.mtype == 1 || terminalNode.intelamt.state == 2) && ((terminalNode.intelamt.ver != null) || (mesh.mtype == 1))));
4281
-
4282
- // Enable buttons
4283
- var online = ((terminalNode.conn & 1) != 0); // If Agent (1) connected, enable Terminal
4284
- QE('connectbutton2', online);
4285
- var hwonline = ((terminalNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal
4286
- QE('connectbutton2h', hwonline);
4287
-
4288
- // Key buttons
4289
- QE('ctrlcbutton', termState);
4290
- QE('ctrlxbutton', termState);
4291
- QE('escbutton', termState);
4292
- QE('bsbutton', termState);
4293
- QE('pastebutton', termState);
4294
- QE('specialkeylist', termState);
4295
- QE('specialkeylistinput', termState);
4296
-
4297
- // Terminal settings
4298
- QV('terminalSettingsButtons', (terminal) && (terminal.contype == 2));
4299
- if (terminal) {
4300
- Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation];
4301
- Q('id_tfxkeysbutton').value = fxEmulations[terminal.m.fxEmulation];
4302
- Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n')?'CR+LF':'LF';
4303
- }
4304
- }
4305
-
4306
- // Called when the terminal state changes
4307
- function onTerminalStateChange(xterminal, state) {
4308
- var xstate = state;
4309
- if ((xstate == 3) && (xterminal.contype == 2)) { xstate++; }
4310
- var str = StatusStrs[xstate];
4311
- if (terminal.webRtcActive == true) { str += ', WebRTC'; }
4312
- QH('termstatus', str);
4313
- switch (state) {
4314
- case 0:
4315
- // Disconnected, clear the terminal
4316
- xterminal.m.TermResetScreen();
4317
- xterminal.m.TermDraw();
4318
- if (terminal != null) {
4319
- terminal.Stop();
4320
- terminal = null;
4321
- }
4322
- break;
4323
- case 3:
4324
- break;
4325
- default:
4326
- //console.log('Unhandled onTerminalStateChange state', state);
4327
- break;
4328
- }
4329
- updateTerminalButtons();
4330
- }
4331
-
4332
- // DEBUG
4333
- var autoConnectTerminalTimer = null;
4334
- function autoConnectTerminal(e) { if (autoConnectTerminalTimer == null) { autoConnectTerminalTimer = setInterval(connectTerminal, 100); } else { clearInterval(autoConnectTerminalTimer); autoConnectTerminalTimer = null; } }
4335
-
4336
- function connectTerminal(e, contype) {
4337
- if (!terminal) {
4338
- if (contype == 2) {
4339
- // Setup the Intel AMT terminal
4340
- if ((terminalNode.intelamt.user == null) || (terminalNode.intelamt.user == '')) { editDeviceAmtSettings(terminalNode._id, connectTerminal); return; }
4341
- terminal = CreateAmtRedirect(CreateAmtRemoteTerminal('Term'));
4342
- terminal.debugmode = debugmode;
4343
- terminal.m.debugmode = debugmode;
4344
- terminal.onStateChanged = onTerminalStateChange;
4345
- terminal.Start(terminalNode._id, 16994, '*', '*', 0);
4346
- terminal.contype = 2;
4347
- Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation];
4348
- } else {
4349
- // Setup a mesh agent terminal
4350
- terminal = CreateAgentRedirect(meshserver, CreateAmtRemoteTerminal('Term'), serverPublicNamePort);
4351
- terminal.debugmode = debugmode;
4352
- terminal.m.debugmode = debugmode;
4353
- terminal.m.lineFeed = ([1,2,3,4,21,22].indexOf(currentNode.agent.id) >= 0)?'\r\n':'\n'; // On windows, send \r\n, on Linux only \n
4354
- terminal.attemptWebRTC = attemptWebRTC;
4355
- terminal.onStateChanged = onTerminalStateChange;
4356
- terminal.Start(terminalNode._id);
4357
- terminal.contype = 1;
4358
- terminal.m.terminalEmulation = 0;
4359
- terminal.m.fxEmulation = 0;
4360
- Q('id_ttypebutton').value = terminalEmulations[0];
4361
- }
4362
- } else {
4363
- //QH('Term', '');
4364
- terminal.Stop();
4365
- terminal = null;
4366
- }
4367
- Q('connectbutton2').blur(); // Deselect the connect button so the button does not get key presses.
4368
- }
4369
-
4370
- var terminalEmulations = ['UTF8 Terminal', 'Extended ASCII', 'Intel ASCII'];
4371
- function termToggleType() {
4372
- if (!terminal || xxdialogMode) return;
4373
- terminal.m.terminalEmulation = (terminal.m.terminalEmulation + 1) % 3;
4374
- Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation];
4375
- Q('id_ttypebutton').blur(); // Deselect the connect button so the button does not get key presses.
4376
- }
4377
-
4378
- var fxEmulations = ['Intel (F10 = ESC+[OM)', 'Alternate (F10 = ESC+0)', 'VT100+ (F10 = ESC+[OY)'];
4379
- function termToggleFx() {
4380
- if (!terminal || xxdialogMode) return;
4381
- terminal.m.fxEmulation = (terminal.m.fxEmulation + 1) % 3;
4382
- Q('id_tfxkeysbutton').value = fxEmulations[terminal.m.fxEmulation];
4383
- Q('id_tfxkeysbutton').blur(); // Deselect the connect button so the button does not get key presses.
4384
- }
4385
-
4386
- function termToggleCr() {
4387
- if (!terminal || xxdialogMode) return;
4388
- if (terminal.m.lineFeed == '\n') { terminal.m.lineFeed = '\r\n'; } else { terminal.m.lineFeed = '\n'; }
4389
- Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n') ? 'CR+LF' : 'LF';
4390
- }
4391
-
4392
- function termSendKey(key, id) {
4393
- if (!terminal || xxdialogMode) return;
4394
- terminal.m.TermSendKey(key);
4395
- Q(id).blur(); // Deselect the connect button so the button does not get key presses.
4396
- }
4397
-
4398
- function showTermPasteDialog() {
4399
- if (!terminal || xxdialogMode) return;
4400
- Q('pastebutton').blur();
4401
- setDialogMode(2, "Paste", 3, showTermPasteDialogEx, '<textarea id=d2pasteText style="width:100%;height:184px;resize:none"></textarea>');
4402
- Q('d2pasteText').focus();
4403
- }
4404
-
4405
- function showTermPasteDialogEx() {
4406
- if (!terminal) return;
4407
- terminal.m.TermSendKeys(Q('d2pasteText').value);
4408
- }
4409
-
4410
- // Send special key
4411
- function sendSpecialKey() {
4412
- terminal.m.TermSendKey(Q('specialkeylist').value);
4413
- Q('specialkeylist').blur();
4414
- Q('specialkeylistinput').blur();
4415
- }
4416
-
4417
- //
4418
- // FILES
4419
- //
4420
-
4421
- var filesNode;
4422
- function setupFiles() {
4423
- // Setup the files tab
4424
- var samenode = (filesNode == currentNode);
4425
- filesNode = currentNode;
4426
- var online = ((filesNode.conn & 1) != 0)?true:false; // If Agent (1) connected, enable Terminal
4427
- QE('p13Connect', online);
4428
- if (((samenode == false) || (online == false)) && files) { files.Stop(); files = null; }
4429
- }
4430
-
4431
- function onFilesStateChange(xfiles, state) {
4432
- p13Connect.value = (state == 0) ? 'Connect' : 'Disconnect';
4433
- var str = StatusStrs[state];
4434
- if (files.webRtcActive == true) { str += ', WebRTC'; }
4435
- Q('p13Status').textContent = str;
4436
- switch (state) {
4437
- case 0:
4438
- // Disconnected, clear the files
4439
- QH('p13files', '');
4440
- p13filetree = null;
4441
- p13filetreelocation = [];
4442
- QH('p13currentpath', '');
4443
- QE('p13FolderUp', false);
4444
- p13setActions();
4445
- if (files != null) { files.Stop(); files = null; }
4446
- break;
4447
- case 3:
4448
- p13targetpath = '';
4449
- files.sendText({ action: 'ls', reqid: 1, path: '' });
4450
- break;
4451
- default:
4452
- //console.log('Unknown onFilesStateChange state', state);
4453
- break;
4454
- }
4455
- }
4456
-
4457
- function CreateRemoteFiles(onFileUpdate) {
4458
- var obj = { protocol: 5 };
4459
- obj.onFileUpdate = onFileUpdate;
4460
- obj.xxStateChange = function(state) { }
4461
- obj.ProcessData = function(data) { obj.onFileUpdate(data); }
4462
- return obj;
4463
- }
4464
-
4465
- // Debug Only
4466
- var autoConnectFilesTimer = null;
4467
- function autoConnectFiles(e) { if (autoConnectFilesTimer == null) { autoConnectFilesTimer = setInterval(connectFiles, 100); } else { clearInterval(autoConnectFilesTimer); autoConnectFilesTimer = null; } }
4468
-
4469
- function connectFiles(e) {
4470
- if (!files) {
4471
- // Setup a mesh agent files
4472
- files = CreateAgentRedirect(meshserver, CreateRemoteFiles(p13gotFiles), serverPublicNamePort);
4473
- files.attemptWebRTC = attemptWebRTC;
4474
- files.onStateChanged = onFilesStateChange;
4475
- files.Start(filesNode._id);
4476
- } else {
4477
- //QH('Term', '');
4478
- files.Stop();
4479
- files = null;
4480
- }
4481
- p13clipboard = p13clipboardFolder = null;
4482
- p13clipboardCut = 0;
4483
- p13updateClipview();
4484
- }
4485
-
4486
- var p13filetree = null;
4487
- var p13targetpath = null;
4488
- var p13filetreelocation = [];
4489
-
4490
- function p13gotFiles(data) {
4491
- if ((data.length > 0) && (data.charCodeAt(0) != 123)) { p13gotDownloadBinaryData(data); return; }
4492
- //console.log('p13gotFiles', data);
4493
- data = JSON.parse(decode_utf8(data));
4494
- if (data.action == 'download') { p13gotDownloadCommand(data); return; }
4495
- data.path = data.path.replace(/\//g, "\\");
4496
- if ((p13filetree != null) && (data.path == p13filetree.path)) {
4497
- // This is an update to the same folder
4498
- var checkedNames = p13getCheckedNames();
4499
- p13filetree = data;
4500
- p13updateFiles(checkedNames);
4501
- } else {
4502
- // Make both paths use the same seperator not start with /
4503
- var x1 = data.path.replace(/\//g, "\\"), x2 = p13targetpath.replace(/\//g, "\\");
4504
- while ((x1.length > 0) && (x1[0] == '\\')) { x1 = x1.substring(1); }
4505
- while ((x2.length > 0) && (x2[0] == '\\')) { x2 = x2.substring(1); }
4506
- if ((x1 == x2) || ((data.path == '\\') && (p13targetpath == ''))) {
4507
- // This is a different folder
4508
- p13filetree = data;
4509
- p13updateFiles();
4510
- }
4511
- }
4512
- }
4513
-
4514
- function p13getCheckedNames() {
4515
- // Save all existing checked boxes
4516
- var checkedNames = [], checkboxes = document.getElementsByName('fd');
4517
- for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { checkedNames.push(p13filetree.dir[checkboxes[i].value].n) }; }
4518
- return checkedNames;
4519
- }
4520
-
4521
- function p13updateFiles(checkedNames) {
4522
- var html1 = '', html2 = '', displayPath = '<a style=cursor:pointer onclick=p13folderup(0)>Root</a>', fullPath = 'Root';
4523
-
4524
- // Work on parsing the file path
4525
- var x = p13filetree.path.split('\\');
4526
- p13filetreelocation = [];
4527
- for (var i in x) { if (x[i] != '') { p13filetreelocation.push(x[i]); } } // Remove empty spaces
4528
- for (var i in p13filetreelocation) { displayPath += ' / <a style=cursor:pointer onclick=p13folderup(' + (parseInt(i) + 1) + ')>' + p13filetreelocation[i] + '</a>' } // Setup the path we display
4529
- var newlinkpath = p13filetreelocation.join('/');
4530
-
4531
- // Sort the files
4532
- var filetreexx = p13sort_files(p13filetree.dir);
4533
-
4534
- // Display all files and folders at this location
4535
- for (var i in filetreexx) {
4536
- // Figure out the name and shortname
4537
- var f = filetreexx[i], name = f.n, shortname;
4538
- shortname = name;
4539
- if (name.length > 70) { shortname = '<span title="' + EscapeHtml(name) + '">' + EscapeHtml(name.substring(0, 70)) + "...</span>"; } else { shortname = EscapeHtml(name); }
4540
- name = EscapeHtml(name);
4541
-
4542
- // Figure out the date
4543
- var fdatestr = '';
4544
- if (f.d != null) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + "/" + (fdate.getDate()) + "/" + fdate.getFullYear() + " " + fdate.toLocaleTimeString() + " "; }
4545
-
4546
- // Figure out the size
4547
- var fsize = '';
4548
- if (f.s != null) { fsize = getFileSizeStr(f.s); }
4549
-
4550
- var h = '';
4551
- if (f.t < 3) {
4552
- var right = '', title = '';
4553
- h = "<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='" + f.nx + "'> <span style=float:right title=\"" + title + "\">" + right + "</span><span><div class=fileIcon" + f.t + "></div><a style=cursor:pointer onclick=p13folderset(\"" + encodeURIComponent(f.nx) + "\")>" + shortname + "</a></span></div>";
4554
- } else {
4555
- var link = shortname;
4556
- if (f.s > 0) { link = "<a rel=\"noreferrer noopener\" target=\"_blank\" style=cursor:pointer onclick=\"p13downloadfile('" + encodeURIComponent(newlinkpath + '/' + name) + "','" + encodeURIComponent(name) + "'," + f.s + ")\">" + shortname + "</a>"; }
4557
- h = "<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='" + f.nx + "'> <span class=fsize>" + fdatestr + "</span><span style=float:right>" + fsize + "</span><span><div class=fileIcon" + f.t + "></div>" + link + "</span></div>";
4558
- }
4559
-
4560
- if (f.t < 3) { html1 += h; } else { html2 += h; }
4561
- }
4562
-
4563
- // Display the files and path
4564
- QH('p13files', html1 + html2);
4565
- QH('p13currentpath', displayPath);
4566
- QE('p13FolderUp', p13filetreelocation.length != 0);
4567
-
4568
- // Re-check all boxes if needed using names
4569
- if (checkedNames != null) { var checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkedNames.indexOf(p13filetree.dir[checkboxes[i].value].n) >= 0) { checkboxes[i].checked = true; } } }
4570
-
4571
- // Update the actions buttons
4572
- p13setActions();
4573
- }
4574
-
4575
- function p13folderset(x) {
4576
- p13targetpath = joinPaths(p13filetree.path, p13filetree.dir[x].n).split('\\').join('/');
4577
- files.sendText({ action: 'ls', reqid: 1, path: p13targetpath });
4578
- }
4579
-
4580
- function p13folderup(x) {
4581
- if (x == null) { p13filetreelocation.pop(); } else { while (p13filetreelocation.length > x) { p13filetreelocation.pop(); } }
4582
- p13targetpath = p13filetreelocation.join('/');
4583
- files.sendText({ action: 'ls', reqid: 1, path: p13targetpath });
4584
- }
4585
-
4586
- var p13sortorder;
4587
- function p13sort_filename(a, b) { if (a.ln > b.ln) return (1 * p13sortorder); if (a.ln < b.ln) return (-1 * p13sortorder); return 0; }
4588
- function p13sort_timestamp(a, b) { if (a.d > b.d) return (1 * p13sortorder); if (a.d < b.d) return (-1 * p13sortorder); return 0; }
4589
- function p13sort_bysize(a, b) { if (a.s == b.s) return p13sort_filename(a, b); return (((a.s - b.s)) * p13sortorder); }
4590
-
4591
- function p13sort_files(files) {
4592
- var r = [], sortselection = Q('p13sortdropdown').value;
4593
- for (var i in files) { files[i].nx = i; if (files[i].s == null) { files[i].s = 0; } if (files[i].n == null) { files[i].n = i; } files[i].ln = files[i].n.toLowerCase(); r.push(files[i]); }
4594
- p13sortorder = 1;
4595
- if (sortselection > 3) { p13sortorder = -1; sortselection -= 3; }
4596
- if (sortselection == 1) { r.sort(p13sort_filename); }
4597
- else if (sortselection == 2) { r.sort(p13sort_bysize); }
4598
- else if (sortselection == 3) { r.sort(p13sort_timestamp); }
4599
- return r;
4600
- }
4601
-
4602
- function p13setActions() {
4603
- if (p13filetree == null) {
4604
- QE('p13DeleteFileButton', false);
4605
- QE('p13NewFolderButton', false);
4606
- QE('p13UploadButton', false);
4607
- QE('p13RenameFileButton', false);
4608
- QE('p13SelectAllButton', false);
4609
- Q('p13SelectAllButton').value = 'Select All';
4610
- QE('p13RefreshButton', false);
4611
- QE('p13CutButton', false);
4612
- QE('p13CopyButton', false);
4613
- QE('p13PasteButton', false);
4614
- } else {
4615
- var cc = p13getFileSelCount(), tc = p13getFileCount(), sfc = p13getFileSelCount(false); // In order: number of entires selected, number of total entries, number of selected entires that are files (not folders)
4616
- var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5));
4617
- QE('p13DeleteFileButton', (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
4618
- QE('p13NewFolderButton', ((p13filetreelocation.length > 0) || (winAgent == false)));
4619
- QE('p13UploadButton', ((p13filetreelocation.length > 0) || (winAgent == false)));
4620
- QE('p13RenameFileButton', (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false)));
4621
- QE('p13SelectAllButton', tc > 0);
4622
- Q('p13SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All');
4623
- QE('p13RefreshButton', true);
4624
- QE('p13CutButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
4625
- QE('p13CopyButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
4626
- QE('p13PasteButton', ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0)));
4627
- }
4628
- }
4629
-
4630
- function p13getFileSelCount(includeDirs) { var cc = 0; var checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == "3"))) cc++; } return cc; }
4631
- function p13getFileSelDirCount() { var cc = 0, checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == "999")) cc++; } return cc; }
4632
- function p13getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fd'); return checkboxes.length; }
4633
- function p13selectallfile() { var nv = (p13getFileSelCount() == 0), checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = nv; } p13setActions(); }
4634
- function p13createfolder() { setDialogMode(2, "New Folder", 3, p13createfolderEx, '<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />'); focusTextBox('p13renameinput'); p13fileNameCheck(); }
4635
- function p13createfolderEx() { files.sendText({ action: 'mkdir', reqid: 1, path: p13filetreelocation.join('/') + '/' + Q('p13renameinput').value }); p13folderup(999); }
4636
- function p13deletefile() { var cc = p13getFileSelCount(), rec = (p13getFileSelDirCount() > 0) ? "<br /><br /><input type=checkbox id=p13recdeleteinput>Recursive delete<br>" : "<input type=checkbox id=p13recdeleteinput style='display:none'>"; setDialogMode(2, "Delete", 3, p13deletefileEx, (cc > 1) ? ('Delete ' + cc + ' selected items?' + rec) : ('Delete selected item?' + rec)); }
4637
- function p13deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(p13filetree.dir[checkboxes[i].value].n); } } files.sendText({ action: 'rm', reqid: 1, path: p13filetreelocation.join('/'), delfiles: delfiles, rec: Q('p13recdeleteinput').checked }); p13folderup(999); }
4638
- function p13renamefile() { var renamefile, checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { renamefile = p13filetree.dir[checkboxes[i].value].n; } } setDialogMode(2, "Rename", 3, p13renamefileEx, '<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="' + renamefile + '" />', { action: 'rename', path: p13filetreelocation.join('/'), oldname: renamefile}); focusTextBox('p13renameinput'); p13fileNameCheck(); }
4639
- function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; files.sendText(t); p13folderup(999); }
4640
- function p13fileNameCheck(e) { var x = isFilenameValid(Q('p13renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e != null) && (e.keyCode == 13)) { dialogclose(1); } }
4641
- function p13uploadFile() { setDialogMode(2, "Upload File", 3, p13uploadFileEx, '<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p13uploadinput\')" />'); updateUploadDialogOk('p13uploadinput'); }
4642
- function p13uploadFileEx() { p13doUploadFiles(Q('p13uploadinput').files); }
4643
-
4644
- var p13clipboard = null, p13clipboardFolder = null, p13clipboardCut = 0;
4645
- function p13copyFile(cut) { var checkboxes = document.getElementsByName('fd'); p13clipboard = []; p13clipboardCut = cut, p13clipboardFolder = p13targetpath; for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == "3")) { p13clipboard.push(p13filetree.dir[checkboxes[i].value].n); } } p13updateClipview(); }
4646
- function p13pasteFile() { var x = ''; if ((p13clipboard != null) && (p13clipboard.length > 0)) { x = 'Confim ' + (p13clipboardCut == 0?'copy':'move') + ' of ' + p13clipboard.length + ' entrie' + ((p13clipboard.length > 1)?'s':'') + ' to this location?' } setDialogMode(2, "Paste", 3, p13pasteFileEx, x); }
4647
- function p13pasteFileEx() { files.sendText({ action: (p13clipboardCut == 0?'copy':'move'), reqid: 1, scpath: p13clipboardFolder, dspath: p13targetpath, names: p13clipboard }); p13folderup(999); if (p13clipboardCut == 1) { p13clipboard = null, p13clipboardFolder = null, p13clipboardCut = 0; p13updateClipview(); } }
4648
- function p13updateClipview() { var x = ''; if ((p13clipboard != null) && (p13clipboard.length > 0)) { x = 'Holding ' + p13clipboard.length + ' entrie' + ((p13clipboard.length > 1)?'s':'') + ' for ' + (p13clipboardCut == 0?'copy':'move') + ', <a onclick=p13clearClip() style=cursor:pointer>Clear</a>.' } QH('p13bottomstatus', x); p13setActions(); }
4649
- function p13clearClip() { p13clipboard = null; p13clipboardFolder = null; p13clipboardCut = 0; p13updateClipview(); }
4650
-
4651
- function p13fileDragDrop(e) {
4652
- haltEvent(e);
4653
- QV('p13bigfail', false);
4654
- QV('p13bigok', false);
4655
- if (e.dataTransfer == null || e.dataTransfer.files.length == 0 || p13filetree == null) return;
4656
- p13doUploadFiles(e.dataTransfer.files);
4657
- }
4658
-
4659
- var p13dragtimer = null;
4660
- function p13fileDragOver(e) {
4661
- haltEvent(e);
4662
- if (p13dragtimer != null) { clearTimeout(p13dragtimer); p13dragtimer = null; }
4663
- var ac = (p13filetree != null); // Set to true if we can accept the file
4664
- QV('p13bigok', ac);
4665
- QV('p13bigfail', !ac);
4666
- }
4667
-
4668
- function p13fileDragLeave(e) {
4669
- haltEvent(e);
4670
- if (e.target.id != "p13filetable") {
4671
- QV('p13bigfail', false);
4672
- QV('p13bigok', false);
4673
- } else {
4674
- p13dragtimer = setTimeout(function () { QV('p13bigfail',false); QV('p13bigok',false); p13dragtimer=null; }, 10);
4675
- }
4676
- }
4677
-
4678
- //
4679
- // FILES DOWNLOAD
4680
- //
4681
-
4682
- var downloadFile; // Global state for file download
4683
-
4684
- // Called by the html page to start a download, arguments are: path, file name and file size.
4685
- function p13downloadfile(x, y, z) {
4686
- if (xxdialogMode || downloadFile || !files) return;
4687
- downloadFile = { path: decodeURIComponent(x), file: decodeURIComponent(y), size: z, tsize: 0, data: '', state: 0, id: Math.random() }
4688
- //console.log('p13downloadFileCancel', downloadFile);
4689
- files.sendText({ action: 'download', sub: 'start', id: downloadFile.id, path: downloadFile.path });
4690
- setDialogMode(2, "Download File", 10, p13downloadFileCancel, '<div>' + downloadFile.file + '</div><br /><progress id=d2progressBar style=width:100% value=0 max=' + z + ' />');
4691
- }
4692
-
4693
- // Called by the html page to cancel the download
4694
- function p13downloadFileCancel() { setDialogMode(0); files.sendText({ action: 'download', sub: 'cancel', id: downloadFile.id }); downloadFile = null; }
4695
-
4696
- // Called by the transport when download control command is received
4697
- function p13gotDownloadCommand(cmd) {
4698
- //console.log('p13gotDownloadCommand', cmd);
4699
- if ((downloadFile == null) || (cmd.id != downloadFile.id)) return;
4700
- if (cmd.sub == 'start') { downloadFile.state = 1; files.sendText({ action: 'download', sub: 'startack', id: downloadFile.id }); }
4701
- else if (cmd.sub == 'cancel') { downloadFile = null; setDialogMode(0); }
4702
- }
4703
-
4704
- // Called by the transport when binary data is received
4705
- function p13gotDownloadBinaryData(data) {
4706
- if (!downloadFile || downloadFile.state == 0) return;
4707
- if (data.length > 4) {
4708
- downloadFile.tsize += (data.length - 4); // Add to the total bytes received
4709
- downloadFile.data += data.substring(4); // Append the data
4710
- Q('d2progressBar').value = downloadFile.tsize; // Change the progress bar
4711
- }
4712
- if ((ReadInt(data, 0) & 1) != 0) { // Check end flag
4713
- saveAs(data2blob(downloadFile.data), downloadFile.file); downloadFile = null; setDialogMode(0); // Save the file
4714
- } else {
4715
- files.sendText({ action: 'download', sub: 'ack', id: downloadFile.id }); // Send the ACK
4716
- }
4717
- }
4718
-
4719
- /*
4720
- var downloadFile; // Global state for file download
4721
-
4722
- // Called by the html page to start a download, arguments are: path, file name and file size.
4723
- function p13downloadfile(x, y, z) {
4724
- if (xxdialogMode) return;
4725
- downloadFile = CreateAgentRedirect(meshserver, CreateRemoteFiles(p13gotDownloadData), serverPublicNamePort); // Create our websocket file transport
4726
- downloadFile.ctrlMsgAllowed = false;
4727
- downloadFile.onStateChanged = onFileDownloadStateChange;
4728
- downloadFile.xpath = decodeURIComponent(x);
4729
- downloadFile.xfile = decodeURIComponent(y);
4730
- downloadFile.xsize = z;
4731
- downloadFile.xtsize = 0;
4732
- downloadFile.xstate = 0;
4733
- downloadFile.Start(filesNode._id);
4734
- setDialogMode(2, "Download File", 10, p13downloadFileCancel, '<div>' + downloadFile.xfile + '</div><br /><progress id=d2progressBar style=width:100% value=0 max=' + z + ' />');
4735
- }
4736
-
4737
- // Called by the html page to cancel the download
4738
- function p13downloadFileCancel(button, tag) {
4739
- //console.log('p13downloadFileCancel');
4740
- downloadFile.Stop();
4741
- delete downloadFile;
4742
- downloadFile = null;
4743
- }
4744
-
4745
- // Called by the file transport to indicate when the transport connection state has changed
4746
- function onFileDownloadStateChange(xdownloadFile, state) {
4747
- switch (state) {
4748
- case 0: // Transport as disconnected. If this is not part of an abort, we need to save the file
4749
- setDialogMode(0); // Close any dialog boxes if present
4750
- if ((downloadFile != null) && (downloadFile.xstate == 1)) { saveAs(data2blob(downloadFile.xdata), downloadFile.xfile); } // Save the file
4751
- break;
4752
- case 3: // Transport as connected, send a command to indicate we want to start a file download
4753
- downloadFile.send(JSON.stringify({ action: 'download', reqid: 1, path: downloadFile.xpath }));
4754
- break;
4755
- default:
4756
- console.log('Unknown onFileDownloadStateChange state', state);
4757
- break;
4758
- }
4759
- }
4760
-
4761
- // Called by the transport when data is received
4762
- function p13gotDownloadData(data) {
4763
- if (downloadFile.xstate == 0) { // If state is 0, this is a command confirming if the file will be transfered.
4764
- var cmd = JSON.parse(data);
4765
- if (cmd.action == 'downloadstart') { // Yes, the file is about to start
4766
- downloadFile.xstate = 1; // Switch to state 1, we will start receiving the file data
4767
- downloadFile.xdata = ''; // Start with empty data
4768
- downloadFile.send('a'); // Send the first ACK
4769
- } else if (cmd.action == 'downloaderror') { // Problem opening this file, cancel
4770
- p13downloadFileCancel();
4771
- }
4772
- } else { // We are in the process of receiving the file
4773
- downloadFile.xtsize += (data.length); // Add to the total bytes received
4774
- downloadFile.xdata += data; // Append the data
4775
- Q('d2progressBar').value = downloadFile.xtsize; // Change the progress bar
4776
- downloadFile.send('a'); // Send the ACK
4777
- }
4778
- }
4779
- */
4780
-
4781
- //
4782
- // FILES UPLOAD
4783
- //
4784
-
4785
- var uploadFile;
4786
- function p13doUploadFiles(files) {
4787
- if (xxdialogMode) return;
4788
- uploadFile = {};
4789
- uploadFile.xpath = p13filetreelocation.join('/');
4790
- uploadFile.xfiles = files;
4791
- uploadFile.xfilePtr = -1;
4792
- setDialogMode(2, "Upload File", 10, p13uploadFileCancel, '<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />');
4793
- p13uploadReconnect();
4794
- }
4795
-
4796
- function onFileUploadStateChange(xdownloadFile, state) {
4797
- switch (state) {
4798
- case 0:
4799
- p13folderup(9999);
4800
- break;
4801
- case 3:
4802
- p13uploadNextFile();
4803
- break;
4804
- default:
4805
- console.log('Unknown onFileUploadStateChange state', state);
4806
- break;
4807
- }
4808
- }
4809
-
4810
- // Connect again
4811
- function p13uploadReconnect() {
4812
- uploadFile.ws = CreateAgentRedirect(meshserver, CreateRemoteFiles(p13gotUploadData), serverPublicNamePort);
4813
- uploadFile.ws.attemptWebRTC = false;
4814
- uploadFile.ws.ctrlMsgAllowed = false;
4815
- uploadFile.ws.onStateChanged = onFileUploadStateChange;
4816
- uploadFile.ws.Start(filesNode._id);
4817
- }
4818
-
4819
- // Push the next file
4820
- function p13uploadNextFile() {
4821
- uploadFile.xfilePtr++;
4822
- if (uploadFile.xfiles.length > uploadFile.xfilePtr) {
4823
- uploadFile.xptr = 0;
4824
- var file = uploadFile.xfiles[uploadFile.xfilePtr];
4825
- QH('p13dfileName', file.name);
4826
- Q('d2progressBar').max = file.size;
4827
- Q('d2progressBar').value = 0;
4828
-
4829
- uploadFile.xreader = new FileReader();
4830
- uploadFile.xreader.onload = function() {
4831
- uploadFile.xdata = uploadFile.xreader.result;
4832
- uploadFile.ws.sendText(JSON.stringify({ action: 'upload', reqid: uploadFile.xfilePtr, path: uploadFile.xpath, name: file.name, size: uploadFile.xdata.byteLength }));
4833
- };
4834
- uploadFile.xreader.readAsArrayBuffer(file);
4835
- } else {
4836
- p13uploadFileCancel();
4837
- }
4838
- }
4839
-
4840
- // Used to cancel the entire transfer.
4841
- function p13uploadFileCancel(button, tag) {
4842
- if (uploadFile != null) {
4843
- if (uploadFile.ws != null) {
4844
- uploadFile.ws.Stop();
4845
- uploadFile.ws = null;
4846
- }
4847
- uploadFile = null;
4848
- }
4849
- setDialogMode(0); // Close any dialog boxes if present
4850
- }
4851
-
4852
- // Receive upload ack from the mesh agent, use this to keep sending more data
4853
- function p13gotUploadData(data) {
4854
- var cmd = JSON.parse(data);
4855
- if ((uploadFile == null) || (parseInt(uploadFile.xfilePtr) != parseInt(cmd.reqid))) { return; }
4856
-
4857
- if (cmd.action == 'uploadstart') {
4858
- p13uploadNextPart(false);
4859
- for (var i = 0; i < 8; i++) { p13uploadNextPart(true); } // Send 8 more blocks of 4 k to full the websocket.
4860
- } else if (cmd.action == 'uploadack') {
4861
- p13uploadNextPart(false);
4862
- } else if (cmd.action == 'uploaderror') {
4863
- p13uploadFileCancel();
4864
- }
4865
- }
4866
-
4867
- // Push the next part of the file into the websocket. If dataPriming is true, push more data only if it's not the last block of the file.
4868
- function p13uploadNextPart(dataPriming) {
4869
- var data = uploadFile.xdata;
4870
- var start = uploadFile.xptr;
4871
- var end = uploadFile.xptr + 4096;
4872
- if (end > data.byteLength) { if (dataPriming == true) { return; } end = data.byteLength; }
4873
- if (start == data.byteLength) {
4874
- if (uploadFile.ws != null) { uploadFile.ws.Stop(); uploadFile.ws = null; }
4875
- if (uploadFile.xfiles.length > uploadFile.xfilePtr + 1) { p13uploadReconnect(); } else { p13uploadFileCancel(); }
4876
- } else {
4877
- var datapart = data.slice(start, end);
4878
- uploadFile.ws.send(datapart);
4879
- uploadFile.xptr = end;
4880
- Q('d2progressBar').value = end;
4881
- }
4882
- }
4883
-
4884
- //
4885
- // DEVICE EVENTS
4886
- //
4887
-
4888
- var currentDeviceEvents = null;
4889
- function deviceEventsUpdate() {
4890
- var x = '', dateHeader = null;
4891
- for (var i in currentDeviceEvents) {
4892
- var event = currentDeviceEvents[i];
4893
- var time = new Date(event.time);
4894
- if (time.toLocaleDateString() != dateHeader) {
4895
- if (dateHeader != null) x += '</table>';
4896
- x += '<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt colspan=4>' + time.toLocaleDateString() + '</td></tr>';
4897
- dateHeader = time.toLocaleDateString();
4898
- }
4899
- var icon = 'si3';
4900
- if (event.etype == 'user') icon = 'm2';
4901
- if (event.etype == 'server') icon = 'si3';
4902
-
4903
- var msg = event.msg.split('(R)').join('®');
4904
- //if (event.username && event.username != userinfo.name) { msg += ': ' + event.username; }
4905
- x += '<tr><td style=width:18px><div class=' + icon + '></div></td><td class=g1 style=float:none> </td><td style=background-color:#C9C9C9>' + time.toLocaleTimeString() + ' - ' + msg + '</td><td class=g2 style=float:none> </td></tr><tr style=height:2px></tr>';
4906
- }
4907
- if (dateHeader != null) x += '</table>';
4908
- if (x == '') x = "<br><i>No Events Found</i><br><br>";
4909
- QH('p16events', x);
4910
- }
4911
-
4912
- /*
4913
- function showDeleteAllEventsDialog() {
4914
- if (xxdialogMode) return;
4915
- var x = "Delete all events in the server event log?<br /><br />";
4916
- x += "<input id=p3check type=checkbox onchange=validateDeleteAllEventsDialog() />Confirm";
4917
- setDialogMode(2, "Delete All Events", 3, showDeleteAllEventsDialogEx, x);
4918
- validateDeleteAllEventsDialog();
4919
- }
4920
-
4921
- function validateDeleteAllEventsDialog() {
4922
- QE('idx_dlgOkButton', Q('p3check').checked);
4923
- }
4924
-
4925
- function showDeleteAllEventsDialogEx(buttons, tag) {
4926
- meshserver.send({ action: 'clearevents' });
4927
- }
4928
- */
4929
-
4930
- function refreshDeviceEvents() {
4931
- //currentDeviceEvents = null;
4932
- //QH('p16events', '');
4933
- meshserver.send({ action: 'events', nodeid: currentNode._id, limit: parseInt(p16limitdropdown.value) });
4934
- }
4935
-
4936
- //
4937
- // CONSOLE
4938
- //
4939
-
4940
- function agentConsoleHandleKeys(e) {
4941
- var processed = 0, box = Q('p15consoleText');
4942
- if (e.key) {
4943
- if (e.keyCode == 13 && consoleFocus == 0) { p15consoleSend(e); processed = 1; }
4944
- else if (e.keyCode == 8 && consoleFocus == 0) { var x = box.value; box.value = x.substring(0, x.length - 1); processed = 1; }
4945
- else if (e.keyCode == 27) { box.value = ''; processed = 1; }
4946
- else if ((e.keyCode == 38) || (e.keyCode == 40)) { // Arrow up || Arrow down
4947
- var hindex = consoleHistory.indexOf(box.value);
4948
- //console.log(hindex, consoleHistory);
4949
- if ((e.keyCode == 38) && ((consoleHistory.length - 1) > hindex)) { box.value = consoleHistory[hindex + 1]; }
4950
- else if ((e.keyCode == 40) && (hindex > 0)) { box.value = consoleHistory[hindex - 1]; }
4951
- else if ((e.keyCode == 40) && (hindex == 0)) { box.value = ''; }
4952
- processed = 1;
4953
- }
4954
- else if (e.key.length === 1) {
4955
- //box.value = ((box.value + e.key));
4956
- insertTextAtCursor(box, e.key);
4957
- processed = 1;
4958
- }
4959
- } else {
4960
- if (e.charCode != 0 && consoleFocus == 0) { box.value = ((box.value + String.fromCharCode(e.charCode))); processed = 1; }
4961
- }
4962
- if (processed > 0) { return haltEvent(e); }
4963
- }
4964
-
4965
- // Insert text at the cursor location on the
4966
- function insertTextAtCursor(ctrl, val) {
4967
- if (document.selection) { ctrl.focus(); sel = document.selection.createRange(); sel.text = val; }
4968
- else if (ctrl.selectionStart || ctrl.selectionStart == '0') {
4969
- var start = ctrl.selectionStart, end = ctrl.selectionEnd;
4970
- ctrl.value = ctrl.value.substring(0, start) + val + ctrl.value.substring(end, ctrl.value.length);
4971
- ctrl.setSelectionRange(end + 1, end + 1);
4972
- } else { ctrl.value += myValue; }
4973
- }
4974
-
4975
- var consoleNode;
4976
- function setupConsole() {
4977
- // Setup the console
4978
- var samenode = (consoleNode == currentNode);
4979
- consoleNode = currentNode;
4980
-
4981
- var mesh = meshes[consoleNode.meshid];
4982
- var meshrights = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
4983
- if ((meshrights & 16) != 0) {
4984
- if (consoleNode.consoleText == null) { consoleNode.consoleText = ''; }
4985
- if (samenode == false) {
4986
- QH('p15agentConsoleText', consoleNode.consoleText);
4987
- Q('p15agentConsoleText').scrollTop = Q('p15agentConsoleText').scrollHeight;
4988
- }
4989
- var online = ((consoleNode.conn & 1) != 0)?true:false;
4990
- QH('p15statetext', online?"Agent is online":"Agent is offline");
4991
- QE('p15consoleText', online);
4992
- QE('p15uploadCore', online);
4993
- } else {
4994
- QH('p15statetext', 'Access Denied');
4995
- QE('p15consoleText', false);
4996
- QE('p15uploadCore', false);
4997
- }
4998
- }
4999
-
This file is too large to show in full.
views/default.handlebars
+10
-9
@@ -150,7 +150,7 @@
150
<div id=p0message style=margin:50px;text-align:center>Server disconnected, <href onclick=reload() style=cursor:pointer><u>click to reconnect</u></href>.</div>
151
</div>
152
<div id=p1 style=display:none>
153
- <div style="float:right" id="devListToolbarViewIcons">
153
+ <div style="float:right;display:none" id="devListToolbarViewIcons">
154
<div id=devViewButton1 class="viewSelector" onclick=onDeviceViewChange(1) title="Columns"><div class="viewSelector2"></div></div>
155
<div id=devViewButton2 class=viewSelector onclick=onDeviceViewChange(2) title="List"><div class="viewSelector1"></div></div>
156
<div id=devViewButton3 class=viewSelector onclick=onDeviceViewChange(3) title="Desktops"><div class="viewSelector3"></div></div>
@@ -159,19 +159,19 @@
159
<table style=width:100%;height:24px;background-color:#d3d9d6;vertical-align:middle;border-spacing:0>
160
<tr>
161
<td class=h1></td>
162
- <td id=devListToolbar class=style14>
162
+ <td id=devListToolbar class=style14 style=display:none>
163
<input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All" />
164
<input type=button id=GroupActionButton disabled="disabled" value="Group Action" onclick=groupActionFunction() />
165
<input id=SearchInput type=text style=width:120px placeholder=Filter onchange=masterUpdate(5) onkeyup=masterUpdate(5) autocomplete=off onfocus=onSearchFocus(1) onblur=onSearchFocus(0) />
166
<input type=checkbox id=RealNameCheckBox onclick=onRealNameCheckBox() /><span title="Show devices operating system name">OS Name</span>
167
</td>
168
- <td id=kvmListToolbar class=style14 style=height:100%>
168
+ <td id=kvmListToolbar class=style14 style=height:100%;display:none>
169
<input type="button" onclick="connectAllKvmFunction()" value="Connect All" />
170
<input type="button" onclick="disconnectAllKvmFunction()" value="Disconnect All" />
171
<input type="checkbox" id="autoConnectDesktopCheckbox" onclick="autoConnectDesktops(event)" title="Automatic connect" />Auto
172
<input type="button" onclick="showMultiDesktopSettings()" value="Settings" />
173
</td>
174
- <td id=devMapToolbar class=style14 style=height:100%>
174
+ <td id=devMapToolbar class=style14 style=height:100%;display:none>
175
<input type=text id=mapSearchLocation placeholder="Search Location" onfocus=onMapSearchFocus(1) onblur=onMapSearchFocus(0) />
176
<input type=button value=Search title="Search for location" onclick=getSearchLocation() />
177
<input type=button id=refreshmap title="Reset map view" value=Reset style=margin-left:5px onclick=refreshMap(false,true) />
@@ -186,7 +186,7 @@
186
<option id=viewselectmapoption value=4>Map</option>
187
</select>
188
</div>
189
- <div style=float:right id=devListToolbarSort>
189
+ <div style=float:right;display:none id=devListToolbarSort>
190
Sort
191
<select id=sortselect onchange=masterUpdate(6)>
192
<option>Group</option>
@@ -196,7 +196,7 @@
196
</select>
197
198
</div>
199
- <div style=float:right id=devListToolbarSize>
199
+ <div style=float:right;display:none id=devListToolbarSize>
200
Size
201
<select id=sizeselect onchange=onDeviceViewChange()>
202
<option value=0>Small</option>
@@ -221,8 +221,8 @@
221
</tr>
222
</table>
223
</div>
224
- <div id="xdevices" style="max-height:calc(100vh - 239px);overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch"></div>
225
- <div id="xdevicesmap" style="height:calc(100vh - 239px);width:100%;overflow:hidden;position:relative">
224
+ <div id="xdevices" style="max-height:calc(100vh - 239px);overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;display:none"></div>
225
+ <div id="xdevicesmap" style="height:calc(100vh - 239px);width:100%;overflow:hidden;position:relative;display:none">
226
<div id=xmapSearchResultsDlg style="position:absolute;display:none;max-height:280px;left:5px;top:5px;max-width:250px;z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666">
227
<div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0">
228
<div id=xmapSearchClose style=float:right;padding:5px;cursor:pointer onclick=mapCloseSearchWindow()><b>X</b></div>
@@ -1943,7 +1943,8 @@
1943
if (view == 3) {
1944
// Figure out and adjust the size to fill the width of the div
1945
var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex];
1946
- var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw);
1946
+ //var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw);
1947
+ var realw = vsize.x + 2, tw = totalDeviceViewWidth - 5, xw = Math.floor(tw / realw);
1948
xw = realw + Math.floor((tw - (xw * realw)) / xw);
1949
vsize.y = vsize.y * (xw / vsize.x);
1950
vsize.x = xw;
views/messenger-min.handlebars
+1
-1
@@ -402,7 +402,7 @@ function trademarks(x) { return x.replace(/\(R\)/g, '®').replace(/\(TM\)/g,
402
}
403
404
function haltEvent(e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
405
- function parseUriArgs() { var name, r = {}, parsedUri = window.document.location.href.split(/[\?&|\=]/); parsedUri.splice(0, 1); for (x in parsedUri) { switch (x % 2) { case 0: { name = parsedUri[x]; break; } case 1: { r[name] = parsedUri[x]; var x = parseInt(r[name]); if (x == r[name]) { r[name] = x; } break; } default: { break; } } } return r; }
405
+ function parseUriArgs() { var name, r = {}, parsedUri = window.document.location.href.split(/[\?&|\=]/); parsedUri.splice(0, 1); for (x in parsedUri) { switch (x % 2) { case 0: { name = decodeURIComponent(parsedUri[x]); break; } case 1: { r[name] = decodeURIComponent(parsedUri[x]); var x = parseInt(r[name]); if (x == r[name]) { r[name] = x; } break; } default: { break; } } } return r; }
406
407
// Update user controls
408
function updateControls() {
webserver.js
+31
-31
@@ -503,24 +503,24 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
503
if ((cookie != null) && (cookie.u != null) && (cookie.e != null)) {
504
var idsplit = cookie.u.split('/');
505
if ((idsplit.length != 2) || (idsplit[0] != domain.id)) {
506
- res.render(obj.path.join(__dirname, 'views/message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid domain. <a href="' + domain.url + '">Go to login page</a>.' });
506
+ res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid domain. <a href="' + domain.url + '">Go to login page</a>.' });
507
} else {
508
obj.db.Get('user/' + cookie.u, function (err, docs) {
509
if (docs.length == 0) {
510
- res.render(obj.path.join(__dirname, 'views/message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid username \"' + EscapeHtml(cookie.u) + '\". <a href="' + domain.url + '">Go to login page</a>.' });
510
+ res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid username \"' + EscapeHtml(cookie.u) + '\". <a href="' + domain.url + '">Go to login page</a>.' });
511
} else {
512
var user = docs[0];
513
if (user.email != cookie.e) {
514
- res.render(obj.path.join(__dirname, 'views/message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid e-mail \"' + EscapeHtml(user.email) + '\" for user \"' + EscapeHtml(user.name) + '\". <a href="' + domain.url + '">Go to login page</a>.' });
514
+ res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid e-mail \"' + EscapeHtml(user.email) + '\" for user \"' + EscapeHtml(user.name) + '\". <a href="' + domain.url + '">Go to login page</a>.' });
515
} else {
516
if (cookie.a == 1) {
517
// Account email verification
518
if (user.emailVerified == true) {
519
- res.render(obj.path.join(__dirname, 'views/message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'E-mail \"' + EscapeHtml(user.email) + '\" for user \"' + EscapeHtml(user.name) + '\" already verified. <a href="' + domain.url + '">Go to login page</a>.' });
519
+ res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'E-mail \"' + EscapeHtml(user.email) + '\" for user \"' + EscapeHtml(user.name) + '\" already verified. <a href="' + domain.url + '">Go to login page</a>.' });
520
} else {
521
obj.db.GetUserWithVerifiedEmail(domain.id, user.email, function (err, docs) {
522
if (docs.length > 0) {
523
- res.render(obj.path.join(__dirname, 'views/message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'E-mail \"' + EscapeHtml(user.email) + '\" already in use on a different account. Change the email address and try again. <a href="' + domain.url + '">Go to login page</a>.' });
523
+ res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'E-mail \"' + EscapeHtml(user.email) + '\" already in use on a different account. Change the email address and try again. <a href="' + domain.url + '">Go to login page</a>.' });
524
} else {
525
// Set the verified flag
526
obj.users[user._id].emailVerified = true;
@@ -540,7 +540,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
540
obj.parent.DispatchEvent(['*', 'server-users', user._id], obj, { etype: 'user', username: userinfo.name, account: userinfo, action: 'accountchange', msg: 'Verified email of user ' + EscapeHtml(user.name) + ' (' + EscapeHtml(userinfo.email) + ')', domain: domain.id });
541
542
// Send the confirmation page
543
- res.render(obj.path.join(__dirname, 'views/message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'Verified email <b>' + EscapeHtml(user.email) + '</b> for user account <b>' + EscapeHtml(user.name) + '</b>. <a href="' + domain.url + '">Go to login page</a>.' });
543
+ res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'Verified email <b>' + EscapeHtml(user.email) + '</b> for user account <b>' + EscapeHtml(user.name) + '</b>. <a href="' + domain.url + '">Go to login page</a>.' });
544
545
// Send a notification
546
obj.parent.DispatchEvent([user._id], obj, { action: 'notify', value: 'Email verified:<br /><b>' + EscapeHtml(userinfo.email) + '</b>.', nolog: 1 });
@@ -550,7 +550,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
550
} else if (cookie.a == 2) {
551
// Account reset
552
if (user.emailVerified != true) {
553
- res.render(obj.path.join(__dirname, 'views/message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'E-mail \"' + EscapeHtml(user.email) + '\" for user \"' + EscapeHtml(user.name) + '\" not verified. <a href="' + domain.url + '">Go to login page</a>.' });
553
+ res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'E-mail \"' + EscapeHtml(user.email) + '\" for user \"' + EscapeHtml(user.name) + '\" not verified. <a href="' + domain.url + '">Go to login page</a>.' });
554
} else {
555
// Set a temporary password
556
obj.crypto.randomBytes(16, function (err, buf) {
@@ -581,19 +581,19 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
581
obj.parent.DispatchEvent(['*', 'server-users', user._id], obj, { etype: 'user', username: userinfo.name, account: userinfo, action: 'accountchange', msg: 'Password reset for user ' + EscapeHtml(user.name), domain: domain.id });
582
583
// Send the new password
584
- res.render(obj.path.join(__dirname, 'views/message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: '<div>Password for account <b>' + EscapeHtml(user.name) + '</b> has been reset to:</div><div style=padding:14px;font-size:18px><b>' + EscapeHtml(newpass) + '</b></div>Login and go to the \"My Account\" tab to update your password. <a href="' + domain.url + '">Go to login page</a>.' });
584
+ res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: '<div>Password for account <b>' + EscapeHtml(user.name) + '</b> has been reset to:</div><div style=padding:14px;font-size:18px><b>' + EscapeHtml(newpass) + '</b></div>Login and go to the \"My Account\" tab to update your password. <a href="' + domain.url + '">Go to login page</a>.' });
585
});
586
});
587
}
588
} else {
589
- res.render(obj.path.join(__dirname, 'views/message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid account check. <a href="' + domain.url + '">Go to login page</a>.' });
589
+ res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid account check. <a href="' + domain.url + '">Go to login page</a>.' });
590
}
591
}
592
}
593
});
594
}
595
} else {
596
- res.render(obj.path.join(__dirname, 'views/message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid account check, verification url is only valid for 30 minutes. <a href="' + domain.url + '">Go to login page</a>.' });
596
+ res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid account check, verification url is only valid for 30 minutes. <a href="' + domain.url + '">Go to login page</a>.' });
597
}
598
}
599
}
@@ -804,14 +804,14 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
804
if (obj.args.minify && !req.query.nominify) {
805
// Try to server the minified version if we can.
806
try {
807
- res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/default-mobile-min' : 'views/default-min'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, passRequirements: passRequirements, webcerthash: Buffer.from(obj.webCertificateFullHashs[domain.id], 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'), footer: (domain.footer == null) ? '' : domain.footer });
807
+ res.render(obj.path.join(obj.parent.webViewsPath, isMobileBrowser(req) ? 'default-mobile-min' : 'default-min'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, passRequirements: passRequirements, webcerthash: Buffer.from(obj.webCertificateFullHashs[domain.id], 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'), footer: (domain.footer == null) ? '' : domain.footer });
808
} catch (ex) {
809
// In case of an exception, serve the non-minified version.
810
- res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/default-mobile' : 'views/default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, passRequirements: passRequirements, webcerthash: Buffer.from(obj.webCertificateFullHashs[domain.id], 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'), footer: (domain.footer == null) ? '' : domain.footer });
810
+ res.render(obj.path.join(obj.parent.webViewsPath, isMobileBrowser(req) ? 'default-mobile' : 'default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, passRequirements: passRequirements, webcerthash: Buffer.from(obj.webCertificateFullHashs[domain.id], 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'), footer: (domain.footer == null) ? '' : domain.footer });
811
}
812
} else {
813
// Serve non-minified version of web pages.
814
- res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/default-mobile' : 'views/default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, passRequirements: passRequirements, webcerthash: Buffer.from(obj.webCertificateFullHashs[domain.id], 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'), footer: (domain.footer == null) ? '' : domain.footer });
814
+ res.render(obj.path.join(obj.parent.webViewsPath, isMobileBrowser(req) ? 'default-mobile' : 'default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, passRequirements: passRequirements, webcerthash: Buffer.from(obj.webCertificateFullHashs[domain.id], 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'), footer: (domain.footer == null) ? '' : domain.footer });
815
}
816
} else {
817
// Send back the login application
@@ -824,19 +824,19 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
824
if (obj.args.minify && !req.query.nominify) {
825
// Try to server the minified version if we can.
826
try {
827
- res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/login-mobile-min' : 'views/login-min'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: obj.getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, sessiontime: args.sessiontime, passRequirements: passRequirements, footer: (domain.footer == null) ? '' : domain.footer });
827
+ res.render(obj.path.join(obj.parent.webViewsPath, isMobileBrowser(req) ? 'login-mobile-min' : 'login-min'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: obj.getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, sessiontime: args.sessiontime, passRequirements: passRequirements, footer: (domain.footer == null) ? '' : domain.footer });
828
} catch (ex) {
829
// In case of an exception, serve the non-minified version.
830
- res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/login-mobile' : 'views/login'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: obj.getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, sessiontime: args.sessiontime, passRequirements: passRequirements, footer: (domain.footer == null) ? '' : domain.footer });
830
+ res.render(obj.path.join(obj.parent.webViewsPath, isMobileBrowser(req) ? 'login-mobile' : 'login'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: obj.getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, sessiontime: args.sessiontime, passRequirements: passRequirements, footer: (domain.footer == null) ? '' : domain.footer });
831
}
832
} else {
833
// Serve non-minified version of web pages.
834
- res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/login-mobile' : 'views/login'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: obj.getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, sessiontime: args.sessiontime, passRequirements: passRequirements, footer: (domain.footer == null) ? '' : domain.footer });
834
+ res.render(obj.path.join(obj.parent.webViewsPath, isMobileBrowser(req) ? 'login-mobile' : 'login'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: obj.getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, sessiontime: args.sessiontime, passRequirements: passRequirements, footer: (domain.footer == null) ? '' : domain.footer });
835
}
836
837
/*
838
var xoptions = { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: obj.getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, footer: (domain.footer == null) ? '' : domain.footer };
839
- var xpath = obj.path.join(__dirname, isMobileBrowser(req) ? 'views/login-mobile' : 'views/login');
839
+ var xpath = obj.path.join(obj.parent.webViewsPath, isMobileBrowser(req) ? 'login-mobile' : 'login');
840
console.log('Render...');
841
res.render(xpath, xoptions, function (err, html) {
842
console.log(err, html);
@@ -868,9 +868,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
868
if (req.session && req.session.userid) {
869
if (req.session.domainid != domain.id) { req.session = null; res.redirect(domain.url); return; } // Check is the session is for the correct domain
870
var user = obj.users[req.session.userid];
871
- res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/terms-mobile' : 'views/terms'), { title: domain.title, title2: domain.title2, terms: encodeURIComponent(data), logoutControl: 'Welcome ' + user.name + '. <a href=' + domain.url + 'logout?' + Math.random() + ' style=color:white>Logout</a>' });
871
+ res.render(obj.path.join(obj.parent.webViewsPath, isMobileBrowser(req) ? 'terms-mobile' : 'terms'), { title: domain.title, title2: domain.title2, terms: encodeURIComponent(data), logoutControl: 'Welcome ' + user.name + '. <a href=' + domain.url + 'logout?' + Math.random() + ' style=color:white>Logout</a>' });
872
} else {
873
- res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/terms-mobile' : 'views/terms'), { title: domain.title, title2: domain.title2, terms: encodeURIComponent(data) });
873
+ res.render(obj.path.join(obj.parent.webViewsPath, isMobileBrowser(req) ? 'terms-mobile' : 'terms'), { title: domain.title, title2: domain.title2, terms: encodeURIComponent(data) });
874
}
875
});
876
} else {
@@ -879,9 +879,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
879
if (req.session && req.session.userid) {
880
if (req.session.domainid != domain.id) { req.session = null; res.redirect(domain.url); return; } // Check is the session is for the correct domain
881
var user = obj.users[req.session.userid];
882
- res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/terms-mobile' : 'views/terms'), { title: domain.title, title2: domain.title2, logoutControl: 'Welcome ' + user.name + '. <a href=' + domain.url + 'logout?' + Math.random() + ' style=color:white>Logout</a>' });
882
+ res.render(obj.path.join(obj.parent.webViewsPath, isMobileBrowser(req) ? 'terms-mobile' : 'terms'), { title: domain.title, title2: domain.title2, logoutControl: 'Welcome ' + user.name + '. <a href=' + domain.url + 'logout?' + Math.random() + ' style=color:white>Logout</a>' });
883
} else {
884
- res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/terms-mobile' : 'views/terms'), { title: domain.title, title2: domain.title2 });
884
+ res.render(obj.path.join(obj.parent.webViewsPath, isMobileBrowser(req) ? 'terms-mobile' : 'terms'), { title: domain.title, title2: domain.title2 });
885
}
886
}
887
}
@@ -891,7 +891,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
891
var webRtcConfig = null;
892
if (obj.parent.config.settings && obj.parent.config.settings.webrtconfig && (typeof obj.parent.config.settings.webrtconfig == 'object')) { webRtcConfig = encodeURIComponent(JSON.stringify(obj.parent.config.settings.webrtconfig)); }
893
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0' });
894
- res.render(obj.path.join(__dirname, 'views/messenger'), { webrtconfig: webRtcConfig });
894
+ res.render(obj.path.join(obj.parent.webViewsPath, 'messenger'), { webrtconfig: webRtcConfig });
895
}
896
897
// Returns the server root certificate encoded in base64
@@ -924,7 +924,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
924
925
if ((serverNameSplit.length == 4) && (parseInt(serverNameSplit[0]) == serverNameSplit[0]) && (parseInt(serverNameSplit[1]) == serverNameSplit[1]) && (parseInt(serverNameSplit[2]) == serverNameSplit[2]) && (parseInt(serverNameSplit[3]) == serverNameSplit[3])) {
926
// Server name is an IPv4 address
927
- obj.fs.readFile(obj.parent.path.join(__dirname, 'public/scripts/cira_setup_script_ip.mescript'), 'utf8', function (err, data) {
927
+ obj.fs.readFile(obj.parent.path.join(obj.parent.webPublicPath, 'scripts/cira_setup_script_ip.mescript'), 'utf8', function (err, data) {
928
if (err != null) { res.sendStatus(404); return; }
929
var scriptFile = JSON.parse(data);
930
@@ -950,7 +950,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
950
});
951
} else {
952
// Server name is a hostname
953
- obj.fs.readFile(obj.parent.path.join(__dirname, 'public/scripts/cira_setup_script_dns.mescript'), 'utf8', function (err, data) {
953
+ obj.fs.readFile(obj.parent.path.join(obj.parent.webPublicPath, 'scripts/cira_setup_script_dns.mescript'), 'utf8', function (err, data) {
954
if (err != null) { res.sendStatus(404); return; }
955
var scriptFile = JSON.parse(data);
956
@@ -978,7 +978,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
978
else if (req.query.type == 2) {
979
var filename = 'cira_cleanup.mescript';
980
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename=' + filename });
981
- obj.fs.readFile(obj.parent.path.join(__dirname, 'public/scripts/cira_cleanup.mescript'), 'utf8', function (err, data) {
981
+ obj.fs.readFile(obj.parent.path.join(obj.parent.webPublicPath, 'scripts/cira_cleanup.mescript'), 'utf8', function (err, data) {
982
if (err != null) { res.sendStatus(404); return; }
983
res.send(Buffer.from(data));
984
});
@@ -1003,10 +1003,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1003
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename=\"' + filename + '\"' });
1004
try { res.sendFile(obj.path.resolve(__dirname, path)); } catch (e) { res.sendStatus(404); }
1005
} else {
1006
- res.render(obj.path.join(__dirname, 'views/download'), { rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, message: "<a href='" + req.path + "?download=1'>" + filename + "</a>, " + stat.size + " byte" + ((stat.size < 2) ? '' : 's') + "." });
1006
+ res.render(obj.path.join(obj.parent.webViewsPath, 'download'), { rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, message: "<a href='" + req.path + "?download=1'>" + filename + "</a>, " + stat.size + " byte" + ((stat.size < 2) ? '' : 's') + "." });
1007
}
1008
} else {
1009
- res.render(obj.path.join(__dirname, 'views/download'), { rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, message: "Invalid file link, please check the URL again." });
1009
+ res.render(obj.path.join(obj.parent.webViewsPath, 'download'), { rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, message: "Invalid file link, please check the URL again." });
1010
}
1011
}
1012
@@ -1017,10 +1017,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1017
res.set({ 'Cache-Control': 'max-age=86400' }); // 1 day
1018
if ((domain != null) && domain.titlepicture) {
1019
try { res.sendFile(obj.path.join(obj.parent.datapath, domain.titlepicture)); } catch (e) {
1020
- try { res.sendFile(obj.path.join(__dirname, 'public/images/logoback.png')); } catch (e) { res.sendStatus(404); }
1020
+ try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/logoback.png')); } catch (e) { res.sendStatus(404); }
1021
}
1022
} else {
1023
- try { res.sendFile(obj.path.join(__dirname, 'public/images/logoback.png')); } catch (e) { res.sendStatus(404); }
1023
+ try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/logoback.png')); } catch (e) { res.sendStatus(404); }
1024
}
1025
}
1026
@@ -1964,7 +1964,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1964
try { res.sendFile(p); } catch (e) { res.sendStatus(404); }
1965
} else {
1966
// Use the default server picture
1967
- try { res.sendFile(obj.path.join(__dirname, 'public/images/server-200.jpg')); } catch (e) { res.sendStatus(404); }
1967
+ try { res.sendFile(obj.path.join(obj.parent.webPublicPath, 'images/server-200.jpg')); } catch (e) { res.sendStatus(404); }
1968
}
1969
});
1970
@@ -2005,7 +2005,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
2005
obj.app.get(url + 'stop', function (req, res) { res.send('Stopping Server, <a href="' + url + '">click here to login</a>.'); setTimeout(function () { parent.Stop(); }, 500); });
2006
2007
// Indicates to ExpressJS that the public folder should be used to serve static files.
2008
- obj.app.use(url, obj.express.static(obj.path.join(__dirname, 'public')));
2008
+ obj.app.use(url, obj.express.static(obj.parent.webPublicPath));
2009
2010
// Start regular disconnection list flush every 2 minutes.
2011
obj.wsagentsDisconnectionsTimer = setInterval(function () { obj.wsagentsDisconnections = {}; }, 120000);