Added Czech, MpsAliasHost.
Ylian Saint-Hilaire committed
Dec 1, 2019 at 12:52 UTC
2c6528e847defdac1421d6d5368afd04e2fdb6f4
29 files changed
+25995
-738
agents/meshcore.min.js
+3
-1
@@ -1211,7 +1211,6 @@ function createMeshCore(agent) {
1211
return;
1212
}
1213
1214
-
1214
// Remote desktop using native pipes
1215
this.httprequest.desktop = { state: 0, kvm: mesh.getRemoteDesktopStream(), tunnel: this };
1216
this.httprequest.desktop.kvm.parent = this.httprequest.desktop;
@@ -1231,6 +1230,9 @@ function createMeshCore(agent) {
1230
this.httprequest.desktop.kvm.unpipe(this.rtcchannel);
1231
}
1232
1233
+ // Place wallpaper back if needed
1234
+ // TODO
1235
+
1236
if (this.desktop.kvm.connectionCount == 0)
1237
{
1238
// Display a toast message. This may not be supported on all platforms.
certoperations.js
+113
-113
@@ -18,9 +18,9 @@ module.exports.CertificateOperations = function (parent) {
18
var obj = {};
19
20
obj.parent = parent;
21
- obj.fs = require("fs");
22
- obj.forge = require("node-forge");
23
- obj.crypto = require("crypto");
21
+ obj.fs = require('fs');
22
+ obj.forge = require('node-forge');
23
+ obj.crypto = require('crypto');
24
obj.tls = require('tls');
25
obj.pki = obj.forge.pki;
26
obj.dirExists = function (filePath) { try { return obj.fs.statSync(filePath).isDirectory(); } catch (err) { return false; } };
@@ -47,7 +47,7 @@ module.exports.CertificateOperations = function (parent) {
47
if (signkey == null) return { 'action': 'acmactivate', 'error': 2, 'errorText': 'No signing certificate found' }; // Did not find a match.
48
49
// If the matching certificate is a root cert, issue a leaf cert that matches the fqdn
50
- if (domain.amtacmactivation.certs[certIndex].cn == '*') return { 'action': 'acmactivate', 'error': 3, 'errorText': 'Unsupported activation' }; // TODO: Add support for this mode
50
+ if (domain.amtacmactivation.certs[certIndex].cn == '*') return { 'action': 'acmactivate', 'error': 3, 'errorText': "Unsupported activation" }; // TODO: Add support for this mode
51
52
// Setup both nonces, ready to be signed
53
const mcNonce = Buffer.from(obj.crypto.randomBytes(20), 'binary');
@@ -59,7 +59,7 @@ module.exports.CertificateOperations = function (parent) {
59
var signer = obj.crypto.createSign(hashAlgo);
60
signer.update(Buffer.concat([fwNonce, mcNonce]));
61
signature = signer.sign(signkey, 'base64');
62
- } catch (ex) { return { 'action': 'acmactivate', 'error': 4, 'errorText': 'Unable to perform signature' }; }
62
+ } catch (ex) { return { 'action': 'acmactivate', 'error': 4, 'errorText': "Unable to perform signature" }; }
63
64
// Log the activation request, logging is a required step for activation.
65
if (obj.logAmtActivation(domain, { time: new Date(), action: 'acmactivate', domain: domain.id, amtUuid: request.uuid, certHash: request.hash, hashType: hashAlgo, amtRealm: request.realm, amtFqdn: request.fqdn, user: user, password: pass, ipport: ipport, nodeid: nodeid, meshid: meshid, computerName: computerName, agentId: agentId, tag: request.tag, name: request.name }) == false) return { 'action': 'acmactivate', 'error': 5, 'errorText': 'Unable to log operation' };
@@ -240,7 +240,7 @@ module.exports.CertificateOperations = function (parent) {
240
// Return the SHA384 hash of the certificate public key
241
obj.getPublicKeyHash = function (cert) {
242
var publickey = obj.pki.certificateFromPem(cert).publicKey;
243
- return obj.pki.getPublicKeyFingerprint(publickey, { encoding: "hex", md: obj.forge.md.sha384.create() });
243
+ return obj.pki.getPublicKeyFingerprint(publickey, { encoding: 'hex', md: obj.forge.md.sha384.create() });
244
};
245
246
// Return the SHA384 hash of the certificate, return hex
@@ -254,7 +254,7 @@ module.exports.CertificateOperations = function (parent) {
254
var x1 = cert.indexOf('-----BEGIN CERTIFICATE-----'), x2 = cert.indexOf('-----END CERTIFICATE-----');
255
if ((x1 >= 0) && (x2 > x1)) {
256
return obj.crypto.createHash('sha1').update(Buffer.from(cert.substring(x1 + 27, x2), 'base64')).digest('hex');
257
- } else { console.log('ERROR: Unable to decode certificate.'); return null; }
257
+ } else { console.log("ERROR: Unable to decode certificate."); return null; }
258
}
259
};
260
@@ -269,14 +269,14 @@ module.exports.CertificateOperations = function (parent) {
269
var x1 = cert.indexOf('-----BEGIN CERTIFICATE-----'), x2 = cert.indexOf('-----END CERTIFICATE-----');
270
if ((x1 >= 0) && (x2 > x1)) {
271
return obj.crypto.createHash('sha384').update(Buffer.from(cert.substring(x1 + 27, x2), 'base64')).digest('hex');
272
- } else { console.log('ERROR: Unable to decode certificate.'); return null; }
272
+ } else { console.log("ERROR: Unable to decode certificate."); return null; }
273
}
274
};
275
276
// Return the SHA384 hash of the certificate public key
277
obj.getPublicKeyHashBinary = function (cert) {
278
var publickey = obj.pki.certificateFromPem(cert).publicKey;
279
- return obj.pki.getPublicKeyFingerprint(publickey, { encoding: "binary", md: obj.forge.md.sha384.create() });
279
+ return obj.pki.getPublicKeyFingerprint(publickey, { encoding: 'binary', md: obj.forge.md.sha384.create() });
280
};
281
282
// Return the SHA384 hash of the certificate, return binary
@@ -291,7 +291,7 @@ module.exports.CertificateOperations = function (parent) {
291
var x1 = cert.indexOf('-----BEGIN CERTIFICATE-----'), x2 = cert.indexOf('-----END CERTIFICATE-----');
292
if ((x1 >= 0) && (x2 > x1)) {
293
return obj.crypto.createHash('sha384').update(Buffer.from(cert.substring(x1 + 27, x2), 'base64')).digest('binary');
294
- } else { console.log('ERROR: Unable to decode certificate.'); return null; }
294
+ } else { console.log("ERROR: Unable to decode certificate."); return null; }
295
}
296
};
297
@@ -305,15 +305,15 @@ module.exports.CertificateOperations = function (parent) {
305
cert.validity.notBefore.setFullYear(cert.validity.notBefore.getFullYear() - 1); // Create a certificate that is valid one year before, to make sure out-of-sync clocks don"t reject this cert.
306
cert.validity.notAfter = new Date();
307
cert.validity.notAfter.setFullYear(cert.validity.notAfter.getFullYear() + 30);
308
- if (addThumbPrintToName === true) { commonName += "-" + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: "hex" }).substring(0, 6); }
308
+ if (addThumbPrintToName === true) { commonName += '-' + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: 'hex' }).substring(0, 6); }
309
if (country == null) { country = "unknown"; }
310
if (organization == null) { organization = "unknown"; }
311
- var attrs = [{ name: "commonName", value: commonName }, { name: "organizationName", value: organization }, { name: "countryName", value: country }];
311
+ var attrs = [{ name: 'commonName', value: commonName }, { name: 'organizationName', value: organization }, { name: 'countryName', value: country }];
312
cert.setSubject(attrs);
313
cert.setIssuer(attrs);
314
// Create a root certificate
315
- //cert.setExtensions([{ name: "basicConstraints", cA: true }, { name: "nsCertType", sslCA: true, emailCA: true, objCA: true }, { name: "subjectKeyIdentifier" }]);
316
- cert.setExtensions([{ name: "basicConstraints", cA: true }, { name: "subjectKeyIdentifier" }, { name: "keyUsage", keyCertSign: true }]);
315
+ //cert.setExtensions([{ name: 'basicConstraints', cA: true }, { name: 'nsCertType', sslCA: true, emailCA: true, objCA: true }, { name: 'subjectKeyIdentifier' }]);
316
+ cert.setExtensions([{ name: 'basicConstraints', cA: true }, { name: 'subjectKeyIdentifier' }, { name: 'keyUsage', keyCertSign: true }]);
317
cert.sign(keys.privateKey, obj.forge.md.sha384.create());
318
319
return { cert: cert, key: keys.privateKey };
@@ -329,16 +329,16 @@ module.exports.CertificateOperations = function (parent) {
329
cert.validity.notBefore.setFullYear(cert.validity.notAfter.getFullYear() - 1); // Create a certificate that is valid one year before, to make sure out-of-sync clocks don"t reject this cert.
330
cert.validity.notAfter = new Date();
331
cert.validity.notAfter.setFullYear(cert.validity.notAfter.getFullYear() + 30);
332
- if (addThumbPrintToName === true) { commonName += "-" + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: "hex" }).substring(0, 6); }
333
- var attrs = [{ name: "commonName", value: commonName }];
334
- if (country != null) { attrs.push({ name: "countryName", value: country }); }
335
- if (organization != null) { attrs.push({ name: "organizationName", value: organization }); }
332
+ if (addThumbPrintToName === true) { commonName += "-" + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: 'hex' }).substring(0, 6); }
333
+ var attrs = [{ name: 'commonName', value: commonName }];
334
+ if (country != null) { attrs.push({ name: 'countryName', value: country }); }
335
+ if (organization != null) { attrs.push({ name: 'organizationName', value: organization }); }
336
cert.setSubject(attrs);
337
cert.setIssuer(rootcert.cert.subject.attributes);
338
339
- if (extKeyUsage == null) { extKeyUsage = { name: "extKeyUsage", serverAuth: true }; } else { extKeyUsage.name = "extKeyUsage"; }
340
- //var extensions = [{ name: "basicConstraints", cA: false }, { name: "keyUsage", keyCertSign: true, digitalSignature: true, nonRepudiation: true, keyEncipherment: true, dataEncipherment: true }, extKeyUsage, { name: "nsCertType", client: false, server: true, email: false, objsign: false, sslCA: false, emailCA: false, objCA: false }, { name: "subjectKeyIdentifier" }];
341
- var extensions = [{ name: "basicConstraints", cA: false }, { name: "keyUsage", keyCertSign: false, digitalSignature: true, nonRepudiation: false, keyEncipherment: true, dataEncipherment: (extKeyUsage.serverAuth !== true) }, extKeyUsage, { name: "subjectKeyIdentifier" }];
339
+ if (extKeyUsage == null) { extKeyUsage = { name: 'extKeyUsage', serverAuth: true }; } else { extKeyUsage.name = 'extKeyUsage'; }
340
+ //var extensions = [{ name: 'basicConstraints', cA: false }, { name: 'keyUsage', keyCertSign: true, digitalSignature: true, nonRepudiation: true, keyEncipherment: true, dataEncipherment: true }, extKeyUsage, { name: "nsCertType", client: false, server: true, email: false, objsign: false, sslCA: false, emailCA: false, objCA: false }, { name: "subjectKeyIdentifier" }];
341
+ var extensions = [{ name: 'basicConstraints', cA: false }, { name: 'keyUsage', keyCertSign: false, digitalSignature: true, nonRepudiation: false, keyEncipherment: true, dataEncipherment: (extKeyUsage.serverAuth !== true) }, extKeyUsage, { name: "subjectKeyIdentifier" }];
342
343
if (extKeyUsage.serverAuth === true) {
344
// Set subjectAltName according to commonName parsing.
@@ -355,14 +355,14 @@ module.exports.CertificateOperations = function (parent) {
355
// set only DNS when commonName is a FQDN
356
altNames.push({ type: 2, value: commonName });
357
}
358
- altNames.push({ type: 6, value: "http://" + commonName + "/" })
358
+ altNames.push({ type: 6, value: 'http://' + commonName + '/' })
359
360
// Add localhost stuff for easy testing on localhost ;)
361
- altNames.push({ type: 2, value: "localhost" });
362
- altNames.push({ type: 6, value: "http://localhost/" });
363
- altNames.push({ type: 7, ip: "127.0.0.1" });
361
+ altNames.push({ type: 2, value: 'localhost' });
362
+ altNames.push({ type: 6, value: 'http://localhost/' });
363
+ altNames.push({ type: 7, ip: '127.0.0.1' });
364
365
- extensions.push({ name: "subjectAltName", altNames: altNames });
365
+ extensions.push({ name: 'subjectAltName', altNames: altNames });
366
}
367
368
cert.setExtensions(extensions);
@@ -413,69 +413,69 @@ module.exports.CertificateOperations = function (parent) {
413
var rcount = 0;
414
415
// If the root certificate already exist, load it
416
- if (obj.fileExists("root-cert-public.crt") && obj.fileExists("root-cert-private.key")) {
417
- var rootCertificate = obj.fileLoad("root-cert-public.crt", "utf8");
418
- var rootPrivateKey = obj.fileLoad("root-cert-private.key", "utf8");
416
+ if (obj.fileExists('root-cert-public.crt') && obj.fileExists('root-cert-private.key')) {
417
+ var rootCertificate = obj.fileLoad('root-cert-public.crt', 'utf8');
418
+ var rootPrivateKey = obj.fileLoad('root-cert-private.key', 'utf8');
419
r.root = { cert: rootCertificate, key: rootPrivateKey };
420
rcount++;
421
422
// Check if the root certificate has the "Certificate Signing (04)" Key usage.
423
// This option is required for newer versions of Intel AMT for CIRA/WS-EVENTS.
424
var xroot = obj.pki.certificateFromPem(rootCertificate);
425
- var xext = xroot.getExtension("keyUsage");
425
+ var xext = xroot.getExtension('keyUsage');
426
if ((xext == null) || (xext.keyCertSign !== true)) {
427
// We need to fix this certificate
428
- console.log('Fixing root certificate to add signing key usage...');
429
- obj.fs.writeFileSync(parent.getConfigFilePath("root-cert-public-backup.crt"), rootCertificate);
430
- xroot.setExtensions([{ name: "basicConstraints", cA: true }, { name: "subjectKeyIdentifier" }, { name: "keyUsage", keyCertSign: true }]);
428
+ console.log("Fixing root certificate to add signing key usage...");
429
+ obj.fs.writeFileSync(parent.getConfigFilePath('root-cert-public-backup.crt'), rootCertificate);
430
+ xroot.setExtensions([{ name: 'basicConstraints', cA: true }, { name: 'subjectKeyIdentifier' }, { name: 'keyUsage', keyCertSign: true }]);
431
var xrootPrivateKey = obj.pki.privateKeyFromPem(rootPrivateKey);
432
xroot.sign(xrootPrivateKey, obj.forge.md.sha384.create());
433
r.root.cert = obj.pki.certificateToPem(xroot);
434
- try { obj.fs.writeFileSync(parent.getConfigFilePath("root-cert-public.crt"), r.root.cert); } catch (ex) { }
434
+ try { obj.fs.writeFileSync(parent.getConfigFilePath('root-cert-public.crt'), r.root.cert); } catch (ex) { }
435
}
436
}
437
438
if (args.tlsoffload) {
439
// If the web certificate already exist, load it. Load just the certificate since we are in TLS offload situation
440
- if (obj.fileExists("webserver-cert-public.crt")) {
441
- r.web = { cert: obj.fileLoad("webserver-cert-public.crt", "utf8") };
440
+ if (obj.fileExists('webserver-cert-public.crt')) {
441
+ r.web = { cert: obj.fileLoad('webserver-cert-public.crt', 'utf8') };
442
rcount++;
443
}
444
} else {
445
// If the web certificate already exist, load it. Load both certificate and private key
446
- if (obj.fileExists("webserver-cert-public.crt") && obj.fileExists("webserver-cert-private.key")) {
447
- r.web = { cert: obj.fileLoad("webserver-cert-public.crt", "utf8"), key: obj.fileLoad("webserver-cert-private.key", "utf8") };
446
+ if (obj.fileExists('webserver-cert-public.crt') && obj.fileExists('webserver-cert-private.key')) {
447
+ r.web = { cert: obj.fileLoad('webserver-cert-public.crt', 'utf8'), key: obj.fileLoad('webserver-cert-private.key', 'utf8') };
448
rcount++;
449
}
450
}
451
452
// If the mps certificate already exist, load it
453
- if (obj.fileExists("mpsserver-cert-public.crt") && obj.fileExists("mpsserver-cert-private.key")) {
454
- r.mps = { cert: obj.fileLoad("mpsserver-cert-public.crt", "utf8"), key: obj.fileLoad("mpsserver-cert-private.key", "utf8") };
453
+ if (obj.fileExists('mpsserver-cert-public.crt') && obj.fileExists('mpsserver-cert-private.key')) {
454
+ r.mps = { cert: obj.fileLoad('mpsserver-cert-public.crt', 'utf8'), key: obj.fileLoad('mpsserver-cert-private.key', 'utf8') };
455
rcount++;
456
}
457
458
// If the agent certificate already exist, load it
459
if (obj.fileExists("agentserver-cert-public.crt") && obj.fileExists("agentserver-cert-private.key")) {
460
- r.agent = { cert: obj.fileLoad("agentserver-cert-public.crt", "utf8"), key: obj.fileLoad("agentserver-cert-private.key", "utf8") };
460
+ r.agent = { cert: obj.fileLoad("agentserver-cert-public.crt", 'utf8'), key: obj.fileLoad("agentserver-cert-private.key", 'utf8') };
461
rcount++;
462
}
463
464
// If the swarm server certificate exist, load it (This is an optional certificate)
465
- if (obj.fileExists("swarmserver-cert-public.crt") && obj.fileExists("swarmserver-cert-private.key")) {
466
- r.swarmserver = { cert: obj.fileLoad("swarmserver-cert-public.crt", "utf8"), key: obj.fileLoad("swarmserver-cert-private.key", "utf8") };
465
+ if (obj.fileExists('swarmserver-cert-public.crt') && obj.fileExists('swarmserver-cert-private.key')) {
466
+ r.swarmserver = { cert: obj.fileLoad('swarmserver-cert-public.crt', 'utf8'), key: obj.fileLoad('swarmserver-cert-private.key', 'utf8') };
467
}
468
469
// If the swarm server root certificate exist, load it (This is an optional certificate)
470
- if (obj.fileExists("swarmserverroot-cert-public.crt")) {
471
- r.swarmserverroot = { cert: obj.fileLoad("swarmserverroot-cert-public.crt", "utf8") };
470
+ if (obj.fileExists('swarmserverroot-cert-public.crt')) {
471
+ r.swarmserverroot = { cert: obj.fileLoad('swarmserverroot-cert-public.crt', 'utf8') };
472
}
473
474
// If CA certificates are present, load them
475
do {
476
caok = false;
477
- if (obj.fileExists("webserver-cert-chain" + caindex + ".crt")) {
478
- calist.push(obj.fileLoad("webserver-cert-chain" + caindex + ".crt", "utf8"));
477
+ if (obj.fileExists('webserver-cert-chain' + caindex + '.crt')) {
478
+ calist.push(obj.fileLoad('webserver-cert-chain' + caindex + '.crt', 'utf8'));
479
caok = true;
480
}
481
caindex++;
@@ -483,24 +483,24 @@ module.exports.CertificateOperations = function (parent) {
483
if (r.web != null) { r.web.ca = calist; }
484
485
// Decode certificate arguments
486
- var commonName = "un-configured";
486
+ var commonName = 'un-configured';
487
var country = null;
488
var organization = null;
489
var forceWebCertGen = 0;
490
var forceMpsCertGen = 0;
491
if (certargs != undefined) {
492
- var xargs = certargs.split(",");
492
+ var xargs = certargs.split(',');
493
if (xargs.length > 0) { commonName = xargs[0]; }
494
if (xargs.length > 1) { country = xargs[1]; }
495
if (xargs.length > 2) { organization = xargs[2]; }
496
}
497
498
// Decode MPS certificate arguments, this is for the Intel AMT CIRA server
499
- var mpsCommonName = commonName;
499
+ var mpsCommonName = ((config.settings != null) && (typeof config.settings.mpsaliashost == 'string')) ? config.settings.mpsaliashost : commonName;
500
var mpsCountry = country;
501
var mpsOrganization = organization;
502
if (mpscertargs !== undefined) {
503
- var xxargs = mpscertargs.split(",");
503
+ var xxargs = mpscertargs.split(',');
504
if (xxargs.length > 0) { mpsCommonName = xxargs[0]; }
505
if (xxargs.length > 1) { mpsCountry = xxargs[1]; }
506
if (xxargs.length > 2) { mpsOrganization = xxargs[2]; }
@@ -508,16 +508,16 @@ module.exports.CertificateOperations = function (parent) {
508
509
if (rcount === rcountmax) {
510
// Fetch the certificates names for the main certificate
511
- r.AmtMpsName = obj.pki.certificateFromPem(r.mps.cert).subject.getField("CN").value;
511
+ r.AmtMpsName = obj.pki.certificateFromPem(r.mps.cert).subject.getField('CN').value;
512
var webCertificate = obj.pki.certificateFromPem(r.web.cert);
513
- r.WebIssuer = webCertificate.issuer.getField("CN").value;
514
- if (commonName == "un-configured") { // If the "cert" name is not set, try to use the certificate CN instead (ok if the certificate is not wildcard).
515
- commonName = webCertificate.subject.getField("CN").value;
513
+ r.WebIssuer = webCertificate.issuer.getField('CN').value;
514
+ if (commonName == 'un-configured') { // If the "cert" name is not set, try to use the certificate CN instead (ok if the certificate is not wildcard).
515
+ commonName = webCertificate.subject.getField('CN').value;
516
if (commonName.startsWith('*.')) { console.log("ERROR: Must specify a server full domain name in Config.json->Settings->Cert when using a wildcard certificate."); process.exit(0); return; }
517
}
518
r.CommonName = commonName;
519
r.CommonNames = [commonName.toLowerCase()];
520
- var altNames = webCertificate.getExtension("subjectAltName");
520
+ var altNames = webCertificate.getExtension('subjectAltName');
521
if (altNames) {
522
for (i = 0; i < altNames.altNames.length; i++) {
523
var acn = altNames.altNames[i].value.toLowerCase();
@@ -525,7 +525,7 @@ module.exports.CertificateOperations = function (parent) {
525
}
526
}
527
var rootCertificate = obj.pki.certificateFromPem(r.root.cert);
528
- r.RootName = rootCertificate.subject.getField("CN").value;
528
+ r.RootName = rootCertificate.subject.getField('CN').value;
529
}
530
531
// Look for domains that have DNS names and load their certificates
@@ -535,28 +535,28 @@ module.exports.CertificateOperations = function (parent) {
535
dnsname = config.domains[i].dns;
536
// Check if this domain matches a parent wildcard cert, if so, use the parent cert.
537
if (obj.compareCertificateNames(r.CommonNames, dnsname) == true) {
538
- r.dns[i] = { cert: obj.fileLoad("webserver-cert-public.crt", "utf8"), key: obj.fileLoad("webserver-cert-private.key", "utf8") };
538
+ r.dns[i] = { cert: obj.fileLoad('webserver-cert-public.crt', 'utf8'), key: obj.fileLoad('webserver-cert-private.key', 'utf8') };
539
} else {
540
if (args.tlsoffload) {
541
// If the web certificate already exist, load it. Load just the certificate since we are in TLS offload situation
542
- if (obj.fileExists("webserver-" + i + "-cert-public.crt")) {
543
- r.dns[i] = { cert: obj.fileLoad("webserver-" + i + "-cert-public.crt", "utf8") };
542
+ if (obj.fileExists('webserver-' + i + '-cert-public.crt')) {
543
+ r.dns[i] = { cert: obj.fileLoad('webserver-' + i + '-cert-public.crt', 'utf8') };
544
config.domains[i].certs = r.dns[i];
545
} else {
546
console.log("WARNING: File \"webserver-" + i + "-cert-public.crt\" missing, domain \"" + i + "\" will not work correctly.");
547
}
548
} else {
549
// If the web certificate already exist, load it. Load both certificate and private key
550
- if (obj.fileExists("webserver-" + i + "-cert-public.crt") && obj.fileExists("webserver-" + i + "-cert-private.key")) {
551
- r.dns[i] = { cert: obj.fileLoad("webserver-" + i + "-cert-public.crt", "utf8"), key: obj.fileLoad("webserver-" + i + "-cert-private.key", "utf8") };
550
+ if (obj.fileExists('webserver-' + i + '-cert-public.crt') && obj.fileExists('webserver-' + i + '-cert-private.key')) {
551
+ r.dns[i] = { cert: obj.fileLoad('webserver-' + i + '-cert-public.crt', 'utf8'), key: obj.fileLoad('webserver-' + i + '-cert-private.key', 'utf8') };
552
config.domains[i].certs = r.dns[i];
553
// If CA certificates are present, load them
554
caindex = 1;
555
r.dns[i].ca = [];
556
do {
557
caok = false;
558
- if (obj.fileExists("webserver-" + i + "-cert-chain" + caindex + ".crt")) {
559
- r.dns[i].ca.push(obj.fileLoad("webserver-" + i + "-cert-chain" + caindex + ".crt", "utf8"));
558
+ if (obj.fileExists('webserver-' + i + '-cert-chain' + caindex + '.crt')) {
559
+ r.dns[i].ca.push(obj.fileLoad('webserver-' + i + '-cert-chain' + caindex + '.crt', 'utf8'));
560
caok = true;
561
}
562
caindex++;
@@ -571,9 +571,9 @@ module.exports.CertificateOperations = function (parent) {
571
572
if (rcount === rcountmax) {
573
if ((certargs == null) && (mpscertargs == null)) { if (func != undefined) { func(r); } return r; } // If no certificate arguments are given, keep the certificate
574
- var xcountry, xcountryField = webCertificate.subject.getField("C");
574
+ var xcountry, xcountryField = webCertificate.subject.getField('C');
575
if (xcountryField != null) { xcountry = xcountryField.value; }
576
- var xorganization, xorganizationField = webCertificate.subject.getField("O");
576
+ var xorganization, xorganizationField = webCertificate.subject.getField('O');
577
if (xorganizationField != null) { xorganization = xorganizationField.value; }
578
if (certargs == null) { commonName = r.CommonName; country = xcountry; organization = xorganization; }
579
@@ -590,15 +590,15 @@ module.exports.CertificateOperations = function (parent) {
590
if (parent.configurationFiles != null) { console.log("Error: Vault/Database missing some certificates."); process.exit(0); return null; }
591
592
console.log("Generating certificates, may take a few minutes...");
593
- parent.updateServerState("state", "generatingcertificates");
593
+ parent.updateServerState('state', 'generatingcertificates');
594
595
// If a certificate is missing, but web certificate is present and --cert is not used, set the names to be the same as the web certificate
596
if ((certargs == null) && (r.web != null)) {
597
var webCertificate = obj.pki.certificateFromPem(r.web.cert);
598
- commonName = webCertificate.subject.getField("CN").value;
599
- var xcountryField = webCertificate.subject.getField("C");
598
+ commonName = webCertificate.subject.getField('CN').value;
599
+ var xcountryField = webCertificate.subject.getField('C');
600
if (xcountryField != null) { country = xcountryField.value; }
601
- var xorganizationField = webCertificate.subject.getField("O");
601
+ var xorganizationField = webCertificate.subject.getField('O');
602
if (xorganizationField != null) { organization = xorganizationField.value; }
603
}
604
@@ -606,18 +606,18 @@ module.exports.CertificateOperations = function (parent) {
606
if (r.root == null) {
607
// If the root certificate does not exist, create one
608
console.log("Generating root certificate...");
609
- rootCertAndKey = obj.GenerateRootCertificate(true, "MeshCentralRoot", null, null, strongCertificate);
609
+ rootCertAndKey = obj.GenerateRootCertificate(true, 'MeshCentralRoot', null, null, strongCertificate);
610
rootCertificate = obj.pki.certificateToPem(rootCertAndKey.cert);
611
rootPrivateKey = obj.pki.privateKeyToPem(rootCertAndKey.key);
612
- obj.fs.writeFileSync(parent.getConfigFilePath("root-cert-public.crt"), rootCertificate);
613
- obj.fs.writeFileSync(parent.getConfigFilePath("root-cert-private.key"), rootPrivateKey);
612
+ obj.fs.writeFileSync(parent.getConfigFilePath('root-cert-public.crt'), rootCertificate);
613
+ obj.fs.writeFileSync(parent.getConfigFilePath('root-cert-private.key'), rootPrivateKey);
614
} else {
615
// Keep the root certificate we have
616
rootCertAndKey = { cert: obj.pki.certificateFromPem(r.root.cert), key: obj.pki.privateKeyFromPem(r.root.key) };
617
rootCertificate = r.root.cert;
618
rootPrivateKey = r.root.key;
619
}
620
- var rootName = rootCertAndKey.cert.subject.getField("CN").value;
620
+ var rootName = rootCertAndKey.cert.subject.getField('CN').value;
621
622
// If the web certificate does not exist, create one
623
var webCertAndKey, webCertificate, webPrivateKey;
@@ -626,8 +626,8 @@ module.exports.CertificateOperations = function (parent) {
626
webCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, false, commonName, country, organization, null, strongCertificate);
627
webCertificate = obj.pki.certificateToPem(webCertAndKey.cert);
628
webPrivateKey = obj.pki.privateKeyToPem(webCertAndKey.key);
629
- obj.fs.writeFileSync(parent.getConfigFilePath("webserver-cert-public.crt"), webCertificate);
630
- obj.fs.writeFileSync(parent.getConfigFilePath("webserver-cert-private.key"), webPrivateKey);
629
+ obj.fs.writeFileSync(parent.getConfigFilePath('webserver-cert-public.crt'), webCertificate);
630
+ obj.fs.writeFileSync(parent.getConfigFilePath('webserver-cert-private.key'), webPrivateKey);
631
} else {
632
// Keep the console certificate we have
633
if (args.tlsoffload) {
@@ -639,17 +639,17 @@ module.exports.CertificateOperations = function (parent) {
639
webPrivateKey = r.web.key;
640
}
641
}
642
- var webIssuer = webCertAndKey.cert.issuer.getField("CN").value;
642
+ var webIssuer = webCertAndKey.cert.issuer.getField('CN').value;
643
644
// If the mesh agent server certificate does not exist, create one
645
var agentCertAndKey, agentCertificate, agentPrivateKey;
646
if (r.agent == null) {
647
console.log("Generating MeshAgent certificate...");
648
- agentCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, true, "MeshCentralAgentServer", country, organization, { }, strongCertificate);
648
+ agentCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, true, 'MeshCentralAgentServer', country, organization, { }, strongCertificate);
649
agentCertificate = obj.pki.certificateToPem(agentCertAndKey.cert);
650
agentPrivateKey = obj.pki.privateKeyToPem(agentCertAndKey.key);
651
- obj.fs.writeFileSync(parent.getConfigFilePath("agentserver-cert-public.crt"), agentCertificate);
652
- obj.fs.writeFileSync(parent.getConfigFilePath("agentserver-cert-private.key"), agentPrivateKey);
651
+ obj.fs.writeFileSync(parent.getConfigFilePath('agentserver-cert-public.crt'), agentCertificate);
652
+ obj.fs.writeFileSync(parent.getConfigFilePath('agentserver-cert-private.key'), agentPrivateKey);
653
} else {
654
// Keep the mesh agent server certificate we have
655
agentCertAndKey = { cert: obj.pki.certificateFromPem(r.agent.cert), key: obj.pki.privateKeyFromPem(r.agent.key) };
@@ -664,8 +664,8 @@ module.exports.CertificateOperations = function (parent) {
664
mpsCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, false, mpsCommonName, mpsCountry, mpsOrganization, null, false);
665
mpsCertificate = obj.pki.certificateToPem(mpsCertAndKey.cert);
666
mpsPrivateKey = obj.pki.privateKeyToPem(mpsCertAndKey.key);
667
- obj.fs.writeFileSync(parent.getConfigFilePath("mpsserver-cert-public.crt"), mpsCertificate);
668
- obj.fs.writeFileSync(parent.getConfigFilePath("mpsserver-cert-private.key"), mpsPrivateKey);
667
+ obj.fs.writeFileSync(parent.getConfigFilePath('mpsserver-cert-public.crt'), mpsCertificate);
668
+ obj.fs.writeFileSync(parent.getConfigFilePath('mpsserver-cert-private.key'), mpsPrivateKey);
669
} else {
670
// Keep the console certificate we have
671
mpsCertAndKey = { cert: obj.pki.certificateFromPem(r.mps.cert), key: obj.pki.privateKeyFromPem(r.mps.key) };
@@ -677,18 +677,18 @@ module.exports.CertificateOperations = function (parent) {
677
678
// Fetch the certificates names for the main certificate
679
var webCertificate = obj.pki.certificateFromPem(r.web.cert);
680
- r.WebIssuer = webCertificate.issuer.getField("CN").value;
681
- r.CommonName = webCertificate.subject.getField("CN").value;
680
+ r.WebIssuer = webCertificate.issuer.getField('CN').value;
681
+ r.CommonName = webCertificate.subject.getField('CN').value;
682
if (r.CommonName.startsWith('*.')) {
683
if (commonName.indexOf('.') == -1) { console.log("ERROR: Must specify a server full domain name in Config.json->Settings->Cert when using a wildcard certificate."); process.exit(0); return; }
684
if (commonName.startsWith('*.')) { console.log("ERROR: Server can't use a wildcard name: " + commonName); process.exit(0); return; }
685
r.CommonName = commonName;
686
}
687
r.CommonNames = [r.CommonName.toLowerCase()];
688
- var altNames = webCertificate.getExtension("subjectAltName");
688
+ var altNames = webCertificate.getExtension('subjectAltName');
689
if (altNames) { for (i = 0; i < altNames.altNames.length; i++) { r.CommonNames.push(altNames.altNames[i].value.toLowerCase()); } }
690
var rootCertificate = obj.pki.certificateFromPem(r.root.cert);
691
- r.RootName = rootCertificate.subject.getField("CN").value;
691
+ r.RootName = rootCertificate.subject.getField('CN').value;
692
693
// Look for domains with DNS names that have no certificates and generated them.
694
for (i in config.domains) {
@@ -696,17 +696,17 @@ module.exports.CertificateOperations = function (parent) {
696
dnsname = config.domains[i].dns;
697
// Check if this domain matches a parent wildcard cert, if so, use the parent cert.
698
if (obj.compareCertificateNames(r.CommonNames, dnsname) == true) {
699
- r.dns[i] = { cert: obj.fileLoad("webserver-cert-public.crt", "utf8"), key: obj.fileLoad("webserver-cert-private.key", "utf8") };
699
+ r.dns[i] = { cert: obj.fileLoad('webserver-cert-public.crt', 'utf8'), key: obj.fileLoad('webserver-cert-private.key', 'utf8') };
700
} else {
701
if (!args.tlsoffload) {
702
// If the web certificate does not exist, create it
703
- if ((obj.fileExists("webserver-" + i + "-cert-public.crt") === false) || (obj.fileExists("webserver-" + i + "-cert-private.key") === false)) {
704
- console.log("Generating HTTPS certificate for " + i + "...");
703
+ if ((obj.fileExists('webserver-' + i + '-cert-public.crt') === false) || (obj.fileExists('webserver-' + i + '-cert-private.key') === false)) {
704
+ console.log('Generating HTTPS certificate for ' + i + '...');
705
var xwebCertAndKey = obj.IssueWebServerCertificate(rootCertAndKey, false, dnsname, country, organization, null, strongCertificate);
706
var xwebCertificate = obj.pki.certificateToPem(xwebCertAndKey.cert);
707
var xwebPrivateKey = obj.pki.privateKeyToPem(xwebCertAndKey.key);
708
- obj.fs.writeFileSync(parent.getConfigFilePath("webserver-" + i + "-cert-public.crt"), xwebCertificate);
709
- obj.fs.writeFileSync(parent.getConfigFilePath("webserver-" + i + "-cert-private.key"), xwebPrivateKey);
708
+ obj.fs.writeFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-public.crt'), xwebCertificate);
709
+ obj.fs.writeFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-private.key'), xwebPrivateKey);
710
r.dns[i] = { cert: xwebCertificate, key: xwebPrivateKey };
711
config.domains[i].certs = r.dns[i];
712
@@ -715,8 +715,8 @@ module.exports.CertificateOperations = function (parent) {
715
r.dns[i].ca = [];
716
do {
717
caok = false;
718
- if (obj.fileExists("webserver-" + i + "-cert-chain" + caindex + ".crt")) {
719
- r.dns[i].ca.push(fixEndOfLines(obj.fs.readFileSync(parent.getConfigFilePath("webserver-" + i + "-cert-chain" + caindex + ".crt"), "utf8")));
718
+ if (obj.fileExists('webserver-' + i + '-cert-chain' + caindex + '.crt')) {
719
+ r.dns[i].ca.push(fixEndOfLines(obj.fs.readFileSync(parent.getConfigFilePath('webserver-' + i + '-cert-chain' + caindex + '.crt'), 'utf8')));
720
caok = true;
721
}
722
caindex++;
@@ -728,13 +728,13 @@ module.exports.CertificateOperations = function (parent) {
728
}
729
730
// If the swarm server certificate exist, load it (This is an optional certificate)
731
- if (obj.fileExists("swarmserver-cert-public.crt") && obj.fileExists("swarmserver-cert-private.key")) {
732
- r.swarmserver = { cert: fixEndOfLines(obj.fs.readFileSync(parent.getConfigFilePath("swarmserver-cert-public.crt"), "utf8")), key: fixEndOfLines(obj.fs.readFileSync(parent.getConfigFilePath("swarmserver-cert-private.key"), "utf8")) };
731
+ if (obj.fileExists('swarmserver-cert-public.crt') && obj.fileExists('swarmserver-cert-private.key')) {
732
+ r.swarmserver = { cert: fixEndOfLines(obj.fs.readFileSync(parent.getConfigFilePath('swarmserver-cert-public.crt'), 'utf8')), key: fixEndOfLines(obj.fs.readFileSync(parent.getConfigFilePath("swarmserver-cert-private.key"), 'utf8')) };
733
}
734
735
// If the swarm server root certificate exist, load it (This is an optional certificate)
736
- if (obj.fileExists("swarmserverroot-cert-public.crt")) {
737
- r.swarmserverroot = { cert: fixEndOfLines(obj.fs.readFileSync(parent.getConfigFilePath("swarmserverroot-cert-public.crt"), "utf8")) };
736
+ if (obj.fileExists('swarmserverroot-cert-public.crt')) {
737
+ r.swarmserverroot = { cert: fixEndOfLines(obj.fs.readFileSync(parent.getConfigFilePath('swarmserverroot-cert-public.crt'), 'utf8')) };
738
}
739
740
// If CA certificates are present, load them
@@ -743,8 +743,8 @@ module.exports.CertificateOperations = function (parent) {
743
r.web.ca = [];
744
do {
745
caok = false;
746
- if (obj.fileExists("webserver-cert-chain" + caindex + ".crt")) {
747
- r.web.ca.push(fixEndOfLines(obj.fs.readFileSync(parent.getConfigFilePath("webserver-cert-chain" + caindex + ".crt"), "utf8")));
746
+ if (obj.fileExists('webserver-cert-chain' + caindex + '.crt')) {
747
+ r.web.ca.push(fixEndOfLines(obj.fs.readFileSync(parent.getConfigFilePath('webserver-cert-chain' + caindex + '.crt'), 'utf8')));
748
caok = true;
749
}
750
caindex++;
@@ -756,9 +756,9 @@ module.exports.CertificateOperations = function (parent) {
756
};
757
758
// Accelerators, used to dispatch work to other processes
759
- const fork = require("child_process").fork;
760
- const program = require("path").join(__dirname, "meshaccelerator.js");
761
- const acceleratorTotalCount = require("os").cpus().length; // TODO: Check if this accelerator can scale.
759
+ const fork = require('child_process').fork;
760
+ const program = require('path').join(__dirname, 'meshaccelerator.js');
761
+ const acceleratorTotalCount = require('os').cpus().length; // TODO: Check if this accelerator can scale.
762
var acceleratorCreateCount = acceleratorTotalCount;
763
var freeAccelerators = [];
764
var pendingAccelerator = [];
@@ -803,21 +803,21 @@ module.exports.CertificateOperations = function (parent) {
803
if (freeAccelerators.length > 0) { return freeAccelerators.pop(); }
804
if (acceleratorCreateCount > 0) {
805
acceleratorCreateCount--;
806
- var accelerator = fork(program, [], { stdio: ["pipe", "pipe", "pipe", "ipc"] });
806
+ var accelerator = fork(program, [], { stdio: ['pipe', 'pipe', 'pipe', 'ipc'] });
807
accelerator.accid = acceleratorCreateCount;
808
- accelerator.on("message", function (message) {
808
+ accelerator.on('message', function (message) {
809
acceleratorMessage++;
810
this.x.func(this.x.tag, message);
811
delete this.x;
812
if (pendingAccelerator.length > 0) { this.send(this.x = pendingAccelerator.shift()); } else { freeAccelerators.push(this); }
813
});
814
- accelerator.on("exit", function (code) {
814
+ accelerator.on('exit', function (code) {
815
if (this.x) { pendingAccelerator.push(this.x); delete this.x; }
816
acceleratorCreateCount++;
817
if (pendingAccelerator.length > 0) { var acc = obj.getAccelerator(); acc.send(acc.x = pendingAccelerator.shift()); }
818
});
819
- accelerator.on("error", function (code) { }); // Not sure if somethign should be done here to help kill the process.
820
- accelerator.send({ action: "setState", certs: obj.acceleratorCertStore });
819
+ accelerator.on('error', function (code) { }); // Not sure if somethign should be done here to help kill the process.
820
+ accelerator.send({ action: 'setState', certs: obj.acceleratorCertStore });
821
return accelerator;
822
}
823
return null;
@@ -836,20 +836,20 @@ module.exports.CertificateOperations = function (parent) {
836
acceleratorPerformSignatureFuncCall++;
837
if (acceleratorTotalCount <= 1) {
838
// No accelerators available
839
- if (typeof privatekey == "number") { privatekey = obj.acceleratorCertStore[privatekey].key; }
840
- const sign = obj.crypto.createSign("SHA384");
841
- sign.end(Buffer.from(data, "binary"));
842
- try { func(tag, sign.sign(privatekey).toString("binary")); } catch (ex) { acceleratorMessageException++; acceleratorMessageLastException = ex; }
839
+ if (typeof privatekey == 'number') { privatekey = obj.acceleratorCertStore[privatekey].key; }
840
+ const sign = obj.crypto.createSign('SHA384');
841
+ sign.end(Buffer.from(data, 'binary'));
842
+ try { func(tag, sign.sign(privatekey).toString('binary')); } catch (ex) { acceleratorMessageException++; acceleratorMessageLastException = ex; }
843
} else {
844
var acc = obj.getAccelerator();
845
if (acc == null) {
846
// Add to pending accelerator workload
847
acceleratorPerformSignaturePushFuncCall++;
848
- pendingAccelerator.push({ action: "sign", key: privatekey, data: data, tag: tag, func: func });
848
+ pendingAccelerator.push({ action: 'sign', key: privatekey, data: data, tag: tag, func: func });
849
} else {
850
// Send to accelerator now
851
acceleratorPerformSignatureRunFuncCall++;
852
- acc.send(acc.x = { action: "sign", key: privatekey, data: data, tag: tag, func: func });
852
+ acc.send(acc.x = { action: 'sign', key: privatekey, data: data, tag: tag, func: func });
853
}
854
}
855
};
meshcentral.js
+5
-4
@@ -650,9 +650,9 @@ function CreateMeshCentralServer(config, args) {
650
651
// Lower case all keys in the config file
652
try {
653
- require('./common.js').objKeysToLower(config2, ["ldapoptions"]);
653
+ require('./common.js').objKeysToLower(config2, ['ldapoptions']);
654
} catch (ex) {
655
- console.log('CRITICAL ERROR: Unable to access the file \"./common.js\".\r\nCheck folder & file permissions.');
655
+ console.log("CRITICAL ERROR: Unable to access the file \"./common.js\".\r\nCheck folder & file permissions.");
656
process.exit();
657
return;
658
}
@@ -719,6 +719,7 @@ function CreateMeshCentralServer(config, args) {
719
var bannedDomains = ['public', 'private', 'images', 'scripts', 'styles', 'views']; // List of banned domains
720
for (i in obj.config.domains) { for (var j in bannedDomains) { if (i == bannedDomains[j]) { console.log("ERROR: Domain '" + i + "' is not allowed domain name in config.json."); return; } } }
721
for (i in obj.config.domains) {
722
+ if ((i.length > 0) && (i[0] == '_')) { delete obj.config.domains[i]; continue; } // Remove any domains with names that start with _
723
if (typeof config.domains[i].auth == 'string') { config.domains[i].auth = config.domains[i].auth.toLowerCase(); }
724
if (obj.config.domains[i].limits == null) { obj.config.domains[i].limits = {}; }
725
if (obj.config.domains[i].dns == null) { obj.config.domains[i].url = (i == '') ? '/' : ('/' + i + '/'); } else { obj.config.domains[i].url = '/'; }
@@ -789,7 +790,7 @@ function CreateMeshCentralServer(config, args) {
790
if (user.length != 1) { console.log("Invalid user name."); process.exit(); return; }
791
user[0].siteadmin = 4294967295; // 0xFFFFFFFF
792
obj.db.Set(user[0], function () {
792
- if (user[0].domain == '') { console.log('User ' + user[0].name + ' set to site administrator.'); } else { console.log('User ' + user[0].name + ' of domain ' + user[0].domain + ' set to site administrator.'); }
793
+ if (user[0].domain == '') { console.log('User ' + user[0].name + ' set to site administrator.'); } else { console.log("User " + user[0].name + " of domain " + user[0].domain + " set to site administrator."); }
794
process.exit();
795
return;
796
});
@@ -807,7 +808,7 @@ function CreateMeshCentralServer(config, args) {
808
if (user.length != 1) { console.log("Invalid user name."); process.exit(); return; }
809
if (user[0].siteadmin) { delete user[0].siteadmin; }
810
obj.db.Set(user[0], function () {
810
- if (user[0].domain == '') { console.log('User ' + user[0].name + ' is not a site administrator.'); } else { console.log('User ' + user[0].name + ' of domain ' + user[0].domain + ' is not a site administrator.'); }
811
+ if (user[0].domain == '') { console.log("User " + user[0].name + " is not a site administrator."); } else { console.log("User " + user[0].name + " of domain " + user[0].domain + " is not a site administrator."); }
812
process.exit();
813
return;
814
});
public/commander.htm
+617
-617
@@ -1,4 +1,4 @@
1
-<!DOCTYPE html><html style=height:100%><head><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8" http-equiv=Content-Type><meta name=format-detection content="telephone=no"><link rel="icon" type=image/png href="data:image/png;base64,iVBORw0KGgo="><style>body{height:100%;max-height:100%;overflow:hidden;font-family:arial, helvetica, sans-serif;font-size:9pt;color:black;background:white;margin-top:0;margin-left:0;margin-right:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}li{margin:0;padding:0;}label{display:block;color:windowtext;background-color:window;margin:0;padding:0;width:100%;}label:hover{background-color:highlight;color:highlighttext;}a:visited{text-decoration:none;color:#04f;}a:link{text-decoration:none;color:#04f;}a:hover{color:#a32;}h1{font-size:11pt;font-weight:bold;color:black;margin-left:5px;margin-top:10px;margin-bottom:6px;}h2{font-size:9pt;font-weight:bold;color:black;margin-left:6px;margin-top:6px;margin-bottom:0;}p{margin-left:6px;margin-top:4px;margin-bottom:0;margin-right:2px;}td{font-size:9pt;}th{font-size:9pt;}th:hover{cursor:pointer;background:#aaa;}.header{position:fixed;top:0;left:0;right:0;height:24px;background:#c0c0c0;}.progressbar{position:fixed;top:24px;left:0;right:0;height:2px;background:#ff9e30;}.in{margin-left:40px;}.log{background:#bbbab5;}.log1{background:#bbbab5;}.log tbody tr:nth-child(odd){background:#e8eefe;}.fullcell{position:fixed;top:26px;right:0;bottom:0;left:0px;overflow:hidden;}.maincell{position:fixed;top:26px;right:0;bottom:0;left:156px;overflow:auto;padding-left:2px;vertical-align:top;}.navbar{position:fixed;top:26px;left:0;bottom:0;width:156px;border-right:2px solid #ff9e30;vertical-align:top;background:#72726f;background:linear-gradient(45deg, #72726f 0%,#a6a5a0 100%);}.nav1{padding:1px 0px 1px 8px;margin:0px;font-weight:bold;color:black;white-space:nowrap;cursor:pointer;}.nav2{margin-left:32px;margin-top:0;color:black;cursor:pointer;}.r{font-size:11pt;}.r0{background:white;}.r1{border-bottom:1px solid gray;text-align:left;}.r2{text-align:left;}.r3{border-bottom:1px solid gray;text-align:left;}.r3:hover{background-color:#83827b;cursor:pointer;}.spread{height:100%;width:100%;background-color:white;}.timer{border:1px solid #abcae1;background-color:#abcae1;}.tm{font-size:7pt;}.top1{font-size:14pt;font-weight:bold;color:white;margin-top:11px;}.top2{color:white;}.warn{font-weight:bold;color:#c00000;}.icon1{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAMISURBVHjadJPPb9t0GMY//rbJaEKSxoPFQQ1WxhQ7RaGoIDEpTBMqgk7iBvwNKJdJXDnssEMl7pMGfwOH9YBYh0AglYiBBNKa0cSGNpiRxs7aJE2aH7aTmkPXqTvwXt7L8z56pef5SEEQcHYMwyjWarX3rLr1tu3YOQAlpZhqVv1J1/VvNU0rn9VLpwbtdlspb5ZLNdNcuZBKF1NKmuS8DECn28axm7ScZlnP5b4vXinelmXZfmrQbreVjbsbN3r9YSmTLbA/Ps92K8FgFAbAdYcsLXRRk10af/9BPBa5vXpt9aYsy7YAKG+WS73+sJS+eJmKneZe5QWEiHHreoJb1xNEInHu/Bzw3cM45zNv0usPS+XNcglAGIZRrJnmSiZbYOtRhF93ZvHcHoPRlN3GkL4Ho5HHeOxRqbv8sHVM+uVFaqa5YhhGUVpfXw+6hwP86DJ3fgkzK44hOGZuLkH7KIQIxuw9dkk812Hqu0wmPh9djZIKG8wnogirbpFS0jy0YOqPcMcurjvh3Vc7fPHpHF9//iLLyja75p/sNWxazj73t9qklDRW3ULYjk1yXmb3Xw/P9fA9n35/AMD0yAIgGQ8zOtxnMhFM/ClG/YjkvIzt2Mye5un5Lr4HY9el5RwA2tOsY9FzCCFBICCYOdlPRigphU63jZKEwWDAweMDJt7kmXINBhOkIEAQQiLMpczzJzcpBaFmVRy7iZ4RdA/7TKcBknTymOd5APT6PiAhghlmpHO8ocdw7CZqVkXour7Ycppriwsuy7koEgKQANDy+dPCIokQkhTiciFG4aJPy2mu6bq+OKtpWlXPmZWGtc2H77yOhOD+gxE7//T45sdHzEjQ7Y0IgmPeKszxwdUwTuM39Fyuomla9bTKyY27Gx/3+sMvlYU8lXqI36sef+1UkCS4pMZZyuu89oqL09gmHot8snpt9StZljtnYUqWN8vv10yzcCGV/ux/YFrTc7lK8UrxnizLnWdoPINzvlarLVl1K2879ktPcN5Ts2pV1/UHmqZVz+r/GwBWYYCoNUz0KwAAAABJRU5ErkJggg==");}.icon2{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAIuSURBVHjalJNBTBNBFIb/2S4tlliFdLBNW0mktibaeivBm9eejFeDZw81kROXHj2SyIEDB65wI3iBI5iYmEjSREtIpI1tQdOm20KBdkuX3ZnnYUVq2Cb6kklm3vxv3vdm3oCI4DTazZ3p3HpM5NZjot3cmR6kY0QEJ9vdnNJcaoMP3xyB3vI2EunP4046xcl5WttK99olHn4URSA2AaNT5qe1rbST1pFgd3NKU93H/P6TJADg8GthIMU1gqODtZlep8QjiegfXzBuUxwdrM1cy9Z/IVIYSn4jpe1vx8jsviAABIBM/Tl9/5Sg/EZKk8JQ+mP+ImiUVjJGp8xDDycB2b1KIgSC0RCMTpk3SisZxxKkpXvqhaXs7aAfnhtukBBXKmFCHVLgj4yjXljKSkv3XDugXlyeM/QKDz24CxIWSJhXBKYJMk2MT3AYeoXXi8tzl3sqAFgXLV+zvJrxhzkUqwdxQQARZl+FbbqeXY7CGHjEj2Z5NcMnXy6o7tEzRkT4mX/7Tisuvok/joBJC5ACl8/LmAIov0EVBZIYvn35gUD89UI4mZ1lRrca2N9+lh8bPeG3RgCyTEBKgAi+1CEAoJ27B6gqGGMAY2idCbRORhvxp++TanVvviaMQ/g8XshzAxACIIn+/pLGOWAqYIoLAODzuKB1K7y6N19j+Y0U3fG3MCw6IMsCyM4Oxvob1l4ze84YQ5u8OD7jUNWhMXz4uI//tx4Syfjg3/iv9msAKbs79bi84QcAAAAASUVORK5CYII=");}.icon3{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAANGSURBVHjadJNNTBwFAIW//UFWfrbsgDuzBTvu0s6OWhHwYMhCOEAbSESC4dpL07TFg9GkxIRDjT3YhEBNPUjC0SbaJjVNQyJQaxtDpzYmlDYUOjuUrhspO0N0gQVWl/0ZD5ZmPfiSd3t5l/c+h23bFCsajR7Rdf1GPBbHtEwAJFFCDsqoqno0HA7/WJx37BUkk8k6bUYb0g2jxy8G6kQpgK9KAGB9I4llJlizEiuqokxE2iJfCIKw8qIgmUzWTU1OfZXaSve9KQep3tzA9fQJhfhvZHd3yfl85OUg26F6os9W8FaWXevq7vpIEIQVJ4A2ow2lttJ9LTU1hH64Tt1qHHv8a0rnH/LS4iPsK9/iixnUXr1Ck3cfqa10nzajDQG4o9HoEd0wet493Ij/zm18n3yMJxQivbND7Px58thUD3xI+egoBcMgd+FLlO73mTUWe5Ro9Jqrs7Nz2eUu9YbSacriT8lms5Q3NlLR3s6uaVJQFISRC1SUuFm9dInJ6WlCfpGMFPBub6eOueOxOMobb+H4+Ta/f3cZz927FPJ5hOPHqRkZgT/+xFniIjY6yveDg0gOB9l6BbHpBMbiPE7TMvFVCWSXl3DU7secnWXu9GniFy+ymctRIfhYHxvj6pkzBG2bA0Du8SN8VQKmZeLc2zOXybA2P8+mbeNpbydTWUmJ203etvGIInV+PxVA9t/pXvzALYkS6xtJqoRq/rJtqoNB/KdO8Up/P+atWxSA8t5e3vN6mT55kgOrq5TUH2J9I4kkSjjloIxlJiiEDiK2tREYHkbq7yd57x6XOzr4paMD59IS+7q7+WB8nPtuNyVN72CZCeSgjFNV1dY1K6H9fbiBDWk/uwsL5G7e5JuWFhTgVUBrbmZX11memyMgv0a64W3WrISmqmqrw7ZtJq5PfP4sYZ0Nl5ayPjJM4fECKdtGAF5+bt3pxBt+HWXwU37NZKgNiOd6ens+27uyNDU5dTa1lR44JAXwPHiA/fA++ScGTsB1UMHV1MxOQyOGmcBbWTbW1d11ThAEsxgmSZvRBnTD6PCLgcj/wKSpivJTpC0yJgiC+R8ai3CO6Lp+NB6Lt5qWqTzH2ZCD8h1VVW+Ew2GtOP/PAFZGexs+cGPjAAAAAElFTkSuQmCC");}.itemBar{padding:7px;min-height:20px;margin-top:4px;margin-right:8px;width:auto;border-radius:8px;background-color:#7e7d74;cursor:pointer;}.computeritem{cursor:pointer;width:auto;border-radius:5px;background-color:#a6a5a0;height:28px;margin:4px;padding:2px;}.computeritem:hover{background-color:#83827b;}.us{-webkit-touch-callout:initial;-webkit-user-select:auto;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;}.rb{cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px;}.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;}.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;}.fsize{float:right;text-align:right;width:180px;}</style><body onunload="cleanup()"><div id=0 class=header><table id=1 cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td id=2 class=style6><div> <input type=button class=connectbutton id=xconnectbutton1 value=Connect onclick="connectButtonfunction(event, false)" onkeypress="return false" onkeydown="return false"> <span id=constatus></span></div></table><div class=progressbar><div id=3 style=height:2px;width:0%;background-color:red></div></div></div><div id=4 class=fullcell style=text-align:center;padding-top:100px;font-size:20px><span id=5>Disconnected</span></div><div id=6 style=height:100%;display:none><div id=7 class=navbar><br><p id=go1 class=nav1 onclick=go(1)><a>System Status</a><p id=go14 class=nav1 onclick=go(14)><a>Remote Desktop</a><p id=go24 class=nav1 onclick=go(24)> <a>Files</a><p id=go13 class=nav1 onclick=go(13)><a>Serial-over-LAN</a><p id=go2 class=nav1 onclick=go(2)><a>Hardware Information</a><p id=go6 class=nav1 onclick=go(6)><a>Event Log</a><p id=go15 class=nav1 onclick=go(15)><a>Audit Log</a><p id=go21 class=nav1 onclick=go(21)><a>Storage</a><p id=go8 class=nav1 onclick=go(8)><a>Network Settings</a><p id=go17 class=nav1 onclick=go(17)><a>Internet Settings</a><p id=go16 class=nav1 onclick=go(16)><a>Security Settings</a><p id=go19 class=nav1 onclick=go(19)><a>Agent Presence</a><p id=go18 class=nav1 onclick=go(18)><a>System Defense</a><p id=go11 class=nav1 onclick=go(11)><a>User Accounts</a><p id=go22 class=nav1 onclick=go(22)><a>Subscriptions</a><p id=go23 class=nav1 onclick=go(23)><a>Wake Alarms</a><p id=go20 class=nav1 onclick=go(20)><a>Script Editor</a><p id=go12 class=nav1 onclick=go(12)><a>WSMAN Browser</a></div><div id=8 class=maincell><div id=9 style=position:relative;height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none><div style=float:right><input id=IDERDiskMapButton type=button value="Disk Map" onclick=iderToggleDiskMap()><input type=button value="Stop IDE-R Session" onclick=iderStop()></div><div style=font-size:16px;padding-top:2px> <span id=10></span></div><div id=iderHeatmap style="z-index:1000;position:absolute;top:31px;right:8px;border:1px solid black;box-shadow:0px 0px 10px;border-radius:5px;padding:8px;width:600px;background-color:#99CC99;display:none"><div id=floppyHeatMap style=display:none><div id=floppyHeatMapText style=margin:2px>Floppy, blocks are 512 bytes.</div><canvas id=floppyHeatMapCanvas width=600 height=0></canvas></div><div id=cdromHeatMap style=display:none><div id=cdromHeatMapText style=margin:2px>CDROM, blocks are 2048 bytes.</div><canvas id=cdromHeatMapCanvas width=600 height=0></canvas></div></div></div><div id=11 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none;overflow:hidden><div style=float:right><input type=button value="Stop Script" onclick=script_Stop()></div><div style=font-size:16px;padding-top:2px;overflow:hidden> <b>Running Script</b><span style=overflow:hidden id=12></span></div></div><div id=13 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none><div style=font-size:16px;float:right;cursor:pointer;padding-right:5px;padding-left:5px;padding-top:2px;font-size:15px onclick="QV(13, false)">✖</div><div style=font-size:14px;padding-top:2px> <b>This computer's firmware should be updated, <a style=cursor:pointer href="https://security-center.intel.com/advisory.aspx?intelid=INTEL-SA-00075&languageid=en-fr" rel="noreferrer noopener" target="_blank"><u>please check here</u></a>.</b></div></div><div id=14 style=width:100%;height:100%><iframe id=15 style=width:100%;height:100%;border:0></iframe></div><div id=16 style=padding:8px;overflow-x:hidden><div id=p0><h1>Loading...</h1></div><div id=p1 style=display:none><h1>System Status</h1><span id=17></span></div><div id=p2 style=display:none><h1 style=margin-bottom:16px>Hardware Information</h1><span id=18></span></div><div id=p6 style=display:none><h1>Event Log</h1><span id=19></span><span id=20></span></div><div id=p8 style=display:none><h1>Network Settings</h1><span id=21></span><span id=22></span></div><div id=p11 style=display:none><h1>User Accounts</h1><span id=23></span></div><div id=p12 style=display:none><h1>WSMAN Browser</h1><div><table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><div style=padding:4px><select id=24 multiple="multiple" style=width:100%;height:120px></select></div><tr><td><input id=25 type=button value=Query style=margin:4px onclick=wsmanQuery()><input type=button value=Clear style=margin:4px onclick="QH(26, '')"><input id=c0 placeholder=Filter style=margin:4px onkeyup=wsmanFilter()></table></div><br><div class=us id=26></div></div><div id=p13 style=display:none;min-width:780px><h1>Serial-over-LAN Terminal</h1><br><div id=27 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 Serial-over-LAN feature is disabled<span id=28>, click here to enable it.</span></div></div><div id=29 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:#CCC><div style=float:right;text-align:right><input onkeyup=sendTermInputKeys(event) autocorrect=off autocapitalize=off style=opacity:0;width:0;height:0;font-size:1px onblur="keyInputBlur()"><span id=30></span> <div id=termRecordIcon title="Server is recording this session" style=display:none;float:right;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-right:4px></div><input type=button onkeypress="return false" onkeydown="return false" class=cadbutton value="Power Actions..." onclick=showPowerActionDlg() style=margin-right:3px><input type=button id=c1 value=SIDER title="Start server-side remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderServerStart() style=margin-right:3px><input type=button id=c2 value=IDER title="Start remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderStart(event) style=margin-right:3px><input id=c3 type=button onkeypress="return false" onkeydown="return false" class=cadbutton value="Start Capture" title="Toggle start/stop of terminal capture, when stopping the content of the capture buffer will be saved to a file." onclick=terminalCaptureToggle() style=margin-right:3px></div><div> <input type=button id=c4 value=Connect onclick=connectTerminal(event) disabled="disabled"> <span id=31>Disconnected.</span></div><tr><td style=background:#000;text-align:center><pre id=Term></pre><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div style=float:right;text-align:right><input id=32 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value=CR+LF title="Toggle what the return key will send" onclick=termToggleCr()><input id=33 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=80x25 title="Toggle terminal size" onclick=termToggleSize()><input id=34 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick=termToggleFx()><input id=35 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value="Extended Ascii" title="Toggle terminal emulation type" onclick=termToggleType()> </div><div> <input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Ctl-C onclick=termSendKey(3)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Ctl-X onclick=termSendKey(24)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=ESC onclick=termSendKey(27)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Backspace onclick=termSendKey(8)><input id=36 type=button onkeypress="return false" onkeydown="return false" class=cadbutton value=Paste disabled="disabled" onclick="setDialogMode(3,'Paste',3,termPaste)"></div></table></div><div id=p14 style=display:none;min-width:780px><div id=37><h1>Remote Desktop</h1><br></div><div id=38 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=39>, click here to enable it.</span></div></div><div id=40 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:#CCC><div style=float:right;text-align:right><span id=41></span> <div class=rb title="Rotate Left" onclick=drotate(-1)>↺</div><div class=rb title="Rotate Right" onclick=drotate(1)>↻</div><div id=deskRecordIcon title="Server is recording this session" style=display:none;float:right;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-right:4px></div><input id=c5 type=button title="Toggle full screen mode" onkeypress="return false" onkeydown="return false" value=Full onclick=deskToggleFull() style=margin-right:3px><input id=c6 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 type=button value=Settings... title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick=showDesktopSettings() style=margin-right:3px><input type=button id=c7 value=SIDER title="Start server-side remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderServerStart() style=margin-right:3px><input type=button id=c8 value=IDER title="Start remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderStart(event) 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></div><div><div id=c9 onclick=deskToggleFull() style=float:left;cursor:pointer;font-size:15px;display:none> ✖</div> <input type=button id=c10 value=Connect onclick=connectDesktop(event) onkeypress="return false" onkeydown="return false" disabled="disabled"> <span id=42>Disconnected.</span></div><tr><td id=43 style=background:black;text-align:center;position:relative><canvas id=Desk width=640 height=400 style=-ms-touch-action:none;margin-left:0px oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event) onmousewheel="dmousewheel(event)" moz-opaque=""></canvas><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div id=44 style=float:right></div><div> <span id=deskkeysspan><select style=margin-left:6px id=deskkeys><option value=0>Win<option value=1>Win+Down<option value=2>Win+Up<option value=3>Win+L<option value=4>Win+M<option value=20>Win+R<option value=23>Win+Left<option value=24>Win+Right<option value=5>Shift+Win+M<option value=19>Alt-Tab<option value=21>Alt-F4<option value=22>Ctrl-W<option value=6>F1<option value=7>F2<option value=8>F3<option value=9>F4<option value=10>F5<option value=11>F6<option value=12>F7<option value=13>F8<option value=14>F9<option value=15>F10<option value=16>F11<option value=17>F12</select><input id=DeskWD type=button value=Send onkeypress="return false" onkeydown="return false" onclick=deskSendKeys()> </span><input id=45 type=button value=Ctrl-Alt-Del onkeypress="return false" onkeydown="return false" onclick=sendCAD()> <input id=46 type=button value=Type onkeypress="return false" onkeydown="return false" onclick=deskShowTypeDialog()> <span id=47><input id=48 type=checkbox>Blank Screen </span><span id=49><input id=50 type=checkbox>View only </span></div></table></div><div id=p15 style=display:none><span id=51></span><h1>Audit Log</h1><span id=52></span></div><div id=p16 style=display:none><h1>Security Settings</h1><span id=53></span></div><div id=p17 style=display:none><h1>Internet Settings</h1><span id=54></span></div><div id=p18 style=display:none><h1>System Defense</h1><span id=55></span></div><div id=p19 style=display:none><h1>Agent Presence</h1><span id=56></span></div><div id=p20 style=display:none><h1>Script Editor</h1><div class=log1 style=padding:5px;border-radius:5px><div id=EditScriptStatus style=float:right;font-weight:bold;padding:5px>Stopped</div><div><input type=button value="View Editor" title="Switch to script line editor view" id=viewEditorButton onclick=scriptViewButton(0)><input type=button value="View Builder" title="Switch to block editor view" id=viewBuilderButton onclick=scriptViewButton(1)><input type=button value=New... title="Clear the script editor" onclick=script_newScriptDlg()><input type=button value=Load... title="Load a script from file" onclick=script_runScriptDlg()><input type=button value=Save... title="Save a script to file" onclick=script_saveScript(event)><input type=button value=Restart title="Compile the script and get ready to run it from the start" onclick=resetScriptButton()><input type=button value=Continue title="Run the script from the current execution point" onclick=runScriptButton()><input type=button value=Break title="Pause the execution of the script" onclick=breakScriptButton()><input type=button value=Step title="Execute one step of the script" onclick=stepScriptButton()></div></div><div id=scriptbuilder style=display:none><h2>Script Builder</h2><div style=padding:0;margin:0><div style=width:250px;height:400px;float:left;padding:0;margin:0;padding-right:3px><input id=blockfilter style="width:inherit;height:24px;padding:0;margin:0;border:1px solid gray;margin-bottom:1px" placeholder="Filter blocks..." onkeyup=script_fonfilterchanged()><div id=blocks style="width:inherit;height:373px;border:1px solid gray;overflow-y:scroll;padding:0;margin:0"></div></div><div id=scriptblocks style="width:auto;height:400px;padding:0;margin:0;border:1px solid gray;overflow-y:scroll" ondrop="script_fondrop(event, this)" onclick=script_fonclick(event)></div></div></div><div id=scripteditor><h2>Script</h2><textarea id=scriptarea style=width:100%;height:176px;resize:vertical;margin:0;padding:0;font-family:Arial,Helvetica,sans-serif spellcheck="false"></textarea><div style=display:none><br><h2>Compiled Script</h2><textarea id=compiledarea style=width:100%;height:16px;resize:vertical;margin:0;padding:0 spellcheck="false"></textarea><br></div><h2>Variables</h2><div id=variables style="width:100%;height:200px;resize:vertical;border:1px solid gray;overflow:scroll;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text"></div></div><h2>Console</h2><textarea id=console style=width:100%;height:80px;resize:vertical;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text readonly=""></textarea></div><div id=p21 style=display:none><h1>Storage</h1><span id=57></span></div><div id=p22 style=display:none><h1>Event Subscriptions</h1><span id=58></span></div><div id=p23 style=display:none><h1>Wake Alarms</h1><span id=59></span></div><div id=p24 style=display:none;position:absolute;top:0px;bottom:0px;left:8px;right:24px><h1>Files</h1><br><table id=p24toolbar style=width:100%;position:absolute;top:35px cellpadding=0 cellspacing=0><tr><td style=width:100%;background-color:#d3d9d6;text-align:left;padding:4px valign="bottom"><div id=p24rightOfButtons style=float:right;margin-top:3px></div><div><input type=button id=p24FolderUp disabled="disabled" onclick=p24folderup() value=Up> <input type=button id=p24SelectAllButton disabled="disabled" onclick=p24selectallfile() value="Select All" onkeypress="return false" onkeydown="return false"> <input type=button id=p24RenameFileButton disabled="disabled" value=Rename onclick=p24renamefile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24DeleteFileButton disabled="disabled" value=Delete onclick=p24deletefile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24NewFolderButton disabled="disabled" value="New Folder" onclick=p24createfolder() onkeypress="return false" onkeydown="return false"> <input type=button id=p24UploadButton disabled="disabled" value=Upload onclick=p24uploadFile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24CutButton disabled="disabled" value=Cut onclick=p24copyFile(1) onkeypress="return false" onkeydown="return false"> <input type=button id=p24CopyButton disabled="disabled" value=Copy onclick=p24copyFile(0) onkeypress="return false" onkeydown="return false"> <input type=button id=p24PasteButton disabled="disabled" value=Paste onclick=p24pasteFile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24RefreshButton disabled="disabled" value=Refresh onclick=p24folderup(9999) onkeypress="return false" onkeydown="return false"> </div><tr><td style=background-color:#E4E9E7;height:28px><div style=float:right;margin-right:4px><select id=p24sortdropdown onchange=p24updateFiles()><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=p24currentpath></span></div></table><div id=p24filetable style=width:100%;overflow:auto;-webkit-user-select:none;position:absolute;top:92px;bottom:30px><div id=p24bigok style=width:256px;overflow:hidden;position:absolute;top:80px;width:100%;text-align:center;font-size:1600%;color:#AAAAAA;display:none><b>✓</b></div><div id=p24bigfail style=width:256px;overflow:hidden;position:absolute;top:80px;width:100%;text-align:center;font-size:1600%;color:#AAAAAA;display:none><b>✗</b></div><span id=p24files></span></div><table id=p24toolbarBottom style=width:100%;position:absolute;bottom:10px cellpadding=0 cellspacing=0><tr><td style=text-align:left;padding:3px;text-align:center;background-color:#D3D9D6> <span id=p24bottomstatus></span></table></div></div></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;overflow:auto;top:75px;width:400px;max-height:550px;display:none"><div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"><div id=60 style=float:right;padding:1px;margin-right:5px;cursor:pointer;font-size:15px onclick=setDialogMode()>✖</div><div id=61 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=62 style=padding:10px></div></div><div id=dialog2 style=margin:auto;margin:3px><br><div style=height:26px><input id=d2username style=float:right;width:200px onkeyup=updateAccountDialog()><div>Username</div></div><div style=height:26px><input id=d2password1 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Password*</div></div><div style=height:26px><input id=d2password2 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Confirm Password</div></div><div id=63><div style=height:26px><select id=d2permission style=float:right;width:200px><option value=0>Local<option value=1>Network<option value=2>Any</select><div>Permission</div></div><div>Granted Permissions</div><ul id=64 style="list-style-type:none;height:100px;overflow:auto;width:100%;border:1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0"></ul></div><div style=font-size:10px><br>*Minimum 8 characters with upper, lowercase, 0-9, and one of !@#$%^&*()+-</div></div><div id=dialog3 style=margin:auto;text-align:center;margin:3px><textarea id=d3pastetextarea maxlength="4096" style=width:100%;height:200px;resize:none></textarea></div><div id=dialog5 style=margin:auto;margin:3px><br><div style=height:26px><select id=d5actionSelect style=float:right;width:200px></select><div>Power Action</div></div><div><span style=color:red>Warning:</span>Some power actions may result in data loss and may disconnect the desktop, terminal or disk redirection sessions.</div></div><div id=dialog6 style=margin:auto;margin:3px><br><div style=height:26px><input id=d6ConsentText style=float:right;width:200px maxlength="6" onkeyup=consentChanged() onkeypress="return numbersOnly(event)"><div>Consent Code</div></div><div style=height:26px><select id=d6Display onchange=changeConsentDisplay() style=float:right;width:200px><option value=0>Primary display<option value=1>Secondary display<option id=d6ThirdDisplay value=2 style=display:none>Third display</select><div>Consent Display</div></div></div><div id=dialog7 style=margin:auto;margin:3px><br><div style=height:26px><select id=c11 style=float:right;width:200px><option value=1>RLE8, Color Fast<option value=2>RLE16, Color<option id=d7gray4 value=5>RLE4G, Gray Fastest<option id=d7gray8 value=6>RLE8G, Gray Fast<option value=3>RAW8, Color Slow<option value=4>RAW16, Color Very Slow</select><div>Image Encoding</div></div><div style=height:80px><div style="float:right;border:1px solid #666;width:200px;height:80px;overflow-y:scroll;background-color:white"><label><input type=checkbox id=d7showcursor>Show Local Mouse Cursor</label><br><label><input type=checkbox id=d7showcad>Show Ctrl-Alt-Del</label><br><label><input type=checkbox id=d7limitFrameRate>Limit Frame Rate</label><br><label><input type=checkbox id=d7noMouseRotate>Don't Rotate Mouse</label><br></div><div>Other Settings</div></div><div id=d7softkvmsettings style=display:none><h4 style="width:100%;border-bottom:1px solid gray">Software KVM</h4><div style="margin:3px 0 3px 0"><select id=d7bitmapquality style=float:right;width:200px;height:20px dir="rtl"><option value=50>50%<option value=40>40%<option selected="selected" value=30>30%<option value=20>20%<option value=10>10%<option value=5>5%<option value=1>1%</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></div><div id=dialog8 style=display:table;margin:3px><div style="margin:3px 0 3px 0;padding-top:5px"><input id=c12 value=admin style=float:right;width:220px><div style=height:20px>Username</div></div><div style="margin:3px 0 3px 0"><input id=c13 type=password autocomplete="off" style=float:right;width:220px><div style=height:20px>Password</div></div></div><div id=dialog9 style=margin:auto;margin:3px><label><input type=checkbox id=c14>Redirection Port</label><br><div id=c15><label><input type=checkbox id=c16>KVM Remote Desktop</label><br></div><label><input type=checkbox id=c17>IDE-Redirection<br></label><label><input type=checkbox id=c18>Serial-over-LAN<br></label></div><div id=dialog10 style=margin:auto;margin:3px><label><input type=radio name=d10 id=c19 value=0>Not Required<br></label><label><input type=radio name=d10 id=c20 value=1>Required for KVM only<br></label><label><input type=radio name=d10 id=c21 value=4294967295>Always Required<br></label></div><div id=dialog11 style=margin:auto;margin:3px><div id=65></div></div><div id=dialog12 style=margin:auto;margin:3px><br><div style=height:26px><input id=c22 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">Profile Name</div></div><div style=height:26px><input id=c23 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">SSID</div></div><div style=height:26px><select id=c24 style=float:right;width:200px onclick=updateWifiDialog()></select><div>Priority</div></div><div style=height:26px><select id=c25 style=float:right;width:200px onclick=updateWifiDialog()><option value=6>WPA2 PSK<option value=4>WPA PSK</select><div>Authentication</div></div><div style=height:26px><select id=c26 style=float:right;width:200px onclick=updateWifiDialog()><option id=66 value=4>CCMP-AES<option id=67 value=3>TKIP-RC4<option id=68 value=2>WEP<option id=69 value=5>None</select><div>Encryption</div></div><div style=height:26px><input id=c27 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Password*</div></div><div style=height:26px><input id=c28 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Confirm Password</div></div></div><div id=dialog19 style=margin:auto;margin:3px>This will save the entire state of Intel® AMT for this machine into file. Passwords will not be saved, but some sensitive data may be included.<br><br><input id=c29 style=width:100% value=amtstate.json></div><div id=dialog20 style=margin:auto;margin:3px><input type=radio name=d20 id=d20a value=0>Disabled<br><input type=radio name=d20 id=d20b value=1>ICMP response<br><input type=radio name=d20 id=d20c value=2>RMCP response<br><input type=radio name=d20 id=d20d value=3>ICMP & RMCP response<br><br></div><div id=dialog21 style=margin:auto;margin:3px><div id=70><label><input type=checkbox name=d21 id=d21ipsync onclick=updateIPSetupDlg()>Operating system IP address sync</label><br></div><input type=radio name=d21 id=d21o0 onclick=updateIPSetupDlg()><span id=d21l0></span><br><input type=radio name=d21 id=d21o1 onclick=updateIPSetupDlg()><span id=d21l1></span><br><div id=71><input type=radio name=d21 id=d21o2 onclick=updateIPSetupDlg()><span id=d21l2></span><br><br><div style=margin-left:20px><div style=height:26px><input id=c30 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>IP address</div></div><div style=height:26px id=72><input id=c31 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Subnet mark</div></div><div style=height:26px><input id=c32 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Gateway</div></div><div style=height:26px><input id=c33 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Primary DNS</div></div><div style=height:26px><input id=c34 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Alternate DNS</div></div></div></div></div><div id=dialog23 style=margin:auto;margin:3px><br><div style=height:26px><select id=c35 style=float:right;width:200px onchange=showEditDnsDlgChange()><option value=0>Disabled<option value=1>Disabled, DHCP update<option value=2>Enabled</select><div>Dynamic DNS client</div></div><div style=height:26px><input id=c36 style=float:right;width:200px><div>Update Interval (minutes)</div></div><div style=height:26px><input id=c37 style=float:right;width:200px><div>TTL (seconds)</div></div><div style=font-size:10px><br>Defaut Interval is 1440 minutes, Default TTL is 900 seconds.</div></div><div id=dialog24 style=margin:auto;margin:3px><br><div style=height:26px><select id=c38 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=2>Power up<option value=5>Power cycle<option value=8>Power down<option value=10>Reset<option id=d24p500 value=500>OS Wake from Standby<option id=d24p501 value=501>OS Power Saving<option value=999>Set boot options</select><div>Remote Command</div></div><div style=height:80px><div id=c39 style="float:right;border:1px solid #666;width:200px;height:72px;overflow-y:scroll;background-color:white"><div id=d24dBiosPause><label><input type=checkbox id=d24BiosPause onchange=showAdvPowerDlgChange()>BIOS Pause</label><br></div><div id=d24dBiosSecureBoot><label><input type=checkbox id=d24BiosSecureBoot onchange=showAdvPowerDlgChange()>Enforce Secure Boot</label><br></div><div id=d24dBiosSetup><label><input type=checkbox id=d24BiosSetup onchange=showAdvPowerDlgChange()>BIOS Setup</label><br></div><div id=d24dForceProgressEvents><label><input type=checkbox id=d24ForceProgressEvents onchange=showAdvPowerDlgChange()>Force progress events</label><br></div><div id=d24dLockPowerButton><label><input type=checkbox id=d24LockPowerButton onchange=showAdvPowerDlgChange()>Lock power button</label><br></div><div id=d24dLockResetButton><label><input type=checkbox id=d24LockResetButton onchange=showAdvPowerDlgChange()>Lock reset button</label><br></div><div id=d24dLockSleepButton><label><input type=checkbox id=d24LockSleepButton onchange=showAdvPowerDlgChange()>Lock sleep button</label><br></div><div id=d24dLockKeyboard><label><input type=checkbox id=d24LockKeyboard onchange=showAdvPowerDlgChange()>Lock keyboard</label><br></div><div id=d24dUserPasswordBypass><label><input type=checkbox id=d24UserPasswordBypass onchange=showAdvPowerDlgChange()>BIOS password bypass</label><br></div><div id=d24dReflashBios><label><input type=checkbox id=d24ReflashBios onchange=showAdvPowerDlgChange()>Reflash BIOS</label><br></div><div id=d24dSafeMode><label><input type=checkbox id=d24SafeMode onchange=showAdvPowerDlgChange()>Safe mode</label><br></div><div id=d24dUseIDER><label><input type=checkbox id=d24UseIDER onchange=showAdvPowerDlgChange()>Use IDER</label><br></div><div id=d24dSerialOverLan><label><input type=checkbox id=d24SerialOverLan onchange=showAdvPowerDlgChange()>Serial-over-LAN</label><br></div><div id=d24dSecureErase><label><input type=checkbox id=d24SecureErase onchange=showAdvPowerDlgChange()>Intel® Remote Secure Erase</label><br></div></div><div>Boot Settings</div></div><div style=height:26px><select id=c40 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option value=1>Force CD/DVD Boot<option value=2>Force PXE Boot<option value=3>Force Hard Disk Boot<option value=4>Force Diagnostic Boot</select><div>Boot Source</div></div><div style=height:26px><select id=c41 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option value=1>Index 1<option value=2>Index 2<option value=3>Index 3<option value=3>Index 4</select><div>Boot Media Index</div></div><div style=height:26px id=idd_d24IDERBootDevice><select id=c42 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>Boot to floppy<option value=1>Boot to CDROM</select><div>IDER Boot Device</div></div><div style=height:26px><select id=c43 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>System Default<option id=c44 value=1>Quiet<option id=c45 value=2>Verbose<option id=c46 value=3>Blank Screen</select><div>Verbocity</div></div><div style=height:26px id=idd_d24RSEPass><div style=float:right;width:200px><input type=password id=d24rsepass maxlength="32" style=float:right;width:100%></div><div>RSE Password</div></div></div><div id=dialog25 style=margin:auto;margin:3px><div style=text-align:left><div style=height:26px;margin-top:4px><input id=d25alarm_name style=float:right;width:180px maxlength="32" onkeyup=alertDialogUpdate()><div style=padding-top:4px>Alarm name</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_sdate style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Wake date (year-month-day)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_stime style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,58)"></div><div style=padding-top:4px>Wake time (hour:min:sec)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_interval style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Interval (days-hours-min)</div></div><div style=height:26px;margin-top:4px><div style=float:right;width:180px><select id=d25alarm_doc style=width:100% onchange=showAdvPowerDlgChange()><option value=0>Keep alarm<option value=1>Delete on completion</select></div><div style=padding-top:4px>After wake</div></div></div></div></div><div style=padding:10px;margin-bottom:4px><input id=c47 type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)><input id=c48 type=button value=OK style=float:right;width:80px onclick=dialogclose(1)><div style=height:25px><input id=c49 type=button value=Delete style=width:80px;display:none onclick=dialogclose(2)></div></div></div><script>var $jscomp={scope:{},getGlobal:function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global?global:b}};$jscomp.global=$jscomp.getGlobal(this);$jscomp.initSymbol=function(){$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol);$jscomp.initSymbol=function(){}};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(b){return"jscomp_symbol_"+b+$jscomp.symbolCounter_++};
1
+<!DOCTYPE html><html style=height:100%><head><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8" http-equiv=Content-Type><meta name=format-detection content="telephone=no"><link rel="icon" type=image/png href="data:image/png;base64,iVBORw0KGgo="><style>body{height:100%;max-height:100%;overflow:hidden;font-family:arial, helvetica, sans-serif;font-size:9pt;color:black;background:white;margin-top:0;margin-left:0;margin-right:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}li{margin:0;padding:0;}label{display:block;color:windowtext;background-color:window;margin:0;padding:0;width:100%;}label:hover{background-color:highlight;color:highlighttext;}a:visited{text-decoration:none;color:#04f;}a:link{text-decoration:none;color:#04f;}a:hover{color:#a32;}h1{font-size:11pt;font-weight:bold;color:black;margin-left:5px;margin-top:10px;margin-bottom:6px;}h2{font-size:9pt;font-weight:bold;color:black;margin-left:6px;margin-top:6px;margin-bottom:0;}p{margin-left:6px;margin-top:4px;margin-bottom:0;margin-right:2px;}td{font-size:9pt;}th{font-size:9pt;}th:hover{cursor:pointer;background:#aaa;}.header{position:fixed;top:0;left:0;right:0;height:24px;background:#c0c0c0;}.progressbar{position:fixed;top:24px;left:0;right:0;height:2px;background:#ff9e30;}.in{margin-left:40px;}.log{background:#bbbab5;}.log1{background:#bbbab5;}.log tbody tr:nth-child(odd){background:#e8eefe;}.fullcell{position:fixed;top:26px;right:0;bottom:0;left:0px;overflow:hidden;}.maincell{position:fixed;top:26px;right:0;bottom:0;left:156px;overflow:auto;padding-left:2px;vertical-align:top;}.navbar{position:fixed;top:26px;left:0;bottom:0;width:156px;border-right:2px solid #ff9e30;vertical-align:top;background:#72726f;background:linear-gradient(45deg, #72726f 0%,#a6a5a0 100%);}.nav1{padding:1px 0px 1px 8px;margin:0px;font-weight:bold;color:black;white-space:nowrap;cursor:pointer;}.nav2{margin-left:32px;margin-top:0;color:black;cursor:pointer;}.r{font-size:11pt;}.r0{background:white;}.r1{border-bottom:1px solid gray;text-align:left;}.r2{text-align:left;}.r3{border-bottom:1px solid gray;text-align:left;}.r3:hover{background-color:#83827b;cursor:pointer;}.spread{height:100%;width:100%;background-color:white;}.timer{border:1px solid #abcae1;background-color:#abcae1;}.tm{font-size:7pt;}.top1{font-size:14pt;font-weight:bold;color:white;margin-top:11px;}.top2{color:white;}.warn{font-weight:bold;color:#c00000;}.icon1{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAMISURBVHjadJPPb9t0GMY//rbJaEKSxoPFQQ1WxhQ7RaGoIDEpTBMqgk7iBvwNKJdJXDnssEMl7pMGfwOH9YBYh0AglYiBBNKa0cSGNpiRxs7aJE2aH7aTmkPXqTvwXt7L8z56pef5SEEQcHYMwyjWarX3rLr1tu3YOQAlpZhqVv1J1/VvNU0rn9VLpwbtdlspb5ZLNdNcuZBKF1NKmuS8DECn28axm7ScZlnP5b4vXinelmXZfmrQbreVjbsbN3r9YSmTLbA/Ps92K8FgFAbAdYcsLXRRk10af/9BPBa5vXpt9aYsy7YAKG+WS73+sJS+eJmKneZe5QWEiHHreoJb1xNEInHu/Bzw3cM45zNv0usPS+XNcglAGIZRrJnmSiZbYOtRhF93ZvHcHoPRlN3GkL4Ho5HHeOxRqbv8sHVM+uVFaqa5YhhGUVpfXw+6hwP86DJ3fgkzK44hOGZuLkH7KIQIxuw9dkk812Hqu0wmPh9djZIKG8wnogirbpFS0jy0YOqPcMcurjvh3Vc7fPHpHF9//iLLyja75p/sNWxazj73t9qklDRW3ULYjk1yXmb3Xw/P9fA9n35/AMD0yAIgGQ8zOtxnMhFM/ClG/YjkvIzt2Mye5un5Lr4HY9el5RwA2tOsY9FzCCFBICCYOdlPRigphU63jZKEwWDAweMDJt7kmXINBhOkIEAQQiLMpczzJzcpBaFmVRy7iZ4RdA/7TKcBknTymOd5APT6PiAhghlmpHO8ocdw7CZqVkXour7Ycppriwsuy7koEgKQANDy+dPCIokQkhTiciFG4aJPy2mu6bq+OKtpWlXPmZWGtc2H77yOhOD+gxE7//T45sdHzEjQ7Y0IgmPeKszxwdUwTuM39Fyuomla9bTKyY27Gx/3+sMvlYU8lXqI36sef+1UkCS4pMZZyuu89oqL09gmHot8snpt9StZljtnYUqWN8vv10yzcCGV/ux/YFrTc7lK8UrxnizLnWdoPINzvlarLVl1K2879ktPcN5Ts2pV1/UHmqZVz+r/GwBWYYCoNUz0KwAAAABJRU5ErkJggg==");}.icon2{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAIuSURBVHjalJNBTBNBFIb/2S4tlliFdLBNW0mktibaeivBm9eejFeDZw81kROXHj2SyIEDB65wI3iBI5iYmEjSREtIpI1tQdOm20KBdkuX3ZnnYUVq2Cb6kklm3vxv3vdm3oCI4DTazZ3p3HpM5NZjot3cmR6kY0QEJ9vdnNJcaoMP3xyB3vI2EunP4046xcl5WttK99olHn4URSA2AaNT5qe1rbST1pFgd3NKU93H/P6TJADg8GthIMU1gqODtZlep8QjiegfXzBuUxwdrM1cy9Z/IVIYSn4jpe1vx8jsviAABIBM/Tl9/5Sg/EZKk8JQ+mP+ImiUVjJGp8xDDycB2b1KIgSC0RCMTpk3SisZxxKkpXvqhaXs7aAfnhtukBBXKmFCHVLgj4yjXljKSkv3XDugXlyeM/QKDz24CxIWSJhXBKYJMk2MT3AYeoXXi8tzl3sqAFgXLV+zvJrxhzkUqwdxQQARZl+FbbqeXY7CGHjEj2Z5NcMnXy6o7tEzRkT4mX/7Tisuvok/joBJC5ACl8/LmAIov0EVBZIYvn35gUD89UI4mZ1lRrca2N9+lh8bPeG3RgCyTEBKgAi+1CEAoJ27B6gqGGMAY2idCbRORhvxp++TanVvviaMQ/g8XshzAxACIIn+/pLGOWAqYIoLAODzuKB1K7y6N19j+Y0U3fG3MCw6IMsCyM4Oxvob1l4ze84YQ5u8OD7jUNWhMXz4uI//tx4Syfjg3/iv9msAKbs79bi84QcAAAAASUVORK5CYII=");}.icon3{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAANGSURBVHjadJNNTBwFAIW//UFWfrbsgDuzBTvu0s6OWhHwYMhCOEAbSESC4dpL07TFg9GkxIRDjT3YhEBNPUjC0SbaJjVNQyJQaxtDpzYmlDYUOjuUrhspO0N0gQVWl/0ZD5ZmPfiSd3t5l/c+h23bFCsajR7Rdf1GPBbHtEwAJFFCDsqoqno0HA7/WJx37BUkk8k6bUYb0g2jxy8G6kQpgK9KAGB9I4llJlizEiuqokxE2iJfCIKw8qIgmUzWTU1OfZXaSve9KQep3tzA9fQJhfhvZHd3yfl85OUg26F6os9W8FaWXevq7vpIEIQVJ4A2ow2lttJ9LTU1hH64Tt1qHHv8a0rnH/LS4iPsK9/iixnUXr1Ck3cfqa10nzajDQG4o9HoEd0wet493Ij/zm18n3yMJxQivbND7Px58thUD3xI+egoBcMgd+FLlO73mTUWe5Ro9Jqrs7Nz2eUu9YbSacriT8lms5Q3NlLR3s6uaVJQFISRC1SUuFm9dInJ6WlCfpGMFPBub6eOueOxOMobb+H4+Ta/f3cZz927FPJ5hOPHqRkZgT/+xFniIjY6yveDg0gOB9l6BbHpBMbiPE7TMvFVCWSXl3DU7secnWXu9GniFy+ymctRIfhYHxvj6pkzBG2bA0Du8SN8VQKmZeLc2zOXybA2P8+mbeNpbydTWUmJ203etvGIInV+PxVA9t/pXvzALYkS6xtJqoRq/rJtqoNB/KdO8Up/P+atWxSA8t5e3vN6mT55kgOrq5TUH2J9I4kkSjjloIxlJiiEDiK2tREYHkbq7yd57x6XOzr4paMD59IS+7q7+WB8nPtuNyVN72CZCeSgjFNV1dY1K6H9fbiBDWk/uwsL5G7e5JuWFhTgVUBrbmZX11memyMgv0a64W3WrISmqmqrw7ZtJq5PfP4sYZ0Nl5ayPjJM4fECKdtGAF5+bt3pxBt+HWXwU37NZKgNiOd6ens+27uyNDU5dTa1lR44JAXwPHiA/fA++ScGTsB1UMHV1MxOQyOGmcBbWTbW1d11ThAEsxgmSZvRBnTD6PCLgcj/wKSpivJTpC0yJgiC+R8ai3CO6Lp+NB6Lt5qWqTzH2ZCD8h1VVW+Ew2GtOP/PAFZGexs+cGPjAAAAAElFTkSuQmCC");}.itemBar{padding:7px;min-height:20px;margin-top:4px;margin-right:8px;width:auto;border-radius:8px;background-color:#7e7d74;cursor:pointer;}.computeritem{cursor:pointer;width:auto;border-radius:5px;background-color:#a6a5a0;height:28px;margin:4px;padding:2px;}.computeritem:hover{background-color:#83827b;}.us{-webkit-touch-callout:initial;-webkit-user-select:auto;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;}.rb{cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px;}.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;}.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;}.fsize{float:right;text-align:right;width:180px;}</style><body onunload="cleanup()"><div id=0 class=header><table id=1 cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td id=2 class=style6><div> <input type=button class=connectbutton id=xconnectbutton1 value=Connect onclick="connectButtonfunction(event, false)" onkeypress="return false" onkeydown="return false"> <span id=constatus></span></div></table><div class=progressbar><div id=3 style=height:2px;width:0%;background-color:red></div></div></div><div id=4 class=fullcell style=text-align:center;padding-top:100px;font-size:20px><span id=5>Disconnected</span></div><div id=6 style=height:100%;display:none><div id=7 class=navbar><br><p id=go1 class=nav1 onclick=go(1)><a>System Status</a><p id=go14 class=nav1 onclick=go(14)><a>Remote Desktop</a><p id=go24 class=nav1 onclick=go(24)> <a>Files</a><p id=go13 class=nav1 onclick=go(13)><a>Serial-over-LAN</a><p id=go2 class=nav1 onclick=go(2)><a>Hardware Information</a><p id=go6 class=nav1 onclick=go(6)><a>Event Log</a><p id=go15 class=nav1 onclick=go(15)><a>Audit Log</a><p id=go21 class=nav1 onclick=go(21)><a>Storage</a><p id=go8 class=nav1 onclick=go(8)><a>Network Settings</a><p id=go17 class=nav1 onclick=go(17)><a>Internet Settings</a><p id=go16 class=nav1 onclick=go(16)><a>Security Settings</a><p id=go19 class=nav1 onclick=go(19)><a>Agent Presence</a><p id=go18 class=nav1 onclick=go(18)><a>System Defense</a><p id=go11 class=nav1 onclick=go(11)><a>User Accounts</a><p id=go22 class=nav1 onclick=go(22)><a>Subscriptions</a><p id=go23 class=nav1 onclick=go(23)><a>Wake Alarms</a><p id=go20 class=nav1 onclick=go(20)><a>Script Editor</a><p id=go12 class=nav1 onclick=go(12)><a>WSMAN Browser</a></div><div id=8 class=maincell><div id=9 style=position:relative;height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none><div style=float:right><input id=IDERDiskMapButton type=button value="Disk Map" onclick=iderToggleDiskMap()><input type=button value="Stop IDE-R Session" onclick=iderStop()></div><div style=font-size:16px;padding-top:2px> <span id=10></span></div><div id=iderHeatmap style="z-index:1000;position:absolute;top:31px;right:8px;border:1px solid black;box-shadow:0px 0px 10px;border-radius:5px;padding:8px;width:600px;background-color:#99CC99;display:none"><div id=floppyHeatMap style=display:none><div id=floppyHeatMapText style=margin:2px>Floppy, blocks are 512 bytes.</div><canvas id=floppyHeatMapCanvas width=600 height=0></canvas></div><div id=cdromHeatMap style=display:none><div id=cdromHeatMapText style=margin:2px>CDROM, blocks are 2048 bytes.</div><canvas id=cdromHeatMapCanvas width=600 height=0></canvas></div></div></div><div id=11 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none;overflow:hidden><div style=float:right><input type=button value="Stop Script" onclick=script_Stop()></div><div style=font-size:16px;padding-top:2px;overflow:hidden> <b>Running Script</b><span style=overflow:hidden id=12></span></div></div><div id=13 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none><div style=font-size:16px;float:right;cursor:pointer;padding-right:5px;padding-left:5px;padding-top:2px;font-size:15px onclick="QV(13, false)">✖</div><div style=font-size:14px;padding-top:2px> <b>This computer's firmware should be updated, <a style=cursor:pointer href="https://security-center.intel.com/advisory.aspx?intelid=INTEL-SA-00075&languageid=en-fr" rel="noreferrer noopener" target="_blank"><u>please check here</u></a>.</b></div></div><div id=14 style=width:100%;height:100%><iframe id=15 style=width:100%;height:100%;border:0></iframe></div><div id=16 style=padding:8px;overflow-x:hidden><div id=p0><h1>Loading...</h1></div><div id=p1 style=display:none><h1>System Status</h1><span id=17></span></div><div id=p2 style=display:none><h1 style=margin-bottom:16px>Hardware Information</h1><span id=18></span></div><div id=p6 style=display:none><h1>Event Log</h1><span id=19></span><span id=20></span></div><div id=p8 style=display:none><h1>Network Settings</h1><span id=21></span><span id=22></span></div><div id=p11 style=display:none><h1>User Accounts</h1><span id=23></span></div><div id=p12 style=display:none><h1>WSMAN Browser</h1><div><table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><div style=padding:4px><select id=24 multiple="multiple" style=width:100%;height:120px></select></div><tr><td><input id=25 type=button value=Query style=margin:4px onclick=wsmanQuery()><input type=button value=Clear style=margin:4px onclick="QH(26, '')"><input id=c0 placeholder=Filter style=margin:4px onkeyup=wsmanFilter()></table></div><br><div class=us id=26></div></div><div id=p13 style=display:none;min-width:780px><h1>Serial-over-LAN Terminal</h1><br><div id=27 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 Serial-over-LAN feature is disabled<span id=28>, click here to enable it.</span></div></div><div id=29 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:#CCC><div style=float:right;text-align:right><input onkeyup=sendTermInputKeys(event) autocorrect=off autocapitalize=off style=opacity:0;width:0;height:0;font-size:1px onblur="keyInputBlur()"><span id=30></span> <div id=termRecordIcon title="Server is recording this session" style=display:none;float:right;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-right:4px></div><input type=button onkeypress="return false" onkeydown="return false" class=cadbutton value="Power Actions..." onclick=showPowerActionDlg() style=margin-right:3px><input type=button id=c1 value=SIDER title="Start server-side remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderServerStart() style=margin-right:3px><input type=button id=c2 value=IDER title="Start remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderStart(event) style=margin-right:3px><input id=c3 type=button onkeypress="return false" onkeydown="return false" class=cadbutton value="Start Capture" title="Toggle start/stop of terminal capture, when stopping the content of the capture buffer will be saved to a file." onclick=terminalCaptureToggle(event) style=margin-right:3px></div><div> <input type=button id=c4 value=Connect onclick=connectTerminal(event) disabled="disabled"> <span id=31>Disconnected.</span></div><tr><td style=background:#000;text-align:center><pre id=Term></pre><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div style=float:right;text-align:right><input id=32 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value=CR+LF title="Toggle what the return key will send" onclick=termToggleCr()><input id=33 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=80x25 title="Toggle terminal size" onclick=termToggleSize()><input id=34 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick=termToggleFx()><input id=35 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value="Extended Ascii" title="Toggle terminal emulation type" onclick=termToggleType()> </div><div> <input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Ctl-C onclick=termSendKey(3)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Ctl-X onclick=termSendKey(24)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=ESC onclick=termSendKey(27)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Backspace onclick=termSendKey(8)><input id=36 type=button onkeypress="return false" onkeydown="return false" class=cadbutton value=Paste disabled="disabled" onclick="setDialogMode(3,'Paste',3,termPaste)"></div></table></div><div id=p14 style=display:none;min-width:780px><div id=37><h1>Remote Desktop</h1><br></div><div id=38 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=39>, click here to enable it.</span></div></div><div id=40 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:#CCC><div style=float:right;text-align:right><span id=41></span> <div class=rb title="Rotate Left" onclick=drotate(-1)>↺</div><div class=rb title="Rotate Right" onclick=drotate(1)>↻</div><div id=deskRecordIcon title="Server is recording this session" style=display:none;float:right;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-right:4px></div><input id=c5 type=button title="Toggle full screen mode" onkeypress="return false" onkeydown="return false" value=Full onclick=deskToggleFull() style=margin-right:3px><input id=c6 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 type=button value=Settings... title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick=showDesktopSettings() style=margin-right:3px><input type=button id=c7 value=SIDER title="Start server-side remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderServerStart() style=margin-right:3px><input type=button id=c8 value=IDER title="Start remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderStart(event) 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></div><div><div id=c9 onclick=deskToggleFull() style=float:left;cursor:pointer;font-size:15px;display:none> ✖</div> <input type=button id=c10 value=Connect onclick=connectDesktop(event) onkeypress="return false" onkeydown="return false" disabled="disabled"> <span id=42>Disconnected.</span></div><tr><td id=43 style=background:black;text-align:center;position:relative><canvas id=Desk width=640 height=400 style=-ms-touch-action:none;margin-left:0px oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event) onmousewheel="dmousewheel(event)" moz-opaque=""></canvas><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div id=44 style=float:right></div><div> <span id=deskkeysspan><select style=margin-left:6px id=deskkeys><option value=0>Win<option value=1>Win+Down<option value=2>Win+Up<option value=3>Win+L<option value=4>Win+M<option value=20>Win+R<option value=23>Win+Left<option value=24>Win+Right<option value=5>Shift+Win+M<option value=19>Alt-Tab<option value=21>Alt-F4<option value=22>Ctrl-W<option value=6>F1<option value=7>F2<option value=8>F3<option value=9>F4<option value=10>F5<option value=11>F6<option value=12>F7<option value=13>F8<option value=14>F9<option value=15>F10<option value=16>F11<option value=17>F12</select><input id=DeskWD type=button value=Send onkeypress="return false" onkeydown="return false" onclick=deskSendKeys()> </span><input id=45 type=button value=Ctrl-Alt-Del onkeypress="return false" onkeydown="return false" onclick=sendCAD()> <input id=46 type=button value=Type onkeypress="return false" onkeydown="return false" onclick=deskShowTypeDialog()> <span id=47><input id=48 type=checkbox>Blank Screen </span><span id=49><input id=50 type=checkbox>View only </span></div></table></div><div id=p15 style=display:none><span id=51></span><h1>Audit Log</h1><span id=52></span></div><div id=p16 style=display:none><h1>Security Settings</h1><span id=53></span></div><div id=p17 style=display:none><h1>Internet Settings</h1><span id=54></span></div><div id=p18 style=display:none><h1>System Defense</h1><span id=55></span></div><div id=p19 style=display:none><h1>Agent Presence</h1><span id=56></span></div><div id=p20 style=display:none><h1>Script Editor</h1><div class=log1 style=padding:5px;border-radius:5px><div id=EditScriptStatus style=float:right;font-weight:bold;padding:5px>Stopped</div><div><input type=button value="View Editor" title="Switch to script line editor view" id=viewEditorButton onclick=scriptViewButton(0)><input type=button value="View Builder" title="Switch to block editor view" id=viewBuilderButton onclick=scriptViewButton(1)><input type=button value=New... title="Clear the script editor" onclick=script_newScriptDlg()><input type=button value=Load... title="Load a script from file" onclick=script_runScriptDlg()><input type=button value=Save... title="Save a script to file" onclick=script_saveScript(event)><input type=button value=Restart title="Compile the script and get ready to run it from the start" onclick=resetScriptButton()><input type=button value=Continue title="Run the script from the current execution point" onclick=runScriptButton()><input type=button value=Break title="Pause the execution of the script" onclick=breakScriptButton()><input type=button value=Step title="Execute one step of the script" onclick=stepScriptButton()></div></div><div id=scriptbuilder style=display:none><h2>Script Builder</h2><div style=padding:0;margin:0><div style=width:250px;height:400px;float:left;padding:0;margin:0;padding-right:3px><input id=blockfilter style="width:inherit;height:24px;padding:0;margin:0;border:1px solid gray;margin-bottom:1px" placeholder="Filter blocks..." onkeyup=script_fonfilterchanged()><div id=blocks style="width:inherit;height:373px;border:1px solid gray;overflow-y:scroll;padding:0;margin:0"></div></div><div id=scriptblocks style="width:auto;height:400px;padding:0;margin:0;border:1px solid gray;overflow-y:scroll" ondrop="script_fondrop(event, this)" onclick=script_fonclick(event)></div></div></div><div id=scripteditor><h2>Script</h2><textarea id=scriptarea style=width:100%;height:176px;resize:vertical;margin:0;padding:0;font-family:Arial,Helvetica,sans-serif spellcheck="false"></textarea><div style=display:none><br><h2>Compiled Script</h2><textarea id=compiledarea style=width:100%;height:16px;resize:vertical;margin:0;padding:0 spellcheck="false"></textarea><br></div><h2>Variables</h2><div id=variables style="width:100%;height:200px;resize:vertical;border:1px solid gray;overflow:scroll;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text"></div></div><h2>Console</h2><textarea id=console style=width:100%;height:80px;resize:vertical;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text readonly=""></textarea></div><div id=p21 style=display:none><h1>Storage</h1><span id=57></span></div><div id=p22 style=display:none><h1>Event Subscriptions</h1><span id=58></span></div><div id=p23 style=display:none><h1>Wake Alarms</h1><span id=59></span></div><div id=p24 style=display:none;position:absolute;top:0px;bottom:0px;left:8px;right:24px><h1>Files</h1><br><table id=p24toolbar style=width:100%;position:absolute;top:35px cellpadding=0 cellspacing=0><tr><td style=width:100%;background-color:#d3d9d6;text-align:left;padding:4px valign="bottom"><div id=p24rightOfButtons style=float:right;margin-top:3px></div><div><input type=button id=p24FolderUp disabled="disabled" onclick=p24folderup() value=Up> <input type=button id=p24SelectAllButton disabled="disabled" onclick=p24selectallfile() value="Select All" onkeypress="return false" onkeydown="return false"> <input type=button id=p24RenameFileButton disabled="disabled" value=Rename onclick=p24renamefile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24DeleteFileButton disabled="disabled" value=Delete onclick=p24deletefile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24NewFolderButton disabled="disabled" value="New Folder" onclick=p24createfolder() onkeypress="return false" onkeydown="return false"> <input type=button id=p24UploadButton disabled="disabled" value=Upload onclick=p24uploadFile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24CutButton disabled="disabled" value=Cut onclick=p24copyFile(1) onkeypress="return false" onkeydown="return false"> <input type=button id=p24CopyButton disabled="disabled" value=Copy onclick=p24copyFile(0) onkeypress="return false" onkeydown="return false"> <input type=button id=p24PasteButton disabled="disabled" value=Paste onclick=p24pasteFile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24RefreshButton disabled="disabled" value=Refresh onclick=p24folderup(9999) onkeypress="return false" onkeydown="return false"> </div><tr><td style=background-color:#E4E9E7;height:28px><div style=float:right;margin-right:4px><select id=p24sortdropdown onchange=p24updateFiles()><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=p24currentpath></span></div></table><div id=p24filetable style=width:100%;overflow:auto;-webkit-user-select:none;position:absolute;top:92px;bottom:30px><div id=p24bigok style=width:256px;overflow:hidden;position:absolute;top:80px;width:100%;text-align:center;font-size:1600%;color:#AAAAAA;display:none><b>✓</b></div><div id=p24bigfail style=width:256px;overflow:hidden;position:absolute;top:80px;width:100%;text-align:center;font-size:1600%;color:#AAAAAA;display:none><b>✗</b></div><span id=p24files></span></div><table id=p24toolbarBottom style=width:100%;position:absolute;bottom:10px cellpadding=0 cellspacing=0><tr><td style=text-align:left;padding:3px;text-align:center;background-color:#D3D9D6> <span id=p24bottomstatus></span></table></div></div></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;overflow:auto;top:75px;width:400px;max-height:550px;display:none"><div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"><div id=60 style=float:right;padding:1px;margin-right:5px;cursor:pointer;font-size:15px onclick=setDialogMode()>✖</div><div id=61 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=62 style=padding:10px></div></div><div id=dialog2 style=margin:auto;margin:3px><br><div style=height:26px><input id=d2username style=float:right;width:200px onkeyup=updateAccountDialog()><div>Username</div></div><div style=height:26px><input id=d2password1 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Password*</div></div><div style=height:26px><input id=d2password2 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Confirm Password</div></div><div id=63><div style=height:26px><select id=d2permission style=float:right;width:200px><option value=0>Local<option value=1>Network<option value=2>Any</select><div>Permission</div></div><div>Granted Permissions</div><ul id=64 style="list-style-type:none;height:100px;overflow:auto;width:100%;border:1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0"></ul></div><div style=font-size:10px><br>*Minimum 8 characters with upper, lowercase, 0-9, and one of !@#$%^&*()+-</div></div><div id=dialog3 style=margin:auto;text-align:center;margin:3px><textarea id=d3pastetextarea maxlength="4096" style=width:100%;height:200px;resize:none></textarea></div><div id=dialog5 style=margin:auto;margin:3px><br><div style=height:26px><select id=d5actionSelect style=float:right;width:200px></select><div>Power Action</div></div><div><span style=color:red>Warning:</span>Some power actions may result in data loss and may disconnect the desktop, terminal or disk redirection sessions.</div></div><div id=dialog6 style=margin:auto;margin:3px><br><div style=height:26px><input id=d6ConsentText style=float:right;width:200px maxlength="6" onkeyup=consentChanged() onkeypress="return numbersOnly(event)"><div>Consent Code</div></div><div style=height:26px><select id=d6Display onchange=changeConsentDisplay() style=float:right;width:200px><option value=0>Primary display<option value=1>Secondary display<option id=d6ThirdDisplay value=2 style=display:none>Third display</select><div>Consent Display</div></div></div><div id=dialog7 style=margin:auto;margin:3px><br><div style=height:26px><select id=c11 style=float:right;width:200px><option value=1>RLE8, Color Fast<option value=2>RLE16, Color<option id=d7gray4 value=5>RLE4G, Gray Fastest<option id=d7gray8 value=6>RLE8G, Gray Fast<option value=3>RAW8, Color Slow<option value=4>RAW16, Color Very Slow</select><div>Image Encoding</div></div><div style=height:80px><div style="float:right;border:1px solid #666;width:200px;height:80px;overflow-y:scroll;background-color:white"><label><input type=checkbox id=d7showcursor>Show Local Mouse Cursor</label><br><label><input type=checkbox id=d7showcad>Show Ctrl-Alt-Del</label><br><label><input type=checkbox id=d7limitFrameRate>Limit Frame Rate</label><br><label><input type=checkbox id=d7noMouseRotate>Don't Rotate Mouse</label><br></div><div>Other Settings</div></div><div id=d7softkvmsettings style=display:none><h4 style="width:100%;border-bottom:1px solid gray">Software KVM</h4><div style="margin:3px 0 3px 0"><select id=d7bitmapquality style=float:right;width:200px;height:20px dir="rtl"><option value=50>50%<option value=40>40%<option selected="selected" value=30>30%<option value=20>20%<option value=10>10%<option value=5>5%<option value=1>1%</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></div><div id=dialog8 style=display:table;margin:3px><div style="margin:3px 0 3px 0;padding-top:5px"><input id=c12 value=admin style=float:right;width:220px><div style=height:20px>Username</div></div><div style="margin:3px 0 3px 0"><input id=c13 type=password autocomplete="off" style=float:right;width:220px><div style=height:20px>Password</div></div></div><div id=dialog9 style=margin:auto;margin:3px><label><input type=checkbox id=c14>Redirection Port</label><br><div id=c15><label><input type=checkbox id=c16>KVM Remote Desktop</label><br></div><label><input type=checkbox id=c17>IDE-Redirection<br></label><label><input type=checkbox id=c18>Serial-over-LAN<br></label></div><div id=dialog10 style=margin:auto;margin:3px><label><input type=radio name=d10 id=c19 value=0>Not Required<br></label><label><input type=radio name=d10 id=c20 value=1>Required for KVM only<br></label><label><input type=radio name=d10 id=c21 value=4294967295>Always Required<br></label></div><div id=dialog11 style=margin:auto;margin:3px><div id=65></div></div><div id=dialog12 style=margin:auto;margin:3px><br><div style=height:26px><input id=c22 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">Profile Name</div></div><div style=height:26px><input id=c23 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">SSID</div></div><div style=height:26px><select id=c24 style=float:right;width:200px onclick=updateWifiDialog()></select><div>Priority</div></div><div style=height:26px><select id=c25 style=float:right;width:200px onclick=updateWifiDialog()><option value=6>WPA2 PSK<option value=4>WPA PSK</select><div>Authentication</div></div><div style=height:26px><select id=c26 style=float:right;width:200px onclick=updateWifiDialog()><option id=66 value=4>CCMP-AES<option id=67 value=3>TKIP-RC4<option id=68 value=2>WEP<option id=69 value=5>None</select><div>Encryption</div></div><div style=height:26px><input id=c27 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Password*</div></div><div style=height:26px><input id=c28 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Confirm Password</div></div></div><div id=dialog19 style=margin:auto;margin:3px>This will save the entire state of Intel® AMT for this machine into file. Passwords will not be saved, but some sensitive data may be included.<br><br><input id=c29 style=width:100% value=amtstate.json></div><div id=dialog20 style=margin:auto;margin:3px><input type=radio name=d20 id=d20a value=0>Disabled<br><input type=radio name=d20 id=d20b value=1>ICMP response<br><input type=radio name=d20 id=d20c value=2>RMCP response<br><input type=radio name=d20 id=d20d value=3>ICMP & RMCP response<br><br></div><div id=dialog21 style=margin:auto;margin:3px><div id=70><label><input type=checkbox name=d21 id=d21ipsync onclick=updateIPSetupDlg()>Operating system IP address sync</label><br></div><input type=radio name=d21 id=d21o0 onclick=updateIPSetupDlg()><span id=d21l0></span><br><input type=radio name=d21 id=d21o1 onclick=updateIPSetupDlg()><span id=d21l1></span><br><div id=71><input type=radio name=d21 id=d21o2 onclick=updateIPSetupDlg()><span id=d21l2></span><br><br><div style=margin-left:20px><div style=height:26px><input id=c30 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>IP address</div></div><div style=height:26px id=72><input id=c31 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Subnet mark</div></div><div style=height:26px><input id=c32 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Gateway</div></div><div style=height:26px><input id=c33 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Primary DNS</div></div><div style=height:26px><input id=c34 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Alternate DNS</div></div></div></div></div><div id=dialog23 style=margin:auto;margin:3px><br><div style=height:26px><select id=c35 style=float:right;width:200px onchange=showEditDnsDlgChange()><option value=0>Disabled<option value=1>Disabled, DHCP update<option value=2>Enabled</select><div>Dynamic DNS client</div></div><div style=height:26px><input id=c36 style=float:right;width:200px><div>Update Interval (minutes)</div></div><div style=height:26px><input id=c37 style=float:right;width:200px><div>TTL (seconds)</div></div><div style=font-size:10px><br>Defaut Interval is 1440 minutes, Default TTL is 900 seconds.</div></div><div id=dialog24 style=margin:auto;margin:3px><br><div style=height:26px><select id=c38 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=2>Power up<option value=5>Power cycle<option value=8>Power down<option value=10>Reset<option id=d24p500 value=500>OS Wake from Standby<option id=d24p501 value=501>OS Power Saving<option value=999>Set boot options</select><div>Remote Command</div></div><div style=height:80px><div id=c39 style="float:right;border:1px solid #666;width:200px;height:72px;overflow-y:scroll;background-color:white"><div id=d24dBiosPause><label><input type=checkbox id=d24BiosPause onchange=showAdvPowerDlgChange()>BIOS Pause</label><br></div><div id=d24dBiosSecureBoot><label><input type=checkbox id=d24BiosSecureBoot onchange=showAdvPowerDlgChange()>Enforce Secure Boot</label><br></div><div id=d24dBiosSetup><label><input type=checkbox id=d24BiosSetup onchange=showAdvPowerDlgChange()>BIOS Setup</label><br></div><div id=d24dForceProgressEvents><label><input type=checkbox id=d24ForceProgressEvents onchange=showAdvPowerDlgChange()>Force progress events</label><br></div><div id=d24dLockPowerButton><label><input type=checkbox id=d24LockPowerButton onchange=showAdvPowerDlgChange()>Lock power button</label><br></div><div id=d24dLockResetButton><label><input type=checkbox id=d24LockResetButton onchange=showAdvPowerDlgChange()>Lock reset button</label><br></div><div id=d24dLockSleepButton><label><input type=checkbox id=d24LockSleepButton onchange=showAdvPowerDlgChange()>Lock sleep button</label><br></div><div id=d24dLockKeyboard><label><input type=checkbox id=d24LockKeyboard onchange=showAdvPowerDlgChange()>Lock keyboard</label><br></div><div id=d24dUserPasswordBypass><label><input type=checkbox id=d24UserPasswordBypass onchange=showAdvPowerDlgChange()>BIOS password bypass</label><br></div><div id=d24dReflashBios><label><input type=checkbox id=d24ReflashBios onchange=showAdvPowerDlgChange()>Reflash BIOS</label><br></div><div id=d24dSafeMode><label><input type=checkbox id=d24SafeMode onchange=showAdvPowerDlgChange()>Safe mode</label><br></div><div id=d24dUseIDER><label><input type=checkbox id=d24UseIDER onchange=showAdvPowerDlgChange()>Use IDER</label><br></div><div id=d24dSerialOverLan><label><input type=checkbox id=d24SerialOverLan onchange=showAdvPowerDlgChange()>Serial-over-LAN</label><br></div><div id=d24dSecureErase><label><input type=checkbox id=d24SecureErase onchange=showAdvPowerDlgChange()>Intel® Remote Secure Erase</label><br></div></div><div>Boot Settings</div></div><div style=height:26px><select id=c40 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option value=1>Force CD/DVD Boot<option value=2>Force PXE Boot<option value=3>Force Hard Disk Boot<option value=4>Force Diagnostic Boot</select><div>Boot Source</div></div><div style=height:26px><select id=c41 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option value=1>Index 1<option value=2>Index 2<option value=3>Index 3<option value=3>Index 4</select><div>Boot Media Index</div></div><div style=height:26px id=idd_d24IDERBootDevice><select id=c42 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>Boot to floppy<option value=1>Boot to CDROM</select><div>IDER Boot Device</div></div><div style=height:26px><select id=c43 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>System Default<option id=c44 value=1>Quiet<option id=c45 value=2>Verbose<option id=c46 value=3>Blank Screen</select><div>Verbocity</div></div><div style=height:26px id=idd_d24RSEPass><div style=float:right;width:200px><input type=password id=d24rsepass maxlength="32" style=float:right;width:100%></div><div>RSE Password</div></div></div><div id=dialog25 style=margin:auto;margin:3px><div style=text-align:left><div style=height:26px;margin-top:4px><input id=d25alarm_name style=float:right;width:180px maxlength="32" onkeyup=alertDialogUpdate()><div style=padding-top:4px>Alarm name</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_sdate style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Wake date (year-month-day)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_stime style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,58)"></div><div style=padding-top:4px>Wake time (hour:min:sec)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_interval style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Interval (days-hours-min)</div></div><div style=height:26px;margin-top:4px><div style=float:right;width:180px><select id=d25alarm_doc style=width:100% onchange=showAdvPowerDlgChange()><option value=0>Keep alarm<option value=1>Delete on completion</select></div><div style=padding-top:4px>After wake</div></div></div></div></div><div style=padding:10px;margin-bottom:4px><input id=c47 type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)><input id=c48 type=button value=OK style=float:right;width:80px onclick=dialogclose(1)><div style=height:25px><input id=c49 type=button value=Delete style=width:80px;display:none onclick=dialogclose(2)></div></div></div><script>var $jscomp={scope:{},getGlobal:function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global?global:b}};$jscomp.global=$jscomp.getGlobal(this);$jscomp.initSymbol=function(){$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol);$jscomp.initSymbol=function(){}};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(b){return"jscomp_symbol_"+b+$jscomp.symbolCounter_++};
2
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();$jscomp.global.Symbol.iterator||($jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));$jscomp.initSymbolIterator=function(){}};
3
$jscomp.makeIterator=function(b){$jscomp.initSymbolIterator();if(b[$jscomp.global.Symbol.iterator])return b[$jscomp.global.Symbol.iterator]();if(!(b instanceof Array||"string"==typeof b||b instanceof String))throw new TypeError(b+" is not iterable");var c=0;return{next:function(){return c==b.length?{done:!0}:{done:!1,value:b[c++]}}}};$jscomp.arrayFromIterator=function(b){for(var c,a=[];!(c=b.next()).done;)a.push(c.value);return a};
4
$jscomp.arrayFromIterable=function(b){return b instanceof Array?b:$jscomp.arrayFromIterator($jscomp.makeIterator(b))};$jscomp.arrayFromArguments=function(b){for(var c=[],a=0;a<b.length;a++)c.push(b[a]);return c};
@@ -11,103 +11,103 @@ function ObjectToStringEx(b,c){var a="";if(0!=b&&(!b||null==b))return"(Null)";if
11
function ObjectToStringEx2(b,c){var a="";if(0!=b&&(!b||null==b))return"(Null)";if(b instanceof Array)for(var d in b)a+="\r\n"+gap2(c)+"Item #"+d+": "+ObjectToStringEx2(b[d],c+1);else if(b instanceof Object)for(d in b)a+="\r\n"+gap2(c)+d+" = "+ObjectToStringEx2(b[d],c+1);else a+=EscapeHtml(b);return a}function gap(b){for(var c="",a=0;a<4*b;a++)c+=" ";return c}function gap2(b){for(var c="",a=0;a<4*b;a++)c+=" ";return c}function ObjectToString(b){return ObjectToStringEx(b,0)}
12
function ObjectToString2(b){return ObjectToStringEx2(b,0)}function hex2rstr(b){if("string"!=typeof b||0==b.length)return"";var c="";b=(""+b).match(/../g);for(var a;a=b.shift();)c+=String.fromCharCode("0x"+a);return c}function char2hex(b){return(b+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(b){return unescape(encodeURIComponent(b))}
13
function decode_utf8(b){return decodeURIComponent(escape(b))}function data2blob(b){for(var c=Array(b.length),a=0;a<b.length;a++)c[a]=b.charCodeAt(a);return new Blob([new Uint8Array(c)])}function random(b){return Math.floor(Math.random()*b)}function trademarks(b){return b.replace(/\(R\)/g,"®").replace(/\(TM\)/g,"™")}
14
-var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log.apply(console,[].concat($jscomp.arrayFromArguments(arguments)))}function c(c,d,y,A){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==e.floppy)return e.SendCommandEndResponse(1,2,c,58,0),-1;if(0==e.floppyReady)return e.floppyReady=!0,e.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;if(0==e.cdromReady)return e.cdromReady=
15
-!0,e.SendCommandEndResponse(1,6,c,40,0),-1;break;default:return b("SCSI Internal error 3",c),-1}e.SendCommandEndResponse(1,0,c,0,0);break;case 8:A=((d.charCodeAt(1)&31)<<16)+(d.charCodeAt(2)<<8)+d.charCodeAt(3);d=d.charCodeAt(4);0==d&&(d=256);b("SCSI: READ_6",c,A,d);a(c,A,d,y);break;case 10:return A=((d.charCodeAt(1)&31)<<16)+(d.charCodeAt(2)<<8)+d.charCodeAt(3),d=d.charCodeAt(4),0==d&&(d=256),b("SCSI: WRITE_6",c,A,d),e.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==
16
-d.charCodeAt(2)&&0==d.charCodeAt(3)){A=d=0;switch(c){case 160:if(null==e.floppy)return e.SendCommandEndResponse(1,2,c,58,0),-1;d=0;A=128;break;case 176:if(null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;d=5;A=128;break;default:return b("SCSI Internal error 6",c),-1}e.SendDataToHost(c,!0,String.fromCharCode(0,d,A,0),y&1);return}e.SendCommandEndResponse(1,5,c,36,0);break;case 27:e.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==e.floppy||176==
17
-c&&null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;e.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);A=ReadShort(d,7);switch(c){case 160:if(null==e.floppy||0==e.floppy.size)return e.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==e.cdrom||0==e.cdrom.size)return e.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}e.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),y&1);break;
14
+var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log.apply(console,[].concat($jscomp.arrayFromArguments(arguments)))}function c(c,d,z,A){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==e.floppy)return e.SendCommandEndResponse(1,2,c,58,0),-1;if(0==e.floppyReady)return e.floppyReady=!0,e.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;if(0==e.cdromReady)return e.cdromReady=
15
+!0,e.SendCommandEndResponse(1,6,c,40,0),-1;break;default:return b("SCSI Internal error 3",c),-1}e.SendCommandEndResponse(1,0,c,0,0);break;case 8:A=((d.charCodeAt(1)&31)<<16)+(d.charCodeAt(2)<<8)+d.charCodeAt(3);d=d.charCodeAt(4);0==d&&(d=256);b("SCSI: READ_6",c,A,d);a(c,A,d,z);break;case 10:return A=((d.charCodeAt(1)&31)<<16)+(d.charCodeAt(2)<<8)+d.charCodeAt(3),d=d.charCodeAt(4),0==d&&(d=256),b("SCSI: WRITE_6",c,A,d),e.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==
16
+d.charCodeAt(2)&&0==d.charCodeAt(3)){A=d=0;switch(c){case 160:if(null==e.floppy)return e.SendCommandEndResponse(1,2,c,58,0),-1;d=0;A=128;break;case 176:if(null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;d=5;A=128;break;default:return b("SCSI Internal error 6",c),-1}e.SendDataToHost(c,!0,String.fromCharCode(0,d,A,0),z&1);return}e.SendCommandEndResponse(1,5,c,36,0);break;case 27:e.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==e.floppy||176==
17
+c&&null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;e.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);A=ReadShort(d,7);switch(c){case 160:if(null==e.floppy||0==e.floppy.size)return e.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==e.cdrom||0==e.cdrom.size)return e.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}e.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),z&1);break;
18
case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null==e.floppy||0==e.floppy.size)return e.SendCommandEndResponse(0,2,c,58,0),-1;null!=e.floppy&&(d=(e.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==e.cdrom||0==e.cdrom.size)return e.SendCommandEndResponse(0,2,c,58,0),-1;null!=e.cdrom&&(d=(e.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,A);e.SendDataToHost(A,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?
19
-8:2,0),y&1);break;case 40:A=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10",c,A,d);a(c,A,d,y);break;case 42:case 46:A=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,A,d);e.SendGetDataFromHost(c,512*d);break;case 67:A=ReadShort(d,7);var E=d.charCodeAt(1)&2,r=d.charCodeAt(2)&7;0==r&&(r=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+A+", msf="+E+", format="+r);switch(c){case 160:return e.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),
20
--1}1==r?e.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0),y&1):0==r&&(E?e.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,2,0,0,20,170,0,0,0,52,19),y&1):e.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,0,0,0,20,170,0,0,0,0,0),y&1));break;case 70:var r=2!=d.charCodeAt(1),L=ReadShort(d,2);A=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,r,L,A);if(0==A)return e.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),y&1),-1;E=IntToStr(8);0==L&&(E+=B);if(1==L||r&&1>
21
-L)E+=k;if(2==L||r&&2>L)E+=g;if(3==L||r&&3>L)E+=J;if(16==L||r&&16>L)E+=u;if(30==L||r&&30>L)E+=C;if(256==L||r&&256>L)E+=x;if(261==L||r&&261>L)E+=w;E=IntToStr(E.length)+E;E.length>A&&(E=E.substring(0,A));e.SendDataToHost(c,!0,E,y&1);return-1;case 74:b("SCSI: GET_EVENT_STATUS_NOTIFICATION",c,d.charCodeAt(1),d.charCodeAt(4),d.charCodeAt(9));if(1!=d.charCodeAt(1)&&16!=d.charCodeAt(4)){b("SCSI ERROR");e.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=e.floppy?d=2:176==c&&null!=e.cdrom&&(d=2);
22
-e.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),y&1);break;case 76:e.SendCommand(81,IntToStrX(0)+IntToStrX(0)+IntToStrX(0)+String.fromCharCode(135,80,3,0,0,0,176,81,5,32,0),!0);break;case 81:return b("SCSI READ_DISC_INFO",c),e.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),e.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);A=ReadShort(d,7);E=null;if(0==A)return e.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),y&
23
-1),-1;A=0;160==c?null!=e.floppy&&(A=e.floppy.size>>9):null!=e.cdrom&&(A=e.cdrom.size>>11);switch(d.charCodeAt(2)&63){case 1:E=160==c?2880>=A?F:H:D;break;case 5:160==c&&(E=2880>=A?q:l);break;case 63:E=160==c?2880>=A?n:p:z;break;case 26:176==c&&(E=m);break;case 29:176==c&&(E=v);break;case 42:176==c&&(E=h)}null==E?e.SendCommandEndResponse(0,5,c,32,0):e.SendDataToHost(c,!0,E,y&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),e.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,
24
-b,c,g){var w=null,n=0;160==a&&(w=e.floppy,null!=e.floppy&&(n=e.floppy.size>>9));176==a&&(w=e.cdrom,null!=e.cdrom&&(n=e.cdrom.size>>11));if(0>c||b+c>n)return e.SendCommandEndResponse(1,5,a,33,0),0;if(0==c)return e.SendCommandEndResponse(1,0,a,0,0),0;null!=w&&(e.sectorStats&&e.sectorStats(1,160==a?0:1,n,b,c),160==a?(b<<=9,c<<=9):(b<<=11,c<<=11),null!==E?A.push({media:w,dev:a,lba:b,len:c,fr:g}):(E=w,L=a,U=b,r=c,d(g)))}function d(a){var b=r,c=U;r>e.iderinfo.readbfr&&(b=e.iderinfo.readbfr);r-=b;U+=b;var g=
25
-new FileReader;g.onload=function(){e.SendDataToHost(L,0==r,this.result,a&1);if(0<r&&0==y)d(a);else if(E=null,y)e.SendCommand(71),A=[],y=!1;else if(0<A.length){var b=A.shift();E=b.media;L=b.dev;U=b.lba;r=b.len;d(b.fr)}};g.readAsBinaryString(E.slice(c,c+b))}var e={protocol:3,bytesToAmt:0,bytesFromAmt:0,rx_timeout:3E4,tx_timeout:0,heartbeat:2E4,version:1,acc:"",inSequence:0,outSequence:0,iderinfo:null,enabled:!1,iderStart:0,floppy:null,cdrom:null,floppyReady:!1,cdromReady:!1,sectorStats:null},l=String.fromCharCode(0,
26
-38,49,128,0,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),p=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),q=String.fromCharCode(0,38,36,128,0,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),n=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,
27
-0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),m=String.fromCharCode(0,18,1,128,0,0,0,0,26,10,0,0,0,0,0,0,0,0,0,0),v=String.fromCharCode(0,18,1,128,0,0,0,0,29,10,0,0,0,0,0,0,0,0,0,0),h=String.fromCharCode(0,32,1,128,0,0,0,0,42,24,0,0,0,0,32,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0),z=String.fromCharCode(0,40,1,128,0,0,0,0,1,6,0,255,0,0,0,0,42,24,0,0,0,0,2,0,0,0,0,0,0,128,
28
-0,0,0,0,0,0,0,0,0,0,0,0);String.fromCharCode(0,0,0,40,0,0,0,8);var B=String.fromCharCode(0,0,3,4,0,8,1,0),k=String.fromCharCode(0,1,3,4,0,0,0,2),g=String.fromCharCode(0,2,3,4,0,0,0,0),J=String.fromCharCode(0,3,3,4,41,0,0,2),u=String.fromCharCode(0,16,1,8,0,0,8,0,0,1,0,0),C=String.fromCharCode(0,30,3,0),x=String.fromCharCode(1,0,3,0),w=String.fromCharCode(1,5,3,0),F=String.fromCharCode(0,18,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),H=String.fromCharCode(0,18,49,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),
29
-D=String.fromCharCode(0,14,1,128,0,0,0,0,1,6,0,255,0,0,0,0);e.xxStateChange=function(a){b("IDER-StateChange",a);0==a&&e.Stop();3==a&&e.Start()};e.Start=function(){b("IDER-Start");b(e.floppy,e.cdrom);e.bytesToAmt=0;e.bytesFromAmt=0;e.inSequence=0;e.outSequence=0;A=[];e.SendCommand(64,ShortToStrX(e.rx_timeout)+ShortToStrX(e.tx_timeout)+ShortToStrX(e.heartbeat)+IntToStrX(e.version));e.sectorStats&&(e.sectorStats(0,0,e.floppy?e.floppy.size>>9:0),e.sectorStats(0,1,e.cdrom?e.cdrom.size>>11:0))};e.Stop=
30
-function(){b("IDER-Stop");e.parent.Stop()};e.ProcessData=function(a){e.bytesFromAmt+=a.length;e.acc+=a;for(b("IDER-ProcessData",e.acc.length,rstr2hex(e.acc));;){a=e.ProcessDataEx();if(0==a)break;if(e.inSequence!=ReadIntX(e.acc,4)){b("ERROR: Out of sequence",e.inSequence,ReadIntX(e.acc,4));e.Stop();break}e.inSequence++;e.acc=e.acc.substring(a)}};e.SendCommand=function(a,c,g,w){null==c&&(c="");g=50<a&&1==g?2:0;w&&(g+=1);c=String.fromCharCode(a,0,0,g)+IntToStrX(e.outSequence++)+c;e.parent.xxSend(c);
31
-e.bytesToAmt+=c.length;75!=a&&b("IDER-SendData",c.length,rstr2hex(c))};e.SendCommandEndResponse=function(a,b,c,g,w){a?e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,197,0,3,0,0,0,c,80,0,0,0),!0):e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,b<<4,3,0,0,0,c,81,b,g,w),!0)};e.SendDataToHost=function(a,b,c,g){var w=g?0:c.length;1==b?e.SendCommand(84,String.fromCharCode(0,c.length&255,c.length>>8,0,g?180:181,0,2,0,w&255,w>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+c,b,g):e.SendCommand(84,
32
-String.fromCharCode(0,c.length&255,c.length>>8,0,g?180:181,0,2,0,w&255,w>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+c,b,g)};e.SendGetDataFromHost=function(a,b){e.SendCommand(82,String.fromCharCode(0,b&255,b>>8,0,181,0,0,0,b&255,b>>8,a,88,0,0,0,0,0,0,0,0,0,0,0),!1)};e.SendDisableEnableFeatures=function(a,b){null==b&&(b="");e.SendCommand(72,String.fromCharCode(a)+b)};e.ProcessDataEx=function(){if(8>e.acc.length)return 0;switch(e.acc.charCodeAt(0)){case 65:if(30>e.acc.length)break;var a=e.acc.charCodeAt(29);
19
+8:2,0),z&1);break;case 40:A=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10",c,A,d);a(c,A,d,z);break;case 42:case 46:A=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,A,d);e.SendGetDataFromHost(c,512*d);break;case 67:A=ReadShort(d,7);var D=d.charCodeAt(1)&2,q=d.charCodeAt(2)&7;0==q&&(q=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+A+", msf="+D+", format="+q);switch(c){case 160:return e.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),
20
+-1}1==q?e.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0),z&1):0==q&&(D?e.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,2,0,0,20,170,0,0,0,52,19),z&1):e.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,0,0,0,20,170,0,0,0,0,0),z&1));break;case 70:var q=2!=d.charCodeAt(1),M=ReadShort(d,2);A=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,q,M,A);if(0==A)return e.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),z&1),-1;D=IntToStr(8);0==M&&(D+=B);if(1==M||q&&1>
21
+M)D+=k;if(2==M||q&&2>M)D+=g;if(3==M||q&&3>M)D+=K;if(16==M||q&&16>M)D+=u;if(30==M||q&&30>M)D+=C;if(256==M||q&&256>M)D+=w;if(261==M||q&&261>M)D+=y;D=IntToStr(D.length)+D;D.length>A&&(D=D.substring(0,A));e.SendDataToHost(c,!0,D,z&1);return-1;case 74:b("SCSI: GET_EVENT_STATUS_NOTIFICATION",c,d.charCodeAt(1),d.charCodeAt(4),d.charCodeAt(9));if(1!=d.charCodeAt(1)&&16!=d.charCodeAt(4)){b("SCSI ERROR");e.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=e.floppy?d=2:176==c&&null!=e.cdrom&&(d=2);
22
+e.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),z&1);break;case 76:e.SendCommand(81,IntToStrX(0)+IntToStrX(0)+IntToStrX(0)+String.fromCharCode(135,80,3,0,0,0,176,81,5,32,0),!0);break;case 81:return b("SCSI READ_DISC_INFO",c),e.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),e.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);A=ReadShort(d,7);D=null;if(0==A)return e.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),z&
23
+1),-1;A=0;160==c?null!=e.floppy&&(A=e.floppy.size>>9):null!=e.cdrom&&(A=e.cdrom.size>>11);switch(d.charCodeAt(2)&63){case 1:D=160==c?2880>=A?E:I:F;break;case 5:160==c&&(D=2880>=A?r:l);break;case 63:D=160==c?2880>=A?p:n:x;break;case 26:176==c&&(D=m);break;case 29:176==c&&(D=v);break;case 42:176==c&&(D=h)}null==D?e.SendCommandEndResponse(0,5,c,32,0):e.SendDataToHost(c,!0,D,z&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),e.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,
24
+b,c,g){var y=null,p=0;160==a&&(y=e.floppy,null!=e.floppy&&(p=e.floppy.size>>9));176==a&&(y=e.cdrom,null!=e.cdrom&&(p=e.cdrom.size>>11));if(0>c||b+c>p)return e.SendCommandEndResponse(1,5,a,33,0),0;if(0==c)return e.SendCommandEndResponse(1,0,a,0,0),0;null!=y&&(e.sectorStats&&e.sectorStats(1,160==a?0:1,p,b,c),160==a?(b<<=9,c<<=9):(b<<=11,c<<=11),null!==D?A.push({media:y,dev:a,lba:b,len:c,fr:g}):(D=y,M=a,U=b,q=c,d(g)))}function d(a){var b=q,c=U;q>e.iderinfo.readbfr&&(b=e.iderinfo.readbfr);q-=b;U+=b;var g=
25
+new FileReader;g.onload=function(){e.SendDataToHost(M,0==q,this.result,a&1);if(0<q&&0==z)d(a);else if(D=null,z)e.SendCommand(71),A=[],z=!1;else if(0<A.length){var b=A.shift();D=b.media;M=b.dev;U=b.lba;q=b.len;d(b.fr)}};g.readAsBinaryString(D.slice(c,c+b))}var e={protocol:3,bytesToAmt:0,bytesFromAmt:0,rx_timeout:3E4,tx_timeout:0,heartbeat:2E4,version:1,acc:"",inSequence:0,outSequence:0,iderinfo:null,enabled:!1,iderStart:0,floppy:null,cdrom:null,floppyReady:!1,cdromReady:!1,sectorStats:null},l=String.fromCharCode(0,
26
+38,49,128,0,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),n=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),r=String.fromCharCode(0,38,36,128,0,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),p=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,
27
+0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),m=String.fromCharCode(0,18,1,128,0,0,0,0,26,10,0,0,0,0,0,0,0,0,0,0),v=String.fromCharCode(0,18,1,128,0,0,0,0,29,10,0,0,0,0,0,0,0,0,0,0),h=String.fromCharCode(0,32,1,128,0,0,0,0,42,24,0,0,0,0,32,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0),x=String.fromCharCode(0,40,1,128,0,0,0,0,1,6,0,255,0,0,0,0,42,24,0,0,0,0,2,0,0,0,0,0,0,128,
28
+0,0,0,0,0,0,0,0,0,0,0,0);String.fromCharCode(0,0,0,40,0,0,0,8);var B=String.fromCharCode(0,0,3,4,0,8,1,0),k=String.fromCharCode(0,1,3,4,0,0,0,2),g=String.fromCharCode(0,2,3,4,0,0,0,0),K=String.fromCharCode(0,3,3,4,41,0,0,2),u=String.fromCharCode(0,16,1,8,0,0,8,0,0,1,0,0),C=String.fromCharCode(0,30,3,0),w=String.fromCharCode(1,0,3,0),y=String.fromCharCode(1,5,3,0),E=String.fromCharCode(0,18,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),I=String.fromCharCode(0,18,49,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),
29
+F=String.fromCharCode(0,14,1,128,0,0,0,0,1,6,0,255,0,0,0,0);e.xxStateChange=function(a){b("IDER-StateChange",a);0==a&&e.Stop();3==a&&e.Start()};e.Start=function(){b("IDER-Start");b(e.floppy,e.cdrom);e.bytesToAmt=0;e.bytesFromAmt=0;e.inSequence=0;e.outSequence=0;A=[];e.SendCommand(64,ShortToStrX(e.rx_timeout)+ShortToStrX(e.tx_timeout)+ShortToStrX(e.heartbeat)+IntToStrX(e.version));e.sectorStats&&(e.sectorStats(0,0,e.floppy?e.floppy.size>>9:0),e.sectorStats(0,1,e.cdrom?e.cdrom.size>>11:0))};e.Stop=
30
+function(){b("IDER-Stop");e.parent.Stop()};e.ProcessData=function(a){e.bytesFromAmt+=a.length;e.acc+=a;for(b("IDER-ProcessData",e.acc.length,rstr2hex(e.acc));;){a=e.ProcessDataEx();if(0==a)break;if(e.inSequence!=ReadIntX(e.acc,4)){b("ERROR: Out of sequence",e.inSequence,ReadIntX(e.acc,4));e.Stop();break}e.inSequence++;e.acc=e.acc.substring(a)}};e.SendCommand=function(a,c,g,y){null==c&&(c="");g=50<a&&1==g?2:0;y&&(g+=1);c=String.fromCharCode(a,0,0,g)+IntToStrX(e.outSequence++)+c;e.parent.xxSend(c);
31
+e.bytesToAmt+=c.length;75!=a&&b("IDER-SendData",c.length,rstr2hex(c))};e.SendCommandEndResponse=function(a,b,c,g,y){a?e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,197,0,3,0,0,0,c,80,0,0,0),!0):e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,b<<4,3,0,0,0,c,81,b,g,y),!0)};e.SendDataToHost=function(a,b,c,g){var y=g?0:c.length;1==b?e.SendCommand(84,String.fromCharCode(0,c.length&255,c.length>>8,0,g?180:181,0,2,0,y&255,y>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+c,b,g):e.SendCommand(84,
32
+String.fromCharCode(0,c.length&255,c.length>>8,0,g?180:181,0,2,0,y&255,y>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+c,b,g)};e.SendGetDataFromHost=function(a,b){e.SendCommand(82,String.fromCharCode(0,b&255,b>>8,0,181,0,0,0,b&255,b>>8,a,88,0,0,0,0,0,0,0,0,0,0,0),!1)};e.SendDisableEnableFeatures=function(a,b){null==b&&(b="");e.SendCommand(72,String.fromCharCode(a)+b)};e.ProcessDataEx=function(){if(8>e.acc.length)return 0;switch(e.acc.charCodeAt(0)){case 65:if(30>e.acc.length)break;var a=e.acc.charCodeAt(29);
33
if(e.acc.length<30+a)break;e.iderinfo={};e.iderinfo.major=e.acc.charCodeAt(8);e.iderinfo.minor=e.acc.charCodeAt(9);e.iderinfo.fwmajor=e.acc.charCodeAt(10);e.iderinfo.fwminor=e.acc.charCodeAt(11);e.iderinfo.readbfr=ReadShortX(e.acc,16);e.iderinfo.writebfr=ReadShortX(e.acc,18);e.iderinfo.proto=e.acc.charCodeAt(21);e.iderinfo.iana=ReadIntX(e.acc,25);b(e.iderinfo);0!=e.iderinfo.proto&&(b("Unknown proto",e.iderinfo.proto),e.Stop());8192<e.iderinfo.readbfr&&(b("Illegal read buffer size",e.iderinfo.readbfr),
34
-e.Stop());8192<e.iderinfo.writebfr&&(b("Illegal write buffer size",e.iderinfo.writebfr),e.Stop());0==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(9)):1==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(17)):2==e.iderStart&&e.SendDisableEnableFeatures(3,IntToStrX(25));return 30+a;case 67:return b("CLOSE"),e.Stop(),8;case 68:return e.SendCommand(69),8;case 69:return b("PONG"),8;case 70:if(9>e.acc.length)break;a=e.acc.charCodeAt(8);null===E?(e.SendCommand(71),b("RESETOCCURED1",a)):(y=!0,b("RESETOCCURED2",
34
+e.Stop());8192<e.iderinfo.writebfr&&(b("Illegal write buffer size",e.iderinfo.writebfr),e.Stop());0==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(9)):1==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(17)):2==e.iderStart&&e.SendDisableEnableFeatures(3,IntToStrX(25));return 30+a;case 67:return b("CLOSE"),e.Stop(),8;case 68:return e.SendCommand(69),8;case 69:return b("PONG"),8;case 70:if(9>e.acc.length)break;a=e.acc.charCodeAt(8);null===D?(e.SendCommand(71),b("RESETOCCURED1",a)):(z=!0,b("RESETOCCURED2",
35
a));return 9;case 73:if(13>e.acc.length)break;var a=e.acc.charCodeAt(8),g=ReadIntX(e.acc,9);b("STATUS_DATA",a,g);switch(a){case 1:g&1&&(0==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(9)):1==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(17)):2==e.iderStart&&e.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:e.enabled=g&2?!0:!1;b("IDER Status: "+e.enabled);break;case 3:1!=g&&b("Register toggle failure")}return 13;case 74:if(11>e.acc.length)break;b("IDER: ABORT",e.acc.charCodeAt(8));
36
-return 11;case 75:return 8;case 80:if(28>e.acc.length)break;var a=e.acc.charCodeAt(14)&16?176:160,g=e.acc.charCodeAt(14),w=e.acc.substring(16,28),n=e.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(w),n,g);c(a,w,n,g);return 28;case 83:if(14>e.acc.length)break;a=ReadShortX(e.acc,9);if(e.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,112,3,0,0,0,160,81,7,39,0),!0);return 14+a;default:b("Unknown IDER command",e.acc[0]),e.Stop()}return 0};
37
-var A=[],y=!1,E=null,L,U,r;return e},CreateAmtRemoteServerIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log.apply(console,[].concat($jscomp.arrayFromArguments(arguments)))}var c={protocol:4,iderStart:0,floppy:null,cdrom:null,state:0,onStateChanged:null,m:{sectorStats:null,onDialogPrompt:null,dialogPrompt:function(a){c.socket.send(JSON.stringify({action:"dialogResponse",args:a}))},bytesToAmt:0,bytesFromAmt:0,server:!0,Stop:function(){c.Stop()}},xxStateChange:function(a){if(c.state!=
38
-a&&(b("SIDER-StateChange",a),c.state=a,null!=c.onStateChanged))c.onStateChanged(c,c.state)},Start:function(a,d,e,l,p){b("SIDER-Start",a,d,e,l,p);c.host=a;c.port=d;c.user=e;c.pass=l;c.connectstate=0;c.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webider.ashx?host="+a+"&port="+d+"&tls="+p+("*"==e?"&serverauth=1":"")+("undefined"===typeof l?"&serverauth=1&user="+e:"")+"&tls1only="+
36
+return 11;case 75:return 8;case 80:if(28>e.acc.length)break;var a=e.acc.charCodeAt(14)&16?176:160,g=e.acc.charCodeAt(14),y=e.acc.substring(16,28),p=e.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(y),p,g);c(a,y,p,g);return 28;case 83:if(14>e.acc.length)break;a=ReadShortX(e.acc,9);if(e.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,112,3,0,0,0,160,81,7,39,0),!0);return 14+a;default:b("Unknown IDER command",e.acc[0]),e.Stop()}return 0};
37
+var A=[],z=!1,D=null,M,U,q;return e},CreateAmtRemoteServerIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log.apply(console,[].concat($jscomp.arrayFromArguments(arguments)))}var c={protocol:4,iderStart:0,floppy:null,cdrom:null,state:0,onStateChanged:null,m:{sectorStats:null,onDialogPrompt:null,dialogPrompt:function(a){c.socket.send(JSON.stringify({action:"dialogResponse",args:a}))},bytesToAmt:0,bytesFromAmt:0,server:!0,Stop:function(){c.Stop()}},xxStateChange:function(a){if(c.state!=
38
+a&&(b("SIDER-StateChange",a),c.state=a,null!=c.onStateChanged))c.onStateChanged(c,c.state)},Start:function(a,d,e,l,n){b("SIDER-Start",a,d,e,l,n);c.host=a;c.port=d;c.user=e;c.pass=l;c.connectstate=0;c.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webider.ashx?host="+a+"&port="+d+"&tls="+n+("*"==e?"&serverauth=1":"")+("undefined"===typeof l?"&serverauth=1&user="+e:"")+"&tls1only="+
39
c.tlsv1only);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1)},Stop:function(){b("SIDER-Stop");null!=c.socket&&(c.socket.close(),c.socket=null);c.xxStateChange(0)},xxOnSocketConnected:function(){c.xxStateChange(2);c.socket.send(JSON.stringify({action:"start"}))},xxOnMessage:function(a){var b=null;try{b=JSON.parse(a.data)}catch(e){}if(null!=b&&"string"==typeof b.action)switch(b.action){case "dialog":if(null!=c.m.onDialogPrompt)c.m.onDialogPrompt(c,
40
b.args,b.buttons);break;case "state":2==b.state&&c.xxStateChange(3);break;case "stats":c.m.bytesToAmt=b.toAmt;c.m.bytesFromAmt=b.fromAmt;c.m.sectorStats&&c.m.sectorStats(b.mode,b.dev,b.total,b.start,b.len);break;case "error":console.log("IDER Error: "+";Floppy disk image does not exist;Invalid floppy disk image;Unable to open floppy disk image;CDROM disk image does not exist;Invalid CDROM disk image;Unable to open CDROM disk image;Can't perform IDER with no disk images".split(";")[b.code]);break;
41
-default:console.log("Unknown Server IDER action: "+b.action),breal}},xxOnSocketClosed:function(){c.Stop()}};return c},CreateWsmanComm=function(b,c,a,d,e){function l(){m.socketState=2;m.socketParseState=0;m.socketAccumulator="";m.socketHeader=null;m.socketData="";for(i in m.pendingAjaxCall)m.sendRequest(m.pendingAjaxCall[i][0],m.pendingAjaxCall[i][3],m.pendingAjaxCall[i][4])}function p(a){if("object"==typeof a.data)if(1==h)z.push(a.data);else if(v.readAsBinaryString)h=!0,v.readAsBinaryString(new Blob([a.data]));
42
-else if(v.readAsArrayBuffer)h=!0,v.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,n=0;n<c;n++)b+=String.fromCharCode(a[n]);q(b)}else q(a.data)}function q(a){if("object"===typeof a){var b="";a=new Uint8Array(a);for(var c=a.byteLength,n=0;n<c;n++)b+=String.fromCharCode(a[n]);a=b}else if("string"!==typeof a)return;for(m.socketAccumulator+=a;;){if(0==m.socketParseState){a=m.socketAccumulator.indexOf("\r\n\r\n");if(0>a)break;m.socketHeader=m.socketAccumulator.substring(0,
43
-a).split("\r\n");if(null==m.amtVersion)for(n in m.socketHeader)0==m.socketHeader[n].indexOf("Server: Intel(R) Active Management Technology ")&&(m.amtVersion=m.socketHeader[n].substring(46));m.socketAccumulator=m.socketAccumulator.substring(a+4);m.socketParseState=1;m.socketData="";m.socketXHeader={Directive:m.socketHeader[0].split(" ")};for(n in m.socketHeader)0!=n&&(a=m.socketHeader[n].indexOf(":"),m.socketXHeader[m.socketHeader[n].substring(0,a).toLowerCase()]=m.socketHeader[n].substring(a+2))}if(1==
41
+default:console.log("Unknown Server IDER action: "+b.action),breal}},xxOnSocketClosed:function(){c.Stop()}};return c},CreateWsmanComm=function(b,c,a,d,e){function l(){m.socketState=2;m.socketParseState=0;m.socketAccumulator="";m.socketHeader=null;m.socketData="";for(i in m.pendingAjaxCall)m.sendRequest(m.pendingAjaxCall[i][0],m.pendingAjaxCall[i][3],m.pendingAjaxCall[i][4])}function n(a){if("object"==typeof a.data)if(1==h)x.push(a.data);else if(v.readAsBinaryString)h=!0,v.readAsBinaryString(new Blob([a.data]));
42
+else if(v.readAsArrayBuffer)h=!0,v.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,p=0;p<c;p++)b+=String.fromCharCode(a[p]);r(b)}else r(a.data)}function r(a){if("object"===typeof a){var b="";a=new Uint8Array(a);for(var c=a.byteLength,p=0;p<c;p++)b+=String.fromCharCode(a[p]);a=b}else if("string"!==typeof a)return;for(m.socketAccumulator+=a;;){if(0==m.socketParseState){a=m.socketAccumulator.indexOf("\r\n\r\n");if(0>a)break;m.socketHeader=m.socketAccumulator.substring(0,
43
+a).split("\r\n");if(null==m.amtVersion)for(p in m.socketHeader)0==m.socketHeader[p].indexOf("Server: Intel(R) Active Management Technology ")&&(m.amtVersion=m.socketHeader[p].substring(46));m.socketAccumulator=m.socketAccumulator.substring(a+4);m.socketParseState=1;m.socketData="";m.socketXHeader={Directive:m.socketHeader[0].split(" ")};for(p in m.socketHeader)0!=p&&(a=m.socketHeader[p].indexOf(":"),m.socketXHeader[m.socketHeader[p].substring(0,a).toLowerCase()]=m.socketHeader[p].substring(a+2))}if(1==
44
m.socketParseState){b=-1;if(void 0==m.socketXHeader.connection||"close"!=m.socketXHeader.connection.toLowerCase()||void 0!=m.socketXHeader["transfer-encoding"]&&"chunked"==m.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=m.socketXHeader["content-length"]){b=parseInt(m.socketXHeader["content-length"]);if(m.socketAccumulator.length<b)break;a=m.socketAccumulator.substring(0,b);m.socketAccumulator=m.socketAccumulator.substring(b);m.socketData=a;b=0}else{c=m.socketAccumulator.indexOf("\r\n");
45
if(0>c)break;b=parseInt(m.socketAccumulator.substring(0,c),16);if(isNaN(b)){m.websocket&&m.websocket.close();break}if(m.socketAccumulator.length<c+2+b+2)break;a=m.socketAccumulator.substring(c+2,c+2+b);m.socketAccumulator=m.socketAccumulator.substring(c+2+b+2);m.socketData+=a}else b=0;0==b&&(c=m.socketXHeader,a=m.socketData,b=parseInt(c.Directive[1]),isNaN(b)&&(b=602),401==b&&3>++m.authcounter?m.challengeParams=m.parseDigest(c["www-authenticate"]):(c=m.pendingAjaxCall.shift(),m.authcounter=0,m.ActiveAjaxCount--,
46
-m.gotNextMessages(a,"success",{status:b},c),m.PerformNextAjax()),m.socketParseState=0,m.socketHeader=null)}}}function n(a){0==m.inDataCount&&(m.tlsv1only=1-m.tlsv1only);m.socketState=0;null!=m.socket&&(m.socket.close(),m.socket=null);if(0<m.pendingAjaxCall.length){a=m.pendingAjaxCall.shift();var b=a[5];m.PerformAjaxExNodeJS2(a[0],a[1],a[2],a[3],a[4],--b)}}var m={PendingAjax:[],ActiveAjaxCount:0,MaxActiveAjaxCount:1,FailAllError:0,challengeParams:null,noncecounter:1,authcounter:0,socket:null,socketState:0};
47
-m.host=b;m.port=c;m.user=a;m.pass=d;m.tls=e;m.tlsv1only=0;m.cnonce=Math.random().toString(36).substring(7);m.inDataCount=0;m.amtVersion=null;m.digestRealmMatch=null;m.digestRealm=null;m.PerformAjax=function(a,b,c,n,d,e){m.ActiveAjaxCount<m.MaxActiveAjaxCount&&0==m.PendingAjax.length?m.PerformAjaxEx(a,b,c,d,e):1==n?m.PendingAjax.unshift([a,b,c,d,e]):m.PendingAjax.push([a,b,c,d,e])};m.PerformNextAjax=function(){if(!(m.ActiveAjaxCount>=m.MaxActiveAjaxCount||0==m.PendingAjax.length)){var a=m.PendingAjax.shift();
48
-m.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);m.PerformNextAjax()}};m.PerformAjaxEx=function(a,b,c,n,d){if(0!=m.FailAllError)m.gotNextMessagesError({status:m.FailAllError},"error",null,[a,b,c,n,d]);else return a||(a=""),m.ActiveAjaxCount++,m.PerformAjaxExNodeJS(a,b,c,n,d)};m.pendingAjaxCall=[];m.PerformAjaxExNodeJS=function(a,b,c,n,d){m.PerformAjaxExNodeJS2(a,b,c,n,d,3)};m.PerformAjaxExNodeJS2=function(a,b,c,n,d,e){0>=e||0!=m.FailAllError?(m.ActiveAjaxCount--,999!=m.FailAllError&&m.gotNextMessages(null,
49
-"error",{status:0==m.FailAllError?408:m.FailAllError},[a,b,c,n,d]),m.PerformNextAjax()):(m.pendingAjaxCall.push([a,b,c,n,d,e]),0==m.socketState?m.xxConnectHttpSocket():2==m.socketState&&m.sendRequest(a,n,d))};m.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var n=c+" "+b+" HTTP/1.1\r\n";if(null!=m.challengeParams){m.digestRealm=m.challengeParams.realm;if(m.digestRealmMatch&&m.digestRealm!=m.digestRealmMatch){m.FailAllError=997;m.CancelAllQueries(997);return}c=hex_md5(hex_md5(m.user+":"+m.challengeParams.realm+
50
-":"+m.pass)+":"+m.challengeParams.nonce+":"+m.noncecounter+":"+m.cnonce+":"+m.challengeParams.qop+":"+hex_md5(c+":"+b));n+="Authorization: "+m.renderDigest({username:m.user,realm:m.challengeParams.realm,nonce:m.challengeParams.nonce,uri:b,qop:m.challengeParams.qop,response:c,nc:m.noncecounter++,cnonce:m.cnonce})+"\r\n"}a=n+="Host: "+m.host+":"+m.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==m.socketState&&null!=m.socket&&m.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(n=
51
-0;n<a.length;++n)b[n]=a.charCodeAt(n);try{m.socket.send(b.buffer)}catch(d){}}};m.parseDigest=function(a){a=a.substring(7).split(",");for(i in a)a[i]=a[i].trim();return a.reduce(function(a,b){var c=b.split("=");a[c[0]]=c[1].replace(/"/g,"");return a},{})};m.renderDigest=function(a){var b=[];for(i in a)b.push(i);return"Digest "+b.reduce(function(b,c){return b+","+c+'="'+a[c]+'"'},"").substring(1)};m.xxConnectHttpSocket=function(){m.inDataCount=0;m.socketState=1;m.socket=new WebSocket(window.location.protocol.replace("http",
52
-"ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=1&host="+m.host+"&port="+m.port+"&tls="+m.tls+"&tls1only="+m.tlsv1only+("*"==a?"&serverauth=1":"")+("undefined"===typeof d?"&serverauth=1&user="+a:""));m.socket.onopen=l;m.socket.onmessage=p;m.socket.onclose=n};var v=new FileReader,h=!1,z=[];v.readAsBinaryString?v.onload=function(a){q(a.target.result);0==z.length?h=!1:v.readAsBinaryString(new Blob([z.shift()]))}:v.readAsArrayBuffer&&
53
-(v.onloadend=function(a){q(a.target.result);0==z.length?h=!1:v.readAsArrayBuffer(z.shift())});m.gotNextMessages=function(a,b,c,n){if(999!=m.FailAllError)if(0!=m.FailAllError)n[1](null,m.FailAllError,n[2]);else if(200!=c.status)n[1](null,c.status,n[2]);else n[1](a,200,n[2])};m.gotNextMessagesError=function(a,b,c,n){if(999!=m.FailAllError)if(0!=m.FailAllError)n[1](null,m.FailAllError,n[2]);else n[1](m,null,{Header:{HttpError:a.status}},a.status,n[2])};m.CancelAllQueries=function(a){for(;0<m.PendingAjax.length;){var b=
54
-m.PendingAjax.shift();b[1](null,a,b[2])}null!=m.websocket&&(m.websocket.close(),m.websocket=null,m.socketState=0)};return m},CreateAmtRedirect=function(b){var c={};c.m=b;b.parent=c;c.State=0;c.socket=null;c.host=null;c.port=0;c.user=null;c.pass=null;c.authuri="/RedirectionService";c.tlsv1only=0;c.connectstate=0;c.protocol=b.protocol;c.amtaccumulator="";c.amtsequence=1;c.amtkeepalivetimer=null;c.digestRealmMatch=null;c.onStateChanged=null;c.Start=function(a,b,d,n,e){c.host=a;c.port=b;c.user=d;c.pass=
55
-n;c.connectstate=0;c.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="+a+"&port="+b+"&tls="+e+("*"==d?"&serverauth=1":"")+("undefined"===typeof n?"&serverauth=1&user="+d:"")+"&tls1only="+c.tlsv1only);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1)};c.xxOnSocketConnected=function(){urlvars&&
46
+m.gotNextMessages(a,"success",{status:b},c),m.PerformNextAjax()),m.socketParseState=0,m.socketHeader=null)}}}function p(a){0==m.inDataCount&&(m.tlsv1only=1-m.tlsv1only);m.socketState=0;null!=m.socket&&(m.socket.close(),m.socket=null);if(0<m.pendingAjaxCall.length){a=m.pendingAjaxCall.shift();var b=a[5];m.PerformAjaxExNodeJS2(a[0],a[1],a[2],a[3],a[4],--b)}}var m={PendingAjax:[],ActiveAjaxCount:0,MaxActiveAjaxCount:1,FailAllError:0,challengeParams:null,noncecounter:1,authcounter:0,socket:null,socketState:0};
47
+m.host=b;m.port=c;m.user=a;m.pass=d;m.tls=e;m.tlsv1only=0;m.cnonce=Math.random().toString(36).substring(7);m.inDataCount=0;m.amtVersion=null;m.digestRealmMatch=null;m.digestRealm=null;m.PerformAjax=function(a,b,c,p,d,e){m.ActiveAjaxCount<m.MaxActiveAjaxCount&&0==m.PendingAjax.length?m.PerformAjaxEx(a,b,c,d,e):1==p?m.PendingAjax.unshift([a,b,c,d,e]):m.PendingAjax.push([a,b,c,d,e])};m.PerformNextAjax=function(){if(!(m.ActiveAjaxCount>=m.MaxActiveAjaxCount||0==m.PendingAjax.length)){var a=m.PendingAjax.shift();
48
+m.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);m.PerformNextAjax()}};m.PerformAjaxEx=function(a,b,c,p,d){if(0!=m.FailAllError)m.gotNextMessagesError({status:m.FailAllError},"error",null,[a,b,c,p,d]);else return a||(a=""),m.ActiveAjaxCount++,m.PerformAjaxExNodeJS(a,b,c,p,d)};m.pendingAjaxCall=[];m.PerformAjaxExNodeJS=function(a,b,c,p,d){m.PerformAjaxExNodeJS2(a,b,c,p,d,3)};m.PerformAjaxExNodeJS2=function(a,b,c,p,d,e){0>=e||0!=m.FailAllError?(m.ActiveAjaxCount--,999!=m.FailAllError&&m.gotNextMessages(null,
49
+"error",{status:0==m.FailAllError?408:m.FailAllError},[a,b,c,p,d]),m.PerformNextAjax()):(m.pendingAjaxCall.push([a,b,c,p,d,e]),0==m.socketState?m.xxConnectHttpSocket():2==m.socketState&&m.sendRequest(a,p,d))};m.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var p=c+" "+b+" HTTP/1.1\r\n";if(null!=m.challengeParams){m.digestRealm=m.challengeParams.realm;if(m.digestRealmMatch&&m.digestRealm!=m.digestRealmMatch){m.FailAllError=997;m.CancelAllQueries(997);return}c=hex_md5(hex_md5(m.user+":"+m.challengeParams.realm+
50
+":"+m.pass)+":"+m.challengeParams.nonce+":"+m.noncecounter+":"+m.cnonce+":"+m.challengeParams.qop+":"+hex_md5(c+":"+b));p+="Authorization: "+m.renderDigest({username:m.user,realm:m.challengeParams.realm,nonce:m.challengeParams.nonce,uri:b,qop:m.challengeParams.qop,response:c,nc:m.noncecounter++,cnonce:m.cnonce})+"\r\n"}a=p+="Host: "+m.host+":"+m.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==m.socketState&&null!=m.socket&&m.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(p=
51
+0;p<a.length;++p)b[p]=a.charCodeAt(p);try{m.socket.send(b.buffer)}catch(d){}}};m.parseDigest=function(a){a=a.substring(7).split(",");for(i in a)a[i]=a[i].trim();return a.reduce(function(a,b){var c=b.split("=");a[c[0]]=c[1].replace(/"/g,"");return a},{})};m.renderDigest=function(a){var b=[];for(i in a)b.push(i);return"Digest "+b.reduce(function(b,c){return b+","+c+'="'+a[c]+'"'},"").substring(1)};m.xxConnectHttpSocket=function(){m.inDataCount=0;m.socketState=1;m.socket=new WebSocket(window.location.protocol.replace("http",
52
+"ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=1&host="+m.host+"&port="+m.port+"&tls="+m.tls+"&tls1only="+m.tlsv1only+("*"==a?"&serverauth=1":"")+("undefined"===typeof d?"&serverauth=1&user="+a:""));m.socket.onopen=l;m.socket.onmessage=n;m.socket.onclose=p};var v=new FileReader,h=!1,x=[];v.readAsBinaryString?v.onload=function(a){r(a.target.result);0==x.length?h=!1:v.readAsBinaryString(new Blob([x.shift()]))}:v.readAsArrayBuffer&&
53
+(v.onloadend=function(a){r(a.target.result);0==x.length?h=!1:v.readAsArrayBuffer(x.shift())});m.gotNextMessages=function(a,b,c,p){if(999!=m.FailAllError)if(0!=m.FailAllError)p[1](null,m.FailAllError,p[2]);else if(200!=c.status)p[1](null,c.status,p[2]);else p[1](a,200,p[2])};m.gotNextMessagesError=function(a,b,c,p){if(999!=m.FailAllError)if(0!=m.FailAllError)p[1](null,m.FailAllError,p[2]);else p[1](m,null,{Header:{HttpError:a.status}},a.status,p[2])};m.CancelAllQueries=function(a){for(;0<m.PendingAjax.length;){var b=
54
+m.PendingAjax.shift();b[1](null,a,b[2])}null!=m.websocket&&(m.websocket.close(),m.websocket=null,m.socketState=0)};return m},CreateAmtRedirect=function(b){var c={};c.m=b;b.parent=c;c.State=0;c.socket=null;c.host=null;c.port=0;c.user=null;c.pass=null;c.authuri="/RedirectionService";c.tlsv1only=0;c.connectstate=0;c.protocol=b.protocol;c.amtaccumulator="";c.amtsequence=1;c.amtkeepalivetimer=null;c.digestRealmMatch=null;c.onStateChanged=null;c.Start=function(a,b,d,p,e){c.host=a;c.port=b;c.user=d;c.pass=
55
+p;c.connectstate=0;c.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="+a+"&port="+b+"&tls="+e+("*"==d?"&serverauth=1":"")+("undefined"===typeof p?"&serverauth=1&user="+d:"")+"&tls1only="+c.tlsv1only);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1)};c.xxOnSocketConnected=function(){urlvars&&
56
urlvars.redirtrace&&console.log("REDIR-CONNECT");c.xxStateChange(2);1==c.protocol&&c.xxSend(c.RedirectStartSol);2==c.protocol&&c.xxSend(c.RedirectStartKvm);3==c.protocol&&c.xxSend(c.RedirectStartIder)};var a=new FileReader,d=!1,e=[];a.readAsBinaryString?a.onload=function(b){c.xxOnSocketData(b.target.result);0==e.length?d=!1:a.readAsBinaryString(new Blob([e.shift()]))}:a.readAsArrayBuffer&&(a.onloadend=function(b){c.xxOnSocketData(b.target.result);0==e.length?d=!1:a.readAsArrayBuffer(e.shift())});
57
-c.xxOnMessage=function(b){c.inDataCount++;if("object"==typeof b.data)if(1==d)e.push(b.data);else if(a.readAsBinaryString)d=!0,a.readAsBinaryString(new Blob([b.data]));else if(a.readAsArrayBuffer)d=!0,a.readAsArrayBuffer(b.data);else{var p="";b=new Uint8Array(b.data);for(var q=b.byteLength,n=0;n<q;n++)p+=String.fromCharCode(b[n]);c.xxOnSocketData(p)}else c.xxOnSocketData(b.data)};c.xxOnSocketData=function(a){if(a&&-1!=c.connectstate){if("object"===typeof a){var b="",d=new Uint8Array(a),n=d.byteLength;
58
-for(a=0;a<n;a++)b+=String.fromCharCode(d[a]);a=b}else if("string"!==typeof a)return;if((2==c.protocol||3==c.protocol)&&1==c.connectstate)return c.m.ProcessData(a);c.amtaccumulator+=a;for(urlvars&&urlvars.redirtrace&&console.log("REDIR-RECV("+c.amtaccumulator.length+"): "+rstr2hex(c.amtaccumulator));1<=c.amtaccumulator.length;){a=0;switch(c.amtaccumulator.charCodeAt(0)){case 17:if(4>c.amtaccumulator.length)return;switch(c.amtaccumulator.charCodeAt(1)){case 0:if(13>c.amtaccumulator.length)return;b=
59
-c.amtaccumulator.charCodeAt(12);if(c.amtaccumulator.length<13+b)return;c.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));a=13+b;break;default:c.Stop()}break;case 20:if(9>c.amtaccumulator.length)return;var e=ReadIntX(c.amtaccumulator,5);if(c.amtaccumulator.length<9+e)return;var n=c.amtaccumulator.charCodeAt(1),b=c.amtaccumulator.charCodeAt(4),v=[];for(a=0;a<e;a++)v.push(c.amtaccumulator.charCodeAt(9+a));d=c.amtaccumulator.substring(9,9+e);a=9+e;if(0==b)0<=v.indexOf(4)?c.xxSend(String.fromCharCode(19,
57
+c.xxOnMessage=function(b){c.inDataCount++;if("object"==typeof b.data)if(1==d)e.push(b.data);else if(a.readAsBinaryString)d=!0,a.readAsBinaryString(new Blob([b.data]));else if(a.readAsArrayBuffer)d=!0,a.readAsArrayBuffer(b.data);else{var n="";b=new Uint8Array(b.data);for(var r=b.byteLength,p=0;p<r;p++)n+=String.fromCharCode(b[p]);c.xxOnSocketData(n)}else c.xxOnSocketData(b.data)};c.xxOnSocketData=function(a){if(a&&-1!=c.connectstate){if("object"===typeof a){var b="",d=new Uint8Array(a),p=d.byteLength;
58
+for(a=0;a<p;a++)b+=String.fromCharCode(d[a]);a=b}else if("string"!==typeof a)return;if((2==c.protocol||3==c.protocol)&&1==c.connectstate)return c.m.ProcessData(a);c.amtaccumulator+=a;for(urlvars&&urlvars.redirtrace&&console.log("REDIR-RECV("+c.amtaccumulator.length+"): "+rstr2hex(c.amtaccumulator));1<=c.amtaccumulator.length;){a=0;switch(c.amtaccumulator.charCodeAt(0)){case 17:if(4>c.amtaccumulator.length)return;switch(c.amtaccumulator.charCodeAt(1)){case 0:if(13>c.amtaccumulator.length)return;b=
59
+c.amtaccumulator.charCodeAt(12);if(c.amtaccumulator.length<13+b)return;c.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));a=13+b;break;default:c.Stop()}break;case 20:if(9>c.amtaccumulator.length)return;var e=ReadIntX(c.amtaccumulator,5);if(c.amtaccumulator.length<9+e)return;var p=c.amtaccumulator.charCodeAt(1),b=c.amtaccumulator.charCodeAt(4),v=[];for(a=0;a<e;a++)v.push(c.amtaccumulator.charCodeAt(9+a));d=c.amtaccumulator.substring(9,9+e);a=9+e;if(0==b)0<=v.indexOf(4)?c.xxSend(String.fromCharCode(19,
60
0,0,0,4)+IntToStrX(c.user.length+c.authuri.length+8)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(0,0)+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(0,0,0,0)):0<=v.indexOf(3)?c.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(c.user.length+c.authuri.length+7)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(0,0)+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(0,0,0)):0<=v.indexOf(1)?c.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(c.user.length+
61
-c.pass.length+2)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(c.pass.length)+c.pass):c.Stop();else if(3!=b&&4!=b||1!=n)0==n?(1==c.protocol&&c.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(c.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0)),2==c.protocol&&c.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0)),3==c.protocol&&(c.connectstate=1,c.xxStateChange(3))):c.Stop();else{e=0;v=d.charCodeAt(e);n=d.substring(e+
62
-1,e+1+v);e+=v+1;if(c.digestRealmMatch&&c.digestRealmMatch!=n){c.Stop();return}var h=d.charCodeAt(e),v=d.substring(e+1,e+1+h),e=e+(h+1),h=0,h=null,z=c.xxRandomNonce(32),B="";4==b&&(h=d.charCodeAt(e),h=d.substring(e+1,e+1+h),B="00000002:"+z+":"+h+":");d=hex_md5(hex_md5(c.user+":"+n+":"+c.pass)+":"+v+":"+B+hex_md5("POST:"+c.authuri));e=c.user.length+n.length+v.length+c.authuri.length+z.length+8+d.length+7;4==b&&(e+=h.length+1);d=String.fromCharCode(19,0,0,0,b)+IntToStrX(e)+String.fromCharCode(c.user.length)+
63
-c.user+String.fromCharCode(n.length)+n+String.fromCharCode(v.length)+v+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(z.length)+z+String.fromCharCode(8)+"00000002"+String.fromCharCode(d.length)+d;4==b&&(d+=String.fromCharCode(h.length)+h);c.xxSend(d)}break;case 33:if(23>c.amtaccumulator.length)break;a=23;c.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(c.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==c.protocol&&(c.amtkeepalivetimer=setInterval(c.xxSendAmtKeepAlive,2E3));
61
+c.pass.length+2)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(c.pass.length)+c.pass):c.Stop();else if(3!=b&&4!=b||1!=p)0==p?(1==c.protocol&&c.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(c.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0)),2==c.protocol&&c.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0)),3==c.protocol&&(c.connectstate=1,c.xxStateChange(3))):c.Stop();else{e=0;v=d.charCodeAt(e);p=d.substring(e+
62
+1,e+1+v);e+=v+1;if(c.digestRealmMatch&&c.digestRealmMatch!=p){c.Stop();return}var h=d.charCodeAt(e),v=d.substring(e+1,e+1+h),e=e+(h+1),h=0,h=null,x=c.xxRandomNonce(32),B="";4==b&&(h=d.charCodeAt(e),h=d.substring(e+1,e+1+h),B="00000002:"+x+":"+h+":");d=hex_md5(hex_md5(c.user+":"+p+":"+c.pass)+":"+v+":"+B+hex_md5("POST:"+c.authuri));e=c.user.length+p.length+v.length+c.authuri.length+x.length+8+d.length+7;4==b&&(e+=h.length+1);d=String.fromCharCode(19,0,0,0,b)+IntToStrX(e)+String.fromCharCode(c.user.length)+
63
+c.user+String.fromCharCode(p.length)+p+String.fromCharCode(v.length)+v+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(x.length)+x+String.fromCharCode(8)+"00000002"+String.fromCharCode(d.length)+d;4==b&&(d+=String.fromCharCode(h.length)+h);c.xxSend(d)}break;case 33:if(23>c.amtaccumulator.length)break;a=23;c.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(c.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==c.protocol&&(c.amtkeepalivetimer=setInterval(c.xxSendAmtKeepAlive,2E3));
64
c.connectstate=1;c.xxStateChange(3);break;case 41:if(10>c.amtaccumulator.length)break;a=10;break;case 42:if(10>c.amtaccumulator.length)break;b=10+((c.amtaccumulator.charCodeAt(9)&255)<<8)+(c.amtaccumulator.charCodeAt(8)&255);if(c.amtaccumulator.length<b)break;c.m.ProcessData(c.amtaccumulator.substring(10,b));a=b;break;case 43:if(8>c.amtaccumulator.length)break;a=8;break;case 65:if(8>c.amtaccumulator.length)break;c.connectstate=1;c.m.Start();8<c.amtaccumulator.length&&c.m.ProcessData(c.amtaccumulator.substring(8));
65
a=c.amtaccumulator.length;break;case 240:c.serverIsRecording=!0;a=1;break;default:console.log("Unknown Intel AMT command: "+c.amtaccumulator.charCodeAt(0)+" acclen="+c.amtaccumulator.length);c.Stop();return}if(0==a)break;c.amtaccumulator=c.amtaccumulator.substring(a)}}};c.xxSend=function(a){urlvars&&urlvars.redirtrace&&console.log("REDIR-SEND("+a.length+"): "+rstr2hex(a));if(null!=c.socket&&c.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),d=0;d<a.length;++d)b[d]=a.charCodeAt(d);
66
c.socket.send(b.buffer)}};c.Send=function(a){null!=c.socket&&1==c.connectstate&&(1==c.protocol?c.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(c.amtsequence++)+ShortToStrX(a.length)+a):c.xxSend(a))};c.xxSendAmtKeepAlive=function(){null!=c.socket&&c.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(c.amtsequence++))};c.xxRandomNonceX="abcdef0123456789";c.xxRandomNonce=function(a){for(var b="",d=0;d<a;d++)b+=c.xxRandomNonceX.charAt(Math.floor(Math.random()*c.xxRandomNonceX.length));return b};c.xxOnSocketClosed=
67
function(){urlvars&&urlvars.redirtrace&&console.log("REDIR-CLOSED");c.Stop()};c.xxStateChange=function(a){if(c.State!=a&&(c.State=a,c.m.xxStateChange(c.State),null!=c.onStateChanged))c.onStateChanged(c,c.State)};c.Stop=function(){c.xxStateChange(0);c.connectstate=-1;c.amtaccumulator="";null!=c.socket&&(c.socket.close(),c.socket=null);null!=c.amtkeepalivetimer&&(clearInterval(c.amtkeepalivetimer),c.amtkeepalivetimer=null)};c.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);c.RedirectStartKvm=
68
-String.fromCharCode(16,1,0,0,75,86,77,82);c.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return c},WsmanStackCreateService=function(b,c,a,d,e,l){function p(a){for(var b,c={},n=0;n<a.childNodes.length;n++){var d=a.childNodes[n];b=null==d.childElementCount||0==d.childElementCount?d.textContent:p(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var g=b;if(null!=d.attributes&&0<d.attributes.length)for(g={Value:b},b=0;b<d.attributes.length;b++)g["@"+d.attributes[b].name]=
69
-d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(g):c[d.localName]=null==c[d.localName]?g:[c[d.localName],g]}return c}function q(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function n(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";var b="<w:SelectorSet>",c;for(c in a)if(a.hasOwnProperty(c)){b+=
70
-'<w:Selector Name="'+c+'">';if(a[c].ReferenceParameters){var b=b+"<a:EndpointReference>",b=b+("<a:Address>"+a[c].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+a[c].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>"),n=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(n))for(var d=0;d<n.length;d++)b+="<w:Selector"+q(n[d])+">"+n[d].Value+"</w:Selector>";else b+="<w:Selector"+q(n)+">"+n.Value+"</w:Selector>";b+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else b+=
71
-a[c];b+="</w:Selector>"}return b+"</w:SelectorSet>"}var m={NextMessageId:1,Address:"/wsman"};m.comm=CreateWsmanComm(b,c,a,d,e,l);m.PerformAjax=function(a,b,c,n,d){null==d&&(d="");m.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" '+
72
-d+"><Header><a:Action>"+a,function(a,c,n){200!=c?b(m,null,{Header:{HttpError:c}},c,n):(a=m.ParseWsman(a))&&null!=a?b(m,a.Header.ResourceURI,a,200,n):b(m,null,{Header:{HttpError:c}},601,n)},c,n)};m.CancelAllQueries=function(a){m.comm.CancelAllQueries(a)};m.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};m.ExecSubscribe=function(a,b,c,d,e,g,J,u,C,x){var w="",F="";u="";null!=C&&null!=x&&(w='<t:IssuedTokens 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"><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>'+
73
-C+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+x+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>",F='<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>');null!=u&&(u="<a:ReferenceParameters><m:arg>"+u+"</m:arg></a:ReferenceParameters>");"PushWithAck"==b?b="dmtf.org/wbem/wsman/1/wsman/PushWithAck":"Push"==b&&(b="xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push");
74
-a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+n(J)+w+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.'+b+'"><e:NotifyTo><a:Address>'+c+"</a:Address>"+u+"</e:NotifyTo>"+F+"</e:Delivery></e:Subscribe>";m.PerformAjax(a+"</Body></Envelope>",d,e,
75
-g,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};m.ExecUnSubscribe=function(a,b,c,d,e){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+n(e)+"</Header><Body><e:Unsubscribe/>";m.PerformAjax(a+"</Body></Envelope>",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};
76
-m.ExecPut=function(a,b,c,d,e,g){g="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.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>"+n(g)+"</Header><Body>";if(a&&null!=b){var J=m.GetNameFromUrl(a);a="<r:"+J+' xmlns:r="'+a+'">';for(var u in b)if(b.hasOwnProperty(u)&&
77
-0!==u.indexOf("__")&&0!==u.indexOf("@")&&null!=b[u]&&"function"!==typeof b[u])if("object"===typeof b[u]&&b[u].ReferenceParameters){a+="<r:"+u+"><a:Address>"+b[u].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+b[u].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var C=b[u].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(C))for(var x=0;x<C.length;x++)a+="<w:Selector"+q(C[x])+">"+C[x].Value+"</w:Selector>";else a+="<w:Selector"+q(C)+">"+C.Value+"</w:Selector>";
78
-a+="</w:SelectorSet></a:ReferenceParameters></r:"+u+">"}else if(Array.isArray(b[u]))for(x=0;x<b[u].length;x++)a+="<r:"+u+">"+b[u][x].toString()+"</r:"+u+">";else a+="<r:"+u+">"+b[u].toString()+"</r:"+u+">";b=a+("</r:"+J+">")}else b="";m.PerformAjax(g+b+"</Body></Envelope>",c,d,e)};m.ExecCreate=function(a,b,c,d,e,g){var J=m.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +
79
-"</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>"+n(g)+"</Header><Body><g:"+J+' xmlns:g="'+a+'">';for(var u in b)a+="<g:"+u+">"+b[u]+"</g:"+u+">";m.PerformAjax(a+"</g:"+J+"></Body></Envelope>",c,d,e)};m.ExecDelete=function(a,b,c,d,e){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +
80
-"</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>"+n(b)+"</Header><Body /></Envelope>";m.PerformAjax(a,c,d,e)};m.ExecGet=function(a,b,c,n){m.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.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>",
81
-b,c,n)};m.ExecMethod=function(a,b,c,n,d,g,e){var u="",C;for(C in c)if(null!=c[C])if(Array.isArray(c[C]))for(var x in c[C])u+="<r:"+C+">"+c[C][x]+"</r:"+C+">";else u+="<r:"+C+">"+c[C]+"</r:"+C+">";m.ExecMethodXml(a,b,u,n,d,g,e)};m.ExecMethodXml=function(a,b,c,d,e,g,J){m.PerformAjax(a+"/"+b+"</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.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>"+
82
-n(J)+"</Header><Body><r:"+b+'_INPUT xmlns:r="'+a+'">'+c+"</r:"+b+"_INPUT></Body></Envelope>",d,e,g)};m.ExecEnum=function(a,b,c,n){m.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.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>',
83
-b,c,n)};m.ExecPull=function(a,b,c,n,d){m.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.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>'+b+"</EnumerationContext></Pull></Body></Envelope>",
84
-c,n,d)};m.ParseWsman=function(a){try{if(!a.childNodes){var b=a;if(window.DOMParser)a=(new DOMParser).parseFromString(b,"text/xml");else{var c=new ActiveXObject("Microsoft.XMLDOM");c.async=!1;c.loadXML(b);a=c}}var b={Header:{}},n=a.getElementsByTagName("Header")[0],d;n||(n=a.getElementsByTagName("a:Header")[0]);if(!n)return null;for(c=0;c<n.childNodes.length;c++){var g=n.childNodes[c];b.Header[g.localName]=g.textContent}var e=a.getElementsByTagName("Body")[0];e||(e=a.getElementsByTagName("a:Body")[0]);
85
-if(!e)return null;0<e.childNodes.length&&(d=e.childNodes[0].localName,d.indexOf("_OUTPUT")==d.length-7&&(d=d.substring(0,d.length-7)),b.Header.Method=d,b.Body=p(e.childNodes[0]));return b}catch(m){return console.log("Unable to parse XML: "+a),null}};return m};
86
-function AmtStackCreateService(b){function c(){var a=h.GetPendingActions();z<a&&(z=a);null!=h.onProcessChanged&&B!=a&&(B=a,h.onProcessChanged(a,z));0==a&&(z=0)}function a(a,b,c,g,n,k,A){200!=n?(c(h,a,null,n,k),e(1)):null!=b&&"EnumerateResponse"==b.Header.Method&&b.Body.EnumerationContext?h.wsman.ExecPull(g,b.Body.EnumerationContext,function(b,g,n,e){d(a,n,c,g,[],e,k,A)}):(c(h,a,null,603,k),e(1))}function d(a,b,g,n,k,m,A,y){if(200!=m)g(h,a,null,m,A),e(1);else if(null==b||"PullResponse"!=b.Header.Method)g(h,
87
-a,null,604,A),e(1);else{for(var E in b.Body.Items)if(b.Body.Items[E]instanceof Array)for(var u in b.Body.Items[E])"function"!=typeof b.Body.Items[E][u]&&k.push(b.Body.Items[E][u]);else"function"!=typeof b.Body.Items[E]&&k.push(b.Body.Items[E]);b.Body.EnumerationContext?h.wsman.ExecPull(n,b.Body.EnumerationContext,function(b,c,n,e){d(a,n,g,c,k,e,A,1)}):(e(1),g(h,a,k,m,A),c())}}function e(a){h.ActiveEnumsCount-=a;h.ActiveEnumsCount>=h.MaxActiveEnumsCount||0==h.PendingEnums.length?c():(a=h.PendingEnums.shift(),
88
-h.Enum(a[0],a[1],a[2]),e(0))}function l(a,b,g,n,d,e,A){h.PendingBatchOperations-=2;var y=b.shift(),k=h.Enum;"*"==y[0]&&(k=h.Get,y=y.substring(1));k(y,function(d,y,k,E,H){H[2][y]={response:null==k?null:k.Body,responses:k,status:E};0==H[1].length||401==E||1!=e&&200!=E&&400!=E?(h.PendingBatchOperations-=2*b.length,c(),g(h,a,H[2],E,n)):(c(),l(a,b,g,n,H[2],A))},[a,b,d],A);c()}function p(a){a.names.length<=a.current?a.callback(h,a.name,a.responses,200,a.tag):(h.wsman.ExecGet(h.CompleteName(a.names[a.current]),
89
-function(b,c,g,n){null==g||200!=n?a.callback(h,a.name,null,n,a.tag):(a.responses[g.Header.Method]=g,p(a))},a.pri),a.current++);c()}function q(a,b,c,g,d){if(200!=g||"0"!=c.Body.ReturnValue)d[0](h,null,d[2]);else h.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,n,d)}function n(a,b,c,g,d){if(200!=g||"0"!=c.Body.ReturnValue)d[0](h,null,d[2]);else{var e,A,y;b=d[2];g=new Date;var k=c.Body.RecordArray;"string"===typeof k&&(c.Body.RecordArray=[c.Body.RecordArray]);for(e in k){a=null;try{a=window.atob(k[e])}catch(u){}if(null!=
90
-a&&(A=ReadIntX(a,0),0<A&&4294967295>A)){y={DeviceAddress:a.charCodeAt(4),EventSensorType:a.charCodeAt(5),EventType:a.charCodeAt(6),EventOffset:a.charCodeAt(7),EventSourceType:a.charCodeAt(8),EventSeverity:a.charCodeAt(9),SensorNumber:a.charCodeAt(10),Entity:a.charCodeAt(11),EntityInstance:a.charCodeAt(12),EventData:[],Time:new Date(1E3*(A+60*g.getTimezoneOffset()))};for(A=13;21>A;A++)y.EventData.push(a.charCodeAt(A));y.EntityStr=J[y.Entity];y.Desc=m(y.EventSensorType,y.EventOffset,y.EventData,y.Entity);
91
-y.EntityStr||(y.EntityStr="Unknown");b.push(y)}}if(1!=c.Body.NoMoreRecords)h.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,n,[d[0],b,d[2]]);else d[0](h,b,d[2])}}function m(a,b,c,n){if(15==a)return 235==c[0]?"Invalid Data":0==b?k[c[1]]:g[c[1]];if(18==a&&170==c[0])return"Agent watchdog "+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... changed to "+h.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Case intrusion";if(192==a&&0==b&&170==c[0]&&
68
+String.fromCharCode(16,1,0,0,75,86,77,82);c.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return c},WsmanStackCreateService=function(b,c,a,d,e,l){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var g=b;if(null!=d.attributes&&0<d.attributes.length)for(g={Value:b},b=0;b<d.attributes.length;b++)g["@"+d.attributes[b].name]=
69
+d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(g):c[d.localName]=null==c[d.localName]?g:[c[d.localName],g]}return c}function r(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";var b="<w:SelectorSet>",c;for(c in a)if(a.hasOwnProperty(c)){b+=
70
+'<w:Selector Name="'+c+'">';if(a[c].ReferenceParameters){var b=b+"<a:EndpointReference>",b=b+("<a:Address>"+a[c].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+a[c].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>"),p=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(p))for(var d=0;d<p.length;d++)b+="<w:Selector"+r(p[d])+">"+p[d].Value+"</w:Selector>";else b+="<w:Selector"+r(p)+">"+p.Value+"</w:Selector>";b+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else b+=
71
+a[c];b+="</w:Selector>"}return b+"</w:SelectorSet>"}var m={NextMessageId:1,Address:"/wsman"};m.comm=CreateWsmanComm(b,c,a,d,e,l);m.PerformAjax=function(a,b,c,p,d){null==d&&(d="");m.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" '+
72
+d+"><Header><a:Action>"+a,function(a,c,p){200!=c?b(m,null,{Header:{HttpError:c}},c,p):(a=m.ParseWsman(a))&&null!=a?b(m,a.Header.ResourceURI,a,200,p):b(m,null,{Header:{HttpError:c}},601,p)},c,p)};m.CancelAllQueries=function(a){m.comm.CancelAllQueries(a)};m.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};m.ExecSubscribe=function(a,b,c,d,e,g,K,u,C,w){var y="",E="";u="";null!=C&&null!=w&&(y='<t:IssuedTokens 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"><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>'+
73
+C+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+w+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>",E='<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>');null!=u&&(u="<a:ReferenceParameters><m:arg>"+u+"</m:arg></a:ReferenceParameters>");"PushWithAck"==b?b="dmtf.org/wbem/wsman/1/wsman/PushWithAck":"Push"==b&&(b="xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push");
74
+a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+p(K)+y+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.'+b+'"><e:NotifyTo><a:Address>'+c+"</a:Address>"+u+"</e:NotifyTo>"+E+"</e:Delivery></e:Subscribe>";m.PerformAjax(a+"</Body></Envelope>",d,e,
75
+g,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};m.ExecUnSubscribe=function(a,b,c,d,e){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+p(e)+"</Header><Body><e:Unsubscribe/>";m.PerformAjax(a+"</Body></Envelope>",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};
76
+m.ExecPut=function(a,b,c,d,e,g){g="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.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>"+p(g)+"</Header><Body>";if(a&&null!=b){var K=m.GetNameFromUrl(a);a="<r:"+K+' xmlns:r="'+a+'">';for(var u in b)if(b.hasOwnProperty(u)&&
77
+0!==u.indexOf("__")&&0!==u.indexOf("@")&&null!=b[u]&&"function"!==typeof b[u])if("object"===typeof b[u]&&b[u].ReferenceParameters){a+="<r:"+u+"><a:Address>"+b[u].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+b[u].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var C=b[u].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(C))for(var w=0;w<C.length;w++)a+="<w:Selector"+r(C[w])+">"+C[w].Value+"</w:Selector>";else a+="<w:Selector"+r(C)+">"+C.Value+"</w:Selector>";
78
+a+="</w:SelectorSet></a:ReferenceParameters></r:"+u+">"}else if(Array.isArray(b[u]))for(w=0;w<b[u].length;w++)a+="<r:"+u+">"+b[u][w].toString()+"</r:"+u+">";else a+="<r:"+u+">"+b[u].toString()+"</r:"+u+">";b=a+("</r:"+K+">")}else b="";m.PerformAjax(g+b+"</Body></Envelope>",c,d,e)};m.ExecCreate=function(a,b,c,d,e,g){var K=m.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +
79
+"</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>"+p(g)+"</Header><Body><g:"+K+' xmlns:g="'+a+'">';for(var u in b)a+="<g:"+u+">"+b[u]+"</g:"+u+">";m.PerformAjax(a+"</g:"+K+"></Body></Envelope>",c,d,e)};m.ExecDelete=function(a,b,c,d,e){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +
80
+"</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>"+p(b)+"</Header><Body /></Envelope>";m.PerformAjax(a,c,d,e)};m.ExecGet=function(a,b,c,p){m.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.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>",
81
+b,c,p)};m.ExecMethod=function(a,b,c,p,d,g,e){var u="",C;for(C in c)if(null!=c[C])if(Array.isArray(c[C]))for(var w in c[C])u+="<r:"+C+">"+c[C][w]+"</r:"+C+">";else u+="<r:"+C+">"+c[C]+"</r:"+C+">";m.ExecMethodXml(a,b,u,p,d,g,e)};m.ExecMethodXml=function(a,b,c,d,e,g,K){m.PerformAjax(a+"/"+b+"</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.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>"+
82
+p(K)+"</Header><Body><r:"+b+'_INPUT xmlns:r="'+a+'">'+c+"</r:"+b+"_INPUT></Body></Envelope>",d,e,g)};m.ExecEnum=function(a,b,c,p){m.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.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>',
83
+b,c,p)};m.ExecPull=function(a,b,c,p,d){m.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.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>'+b+"</EnumerationContext></Pull></Body></Envelope>",
84
+c,p,d)};m.ParseWsman=function(a){try{if(!a.childNodes){var b=a;if(window.DOMParser)a=(new DOMParser).parseFromString(b,"text/xml");else{var c=new ActiveXObject("Microsoft.XMLDOM");c.async=!1;c.loadXML(b);a=c}}var b={Header:{}},p=a.getElementsByTagName("Header")[0],d;p||(p=a.getElementsByTagName("a:Header")[0]);if(!p)return null;for(c=0;c<p.childNodes.length;c++){var g=p.childNodes[c];b.Header[g.localName]=g.textContent}var e=a.getElementsByTagName("Body")[0];e||(e=a.getElementsByTagName("a:Body")[0]);
85
+if(!e)return null;0<e.childNodes.length&&(d=e.childNodes[0].localName,d.indexOf("_OUTPUT")==d.length-7&&(d=d.substring(0,d.length-7)),b.Header.Method=d,b.Body=n(e.childNodes[0]));return b}catch(m){return console.log("Unable to parse XML: "+a),null}};return m};
86
+function AmtStackCreateService(b){function c(){var a=h.GetPendingActions();x<a&&(x=a);null!=h.onProcessChanged&&B!=a&&(B=a,h.onProcessChanged(a,x));0==a&&(x=0)}function a(a,b,c,g,p,k,A){200!=p?(c(h,a,null,p,k),e(1)):null!=b&&"EnumerateResponse"==b.Header.Method&&b.Body.EnumerationContext?h.wsman.ExecPull(g,b.Body.EnumerationContext,function(b,g,p,e){d(a,p,c,g,[],e,k,A)}):(c(h,a,null,603,k),e(1))}function d(a,b,g,p,k,m,A,z){if(200!=m)g(h,a,null,m,A),e(1);else if(null==b||"PullResponse"!=b.Header.Method)g(h,
87
+a,null,604,A),e(1);else{for(var D in b.Body.Items)if(b.Body.Items[D]instanceof Array)for(var u in b.Body.Items[D])"function"!=typeof b.Body.Items[D][u]&&k.push(b.Body.Items[D][u]);else"function"!=typeof b.Body.Items[D]&&k.push(b.Body.Items[D]);b.Body.EnumerationContext?h.wsman.ExecPull(p,b.Body.EnumerationContext,function(b,c,p,e){d(a,p,g,c,k,e,A,1)}):(e(1),g(h,a,k,m,A),c())}}function e(a){h.ActiveEnumsCount-=a;h.ActiveEnumsCount>=h.MaxActiveEnumsCount||0==h.PendingEnums.length?c():(a=h.PendingEnums.shift(),
88
+h.Enum(a[0],a[1],a[2]),e(0))}function l(a,b,g,p,d,e,A){h.PendingBatchOperations-=2;var z=b.shift(),k=h.Enum;"*"==z[0]&&(k=h.Get,z=z.substring(1));k(z,function(d,z,k,D,I){I[2][z]={response:null==k?null:k.Body,responses:k,status:D};0==I[1].length||401==D||1!=e&&200!=D&&400!=D?(h.PendingBatchOperations-=2*b.length,c(),g(h,a,I[2],D,p)):(c(),l(a,b,g,p,I[2],A))},[a,b,d],A);c()}function n(a){a.names.length<=a.current?a.callback(h,a.name,a.responses,200,a.tag):(h.wsman.ExecGet(h.CompleteName(a.names[a.current]),
89
+function(b,c,g,p){null==g||200!=p?a.callback(h,a.name,null,p,a.tag):(a.responses[g.Header.Method]=g,n(a))},a.pri),a.current++);c()}function r(a,b,c,g,d){if(200!=g||"0"!=c.Body.ReturnValue)d[0](h,null,d[2]);else h.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,p,d)}function p(a,b,c,g,d){if(200!=g||"0"!=c.Body.ReturnValue)d[0](h,null,d[2]);else{var e,A,z;b=d[2];g=new Date;var k=c.Body.RecordArray;"string"===typeof k&&(c.Body.RecordArray=[c.Body.RecordArray]);for(e in k){a=null;try{a=window.atob(k[e])}catch(u){}if(null!=
90
+a&&(A=ReadIntX(a,0),0<A&&4294967295>A)){z={DeviceAddress:a.charCodeAt(4),EventSensorType:a.charCodeAt(5),EventType:a.charCodeAt(6),EventOffset:a.charCodeAt(7),EventSourceType:a.charCodeAt(8),EventSeverity:a.charCodeAt(9),SensorNumber:a.charCodeAt(10),Entity:a.charCodeAt(11),EntityInstance:a.charCodeAt(12),EventData:[],Time:new Date(1E3*(A+60*g.getTimezoneOffset()))};for(A=13;21>A;A++)z.EventData.push(a.charCodeAt(A));z.EntityStr=K[z.Entity];z.Desc=m(z.EventSensorType,z.EventOffset,z.EventData,z.Entity);
91
+z.EntityStr||(z.EntityStr="Unknown");b.push(z)}}if(1!=c.Body.NoMoreRecords)h.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,p,[d[0],b,d[2]]);else d[0](h,b,d[2])}}function m(a,b,c,p){if(15==a)return 235==c[0]?"Invalid Data":0==b?k[c[1]]:g[c[1]];if(18==a&&170==c[0])return"Agent watchdog "+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... changed to "+h.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Case intrusion";if(192==a&&0==b&&170==c[0]&&
92
48==c[1]){if(0==c[2])return"A remote Serial Over LAN session was established.";if(1==c[2])return"Remote Serial Over LAN session finished. User control was restored.";if(2==c[2])return"A remote IDE-Redirection session was established.";if(3==c[2])return"Remote IDE-Redirection session finished. User control was restored."}if(36==a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="wired"),4294967293==a?"All received packet filter was matched on "+b+" interface.":4294967292==a?"All outbound packet filter was matched on "+
93
b+" interface.":4294967290==a?"Spoofed packet filter was matched on "+b+" interface.":"Filter "+a+" was matched on "+b+" interface.";if(192==a)return 0==c[2]?"Security policy invoked. Some or all network traffic (TX) was stopped.":2==c[2]?"Security policy invoked. Some or all network traffic (RX) was stopped.":"Security policy invoked.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"User request for remote connection.";if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"EAC error: attempt to get posture while NAC in Intel\ufffd AMT is disabled.";
94
-if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"HWA Error: general error"}return 6==a?"Authentication failed "+(c[1]+(c[2]<<8))+" times. The system may be under attack.":30==a?"No bootable media":32==a?"Operating system lockup or power interrupt":35==a?"System boot failure":37==a?"System firmware started (at least one CPU is properly executing).":"Unknown Sensor Type #"+a}function v(a,b,c,g,n){if(200!=g)n[0](h,[],g);else{var d,e,y=n[1],k=new Date,m;if(0<c.Body.RecordsReturned)for(e in c.Body.EventRecords=
95
-MakeToArray(c.Body.EventRecords),c.Body.EventRecords){a=null;try{a=window.atob(c.Body.EventRecords[e])}catch(z){console.log(z+" "+c.Body.EventRecords[e])}b={AuditAppID:ReadShort(a,0),EventID:ReadShort(a,2),InitiatorType:a.charCodeAt(4)};b.AuditApp=u[b.AuditAppID];b.Event=u[100*b.AuditAppID+b.EventID];b.Event||(b.Event="#"+b.EventID);0==b.InitiatorType&&(d=a.charCodeAt(5),b.Initiator=a.substring(6,6+d),d=6+d);1==b.InitiatorType&&(b.KerberosUserInDomain=ReadInt(a,5),d=a.charCodeAt(9),b.Initiator=GetSidString(a.substring(10,
96
-10+d)),d=10+d);2==b.InitiatorType&&(b.Initiator="<i>Local</i>",d=5);3==b.InitiatorType&&(b.Initiator="<i>KVM Default Port</i>",d=5);m=ReadInt(a,d);b.Time=new Date(1E3*(m+60*k.getTimezoneOffset()));d+=4;b.MCLocationType=a.charCodeAt(d++);m=a.charCodeAt(d++);b.NetAddress=a.substring(d,d+m);d+=m;m=a.charCodeAt(d++);b.Ex=a.substring(d,d+m);b.ExStr=h.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);y.push(b)}if(c.Body.TotalRecordCount>y.length)h.AMT_AuditLog_ReadRecords(y.length+1,v,[n[0],y]);
97
-else n[0](h,y,g)}}var h={};h.wsman=b;h.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/"];h.PendingEnums=[];h.PendingBatchOperations=0;h.ActiveEnumsCount=0;h.MaxActiveEnumsCount=1;h.onProcessChanged=null;var z=0,B=0;h.GetPendingActions=function(){return 2*h.PendingEnums.length+h.ActiveEnumsCount+h.wsman.comm.PendingAjax.length+h.wsman.comm.ActiveAjaxCount+h.PendingBatchOperations};h.Subscribe=function(a,
98
-b,g,n,d,e,A,y,k,m){h.wsman.ExecSubscribe(h.CompleteName(a),b,g,function(b,g,w,e){c();n(h,a,w,e,d)},0,e,A,y,k,m);c()};h.UnSubscribe=function(a,b,g,n,d){h.wsman.ExecUnSubscribe(h.CompleteName(a),function(n,d,e,k){c();b(h,a,e,k,g)},0,n,d);c()};h.Get=function(a,b,g,n){h.wsman.ExecGet(h.CompleteName(a),function(n,d,e,y){c();b(h,a,e,y,g)},0,n);c()};h.Put=function(a,b,g,n,d,e){h.wsman.ExecPut(h.CompleteName(a),b,function(b,d,e,k){c();g(h,a,e,k,n)},0,d,e);c()};h.Create=function(a,b,g,n,d){h.wsman.ExecCreate(h.CompleteName(a),
99
-b,function(b,d,e,k){c();g(h,a,e,k,n)},0,d);c()};h.Delete=function(a,b,g,n,d){h.wsman.ExecDelete(h.CompleteName(a),b,function(b,d,e,k){c();g(h,a,e,k,n)},0,d);c()};h.Exec=function(a,b,g,n,d,e,A){h.wsman.ExecMethod(h.CompleteName(a),b,g,function(b,g,e,w){c();n(h,a,h.CompleteExecResponse(e),w,d)},0,e,A);c()};h.ExecWithXml=function(a,b,g,n,d,e,A){h.wsman.ExecMethodXml(h.CompleteName(a),b,execArgumentsToXml(g),function(b,g,e,w){c();n(h,a,h.CompleteExecResponse(e),w,d)},0,e,A);c()};h.Enum=function(b,g,n,
100
-d){h.ActiveEnumsCount<h.MaxActiveEnumsCount?(h.ActiveEnumsCount++,h.wsman.ExecEnum(h.CompleteName(b),function(n,d,e,w,k){c();a(b,e,g,d,w,k)},n,d)):h.PendingEnums.push([b,g,n,d]);c()};h.BatchEnum=function(a,b,g,n,d,e){h.PendingBatchOperations+=2*b.length;l(a,Clone(b),g,n,{},d,e);c()};h.BatchGet=function(a,b,g,n,d){p({name:a,names:b,callback:g,current:0,responses:{},tag:n,pri:d});c()};h.CompleteName=function(a){if(0==a.indexOf("AMT_"))return h.pfx[0]+a;if(0==a.indexOf("CIM_"))return h.pfx[1]+a;if(0==
94
+if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"HWA Error: general error"}return 6==a?"Authentication failed "+(c[1]+(c[2]<<8))+" times. The system may be under attack.":30==a?"No bootable media":32==a?"Operating system lockup or power interrupt":35==a?"System boot failure":37==a?"System firmware started (at least one CPU is properly executing).":"Unknown Sensor Type #"+a}function v(a,b,c,g,p){if(200!=g)p[0](h,[],g);else{var d,e,z=p[1],k=new Date,m;if(0<c.Body.RecordsReturned)for(e in c.Body.EventRecords=
95
+MakeToArray(c.Body.EventRecords),c.Body.EventRecords){a=null;try{a=window.atob(c.Body.EventRecords[e])}catch(x){console.log(x+" "+c.Body.EventRecords[e])}b={AuditAppID:ReadShort(a,0),EventID:ReadShort(a,2),InitiatorType:a.charCodeAt(4)};b.AuditApp=u[b.AuditAppID];b.Event=u[100*b.AuditAppID+b.EventID];b.Event||(b.Event="#"+b.EventID);0==b.InitiatorType&&(d=a.charCodeAt(5),b.Initiator=a.substring(6,6+d),d=6+d);1==b.InitiatorType&&(b.KerberosUserInDomain=ReadInt(a,5),d=a.charCodeAt(9),b.Initiator=GetSidString(a.substring(10,
96
+10+d)),d=10+d);2==b.InitiatorType&&(b.Initiator="<i>Local</i>",d=5);3==b.InitiatorType&&(b.Initiator="<i>KVM Default Port</i>",d=5);m=ReadInt(a,d);b.Time=new Date(1E3*(m+60*k.getTimezoneOffset()));d+=4;b.MCLocationType=a.charCodeAt(d++);m=a.charCodeAt(d++);b.NetAddress=a.substring(d,d+m);d+=m;m=a.charCodeAt(d++);b.Ex=a.substring(d,d+m);b.ExStr=h.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);z.push(b)}if(c.Body.TotalRecordCount>z.length)h.AMT_AuditLog_ReadRecords(z.length+1,v,[p[0],z]);
97
+else p[0](h,z,g)}}var h={};h.wsman=b;h.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/"];h.PendingEnums=[];h.PendingBatchOperations=0;h.ActiveEnumsCount=0;h.MaxActiveEnumsCount=1;h.onProcessChanged=null;var x=0,B=0;h.GetPendingActions=function(){return 2*h.PendingEnums.length+h.ActiveEnumsCount+h.wsman.comm.PendingAjax.length+h.wsman.comm.ActiveAjaxCount+h.PendingBatchOperations};h.Subscribe=function(a,
98
+b,g,p,d,e,A,z,k,m){h.wsman.ExecSubscribe(h.CompleteName(a),b,g,function(b,g,y,e){c();p(h,a,y,e,d)},0,e,A,z,k,m);c()};h.UnSubscribe=function(a,b,g,p,d){h.wsman.ExecUnSubscribe(h.CompleteName(a),function(p,d,e,k){c();b(h,a,e,k,g)},0,p,d);c()};h.Get=function(a,b,g,p){h.wsman.ExecGet(h.CompleteName(a),function(p,d,e,z){c();b(h,a,e,z,g)},0,p);c()};h.Put=function(a,b,g,p,d,e){h.wsman.ExecPut(h.CompleteName(a),b,function(b,d,e,k){c();g(h,a,e,k,p)},0,d,e);c()};h.Create=function(a,b,g,p,d){h.wsman.ExecCreate(h.CompleteName(a),
99
+b,function(b,d,e,k){c();g(h,a,e,k,p)},0,d);c()};h.Delete=function(a,b,g,p,d){h.wsman.ExecDelete(h.CompleteName(a),b,function(b,d,e,k){c();g(h,a,e,k,p)},0,d);c()};h.Exec=function(a,b,g,p,d,e,A){h.wsman.ExecMethod(h.CompleteName(a),b,g,function(b,g,e,y){c();p(h,a,h.CompleteExecResponse(e),y,d)},0,e,A);c()};h.ExecWithXml=function(a,b,g,p,d,e,A){h.wsman.ExecMethodXml(h.CompleteName(a),b,execArgumentsToXml(g),function(b,g,e,y){c();p(h,a,h.CompleteExecResponse(e),y,d)},0,e,A);c()};h.Enum=function(b,g,p,
100
+d){h.ActiveEnumsCount<h.MaxActiveEnumsCount?(h.ActiveEnumsCount++,h.wsman.ExecEnum(h.CompleteName(b),function(p,d,e,y,k){c();a(b,e,g,d,y,k)},p,d)):h.PendingEnums.push([b,g,p,d]);c()};h.BatchEnum=function(a,b,g,p,d,e){h.PendingBatchOperations+=2*b.length;l(a,Clone(b),g,p,{},d,e);c()};h.BatchGet=function(a,b,g,p,d){n({name:a,names:b,callback:g,current:0,responses:{},tag:p,pri:d});c()};h.CompleteName=function(a){if(0==a.indexOf("AMT_"))return h.pfx[0]+a;if(0==a.indexOf("CIM_"))return h.pfx[1]+a;if(0==
101
a.indexOf("IPS_"))return h.pfx[2]+a};h.CompleteExecResponse=function(a){a&&null!=a&&a.Body&&void 0!=a.Body.ReturnValue&&(a.Body.ReturnValueStr=h.AmtStatusToStr(a.Body.ReturnValue));return a};h.RequestPowerStateChange=function(a,b){h.CIM_PowerManagementService_RequestPowerStateChange(a,'<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>',
102
null,null,b)};h.RequestOSPowerStateChange=function(a,b){h.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'<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>',
103
null,null,b)};h.SetBootConfigRole=function(a,b){h.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>',
104
-a,b)};h.CancelAllQueries=function(a){h.wsman.CancelAllQueries(a)};h.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){h.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};h.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){h.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};h.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){h.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};h.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,g,n,d,
105
-e,y,k){h.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:g,ActionEac:n},d,e,y,k)};h.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,g){h.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,g)};h.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){h.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};h.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){h.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};h.AMT_AgentPresenceWatchdogVA_AssertPresence=
106
-function(a,b){h.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};h.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){h.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};h.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,g,n,d){h.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:g,ActionEac:n},d)};h.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){h.Exec("AMT_AgentPresenceWatchdogVA",
104
+a,b)};h.CancelAllQueries=function(a){h.wsman.CancelAllQueries(a)};h.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){h.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};h.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){h.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};h.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){h.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};h.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,g,p,d,
105
+e,z,k){h.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:g,ActionEac:p},d,e,z,k)};h.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,g){h.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,g)};h.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){h.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};h.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){h.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};h.AMT_AgentPresenceWatchdogVA_AssertPresence=
106
+function(a,b){h.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};h.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){h.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};h.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,g,p,d){h.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:g,ActionEac:p},d)};h.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){h.Exec("AMT_AgentPresenceWatchdogVA",
107
"DeleteAllActions",{_method_dummy:a},b)};h.AMT_AuditLog_ClearLog=function(a){h.Exec("AMT_AuditLog","ClearLog",{},a)};h.AMT_AuditLog_RequestStateChange=function(a,b,c){h.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.AMT_AuditLog_ReadRecords=function(a,b,c){h.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};h.AMT_AuditLog_SetAuditLock=function(a,b,c,g){h.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},g)};h.AMT_AuditLog_ExportAuditLogSignature=
108
-function(a,b){h.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};h.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,g,n){h.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:g},n)};h.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,g,n){h.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:g},n)};h.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,g,n){h.Exec("AMT_AuditPolicyRule",
109
-"SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:g},n)};h.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,g,n,d){h.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:g,Realms:n},d)};h.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){h.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};h.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){h.Exec("AMT_AuthorizationService",
110
-"GetUserAclEntryEx",{Handle:a},b,c)};h.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,g,n,d,e){h.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:g,AccessPermission:n,Realms:d},e)};h.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){h.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};h.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){h.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",
108
+function(a,b){h.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};h.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,g,p){h.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:g},p)};h.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,g,p){h.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:g},p)};h.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,g,p){h.Exec("AMT_AuditPolicyRule",
109
+"SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:g},p)};h.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,g,p,d){h.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:g,Realms:p},d)};h.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){h.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};h.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){h.Exec("AMT_AuthorizationService",
110
+"GetUserAclEntryEx",{Handle:a},b,c)};h.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,g,p,d,e){h.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:g,AccessPermission:p,Realms:d},e)};h.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){h.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};h.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){h.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",
111
{Username:a,DigestPassword:b},c)};h.AMT_AuthorizationService_GetAdminAclEntry=function(a){h.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};h.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){h.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};h.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){h.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};h.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,g){h.Exec("AMT_AuthorizationService",
112
"SetAclEnabledState",{Handle:a,Enabled:b},c,g)};h.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){h.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};h.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){h.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.AMT_EndpointAccessControlService_GetPosture=function(a,b){h.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};h.AMT_EndpointAccessControlService_GetPostureHash=
113
function(a,b){h.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};h.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){h.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};h.AMT_EndpointAccessControlService_GetEacOptions=function(a){h.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};h.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){h.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a,
@@ -117,20 +117,20 @@ function(a,b,c){h.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:a,T
117
"PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},g)};h.AMT_MessageLog_PositionToFirstRecord=function(a,b){h.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};h.AMT_MessageLog_FreezeLog=function(a,b){h.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};h.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){h.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:a,SerialNumbers:b},c)};h.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){h.Exec("AMT_PublicKeyManagementService",
118
"ResetCRLList",{_method_dummy:a},b)};h.AMT_PublicKeyManagementService_AddCertificate=function(a,b){h.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};h.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){h.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};h.AMT_PublicKeyManagementService_AddKey=function(a,b){h.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};h.AMT_PublicKeyManagementService_GeneratePKCS10Request=
119
function(a,b,c,g){h.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},g)};h.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,g){h.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},g)};h.AMT_PublicKeyManagementService_GenerateKeyPair=function(a,b,c){h.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};h.AMT_RedirectionService_RequestStateChange=
120
-function(a,b){h.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};h.AMT_RedirectionService_TerminateSession=function(a,b){h.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};h.AMT_RemoteAccessService_AddMpServer=function(a,b,c,g,n,d,e,y,k){h.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b,Port:c,AuthMethod:g,Certificate:n,Username:d,Password:e,CN:y},k)};h.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,g,n,d){h.Exec("AMT_RemoteAccessService",
121
-"AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:g,InternalMpServer:n},d)};h.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){h.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};h.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){h.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:a},b)};h.AMT_SetupAndConfigurationService_Unprovision=function(a,b){h.Exec("AMT_SetupAndConfigurationService",
120
+function(a,b){h.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};h.AMT_RedirectionService_TerminateSession=function(a,b){h.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};h.AMT_RemoteAccessService_AddMpServer=function(a,b,c,g,p,d,e,z,k){h.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b,Port:c,AuthMethod:g,Certificate:p,Username:d,Password:e,CN:z},k)};h.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,g,p,d){h.Exec("AMT_RemoteAccessService",
121
+"AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:g,InternalMpServer:p},d)};h.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){h.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};h.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){h.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:a},b)};h.AMT_SetupAndConfigurationService_Unprovision=function(a,b){h.Exec("AMT_SetupAndConfigurationService",
122
"Unprovision",{ProvisioningMode:a},b)};h.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){h.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};h.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){h.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)};h.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){h.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",
123
{Duration:a},b)};h.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){h.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};h.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){h.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};h.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){h.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},a)};h.AMT_SetupAndConfigurationService_GetUuid=function(a){h.Exec("AMT_SetupAndConfigurationService",
124
"GetUuid",{},a)};h.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){h.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};h.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){h.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};h.AMT_SystemDefensePolicy_GetTimeout=function(a){h.Exec("AMT_SystemDefensePolicy","GetTimeout",{},a)};h.AMT_SystemDefensePolicy_SetTimeout=function(a,b){h.Exec("AMT_SystemDefensePolicy",
125
-"SetTimeout",{Timeout:a},b)};h.AMT_SystemDefensePolicy_UpdateStatistics=function(a,b,c,g,n,d){h.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:a,ResetOnRead:b},c,g,n,d)};h.AMT_SystemPowerScheme_SetPowerScheme=function(a,b,c){h.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},a,c,0,{InstanceID:b})};h.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(a,b){h.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},a,b)};h.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=
126
-function(a,b,c,g,n){h.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:a,Tm1:b,Tm2:c},g,n)};h.AMT_UserInitiatedConnectionService_RequestStateChange=function(a,b,c){h.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.AMT_WebUIService_RequestStateChange=function(a,b,c){h.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(a,b,c,g,n,d){h.ExecWithXml("AMT_WiFiPortConfigurationService",
127
-"AddWiFiSettings",{WiFiEndpoint:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:g,CACredential:n},d)};h.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(a,b,c,g,n,d){h.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:g,CACredential:n},d)};h.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(a,b){h.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",
125
+"SetTimeout",{Timeout:a},b)};h.AMT_SystemDefensePolicy_UpdateStatistics=function(a,b,c,g,p,d){h.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:a,ResetOnRead:b},c,g,p,d)};h.AMT_SystemPowerScheme_SetPowerScheme=function(a,b,c){h.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},a,c,0,{InstanceID:b})};h.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(a,b){h.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},a,b)};h.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=
126
+function(a,b,c,g,p){h.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:a,Tm1:b,Tm2:c},g,p)};h.AMT_UserInitiatedConnectionService_RequestStateChange=function(a,b,c){h.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.AMT_WebUIService_RequestStateChange=function(a,b,c){h.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(a,b,c,g,p,d){h.ExecWithXml("AMT_WiFiPortConfigurationService",
127
+"AddWiFiSettings",{WiFiEndpoint:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:g,CACredential:p},d)};h.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(a,b,c,g,p,d){h.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:g,CACredential:p},d)};h.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(a,b){h.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",
128
{_method_dummy:a},b)};h.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(a,b){h.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:a},b)};h.CIM_Account_RequestStateChange=function(a,b,c){h.Exec("CIM_Account","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.CIM_AccountManagementService_CreateAccount=function(a,b,c){h.Exec("CIM_AccountManagementService","CreateAccount",{System:a,AccountTemplate:b},c)};h.CIM_BootConfigSetting_ChangeBootOrder=function(a,
129
b){h.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:a},b)};h.CIM_BootService_SetBootConfigRole=function(a,b,c){h.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:a,Role:b},c,0,1)};h.CIM_Card_ConnectorPower=function(a,b,c){h.Exec("CIM_Card","ConnectorPower",{Connector:a,PoweredOn:b},c)};h.CIM_Card_IsCompatible=function(a,b){h.Exec("CIM_Card","IsCompatible",{ElementToCheck:a},b)};h.CIM_Chassis_IsCompatible=function(a,b){h.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:a},b)};
130
h.CIM_Fan_SetSpeed=function(a,b){h.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:a},b)};h.CIM_KVMRedirectionSAP_RequestStateChange=function(a,b,c){h.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:a},c)};h.CIM_MediaAccessDevice_LockMedia=function(a,b){h.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:a},b)};h.CIM_MediaAccessDevice_SetPowerState=function(a,b,c){h.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:a,Time:b},c)};h.CIM_MediaAccessDevice_Reset=function(a){h.Exec("CIM_MediaAccessDevice",
131
"Reset",{},a)};h.CIM_MediaAccessDevice_EnableDevice=function(a,b){h.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:a},b)};h.CIM_MediaAccessDevice_OnlineDevice=function(a,b){h.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:a},b)};h.CIM_MediaAccessDevice_QuiesceDevice=function(a,b){h.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:a},b)};h.CIM_MediaAccessDevice_SaveProperties=function(a){h.Exec("CIM_MediaAccessDevice","SaveProperties",{},a)};h.CIM_MediaAccessDevice_RestoreProperties=
132
function(a){h.Exec("CIM_MediaAccessDevice","RestoreProperties",{},a)};h.CIM_MediaAccessDevice_RequestStateChange=function(a,b,c){h.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.CIM_PhysicalFrame_IsCompatible=function(a,b){h.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:a},b)};h.CIM_PhysicalPackage_IsCompatible=function(a,b){h.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:a},b)};h.CIM_PowerManagementService_RequestPowerStateChange=
133
-function(a,b,c,g,n){h.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:a,ManagedElement:b,Time:c,TimeoutPeriod:g},n,0,1)};h.CIM_PowerSupply_SetPowerState=function(a,b,c){h.Exec("CIM_PowerSupply","SetPowerState",{PowerState:a,Time:b},c)};h.CIM_PowerSupply_Reset=function(a){h.Exec("CIM_PowerSupply","Reset",{},a)};h.CIM_PowerSupply_EnableDevice=function(a,b){h.Exec("CIM_PowerSupply","EnableDevice",{Enabled:a},b)};h.CIM_PowerSupply_OnlineDevice=function(a,b){h.Exec("CIM_PowerSupply",
133
+function(a,b,c,g,p){h.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:a,ManagedElement:b,Time:c,TimeoutPeriod:g},p,0,1)};h.CIM_PowerSupply_SetPowerState=function(a,b,c){h.Exec("CIM_PowerSupply","SetPowerState",{PowerState:a,Time:b},c)};h.CIM_PowerSupply_Reset=function(a){h.Exec("CIM_PowerSupply","Reset",{},a)};h.CIM_PowerSupply_EnableDevice=function(a,b){h.Exec("CIM_PowerSupply","EnableDevice",{Enabled:a},b)};h.CIM_PowerSupply_OnlineDevice=function(a,b){h.Exec("CIM_PowerSupply",
134
"OnlineDevice",{Online:a},b)};h.CIM_PowerSupply_QuiesceDevice=function(a,b){h.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:a},b)};h.CIM_PowerSupply_SaveProperties=function(a){h.Exec("CIM_PowerSupply","SaveProperties",{},a)};h.CIM_PowerSupply_RestoreProperties=function(a){h.Exec("CIM_PowerSupply","RestoreProperties",{},a)};h.CIM_PowerSupply_RequestStateChange=function(a,b,c){h.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.CIM_Processor_SetPowerState=function(a,
135
b,c){h.Exec("CIM_Processor","SetPowerState",{PowerState:a,Time:b},c)};h.CIM_Processor_Reset=function(a){h.Exec("CIM_Processor","Reset",{},a)};h.CIM_Processor_EnableDevice=function(a,b){h.Exec("CIM_Processor","EnableDevice",{Enabled:a},b)};h.CIM_Processor_OnlineDevice=function(a,b){h.Exec("CIM_Processor","OnlineDevice",{Online:a},b)};h.CIM_Processor_QuiesceDevice=function(a,b){h.Exec("CIM_Processor","QuiesceDevice",{Quiesce:a},b)};h.CIM_Processor_SaveProperties=function(a){h.Exec("CIM_Processor","SaveProperties",
136
{},a)};h.CIM_Processor_RestoreProperties=function(a){h.Exec("CIM_Processor","RestoreProperties",{},a)};h.CIM_Processor_RequestStateChange=function(a,b,c){h.Exec("CIM_Processor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.CIM_RecordLog_ClearLog=function(a){h.Exec("CIM_RecordLog","ClearLog",{},a)};h.CIM_RecordLog_RequestStateChange=function(a,b,c){h.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.CIM_RedirectionService_RequestStateChange=function(a,
@@ -139,19 +139,19 @@ b,c){h.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:a,Time
139
"KeepAlive",{},a)};h.CIM_Watchdog_SetPowerState=function(a,b,c){h.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};h.CIM_Watchdog_Reset=function(a){h.Exec("CIM_Watchdog","Reset",{},a)};h.CIM_Watchdog_EnableDevice=function(a,b){h.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};h.CIM_Watchdog_OnlineDevice=function(a,b){h.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};h.CIM_Watchdog_QuiesceDevice=function(a,b){h.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};h.CIM_Watchdog_SaveProperties=
140
function(a){h.Exec("CIM_Watchdog","SaveProperties",{},a)};h.CIM_Watchdog_RestoreProperties=function(a){h.Exec("CIM_Watchdog","RestoreProperties",{},a)};h.CIM_Watchdog_RequestStateChange=function(a,b,c){h.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.CIM_WiFiPort_SetPowerState=function(a,b,c){h.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};h.CIM_WiFiPort_Reset=function(a){h.Exec("CIM_WiFiPort","Reset",{},a)};h.CIM_WiFiPort_EnableDevice=function(a,
141
b){h.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};h.CIM_WiFiPort_OnlineDevice=function(a,b){h.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};h.CIM_WiFiPort_QuiesceDevice=function(a,b){h.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};h.CIM_WiFiPort_SaveProperties=function(a){h.Exec("CIM_WiFiPort","SaveProperties",{},a)};h.CIM_WiFiPort_RestoreProperties=function(a){h.Exec("CIM_WiFiPort","RestoreProperties",{},a)};h.CIM_WiFiPort_RequestStateChange=function(a,b,c){h.Exec("CIM_WiFiPort",
142
-"RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.IPS_HostBasedSetupService_Setup=function(a,b,c,g,n,d,e){h.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,Certificate:g,SigningAlgorithm:n,DigitalSignature:d},e)};h.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,g){h.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},g)};h.IPS_HostBasedSetupService_AdminSetup=
143
-function(a,b,c,g,n,d){h.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:g,DigitalSignature:n},d)};h.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(a,b,c,g){h.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},g)};h.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){h.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},
142
+"RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.IPS_HostBasedSetupService_Setup=function(a,b,c,g,p,d,e){h.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,Certificate:g,SigningAlgorithm:p,DigitalSignature:d},e)};h.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,g){h.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},g)};h.IPS_HostBasedSetupService_AdminSetup=
143
+function(a,b,c,g,p,d){h.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:g,DigitalSignature:p},d)};h.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(a,b,c,g){h.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},g)};h.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){h.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},
144
b)};h.IPS_KVMRedirectionSettingData_TerminateSession=function(a){h.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};h.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){h.Exec("IPS_KVMRedirectionSettingData","DataChannelRead",{},a)};h.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){h.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};h.IPS_OptInService_StartOptIn=function(a){h.Exec("IPS_OptInService","StartOptIn",{},a)};h.IPS_OptInService_CancelOptIn=
145
function(a){h.Exec("IPS_OptInService","CancelOptIn",{},a)};h.IPS_OptInService_SendOptInCode=function(a,b){h.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};h.IPS_OptInService_StartService=function(a){h.Exec("IPS_OptInService","StartService",{},a)};h.IPS_OptInService_StopService=function(a){h.Exec("IPS_OptInService","StopService",{},a)};h.IPS_OptInService_RequestStateChange=function(a,b,c){h.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.IPS_PowerManagementService_RequestOSPowerSavingStateChange=
146
-function(a,b,c,g,n){h.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:g},n,0,1)};h.IPS_ProvisioningRecordLog_RequestStateChange=function(a,b,c){h.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.IPS_ProvisioningRecordLog_ClearLog=function(a,b){h.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:a},b)};h.IPS_ScreenConfigurationService_SetSessionState=function(a,b,c){h.Exec("IPS_ScreenConfigurationService",
147
-"SetSessionState",{SessionState:a,ConsecutiveRebootsNum:b},c)};h.IPS_SecIOService_RequestStateChange=function(a,b,c){h.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,g,n){h.Exec("IPS_HTTPProxyService","AddProxyAccessPoint",{AccessInfo:a,InfoFormat:b,Port:c,NetworkDnsSuffix:g},n)};h.AmtStatusToStr=function(a){return h.AmtStatusCodes[a]?h.AmtStatusCodes[a]:"UNKNOWN_ERROR"};h.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",
146
+function(a,b,c,g,p){h.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:g},p,0,1)};h.IPS_ProvisioningRecordLog_RequestStateChange=function(a,b,c){h.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.IPS_ProvisioningRecordLog_ClearLog=function(a,b){h.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:a},b)};h.IPS_ScreenConfigurationService_SetSessionState=function(a,b,c){h.Exec("IPS_ScreenConfigurationService",
147
+"SetSessionState",{SessionState:a,ConsecutiveRebootsNum:b},c)};h.IPS_SecIOService_RequestStateChange=function(a,b,c){h.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};h.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,g,p){h.Exec("IPS_HTTPProxyService","AddProxyAccessPoint",{AccessInfo:a,InfoFormat:b,Port:c,NetworkDnsSuffix:g},p)};h.AmtStatusToStr=function(a){return h.AmtStatusCodes[a]?h.AmtStatusCodes[a]:"UNKNOWN_ERROR"};h.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",
148
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",
149
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",
150
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",
151
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",
152
-4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};h.GetMessageLog=function(a,b){h.AMT_MessageLog_PositionToFirstRecord(q,[a,b,[]])};var k="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(";"),
152
+4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};h.GetMessageLog=function(a,b){h.AMT_MessageLog_PositionToFirstRecord(r,[a,b,[]])};var k="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(";"),
153
g="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(";"),
154
-J="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(";");
154
+K="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(";");
155
h.RealmNames=";;Redirection;;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(";");h.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};var u={16:"Security Admin",17:"RCO",18:"Redirection Manager",19:"Firmware Update Manager",
156
20:"Security Audit Log",21:"Network Time",22:"Network Administration",23:"Storage Administration",24:"Event Manager",25:"Circuit Breaker Manager",26:"Agent Presence Manager",27:"Wireless Configuration",28:"EAC",29:"KVM",30:"User Opt-In Events",32:"Screen Blanking",33:"Watchdog Events",1600:"Provisioning Started",1601:"Provisioning Completed",1602:"ACL Entry Added",1603:"ACL Entry Modified",1604:"ACL Entry Removed",1605:"ACL Access with Invalid Credentials",1606:"ACL Entry State",1607:"TLS State Changed",
157
1608:"TLS Server Certificate Set",1609:"TLS Server Certificate Remove",1610:"TLS Trusted Root Certificate Added",1611:"TLS Trusted Root Certificate Removed",1612:"TLS Preshared Key Set",1613:"Kerberos Settings Modified",1614:"Kerberos Master Key Modified",1615:"Flash Wear out Counters Reset",1616:"Power Package Modified",1617:"Set Realm Authentication Mode",1618:"Upgrade Client to Admin Control Mode",1619:"Unprovisioning Started",1700:"Performed Power Up",1701:"Performed Power Down",1702:"Performed Power Cycle",
@@ -166,15 +166,15 @@ function instanceToXml(b,c){if(void 0===c||null===c)return null;var a=!!c.__name
166
function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+c.__resourceUri+"</w:ResourceURI><w:SelectorSet>",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+='<w:Selector Name="'+d+'">'+c[d].toString()+"</w:Selector>"));return a+("</w:SelectorSet></a:ReferenceParameters></r:"+b+">")}
167
function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;a<b.length/4;a++)c+="-"+ReadIntX(b,4*a);return c}
168
function GetSidByteArray(b){if(!b||null==b)return null;b=b.split("-");if(4>b.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;c<b.length;c++){var a=parseInt(b[c]);if(a!=b[c])return null;b[c]=a}a=String.fromCharCode(b[1])+String.fromCharCode(b.length-3)+ShortToStr(Math.floor(b[2]/Math.pow(2,32)))+IntToStr(b[2]&65535);for(c=3;c<b.length;c++)a+=IntToStrX(b[c]);return a}
169
-(function(b,c){"function"===typeof define&&define.amd?define([],c):b.forge=c()})(this,function(){var b,c,a;(function(d){function e(a,b){var c,g,n,d,e,w,k,h,m,v=b&&b.split("/"),z=u.map,x=z&&z["*"]||{};if(a&&"."===a.charAt(0))if(b){v=v.slice(0,v.length-1);a=a.split("/");e=a.length-1;u.nodeIdCompat&&F.test(a[e])&&(a[e]=a[e].replace(F,""));a=v.concat(a);for(e=0;e<a.length;e+=1)if(c=a[e],"."===c)a.splice(e,1),--e;else if(".."===c)if(1!==e||".."!==a[2]&&".."!==a[0])0<e&&(a.splice(e-1,2),e-=2);else break;
170
-a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((v||x)&&z){c=a.split("/");for(e=c.length;0<e;--e){g=c.slice(0,e).join("/");if(v)for(m=v.length;0<m;--m)if(n=z[v.slice(0,m).join("/")])if(n=n[g]){d=n;w=e;break}if(d)break;!k&&x&&x[g]&&(k=x[g],h=e)}!d&&k&&(d=k,w=h);d&&(c.splice(0,w,d),a=c.join("/"))}return a}function l(a,b){return function(){return z.apply(d,w.call(arguments,0).concat([a,b]))}}function p(a){return function(b){return e(b,a)}}function q(a){return function(b){g[a]=b}}function n(a){if(x.call(J,
171
-a)){var b=J[a];delete J[a];C[a]=!0;h.apply(d,b)}if(!x.call(g,a)&&!x.call(C,a))throw Error("No "+a);return g[a]}function m(a){var b,c=a?a.indexOf("!"):-1;-1<c&&(b=a.substring(0,c),a=a.substring(c+1,a.length));return[b,a]}function v(a){return function(){return u&&u.config&&u.config[a]||{}}}var h,z,B,k,g={},J={},u={},C={},x=Object.prototype.hasOwnProperty,w=[].slice,F=/\.js$/;B=function(a,b){var c,g=m(a),d=g[0];a=g[1];d&&(d=e(d,b),c=n(d));d?a=c&&c.normalize?c.normalize(a,p(b)):e(a,b):(a=e(a,b),g=m(a),
172
-d=g[0],a=g[1],d&&(c=n(d)));return{f:d?d+"!"+a:a,n:a,pr:d,p:c}};k={require:function(a){return l(a)},exports:function(a){var b=g[a];return"undefined"!==typeof b?b:g[a]={}},module:function(a){return{id:a,uri:"",exports:g[a],config:v(a)}}};h=function(a,b,c,e){var w,h,m,F,u=[];h=typeof c;var v;e=e||a;if("undefined"===h||"function"===h){b=!b.length&&c.length?["require","exports","module"]:b;for(F=0;F<b.length;F+=1)if(m=B(b[F],e),h=m.f,"require"===h)u[F]=k.require(a);else if("exports"===h)u[F]=k.exports(a),
173
-v=!0;else if("module"===h)w=u[F]=k.module(a);else if(x.call(g,h)||x.call(J,h)||x.call(C,h))u[F]=n(h);else if(m.p)m.p.load(m.n,l(e,!0),q(h),{}),u[F]=g[h];else throw Error(a+" missing "+h);b=c?c.apply(g[a],u):void 0;a&&(w&&w.exports!==d&&w.exports!==g[a]?g[a]=w.exports:b===d&&v||(g[a]=b))}else a&&(g[a]=c)};b=c=z=function(a,b,c,g,e){if("string"===typeof a)return k[a]?k[a](b):n(B(a,b).f);if(!a.splice){u=a;u.deps&&z(u.deps,u.callback);if(!b)return;b.splice?(a=b,b=c,c=null):a=d}b=b||function(){};"function"===
174
-typeof c&&(c=g,g=e);g?h(d,a,b,c):setTimeout(function(){h(d,a,b,c)},4);return z};z.config=function(a){return z(a)};b._defined=g;a=function(a,b,c){b.splice||(c=b,b=[]);x.call(g,a)||x.call(J,a)||(J[a]=[a,b,c])};a.amd={jQuery:!0}})();a("node_modules/almond/almond",function(){});(function(){function b(a){function c(a){this.data="";this.read=0;if("string"===typeof a)this.data=a;else if(d.isArrayBuffer(a)||d.isArrayBufferView(a)){a=new Uint8Array(a);try{this.data=String.fromCharCode.apply(null,a)}catch(b){for(var g=
169
+(function(b,c){"function"===typeof define&&define.amd?define([],c):b.forge=c()})(this,function(){var b,c,a;(function(d){function e(a,b){var c,g,p,d,e,y,k,h,m,v=b&&b.split("/"),x=u.map,w=x&&x["*"]||{};if(a&&"."===a.charAt(0))if(b){v=v.slice(0,v.length-1);a=a.split("/");e=a.length-1;u.nodeIdCompat&&E.test(a[e])&&(a[e]=a[e].replace(E,""));a=v.concat(a);for(e=0;e<a.length;e+=1)if(c=a[e],"."===c)a.splice(e,1),--e;else if(".."===c)if(1!==e||".."!==a[2]&&".."!==a[0])0<e&&(a.splice(e-1,2),e-=2);else break;
170
+a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((v||w)&&x){c=a.split("/");for(e=c.length;0<e;--e){g=c.slice(0,e).join("/");if(v)for(m=v.length;0<m;--m)if(p=x[v.slice(0,m).join("/")])if(p=p[g]){d=p;y=e;break}if(d)break;!k&&w&&w[g]&&(k=w[g],h=e)}!d&&k&&(d=k,y=h);d&&(c.splice(0,y,d),a=c.join("/"))}return a}function l(a,b){return function(){return x.apply(d,y.call(arguments,0).concat([a,b]))}}function n(a){return function(b){return e(b,a)}}function r(a){return function(b){g[a]=b}}function p(a){if(w.call(K,
171
+a)){var b=K[a];delete K[a];C[a]=!0;h.apply(d,b)}if(!w.call(g,a)&&!w.call(C,a))throw Error("No "+a);return g[a]}function m(a){var b,c=a?a.indexOf("!"):-1;-1<c&&(b=a.substring(0,c),a=a.substring(c+1,a.length));return[b,a]}function v(a){return function(){return u&&u.config&&u.config[a]||{}}}var h,x,B,k,g={},K={},u={},C={},w=Object.prototype.hasOwnProperty,y=[].slice,E=/\.js$/;B=function(a,b){var c,g=m(a),d=g[0];a=g[1];d&&(d=e(d,b),c=p(d));d?a=c&&c.normalize?c.normalize(a,n(b)):e(a,b):(a=e(a,b),g=m(a),
172
+d=g[0],a=g[1],d&&(c=p(d)));return{f:d?d+"!"+a:a,n:a,pr:d,p:c}};k={require:function(a){return l(a)},exports:function(a){var b=g[a];return"undefined"!==typeof b?b:g[a]={}},module:function(a){return{id:a,uri:"",exports:g[a],config:v(a)}}};h=function(a,b,c,e){var y,h,m,E,u=[];h=typeof c;var v;e=e||a;if("undefined"===h||"function"===h){b=!b.length&&c.length?["require","exports","module"]:b;for(E=0;E<b.length;E+=1)if(m=B(b[E],e),h=m.f,"require"===h)u[E]=k.require(a);else if("exports"===h)u[E]=k.exports(a),
173
+v=!0;else if("module"===h)y=u[E]=k.module(a);else if(w.call(g,h)||w.call(K,h)||w.call(C,h))u[E]=p(h);else if(m.p)m.p.load(m.n,l(e,!0),r(h),{}),u[E]=g[h];else throw Error(a+" missing "+h);b=c?c.apply(g[a],u):void 0;a&&(y&&y.exports!==d&&y.exports!==g[a]?g[a]=y.exports:b===d&&v||(g[a]=b))}else a&&(g[a]=c)};b=c=x=function(a,b,c,g,e){if("string"===typeof a)return k[a]?k[a](b):p(B(a,b).f);if(!a.splice){u=a;u.deps&&x(u.deps,u.callback);if(!b)return;b.splice?(a=b,b=c,c=null):a=d}b=b||function(){};"function"===
174
+typeof c&&(c=g,g=e);g?h(d,a,b,c):setTimeout(function(){h(d,a,b,c)},4);return x};x.config=function(a){return x(a)};b._defined=g;a=function(a,b,c){b.splice||(c=b,b=[]);w.call(g,a)||w.call(K,a)||(K[a]=[a,b,c])};a.amd={jQuery:!0}})();a("node_modules/almond/almond",function(){});(function(){function b(a){function c(a){this.data="";this.read=0;if("string"===typeof a)this.data=a;else if(d.isArrayBuffer(a)||d.isArrayBufferView(a)){a=new Uint8Array(a);try{this.data=String.fromCharCode.apply(null,a)}catch(b){for(var g=
175
0;g<a.length;++g)this.putByte(a[g])}}else if(a instanceof c||"object"===typeof a&&"string"===typeof a.data&&"number"===typeof a.read)this.data=a.data,this.read=a.read;this._constructedStringLength=0}var d=a.util=a.util||{};(function(){if("undefined"!==typeof process&&process.nextTick)d.nextTick=process.nextTick,d.setImmediate="function"===typeof setImmediate?setImmediate:d.nextTick;else if("function"===typeof setImmediate)d.setImmediate=setImmediate,d.nextTick=function(a){return setImmediate(a)};
176
else{d.setImmediate=function(a){setTimeout(a,0)};if("undefined"!==typeof window&&"function"===typeof window.postMessage){var a=[];d.setImmediate=function(b){a.push(b);1===a.length&&window.postMessage("forge.setImmediate","*")};window.addEventListener("message",function(b){b.source===window&&"forge.setImmediate"===b.data&&(b.stopPropagation(),b=a.slice(),a.length=0,b.forEach(function(a){a()}))},!0)}if("undefined"!==typeof MutationObserver){var b=Date.now(),c=!0,g=document.createElement("div"),a=[];
177
-(new MutationObserver(function(){var b=a.slice();a.length=0;b.forEach(function(a){a()})})).observe(g,{attributes:!0});var n=d.setImmediate;d.setImmediate=function(d){15<Date.now()-b?(b=Date.now(),n(d)):(a.push(d),1===a.length&&g.setAttribute("a",c=!c))}}d.nextTick=d.setImmediate}})();d.isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};d.isArrayBuffer=function(a){return"undefined"!==typeof ArrayBuffer&&a instanceof ArrayBuffer};d.isArrayBufferView=function(a){return a&&
177
+(new MutationObserver(function(){var b=a.slice();a.length=0;b.forEach(function(a){a()})})).observe(g,{attributes:!0});var p=d.setImmediate;d.setImmediate=function(d){15<Date.now()-b?(b=Date.now(),p(d)):(a.push(d),1===a.length&&g.setAttribute("a",c=!c))}}d.nextTick=d.setImmediate}})();d.isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};d.isArrayBuffer=function(a){return"undefined"!==typeof ArrayBuffer&&a instanceof ArrayBuffer};d.isArrayBufferView=function(a){return a&&
178
d.isArrayBuffer(a.buffer)&&void 0!==a.byteLength};d.ByteBuffer=c;d.ByteStringBuffer=c;d.ByteStringBuffer.prototype._optimizeConstructedString=function(a){this._constructedStringLength+=a;4096<this._constructedStringLength&&(this.data.substr(0,1),this._constructedStringLength=0)};d.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};d.ByteStringBuffer.prototype.isEmpty=function(){return 0>=this.length()};d.ByteStringBuffer.prototype.putByte=function(a){return this.putBytes(String.fromCharCode(a))};
179
d.ByteStringBuffer.prototype.fillWithByte=function(a,b){a=String.fromCharCode(a);for(var c=this.data;0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);this.data=c;this._optimizeConstructedString(b);return this};d.ByteStringBuffer.prototype.putBytes=function(a){this.data+=a;this._optimizeConstructedString(a.length);return this};d.ByteStringBuffer.prototype.putString=function(a){return this.putBytes(d.encodeUtf8(a))};d.ByteStringBuffer.prototype.putInt16=function(a){return this.putBytes(String.fromCharCode(a>>8&
180
255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt24=function(a){return this.putBytes(String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt32=function(a){return this.putBytes(String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt16Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>
@@ -187,8 +187,8 @@ a)};d.ByteStringBuffer.prototype.setAt=function(a,b){this.data=this.data.substr(
187
function(){this.data="";this.read=0;return this};d.ByteStringBuffer.prototype.truncate=function(a){a=Math.max(0,this.length()-a);this.data=this.data.substr(this.read,a);this.read=0;return this};d.ByteStringBuffer.prototype.toHex=function(){for(var a="",b=this.read;b<this.data.length;++b){var c=this.data.charCodeAt(b);16>c&&(a+="0");a+=c.toString(16)}return a};d.ByteStringBuffer.prototype.toString=function(){return d.decodeUtf8(this.bytes())};d.DataBuffer=function(a,b){b=b||{};this.read=b.readOffset||
188
0;this.growSize=b.growSize||1024;var c=d.isArrayBuffer(a),g=d.isArrayBufferView(a);c||g?(this.data=c?new DataView(a):new DataView(a.buffer,a.byteOffset,a.byteLength),this.write="writeOffset"in b?b.writeOffset:this.data.byteLength):(this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==a&&void 0!==a&&this.putBytes(a),"writeOffset"in b&&(this.write=b.writeOffset))};d.DataBuffer.prototype.length=function(){return this.write-this.read};d.DataBuffer.prototype.isEmpty=function(){return 0>=this.length()};
189
d.DataBuffer.prototype.accommodate=function(a,b){if(this.length()>=a)return this;b=Math.max(b||this.growSize,a);var c=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),g=new Uint8Array(this.length()+b);g.set(c);this.data=new DataView(g.buffer);return this};d.DataBuffer.prototype.putByte=function(a){this.accommodate(1);this.data.setUint8(this.write++,a);return this};d.DataBuffer.prototype.fillWithByte=function(a,b){this.accommodate(b);for(var c=0;c<b;++c)this.data.setUint8(a);
190
-return this};d.DataBuffer.prototype.putBytes=function(a,b){if(d.isArrayBufferView(a)){var c=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),g=c.byteLength-c.byteOffset;this.accommodate(g);var n=new Uint8Array(this.data.buffer,this.write);n.set(c);this.write+=g;return this}if(d.isArrayBuffer(a))return c=new Uint8Array(a),this.accommodate(c.byteLength),n=new Uint8Array(this.data.buffer),n.set(c,this.write),this.write+=c.byteLength,this;if(a instanceof d.DataBuffer||"object"===typeof a&&"number"===
191
-typeof a.read&&"number"===typeof a.write&&d.isArrayBufferView(a.data))return c=new Uint8Array(a.data.byteLength,a.read,a.length()),this.accommodate(c.byteLength),n=new Uint8Array(a.data.byteLength,this.write),n.set(c),this.write+=c.byteLength,this;a instanceof d.ByteStringBuffer&&(a=a.data,b="binary");b=b||"binary";if("string"===typeof a){if("hex"===b)return this.accommodate(Math.ceil(a.length/2)),c=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.hex.decode(a,c,this.write),this;if("base64"===
190
+return this};d.DataBuffer.prototype.putBytes=function(a,b){if(d.isArrayBufferView(a)){var c=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),g=c.byteLength-c.byteOffset;this.accommodate(g);var p=new Uint8Array(this.data.buffer,this.write);p.set(c);this.write+=g;return this}if(d.isArrayBuffer(a))return c=new Uint8Array(a),this.accommodate(c.byteLength),p=new Uint8Array(this.data.buffer),p.set(c,this.write),this.write+=c.byteLength,this;if(a instanceof d.DataBuffer||"object"===typeof a&&"number"===
191
+typeof a.read&&"number"===typeof a.write&&d.isArrayBufferView(a.data))return c=new Uint8Array(a.data.byteLength,a.read,a.length()),this.accommodate(c.byteLength),p=new Uint8Array(a.data.byteLength,this.write),p.set(c),this.write+=c.byteLength,this;a instanceof d.ByteStringBuffer&&(a=a.data,b="binary");b=b||"binary";if("string"===typeof a){if("hex"===b)return this.accommodate(Math.ceil(a.length/2)),c=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.hex.decode(a,c,this.write),this;if("base64"===
192
b)return this.accommodate(3*Math.ceil(a.length/4)),c=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.base64.decode(a,c,this.write),this;"utf8"===b&&(a=d.encodeUtf8(a),b="binary");if("binary"===b||"raw"===b)return this.accommodate(a.length),c=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.raw.decode(c),this;if("utf16"===b)return this.accommodate(2*a.length),c=new Uint16Array(this.data.buffer,this.write),this.write+=d.text.utf16.encode(c),this;throw Error("Invalid encoding: "+
193
b);}throw Error("Invalid parameter: "+a);};d.DataBuffer.prototype.putBuffer=function(a){this.putBytes(a);a.clear();return this};d.DataBuffer.prototype.putString=function(a){return this.putBytes(a,"utf16")};d.DataBuffer.prototype.putInt16=function(a){this.accommodate(2);this.data.setInt16(this.write,a);this.write+=2;return this};d.DataBuffer.prototype.putInt24=function(a){this.accommodate(3);this.data.setInt16(this.write,a>>8&65535);this.data.setInt8(this.write,a>>16&255);this.write+=3;return this};
194
d.DataBuffer.prototype.putInt32=function(a){this.accommodate(4);this.data.setInt32(this.write,a);this.write+=4;return this};d.DataBuffer.prototype.putInt16Le=function(a){this.accommodate(2);this.data.setInt16(this.write,a,!0);this.write+=2;return this};d.DataBuffer.prototype.putInt24Le=function(a){this.accommodate(3);this.data.setInt8(this.write,a>>16&255);this.data.setInt16(this.write,a>>8&65535,!0);this.write+=3;return this};d.DataBuffer.prototype.putInt32Le=function(a){this.accommodate(4);this.data.setInt32(this.write,
@@ -198,69 +198,69 @@ this.data.getInt32(this.read,!0);this.read+=4;return a};d.DataBuffer.prototype.g
198
d.DataBuffer.prototype.bytes=function(a){return"undefined"===typeof a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)};d.DataBuffer.prototype.at=function(a){return this.data.getUint8(this.read+a)};d.DataBuffer.prototype.setAt=function(a,b){this.data.setUint8(a,b);return this};d.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};d.DataBuffer.prototype.copy=function(){return new d.DataBuffer(this)};d.DataBuffer.prototype.compact=function(){if(0<this.read){var a=
199
new Uint8Array(this.data.buffer,this.read),b=new Uint8Array(a.byteLength);b.set(a);this.data=new DataView(b);this.write-=this.read;this.read=0}return this};d.DataBuffer.prototype.clear=function(){this.data=new DataView(new ArrayBuffer(0));this.read=this.write=0;return this};d.DataBuffer.prototype.truncate=function(a){this.write=Math.max(0,this.length()-a);this.read=Math.min(this.read,this.write);return this};d.DataBuffer.prototype.toHex=function(){for(var a="",b=this.read;b<this.data.byteLength;++b){var c=
200
this.data.getUint8(b);16>c&&(a+="0");a+=c.toString(16)}return a};d.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return d.binary.raw.encode(b);if("hex"===a)return d.binary.hex.encode(b);if("base64"===a)return d.binary.base64.encode(b);if("utf8"===a)return d.text.utf8.decode(b);if("utf16"===a)return d.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};d.createBuffer=function(a,b){void 0!==a&&"utf8"===
201
-(b||"raw")&&(a=d.encodeUtf8(a));return new d.ByteBuffer(a)};d.fillString=function(a,b){for(var c="";0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);return c};d.xorBytes=function(a,b,c){for(var g="",d="",n="",e=0,k=0;0<c;--c,++e)d=a.charCodeAt(e)^b.charCodeAt(e),10<=k&&(g+=n,n="",k=0),n+=String.fromCharCode(d),++k;return g+n};d.hexToBytes=function(a){var b="",c=0;a.length&1&&(c=1,b+=String.fromCharCode(parseInt(a[0],16)));for(;c<a.length;c+=2)b+=String.fromCharCode(parseInt(a.substr(c,2),16));return b};d.bytesToHex=
202
-function(a){return d.createBuffer(a).toHex()};d.int32ToBytes=function(a){return String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var e=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];d.encode64=function(a,b){for(var c="",g="",d,n,e,k=0;k<a.length;)d=
203
-a.charCodeAt(k++),n=a.charCodeAt(k++),e=a.charCodeAt(k++),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|n>>4),isNaN(n)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((n&15)<<2|e>>6),c+=isNaN(e)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e&63)),b&&c.length>b&&(g+=c.substr(0,b)+"\r\n",c=c.substr(b));return g+
204
-c};d.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,g,d,n,k=0;k<a.length;)c=e[a.charCodeAt(k++)-43],g=e[a.charCodeAt(k++)-43],d=e[a.charCodeAt(k++)-43],n=e[a.charCodeAt(k++)-43],b+=String.fromCharCode(c<<2|g>>4),64!==d&&(b+=String.fromCharCode((g&15)<<4|d>>2),64!==n&&(b+=String.fromCharCode((d&3)<<6|n)));return b};d.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};d.decodeUtf8=function(a){return decodeURIComponent(escape(a))};d.binary={raw:{},hex:{},base64:{}};
205
-d.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};d.binary.raw.decode=function(a,b,c){var g=b;g||(g=new Uint8Array(a.length));for(var d=c=c||0,n=0;n<a.length;++n)g[d++]=a.charCodeAt(n);return b?d-c:g};d.binary.hex.encode=d.bytesToHex;d.binary.hex.decode=function(a,b,c){var g=b;g||(g=new Uint8Array(Math.ceil(a.length/2)));c=c||0;var d=0,n=c;a.length&1&&(d=1,g[n++]=parseInt(a[0],16));for(;d<a.length;d+=2)g[n++]=parseInt(a.substr(d,2),16);return b?n-c:g};d.binary.base64.encode=
206
-function(a,b){for(var c="",g="",d,n,e,k=0;k<a.byteLength;)d=a[k++],n=a[k++],e=a[k++],c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|n>>4),isNaN(n)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((n&15)<<2|e>>6),c+=isNaN(e)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e&63)),b&&c.length>b&&(g+=c.substr(0,
207
-b)+"\r\n",c=c.substr(b));return g+c};d.binary.base64.decode=function(a,b,c){var g=b;g||(g=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var d,n,k,m,u=0,r=c;u<a.length;)d=e[a.charCodeAt(u++)-43],n=e[a.charCodeAt(u++)-43],k=e[a.charCodeAt(u++)-43],m=e[a.charCodeAt(u++)-43],g[r++]=d<<2|n>>4,64!==k&&(g[r++]=(n&15)<<4|k>>2,64!==m&&(g[r++]=(k&3)<<6|m));return b?r-c:g.subarray(0,r)};d.text={utf8:{},utf16:{}};d.text.utf8.encode=function(a,b,c){a=d.encodeUtf8(a);
208
-var g=b;g||(g=new Uint8Array(a.length));for(var n=c=c||0,e=0;e<a.length;++e)g[n++]=a.charCodeAt(e);return b?n-c:g};d.text.utf8.decode=function(a){return d.decodeUtf8(String.fromCharCode.apply(null,a))};d.text.utf16.encode=function(a,b,c){var g=b;g||(g=new Uint8Array(2*a.length));for(var d=new Uint16Array(g.buffer),n=c=c||0,e=c,k=0;k<a.length;++k)d[e++]=a.charCodeAt(k),n+=2;return b?n-c:g};d.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))};d.deflate=function(a,
209
-b,c){b=d.decode64(a.deflate(d.encode64(b)).rval);c&&(a=2,b.charCodeAt(1)&32&&(a=6),b=b.substring(a,b.length-4));return b};d.inflate=function(a,b,c){a=a.inflate(d.encode64(b)).rval;return null===a?null:d.decode64(a)};var z=function(a,b,c){if(!a)throw Error("WebStorage not available.");null===c?a=a.removeItem(b):(c=d.encode64(JSON.stringify(c)),a=a.setItem(b,c));if("undefined"!==typeof a&&!0!==a.rval)throw b=Error(a.error.message),b.id=a.error.id,b.name=a.error.name,b;},B=function(a,b){if(!a)throw Error("WebStorage not available.");
210
-var c=a.getItem(b);if(a.init)if(null===c.rval){if(c.error){var g=Error(c.error.message);g.id=c.error.id;g.name=c.error.name;throw g;}c=null}else c=c.rval;null!==c&&(c=JSON.parse(d.decode64(c)));return c},k=function(a,b,c,g){var d=B(a,b);null===d&&(d={});d[c]=g;z(a,b,d)},g=function(a,b,c){a=B(a,b);null!==a&&(a=c in a?a[c]:null);return a},J=function(a,b,c){var g=B(a,b);if(null!==g&&c in g){delete g[c];c=!0;for(var d in g){c=!1;break}c&&(g=null);z(a,b,g)}},u=function(a,b){z(a,b,null)},l=function(a,b,
211
-c){var g=null;"undefined"===typeof c&&(c=["web","flash"]);var d,n=!1,e=null,k;for(k in c){d=c[k];try{if("flash"===d||"both"===d){if(null===b[0])throw Error("Flash local storage not available.");g=a.apply(this,b);n="flash"===d}if("web"===d||"both"===d)b[0]=localStorage,g=a.apply(this,b),n=!0}catch(h){e=h}if(n)break}if(!n)throw e;return g};d.setItem=function(a,b,c,g,d){l(k,arguments,d)};d.getItem=function(a,b,c,d){return l(g,arguments,d)};d.removeItem=function(a,b,c,g){l(J,arguments,g)};d.clearItems=
212
-function(a,b,c){l(u,arguments,c)};d.parseUrl=function(a){var b=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;b.lastIndex=0;b=b.exec(a);if(a=null===b?null:{full:a,scheme:b[1],host:b[2],port:b[3],path:b[4]})a.fullHost=a.host,a.port?80!==a.port&&"http"===a.scheme?a.fullHost+=":"+a.port:443!==a.port&&"https"===a.scheme&&(a.fullHost+=":"+a.port):"http"===a.scheme?a.port=80:"https"===a.scheme&&(a.port=443),a.full=a.scheme+"://"+a.fullHost;return a};var x=null;d.getQueryVariables=function(a){var b=function(a){var b=
213
-{};a=a.split("&");for(var c=0;c<a.length;c++){var g=a[c].indexOf("="),d;0<g?(d=a[c].substring(0,g),g=a[c].substring(g+1)):(d=a[c],g=null);d in b||(b[d]=[]);d in Object.prototype||null===g||b[d].push(unescape(g))}return b};"undefined"===typeof a?(null===x&&(x="undefined"!==typeof window&&window.location&&window.location.search?b(window.location.search.substring(1)):{}),a=x):a=b(a);return a};d.parseFragment=function(a){var b=a,c="",g=a.indexOf("?");0<g&&(b=a.substring(0,g),c=a.substring(g+1));a=b.split("/");
201
+(b||"raw")&&(a=d.encodeUtf8(a));return new d.ByteBuffer(a)};d.fillString=function(a,b){for(var c="";0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);return c};d.xorBytes=function(a,b,c){for(var g="",d="",p="",e=0,k=0;0<c;--c,++e)d=a.charCodeAt(e)^b.charCodeAt(e),10<=k&&(g+=p,p="",k=0),p+=String.fromCharCode(d),++k;return g+p};d.hexToBytes=function(a){var b="",c=0;a.length&1&&(c=1,b+=String.fromCharCode(parseInt(a[0],16)));for(;c<a.length;c+=2)b+=String.fromCharCode(parseInt(a.substr(c,2),16));return b};d.bytesToHex=
202
+function(a){return d.createBuffer(a).toHex()};d.int32ToBytes=function(a){return String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var e=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];d.encode64=function(a,b){for(var c="",g="",d,p,e,k=0;k<a.length;)d=
203
+a.charCodeAt(k++),p=a.charCodeAt(k++),e=a.charCodeAt(k++),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|p>>4),isNaN(p)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((p&15)<<2|e>>6),c+=isNaN(e)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e&63)),b&&c.length>b&&(g+=c.substr(0,b)+"\r\n",c=c.substr(b));return g+
204
+c};d.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,g,d,p,k=0;k<a.length;)c=e[a.charCodeAt(k++)-43],g=e[a.charCodeAt(k++)-43],d=e[a.charCodeAt(k++)-43],p=e[a.charCodeAt(k++)-43],b+=String.fromCharCode(c<<2|g>>4),64!==d&&(b+=String.fromCharCode((g&15)<<4|d>>2),64!==p&&(b+=String.fromCharCode((d&3)<<6|p)));return b};d.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};d.decodeUtf8=function(a){return decodeURIComponent(escape(a))};d.binary={raw:{},hex:{},base64:{}};
205
+d.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};d.binary.raw.decode=function(a,b,c){var g=b;g||(g=new Uint8Array(a.length));for(var d=c=c||0,p=0;p<a.length;++p)g[d++]=a.charCodeAt(p);return b?d-c:g};d.binary.hex.encode=d.bytesToHex;d.binary.hex.decode=function(a,b,c){var g=b;g||(g=new Uint8Array(Math.ceil(a.length/2)));c=c||0;var d=0,p=c;a.length&1&&(d=1,g[p++]=parseInt(a[0],16));for(;d<a.length;d+=2)g[p++]=parseInt(a.substr(d,2),16);return b?p-c:g};d.binary.base64.encode=
206
+function(a,b){for(var c="",g="",d,p,e,k=0;k<a.byteLength;)d=a[k++],p=a[k++],e=a[k++],c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|p>>4),isNaN(p)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((p&15)<<2|e>>6),c+=isNaN(e)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e&63)),b&&c.length>b&&(g+=c.substr(0,
207
+b)+"\r\n",c=c.substr(b));return g+c};d.binary.base64.decode=function(a,b,c){var g=b;g||(g=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var d,p,k,m,u=0,q=c;u<a.length;)d=e[a.charCodeAt(u++)-43],p=e[a.charCodeAt(u++)-43],k=e[a.charCodeAt(u++)-43],m=e[a.charCodeAt(u++)-43],g[q++]=d<<2|p>>4,64!==k&&(g[q++]=(p&15)<<4|k>>2,64!==m&&(g[q++]=(k&3)<<6|m));return b?q-c:g.subarray(0,q)};d.text={utf8:{},utf16:{}};d.text.utf8.encode=function(a,b,c){a=d.encodeUtf8(a);
208
+var g=b;g||(g=new Uint8Array(a.length));for(var p=c=c||0,e=0;e<a.length;++e)g[p++]=a.charCodeAt(e);return b?p-c:g};d.text.utf8.decode=function(a){return d.decodeUtf8(String.fromCharCode.apply(null,a))};d.text.utf16.encode=function(a,b,c){var g=b;g||(g=new Uint8Array(2*a.length));for(var d=new Uint16Array(g.buffer),p=c=c||0,e=c,k=0;k<a.length;++k)d[e++]=a.charCodeAt(k),p+=2;return b?p-c:g};d.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))};d.deflate=function(a,
209
+b,c){b=d.decode64(a.deflate(d.encode64(b)).rval);c&&(a=2,b.charCodeAt(1)&32&&(a=6),b=b.substring(a,b.length-4));return b};d.inflate=function(a,b,c){a=a.inflate(d.encode64(b)).rval;return null===a?null:d.decode64(a)};var x=function(a,b,c){if(!a)throw Error("WebStorage not available.");null===c?a=a.removeItem(b):(c=d.encode64(JSON.stringify(c)),a=a.setItem(b,c));if("undefined"!==typeof a&&!0!==a.rval)throw b=Error(a.error.message),b.id=a.error.id,b.name=a.error.name,b;},B=function(a,b){if(!a)throw Error("WebStorage not available.");
210
+var c=a.getItem(b);if(a.init)if(null===c.rval){if(c.error){var g=Error(c.error.message);g.id=c.error.id;g.name=c.error.name;throw g;}c=null}else c=c.rval;null!==c&&(c=JSON.parse(d.decode64(c)));return c},k=function(a,b,c,g){var d=B(a,b);null===d&&(d={});d[c]=g;x(a,b,d)},g=function(a,b,c){a=B(a,b);null!==a&&(a=c in a?a[c]:null);return a},K=function(a,b,c){var g=B(a,b);if(null!==g&&c in g){delete g[c];c=!0;for(var d in g){c=!1;break}c&&(g=null);x(a,b,g)}},u=function(a,b){x(a,b,null)},l=function(a,b,
211
+c){var g=null;"undefined"===typeof c&&(c=["web","flash"]);var d,p=!1,e=null,k;for(k in c){d=c[k];try{if("flash"===d||"both"===d){if(null===b[0])throw Error("Flash local storage not available.");g=a.apply(this,b);p="flash"===d}if("web"===d||"both"===d)b[0]=localStorage,g=a.apply(this,b),p=!0}catch(h){e=h}if(p)break}if(!p)throw e;return g};d.setItem=function(a,b,c,g,d){l(k,arguments,d)};d.getItem=function(a,b,c,d){return l(g,arguments,d)};d.removeItem=function(a,b,c,g){l(K,arguments,g)};d.clearItems=
212
+function(a,b,c){l(u,arguments,c)};d.parseUrl=function(a){var b=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;b.lastIndex=0;b=b.exec(a);if(a=null===b?null:{full:a,scheme:b[1],host:b[2],port:b[3],path:b[4]})a.fullHost=a.host,a.port?80!==a.port&&"http"===a.scheme?a.fullHost+=":"+a.port:443!==a.port&&"https"===a.scheme&&(a.fullHost+=":"+a.port):"http"===a.scheme?a.port=80:"https"===a.scheme&&(a.port=443),a.full=a.scheme+"://"+a.fullHost;return a};var w=null;d.getQueryVariables=function(a){var b=function(a){var b=
213
+{};a=a.split("&");for(var c=0;c<a.length;c++){var g=a[c].indexOf("="),d;0<g?(d=a[c].substring(0,g),g=a[c].substring(g+1)):(d=a[c],g=null);d in b||(b[d]=[]);d in Object.prototype||null===g||b[d].push(unescape(g))}return b};"undefined"===typeof a?(null===w&&(w="undefined"!==typeof window&&window.location&&window.location.search?b(window.location.search.substring(1)):{}),a=w):a=b(a);return a};d.parseFragment=function(a){var b=a,c="",g=a.indexOf("?");0<g&&(b=a.substring(0,g),c=a.substring(g+1));a=b.split("/");
214
0<a.length&&""===a[0]&&a.shift();g=""===c?{}:d.getQueryVariables(c);return{pathString:b,queryString:c,path:a,query:g}};d.makeRequest=function(a){var b=d.parseFragment(a),c={path:b.pathString,query:b.queryString,getPath:function(a){return"undefined"===typeof a?b.path:b.path[a]},getQuery:function(a,c){var g;"undefined"===typeof a?g=b.query:(g=b.query[a])&&"undefined"!==typeof c&&(g=g[c]);return g},getQueryLast:function(a,b){var g=c.getQuery(a);return g?g[g.length-1]:b}};return c};d.makeLink=function(a,
215
-b,c){a=jQuery.isArray(a)?a.join("/"):a;b=jQuery.param(b||{});c=c||"";return a+(0<b.length?"?"+b:"")+(0<c.length?"#"+c:"")};d.setPath=function(a,b,c){if("object"===typeof a&&null!==a)for(var g=0,d=b.length;g<d;){var n=b[g++];if(g==d)a[n]=c;else{var e=n in a;if(!e||e&&"object"!==typeof a[n]||e&&null===a[n])a[n]={};a=a[n]}}};d.getPath=function(a,b,c){for(var g=0,d=b.length,n=!0;n&&g<d&&"object"===typeof a&&null!==a;){var e=b[g++];(n=e in a)&&(a=a[e])}return n?a:c};d.deletePath=function(a,b){if("object"===
216
-typeof a&&null!==a)for(var c=0,g=b.length;c<g;){var d=b[c++];if(c==g)delete a[d];else{if(!(d in a)||"object"!==typeof a[d]||null===a[d])break;a=a[d]}}};d.isEmpty=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};d.format=function(a){var b=/%./g,c,g,d=0,n=[];for(g=0;c=b.exec(a);)switch(g=a.substring(g,b.lastIndex-2),0<g.length&&n.push(g),g=b.lastIndex,c=c[0][1],c){case "s":case "o":d<arguments.length?n.push(arguments[d++ +1]):n.push("<?>");break;case "%":n.push("%");break;default:n.push("<#"+
217
-c+"?>")}n.push(a.substring(g));return n.join("")};d.formatNumber=function(a,b,c,g){var d=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;g=void 0===g?".":g;c=0>a?"-":"";var n=parseInt(a=Math.abs(+a||0).toFixed(d),10)+"",e=3<n.length?n.length%3:0;return c+(e?n.substr(0,e)+g:"")+n.substr(e).replace(/(\d{3})(?=\d)/g,"$1"+g)+(d?b+Math.abs(a-n).toFixed(d).slice(2):"")};d.formatSize=function(a){return a=1073741824<=a?d.formatNumber(a/1073741824,2,".","")+" GiB":1048576<=a?d.formatNumber(a/1048576,2,".","")+
215
+b,c){a=jQuery.isArray(a)?a.join("/"):a;b=jQuery.param(b||{});c=c||"";return a+(0<b.length?"?"+b:"")+(0<c.length?"#"+c:"")};d.setPath=function(a,b,c){if("object"===typeof a&&null!==a)for(var g=0,d=b.length;g<d;){var p=b[g++];if(g==d)a[p]=c;else{var e=p in a;if(!e||e&&"object"!==typeof a[p]||e&&null===a[p])a[p]={};a=a[p]}}};d.getPath=function(a,b,c){for(var g=0,d=b.length,p=!0;p&&g<d&&"object"===typeof a&&null!==a;){var e=b[g++];(p=e in a)&&(a=a[e])}return p?a:c};d.deletePath=function(a,b){if("object"===
216
+typeof a&&null!==a)for(var c=0,g=b.length;c<g;){var d=b[c++];if(c==g)delete a[d];else{if(!(d in a)||"object"!==typeof a[d]||null===a[d])break;a=a[d]}}};d.isEmpty=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};d.format=function(a){var b=/%./g,c,g,d=0,p=[];for(g=0;c=b.exec(a);)switch(g=a.substring(g,b.lastIndex-2),0<g.length&&p.push(g),g=b.lastIndex,c=c[0][1],c){case "s":case "o":d<arguments.length?p.push(arguments[d++ +1]):p.push("<?>");break;case "%":p.push("%");break;default:p.push("<#"+
217
+c+"?>")}p.push(a.substring(g));return p.join("")};d.formatNumber=function(a,b,c,g){var d=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;g=void 0===g?".":g;c=0>a?"-":"";var p=parseInt(a=Math.abs(+a||0).toFixed(d),10)+"",e=3<p.length?p.length%3:0;return c+(e?p.substr(0,e)+g:"")+p.substr(e).replace(/(\d{3})(?=\d)/g,"$1"+g)+(d?b+Math.abs(a-p).toFixed(d).slice(2):"")};d.formatSize=function(a){return a=1073741824<=a?d.formatNumber(a/1073741824,2,".","")+" GiB":1048576<=a?d.formatNumber(a/1048576,2,".","")+
218
" MiB":1024<=a?d.formatNumber(a/1024,0)+" KiB":d.formatNumber(a,0)+" bytes"};d.bytesFromIP=function(a){return-1!==a.indexOf(".")?d.bytesFromIPv4(a):-1!==a.indexOf(":")?d.bytesFromIPv6(a):null};d.bytesFromIPv4=function(a){a=a.split(".");if(4!==a.length)return null;for(var b=d.createBuffer(),c=0;c<a.length;++c){var g=parseInt(a[c],10);if(isNaN(g))return null;b.putByte(g)}return b.getBytes()};d.bytesFromIPv6=function(a){var b=0;a=a.split(":").filter(function(a){0===a.length&&++b;return!0});for(var c=
219
-2*(8-a.length+b),g=d.createBuffer(),n=0;8>n;++n)if(a[n]&&0!==a[n].length){var e=d.hexToBytes(a[n]);2>e.length&&g.putByte(0);g.putBytes(e)}else g.fillWithByte(0,c),c=0;return g.getBytes()};d.bytesToIP=function(a){return 4===a.length?d.bytesToIPv4(a):16===a.length?d.bytesToIPv6(a):null};d.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c));return b.join(".")};d.bytesToIPv6=function(a){if(16!==a.length)return null;for(var b=[],c=[],g=0,n=0;n<a.length;n+=
220
-2){for(var e=d.bytesToHex(a[n]+a[n+1]);"0"===e[0]&&"0"!==e;)e=e.substr(1);if("0"===e){var k=c[c.length-1],h=b.length;k&&h===k.end+1?(k.end=h,k.end-k.start>c[g].end-c[g].start&&(g=c.length-1)):c.push({start:h,end:h})}b.push(e)}0<c.length&&(a=c[g],0<a.end-a.start&&(b.splice(a.start,a.end-a.start+1,""),0===a.start&&b.unshift(""),7===a.end&&b.push("")));return b.join(":")};d.estimateCores=function(a,b){function c(a,k,h){if(0===k){var m=Math.floor(a.reduce(function(a,b){return a+b},0)/a.length);d.cores=
221
-Math.max(1,m);URL.revokeObjectURL(e);return b(null,d.cores)}g(h,function(b,g){a.push(n(h,g));c(a,k-1,h)})}function g(a,b){for(var c=[],d=[],n=0;n<a;++n){var k=new Worker(e);k.addEventListener("message",function(g){d.push(g.data);if(d.length===a){for(g=0;g<a;++g)c[g].terminate();b(null,d)}});c.push(k)}for(n=0;n<a;++n)c[n].postMessage(n)}function n(a,b){for(var c=[],g=0;g<a;++g)for(var d=b[g],e=c[g]=[],k=0;k<a;++k)if(g!==k){var y=b[k];(d.st>y.st&&d.st<y.et||y.st>d.st&&y.st<d.et)&&e.push(k)}return c.reduce(function(a,
219
+2*(8-a.length+b),g=d.createBuffer(),p=0;8>p;++p)if(a[p]&&0!==a[p].length){var e=d.hexToBytes(a[p]);2>e.length&&g.putByte(0);g.putBytes(e)}else g.fillWithByte(0,c),c=0;return g.getBytes()};d.bytesToIP=function(a){return 4===a.length?d.bytesToIPv4(a):16===a.length?d.bytesToIPv6(a):null};d.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c));return b.join(".")};d.bytesToIPv6=function(a){if(16!==a.length)return null;for(var b=[],c=[],g=0,p=0;p<a.length;p+=
220
+2){for(var e=d.bytesToHex(a[p]+a[p+1]);"0"===e[0]&&"0"!==e;)e=e.substr(1);if("0"===e){var k=c[c.length-1],h=b.length;k&&h===k.end+1?(k.end=h,k.end-k.start>c[g].end-c[g].start&&(g=c.length-1)):c.push({start:h,end:h})}b.push(e)}0<c.length&&(a=c[g],0<a.end-a.start&&(b.splice(a.start,a.end-a.start+1,""),0===a.start&&b.unshift(""),7===a.end&&b.push("")));return b.join(":")};d.estimateCores=function(a,b){function c(a,k,h){if(0===k){var m=Math.floor(a.reduce(function(a,b){return a+b},0)/a.length);d.cores=
221
+Math.max(1,m);URL.revokeObjectURL(e);return b(null,d.cores)}g(h,function(b,g){a.push(p(h,g));c(a,k-1,h)})}function g(a,b){for(var c=[],d=[],p=0;p<a;++p){var k=new Worker(e);k.addEventListener("message",function(g){d.push(g.data);if(d.length===a){for(g=0;g<a;++g)c[g].terminate();b(null,d)}});c.push(k)}for(p=0;p<a;++p)c[p].postMessage(p)}function p(a,b){for(var c=[],g=0;g<a;++g)for(var d=b[g],e=c[g]=[],k=0;k<a;++k)if(g!==k){var z=b[k];(d.st>z.st&&d.st<z.et||z.st>d.st&&z.st<d.et)&&e.push(k)}return c.reduce(function(a,
222
b){return Math.max(a,b.length)},0)}"function"===typeof a&&(b=a,a={});a=a||{};if("cores"in d&&!a.update)return b(null,d.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&0<navigator.hardwareConcurrency)return d.cores=navigator.hardwareConcurrency,b(null,d.cores);if("undefined"===typeof Worker)return d.cores=1,b(null,d.cores);if("undefined"===typeof Blob)return d.cores=2,b(null,d.cores);var e=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(a){a=
223
-Date.now();for(var b=a+4;Date.now()<b;);self.postMessage({st:a,et:b})})}.toString(),")()"],{type:"application/javascript"}));c([],5,16)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.util)return c.util;c.defined.util=!0;for(var m=0;m<e.length;++m)e[m](c);
224
-return c.util}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/util",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.cipher=a.cipher||{};a.cipher.algorithms=a.cipher.algorithms||{};a.cipher.createCipher=function(b,c){var d=b;"string"===typeof d&&(d=a.cipher.getAlgorithm(d))&&
223
+Date.now();for(var b=a+4;Date.now()<b;);self.postMessage({st:a,et:b})})}.toString(),")()"],{type:"application/javascript"}));c([],5,16)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.util)return c.util;c.defined.util=!0;for(var m=0;m<e.length;++m)e[m](c);
224
+return c.util}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/util",["require","module"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.cipher=a.cipher||{};a.cipher.algorithms=a.cipher.algorithms||{};a.cipher.createCipher=function(b,c){var d=b;"string"===typeof d&&(d=a.cipher.getAlgorithm(d))&&
225
(d=d());if(!d)throw Error("Unsupported algorithm: "+b);return new a.cipher.BlockCipher({algorithm:d,key:c,decrypt:!1})};a.cipher.createDecipher=function(b,c){var d=b;"string"===typeof d&&(d=a.cipher.getAlgorithm(d))&&(d=d());if(!d)throw Error("Unsupported algorithm: "+b);return new a.cipher.BlockCipher({algorithm:d,key:c,decrypt:!0})};a.cipher.registerAlgorithm=function(b,c){b=b.toUpperCase();a.cipher.algorithms[b]=c};a.cipher.getAlgorithm=function(b){b=b.toUpperCase();return b in a.cipher.algorithms?
226
a.cipher.algorithms[b]:null};var c=a.cipher.BlockCipher=function(a){this.algorithm=a.algorithm;this.mode=this.algorithm.mode;this.blockSize=this.mode.blockSize;this._finish=!1;this.output=this._input=null;this._op=a.decrypt?this.mode.decrypt:this.mode.encrypt;this._decrypt=a.decrypt;this.algorithm.initialize(a)};c.prototype.start=function(b){b=b||{};var c={},d;for(d in b)c[d]=b[d];c.decrypt=this._decrypt;this._finish=!1;this._input=a.util.createBuffer();this.output=b.output||a.util.createBuffer();
227
this.mode.start(c)};c.prototype.update=function(a){for(a&&this._input.putBuffer(a);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};c.prototype.finish=function(a){!a||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(b){return a(this.blockSize,b,!1)},this.mode.unpad=function(b){return a(this.blockSize,b,!0)});var b={};b.decrypt=this._decrypt;b.overflow=this._input.length()%this.blockSize;if(!this._decrypt&&this.mode.pad&&
228
-!this.mode.pad(this._input,b))return!1;this._finish=!0;this.update();return this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,b)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,b)?!1:!0}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipher)return c.cipher;
229
-c.defined.cipher=!0;for(var m=0;m<e.length;++m)e[m](c);return c.cipher}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipher",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){"string"===typeof b&&(b=a.util.createBuffer(b));if(a.util.isArray(b)&&
230
-4<b.length){var d=b;b=a.util.createBuffer();for(var g=0;g<d.length;++g)b.putByte(d[g])}a.util.isArray(b)||(b=[b.getInt32(),b.getInt32(),b.getInt32(),b.getInt32()]);return b}function d(a){a[a.length-1]=a[a.length-1]+1&4294967295}function e(a){return[a/4294967296|0,a&4294967295]}a.cipher=a.cipher||{};var z=a.cipher.modes=a.cipher.modes||{};z.ecb=function(a){a=a||{};this.name="ECB";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=
231
-Array(this._ints)};z.ecb.prototype.start=function(a){};z.ecb.prototype.encrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};z.ecb.prototype.decrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.decrypt(this._inBlock,
232
-this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};z.ecb.prototype.pad=function(a,b){var c=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(c,c);return!0};z.ecb.prototype.unpad=function(a,b){if(0<b.overflow)return!1;var c=a.length(),c=a.at(c-1);if(c>this.blockSize<<2)return!1;a.truncate(c);return!0};z.cbc=function(a){a=a||{};this.name="CBC";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);
233
-this._outBlock=Array(this._ints)};z.cbc.prototype.start=function(a){if(null===a.iv){if(!this._prev)throw Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in a)this._iv=c(a.iv),this._prev=this._iv.slice(0);else throw Error("Invalid IV parameter.");};z.cbc.prototype.encrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=this._prev[c]^a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c]);
234
-this._prev=this._outBlock};z.cbc.prototype.decrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._prev[c]^this._outBlock[c]);this._prev=this._inBlock.slice(0)};z.cbc.prototype.pad=function(a,b){var c=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(c,c);return!0};z.cbc.prototype.unpad=function(a,
235
-b){if(0<b.overflow)return!1;var c=a.length(),c=a.at(c-1);if(c>this.blockSize<<2)return!1;a.truncate(c);return!0};z.cfb=function(b){b=b||{};this.name="CFB";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};z.cfb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=c(a.iv);this._inBlock=
236
-this._iv.slice(0);this._partialBytes=0};z.cfb.prototype.encrypt=function(a,b,c){var d=a.length();if(0===d)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&d>=this.blockSize)for(var n=0;n<this._ints;++n)this._inBlock[n]=a.getInt32()^this._outBlock[n],b.putInt32(this._inBlock[n]);else{var e=(this.blockSize-d)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialBlock[n]=a.getInt32()^this._outBlock[n],this._partialOutput.putInt32(this._partialBlock[n]);
237
-if(0<e)a.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};z.cfb.prototype.decrypt=function(a,b,c){var d=a.length();if(0===d)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&
238
-d>=this.blockSize)for(var n=0;n<this._ints;++n)this._inBlock[n]=a.getInt32(),b.putInt32(this._inBlock[n]^this._outBlock[n]);else{var e=(this.blockSize-d)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialBlock[n]=a.getInt32(),this._partialOutput.putInt32(this._partialBlock[n]^this._outBlock[n]);if(0<e)a.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);
239
-if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};z.ofb=function(b){b=b||{};this.name="OFB";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};z.ofb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");
240
-this._iv=c(a.iv);this._inBlock=this._iv.slice(0);this._partialBytes=0};z.ofb.prototype.encrypt=function(a,b,c){var d=a.length();if(0===a.length())return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&d>=this.blockSize)for(var n=0;n<this._ints;++n)b.putInt32(a.getInt32()^this._outBlock[n]),this._inBlock[n]=this._outBlock[n];else{var e=(this.blockSize-d)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialOutput.putInt32(a.getInt32()^
241
-this._outBlock[n]);if(0<e)a.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._outBlock[n];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};z.ofb.prototype.decrypt=z.ofb.prototype.encrypt;z.ctr=function(b){b=b||{};this.name="CTR";this.cipher=b.cipher;this.blockSize=
242
-b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};z.ctr.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=c(a.iv);this._inBlock=this._iv.slice(0);this._partialBytes=0};z.ctr.prototype.encrypt=function(a,b,c){var n=a.length();if(0===n)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&n>=this.blockSize)for(var e=0;e<
243
-this._ints;++e)b.putInt32(a.getInt32()^this._outBlock[e]);else{var h=(this.blockSize-n)%this.blockSize;0<h&&(h=this.blockSize-h);this._partialOutput.clear();for(e=0;e<this._ints;++e)this._partialOutput.putInt32(a.getInt32()^this._outBlock[e]);0<h&&(a.read-=this.blockSize);0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<h&&!c)return b.putBytes(this._partialOutput.getBytes(h-this._partialBytes)),this._partialBytes=h,!0;b.putBytes(this._partialOutput.getBytes(n-this._partialBytes));
244
-this._partialBytes=0}d(this._inBlock)};z.ctr.prototype.decrypt=z.ctr.prototype.encrypt;z.gcm=function(b){b=b||{};this.name="GCM";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0;this._R=3774873600};z.gcm.prototype.start=function(b){if(!("iv"in b))throw Error("Invalid IV parameter.");var c=a.util.createBuffer(b.iv);this._cipherLength=0;var g;
228
+!this.mode.pad(this._input,b))return!1;this._finish=!0;this.update();return this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,b)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,b)?!1:!0}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipher)return c.cipher;
229
+c.defined.cipher=!0;for(var m=0;m<e.length;++m)e[m](c);return c.cipher}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipher",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){"string"===typeof b&&(b=a.util.createBuffer(b));if(a.util.isArray(b)&&
230
+4<b.length){var d=b;b=a.util.createBuffer();for(var g=0;g<d.length;++g)b.putByte(d[g])}a.util.isArray(b)||(b=[b.getInt32(),b.getInt32(),b.getInt32(),b.getInt32()]);return b}function d(a){a[a.length-1]=a[a.length-1]+1&4294967295}function e(a){return[a/4294967296|0,a&4294967295]}a.cipher=a.cipher||{};var x=a.cipher.modes=a.cipher.modes||{};x.ecb=function(a){a=a||{};this.name="ECB";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=
231
+Array(this._ints)};x.ecb.prototype.start=function(a){};x.ecb.prototype.encrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};x.ecb.prototype.decrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.decrypt(this._inBlock,
232
+this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};x.ecb.prototype.pad=function(a,b){var c=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(c,c);return!0};x.ecb.prototype.unpad=function(a,b){if(0<b.overflow)return!1;var c=a.length(),c=a.at(c-1);if(c>this.blockSize<<2)return!1;a.truncate(c);return!0};x.cbc=function(a){a=a||{};this.name="CBC";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);
233
+this._outBlock=Array(this._ints)};x.cbc.prototype.start=function(a){if(null===a.iv){if(!this._prev)throw Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in a)this._iv=c(a.iv),this._prev=this._iv.slice(0);else throw Error("Invalid IV parameter.");};x.cbc.prototype.encrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=this._prev[c]^a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c]);
234
+this._prev=this._outBlock};x.cbc.prototype.decrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._prev[c]^this._outBlock[c]);this._prev=this._inBlock.slice(0)};x.cbc.prototype.pad=function(a,b){var c=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(c,c);return!0};x.cbc.prototype.unpad=function(a,
235
+b){if(0<b.overflow)return!1;var c=a.length(),c=a.at(c-1);if(c>this.blockSize<<2)return!1;a.truncate(c);return!0};x.cfb=function(b){b=b||{};this.name="CFB";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};x.cfb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=c(a.iv);this._inBlock=
236
+this._iv.slice(0);this._partialBytes=0};x.cfb.prototype.encrypt=function(a,b,c){var d=a.length();if(0===d)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&d>=this.blockSize)for(var p=0;p<this._ints;++p)this._inBlock[p]=a.getInt32()^this._outBlock[p],b.putInt32(this._inBlock[p]);else{var e=(this.blockSize-d)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(p=0;p<this._ints;++p)this._partialBlock[p]=a.getInt32()^this._outBlock[p],this._partialOutput.putInt32(this._partialBlock[p]);
237
+if(0<e)a.read-=this.blockSize;else for(p=0;p<this._ints;++p)this._inBlock[p]=this._partialBlock[p];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};x.cfb.prototype.decrypt=function(a,b,c){var d=a.length();if(0===d)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&
238
+d>=this.blockSize)for(var p=0;p<this._ints;++p)this._inBlock[p]=a.getInt32(),b.putInt32(this._inBlock[p]^this._outBlock[p]);else{var e=(this.blockSize-d)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(p=0;p<this._ints;++p)this._partialBlock[p]=a.getInt32(),this._partialOutput.putInt32(this._partialBlock[p]^this._outBlock[p]);if(0<e)a.read-=this.blockSize;else for(p=0;p<this._ints;++p)this._inBlock[p]=this._partialBlock[p];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);
239
+if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};x.ofb=function(b){b=b||{};this.name="OFB";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};x.ofb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");
240
+this._iv=c(a.iv);this._inBlock=this._iv.slice(0);this._partialBytes=0};x.ofb.prototype.encrypt=function(a,b,c){var d=a.length();if(0===a.length())return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&d>=this.blockSize)for(var p=0;p<this._ints;++p)b.putInt32(a.getInt32()^this._outBlock[p]),this._inBlock[p]=this._outBlock[p];else{var e=(this.blockSize-d)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(p=0;p<this._ints;++p)this._partialOutput.putInt32(a.getInt32()^
241
+this._outBlock[p]);if(0<e)a.read-=this.blockSize;else for(p=0;p<this._ints;++p)this._inBlock[p]=this._outBlock[p];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};x.ofb.prototype.decrypt=x.ofb.prototype.encrypt;x.ctr=function(b){b=b||{};this.name="CTR";this.cipher=b.cipher;this.blockSize=
242
+b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};x.ctr.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=c(a.iv);this._inBlock=this._iv.slice(0);this._partialBytes=0};x.ctr.prototype.encrypt=function(a,b,c){var p=a.length();if(0===p)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&p>=this.blockSize)for(var e=0;e<
243
+this._ints;++e)b.putInt32(a.getInt32()^this._outBlock[e]);else{var h=(this.blockSize-p)%this.blockSize;0<h&&(h=this.blockSize-h);this._partialOutput.clear();for(e=0;e<this._ints;++e)this._partialOutput.putInt32(a.getInt32()^this._outBlock[e]);0<h&&(a.read-=this.blockSize);0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<h&&!c)return b.putBytes(this._partialOutput.getBytes(h-this._partialBytes)),this._partialBytes=h,!0;b.putBytes(this._partialOutput.getBytes(p-this._partialBytes));
244
+this._partialBytes=0}d(this._inBlock)};x.ctr.prototype.decrypt=x.ctr.prototype.encrypt;x.gcm=function(b){b=b||{};this.name="GCM";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0;this._R=3774873600};x.gcm.prototype.start=function(b){if(!("iv"in b))throw Error("Invalid IV parameter.");var c=a.util.createBuffer(b.iv);this._cipherLength=0;var g;
245
g="additionalData"in b?a.util.createBuffer(b.additionalData):a.util.createBuffer();this._tagLength="tagLength"in b?b.tagLength:128;this._tag=null;if(b.decrypt&&(this._tag=a.util.createBuffer(b.tag).getBytes(),this._tag.length!==this._tagLength/8))throw Error("Authentication tag does not match tag length.");this._hashBlock=Array(this._ints);this.tag=null;this._hashSubkey=Array(this._ints);this.cipher.encrypt([0,0,0,0],this._hashSubkey);this.componentBits=4;this._m=this.generateHashTable(this._hashSubkey,
246
this.componentBits);b=c.length();if(12===b)this._j0=[c.getInt32(),c.getInt32(),c.getInt32(),1];else{for(this._j0=[0,0,0,0];0<c.length();)this._j0=this.ghash(this._hashSubkey,this._j0,[c.getInt32(),c.getInt32(),c.getInt32(),c.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(e(8*b)))}this._inBlock=this._j0.slice(0);d(this._inBlock);this._partialBytes=0;g=a.util.createBuffer(g);this._aDataLength=e(8*g.length());(c=g.length()%this.blockSize)&&g.fillWithByte(0,this.blockSize-c);
247
-for(this._s=[0,0,0,0];0<g.length();)this._s=this.ghash(this._hashSubkey,this._s,[g.getInt32(),g.getInt32(),g.getInt32(),g.getInt32()])};z.gcm.prototype.encrypt=function(a,b,c){var n=a.length();if(0===n)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&n>=this.blockSize){for(var e=0;e<this._ints;++e)b.putInt32(this._outBlock[e]^=a.getInt32());this._cipherLength+=this.blockSize}else{var h=(this.blockSize-n)%this.blockSize;0<h&&(h=this.blockSize-h);this._partialOutput.clear();
248
-for(e=0;e<this._ints;++e)this._partialOutput.putInt32(a.getInt32()^this._outBlock[e]);if(0===h||c){c?(e=n%this.blockSize,this._cipherLength+=e,this._partialOutput.truncate(this.blockSize-e)):this._cipherLength+=this.blockSize;for(e=0;e<this._ints;++e)this._outBlock[e]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<h&&!c)return a.read-=this.blockSize,b.putBytes(this._partialOutput.getBytes(h-this._partialBytes)),
249
-this._partialBytes=h,!0;b.putBytes(this._partialOutput.getBytes(n-this._partialBytes));this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock);d(this._inBlock)};z.gcm.prototype.decrypt=function(a,b,c){var n=a.length();if(n<this.blockSize&&!(c&&0<n))return!0;this.cipher.encrypt(this._inBlock,this._outBlock);d(this._inBlock);this._hashBlock[0]=a.getInt32();this._hashBlock[1]=a.getInt32();this._hashBlock[2]=a.getInt32();this._hashBlock[3]=a.getInt32();this._s=this.ghash(this._hashSubkey,
250
-this._s,this._hashBlock);for(a=0;a<this._ints;++a)b.putInt32(this._outBlock[a]^this._hashBlock[a]);this._cipherLength=n<this.blockSize?this._cipherLength+n%this.blockSize:this._cipherLength+this.blockSize};z.gcm.prototype.afterFinish=function(b,c){var d=!0;c.decrypt&&c.overflow&&b.truncate(this.blockSize-c.overflow);this.tag=a.util.createBuffer();var m=this._aDataLength.concat(e(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,m);m=[];this.cipher.encrypt(this._j0,m);for(var u=0;u<
251
-this._ints;++u)this.tag.putInt32(this._s[u]^m[u]);this.tag.truncate(this.tag.length()%(this._tagLength/8));c.decrypt&&this.tag.bytes()!==this._tag&&(d=!1);return d};z.gcm.prototype.multiply=function(a,b){for(var c=[0,0,0,0],d=b.slice(0),n=0;128>n;++n)a[n/32|0]&1<<31-n%32&&(c[0]^=d[0],c[1]^=d[1],c[2]^=d[2],c[3]^=d[3]),this.pow(d,d);return c};z.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,d=3;0<d;--d)b[d]=a[d]>>>1|(a[d-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};z.gcm.prototype.tableMultiply=function(a){for(var b=
252
-[0,0,0,0],c=0;32>c;++c){var d=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=d[0];b[1]^=d[1];b[2]^=d[2];b[3]^=d[3]}return b};z.gcm.prototype.ghash=function(a,b,c){b[0]^=c[0];b[1]^=c[1];b[2]^=c[2];b[3]^=c[3];return this.tableMultiply(b)};z.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,d=4*c,c=16*c,n=Array(c),e=0;e<c;++e){var h=[0,0,0,0];h[e/d|0]=1<<b-1<<(d-1-e%d)*b;n[e]=this.generateSubHashTable(this.multiply(h,a),b)}return n};z.gcm.prototype.generateSubHashTable=function(a,b){var c=1<<b,
253
-d=c>>>1,n=Array(c);n[d]=a.slice(0);for(var e=d>>>1;0<e;)this.pow(n[2*e],n[e]=[]),e>>=1;for(e=2;e<d;){for(var h=1;h<e;++h){var m=n[e],z=n[h];n[e+h]=[m[0]^z[0],m[1]^z[1],m[2]^z[2],m[3]^z[3]]}e*=2}n[0]=[0,0,0,0];for(e=d+1;e<c;++e)h=n[e^d],n[e]=[a[0]^h[0],a[1]^h[1],a[2]^h[2],a[3]^h[3]];return n}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=
254
-l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipherModes)return c.cipherModes;c.defined.cipherModes=!0;for(var m=0;m<e.length;++m)e[m](c);return c.cipherModes}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipherModes",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,
255
-0))})})();(function(){function b(a){function c(b,d){a.cipher.registerAlgorithm(b,function(){return new a.aes.Algorithm(b,d)})}function d(){k=!0;p=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),b=0;128>b;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;J=Array(256);u=Array(256);x=Array(4);w=Array(4);for(b=0;4>b;++b)x[b]=Array(256),w[b]=Array(256);for(var c=0,g=0,n,e,h,m,r,b=0;256>b;++b){m=g^g<<1^g<<2^g<<3^g<<4;m=m>>8^m&255^99;J[c]=m;u[m]=c;r=a[m];n=a[c];e=a[n];h=a[e];r^=r<<24^m<<16^m<<8^m;e=(n^e^h)<<24^(c^
256
-h)<<16^(c^e^h)<<8^c^n^h;for(var z=0;4>z;++z)x[z][c]=r,w[z][m]=e,r=r<<24|r>>>8,e=e<<24|e>>>8;0===c?c=g=1:(c=n^a[a[a[n^h]]],g^=a[a[g]])}}function e(a,b){for(var c=a.slice(0),d,n=1,k=c.length,h=g*(k+6+1),m=k;m<h;++m)d=c[m-1],0===m%k?(d=J[d>>>16&255]<<24^J[d>>>8&255]<<16^J[d&255]<<8^J[d>>>24]^p[n]<<24,n++):6<k&&4===m%k&&(d=J[d>>>24]<<24^J[d>>>16&255]<<16^J[d>>>8&255]<<8^J[d&255]),c[m]=c[m-k]^d;if(b){for(var n=w[0],k=w[1],u=w[2],z=w[3],x=c.slice(0),h=c.length,m=0,M=h-g;m<h;m+=g,M-=g)if(0===m||m===h-g)x[m]=
257
-c[M],x[m+1]=c[M+3],x[m+2]=c[M+2],x[m+3]=c[M+1];else for(var v=0;v<g;++v)d=c[M+v],x[m+(3&-v)]=n[J[d>>>24]]^k[J[d>>>16&255]]^u[J[d>>>8&255]]^z[J[d&255]];c=x}return c}function z(a,b,c,d){var g=a.length/4-1,n,e,k,h,m;d?(n=w[0],e=w[1],k=w[2],h=w[3],m=u):(n=x[0],e=x[1],k=x[2],h=x[3],m=J);var z,M,v,l,B,p;z=b[0]^a[0];M=b[d?3:1]^a[1];v=b[2]^a[2];b=b[d?1:3]^a[3];for(var C=3,q=1;q<g;++q)l=n[z>>>24]^e[M>>>16&255]^k[v>>>8&255]^h[b&255]^a[++C],B=n[M>>>24]^e[v>>>16&255]^k[b>>>8&255]^h[z&255]^a[++C],p=n[v>>>24]^
258
-e[b>>>16&255]^k[z>>>8&255]^h[M&255]^a[++C],b=n[b>>>24]^e[z>>>16&255]^k[M>>>8&255]^h[v&255]^a[++C],z=l,M=B,v=p;c[0]=m[z>>>24]<<24^m[M>>>16&255]<<16^m[v>>>8&255]<<8^m[b&255]^a[++C];c[d?3:1]=m[M>>>24]<<24^m[v>>>16&255]<<16^m[b>>>8&255]<<8^m[z&255]^a[++C];c[2]=m[v>>>24]<<24^m[b>>>16&255]<<16^m[z>>>8&255]<<8^m[M&255]^a[++C];c[d?1:3]=m[b>>>24]<<24^m[z>>>16&255]<<16^m[M>>>8&255]<<8^m[v&255]^a[++C]}function l(b){b=b||{};var c="AES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):
247
+for(this._s=[0,0,0,0];0<g.length();)this._s=this.ghash(this._hashSubkey,this._s,[g.getInt32(),g.getInt32(),g.getInt32(),g.getInt32()])};x.gcm.prototype.encrypt=function(a,b,c){var p=a.length();if(0===p)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&p>=this.blockSize){for(var e=0;e<this._ints;++e)b.putInt32(this._outBlock[e]^=a.getInt32());this._cipherLength+=this.blockSize}else{var h=(this.blockSize-p)%this.blockSize;0<h&&(h=this.blockSize-h);this._partialOutput.clear();
248
+for(e=0;e<this._ints;++e)this._partialOutput.putInt32(a.getInt32()^this._outBlock[e]);if(0===h||c){c?(e=p%this.blockSize,this._cipherLength+=e,this._partialOutput.truncate(this.blockSize-e)):this._cipherLength+=this.blockSize;for(e=0;e<this._ints;++e)this._outBlock[e]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<h&&!c)return a.read-=this.blockSize,b.putBytes(this._partialOutput.getBytes(h-this._partialBytes)),
249
+this._partialBytes=h,!0;b.putBytes(this._partialOutput.getBytes(p-this._partialBytes));this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock);d(this._inBlock)};x.gcm.prototype.decrypt=function(a,b,c){var p=a.length();if(p<this.blockSize&&!(c&&0<p))return!0;this.cipher.encrypt(this._inBlock,this._outBlock);d(this._inBlock);this._hashBlock[0]=a.getInt32();this._hashBlock[1]=a.getInt32();this._hashBlock[2]=a.getInt32();this._hashBlock[3]=a.getInt32();this._s=this.ghash(this._hashSubkey,
250
+this._s,this._hashBlock);for(a=0;a<this._ints;++a)b.putInt32(this._outBlock[a]^this._hashBlock[a]);this._cipherLength=p<this.blockSize?this._cipherLength+p%this.blockSize:this._cipherLength+this.blockSize};x.gcm.prototype.afterFinish=function(b,c){var d=!0;c.decrypt&&c.overflow&&b.truncate(this.blockSize-c.overflow);this.tag=a.util.createBuffer();var m=this._aDataLength.concat(e(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,m);m=[];this.cipher.encrypt(this._j0,m);for(var u=0;u<
251
+this._ints;++u)this.tag.putInt32(this._s[u]^m[u]);this.tag.truncate(this.tag.length()%(this._tagLength/8));c.decrypt&&this.tag.bytes()!==this._tag&&(d=!1);return d};x.gcm.prototype.multiply=function(a,b){for(var c=[0,0,0,0],d=b.slice(0),p=0;128>p;++p)a[p/32|0]&1<<31-p%32&&(c[0]^=d[0],c[1]^=d[1],c[2]^=d[2],c[3]^=d[3]),this.pow(d,d);return c};x.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,d=3;0<d;--d)b[d]=a[d]>>>1|(a[d-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};x.gcm.prototype.tableMultiply=function(a){for(var b=
252
+[0,0,0,0],c=0;32>c;++c){var d=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=d[0];b[1]^=d[1];b[2]^=d[2];b[3]^=d[3]}return b};x.gcm.prototype.ghash=function(a,b,c){b[0]^=c[0];b[1]^=c[1];b[2]^=c[2];b[3]^=c[3];return this.tableMultiply(b)};x.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,d=4*c,c=16*c,p=Array(c),e=0;e<c;++e){var h=[0,0,0,0];h[e/d|0]=1<<b-1<<(d-1-e%d)*b;p[e]=this.generateSubHashTable(this.multiply(h,a),b)}return p};x.gcm.prototype.generateSubHashTable=function(a,b){var c=1<<b,
253
+d=c>>>1,p=Array(c);p[d]=a.slice(0);for(var e=d>>>1;0<e;)this.pow(p[2*e],p[e]=[]),e>>=1;for(e=2;e<d;){for(var h=1;h<e;++h){var m=p[e],x=p[h];p[e+h]=[m[0]^x[0],m[1]^x[1],m[2]^x[2],m[3]^x[3]]}e*=2}p[0]=[0,0,0,0];for(e=d+1;e<c;++e)h=p[e^d],p[e]=[a[0]^h[0],a[1]^h[1],a[2]^h[2],a[3]^h[3]];return p}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=
254
+l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipherModes)return c.cipherModes;c.defined.cipherModes=!0;for(var m=0;m<e.length;++m)e[m](c);return c.cipherModes}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipherModes",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,
255
+0))})})();(function(){function b(a){function c(b,d){a.cipher.registerAlgorithm(b,function(){return new a.aes.Algorithm(b,d)})}function d(){k=!0;n=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),b=0;128>b;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;K=Array(256);u=Array(256);w=Array(4);y=Array(4);for(b=0;4>b;++b)w[b]=Array(256),y[b]=Array(256);for(var c=0,g=0,p,e,h,m,q,b=0;256>b;++b){m=g^g<<1^g<<2^g<<3^g<<4;m=m>>8^m&255^99;K[c]=m;u[m]=c;q=a[m];p=a[c];e=a[p];h=a[e];q^=q<<24^m<<16^m<<8^m;e=(p^e^h)<<24^(c^
256
+h)<<16^(c^e^h)<<8^c^p^h;for(var x=0;4>x;++x)w[x][c]=q,y[x][m]=e,q=q<<24|q>>>8,e=e<<24|e>>>8;0===c?c=g=1:(c=p^a[a[a[p^h]]],g^=a[a[g]])}}function e(a,b){for(var c=a.slice(0),d,p=1,k=c.length,h=g*(k+6+1),m=k;m<h;++m)d=c[m-1],0===m%k?(d=K[d>>>16&255]<<24^K[d>>>8&255]<<16^K[d&255]<<8^K[d>>>24]^n[p]<<24,p++):6<k&&4===m%k&&(d=K[d>>>24]<<24^K[d>>>16&255]<<16^K[d>>>8&255]<<8^K[d&255]),c[m]=c[m-k]^d;if(b){for(var p=y[0],k=y[1],u=y[2],x=y[3],w=c.slice(0),h=c.length,m=0,v=h-g;m<h;m+=g,v-=g)if(0===m||m===h-g)w[m]=
257
+c[v],w[m+1]=c[v+3],w[m+2]=c[v+2],w[m+3]=c[v+1];else for(var l=0;l<g;++l)d=c[v+l],w[m+(3&-l)]=p[K[d>>>24]]^k[K[d>>>16&255]]^u[K[d>>>8&255]]^x[K[d&255]];c=w}return c}function x(a,b,c,d){var g=a.length/4-1,p,e,k,h,m;d?(p=y[0],e=y[1],k=y[2],h=y[3],m=u):(p=w[0],e=w[1],k=w[2],h=w[3],m=K);var x,v,l,B,n,r;x=b[0]^a[0];v=b[d?3:1]^a[1];l=b[2]^a[2];b=b[d?1:3]^a[3];for(var C=3,aa=1;aa<g;++aa)B=p[x>>>24]^e[v>>>16&255]^k[l>>>8&255]^h[b&255]^a[++C],n=p[v>>>24]^e[l>>>16&255]^k[b>>>8&255]^h[x&255]^a[++C],r=p[l>>>24]^
258
+e[b>>>16&255]^k[x>>>8&255]^h[v&255]^a[++C],b=p[b>>>24]^e[x>>>16&255]^k[v>>>8&255]^h[l&255]^a[++C],x=B,v=n,l=r;c[0]=m[x>>>24]<<24^m[v>>>16&255]<<16^m[l>>>8&255]<<8^m[b&255]^a[++C];c[d?3:1]=m[v>>>24]<<24^m[l>>>16&255]<<16^m[b>>>8&255]<<8^m[x&255]^a[++C];c[2]=m[l>>>24]<<24^m[b>>>16&255]<<16^m[x>>>8&255]<<8^m[v&255]^a[++C];c[d?1:3]=m[b>>>24]<<24^m[x>>>16&255]<<16^m[v>>>8&255]<<8^m[l&255]^a[++C]}function l(b){b=b||{};var c="AES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):
259
a.cipher.createCipher(c,b.key);var g=d.start;d.start=function(b,c){var e=null;c instanceof a.util.ByteBuffer&&(e=c,c={});c=c||{};c.output=e;c.iv=b;g.call(d,c)};return d}a.aes=a.aes||{};a.aes.startEncrypting=function(a,b,c,d){a=l({key:a,output:c,decrypt:!1,mode:d});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return l({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,d){a=l({key:a,output:c,decrypt:!0,mode:d});a.start(b);return a};a.aes.createDecryptionCipher=
260
-function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){k||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return z(c._w,a,b,!1)},decrypt:function(a,b){return z(c._w,a,b,!0)}}});c._init=!1};a.aes.Algorithm.prototype.initialize=function(b){if(!this._init){var c=b.key,d;if("string"===typeof c&&(16===c.length||24===c.length||32===c.length))c=a.util.createBuffer(c);else if(a.util.isArray(c)&&(16===c.length||24===c.length||32===c.length)){d=
261
-c;for(var c=a.util.createBuffer(),g=0;g<d.length;++g)c.putByte(d[g])}if(!a.util.isArray(c)){d=c;var c=[],k=d.length();if(16===k||24===k||32===k)for(k>>>=2,g=0;g<k;++g)c.push(d.getInt32())}if(!a.util.isArray(c)||4!==c.length&&6!==c.length&&8!==c.length)throw Error("Invalid key parameter.");d=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=e(c,b.decrypt&&!d);this._init=!0}};a.aes._expandKey=function(a,b){k||d();return e(a,b)};a.aes._updateBlock=z;c("AES-ECB",a.cipher.modes.ecb);c("AES-CBC",
262
-a.cipher.modes.cbc);c("AES-CFB",a.cipher.modes.cfb);c("AES-OFB",a.cipher.modes.ofb);c("AES-CTR",a.cipher.modes.ctr);c("AES-GCM",a.cipher.modes.gcm);var k=!1,g=4,J,u,p,x,w}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aes)return c.aes;c.defined.aes=
263
-!0;for(var m=0;m<e.length;++m)e[m](c);return c.aes}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aes",["require","module","./cipher","./cipherModes","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.pki=a.pki||{};a=a.pki.oids=a.oids=a.oids||{};a["1.2.840.113549.1.1.1"]="rsaEncryption";
260
+function(a,b){return l({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){k||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return x(c._w,a,b,!1)},decrypt:function(a,b){return x(c._w,a,b,!0)}}});c._init=!1};a.aes.Algorithm.prototype.initialize=function(b){if(!this._init){var c=b.key,d;if("string"===typeof c&&(16===c.length||24===c.length||32===c.length))c=a.util.createBuffer(c);else if(a.util.isArray(c)&&(16===c.length||24===c.length||32===c.length)){d=
261
+c;for(var c=a.util.createBuffer(),g=0;g<d.length;++g)c.putByte(d[g])}if(!a.util.isArray(c)){d=c;var c=[],k=d.length();if(16===k||24===k||32===k)for(k>>>=2,g=0;g<k;++g)c.push(d.getInt32())}if(!a.util.isArray(c)||4!==c.length&&6!==c.length&&8!==c.length)throw Error("Invalid key parameter.");d=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=e(c,b.decrypt&&!d);this._init=!0}};a.aes._expandKey=function(a,b){k||d();return e(a,b)};a.aes._updateBlock=x;c("AES-ECB",a.cipher.modes.ecb);c("AES-CBC",
262
+a.cipher.modes.cbc);c("AES-CFB",a.cipher.modes.cfb);c("AES-OFB",a.cipher.modes.ofb);c("AES-CTR",a.cipher.modes.ctr);c("AES-GCM",a.cipher.modes.gcm);var k=!1,g=4,K,u,n,w,y}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aes)return c.aes;c.defined.aes=
263
+!0;for(var m=0;m<e.length;++m)e[m](c);return c.aes}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aes",["require","module","./cipher","./cipherModes","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.pki=a.pki||{};a=a.pki.oids=a.oids=a.oids||{};a["1.2.840.113549.1.1.1"]="rsaEncryption";
264
a.rsaEncryption="1.2.840.113549.1.1.1";a["1.2.840.113549.1.1.4"]="md5WithRSAEncryption";a.md5WithRSAEncryption="1.2.840.113549.1.1.4";a["1.2.840.113549.1.1.5"]="sha1WithRSAEncryption";a.sha1WithRSAEncryption="1.2.840.113549.1.1.5";a["1.2.840.113549.1.1.7"]="RSAES-OAEP";a["RSAES-OAEP"]="1.2.840.113549.1.1.7";a["1.2.840.113549.1.1.8"]="mgf1";a.mgf1="1.2.840.113549.1.1.8";a["1.2.840.113549.1.1.9"]="pSpecified";a.pSpecified="1.2.840.113549.1.1.9";a["1.2.840.113549.1.1.10"]="RSASSA-PSS";a["RSASSA-PSS"]=
265
"1.2.840.113549.1.1.10";a["1.2.840.113549.1.1.11"]="sha256WithRSAEncryption";a.sha256WithRSAEncryption="1.2.840.113549.1.1.11";a["1.2.840.113549.1.1.12"]="sha384WithRSAEncryption";a.sha384WithRSAEncryption="1.2.840.113549.1.1.12";a["1.2.840.113549.1.1.13"]="sha512WithRSAEncryption";a.sha512WithRSAEncryption="1.2.840.113549.1.1.13";a["1.3.14.3.2.7"]="desCBC";a.desCBC="1.3.14.3.2.7";a["1.3.14.3.2.26"]="sha1";a.sha1="1.3.14.3.2.26";a["2.16.840.1.101.3.4.2.1"]="sha256";a.sha256="2.16.840.1.101.3.4.2.1";
266
a["2.16.840.1.101.3.4.2.2"]="sha384";a.sha384="2.16.840.1.101.3.4.2.2";a["2.16.840.1.101.3.4.2.3"]="sha512";a.sha512="2.16.840.1.101.3.4.2.3";a["1.2.840.113549.2.5"]="md5";a.md5="1.2.840.113549.2.5";a["1.2.840.113549.1.7.1"]="data";a.data="1.2.840.113549.1.7.1";a["1.2.840.113549.1.7.2"]="signedData";a.signedData="1.2.840.113549.1.7.2";a["1.2.840.113549.1.7.3"]="envelopedData";a.envelopedData="1.2.840.113549.1.7.3";a["1.2.840.113549.1.7.4"]="signedAndEnvelopedData";a.signedAndEnvelopedData="1.2.840.113549.1.7.4";
@@ -274,215 +274,215 @@ a["2.5.4.8"]="stateOrProvinceName";a.stateOrProvinceName="2.5.4.8";a["2.5.4.10"]
274
"subjectAltName";a["2.5.29.8"]="issuerAltName";a["2.5.29.9"]="subjectDirectoryAttributes";a["2.5.29.10"]="basicConstraints";a["2.5.29.11"]="nameConstraints";a["2.5.29.12"]="policyConstraints";a["2.5.29.13"]="basicConstraints";a["2.5.29.14"]="subjectKeyIdentifier";a.subjectKeyIdentifier="2.5.29.14";a["2.5.29.15"]="keyUsage";a.keyUsage="2.5.29.15";a["2.5.29.16"]="privateKeyUsagePeriod";a["2.5.29.17"]="subjectAltName";a.subjectAltName="2.5.29.17";a["2.5.29.18"]="issuerAltName";a.issuerAltName="2.5.29.18";
275
a["2.5.29.19"]="basicConstraints";a.basicConstraints="2.5.29.19";a["2.5.29.20"]="cRLNumber";a["2.5.29.21"]="cRLReason";a["2.5.29.22"]="expirationDate";a["2.5.29.23"]="instructionCode";a["2.5.29.24"]="invalidityDate";a["2.5.29.25"]="cRLDistributionPoints";a["2.5.29.26"]="issuingDistributionPoint";a["2.5.29.27"]="deltaCRLIndicator";a["2.5.29.28"]="issuingDistributionPoint";a["2.5.29.29"]="certificateIssuer";a["2.5.29.30"]="nameConstraints";a["2.5.29.31"]="cRLDistributionPoints";a["2.5.29.32"]="certificatePolicies";
276
a["2.5.29.33"]="policyMappings";a["2.5.29.34"]="policyConstraints";a["2.5.29.35"]="authorityKeyIdentifier";a["2.5.29.36"]="policyConstraints";a["2.5.29.37"]="extKeyUsage";a.extKeyUsage="2.5.29.37";a["2.5.29.46"]="freshestCRL";a["2.5.29.54"]="inhibitAnyPolicy";a["1.3.6.1.5.5.7.3.1"]="serverAuth";a.serverAuth="1.3.6.1.5.5.7.3.1";a["1.3.6.1.5.5.7.3.2"]="clientAuth";a.clientAuth="1.3.6.1.5.5.7.3.2";a["1.3.6.1.5.5.7.3.3"]="codeSigning";a.codeSigning="1.3.6.1.5.5.7.3.3";a["1.3.6.1.5.5.7.3.4"]="emailProtection";
277
-a.emailProtection="1.3.6.1.5.5.7.3.4";a["1.3.6.1.5.5.7.3.8"]="timeStamping";a.timeStamping="1.3.6.1.5.5.7.3.8"}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.oids)return c.oids;c.defined.oids=!0;for(var m=0;m<e.length;++m)e[m](c);return c.oids}},
278
-q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/oids",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1=a.asn1||{};c.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};c.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,
277
+a.emailProtection="1.3.6.1.5.5.7.3.4";a["1.3.6.1.5.5.7.3.8"]="timeStamping";a.timeStamping="1.3.6.1.5.5.7.3.8"}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.oids)return c.oids;c.defined.oids=!0;for(var m=0;m<e.length;++m)e[m](c);return c.oids}},
278
+r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/oids",["require","module"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1=a.asn1||{};c.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};c.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,
279
ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};c.create=function(b,c,d,g){if(a.util.isArray(g)){for(var e=[],h=0;h<g.length;++h)void 0!==g[h]&&e.push(g[h]);g=e}return{tagClass:b,type:c,constructed:d,composed:d||a.util.isArray(g),value:g}};var d=c.getBerValueLength=function(a){var b=a.getByte();if(128!==b)return b&128?a.getInt((b&127)<<3):b};c.fromDer=function(b,e){void 0===e&&(e=!0);
280
-"string"===typeof b&&(b=a.util.createBuffer(b));if(2>b.length()){var k=Error("Too few bytes to parse DER.");k.bytes=b.length();throw k;}var g=b.getByte(),k=g&192,h=g&31,u=d(b);if(b.length()<u){if(e)throw k=Error("Too few bytes to read ASN.1 value."),k.detail=b.length()+" < "+u,k;u=b.length()}var l,x=32===(g&32);l=x;if(!l&&k===c.Class.UNIVERSAL&&h===c.Type.BITSTRING&&1<u){var w=b.read;if(0===b.getByte()&&(g=b.getByte(),g&=192,g===c.Class.UNIVERSAL||g===c.Class.CONTEXT_SPECIFIC))try{if(l=d(b)===u-(b.read-
281
-w))++w,--u}catch(F){}b.read=w}if(l)if(l=[],void 0===u)for(;;){if(b.bytes(2)===String.fromCharCode(0,0)){b.getBytes(2);break}l.push(c.fromDer(b,e))}else for(w=b.length();0<u;)l.push(c.fromDer(b,e)),u-=w-b.length(),w=b.length();else{if(void 0===u){if(e)throw Error("Non-constructed ASN.1 object of indefinite length.");u=b.length()}if(h===c.Type.BMPSTRING)for(l="",w=0;w<u;w+=2)l+=String.fromCharCode(b.getInt16());else l=b.getBytes(u)}return c.create(k,h,x,l)};c.toDer=function(b){var d=a.util.createBuffer(),
280
+"string"===typeof b&&(b=a.util.createBuffer(b));if(2>b.length()){var k=Error("Too few bytes to parse DER.");k.bytes=b.length();throw k;}var g=b.getByte(),k=g&192,h=g&31,u=d(b);if(b.length()<u){if(e)throw k=Error("Too few bytes to read ASN.1 value."),k.detail=b.length()+" < "+u,k;u=b.length()}var l,w=32===(g&32);l=w;if(!l&&k===c.Class.UNIVERSAL&&h===c.Type.BITSTRING&&1<u){var y=b.read;if(0===b.getByte()&&(g=b.getByte(),g&=192,g===c.Class.UNIVERSAL||g===c.Class.CONTEXT_SPECIFIC))try{if(l=d(b)===u-(b.read-
281
+y))++y,--u}catch(E){}b.read=y}if(l)if(l=[],void 0===u)for(;;){if(b.bytes(2)===String.fromCharCode(0,0)){b.getBytes(2);break}l.push(c.fromDer(b,e))}else for(y=b.length();0<u;)l.push(c.fromDer(b,e)),u-=y-b.length(),y=b.length();else{if(void 0===u){if(e)throw Error("Non-constructed ASN.1 object of indefinite length.");u=b.length()}if(h===c.Type.BMPSTRING)for(l="",y=0;y<u;y+=2)l+=String.fromCharCode(b.getInt16());else l=b.getBytes(u)}return c.create(k,h,w,l)};c.toDer=function(b){var d=a.util.createBuffer(),
282
e=b.tagClass|b.type,g=a.util.createBuffer();if(b.composed){b.constructed?e|=32:g.putByte(0);for(var h=0;h<b.value.length;++h)void 0!==b.value[h]&&g.putBuffer(c.toDer(b.value[h]))}else if(b.type===c.Type.BMPSTRING)for(h=0;h<b.value.length;++h)g.putInt16(b.value.charCodeAt(h));else g.putBytes(b.value);d.putByte(e);if(127>=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0<h);d.putByte(b.length|128);for(h=b.length-1;0<=h;--h)d.putByte(b.charCodeAt(h))}d.putBuffer(g);
283
return d};c.oidToDer=function(b){b=b.split(".");var c=a.util.createBuffer();c.putByte(40*parseInt(b[0],10)+parseInt(b[1],10));for(var d,g,e,h,m=2;m<b.length;++m){d=!0;g=[];e=parseInt(b[m],10);do h=e&127,e>>>=7,d||(h|=128),g.push(h),d=!1;while(0<e);for(d=g.length-1;0<=d;--d)c.putByte(g[d])}return c};c.derToOid=function(b){var c;"string"===typeof b&&(b=a.util.createBuffer(b));var d=b.getByte();c=Math.floor(d/40)+"."+d%40;for(var g=0;0<b.length();)d=b.getByte(),g<<=7,d&128?g+=d&127:(c+="."+(g+d),g=0);
284
-return c};c.utcTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,2),10),c=50<=c?1900+c:2E3+c,d=parseInt(a.substr(2,2),10)-1,e=parseInt(a.substr(4,2),10),n=parseInt(a.substr(6,2),10),h=parseInt(a.substr(8,2),10),m=0;if(11<a.length){var w=a.charAt(10),F=10;"+"!==w&&"-"!==w&&(m=parseInt(a.substr(10,2),10),F+=2)}b.setUTCFullYear(c,d,e);b.setUTCHours(n,h,m,0);F&&(w=a.charAt(F),"+"===w||"-"===w)&&(c=parseInt(a.substr(F+1,2),10),a=parseInt(a.substr(F+4,2),10),a=6E4*(60*c+a),"+"===w?b.setTime(+b-
285
-a):b.setTime(+b+a));return b};c.generalizedTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,4),10),d=parseInt(a.substr(4,2),10)-1,e=parseInt(a.substr(6,2),10),n=parseInt(a.substr(8,2),10),h=parseInt(a.substr(10,2),10),m=parseInt(a.substr(12,2),10),w=0,F=0,v=!1;"Z"===a.charAt(a.length-1)&&(v=!0);var D=a.length-5,A=a.charAt(D);if("+"===A||"-"===A)F=parseInt(a.substr(D+1,2),10),D=parseInt(a.substr(D+4,2),10),F=6E4*(60*F+D),"+"===A&&(F*=-1),v=!0;"."===a.charAt(14)&&(w=1E3*parseFloat(a.substr(14),
286
-10));v?(b.setUTCFullYear(c,d,e),b.setUTCHours(n,h,m,w),b.setTime(+b+F)):(b.setFullYear(c,d,e),b.setHours(n,h,m,w));return b};c.dateToUtcTime=function(a){if("string"===typeof a)return a;var b="",c=[];c.push((""+a.getUTCFullYear()).substr(2));c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"===
284
+return c};c.utcTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,2),10),c=50<=c?1900+c:2E3+c,d=parseInt(a.substr(2,2),10)-1,e=parseInt(a.substr(4,2),10),p=parseInt(a.substr(6,2),10),h=parseInt(a.substr(8,2),10),m=0;if(11<a.length){var y=a.charAt(10),E=10;"+"!==y&&"-"!==y&&(m=parseInt(a.substr(10,2),10),E+=2)}b.setUTCFullYear(c,d,e);b.setUTCHours(p,h,m,0);E&&(y=a.charAt(E),"+"===y||"-"===y)&&(c=parseInt(a.substr(E+1,2),10),a=parseInt(a.substr(E+4,2),10),a=6E4*(60*c+a),"+"===y?b.setTime(+b-
285
+a):b.setTime(+b+a));return b};c.generalizedTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,4),10),d=parseInt(a.substr(4,2),10)-1,e=parseInt(a.substr(6,2),10),p=parseInt(a.substr(8,2),10),h=parseInt(a.substr(10,2),10),m=parseInt(a.substr(12,2),10),y=0,E=0,v=!1;"Z"===a.charAt(a.length-1)&&(v=!0);var F=a.length-5,A=a.charAt(F);if("+"===A||"-"===A)E=parseInt(a.substr(F+1,2),10),F=parseInt(a.substr(F+4,2),10),E=6E4*(60*E+F),"+"===A&&(E*=-1),v=!0;"."===a.charAt(14)&&(y=1E3*parseFloat(a.substr(14),
286
+10));v?(b.setUTCFullYear(c,d,e),b.setUTCHours(p,h,m,y),b.setTime(+b+E)):(b.setFullYear(c,d,e),b.setHours(p,h,m,y));return b};c.dateToUtcTime=function(a){if("string"===typeof a)return a;var b="",c=[];c.push((""+a.getUTCFullYear()).substr(2));c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"===
287
typeof a)return a;var b="",c=[];c.push(""+a.getUTCFullYear());c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.integerToDer=function(b){var c=a.util.createBuffer();if(-128<=b&&128>b)return c.putSignedInt(b,8);if(-32768<=b&&32768>b)return c.putSignedInt(b,16);if(-8388608<=b&&8388608>b)return c.putSignedInt(b,24);if(-2147483648<=b&&2147483648>
288
b)return c.putSignedInt(b,32);c=Error("Integer too large; max is 32-bits.");c.integer=b;throw c;};c.derToInteger=function(b){"string"===typeof b&&(b=a.util.createBuffer(b));var c=8*b.length();if(32<c)throw Error("Integer too large; max is 32-bits.");return b.getSignedInt(c)};c.validate=function(b,d,e,g){var h=!1;if(b.tagClass!==d.tagClass&&"undefined"!==typeof d.tagClass||b.type!==d.type&&"undefined"!==typeof d.type)g&&(b.tagClass!==d.tagClass&&g.push("["+d.name+'] Expected tag class "'+d.tagClass+
289
'", got "'+b.tagClass+'"'),b.type!==d.type&&g.push("["+d.name+'] Expected type "'+d.type+'", got "'+b.type+'"'));else if(b.constructed===d.constructed||"undefined"===typeof d.constructed){h=!0;if(d.value&&a.util.isArray(d.value))for(var u=0,v=0;h&&v<d.value.length;++v)h=d.value[v].optional||!1,b.value[u]&&((h=c.validate(b.value[u],d.value[v],e,g))?++u:d.value[v].optional&&(h=!0)),!h&&g&&g.push("["+d.name+'] Tag class "'+d.tagClass+'", type "'+d.type+'" expected value length "'+d.value.length+'", got "'+
290
b.value.length+'"');h&&e&&(d.capture&&(e[d.capture]=b.value),d.captureAsn1&&(e[d.captureAsn1]=b))}else g&&g.push("["+d.name+'] Expected constructed "'+d.constructed+'", got "'+b.constructed+'"');return h};var e=/[^\\u0000-\\u00ff]/;c.prettyPrint=function(b,d,k){var g="";d=d||0;k=k||2;0<d&&(g+="\n");for(var v="",u=0;u<d*k;++u)v+=" ";g+=v+"Tag: ";switch(b.tagClass){case c.Class.UNIVERSAL:g+="Universal:";break;case c.Class.APPLICATION:g+="Application:";break;case c.Class.CONTEXT_SPECIFIC:g+="Context-Specific:";
291
break;case c.Class.PRIVATE:g+="Private:"}if(b.tagClass===c.Class.UNIVERSAL)switch(g+=b.type,b.type){case c.Type.NONE:g+=" (None)";break;case c.Type.BOOLEAN:g+=" (Boolean)";break;case c.Type.BITSTRING:g+=" (Bit string)";break;case c.Type.INTEGER:g+=" (Integer)";break;case c.Type.OCTETSTRING:g+=" (Octet string)";break;case c.Type.NULL:g+=" (Null)";break;case c.Type.OID:g+=" (Object Identifier)";break;case c.Type.ODESC:g+=" (Object Descriptor)";break;case c.Type.EXTERNAL:g+=" (External or Instance of)";
292
break;case c.Type.REAL:g+=" (Real)";break;case c.Type.ENUMERATED:g+=" (Enumerated)";break;case c.Type.EMBEDDED:g+=" (Embedded PDV)";break;case c.Type.UTF8:g+=" (UTF8)";break;case c.Type.ROID:g+=" (Relative Object Identifier)";break;case c.Type.SEQUENCE:g+=" (Sequence)";break;case c.Type.SET:g+=" (Set)";break;case c.Type.PRINTABLESTRING:g+=" (Printable String)";break;case c.Type.IA5String:g+=" (IA5String (ASCII))";break;case c.Type.UTCTIME:g+=" (UTC time)";break;case c.Type.GENERALIZEDTIME:g+=" (Generalized time)";
293
-break;case c.Type.BMPSTRING:g+=" (BMP String)"}else g+=b.type;g=g+"\n"+(v+"Constructed: "+b.constructed+"\n");if(b.composed){for(var l=0,x="",u=0;u<b.value.length;++u)void 0!==b.value[u]&&(l+=1,x+=c.prettyPrint(b.value[u],d+1,k),u+1<b.value.length&&(x+=","));g+=v+"Sub values: "+l+x}else if(g+=v+"Value: ",b.type===c.Type.OID&&(d=c.derToOid(b.value),g+=d,a.pki&&a.pki.oids&&d in a.pki.oids&&(g+=" ("+a.pki.oids[d]+") ")),b.type===c.Type.INTEGER)try{g+=c.derToInteger(b.value)}catch(w){g+="0x"+a.util.bytesToHex(b.value)}else b.type===
294
-c.Type.OCTETSTRING?(e.test(b.value)||(g+="("+b.value+") "),g+="0x"+a.util.bytesToHex(b.value)):g=b.type===c.Type.UTF8?g+a.util.decodeUtf8(b.value):b.type===c.Type.PRINTABLESTRING||b.type===c.Type.IA5String?g+b.value:e.test(b.value)?g+("0x"+a.util.bytesToHex(b.value)):0===b.value.length?g+"[null]":g+b.value;return g}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,
295
-c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.asn1)return c.asn1;c.defined.asn1=!0;for(var m=0;m<e.length;++m)e[m](c);return c.asn1}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/asn1",["require","module","./util","./oids"],function(){p.apply(null,Array.prototype.slice.call(arguments,
296
-0))})})();(function(){function b(a){function c(){l=String.fromCharCode(128);l+=a.util.fillString(String.fromCharCode(0),64);p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9];k=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21];g=Array(64);for(var b=0;64>b;++b)g[b]=Math.floor(4294967296*
297
-Math.abs(Math.sin(b+1)));J=!0}function d(a,b,c){for(var e,n,h,m,A,y,E,v=c.length();64<=v;){n=a.h0;h=a.h1;m=a.h2;A=a.h3;for(E=0;16>E;++E)b[E]=c.getInt32Le(),e=A^h&(m^A),e=n+e+g[E]+b[E],y=k[E],n=A,A=m,m=h,h+=e<<y|e>>>32-y;for(;32>E;++E)e=m^A&(h^m),e=n+e+g[E]+b[p[E]],y=k[E],n=A,A=m,m=h,h+=e<<y|e>>>32-y;for(;48>E;++E)e=h^m^A,e=n+e+g[E]+b[p[E]],y=k[E],n=A,A=m,m=h,h+=e<<y|e>>>32-y;for(;64>E;++E)e=m^(h|~A),e=n+e+g[E]+b[p[E]],y=k[E],n=A,A=m,m=h,h+=e<<y|e>>>32-y;a.h0=a.h0+n|0;a.h1=a.h1+h|0;a.h2=a.h2+m|0;a.h3=
298
-a.h3+A|0;v-=64}}var e=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=e;e.create=function(){J||c();var b=null,g=a.util.createBuffer(),e=Array(16),h={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){h.messageLength=0;h.fullMessageLength=h.messageLength64=[];for(var c=h.messageLengthSize/4,d=0;d<c;++d)h.fullMessageLength.push(0);g=a.util.createBuffer();b={h0:1732584193,h1:4023233417,
293
+break;case c.Type.BMPSTRING:g+=" (BMP String)"}else g+=b.type;g=g+"\n"+(v+"Constructed: "+b.constructed+"\n");if(b.composed){for(var l=0,w="",u=0;u<b.value.length;++u)void 0!==b.value[u]&&(l+=1,w+=c.prettyPrint(b.value[u],d+1,k),u+1<b.value.length&&(w+=","));g+=v+"Sub values: "+l+w}else if(g+=v+"Value: ",b.type===c.Type.OID&&(d=c.derToOid(b.value),g+=d,a.pki&&a.pki.oids&&d in a.pki.oids&&(g+=" ("+a.pki.oids[d]+") ")),b.type===c.Type.INTEGER)try{g+=c.derToInteger(b.value)}catch(y){g+="0x"+a.util.bytesToHex(b.value)}else b.type===
294
+c.Type.OCTETSTRING?(e.test(b.value)||(g+="("+b.value+") "),g+="0x"+a.util.bytesToHex(b.value)):g=b.type===c.Type.UTF8?g+a.util.decodeUtf8(b.value):b.type===c.Type.PRINTABLESTRING||b.type===c.Type.IA5String?g+b.value:e.test(b.value)?g+("0x"+a.util.bytesToHex(b.value)):0===b.value.length?g+"[null]":g+b.value;return g}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,
295
+c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.asn1)return c.asn1;c.defined.asn1=!0;for(var m=0;m<e.length;++m)e[m](c);return c.asn1}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/asn1",["require","module","./util","./oids"],function(){n.apply(null,Array.prototype.slice.call(arguments,
296
+0))})})();(function(){function b(a){function c(){l=String.fromCharCode(128);l+=a.util.fillString(String.fromCharCode(0),64);n=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9];k=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21];g=Array(64);for(var b=0;64>b;++b)g[b]=Math.floor(4294967296*
297
+Math.abs(Math.sin(b+1)));K=!0}function d(a,b,c){for(var e,p,h,m,A,z,D,l=c.length();64<=l;){p=a.h0;h=a.h1;m=a.h2;A=a.h3;for(D=0;16>D;++D)b[D]=c.getInt32Le(),e=A^h&(m^A),e=p+e+g[D]+b[D],z=k[D],p=A,A=m,m=h,h+=e<<z|e>>>32-z;for(;32>D;++D)e=m^A&(h^m),e=p+e+g[D]+b[n[D]],z=k[D],p=A,A=m,m=h,h+=e<<z|e>>>32-z;for(;48>D;++D)e=h^m^A,e=p+e+g[D]+b[n[D]],z=k[D],p=A,A=m,m=h,h+=e<<z|e>>>32-z;for(;64>D;++D)e=m^(h|~A),e=p+e+g[D]+b[n[D]],z=k[D],p=A,A=m,m=h,h+=e<<z|e>>>32-z;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+m|0;a.h3=
298
+a.h3+A|0;l-=64}}var e=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=e;e.create=function(){K||c();var b=null,g=a.util.createBuffer(),e=Array(16),h={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){h.messageLength=0;h.fullMessageLength=h.messageLength64=[];for(var c=h.messageLengthSize/4,d=0;d<c;++d)h.fullMessageLength.push(0);g=a.util.createBuffer();b={h0:1732584193,h1:4023233417,
299
h2:2562383102,h3:271733878};return h}};h.start();h.update=function(c,k){"utf8"===k&&(c=a.util.encodeUtf8(c));var m=c.length;h.messageLength+=m;for(var m=[m/4294967296>>>0,m>>>0],A=h.fullMessageLength.length-1;0<=A;--A)h.fullMessageLength[A]+=m[1],m[1]=m[0]+(h.fullMessageLength[A]/4294967296>>>0),h.fullMessageLength[A]>>>=0,m[0]=m[1]/4294967296>>>0;g.putBytes(c);d(b,e,g);(2048<g.read||0===g.length())&&g.compact();return h};h.digest=function(){var c=a.util.createBuffer();c.putBytes(g.bytes());c.putBytes(l.substr(0,
300
-h.blockLength-(h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1)));for(var k,m=0,A=h.fullMessageLength.length-1;0<=A;--A)k=8*h.fullMessageLength[A]+m,m=k/4294967296>>>0,c.putInt32Le(k>>>0);k={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(k,e,c);c=a.util.createBuffer();c.putInt32Le(k.h0);c.putInt32Le(k.h1);c.putInt32Le(k.h2);c.putInt32Le(k.h3);return c};return h};var l=null,p=null,k=null,g=null,J=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=
301
-!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md5)return c.md5;c.defined.md5=!0;for(var m=0;m<e.length;++m)e[m](c);return c.md5}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,
302
-0))};a("js/md5",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var e,n,h,m,w,l,v,D,A=d.length();64<=A;){n=a.h0;h=a.h1;m=a.h2;w=a.h3;l=a.h4;for(D=0;16>D;++D)e=d.getInt32(),b[D]=e,v=w^h&(m^w),e=(n<<5|n>>>27)+v+l+1518500249+e,l=w,w=m,m=h<<30|h>>>2,h=n,n=e;for(;20>D;++D)e=b[D-3]^b[D-8]^b[D-14]^b[D-16],e=e<<1|e>>>31,b[D]=e,v=w^h&(m^w),e=(n<<5|n>>>27)+v+l+1518500249+e,l=w,w=m,m=h<<30|h>>>2,h=n,n=e;for(;32>
303
-D;++D)e=b[D-3]^b[D-8]^b[D-14]^b[D-16],e=e<<1|e>>>31,b[D]=e,v=h^m^w,e=(n<<5|n>>>27)+v+l+1859775393+e,l=w,w=m,m=h<<30|h>>>2,h=n,n=e;for(;40>D;++D)e=b[D-6]^b[D-16]^b[D-28]^b[D-32],e=e<<2|e>>>30,b[D]=e,v=h^m^w,e=(n<<5|n>>>27)+v+l+1859775393+e,l=w,w=m,m=h<<30|h>>>2,h=n,n=e;for(;60>D;++D)e=b[D-6]^b[D-16]^b[D-28]^b[D-32],e=e<<2|e>>>30,b[D]=e,v=h&m|w&(h^m),e=(n<<5|n>>>27)+v+l+2400959708+e,l=w,w=m,m=h<<30|h>>>2,h=n,n=e;for(;80>D;++D)e=b[D-6]^b[D-16]^b[D-28]^b[D-32],e=e<<2|e>>>30,b[D]=e,v=h^m^w,e=(n<<5|n>>>
304
-27)+v+l+3395469782+e,l=w,w=m,m=h<<30|h>>>2,h=n,n=e;a.h0=a.h0+n|0;a.h1=a.h1+h|0;a.h2=a.h2+m|0;a.h3=a.h3+w|0;a.h4=a.h4+l|0;A-=64}}var d=a.sha1=a.sha1||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha1=a.md.algorithms.sha1=d;d.create=function(){l||(e=String.fromCharCode(128),e+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),g=Array(80),v={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){v.messageLength=
305
-0;v.fullMessageLength=v.messageLength64=[];for(var c=v.messageLengthSize/4,g=0;g<c;++g)v.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520};return v}};v.start();v.update=function(e,h){"utf8"===h&&(e=a.util.encodeUtf8(e));var x=e.length;v.messageLength+=x;for(var x=[x/4294967296>>>0,x>>>0],w=v.fullMessageLength.length-1;0<=w;--w)v.fullMessageLength[w]+=x[1],x[1]=x[0]+(v.fullMessageLength[w]/4294967296>>>0),v.fullMessageLength[w]>>>=
306
-0,x[0]=x[1]/4294967296>>>0;d.putBytes(e);c(b,g,d);(2048<d.read||0===d.length())&&d.compact();return v};v.digest=function(){var u=a.util.createBuffer();u.putBytes(d.bytes());u.putBytes(e.substr(0,v.blockLength-(v.fullMessageLength[v.fullMessageLength.length-1]+v.messageLengthSize&v.blockLength-1)));a.util.createBuffer();for(var l,x,w=8*v.fullMessageLength[0],F=0;F<v.fullMessageLength.length;++F)l=8*v.fullMessageLength[F+1],x=l/4294967296>>>0,w+=x,u.putInt32(w>>>0),w=l;l={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,
307
-h4:b.h4};c(l,g,u);u=a.util.createBuffer();u.putInt32(l.h0);u.putInt32(l.h1);u.putInt32(l.h2);u.putInt32(l.h3);u.putInt32(l.h4);return u};return v};var e=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha1)return c.sha1;c.defined.sha1=
308
-!0;for(var m=0;m<e.length;++m)e[m](c);return c.sha1}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha1",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var e,n,h,m,l,v,D,A,y,E,z,q,r,P=d.length();64<=P;){for(l=0;16>l;++l)b[l]=d.getInt32();
309
-for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,n=b[l-15],n=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,b[l]=e+b[l-7]+n+b[l-16]|0;v=a.h0;D=a.h1;A=a.h2;y=a.h3;E=a.h4;z=a.h5;q=a.h6;r=a.h7;for(l=0;64>l;++l)e=(E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7),h=q^E&(z^q),n=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),m=v&D|A&(v^D),e=r+e+h+p[l]+b[l],n+=m,r=q,q=z,z=E,E=y+e|0,y=A,A=D,D=v,v=e+n|0;a.h0=a.h0+v|0;a.h1=a.h1+D|0;a.h2=a.h2+A|0;a.h3=a.h3+y|0;a.h4=a.h4+E|0;a.h5=a.h5+z|0;a.h6=a.h6+q|0;a.h7=a.h7+r|0;P-=
310
-64}}var d=a.sha256=a.sha256||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha256=a.md.algorithms.sha256=d;d.create=function(){l||(e=String.fromCharCode(128),e+=a.util.fillString(String.fromCharCode(0),64),p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,
300
+h.blockLength-(h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1)));for(var k,m=0,A=h.fullMessageLength.length-1;0<=A;--A)k=8*h.fullMessageLength[A]+m,m=k/4294967296>>>0,c.putInt32Le(k>>>0);k={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(k,e,c);c=a.util.createBuffer();c.putInt32Le(k.h0);c.putInt32Le(k.h1);c.putInt32Le(k.h2);c.putInt32Le(k.h3);return c};return h};var l=null,n=null,k=null,g=null,K=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=
301
+!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md5)return c.md5;c.defined.md5=!0;for(var m=0;m<e.length;++m)e[m](c);return c.md5}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,
302
+0))};a("js/md5",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var e,p,h,m,y,l,v,F,A=d.length();64<=A;){p=a.h0;h=a.h1;m=a.h2;y=a.h3;l=a.h4;for(F=0;16>F;++F)e=d.getInt32(),b[F]=e,v=y^h&(m^y),e=(p<<5|p>>>27)+v+l+1518500249+e,l=y,y=m,m=h<<30|h>>>2,h=p,p=e;for(;20>F;++F)e=b[F-3]^b[F-8]^b[F-14]^b[F-16],e=e<<1|e>>>31,b[F]=e,v=y^h&(m^y),e=(p<<5|p>>>27)+v+l+1518500249+e,l=y,y=m,m=h<<30|h>>>2,h=p,p=e;for(;32>
303
+F;++F)e=b[F-3]^b[F-8]^b[F-14]^b[F-16],e=e<<1|e>>>31,b[F]=e,v=h^m^y,e=(p<<5|p>>>27)+v+l+1859775393+e,l=y,y=m,m=h<<30|h>>>2,h=p,p=e;for(;40>F;++F)e=b[F-6]^b[F-16]^b[F-28]^b[F-32],e=e<<2|e>>>30,b[F]=e,v=h^m^y,e=(p<<5|p>>>27)+v+l+1859775393+e,l=y,y=m,m=h<<30|h>>>2,h=p,p=e;for(;60>F;++F)e=b[F-6]^b[F-16]^b[F-28]^b[F-32],e=e<<2|e>>>30,b[F]=e,v=h&m|y&(h^m),e=(p<<5|p>>>27)+v+l+2400959708+e,l=y,y=m,m=h<<30|h>>>2,h=p,p=e;for(;80>F;++F)e=b[F-6]^b[F-16]^b[F-28]^b[F-32],e=e<<2|e>>>30,b[F]=e,v=h^m^y,e=(p<<5|p>>>
304
+27)+v+l+3395469782+e,l=y,y=m,m=h<<30|h>>>2,h=p,p=e;a.h0=a.h0+p|0;a.h1=a.h1+h|0;a.h2=a.h2+m|0;a.h3=a.h3+y|0;a.h4=a.h4+l|0;A-=64}}var d=a.sha1=a.sha1||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha1=a.md.algorithms.sha1=d;d.create=function(){l||(e=String.fromCharCode(128),e+=a.util.fillString(String.fromCharCode(0),64),l=!0);var b=null,d=a.util.createBuffer(),g=Array(80),v={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){v.messageLength=
305
+0;v.fullMessageLength=v.messageLength64=[];for(var c=v.messageLengthSize/4,g=0;g<c;++g)v.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520};return v}};v.start();v.update=function(e,h){"utf8"===h&&(e=a.util.encodeUtf8(e));var w=e.length;v.messageLength+=w;for(var w=[w/4294967296>>>0,w>>>0],y=v.fullMessageLength.length-1;0<=y;--y)v.fullMessageLength[y]+=w[1],w[1]=w[0]+(v.fullMessageLength[y]/4294967296>>>0),v.fullMessageLength[y]>>>=
306
+0,w[0]=w[1]/4294967296>>>0;d.putBytes(e);c(b,g,d);(2048<d.read||0===d.length())&&d.compact();return v};v.digest=function(){var u=a.util.createBuffer();u.putBytes(d.bytes());u.putBytes(e.substr(0,v.blockLength-(v.fullMessageLength[v.fullMessageLength.length-1]+v.messageLengthSize&v.blockLength-1)));a.util.createBuffer();for(var l,w,y=8*v.fullMessageLength[0],E=0;E<v.fullMessageLength.length;++E)l=8*v.fullMessageLength[E+1],w=l/4294967296>>>0,y+=w,u.putInt32(y>>>0),y=l;l={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,
307
+h4:b.h4};c(l,g,u);u=a.util.createBuffer();u.putInt32(l.h0);u.putInt32(l.h1);u.putInt32(l.h2);u.putInt32(l.h3);u.putInt32(l.h4);return u};return v};var e=null,l=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha1)return c.sha1;c.defined.sha1=
308
+!0;for(var m=0;m<e.length;++m)e[m](c);return c.sha1}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha1",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var e,p,h,m,l,v,F,A,z,D,x,r,q,G=d.length();64<=G;){for(l=0;16>l;++l)b[l]=d.getInt32();
309
+for(;64>l;++l)e=b[l-2],e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10,p=b[l-15],p=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,b[l]=e+b[l-7]+p+b[l-16]|0;v=a.h0;F=a.h1;A=a.h2;z=a.h3;D=a.h4;x=a.h5;r=a.h6;q=a.h7;for(l=0;64>l;++l)e=(D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7),h=r^D&(x^r),p=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),m=v&F|A&(v^F),e=q+e+h+n[l]+b[l],p+=m,q=r,r=x,x=D,D=z+e|0,z=A,A=F,F=v,v=e+p|0;a.h0=a.h0+v|0;a.h1=a.h1+F|0;a.h2=a.h2+A|0;a.h3=a.h3+z|0;a.h4=a.h4+D|0;a.h5=a.h5+x|0;a.h6=a.h6+r|0;a.h7=a.h7+q|0;G-=
310
+64}}var d=a.sha256=a.sha256||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha256=a.md.algorithms.sha256=d;d.create=function(){l||(e=String.fromCharCode(128),e+=a.util.fillString(String.fromCharCode(0),64),n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,
311
2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],l=!0);var b=null,d=a.util.createBuffer(),v=Array(64),u={algorithm:"sha256",blockLength:64,digestLength:32,
312
-messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){u.messageLength=0;u.fullMessageLength=u.messageLength64=[];for(var c=u.messageLengthSize/4,e=0;e<c;++e)u.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225};return u}};u.start();u.update=function(e,h){"utf8"===h&&(e=a.util.encodeUtf8(e));var w=e.length;u.messageLength+=w;for(var w=[w/4294967296>>>0,w>>>0],l=u.fullMessageLength.length-
313
-1;0<=l;--l)u.fullMessageLength[l]+=w[1],w[1]=w[0]+(u.fullMessageLength[l]/4294967296>>>0),u.fullMessageLength[l]>>>=0,w[0]=w[1]/4294967296>>>0;d.putBytes(e);c(b,v,d);(2048<d.read||0===d.length())&&d.compact();return u};u.digest=function(){var l=a.util.createBuffer();l.putBytes(d.bytes());l.putBytes(e.substr(0,u.blockLength-(u.fullMessageLength[u.fullMessageLength.length-1]+u.messageLengthSize&u.blockLength-1)));a.util.createBuffer();for(var x,w,z=8*u.fullMessageLength[0],p=0;p<u.fullMessageLength.length;++p)x=
314
-8*u.fullMessageLength[p+1],w=x/4294967296>>>0,z+=w,l.putInt32(z>>>0),z=x;x={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,h4:b.h4,h5:b.h5,h6:b.h6,h7:b.h7};c(x,v,l);l=a.util.createBuffer();l.putInt32(x.h0);l.putInt32(x.h1);l.putInt32(x.h2);l.putInt32(x.h3);l.putInt32(x.h4);l.putInt32(x.h5);l.putInt32(x.h6);l.putInt32(x.h7);return l};return u};var e=null,l=!1,p=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge=
315
-{}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha256)return c.sha256;c.defined.sha256=!0;for(var m=0;m<e.length;++m)e[m](c);return c.sha256}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha256",["require","module","./util"],function(){p.apply(null,
316
-Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var g,e,n,h,m,A,y,E,l,v,r,z,p,M,ba,q,B,V,Z,aa,ca,Y,N,G,I,X=d.length();128<=X;){for(I=0;16>I;++I)b[I][0]=d.getInt32()>>>0,b[I][1]=d.getInt32()>>>0;for(;80>I;++I)m=b[I-2],l=m[0],m=m[1],g=((l>>>19|m<<13)^(m>>>29|l<<3)^l>>>6)>>>0,e=((l<<13|m>>>19)^(m<<3|l>>>29)^(l<<26|m>>>6))>>>0,m=b[I-15],l=m[0],m=m[1],n=((l>>>1|m<<31)^(l>>>8|m<<24)^l>>>7)>>>0,h=((l<<31|m>>>1)^(l<<24|m>>>8)^(l<<25|m>>>7))>>>0,l=b[I-7],v=b[I-
317
-16],m=e+l[1]+h+v[1],b[I][0]=g+l[0]+n+v[0]+(m/4294967296>>>0)>>>0,b[I][1]=m>>>0;l=a[0][0];v=a[0][1];r=a[1][0];z=a[1][1];p=a[2][0];M=a[2][1];ba=a[3][0];q=a[3][1];B=a[4][0];V=a[4][1];Z=a[5][0];aa=a[5][1];ca=a[6][0];Y=a[6][1];N=a[7][0];G=a[7][1];for(I=0;80>I;++I)g=((B>>>14|V<<18)^(B>>>18|V<<14)^(V>>>9|B<<23))>>>0,m=((B<<18|V>>>14)^(B<<14|V>>>18)^(V<<23|B>>>9))>>>0,e=(ca^B&(Z^ca))>>>0,A=(Y^V&(aa^Y))>>>0,n=((l>>>28|v<<4)^(v>>>2|l<<30)^(v>>>7|l<<25))>>>0,h=((l<<4|v>>>28)^(v<<30|l>>>2)^(v<<25|l>>>7))>>>0,
318
-y=(l&r|p&(l^r))>>>0,E=(v&z|M&(v^z))>>>0,m=G+m+A+k[I][1]+b[I][1],g=N+g+e+k[I][0]+b[I][0]+(m/4294967296>>>0)>>>0,e=m>>>0,m=h+E,n=n+y+(m/4294967296>>>0)>>>0,h=m>>>0,N=ca,G=Y,ca=Z,Y=aa,Z=B,aa=V,m=q+e,B=ba+g+(m/4294967296>>>0)>>>0,V=m>>>0,ba=p,q=M,p=r,M=z,r=l,z=v,m=e+h,l=g+n+(m/4294967296>>>0)>>>0,v=m>>>0;m=a[0][1]+v;a[0][0]=a[0][0]+l+(m/4294967296>>>0)>>>0;a[0][1]=m>>>0;m=a[1][1]+z;a[1][0]=a[1][0]+r+(m/4294967296>>>0)>>>0;a[1][1]=m>>>0;m=a[2][1]+M;a[2][0]=a[2][0]+p+(m/4294967296>>>0)>>>0;a[2][1]=m>>>
319
-0;m=a[3][1]+q;a[3][0]=a[3][0]+ba+(m/4294967296>>>0)>>>0;a[3][1]=m>>>0;m=a[4][1]+V;a[4][0]=a[4][0]+B+(m/4294967296>>>0)>>>0;a[4][1]=m>>>0;m=a[5][1]+aa;a[5][0]=a[5][0]+Z+(m/4294967296>>>0)>>>0;a[5][1]=m>>>0;m=a[6][1]+Y;a[6][0]=a[6][0]+ca+(m/4294967296>>>0)>>>0;a[6][1]=m>>>0;m=a[7][1]+G;a[7][0]=a[7][0]+N+(m/4294967296>>>0)>>>0;a[7][1]=m>>>0;X-=128}}var d=a.sha512=a.sha512||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha512=a.md.algorithms.sha512=d;var e=a.sha384=a.sha512.sha384=a.sha512.sha384||
320
-{};e.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=e;a.sha512.sha256=a.sha512.sha256||{create:function(){return d.create("SHA-512/256")}};a.md["sha512/256"]=a.md.algorithms["sha512/256"]=a.sha512.sha256;a.sha512.sha224=a.sha512.sha224||{create:function(){return d.create("SHA-512/224")}};a.md["sha512/224"]=a.md.algorithms["sha512/224"]=a.sha512.sha224;d.create=function(b){p||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),k=[[1116352408,
312
+messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){u.messageLength=0;u.fullMessageLength=u.messageLength64=[];for(var c=u.messageLengthSize/4,e=0;e<c;++e)u.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225};return u}};u.start();u.update=function(e,h){"utf8"===h&&(e=a.util.encodeUtf8(e));var l=e.length;u.messageLength+=l;for(var l=[l/4294967296>>>0,l>>>0],E=u.fullMessageLength.length-
313
+1;0<=E;--E)u.fullMessageLength[E]+=l[1],l[1]=l[0]+(u.fullMessageLength[E]/4294967296>>>0),u.fullMessageLength[E]>>>=0,l[0]=l[1]/4294967296>>>0;d.putBytes(e);c(b,v,d);(2048<d.read||0===d.length())&&d.compact();return u};u.digest=function(){var l=a.util.createBuffer();l.putBytes(d.bytes());l.putBytes(e.substr(0,u.blockLength-(u.fullMessageLength[u.fullMessageLength.length-1]+u.messageLengthSize&u.blockLength-1)));a.util.createBuffer();for(var w,y,E=8*u.fullMessageLength[0],x=0;x<u.fullMessageLength.length;++x)w=
314
+8*u.fullMessageLength[x+1],y=w/4294967296>>>0,E+=y,l.putInt32(E>>>0),E=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,h4:b.h4,h5:b.h5,h6:b.h6,h7:b.h7};c(w,v,l);l=a.util.createBuffer();l.putInt32(w.h0);l.putInt32(w.h1);l.putInt32(w.h2);l.putInt32(w.h3);l.putInt32(w.h4);l.putInt32(w.h5);l.putInt32(w.h6);l.putInt32(w.h7);return l};return u};var e=null,l=!1,n=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge=
315
+{}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha256)return c.sha256;c.defined.sha256=!0;for(var m=0;m<e.length;++m)e[m](c);return c.sha256}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha256",["require","module","./util"],function(){n.apply(null,
316
+Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var g,e,p,h,m,A,z,D,l,v,q,x,n,T,ba,P,r,B,Z,aa,O,Y,N,H,J,X=d.length();128<=X;){for(J=0;16>J;++J)b[J][0]=d.getInt32()>>>0,b[J][1]=d.getInt32()>>>0;for(;80>J;++J)m=b[J-2],l=m[0],m=m[1],g=((l>>>19|m<<13)^(m>>>29|l<<3)^l>>>6)>>>0,e=((l<<13|m>>>19)^(m<<3|l>>>29)^(l<<26|m>>>6))>>>0,m=b[J-15],l=m[0],m=m[1],p=((l>>>1|m<<31)^(l>>>8|m<<24)^l>>>7)>>>0,h=((l<<31|m>>>1)^(l<<24|m>>>8)^(l<<25|m>>>7))>>>0,l=b[J-7],v=b[J-
317
+16],m=e+l[1]+h+v[1],b[J][0]=g+l[0]+p+v[0]+(m/4294967296>>>0)>>>0,b[J][1]=m>>>0;l=a[0][0];v=a[0][1];q=a[1][0];x=a[1][1];n=a[2][0];T=a[2][1];ba=a[3][0];P=a[3][1];r=a[4][0];B=a[4][1];Z=a[5][0];aa=a[5][1];O=a[6][0];Y=a[6][1];N=a[7][0];H=a[7][1];for(J=0;80>J;++J)g=((r>>>14|B<<18)^(r>>>18|B<<14)^(B>>>9|r<<23))>>>0,m=((r<<18|B>>>14)^(r<<14|B>>>18)^(B<<23|r>>>9))>>>0,e=(O^r&(Z^O))>>>0,A=(Y^B&(aa^Y))>>>0,p=((l>>>28|v<<4)^(v>>>2|l<<30)^(v>>>7|l<<25))>>>0,h=((l<<4|v>>>28)^(v<<30|l>>>2)^(v<<25|l>>>7))>>>0,z=
318
+(l&q|n&(l^q))>>>0,D=(v&x|T&(v^x))>>>0,m=H+m+A+k[J][1]+b[J][1],g=N+g+e+k[J][0]+b[J][0]+(m/4294967296>>>0)>>>0,e=m>>>0,m=h+D,p=p+z+(m/4294967296>>>0)>>>0,h=m>>>0,N=O,H=Y,O=Z,Y=aa,Z=r,aa=B,m=P+e,r=ba+g+(m/4294967296>>>0)>>>0,B=m>>>0,ba=n,P=T,n=q,T=x,q=l,x=v,m=e+h,l=g+p+(m/4294967296>>>0)>>>0,v=m>>>0;m=a[0][1]+v;a[0][0]=a[0][0]+l+(m/4294967296>>>0)>>>0;a[0][1]=m>>>0;m=a[1][1]+x;a[1][0]=a[1][0]+q+(m/4294967296>>>0)>>>0;a[1][1]=m>>>0;m=a[2][1]+T;a[2][0]=a[2][0]+n+(m/4294967296>>>0)>>>0;a[2][1]=m>>>0;m=
319
+a[3][1]+P;a[3][0]=a[3][0]+ba+(m/4294967296>>>0)>>>0;a[3][1]=m>>>0;m=a[4][1]+B;a[4][0]=a[4][0]+r+(m/4294967296>>>0)>>>0;a[4][1]=m>>>0;m=a[5][1]+aa;a[5][0]=a[5][0]+Z+(m/4294967296>>>0)>>>0;a[5][1]=m>>>0;m=a[6][1]+Y;a[6][0]=a[6][0]+O+(m/4294967296>>>0)>>>0;a[6][1]=m>>>0;m=a[7][1]+H;a[7][0]=a[7][0]+N+(m/4294967296>>>0)>>>0;a[7][1]=m>>>0;X-=128}}var d=a.sha512=a.sha512||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha512=a.md.algorithms.sha512=d;var e=a.sha384=a.sha512.sha384=a.sha512.sha384||
320
+{};e.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=e;a.sha512.sha256=a.sha512.sha256||{create:function(){return d.create("SHA-512/256")}};a.md["sha512/256"]=a.md.algorithms["sha512/256"]=a.sha512.sha256;a.sha512.sha224=a.sha512.sha224||{create:function(){return d.create("SHA-512/224")}};a.md["sha512/224"]=a.md.algorithms["sha512/224"]=a.sha512.sha224;d.create=function(b){n||(l=String.fromCharCode(128),l+=a.util.fillString(String.fromCharCode(0),128),k=[[1116352408,
321
3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],
322
[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,
323
106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],
324
[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],g={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],
325
[528734635,4215389547],[1541459225,327033209]],"SHA-384":[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],"SHA-512/256":[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],"SHA-512/224":[[2352822216,424955298],[1944164710,
326
-2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]]},p=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in g))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=g[b],e=null,h=a.util.createBuffer(),v=Array(80),F=0;80>F;++F)v[F]=Array(2);var q={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){q.messageLength=
327
-0;q.fullMessageLength=q.messageLength128=[];for(var b=q.messageLengthSize/4,c=0;c<b;++c)q.fullMessageLength.push(0);h=a.util.createBuffer();e=Array(d.length);for(c=0;c<d.length;++c)e[c]=d[c].slice(0);return q}};q.start();q.update=function(b,d){"utf8"===d&&(b=a.util.encodeUtf8(b));var g=b.length;q.messageLength+=g;for(var g=[g/4294967296>>>0,g>>>0],k=q.fullMessageLength.length-1;0<=k;--k)q.fullMessageLength[k]+=g[1],g[1]=g[0]+(q.fullMessageLength[k]/4294967296>>>0),q.fullMessageLength[k]>>>=0,g[0]=
328
-g[1]/4294967296>>>0;h.putBytes(b);c(e,v,h);(2048<h.read||0===h.length())&&h.compact();return q};q.digest=function(){var d=a.util.createBuffer();d.putBytes(h.bytes());d.putBytes(l.substr(0,q.blockLength-(q.fullMessageLength[q.fullMessageLength.length-1]+q.messageLengthSize&q.blockLength-1)));a.util.createBuffer();for(var g,y,k=8*q.fullMessageLength[0],u=0;u<q.fullMessageLength.length;++u)g=8*q.fullMessageLength[u+1],y=g/4294967296>>>0,k+=y,d.putInt32(k>>>0),k=g;g=Array(e.length);for(u=0;u<e.length;++u)g[u]=
329
-e[u].slice(0);c(g,v,d);d=a.util.createBuffer();y="SHA-512"===b?g.length:"SHA-384"===b?g.length-2:g.length-4;for(u=0;u<y;++u)d.putInt32(g[u][0]),u===y-1&&"SHA-512/224"===b||d.putInt32(g[u][1]);return d};return q};var l=null,p=!1,k=null,g=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);
330
-c=c||{};c.defined=c.defined||{};if(c.defined.sha512)return c.sha512;c.defined.sha512=!0;for(var m=0;m<e.length;++m)e[m](c);return c.sha512}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha512",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.md=a.md||{};
331
-a.md.algorithms={md5:a.md5,sha1:a.sha1,sha256:a.sha256};a.md.md5=a.md5;a.md.sha1=a.sha1;a.md.sha256=a.sha256}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md)return c.md;c.defined.md=!0;for(var m=0;m<e.length;++m)e[m](c);return c.md}},q=a;a=function(b,
332
-c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/md","require module ./md5 ./sha1 ./sha256 ./sha512".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.hmac=a.hmac||{}).create=function(){var b=null,c=null,d=null,e={start:function(e,k){if(null!==e)if("string"===typeof e)if(e=e.toLowerCase(),e in a.md.algorithms)b=
326
+2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]]},n=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in g))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=g[b],e=null,h=a.util.createBuffer(),v=Array(80),E=0;80>E;++E)v[E]=Array(2);var r={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){r.messageLength=
327
+0;r.fullMessageLength=r.messageLength128=[];for(var b=r.messageLengthSize/4,c=0;c<b;++c)r.fullMessageLength.push(0);h=a.util.createBuffer();e=Array(d.length);for(c=0;c<d.length;++c)e[c]=d[c].slice(0);return r}};r.start();r.update=function(b,d){"utf8"===d&&(b=a.util.encodeUtf8(b));var g=b.length;r.messageLength+=g;for(var g=[g/4294967296>>>0,g>>>0],k=r.fullMessageLength.length-1;0<=k;--k)r.fullMessageLength[k]+=g[1],g[1]=g[0]+(r.fullMessageLength[k]/4294967296>>>0),r.fullMessageLength[k]>>>=0,g[0]=
328
+g[1]/4294967296>>>0;h.putBytes(b);c(e,v,h);(2048<h.read||0===h.length())&&h.compact();return r};r.digest=function(){var d=a.util.createBuffer();d.putBytes(h.bytes());d.putBytes(l.substr(0,r.blockLength-(r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize&r.blockLength-1)));a.util.createBuffer();for(var g,z,k=8*r.fullMessageLength[0],u=0;u<r.fullMessageLength.length;++u)g=8*r.fullMessageLength[u+1],z=g/4294967296>>>0,k+=z,d.putInt32(k>>>0),k=g;g=Array(e.length);for(u=0;u<e.length;++u)g[u]=
329
+e[u].slice(0);c(g,v,d);d=a.util.createBuffer();z="SHA-512"===b?g.length:"SHA-384"===b?g.length-2:g.length-4;for(u=0;u<z;++u)d.putInt32(g[u][0]),u===z-1&&"SHA-512/224"===b||d.putInt32(g[u][1]);return d};return r};var l=null,n=!1,k=null,g=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);
330
+c=c||{};c.defined=c.defined||{};if(c.defined.sha512)return c.sha512;c.defined.sha512=!0;for(var m=0;m<e.length;++m)e[m](c);return c.sha512}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha512",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.md=a.md||{};
331
+a.md.algorithms={md5:a.md5,sha1:a.sha1,sha256:a.sha256};a.md.md5=a.md5;a.md.sha1=a.sha1;a.md.sha256=a.sha256}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md)return c.md;c.defined.md=!0;for(var m=0;m<e.length;++m)e[m](c);return c.md}},r=a;a=function(b,
332
+c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/md","require module ./md5 ./sha1 ./sha256 ./sha512".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.hmac=a.hmac||{}).create=function(){var b=null,c=null,d=null,e={start:function(e,k){if(null!==e)if("string"===typeof e)if(e=e.toLowerCase(),e in a.md.algorithms)b=
333
a.md.algorithms[e].create();else throw Error('Unknown hash algorithm "'+e+'"');else b=e;if(null!==k){if("string"===typeof k)k=a.util.createBuffer(k);else if(a.util.isArray(k)){var g=k;k=a.util.createBuffer();for(var l=0;l<g.length;++l)k.putByte(g[l])}var u=k.length();u>b.blockLength&&(b.start(),b.update(k.bytes()),k=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();u=k.length();for(l=0;l<u;++l)g=k.at(l),c.putByte(54^g),d.putByte(92^g);if(u<b.blockLength)for(g=b.blockLength-u,l=0;l<g;++l)c.putByte(54),
334
-d.putByte(92);c=c.bytes();d=d.bytes()}b.start();b.update(c)},update:function(a){b.update(a)},getMac:function(){var a=b.digest().bytes();b.start();b.update(d);b.update(a);return b.digest()}};e.digest=e.getMac;return e}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
335
-{};if(c.defined.hmac)return c.hmac;c.defined.hmac=!0;for(var m=0;m<e.length;++m)e[m](c);return c.hmac}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/hmac",["require","module","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a){for(var b=a.name+": ",d=[],e=function(a,
334
+d.putByte(92);c=c.bytes();d=d.bytes()}b.start();b.update(c)},update:function(a){b.update(a)},getMac:function(){var a=b.digest().bytes();b.start();b.update(d);b.update(a);return b.digest()}};e.digest=e.getMac;return e}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
335
+{};if(c.defined.hmac)return c.hmac;c.defined.hmac=!0;for(var m=0;m<e.length;++m)e[m](c);return c.hmac}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/hmac",["require","module","./md","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a){for(var b=a.name+": ",d=[],e=function(a,
336
b){return" "+b},g=0;g<a.values.length;++g)d.push(a.values[g].replace(/^(\S+\r\n)/,e));b+=d.join(",")+"\r\n";d=0;a=-1;for(g=0;g<b.length;++g,++d)if(65<d&&-1!==a)d=b[a],","===d?(++a,b=b.substr(0,a)+"\r\n "+b.substr(a)):b=b.substr(0,a)+"\r\n"+d+b.substr(a+1),d=g-a-1,a=-1,++g;else if(" "===b[g]||"\t"===b[g]||","===b[g])a=g;return b}var d=a.pem=a.pem||{};d.encode=function(b,d){d=d||{};var e="-----BEGIN "+b.type+"-----\r\n",k;b.procType&&(k={name:"Proc-Type",values:[String(b.procType.version),b.procType.type]},
337
e+=c(k));b.contentDomain&&(k={name:"Content-Domain",values:[b.contentDomain]},e+=c(k));b.dekInfo&&(k={name:"DEK-Info",values:[b.dekInfo.algorithm]},b.dekInfo.parameters&&k.values.push(b.dekInfo.parameters),e+=c(k));if(b.headers)for(k=0;k<b.headers.length;++k)e+=c(b.headers[k]);b.procType&&(e+="\r\n");e+=a.util.encode64(b.body,d.maxline||64)+"\r\n";return e+="-----END "+b.type+"-----\r\n"};d.decode=function(b){for(var c=[],d=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,
338
-e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,m;;){m=d.exec(b);if(!m)break;var u={type:m[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(m[3])};c.push(u);if(m[2]){for(var l=m[2].split(g),x=0;m&&x<l.length;){m=l[x].replace(/\s+$/,"");for(var w=x+1;w<l.length;++w){var v=l[w];if(!/\s/.test(v[0]))break;m+=v;x=w}if(m=m.match(e)){for(var w={name:m[1],values:[]},v=m[2].split(","),p=0;p<v.length;++p)w.values.push(v[p].replace(/^\s+/,""));if(u.procType)if(u.contentDomain||
339
-"Content-Domain"!==w.name)if(u.dekInfo||"DEK-Info"!==w.name)u.headers.push(w);else{if(0===w.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:v[0],parameters:v[1]||null}}else u.contentDomain=v[0]||"";else{if("Proc-Type"!==w.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==w.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');
340
-u.procType={version:v[0],type:v[1]}}}++x}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".');}}if(0===c.length)throw Error("Invalid PEM formatted message.");return c}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);
341
-c=c||{};c.defined=c.defined||{};if(c.defined.pem)return c.pem;c.defined.pem=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pem}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pem",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d){a.cipher.registerAlgorithm(b,
342
-function(){return new a.des.Algorithm(b,d)})}function d(a,b,c,e){var n=32===a.length?3:9;e=3===n?e?[30,-2,-2]:[0,32,2]:e?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=b[0],h=b[1];b=(y>>>4^h)&252645135;h^=b;y^=b<<4;b=(y>>>16^h)&65535;h^=b;y^=b<<16;b=(h>>>2^y)&858993459;y^=b;h^=b<<2;b=(h>>>8^y)&16711935;y^=b;h^=b<<8;b=(y>>>1^h)&1431655765;for(var h=h^b,y=y^b<<1,y=y<<1|y>>>31,h=h<<1|h>>>31,m=0;m<n;m+=3){for(var v=e[m+1],r=e[m+2],P=e[m];P!=v;P+=r){var T=h^a[P],M=(h>>>4|h<<28)^a[P+1];b=y;
343
-y=h;h=b^(p[T>>>24&63]|g[T>>>16&63]|u[T>>>8&63]|x[T&63]|l[M>>>24&63]|k[M>>>16&63]|q[M>>>8&63]|C[M&63])}b=y;y=h;h=b}y=y>>>1|y<<31;h=h>>>1|h<<31;b=(y>>>1^h)&1431655765;h^=b;y^=b<<1;b=(h>>>8^y)&16711935;y^=b;h^=b<<8;b=(h>>>2^y)&858993459;y^=b;h^=b<<2;b=(y>>>16^h)&65535;h^=b;y^=b<<16;b=(y>>>4^h)&252645135;c[0]=y^b<<4;c[1]=h^b}function e(b){b=b||{};var c="DES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):a.cipher.createCipher(c,b.key);var g=d.start;d.start=function(b,c){var e=
338
+e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,m;;){m=d.exec(b);if(!m)break;var u={type:m[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(m[3])};c.push(u);if(m[2]){for(var l=m[2].split(g),w=0;m&&w<l.length;){m=l[w].replace(/\s+$/,"");for(var y=w+1;y<l.length;++y){var v=l[y];if(!/\s/.test(v[0]))break;m+=v;w=y}if(m=m.match(e)){for(var y={name:m[1],values:[]},v=m[2].split(","),n=0;n<v.length;++n)y.values.push(v[n].replace(/^\s+/,""));if(u.procType)if(u.contentDomain||
339
+"Content-Domain"!==y.name)if(u.dekInfo||"DEK-Info"!==y.name)u.headers.push(y);else{if(0===y.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:v[0],parameters:v[1]||null}}else u.contentDomain=v[0]||"";else{if("Proc-Type"!==y.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');
340
+u.procType={version:v[0],type:v[1]}}}++w}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".');}}if(0===c.length)throw Error("Invalid PEM formatted message.");return c}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);
341
+c=c||{};c.defined=c.defined||{};if(c.defined.pem)return c.pem;c.defined.pem=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pem}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pem",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d){a.cipher.registerAlgorithm(b,
342
+function(){return new a.des.Algorithm(b,d)})}function d(a,b,c,e){var p=32===a.length?3:9;e=3===p?e?[30,-2,-2]:[0,32,2]:e?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var z=b[0],h=b[1];b=(z>>>4^h)&252645135;h^=b;z^=b<<4;b=(z>>>16^h)&65535;h^=b;z^=b<<16;b=(h>>>2^z)&858993459;z^=b;h^=b<<2;b=(h>>>8^z)&16711935;z^=b;h^=b<<8;b=(z>>>1^h)&1431655765;for(var h=h^b,z=z^b<<1,z=z<<1|z>>>31,h=h<<1|h>>>31,m=0;m<p;m+=3){for(var v=e[m+1],q=e[m+2],G=e[m];G!=v;G+=q){var V=h^a[G],T=(h>>>4|h<<28)^a[G+1];b=z;
343
+z=h;h=b^(n[V>>>24&63]|g[V>>>16&63]|u[V>>>8&63]|w[V&63]|l[T>>>24&63]|k[T>>>16&63]|r[T>>>8&63]|C[T&63])}b=z;z=h;h=b}z=z>>>1|z<<31;h=h>>>1|h<<31;b=(z>>>1^h)&1431655765;h^=b;z^=b<<1;b=(h>>>8^z)&16711935;z^=b;h^=b<<8;b=(h>>>2^z)&858993459;z^=b;h^=b<<2;b=(z>>>16^h)&65535;h^=b;z^=b<<16;b=(z>>>4^h)&252645135;c[0]=z^b<<4;c[1]=h^b}function e(b){b=b||{};var c="DES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):a.cipher.createCipher(c,b.key);var g=d.start;d.start=function(b,c){var e=
344
null;c instanceof a.util.ByteBuffer&&(e=c,c={});c=c||{};c.output=e;c.iv=b;g.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=e({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return e({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=e({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return e({key:a,
345
output:null,decrypt:!0,mode:b})};a.des.Algorithm=function(a,b){var c=this;c.name=a;c.mode=new b({blockSize:8,cipher:{encrypt:function(a,b){return d(c._keys,a,b,!1)},decrypt:function(a,b){return d(c._keys,a,b,!0)}}});c._init=!1};a.des.Algorithm.prototype.initialize=function(b){if(!this._init){b=a.util.createBuffer(b.key);if(0===this.name.indexOf("3DES")&&24!==b.length())throw Error("Invalid Triple-DES key size: "+8*b.length());for(var c=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,
346
516,536871424,536871428,66048,66052,536936960,536936964],d=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],e=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],g=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],h=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],
347
-m=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],r=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,
348
-8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],x=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],M=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],v=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],p=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],z=8<b.length()?3:
349
-1,q=[],J=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],B=0,C,Y=0;Y<z;Y++){var N=b.getInt32(),G=b.getInt32();C=(N>>>4^G)&252645135;G^=C;N^=C<<4;C=(G>>>-16^N)&65535;N^=C;G^=C<<-16;C=(N>>>2^G)&858993459;G^=C;N^=C<<2;C=(G>>>-16^N)&65535;N^=C;G^=C<<-16;C=(N>>>1^G)&1431655765;G^=C;N^=C<<1;C=(G>>>8^N)&16711935;N^=C;G^=C<<8;C=(N>>>1^G)&1431655765;G^=C;N^=C<<1;C=N<<8|G>>>20&240;for(var N=G<<24|G<<8&16711680|G>>>8&65280|G>>>24&240,G=C,I=0;I<J.length;++I){J[I]?(N=N<<2|N>>>26,G=G<<2|G>>>26):(N=N<<1|N>>>27,G=G<<1|G>>>27);
350
-var N=N&-15,G=G&-15,X=c[N>>>28]|d[N>>>24&15]|e[N>>>20&15]|g[N>>>16&15]|h[N>>>12&15]|m[N>>>8&15]|k[N>>>4&15],da=u[G>>>28]|r[G>>>24&15]|l[G>>>20&15]|x[G>>>16&15]|M[G>>>12&15]|v[G>>>8&15]|p[G>>>4&15];C=(da>>>16^X)&65535;q[B++]=X^C;q[B++]=da^C<<16}}this._keys=q;this._init=!0}};c("DES-ECB",a.cipher.modes.ecb);c("DES-CBC",a.cipher.modes.cbc);c("DES-CFB",a.cipher.modes.cfb);c("DES-OFB",a.cipher.modes.ofb);c("DES-CTR",a.cipher.modes.ctr);c("3DES-ECB",a.cipher.modes.ecb);c("3DES-CBC",a.cipher.modes.cbc);c("3DES-CFB",
347
+m=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],q=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,
348
+8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],w=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],v=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],n=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],r=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],x=8<b.length()?3:
349
+1,K=[],B=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],C=0,O,Y=0;Y<x;Y++){var N=b.getInt32(),H=b.getInt32();O=(N>>>4^H)&252645135;H^=O;N^=O<<4;O=(H>>>-16^N)&65535;N^=O;H^=O<<-16;O=(N>>>2^H)&858993459;H^=O;N^=O<<2;O=(H>>>-16^N)&65535;N^=O;H^=O<<-16;O=(N>>>1^H)&1431655765;H^=O;N^=O<<1;O=(H>>>8^N)&16711935;N^=O;H^=O<<8;O=(N>>>1^H)&1431655765;H^=O;N^=O<<1;O=N<<8|H>>>20&240;for(var N=H<<24|H<<8&16711680|H>>>8&65280|H>>>24&240,H=O,J=0;J<B.length;++J){B[J]?(N=N<<2|N>>>26,H=H<<2|H>>>26):(N=N<<1|N>>>27,H=H<<1|H>>>27);
350
+var N=N&-15,H=H&-15,X=c[N>>>28]|d[N>>>24&15]|e[N>>>20&15]|g[N>>>16&15]|h[N>>>12&15]|m[N>>>8&15]|k[N>>>4&15],da=u[H>>>28]|q[H>>>24&15]|l[H>>>20&15]|w[H>>>16&15]|v[H>>>12&15]|n[H>>>8&15]|r[H>>>4&15];O=(da>>>16^X)&65535;K[C++]=X^O;K[C++]=da^O<<16}}this._keys=K;this._init=!0}};c("DES-ECB",a.cipher.modes.ecb);c("DES-CBC",a.cipher.modes.cbc);c("DES-CFB",a.cipher.modes.cfb);c("DES-OFB",a.cipher.modes.ofb);c("DES-CTR",a.cipher.modes.ctr);c("3DES-ECB",a.cipher.modes.ecb);c("3DES-CBC",a.cipher.modes.cbc);c("3DES-CFB",
351
a.cipher.modes.cfb);c("3DES-OFB",a.cipher.modes.ofb);c("3DES-CTR",a.cipher.modes.ctr);var l=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,
352
-0,65540,66560,0,16842756],p=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,
352
+0,65540,66560,0,16842756],n=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,
353
-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],k=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,
354
-8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],g=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],q=[256,34078976,34078720,1107296512,
354
+8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],g=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],r=[256,34078976,34078720,1107296512,
355
524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,
356
524288,0,1074266112,34078976,1073742080],u=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,
357
4194320,536887312,0,541081600,536870912,4194320,536887312],C=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,
358
-67108866,67110912,2048,2097154],x=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,
359
-268435456,268701696]}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.des)return c.des;c.defined.des=!0;for(var m=0;m<e.length;++m)e[m](c);return c.des}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,
360
-Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/des",["require","module","./cipher","./cipherModes","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var d=a.pkcs5=a.pkcs5||{},e="undefined"!==typeof process&&process.versions&&process.versions.node,h;e&&!a.disableNativeCode&&(h=c("crypto"));a.pbkdf2=d.pbkdf2=function(b,c,d,g,m,u){function l(){if(U>p)return u(null,A);D.start(null,
361
-null);D.update(c);D.update(a.util.int32ToBytes(U));y=L=D.digest().getBytes();r=2;x()}function x(){if(r<=d)return D.start(null,null),D.update(L),E=D.digest().getBytes(),y=a.util.xorBytes(y,E,w),L=E,++r,a.util.setImmediate(x);A+=U<p?y:y.substr(0,q);++U;l()}"function"===typeof m&&(u=m,m=null);if(e&&!a.disableNativeCode&&h.pbkdf2&&(null===m||"object"!==typeof m)&&(4<h.pbkdf2Sync.length||!m||"sha1"===m))return"string"!==typeof m&&(m="sha1"),c=new Buffer(c,"binary"),u?4===h.pbkdf2Sync.length?h.pbkdf2(b,
362
-c,d,g,function(a,b){if(a)return u(a);u(null,b.toString("binary"))}):h.pbkdf2(b,c,d,g,m,function(a,b){if(a)return u(a);u(null,b.toString("binary"))}):4===h.pbkdf2Sync.length?h.pbkdf2Sync(b,c,d,g).toString("binary"):h.pbkdf2Sync(b,c,d,g,m).toString("binary");if("undefined"===typeof m||null===m)m=a.md.sha1.create();if("string"===typeof m){if(!(m in a.md.algorithms))throw Error("Unknown hash algorithm: "+m);m=a.md[m].create()}var w=m.digestLength;if(g>4294967295*w){b=Error("Derived key is too long.");
363
-if(u)return u(b);throw b;}var p=Math.ceil(g/w),q=g-(p-1)*w,D=a.hmac.create();D.start(m,b);var A="",y,E,L;if(!u){for(var U=1;U<=p;++U){D.start(null,null);D.update(c);D.update(a.util.int32ToBytes(U));y=L=D.digest().getBytes();for(var r=2;r<=d;++r)D.start(null,null),D.update(L),E=D.digest().getBytes(),y=a.util.xorBytes(y,E,w),L=E;A+=U<p?y:y.substr(0,q)}return A}U=1;l()}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
364
-typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pbkdf2)return c.pbkdf2;c.defined.pbkdf2=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pbkdf2}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbkdf2",["require","module",
365
-"./hmac","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var d="undefined"!==typeof process&&process.versions&&process.versions.node,e=null;a.disableNativeCode||!d||process.versions["node-webkit"]||(e=c("crypto"));(a.prng=a.prng||{}).create=function(b){function c(a){if(32<=g.pools[0].messageLength)return d(),a();g.seedFile(32-g.pools[0].messageLength<<5,function(b,c){if(b)return a(b);g.collect(c);d();a()})}function d(){var a=g.plugin.md.create();
358
+67108866,67110912,2048,2097154],w=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,
359
+268435456,268701696]}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.des)return c.des;c.defined.des=!0;for(var m=0;m<e.length;++m)e[m](c);return c.des}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,
360
+Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/des",["require","module","./cipher","./cipherModes","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var d=a.pkcs5=a.pkcs5||{},e="undefined"!==typeof process&&process.versions&&process.versions.node,h;e&&!a.disableNativeCode&&(h=c("crypto"));a.pbkdf2=d.pbkdf2=function(b,c,d,g,m,u){function l(){if(U>n)return u(null,A);F.start(null,
361
+null);F.update(c);F.update(a.util.int32ToBytes(U));z=M=F.digest().getBytes();q=2;w()}function w(){if(q<=d)return F.start(null,null),F.update(M),D=F.digest().getBytes(),z=a.util.xorBytes(z,D,y),M=D,++q,a.util.setImmediate(w);A+=U<n?z:z.substr(0,r);++U;l()}"function"===typeof m&&(u=m,m=null);if(e&&!a.disableNativeCode&&h.pbkdf2&&(null===m||"object"!==typeof m)&&(4<h.pbkdf2Sync.length||!m||"sha1"===m))return"string"!==typeof m&&(m="sha1"),c=new Buffer(c,"binary"),u?4===h.pbkdf2Sync.length?h.pbkdf2(b,
362
+c,d,g,function(a,b){if(a)return u(a);u(null,b.toString("binary"))}):h.pbkdf2(b,c,d,g,m,function(a,b){if(a)return u(a);u(null,b.toString("binary"))}):4===h.pbkdf2Sync.length?h.pbkdf2Sync(b,c,d,g).toString("binary"):h.pbkdf2Sync(b,c,d,g,m).toString("binary");if("undefined"===typeof m||null===m)m=a.md.sha1.create();if("string"===typeof m){if(!(m in a.md.algorithms))throw Error("Unknown hash algorithm: "+m);m=a.md[m].create()}var y=m.digestLength;if(g>4294967295*y){b=Error("Derived key is too long.");
363
+if(u)return u(b);throw b;}var n=Math.ceil(g/y),r=g-(n-1)*y,F=a.hmac.create();F.start(m,b);var A="",z,D,M;if(!u){for(var U=1;U<=n;++U){F.start(null,null);F.update(c);F.update(a.util.int32ToBytes(U));z=M=F.digest().getBytes();for(var q=2;q<=d;++q)F.start(null,null),F.update(M),D=F.digest().getBytes(),z=a.util.xorBytes(z,D,y),M=D;A+=U<n?z:z.substr(0,r)}return A}U=1;l()}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
364
+typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pbkdf2)return c.pbkdf2;c.defined.pbkdf2=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pbkdf2}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbkdf2",["require","module",
365
+"./hmac","./md","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var d="undefined"!==typeof process&&process.versions&&process.versions.node,e=null;a.disableNativeCode||!d||process.versions["node-webkit"]||(e=c("crypto"));(a.prng=a.prng||{}).create=function(b){function c(a){if(32<=g.pools[0].messageLength)return d(),a();g.seedFile(32-g.pools[0].messageLength<<5,function(b,c){if(b)return a(b);g.collect(c);d();a()})}function d(){var a=g.plugin.md.create();
366
a.update(g.pools[0].digest().getBytes());g.pools[0].start();for(var b=1,c=1;32>c;++c)b=31===b?2147483648:b<<2,0===b%g.reseeds&&(a.update(g.pools[c].digest().getBytes()),g.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();g.key=g.plugin.formatKey(b);g.seed=g.plugin.formatSeed(a);g.reseeds=4294967295===g.reseeds?0:g.reseeds+1;g.generated=0}function m(b){var c=null;if("undefined"!==typeof window){var d=window.crypto||window.msCrypto;d&&d.getRandomValues&&(c=function(a){return d.getRandomValues(a)})}var e=
367
a.util.createBuffer();if(c)for(;e.length()<b;){var g=Math.max(1,Math.min(b-e.length(),65536)/4),h=new Uint32Array(Math.floor(g));try{for(c(h),g=0;g<h.length;++g)e.putInt32(h[g])}catch(k){if(!("undefined"!==typeof QuotaExceededError&&k instanceof QuotaExceededError))throw k;}}if(e.length()<b)for(c=Math.floor(65536*Math.random());e.length()<b;)for(g=16807*(c&65535),c=16807*(c>>16),g+=(c&32767)<<16,g+=c>>15,g=(g&2147483647)+(g>>31),c=g&4294967295,g=0;3>g;++g)h=c>>>(g<<3),h^=Math.floor(256*Math.random()),
368
-e.putByte(String.fromCharCode(h&255));return e.getBytes(b)}var g={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var l=Array(32),u=0;32>u;++u)l[u]=b.create();g.pools=l;g.pool=0;g.generate=function(b,d){function e(E){if(E)return d(E);if(y.length()>=b)return d(null,y.getBytes(b));1048575<g.generated&&(g.key=null);if(null===g.key)return a.util.nextTick(function(){c(e)});E=h(g.key,g.seed);g.generated+=E.length;y.putBytes(E);g.key=k(h(g.key,m(g.seed)));g.seed=A(h(g.key,g.seed));
369
-a.util.setImmediate(e)}if(!d)return g.generateSync(b);var h=g.plugin.cipher,m=g.plugin.increment,k=g.plugin.formatKey,A=g.plugin.formatSeed,y=a.util.createBuffer();g.key=null;e()};g.generateSync=function(b){var c=g.plugin.cipher,e=g.plugin.increment,h=g.plugin.formatKey,m=g.plugin.formatSeed;g.key=null;for(var k=a.util.createBuffer();k.length()<b;){1048575<g.generated&&(g.key=null);null===g.key&&(32<=g.pools[0].messageLength||g.collect(g.seedFileSync(32-g.pools[0].messageLength<<5)),d());var A=c(g.key,
368
+e.putByte(String.fromCharCode(h&255));return e.getBytes(b)}var g={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var l=Array(32),u=0;32>u;++u)l[u]=b.create();g.pools=l;g.pool=0;g.generate=function(b,d){function e(D){if(D)return d(D);if(z.length()>=b)return d(null,z.getBytes(b));1048575<g.generated&&(g.key=null);if(null===g.key)return a.util.nextTick(function(){c(e)});D=h(g.key,g.seed);g.generated+=D.length;z.putBytes(D);g.key=k(h(g.key,m(g.seed)));g.seed=A(h(g.key,g.seed));
369
+a.util.setImmediate(e)}if(!d)return g.generateSync(b);var h=g.plugin.cipher,m=g.plugin.increment,k=g.plugin.formatKey,A=g.plugin.formatSeed,z=a.util.createBuffer();g.key=null;e()};g.generateSync=function(b){var c=g.plugin.cipher,e=g.plugin.increment,h=g.plugin.formatKey,m=g.plugin.formatSeed;g.key=null;for(var k=a.util.createBuffer();k.length()<b;){1048575<g.generated&&(g.key=null);null===g.key&&(32<=g.pools[0].messageLength||g.collect(g.seedFileSync(32-g.pools[0].messageLength<<5)),d());var A=c(g.key,
370
g.seed);g.generated+=A.length;k.putBytes(A);g.key=h(c(g.key,e(g.seed)));g.seed=m(c(g.key,g.seed))}return k.getBytes(b)};e?(g.seedFile=function(a,b){e.randomBytes(a,function(a,c){if(a)return b(a);b(null,c.toString())})},g.seedFileSync=function(a){return e.randomBytes(a).toString()}):(g.seedFile=function(a,b){try{b(null,m(a))}catch(c){b(c)}},g.seedFileSync=m);g.collect=function(a){for(var b=a.length,c=0;c<b;++c)g.pools[g.pool].update(a.substr(c,1)),g.pool=31===g.pool?0:g.pool+1};g.collectInt=function(a,
371
b){for(var c="",d=0;d<b;d+=8)c+=String.fromCharCode(a>>d&255);g.collect(c)};g.registerWorker=function(a){a===self?g.seedFile=function(a,b){function c(a){a=a.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",c),b(a.forge.prng.err,a.forge.prng.bytes))}self.addEventListener("message",c);self.postMessage({forge:{prng:{needed:a}}})}:a.addEventListener("message",function(b){b=b.data;b.forge&&b.forge.prng&&g.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})};
372
-return g}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prng)return c.prng;c.defined.prng=!0;for(var m=0;m<e.length;++m)e[m](c);return c.prng}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,
373
-0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prng",["require","module","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.random&&a.random.getBytes||function(b){function c(){var b=a.prng.create(d);b.getBytes=function(a,c){return b.generate(a,c)};b.getBytesSync=function(a){return b.generate(a)};return b}var d={},e=Array(4),l=a.util.createBuffer();d.formatKey=function(b){var c=a.util.createBuffer(b);b=Array(4);
372
+return g}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prng)return c.prng;c.defined.prng=!0;for(var m=0;m<e.length;++m)e[m](c);return c.prng}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,
373
+0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prng",["require","module","./md","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.random&&a.random.getBytes||function(b){function c(){var b=a.prng.create(d);b.getBytes=function(a,c){return b.generate(a,c)};b.getBytesSync=function(a){return b.generate(a)};return b}var d={},e=Array(4),l=a.util.createBuffer();d.formatKey=function(b){var c=a.util.createBuffer(b);b=Array(4);
374
b[0]=c.getInt32();b[1]=c.getInt32();b[2]=c.getInt32();b[3]=c.getInt32();return a.aes._expandKey(b,!1)};d.formatSeed=function(b){var c=a.util.createBuffer(b);b=Array(4);b[0]=c.getInt32();b[1]=c.getInt32();b[2]=c.getInt32();b[3]=c.getInt32();return b};d.cipher=function(b,c){a.aes._updateBlock(b,c,e,!1);l.putInt32(e[0]);l.putInt32(e[1]);l.putInt32(e[2]);l.putInt32(e[3]);return l.getBytes()};d.increment=function(a){++a[3];return a};d.md=a.md.sha256;var k=c(),g="undefined"!==typeof process&&process.versions&&
375
-process.versions.node,p=null;if("undefined"!==typeof window){var u=window.crypto||window.msCrypto;u&&u.getRandomValues&&(p=function(a){return u.getRandomValues(a)})}if(a.disableNativeCode||!g&&!p){k.collectInt(+new Date,32);if("undefined"!==typeof navigator){var g="",q;for(q in navigator)try{"string"==typeof navigator[q]&&(g+=navigator[q])}catch(x){}k.collect(g);g=null}b&&(b().mousemove(function(a){k.collectInt(a.clientX,16);k.collectInt(a.clientY,16)}),b().keypress(function(a){k.collectInt(a.charCode,
376
-8)}))}if(a.random)for(q in k)a.random[q]=k[q];else a.random=k;a.random.createInstance=c}("undefined"!==typeof jQuery?jQuery:null)}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.random)return c.random;c.defined.random=!0;for(var m=0;m<e.length;++m)e[m](c);
377
-return c.random}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/random","require module ./aes ./md ./prng ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,
375
+process.versions.node,n=null;if("undefined"!==typeof window){var u=window.crypto||window.msCrypto;u&&u.getRandomValues&&(n=function(a){return u.getRandomValues(a)})}if(a.disableNativeCode||!g&&!n){k.collectInt(+new Date,32);if("undefined"!==typeof navigator){var g="",r;for(r in navigator)try{"string"==typeof navigator[r]&&(g+=navigator[r])}catch(w){}k.collect(g);g=null}b&&(b().mousemove(function(a){k.collectInt(a.clientX,16);k.collectInt(a.clientY,16)}),b().keypress(function(a){k.collectInt(a.charCode,
376
+8)}))}if(a.random)for(r in k)a.random[r]=k[r];else a.random=k;a.random.createInstance=c}("undefined"!==typeof jQuery?jQuery:null)}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.random)return c.random;c.defined.random=!0;for(var m=0;m<e.length;++m)e[m](c);
377
+return c.random}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/random","require module ./aes ./md ./prng ./util".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,
378
139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,
379
175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],d=[1,2,3,5];a.rc2=a.rc2||{};a.rc2.expandKey=function(b,d){"string"===typeof b&&(b=a.util.createBuffer(b));d=d||128;var e=b,g=b.length(),h=d,u=Math.ceil(h/8),h=255>>(h&7),l;for(l=g;128>l;l++)e.putByte(c[e.at(l-
380
-1)+e.at(l-g)&255]);e.setAt(128-u,c[e.at(128-u)&h]);for(l=127-u;0<=l;l--)e.setAt(l,c[e.at(l+1)^e.at(l+u)]);return e};var e=function(b,c,e){var g=!1,h=null,m=null,l=null,x,p,q,H,D=[];b=a.rc2.expandKey(b,c);for(q=0;64>q;q++)D.push(b.getInt16Le());e?(x=function(a){for(q=0;4>q;q++){a[q]+=D[H]+(a[(q+3)%4]&a[(q+2)%4])+(~a[(q+3)%4]&a[(q+1)%4]);var b=a[q],c=d[q];a[q]=b<<c&65535|(b&65535)>>16-c;H++}},p=function(a){for(q=0;4>q;q++)a[q]+=D[a[(q+3)%4]&63]}):(x=function(a){for(q=3;0<=q;q--){var b=a[q],c=d[q];a[q]=
381
-(b&65535)>>c|b<<16-c&65535;a[q]-=D[H]+(a[(q+3)%4]&a[(q+2)%4])+(~a[(q+3)%4]&a[(q+1)%4]);H--}},p=function(a){for(q=3;0<=q;q--)a[q]-=D[a[(q+3)%4]&63]});var A=null;return A={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));g=!1;h=a.util.createBuffer();m=c||new a.util.createBuffer;l=b;A.output=m},update:function(a){for(g||h.putBuffer(a);8<=h.length();){a=[[5,x],[1,p],[6,x],[1,p],[5,x]];var b=[];for(q=0;4>q;q++){var c=h.getInt16Le();null!==l&&(e?c^=l.getInt16Le():l.putInt16Le(c));
382
-b.push(c&65535)}H=e?0:63;for(c=0;c<a.length;c++)for(var d=0;d<a[c][0];d++)a[c][1](b);for(q=0;4>q;q++)null!==l&&(e?l.putInt16Le(b[q]):b[q]^=l.getInt16Le()),m.putInt16Le(b[q])}},finish:function(a){var b=!0;if(e)if(a)b=a(8,h,!e);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(g=!0,A.update());!e&&(b=0===h.length())&&(a?b=a(8,m,!e):(a=m.length(),c=m.at(a-1),c>a?b=!1:m.truncate(c)));return b}}};a.rc2.startEncrypting=function(b,c,d){b=a.rc2.createEncryptionCipher(b,128);b.start(c,d);return b};
383
-a.rc2.createEncryptionCipher=function(a,b){return e(a,b,!0)};a.rc2.startDecrypting=function(b,c,d){b=a.rc2.createDecryptionCipher(b,128);b.start(c,d);return b};a.rc2.createDecryptionCipher=function(a,b){return e(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
384
-{};if(c.defined.rc2)return c.rc2;c.defined.rc2=!0;for(var m=0;m<e.length;++m)e[m](c);return c.rc2}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rc2",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){this.data=[];null!=a&&("number"==typeof a?
385
-this.fromNumber(a,b,d):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))}function d(){return new c(null)}function e(a,b,c,d,g,n){for(;0<=--n;){var h=b*this.data[a++]+c.data[d]+g;g=Math.floor(h/67108864);c.data[d++]=h&67108863}return g}function l(a,b,c,d,e,g){var n=b&32767;for(b>>=15;0<=--g;){var h=this.data[a]&32767,y=this.data[a++]>>15,k=b*h+y*n,h=n*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*y+(e>>>30);c.data[d++]=h&1073741823}return e}function q(a,b,
386
-c,d,e,g){var n=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,y=this.data[a++]>>14,k=b*h+y*n,h=n*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*y;c.data[d++]=h&268435455}return e}function k(a,b){var c=U[a.charCodeAt(b)];return null==c?-1:c}function g(a){var b=d();b.fromInt(a);return b}function p(a){var b=1,c;0!=(c=a>>>16)&&(a=c,b+=16);0!=(c=a>>8)&&(a=c,b+=8);0!=(c=a>>4)&&(a=c,b+=4);0!=(c=a>>2)&&(a=c,b+=2);0!=a>>1&&(b+=1);return b}function u(a){this.m=a}function C(a){this.m=a;this.mp=a.invDigit();
387
-this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t}function x(a,b){return a&b}function w(a,b){return a|b}function F(a,b){return a^b}function H(a,b){return a&~b}function D(){}function A(a){return a}function y(a){this.r2=d();this.q3=d();c.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function E(){return{nextBytes:function(a){for(var b=0;b<a.length;++b)a[b]=Math.floor(256*Math.random())}}}var L;"undefined"===typeof navigator?(c.prototype.am=q,L=28):"Microsoft Internet Explorer"==
388
-navigator.appName?(c.prototype.am=l,L=30):"Netscape"!=navigator.appName?(c.prototype.am=e,L=26):(c.prototype.am=q,L=28);c.prototype.DB=L;c.prototype.DM=(1<<L)-1;c.prototype.DV=1<<L;c.prototype.FV=Math.pow(2,52);c.prototype.F1=52-L;c.prototype.F2=2*L-52;var U=[],r;L=48;for(r=0;9>=r;++r)U[L++]=r;L=97;for(r=10;36>r;++r)U[L++]=r;L=65;for(r=10;36>r;++r)U[L++]=r;u.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};u.prototype.revert=function(a){return a};u.prototype.reduce=
380
+1)+e.at(l-g)&255]);e.setAt(128-u,c[e.at(128-u)&h]);for(l=127-u;0<=l;l--)e.setAt(l,c[e.at(l+1)^e.at(l+u)]);return e};var e=function(b,c,e){var g=!1,h=null,m=null,l=null,w,n,r,I,F=[];b=a.rc2.expandKey(b,c);for(r=0;64>r;r++)F.push(b.getInt16Le());e?(w=function(a){for(r=0;4>r;r++){a[r]+=F[I]+(a[(r+3)%4]&a[(r+2)%4])+(~a[(r+3)%4]&a[(r+1)%4]);var b=a[r],c=d[r];a[r]=b<<c&65535|(b&65535)>>16-c;I++}},n=function(a){for(r=0;4>r;r++)a[r]+=F[a[(r+3)%4]&63]}):(w=function(a){for(r=3;0<=r;r--){var b=a[r],c=d[r];a[r]=
381
+(b&65535)>>c|b<<16-c&65535;a[r]-=F[I]+(a[(r+3)%4]&a[(r+2)%4])+(~a[(r+3)%4]&a[(r+1)%4]);I--}},n=function(a){for(r=3;0<=r;r--)a[r]-=F[a[(r+3)%4]&63]});var A=null;return A={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));g=!1;h=a.util.createBuffer();m=c||new a.util.createBuffer;l=b;A.output=m},update:function(a){for(g||h.putBuffer(a);8<=h.length();){a=[[5,w],[1,n],[6,w],[1,n],[5,w]];var b=[];for(r=0;4>r;r++){var c=h.getInt16Le();null!==l&&(e?c^=l.getInt16Le():l.putInt16Le(c));
382
+b.push(c&65535)}I=e?0:63;for(c=0;c<a.length;c++)for(var d=0;d<a[c][0];d++)a[c][1](b);for(r=0;4>r;r++)null!==l&&(e?l.putInt16Le(b[r]):b[r]^=l.getInt16Le()),m.putInt16Le(b[r])}},finish:function(a){var b=!0;if(e)if(a)b=a(8,h,!e);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(g=!0,A.update());!e&&(b=0===h.length())&&(a?b=a(8,m,!e):(a=m.length(),c=m.at(a-1),c>a?b=!1:m.truncate(c)));return b}}};a.rc2.startEncrypting=function(b,c,d){b=a.rc2.createEncryptionCipher(b,128);b.start(c,d);return b};
383
+a.rc2.createEncryptionCipher=function(a,b){return e(a,b,!0)};a.rc2.startDecrypting=function(b,c,d){b=a.rc2.createDecryptionCipher(b,128);b.start(c,d);return b};a.rc2.createDecryptionCipher=function(a,b){return e(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
384
+{};if(c.defined.rc2)return c.rc2;c.defined.rc2=!0;for(var m=0;m<e.length;++m)e[m](c);return c.rc2}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rc2",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){this.data=[];null!=a&&("number"==typeof a?
385
+this.fromNumber(a,b,d):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))}function d(){return new c(null)}function e(a,b,c,d,g,p){for(;0<=--p;){var h=b*this.data[a++]+c.data[d]+g;g=Math.floor(h/67108864);c.data[d++]=h&67108863}return g}function l(a,b,c,d,e,g){var p=b&32767;for(b>>=15;0<=--g;){var h=this.data[a]&32767,z=this.data[a++]>>15,k=b*h+z*p,h=p*h+((k&32767)<<15)+c.data[d]+(e&1073741823);e=(h>>>30)+(k>>>15)+b*z+(e>>>30);c.data[d++]=h&1073741823}return e}function r(a,b,
386
+c,d,e,g){var p=b&16383;for(b>>=14;0<=--g;){var h=this.data[a]&16383,z=this.data[a++]>>14,k=b*h+z*p,h=p*h+((k&16383)<<14)+c.data[d]+e;e=(h>>28)+(k>>14)+b*z;c.data[d++]=h&268435455}return e}function k(a,b){var c=U[a.charCodeAt(b)];return null==c?-1:c}function g(a){var b=d();b.fromInt(a);return b}function n(a){var b=1,c;0!=(c=a>>>16)&&(a=c,b+=16);0!=(c=a>>8)&&(a=c,b+=8);0!=(c=a>>4)&&(a=c,b+=4);0!=(c=a>>2)&&(a=c,b+=2);0!=a>>1&&(b+=1);return b}function u(a){this.m=a}function C(a){this.m=a;this.mp=a.invDigit();
387
+this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t}function w(a,b){return a&b}function y(a,b){return a|b}function E(a,b){return a^b}function I(a,b){return a&~b}function F(){}function A(a){return a}function z(a){this.r2=d();this.q3=d();c.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function D(){return{nextBytes:function(a){for(var b=0;b<a.length;++b)a[b]=Math.floor(256*Math.random())}}}var M;"undefined"===typeof navigator?(c.prototype.am=r,M=28):"Microsoft Internet Explorer"==
388
+navigator.appName?(c.prototype.am=l,M=30):"Netscape"!=navigator.appName?(c.prototype.am=e,M=26):(c.prototype.am=r,M=28);c.prototype.DB=M;c.prototype.DM=(1<<M)-1;c.prototype.DV=1<<M;c.prototype.FV=Math.pow(2,52);c.prototype.F1=52-M;c.prototype.F2=2*M-52;var U=[],q;M=48;for(q=0;9>=q;++q)U[M++]=q;M=97;for(q=10;36>q;++q)U[M++]=q;M=65;for(q=10;36>q;++q)U[M++]=q;u.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};u.prototype.revert=function(a){return a};u.prototype.reduce=
389
function(a){a.divRemTo(this.m,null,a)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};C.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0<b.compareTo(c.ZERO)&&this.m.subTo(b,b);return b};C.prototype.revert=function(a){var b=d();a.copyTo(b);this.reduce(b);return b};C.prototype.reduce=function(a){for(;a.t<=this.mt2;)a.data[a.t++]=0;for(var b=0;b<this.m.t;++b){var c=
390
a.data[b]&32767,d=c*this.mpl+((c*this.mph+(a.data[b]>>15)*this.mpl&this.um)<<15)&a.DM,c=b+this.m.t;for(a.data[c]+=this.m.am(0,d,a,b,0,this.m.t);a.data[c]>=a.DV;)a.data[c]-=a.DV,a.data[++c]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};C.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};C.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};c.prototype.copyTo=function(a){for(var b=this.t-1;0<=b;--b)a.data[b]=this.data[b];a.t=this.t;a.s=this.s};
391
-c.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this.data[0]=a:-1>a?this.data[0]=a+this.DV:this.t=0};c.prototype.fromString=function(a,b){var d;if(16==b)d=4;else if(8==b)d=3;else if(256==b)d=8;else if(2==b)d=1;else if(32==b)d=5;else if(4==b)d=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var e=a.length,g=!1,n=0;0<=--e;){var h=8==d?a[e]&255:k(a,e);0>h?"-"==a.charAt(e)&&(g=!0):(g=!1,0==n?this.data[this.t++]=h:n+d>this.DB?(this.data[this.t-1]|=(h&(1<<this.DB-n)-1)<<n,this.data[this.t++]=
392
-h>>this.DB-n):this.data[this.t-1]|=h<<n,n+=d,n>=this.DB&&(n-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0<n&&(this.data[this.t-1]|=(1<<this.DB-n)-1<<n));this.clamp();g&&c.ZERO.subTo(this,this)};c.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this.data[this.t-1]==a;)--this.t};c.prototype.dlShiftTo=function(a,b){var c;for(c=this.t-1;0<=c;--c)b.data[c+a]=this.data[c];for(c=a-1;0<=c;--c)b.data[c]=0;b.t=this.t+a;b.s=this.s};c.prototype.drShiftTo=function(a,b){for(var c=a;c<this.t;++c)b.data[c-
393
-a]=this.data[c];b.t=Math.max(this.t-a,0);b.s=this.s};c.prototype.lShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,e=(1<<d)-1,g=Math.floor(a/this.DB),n=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)b.data[h+g+1]=this.data[h]>>d|n,n=(this.data[h]&e)<<c;for(h=g-1;0<=h;--h)b.data[h]=0;b.data[g]=n;b.t=this.t+g+1;b.s=this.s;b.clamp()};c.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<<d)-1;b.data[0]=this.data[c]>>d;for(var n=
394
-c+1;n<this.t;++n)b.data[n-c-1]|=(this.data[n]&g)<<e,b.data[n-c]=this.data[n]>>d;0<d&&(b.data[this.t-c-1]|=(this.s&g)<<e);b.t=this.t-c;b.clamp()}};c.prototype.subTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]-a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0<d&&
391
+c.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this.data[0]=a:-1>a?this.data[0]=a+this.DV:this.t=0};c.prototype.fromString=function(a,b){var d;if(16==b)d=4;else if(8==b)d=3;else if(256==b)d=8;else if(2==b)d=1;else if(32==b)d=5;else if(4==b)d=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var e=a.length,g=!1,p=0;0<=--e;){var h=8==d?a[e]&255:k(a,e);0>h?"-"==a.charAt(e)&&(g=!0):(g=!1,0==p?this.data[this.t++]=h:p+d>this.DB?(this.data[this.t-1]|=(h&(1<<this.DB-p)-1)<<p,this.data[this.t++]=
392
+h>>this.DB-p):this.data[this.t-1]|=h<<p,p+=d,p>=this.DB&&(p-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0<p&&(this.data[this.t-1]|=(1<<this.DB-p)-1<<p));this.clamp();g&&c.ZERO.subTo(this,this)};c.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this.data[this.t-1]==a;)--this.t};c.prototype.dlShiftTo=function(a,b){var c;for(c=this.t-1;0<=c;--c)b.data[c+a]=this.data[c];for(c=a-1;0<=c;--c)b.data[c]=0;b.t=this.t+a;b.s=this.s};c.prototype.drShiftTo=function(a,b){for(var c=a;c<this.t;++c)b.data[c-
393
+a]=this.data[c];b.t=Math.max(this.t-a,0);b.s=this.s};c.prototype.lShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,e=(1<<d)-1,g=Math.floor(a/this.DB),p=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)b.data[h+g+1]=this.data[h]>>d|p,p=(this.data[h]&e)<<c;for(h=g-1;0<=h;--h)b.data[h]=0;b.data[g]=p;b.t=this.t+g+1;b.s=this.s;b.clamp()};c.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<<d)-1;b.data[0]=this.data[c]>>d;for(var p=
394
+c+1;p<this.t;++p)b.data[p-c-1]|=(this.data[p]&g)<<e,b.data[p-c]=this.data[p]>>d;0<d&&(b.data[this.t-c-1]|=(this.s&g)<<e);b.t=this.t-c;b.clamp()}};c.prototype.subTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]-a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0<d&&
395
(b.data[c++]=d);b.t=c;b.clamp()};c.prototype.multiplyTo=function(a,b){var d=this.abs(),e=a.abs(),g=d.t;for(b.t=g+e.t;0<=--g;)b.data[g]=0;for(g=0;g<e.t;++g)b.data[g+d.t]=d.am(0,e.data[g],b,g,0,d.t);b.s=0;b.clamp();this.s!=a.s&&c.ZERO.subTo(b,b)};c.prototype.squareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a.data[c]=0;for(c=0;c<b.t-1;++c){var d=b.am(c,b.data[c],a,2*c,0,1);(a.data[c+b.t]+=b.am(c+1,2*b.data[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0<a.t&&(a.data[a.t-
396
-1]+=b.am(c,b.data[c],a,2*c,0,1));a.s=0;a.clamp()};c.prototype.divRemTo=function(a,b,e){var g=a.abs();if(!(0>=g.t)){var n=this.abs();if(n.t<g.t)null!=b&&b.fromInt(0),null!=e&&this.copyTo(e);else{null==e&&(e=d());var h=d(),y=this.s;a=a.s;var k=this.DB-p(g.data[g.t-1]);0<k?(g.lShiftTo(k,h),n.lShiftTo(k,e)):(g.copyTo(h),n.copyTo(e));g=h.t;n=h.data[g-1];if(0!=n){var A=n*(1<<this.F1)+(1<g?h.data[g-2]>>this.F2:0),r=this.FV/A,A=(1<<this.F1)/A,E=1<<this.F2,u=e.t,l=u-g,x=null==b?d():b;h.dlShiftTo(l,x);0<=e.compareTo(x)&&
397
-(e.data[e.t++]=1,e.subTo(x,e));c.ONE.dlShiftTo(g,x);for(x.subTo(h,h);h.t<g;)h.data[h.t++]=0;for(;0<=--l;){var q=e.data[--u]==n?this.DM:Math.floor(e.data[u]*r+(e.data[u-1]+E)*A);if((e.data[u]+=h.am(0,q,e,l,0,g))<q)for(h.dlShiftTo(l,x),e.subTo(x,e);e.data[u]<--q;)e.subTo(x,e)}null!=b&&(e.drShiftTo(g,b),y!=a&&c.ZERO.subTo(b,b));e.t=g;e.clamp();0<k&&e.rShiftTo(k,e);0>y&&c.ZERO.subTo(e,e)}}}};c.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-
398
-(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};c.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};c.prototype.exp=function(a,b){if(4294967295<a||1>a)return c.ONE;var e=d(),g=d(),n=b.convert(this),h=p(a)-1;for(n.copyTo(e);0<=--h;)if(b.sqrTo(e,g),0<(a&1<<h))b.mulTo(g,n,e);else var y=e,e=g,g=y;return b.revert(e)};c.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=
399
-4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,e="",g=this.t,n=this.DB-g*this.DB%a;if(0<g--)for(n<this.DB&&0<(c=this.data[g]>>n)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)n<a?(c=(this.data[g]&(1<<n)-1)<<a-n,c|=this.data[--g]>>(n+=this.DB-a)):(c=this.data[g]>>(n-=a)&b,0>=n&&(n+=this.DB,--g)),0<c&&(d=!0),d&&(e+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?e:"0"};c.prototype.negate=function(){var a=
400
-d();c.ZERO.subTo(this,a);return a};c.prototype.abs=function(){return 0>this.s?this.negate():this};c.prototype.compareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t,b=c-a.t;if(0!=b)return 0>this.s?-b:b;for(;0<=--c;)if(0!=(b=this.data[c]-a.data[c]))return b;return 0};c.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)};c.prototype.mod=function(a){var b=d();this.abs().divRemTo(a,null,b);0>this.s&&0<b.compareTo(c.ZERO)&&a.subTo(b,
401
-b);return b};c.prototype.modPowInt=function(a,b){var c;c=256>a||b.isEven()?new u(b):new C(b);return this.exp(a,c)};c.ZERO=g(0);c.ONE=g(1);D.prototype.convert=A;D.prototype.revert=A;D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};D.prototype.sqrTo=function(a,b){a.squareTo(b)};y.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=d();a.copyTo(b);this.reduce(b);return b};y.prototype.revert=function(a){return a};y.prototype.reduce=function(a){a.drShiftTo(this.m.t-
402
-1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};y.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};y.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var P=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,
403
-113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],T=67108864/P[P.length-1];c.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};c.prototype.toRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36<a)return"0";var b=this.chunkSize(a),b=Math.pow(a,
404
-b),c=g(b),e=d(),n=d(),h="";for(this.divRemTo(c,e,n);0<e.signum();)h=(b+n.intValue()).toString(a).substr(1)+h,e.divRemTo(c,e,n);return n.intValue().toString(a)+h};c.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var d=this.chunkSize(b),e=Math.pow(b,d),g=!1,n=0,h=0,y=0;y<a.length;++y){var A=k(a,y);0>A?"-"==a.charAt(y)&&0==this.signum()&&(g=!0):(h=b*h+A,++n>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=n=0))}0<n&&(this.dMultiply(Math.pow(b,n)),this.dAddOffset(h,0));g&&c.ZERO.subTo(this,
405
-this)};c.prototype.fromNumber=function(a,b,d){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),w,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(c.ONE.shiftLeft(a-1),this);else{d=[];var e=a&7;d.length=(a>>3)+1;b.nextBytes(d);d[0]=0<e?d[0]&(1<<e)-1:0;this.fromString(d,256)}};c.prototype.bitwiseTo=function(a,b,c){var d,e,g=Math.min(a.t,this.t);for(d=
396
+1]+=b.am(c,b.data[c],a,2*c,0,1));a.s=0;a.clamp()};c.prototype.divRemTo=function(a,b,e){var g=a.abs();if(!(0>=g.t)){var p=this.abs();if(p.t<g.t)null!=b&&b.fromInt(0),null!=e&&this.copyTo(e);else{null==e&&(e=d());var h=d(),z=this.s;a=a.s;var k=this.DB-n(g.data[g.t-1]);0<k?(g.lShiftTo(k,h),p.lShiftTo(k,e)):(g.copyTo(h),p.copyTo(e));g=h.t;p=h.data[g-1];if(0!=p){var A=p*(1<<this.F1)+(1<g?h.data[g-2]>>this.F2:0),q=this.FV/A,A=(1<<this.F1)/A,D=1<<this.F2,l=e.t,u=l-g,w=null==b?d():b;h.dlShiftTo(u,w);0<=e.compareTo(w)&&
397
+(e.data[e.t++]=1,e.subTo(w,e));c.ONE.dlShiftTo(g,w);for(w.subTo(h,h);h.t<g;)h.data[h.t++]=0;for(;0<=--u;){var r=e.data[--l]==p?this.DM:Math.floor(e.data[l]*q+(e.data[l-1]+D)*A);if((e.data[l]+=h.am(0,r,e,u,0,g))<r)for(h.dlShiftTo(u,w),e.subTo(w,e);e.data[l]<--r;)e.subTo(w,e)}null!=b&&(e.drShiftTo(g,b),z!=a&&c.ZERO.subTo(b,b));e.t=g;e.clamp();0<k&&e.rShiftTo(k,e);0>z&&c.ZERO.subTo(e,e)}}}};c.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-
398
+(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};c.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};c.prototype.exp=function(a,b){if(4294967295<a||1>a)return c.ONE;var e=d(),g=d(),p=b.convert(this),h=n(a)-1;for(p.copyTo(e);0<=--h;)if(b.sqrTo(e,g),0<(a&1<<h))b.mulTo(g,p,e);else var z=e,e=g,g=z;return b.revert(e)};c.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=
399
+4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,e="",g=this.t,p=this.DB-g*this.DB%a;if(0<g--)for(p<this.DB&&0<(c=this.data[g]>>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p<a?(c=(this.data[g]&(1<<p)-1)<<a-p,c|=this.data[--g]>>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0<c&&(d=!0),d&&(e+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?e:"0"};c.prototype.negate=function(){var a=
400
+d();c.ZERO.subTo(this,a);return a};c.prototype.abs=function(){return 0>this.s?this.negate():this};c.prototype.compareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t,b=c-a.t;if(0!=b)return 0>this.s?-b:b;for(;0<=--c;)if(0!=(b=this.data[c]-a.data[c]))return b;return 0};c.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+n(this.data[this.t-1]^this.s&this.DM)};c.prototype.mod=function(a){var b=d();this.abs().divRemTo(a,null,b);0>this.s&&0<b.compareTo(c.ZERO)&&a.subTo(b,
401
+b);return b};c.prototype.modPowInt=function(a,b){var c;c=256>a||b.isEven()?new u(b):new C(b);return this.exp(a,c)};c.ZERO=g(0);c.ONE=g(1);F.prototype.convert=A;F.prototype.revert=A;F.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};F.prototype.sqrTo=function(a,b){a.squareTo(b)};z.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=d();a.copyTo(b);this.reduce(b);return b};z.prototype.revert=function(a){return a};z.prototype.reduce=function(a){a.drShiftTo(this.m.t-
402
+1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};z.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};z.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var G=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,
403
+113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],V=67108864/G[G.length-1];c.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};c.prototype.toRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36<a)return"0";var b=this.chunkSize(a),b=Math.pow(a,
404
+b),c=g(b),e=d(),p=d(),h="";for(this.divRemTo(c,e,p);0<e.signum();)h=(b+p.intValue()).toString(a).substr(1)+h,e.divRemTo(c,e,p);return p.intValue().toString(a)+h};c.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var d=this.chunkSize(b),e=Math.pow(b,d),g=!1,p=0,h=0,z=0;z<a.length;++z){var A=k(a,z);0>A?"-"==a.charAt(z)&&0==this.signum()&&(g=!0):(h=b*h+A,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0<p&&(this.dMultiply(Math.pow(b,p)),this.dAddOffset(h,0));g&&c.ZERO.subTo(this,
405
+this)};c.prototype.fromNumber=function(a,b,d){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(c.ONE.shiftLeft(a-1),this);else{d=[];var e=a&7;d.length=(a>>3)+1;b.nextBytes(d);d[0]=0<e?d[0]&(1<<e)-1:0;this.fromString(d,256)}};c.prototype.bitwiseTo=function(a,b,c){var d,e,g=Math.min(a.t,this.t);for(d=
406
0;d<g;++d)c.data[d]=b(this.data[d],a.data[d]);if(a.t<this.t){e=a.s&this.DM;for(d=g;d<this.t;++d)c.data[d]=b(this.data[d],e);c.t=this.t}else{e=this.s&this.DM;for(d=g;d<a.t;++d)c.data[d]=b(e,a.data[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};c.prototype.changeBit=function(a,b){var d=c.ONE.shiftLeft(a);this.bitwiseTo(d,b,d);return d};c.prototype.addTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]+a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=
407
this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d+=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=a.s}b.s=0>d?-1:0;0<d?b.data[c++]=d:-1>d&&(b.data[c++]=this.DV+d);b.t=c;b.clamp()};c.prototype.dMultiply=function(a){this.data[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};c.prototype.dAddOffset=function(a,b){if(0!=a){for(;this.t<=b;)this.data[this.t++]=0;for(this.data[b]+=a;this.data[b]>=this.DV;)this.data[b]-=this.DV,++b>=this.t&&(this.data[this.t++]=
408
0),++this.data[b]}};c.prototype.multiplyLowerTo=function(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0<d;)c.data[--d]=0;var e;for(e=c.t-this.t;d<e;++d)c.data[d+this.t]=this.am(0,a.data[d],c,d,0,this.t);for(e=Math.min(a.t,b);d<e;++d)this.am(0,a.data[d],c,d,0,b-d);c.clamp()};c.prototype.multiplyUpperTo=function(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c.data[d]=0;for(d=Math.max(b-this.t,0);d<a.t;++d)c.data[this.t+d-b]=this.am(b-d,a.data[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,
409
-c)};c.prototype.modInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this.data[d])%a;return c};c.prototype.millerRabin=function(a){var b=this.subtract(c.ONE),d=b.getLowestSetBit();if(0>=d)return!1;for(var e=b.shiftRight(d),g=E(),n,h=0;h<a;++h){do n=new c(this.bitLength(),g);while(0>=n.compareTo(c.ONE)||0<=n.compareTo(b));n=n.modPow(e,this);if(0!=n.compareTo(c.ONE)&&0!=n.compareTo(b)){for(var y=1;y++<d&&0!=
410
-n.compareTo(b);)if(n=n.modPowInt(2,this),0==n.compareTo(c.ONE))return!1;if(0!=n.compareTo(b))return!1}}return!0};c.prototype.clone=function(){var a=d();this.copyTo(a);return a};c.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};c.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};c.prototype.shortValue=
409
+c)};c.prototype.modInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this.data[d])%a;return c};c.prototype.millerRabin=function(a){var b=this.subtract(c.ONE),d=b.getLowestSetBit();if(0>=d)return!1;for(var e=b.shiftRight(d),g=D(),p,h=0;h<a;++h){do p=new c(this.bitLength(),g);while(0>=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var z=1;z++<d&&0!=
410
+p.compareTo(b);)if(p=p.modPowInt(2,this),0==p.compareTo(c.ONE))return!1;if(0!=p.compareTo(b))return!1}}return!0};c.prototype.clone=function(){var a=d();this.copyTo(a);return a};c.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};c.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};c.prototype.shortValue=
411
function(){return 0==this.t?this.s:this.data[0]<<16>>16};c.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};c.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,d,e=0;if(0<a--)for(c<this.DB&&(d=this.data[a]>>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<<this.DB-c);0<=a;)if(8>c?(d=(this.data[a]&(1<<c)-1)<<8-c,d|=this.data[--a]>>(c+=this.DB-8)):(d=this.data[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==e&&
412
-(this.s&128)!=(d&128)&&++e,0<e||d!=this.s)b[e++]=d;return b};c.prototype.equals=function(a){return 0==this.compareTo(a)};c.prototype.min=function(a){return 0>this.compareTo(a)?this:a};c.prototype.max=function(a){return 0<this.compareTo(a)?this:a};c.prototype.and=function(a){var b=d();this.bitwiseTo(a,x,b);return b};c.prototype.or=function(a){var b=d();this.bitwiseTo(a,w,b);return b};c.prototype.xor=function(a){var b=d();this.bitwiseTo(a,F,b);return b};c.prototype.andNot=function(a){var b=d();this.bitwiseTo(a,
413
-H,b);return b};c.prototype.not=function(){for(var a=d(),b=0;b<this.t;++b)a.data[b]=this.DM&~this.data[b];a.t=this.t;a.s=~this.s;return a};c.prototype.shiftLeft=function(a){var b=d();0>a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b};c.prototype.shiftRight=function(a){var b=d();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b);return b};c.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this.data[a]){var b=a*this.DB;a=this.data[a];if(0==a)a=-1;else{var c=0;0==(a&65535)&&(a>>=16,c+=16);
414
-0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};c.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c){for(var d=this.data[c]^b,e=0;0!=d;)d&=d-1,++e;a+=e}return a};c.prototype.testBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this.data[b]&1<<a%this.DB)};c.prototype.setBit=function(a){return this.changeBit(a,w)};c.prototype.clearBit=function(a){return this.changeBit(a,
415
-H)};c.prototype.flipBit=function(a){return this.changeBit(a,F)};c.prototype.add=function(a){var b=d();this.addTo(a,b);return b};c.prototype.subtract=function(a){var b=d();this.subTo(a,b);return b};c.prototype.multiply=function(a){var b=d();this.multiplyTo(a,b);return b};c.prototype.divide=function(a){var b=d();this.divRemTo(a,b,null);return b};c.prototype.remainder=function(a){var b=d();this.divRemTo(a,null,b);return b};c.prototype.divideAndRemainder=function(a){var b=d(),c=d();this.divRemTo(a,b,
416
-c);return[b,c]};c.prototype.modPow=function(a,b){var c=a.bitLength(),e,n=g(1),h;if(0>=c)return n;e=18>c?1:48>c?3:144>c?4:768>c?5:6;h=8>c?new u(b):b.isEven()?new y(b):new C(b);var k=[],A=3,m=e-1,r=(1<<e)-1;k[1]=h.convert(this);if(1<e)for(c=d(),h.sqrTo(k[1],c);A<=r;)k[A]=d(),h.mulTo(c,k[A-2],k[A]),A+=2;for(var E=a.t-1,l,x=!0,q=d(),c=p(a.data[E])-1;0<=E;){c>=m?l=a.data[E]>>c-m&r:(l=(a.data[E]&(1<<c+1)-1)<<m-c,0<E&&(l|=a.data[E-1]>>this.DB+c-m));for(A=e;0==(l&1);)l>>=1,--A;0>(c-=A)&&(c+=this.DB,--E);
417
-if(x)k[l].copyTo(n),x=!1;else{for(;1<A;)h.sqrTo(n,q),h.sqrTo(q,n),A-=2;0<A?h.sqrTo(n,q):(A=n,n=q,q=A);h.mulTo(q,k[l],n)}for(;0<=E&&0==(a.data[E]&1<<c);)h.sqrTo(n,q),A=n,n=q,q=A,0>--c&&(c=this.DB-1,--E)}return h.revert(n)};c.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return c.ZERO;for(var d=a.clone(),e=this.clone(),n=g(1),h=g(0),y=g(0),k=g(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(n.isEven()&&h.isEven()||(n.addTo(this,n),h.subTo(a,h)),n.rShiftTo(1,
418
-n)):h.isEven()||h.subTo(a,h),h.rShiftTo(1,h);for(;e.isEven();)e.rShiftTo(1,e),b?(y.isEven()&&k.isEven()||(y.addTo(this,y),k.subTo(a,k)),y.rShiftTo(1,y)):k.isEven()||k.subTo(a,k),k.rShiftTo(1,k);0<=d.compareTo(e)?(d.subTo(e,d),b&&n.subTo(y,n),h.subTo(k,h)):(e.subTo(d,e),b&&y.subTo(n,y),k.subTo(h,k))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=k.compareTo(a))return k.subtract(a);if(0>k.signum())k.addTo(a,k);else return k;return 0>k.signum()?k.add(a):k};c.prototype.pow=function(a){return this.exp(a,
419
-new D)};c.prototype.gcd=function(a){var b=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b,b=a;a=c}var c=b.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return b;c<d&&(d=c);0<d&&(b.rShiftTo(d,b),a.rShiftTo(d,a));for(;0<b.signum();)0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<(c=a.getLowestSetBit())&&a.rShiftTo(c,a),0<=b.compareTo(a)?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};c.prototype.isProbablePrime=
420
-function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=P[P.length-1]){for(b=0;b<P.length;++b)if(c.data[0]==P[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<P.length;){for(var d=P[b],e=b+1;e<P.length&&d<T;)d*=P[e++];for(d=c.modInt(d);b<e;)if(0==d%P[b++])return!1}return c.millerRabin(a)};a.jsbn=a.jsbn||{};a.jsbn.BigInteger=c}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,
421
-p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.jsbn)return c.jsbn;c.defined.jsbn=!0;for(var m=0;m<e.length;++m)e[m](c);return c.jsbn}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/jsbn",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,
422
-0))})})();(function(){function b(a){function c(b,d,e){e||(e=a.md.sha1.create());for(var k="",g=Math.ceil(d/e.digestLength),m=0;m<g;++m){var l=String.fromCharCode(m>>24&255,m>>16&255,m>>8&255,m&255);e.start();e.update(b+l);k+=e.digest().getBytes()}return k.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,k,g){var l,u,q,x;"string"===typeof e?(l=e,u=k||void 0,q=g||void 0):e&&(l=e.label||void 0,u=e.seed||void 0,q=e.md||void 0,e.mgf1&&e.mgf1.md&&(x=e.mgf1.md));q?q.start():q=a.md.sha1.create();
423
-x||(x=q);b=Math.ceil(b.n.bitLength()/8);e=b-2*q.digestLength-2;if(d.length>e)throw x=Error("RSAES-OAEP input message length is too long."),x.length=d.length,x.maxLength=e,x;l||(l="");q.update(l,"raw");l=q.digest();k="";e-=d.length;for(g=0;g<e;g++)k+="\x00";d=l.getBytes()+k+"\u0001"+d;if(!u)u=a.random.getBytes(q.digestLength);else if(u.length!==q.digestLength)throw x=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length."),x.seedLength=u.length,x.digestLength=q.digestLength,
424
-x;b=c(u,b-q.digestLength-1,x);d=a.util.xorBytes(d,b,d.length);q=c(d,q.digestLength,x);return"\x00"+a.util.xorBytes(u,q,u.length)+d};d.decode_rsa_oaep=function(b,d,e,k){var g,l,u;"string"===typeof e?(g=e,l=k||void 0):e&&(g=e.label||void 0,l=e.md||void 0,e.mgf1&&e.mgf1.md&&(u=e.mgf1.md));e=Math.ceil(b.n.bitLength()/8);if(d.length!==e)throw u=Error("RSAES-OAEP encoded message length is invalid."),u.length=d.length,u.expectedLength=e,u;void 0===l?l=a.md.sha1.create():l.start();u||(u=l);if(e<2*l.digestLength+
425
-2)throw Error("RSAES-OAEP key is too short for the hash function.");g||(g="");l.update(g,"raw");g=l.digest().getBytes();b=d.charAt(0);k=d.substring(1,l.digestLength+1);d=d.substring(1+l.digestLength);var q=c(d,l.digestLength,u);k=a.util.xorBytes(k,q,k.length);u=c(k,e-l.digestLength-1,u);d=a.util.xorBytes(d,u,d.length);e=d.substring(0,l.digestLength);u="\x00"!==b;for(b=0;b<l.digestLength;++b)u|=g.charAt(b)!==e.charAt(b);g=1;for(l=b=l.digestLength;l<d.length;l++)e=d.charCodeAt(l),k=e&1^1,u|=e&(g?65534:
426
-0),g&=k,b+=g;if(u||1!==d.charCodeAt(b))throw Error("Invalid RSAES-OAEP padding.");return d.substring(b+1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs1)return c.pkcs1;c.defined.pkcs1=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pkcs1}},
427
-q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs1",["require","module","./util","./random","./sha1"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,g,n){return"workers"in g?e(a,b,g,n):d(a,b,g,n)}function d(b,c,e,g){var h=l(b,c),k=0,y=q(h.bitLength());"millerRabinTests"in
428
-e&&(y=e.millerRabinTests);var m=10;"maxBlockTime"in e&&(m=e.maxBlockTime);var u=+new Date;do{h.bitLength()>b&&(h=l(b,c));if(h.isProbablePrime(y))return g(null,h);h.dAddOffset(p[k++%8],0)}while(0>m||+new Date-u<m);a.util.setImmediate(function(){d(b,c,e,g)})}function e(b,c,h,k){function m(){function a(e){if(!h){--n;var y=e.data;if(y.found){for(e=0;e<d.length;++e)d[e].terminate();h=!0;return k(null,new g(y.prime,16))}A.bitLength()>b&&(A=l(b,c));y=A.toString(16);e.target.postMessage({hex:y,workLoad:E});
429
-A.dAddOffset(u,0)}}y=Math.max(1,y);for(var d=[],e=0;e<y;++e)d[e]=new Worker(q);for(var n=y,e=0;e<y;++e)d[e].addEventListener("message",a);var h=!1}if("undefined"===typeof Worker)return d(b,c,h,k);var A=l(b,c),y=h.workers,E=h.workLoad||100,u=30*E/8,q=h.workerScript||"forge/prime.worker.js";if(-1===y)return a.util.estimateCores(function(a,b){a&&(b=2);y=b-1;m()});m()}function l(a,b){var c=new g(a,b),d=a-1;c.testBit(d)||c.bitwiseTo(g.ONE.shiftLeft(d),C,c);c.dAddOffset(31-c.mod(u).byteValue(),0);return c}
430
-function q(a){return 100>=a?27:150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if(!a.prime){var k=a.prime=a.prime||{},g=a.jsbn.BigInteger,p=[6,4,2,4,2,4,6,2],u=new g(null);u.fromInt(30);var C=function(a,b){return a|b};k.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length),
431
-c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};if("PRIMEINC"===g.name)return c(b,d,g.options,e);throw Error("Invalid prime generation algorithm: "+g.name);}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prime)return c.prime;c.defined.prime=!0;for(var m=
432
-0;m<e.length;++m)e[m](c);return c.prime}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prime",["require","module","./util","./jsbn","./random"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d,e){var g=a.util.createBuffer();d=Math.ceil(d.n.bitLength()/8);if(b.length>d-11)throw g=
412
+(this.s&128)!=(d&128)&&++e,0<e||d!=this.s)b[e++]=d;return b};c.prototype.equals=function(a){return 0==this.compareTo(a)};c.prototype.min=function(a){return 0>this.compareTo(a)?this:a};c.prototype.max=function(a){return 0<this.compareTo(a)?this:a};c.prototype.and=function(a){var b=d();this.bitwiseTo(a,w,b);return b};c.prototype.or=function(a){var b=d();this.bitwiseTo(a,y,b);return b};c.prototype.xor=function(a){var b=d();this.bitwiseTo(a,E,b);return b};c.prototype.andNot=function(a){var b=d();this.bitwiseTo(a,
413
+I,b);return b};c.prototype.not=function(){for(var a=d(),b=0;b<this.t;++b)a.data[b]=this.DM&~this.data[b];a.t=this.t;a.s=~this.s;return a};c.prototype.shiftLeft=function(a){var b=d();0>a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b};c.prototype.shiftRight=function(a){var b=d();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b);return b};c.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this.data[a]){var b=a*this.DB;a=this.data[a];if(0==a)a=-1;else{var c=0;0==(a&65535)&&(a>>=16,c+=16);
414
+0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};c.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c){for(var d=this.data[c]^b,e=0;0!=d;)d&=d-1,++e;a+=e}return a};c.prototype.testBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this.data[b]&1<<a%this.DB)};c.prototype.setBit=function(a){return this.changeBit(a,y)};c.prototype.clearBit=function(a){return this.changeBit(a,
415
+I)};c.prototype.flipBit=function(a){return this.changeBit(a,E)};c.prototype.add=function(a){var b=d();this.addTo(a,b);return b};c.prototype.subtract=function(a){var b=d();this.subTo(a,b);return b};c.prototype.multiply=function(a){var b=d();this.multiplyTo(a,b);return b};c.prototype.divide=function(a){var b=d();this.divRemTo(a,b,null);return b};c.prototype.remainder=function(a){var b=d();this.divRemTo(a,null,b);return b};c.prototype.divideAndRemainder=function(a){var b=d(),c=d();this.divRemTo(a,b,
416
+c);return[b,c]};c.prototype.modPow=function(a,b){var c=a.bitLength(),e,p=g(1),h;if(0>=c)return p;e=18>c?1:48>c?3:144>c?4:768>c?5:6;h=8>c?new u(b):b.isEven()?new z(b):new C(b);var k=[],A=3,m=e-1,q=(1<<e)-1;k[1]=h.convert(this);if(1<e)for(c=d(),h.sqrTo(k[1],c);A<=q;)k[A]=d(),h.mulTo(c,k[A-2],k[A]),A+=2;for(var D=a.t-1,l,w=!0,r=d(),c=n(a.data[D])-1;0<=D;){c>=m?l=a.data[D]>>c-m&q:(l=(a.data[D]&(1<<c+1)-1)<<m-c,0<D&&(l|=a.data[D-1]>>this.DB+c-m));for(A=e;0==(l&1);)l>>=1,--A;0>(c-=A)&&(c+=this.DB,--D);
417
+if(w)k[l].copyTo(p),w=!1;else{for(;1<A;)h.sqrTo(p,r),h.sqrTo(r,p),A-=2;0<A?h.sqrTo(p,r):(A=p,p=r,r=A);h.mulTo(r,k[l],p)}for(;0<=D&&0==(a.data[D]&1<<c);)h.sqrTo(p,r),A=p,p=r,r=A,0>--c&&(c=this.DB-1,--D)}return h.revert(p)};c.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return c.ZERO;for(var d=a.clone(),e=this.clone(),p=g(1),h=g(0),z=g(0),k=g(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&h.isEven()||(p.addTo(this,p),h.subTo(a,h)),p.rShiftTo(1,
418
+p)):h.isEven()||h.subTo(a,h),h.rShiftTo(1,h);for(;e.isEven();)e.rShiftTo(1,e),b?(z.isEven()&&k.isEven()||(z.addTo(this,z),k.subTo(a,k)),z.rShiftTo(1,z)):k.isEven()||k.subTo(a,k),k.rShiftTo(1,k);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(z,p),h.subTo(k,h)):(e.subTo(d,e),b&&z.subTo(p,z),k.subTo(h,k))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=k.compareTo(a))return k.subtract(a);if(0>k.signum())k.addTo(a,k);else return k;return 0>k.signum()?k.add(a):k};c.prototype.pow=function(a){return this.exp(a,
419
+new F)};c.prototype.gcd=function(a){var b=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b,b=a;a=c}var c=b.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return b;c<d&&(d=c);0<d&&(b.rShiftTo(d,b),a.rShiftTo(d,a));for(;0<b.signum();)0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<(c=a.getLowestSetBit())&&a.rShiftTo(c,a),0<=b.compareTo(a)?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};c.prototype.isProbablePrime=
420
+function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=G[G.length-1]){for(b=0;b<G.length;++b)if(c.data[0]==G[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<G.length;){for(var d=G[b],e=b+1;e<G.length&&d<V;)d*=G[e++];for(d=c.modInt(d);b<e;)if(0==d%G[b++])return!1}return c.millerRabin(a)};a.jsbn=a.jsbn||{};a.jsbn.BigInteger=c}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,
421
+n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.jsbn)return c.jsbn;c.defined.jsbn=!0;for(var m=0;m<e.length;++m)e[m](c);return c.jsbn}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/jsbn",["require","module"],function(){n.apply(null,Array.prototype.slice.call(arguments,
422
+0))})})();(function(){function b(a){function c(b,d,e){e||(e=a.md.sha1.create());for(var k="",g=Math.ceil(d/e.digestLength),m=0;m<g;++m){var l=String.fromCharCode(m>>24&255,m>>16&255,m>>8&255,m&255);e.start();e.update(b+l);k+=e.digest().getBytes()}return k.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,k,g){var l,u,r,w;"string"===typeof e?(l=e,u=k||void 0,r=g||void 0):e&&(l=e.label||void 0,u=e.seed||void 0,r=e.md||void 0,e.mgf1&&e.mgf1.md&&(w=e.mgf1.md));r?r.start():r=a.md.sha1.create();
423
+w||(w=r);b=Math.ceil(b.n.bitLength()/8);e=b-2*r.digestLength-2;if(d.length>e)throw w=Error("RSAES-OAEP input message length is too long."),w.length=d.length,w.maxLength=e,w;l||(l="");r.update(l,"raw");l=r.digest();k="";e-=d.length;for(g=0;g<e;g++)k+="\x00";d=l.getBytes()+k+"\u0001"+d;if(!u)u=a.random.getBytes(r.digestLength);else if(u.length!==r.digestLength)throw w=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length."),w.seedLength=u.length,w.digestLength=r.digestLength,
424
+w;b=c(u,b-r.digestLength-1,w);d=a.util.xorBytes(d,b,d.length);r=c(d,r.digestLength,w);return"\x00"+a.util.xorBytes(u,r,u.length)+d};d.decode_rsa_oaep=function(b,d,e,k){var g,l,u;"string"===typeof e?(g=e,l=k||void 0):e&&(g=e.label||void 0,l=e.md||void 0,e.mgf1&&e.mgf1.md&&(u=e.mgf1.md));e=Math.ceil(b.n.bitLength()/8);if(d.length!==e)throw u=Error("RSAES-OAEP encoded message length is invalid."),u.length=d.length,u.expectedLength=e,u;void 0===l?l=a.md.sha1.create():l.start();u||(u=l);if(e<2*l.digestLength+
425
+2)throw Error("RSAES-OAEP key is too short for the hash function.");g||(g="");l.update(g,"raw");g=l.digest().getBytes();b=d.charAt(0);k=d.substring(1,l.digestLength+1);d=d.substring(1+l.digestLength);var r=c(d,l.digestLength,u);k=a.util.xorBytes(k,r,k.length);u=c(k,e-l.digestLength-1,u);d=a.util.xorBytes(d,u,d.length);e=d.substring(0,l.digestLength);u="\x00"!==b;for(b=0;b<l.digestLength;++b)u|=g.charAt(b)!==e.charAt(b);g=1;for(l=b=l.digestLength;l<d.length;l++)e=d.charCodeAt(l),k=e&1^1,u|=e&(g?65534:
426
+0),g&=k,b+=g;if(u||1!==d.charCodeAt(b))throw Error("Invalid RSAES-OAEP padding.");return d.substring(b+1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs1)return c.pkcs1;c.defined.pkcs1=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pkcs1}},
427
+r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs1",["require","module","./util","./random","./sha1"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,g,p){return"workers"in g?e(a,b,g,p):d(a,b,g,p)}function d(b,c,e,g){var h=l(b,c),k=0,z=r(h.bitLength());"millerRabinTests"in
428
+e&&(z=e.millerRabinTests);var m=10;"maxBlockTime"in e&&(m=e.maxBlockTime);var u=+new Date;do{h.bitLength()>b&&(h=l(b,c));if(h.isProbablePrime(z))return g(null,h);h.dAddOffset(n[k++%8],0)}while(0>m||+new Date-u<m);a.util.setImmediate(function(){d(b,c,e,g)})}function e(b,c,h,k){function m(){function a(e){if(!h){--p;var z=e.data;if(z.found){for(e=0;e<d.length;++e)d[e].terminate();h=!0;return k(null,new g(z.prime,16))}A.bitLength()>b&&(A=l(b,c));z=A.toString(16);e.target.postMessage({hex:z,workLoad:D});
429
+A.dAddOffset(u,0)}}z=Math.max(1,z);for(var d=[],e=0;e<z;++e)d[e]=new Worker(r);for(var p=z,e=0;e<z;++e)d[e].addEventListener("message",a);var h=!1}if("undefined"===typeof Worker)return d(b,c,h,k);var A=l(b,c),z=h.workers,D=h.workLoad||100,u=30*D/8,r=h.workerScript||"forge/prime.worker.js";if(-1===z)return a.util.estimateCores(function(a,b){a&&(b=2);z=b-1;m()});m()}function l(a,b){var c=new g(a,b),d=a-1;c.testBit(d)||c.bitwiseTo(g.ONE.shiftLeft(d),C,c);c.dAddOffset(31-c.mod(u).byteValue(),0);return c}
430
+function r(a){return 100>=a?27:150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if(!a.prime){var k=a.prime=a.prime||{},g=a.jsbn.BigInteger,n=[6,4,2,4,2,4,6,2],u=new g(null);u.fromInt(30);var C=function(a,b){return a|b};k.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length),
431
+c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};if("PRIMEINC"===g.name)return c(b,d,g.options,e);throw Error("Invalid prime generation algorithm: "+g.name);}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prime)return c.prime;c.defined.prime=!0;for(var m=
432
+0;m<e.length;++m)e[m](c);return c.prime}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prime",["require","module","./util","./jsbn","./random"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d,e){var g=a.util.createBuffer();d=Math.ceil(d.n.bitLength()/8);if(b.length>d-11)throw g=
433
Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;h<d;++h)g.putByte(e)}else for(;0<d;){for(var k=0,m=a.random.getBytes(d),h=0;h<d;++h)e=m.charCodeAt(h),0===e?++k:g.putByte(e);d=k}g.putByte(0);g.putBytes(b);return g}function d(b,c,e,g){c=Math.ceil(c.n.bitLength()/8);b=a.util.createBuffer(b);var h=b.getByte(),k=b.getByte();if(0!==h||e&&0!==k&&1!==k||!e&&2!=k||e&&0===k&&"undefined"===
434
typeof g)throw Error("Encryption block is invalid.");e=0;if(0===k)for(e=c-3-g,g=0;g<e;++g){if(0!==b.getByte())throw Error("Encryption block is invalid.");}else if(1===k)for(e=0;1<b.length();){if(255!==b.getByte()){--b.read;break}++e}else if(2===k)for(e=0;1<b.length();){if(0===b.getByte()){--b.read;break}++e}if(0!==b.getByte()||e!==c-3-b.length())throw Error("Encryption block is invalid.");return b.getBytes()}function e(b,c,d){function g(){h(b.pBits,function(a,c){if(a)return d(a);b.p=c;if(null!==b.q)return m(a,
435
b.q);h(b.qBits,m)})}function h(b,c){a.prime.generateProbablePrime(b,l,c)}function m(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var e=b.p;b.p=b.q;b.q=e}0!==b.p.subtract(k.ONE).gcd(b.e).compareTo(k.ONE)?(b.p=null,g()):0!==b.q.subtract(k.ONE).gcd(b.e).compareTo(k.ONE)?(b.q=null,h(b.qBits,m)):(b.p1=b.p.subtract(k.ONE),b.q1=b.q.subtract(k.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(k.ONE)?(b.p=b.q=null,g()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,h(b.qBits,m)):
436
-(e=b.e.modInverse(b.phi),b.keys={privateKey:p.rsa.setPrivateKey(b.n,b.e,e,b.p,b.q,e.mod(b.p1),e.mod(b.q1),b.q.modInverse(b.p)),publicKey:p.rsa.setPublicKey(b.n,b.e)},d(null,b.keys))))}"function"===typeof c&&(d=c,c={});c=c||{};var l={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(l.prng=c.prng);g()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function q(a){return 100>=a?27:
437
-150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if("undefined"===typeof k)var k=a.jsbn.BigInteger;var g=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var p=a.pki,u=[6,4,2,4,2,4,6,2],C={name:"PrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:g.Class.UNIVERSAL,
438
-type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},x={name:"RSAPrivateKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",
436
+(e=b.e.modInverse(b.phi),b.keys={privateKey:n.rsa.setPrivateKey(b.n,b.e,e,b.p,b.q,e.mod(b.p1),e.mod(b.q1),b.q.modInverse(b.p)),publicKey:n.rsa.setPublicKey(b.n,b.e)},d(null,b.keys))))}"function"===typeof c&&(d=c,c={});c=c||{};var l={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(l.prng=c.prng);g()}function l(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function r(a){return 100>=a?27:
437
+150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if("undefined"===typeof k)var k=a.jsbn.BigInteger;var g=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var n=a.pki,u=[6,4,2,4,2,4,6,2],C={name:"PrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:g.Class.UNIVERSAL,
438
+type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},w={name:"RSAPrivateKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",
439
tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",
440
-tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},w={name:"RSAPublicKey",tagClass:g.Class.UNIVERSAL,
441
-type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},F=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,
442
-type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},H=function(a){var b;if(a.algorithm in p.oids)b=p.oids[a.algorithm];
443
-else throw b=Error("Unknown message digest algorithm."),b.algorithm=a.algorithm,b;var c=g.oidToDer(b).getBytes();b=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);var d=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);d.value.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,c));d.value.push(g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,""));a=g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return g.toDer(b).getBytes()},D=function(b,c,d){if(d)return b.modPow(c.e,
440
+tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},y={name:"RSAPublicKey",tagClass:g.Class.UNIVERSAL,
441
+type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},E=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,
442
+type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},I=function(a){var b;if(a.algorithm in n.oids)b=n.oids[a.algorithm];
443
+else throw b=Error("Unknown message digest algorithm."),b.algorithm=a.algorithm,b;var c=g.oidToDer(b).getBytes();b=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);var d=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);d.value.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,c));d.value.push(g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,""));a=g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return g.toDer(b).getBytes()},F=function(b,c,d){if(d)return b.modPow(c.e,
444
c.n);if(!c.p||!c.q)return b.modPow(c.d,c.n);c.dP||(c.dP=c.d.mod(c.p.subtract(k.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(k.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new k(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(k.ONE));b=b.multiply(d.modPow(c.e,c.n)).mod(c.n);var e=b.mod(c.p).modPow(c.dP,c.p);for(b=b.mod(c.q).modPow(c.dQ,c.q);0>e.compareTo(b);)e=e.add(c.p);b=e.subtract(b).multiply(c.qInv).mod(c.p).multiply(c.q).add(b);return b=
445
-b.multiply(d.modInverse(c.n)).mod(c.n)};p.rsa.encrypt=function(b,d,e){var g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new k(e.toHex(),16);d=D(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0<h;)g.putByte(0),--h;g.putBytes(a.util.hexToBytes(d));return g.getBytes()};p.rsa.decrypt=function(b,c,e,g){var h=Math.ceil(c.n.bitLength()/8);if(b.length!==h)throw c=Error("Encrypted message length is invalid."),c.length=
446
-b.length,c.expected=h,c;b=new k(a.util.createBuffer(b).toHex(),16);if(0<=b.compareTo(c.n))throw Error("Encrypted message is invalid.");b=D(b,c,e).toString(16);for(var m=a.util.createBuffer(),h=h-Math.ceil(b.length/2);0<h;)m.putByte(0),--h;m.putBytes(a.util.hexToBytes(b));return!1!==g?d(m.getBytes(),c,e):m.getBytes()};p.rsa.createKeyPairGenerationState=function(b,c,d){"string"===typeof b&&(b=parseInt(b,10));b=b||2048;d=d||{};var e=d.prng||a.random,g={nextBytes:function(a){for(var b=e.getBytesSync(a.length),
447
-c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};d=d.algorithm||"PRIMEINC";if("PRIMEINC"===d)b={algorithm:d,state:0,bits:b,rng:g,eInt:c||65537,e:new k(null),p:null,q:null,qBits:b>>1,pBits:b-(b>>1),pqState:0,num:null,keys:null},b.e.fromInt(b.eInt);else throw Error("Invalid key generation algorithm: "+d);return b};p.rsa.stepKeyPairGenerationState=function(a,b){"algorithm"in a||(a.algorithm="PRIMEINC");var c=new k(null);c.fromInt(30);for(var d=0,e=function(a,b){return a|b},g=+new Date,n,h=0;null===a.keys&&
448
-(0>=b||h<b);){if(0===a.state){n=null===a.p?a.pBits:a.qBits;var m=n-1;0===a.pqState?(a.num=new k(n,a.rng),a.num.testBit(m)||a.num.bitwiseTo(k.ONE.shiftLeft(m),e,a.num),a.num.dAddOffset(31-a.num.mod(c).byteValue(),0),d=0,++a.pqState):1===a.pqState?a.num.bitLength()>n?a.pqState=0:a.num.isProbablePrime(q(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(u[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(k.ONE).gcd(a.e).compareTo(k.ONE)?3:0:3===a.pqState&&(a.pqState=0,null===a.p?a.p=a.num:a.q=a.num,
449
-null!==a.p&&null!==a.q&&++a.state,a.num=null)}else 1===a.state?(0>a.p.compareTo(a.q)&&(a.num=a.p,a.p=a.q,a.q=a.num),++a.state):2===a.state?(a.p1=a.p.subtract(k.ONE),a.q1=a.q.subtract(k.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(k.ONE)?++a.state:(a.p=null,a.q=null,a.state=0):4===a.state?(a.n=a.p.multiply(a.q),a.n.bitLength()===a.bits?++a.state:(a.q=null,a.state=0)):5===a.state&&(n=a.e.modInverse(a.phi),a.keys={privateKey:p.rsa.setPrivateKey(a.n,a.e,n,a.p,a.q,
450
-n.mod(a.p1),n.mod(a.q1),a.q.modInverse(a.p)),publicKey:p.rsa.setPublicKey(a.n,a.e)});n=+new Date;h+=n-g;g=n}return null!==a.keys};p.rsa.generateKeyPair=function(a,b,c,d){1===arguments.length?"object"===typeof a?(c=a,a=void 0):"function"===typeof a&&(d=a,a=void 0):2===arguments.length?"number"===typeof a?"function"===typeof b?(d=b,b=void 0):"number"!==typeof b&&(c=b,b=void 0):(c=a,d=b,b=a=void 0):3===arguments.length&&("number"===typeof b?"function"===typeof c&&(d=c,c=void 0):(d=c,c=b,b=void 0));c=
451
-c||{};void 0===a&&(a=c.bits||2048);void 0===b&&(b=c.e||65537);var g=p.rsa.createKeyPairGenerationState(a,b,c);if(!d)return p.rsa.stepKeyPairGenerationState(g,0),g.keys;e(g,c,d)};p.setRsaPublicKey=p.rsa.setPublicKey=function(b,e){var h={n:b,e:e,encrypt:function(b,d,e){"string"===typeof d?d=d.toUpperCase():void 0===d&&(d="RSAES-PKCS1-V1_5");if("RSAES-PKCS1-V1_5"===d)d={encode:function(a,b,d){return c(a,b,2).getBytes()}};else if("RSA-OAEP"===d||"RSAES-OAEP"===d)d={encode:function(b,c){return a.pkcs1.encode_rsa_oaep(c,
452
-b,e)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(d))d={encode:function(a){return a}};else if("string"===typeof d)throw Error('Unsupported encryption scheme: "'+d+'".');b=d.encode(b,h,!0);return p.rsa.encrypt(b,h,!0)},verify:function(a,b,c){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSASSA-PKCS1-V1_5");if("RSASSA-PKCS1-V1_5"===c)c={verify:function(a,b){b=d(b,h,!0);var c=g.fromDer(b);return a===c.value[1].value}};else if("NONE"===c||"NULL"===c||null===c)c={verify:function(a,b){b=d(b,
453
-h,!0);return a===b}};b=p.rsa.decrypt(b,h,!0,!1);return c.verify(a,b,h.n.bitLength())}};return h};p.setRsaPrivateKey=p.rsa.setPrivateKey=function(b,c,e,g,h,k,m,l){var u={n:b,e:c,d:e,p:g,q:h,dP:k,dQ:m,qInv:l,decrypt:function(b,c,e){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=p.rsa.decrypt(b,u,!1,!1);if("RSAES-PKCS1-V1_5"===c)c={decode:d};else if("RSA-OAEP"===c||"RSAES-OAEP"===c)c={decode:function(b,c){return a.pkcs1.decode_rsa_oaep(c,b,e)}};else if(-1!==["RAW","NONE",
454
-"NULL",null].indexOf(c))c={decode:function(a){return a}};else throw Error('Unsupported encryption scheme: "'+c+'".');return c.decode(b,u,!1)},sign:function(a,b){var c=!1;"string"===typeof b&&(b=b.toUpperCase());if(void 0===b||"RSASSA-PKCS1-V1_5"===b)b={encode:H},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,u.n.bitLength());return p.rsa.encrypt(d,u,c)}};return u};p.wrapRsaPrivateKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,
455
-[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(p.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(a).getBytes())])};p.privateKeyFromAsn1=function(b){var c={},d=[];g.validate(b,C,c,d)&&(b=g.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!g.validate(b,x,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),
456
-c.errors=d,c;var e,h,m,l,u,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();h=a.util.createBuffer(c.privateKeyPrime1).toHex();m=a.util.createBuffer(c.privateKeyPrime2).toHex();l=a.util.createBuffer(c.privateKeyExponent1).toHex();u=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return p.setRsaPrivateKey(new k(d,16),new k(b,
457
-16),new k(e,16),new k(h,16),new k(m,16),new k(l,16),new k(u,16),new k(c,16))};p.privateKeyToAsn1=p.privateKeyToRSAPrivateKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.e)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.d)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.p)),g.create(g.Class.UNIVERSAL,
458
-g.Type.INTEGER,!1,l(a.q)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.dP)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.dQ)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.qInv))])};p.publicKeyFromAsn1=function(b){var c={},d=[];if(g.validate(b,F,c,d)){d=g.derToOid(c.publicKeyOid);if(d!==p.oids.rsaEncryption)throw c=Error("Cannot read public key. Unknown OID."),c.oid=d,c;b=c.rsaPublicKey}d=[];if(!g.validate(b,w,c,d))throw c=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),
459
-c.errors=d,c;d=a.util.createBuffer(c.publicKeyModulus).toHex();c=a.util.createBuffer(c.publicKeyExponent).toHex();return p.setRsaPublicKey(new k(d,16),new k(c,16))};p.publicKeyToAsn1=p.publicKeyToSubjectPublicKeyInfo=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(p.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,
460
-!1,[p.publicKeyToRSAPublicKey(a)])])};p.publicKeyToRSAPublicKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||
461
-{};c.defined=c.defined||{};if(c.defined.rsa)return c.rsa;c.defined.rsa=!0;for(var m=0;m<e.length;++m)e[m](c);return c.rsa}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rsa","require module ./asn1 ./jsbn ./oids ./pkcs1 ./prime ./random ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,
462
-b){return a.start().update(b).digest().getBytes()}if("undefined"===typeof d)var d=a.jsbn.BigInteger;var e=a.asn1,l=a.pki=a.pki||{};l.pbe=a.pbe=a.pbe||{};var q=l.oids,k={name:"EncryptedPrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encryptionOid"},
445
+b.multiply(d.modInverse(c.n)).mod(c.n)};n.rsa.encrypt=function(b,d,e){var g=e,h=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new k(e.toHex(),16);d=F(b,d,g).toString(16);g=a.util.createBuffer();for(h-=Math.ceil(d.length/2);0<h;)g.putByte(0),--h;g.putBytes(a.util.hexToBytes(d));return g.getBytes()};n.rsa.decrypt=function(b,c,e,g){var h=Math.ceil(c.n.bitLength()/8);if(b.length!==h)throw c=Error("Encrypted message length is invalid."),c.length=
446
+b.length,c.expected=h,c;b=new k(a.util.createBuffer(b).toHex(),16);if(0<=b.compareTo(c.n))throw Error("Encrypted message is invalid.");b=F(b,c,e).toString(16);for(var m=a.util.createBuffer(),h=h-Math.ceil(b.length/2);0<h;)m.putByte(0),--h;m.putBytes(a.util.hexToBytes(b));return!1!==g?d(m.getBytes(),c,e):m.getBytes()};n.rsa.createKeyPairGenerationState=function(b,c,d){"string"===typeof b&&(b=parseInt(b,10));b=b||2048;d=d||{};var e=d.prng||a.random,g={nextBytes:function(a){for(var b=e.getBytesSync(a.length),
447
+c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};d=d.algorithm||"PRIMEINC";if("PRIMEINC"===d)b={algorithm:d,state:0,bits:b,rng:g,eInt:c||65537,e:new k(null),p:null,q:null,qBits:b>>1,pBits:b-(b>>1),pqState:0,num:null,keys:null},b.e.fromInt(b.eInt);else throw Error("Invalid key generation algorithm: "+d);return b};n.rsa.stepKeyPairGenerationState=function(a,b){"algorithm"in a||(a.algorithm="PRIMEINC");var c=new k(null);c.fromInt(30);for(var d=0,e=function(a,b){return a|b},g=+new Date,p,h=0;null===a.keys&&
448
+(0>=b||h<b);){if(0===a.state){p=null===a.p?a.pBits:a.qBits;var m=p-1;0===a.pqState?(a.num=new k(p,a.rng),a.num.testBit(m)||a.num.bitwiseTo(k.ONE.shiftLeft(m),e,a.num),a.num.dAddOffset(31-a.num.mod(c).byteValue(),0),d=0,++a.pqState):1===a.pqState?a.num.bitLength()>p?a.pqState=0:a.num.isProbablePrime(r(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(u[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(k.ONE).gcd(a.e).compareTo(k.ONE)?3:0:3===a.pqState&&(a.pqState=0,null===a.p?a.p=a.num:a.q=a.num,
449
+null!==a.p&&null!==a.q&&++a.state,a.num=null)}else 1===a.state?(0>a.p.compareTo(a.q)&&(a.num=a.p,a.p=a.q,a.q=a.num),++a.state):2===a.state?(a.p1=a.p.subtract(k.ONE),a.q1=a.q.subtract(k.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(k.ONE)?++a.state:(a.p=null,a.q=null,a.state=0):4===a.state?(a.n=a.p.multiply(a.q),a.n.bitLength()===a.bits?++a.state:(a.q=null,a.state=0)):5===a.state&&(p=a.e.modInverse(a.phi),a.keys={privateKey:n.rsa.setPrivateKey(a.n,a.e,p,a.p,a.q,
450
+p.mod(a.p1),p.mod(a.q1),a.q.modInverse(a.p)),publicKey:n.rsa.setPublicKey(a.n,a.e)});p=+new Date;h+=p-g;g=p}return null!==a.keys};n.rsa.generateKeyPair=function(a,b,c,d){1===arguments.length?"object"===typeof a?(c=a,a=void 0):"function"===typeof a&&(d=a,a=void 0):2===arguments.length?"number"===typeof a?"function"===typeof b?(d=b,b=void 0):"number"!==typeof b&&(c=b,b=void 0):(c=a,d=b,b=a=void 0):3===arguments.length&&("number"===typeof b?"function"===typeof c&&(d=c,c=void 0):(d=c,c=b,b=void 0));c=
451
+c||{};void 0===a&&(a=c.bits||2048);void 0===b&&(b=c.e||65537);var g=n.rsa.createKeyPairGenerationState(a,b,c);if(!d)return n.rsa.stepKeyPairGenerationState(g,0),g.keys;e(g,c,d)};n.setRsaPublicKey=n.rsa.setPublicKey=function(b,e){var h={n:b,e:e,encrypt:function(b,d,e){"string"===typeof d?d=d.toUpperCase():void 0===d&&(d="RSAES-PKCS1-V1_5");if("RSAES-PKCS1-V1_5"===d)d={encode:function(a,b,d){return c(a,b,2).getBytes()}};else if("RSA-OAEP"===d||"RSAES-OAEP"===d)d={encode:function(b,c){return a.pkcs1.encode_rsa_oaep(c,
452
+b,e)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(d))d={encode:function(a){return a}};else if("string"===typeof d)throw Error('Unsupported encryption scheme: "'+d+'".');b=d.encode(b,h,!0);return n.rsa.encrypt(b,h,!0)},verify:function(a,b,c){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSASSA-PKCS1-V1_5");if("RSASSA-PKCS1-V1_5"===c)c={verify:function(a,b){b=d(b,h,!0);var c=g.fromDer(b);return a===c.value[1].value}};else if("NONE"===c||"NULL"===c||null===c)c={verify:function(a,b){b=d(b,
453
+h,!0);return a===b}};b=n.rsa.decrypt(b,h,!0,!1);return c.verify(a,b,h.n.bitLength())}};return h};n.setRsaPrivateKey=n.rsa.setPrivateKey=function(b,c,e,g,h,k,m,l){var u={n:b,e:c,d:e,p:g,q:h,dP:k,dQ:m,qInv:l,decrypt:function(b,c,e){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=n.rsa.decrypt(b,u,!1,!1);if("RSAES-PKCS1-V1_5"===c)c={decode:d};else if("RSA-OAEP"===c||"RSAES-OAEP"===c)c={decode:function(b,c){return a.pkcs1.decode_rsa_oaep(c,b,e)}};else if(-1!==["RAW","NONE",
454
+"NULL",null].indexOf(c))c={decode:function(a){return a}};else throw Error('Unsupported encryption scheme: "'+c+'".');return c.decode(b,u,!1)},sign:function(a,b){var c=!1;"string"===typeof b&&(b=b.toUpperCase());if(void 0===b||"RSASSA-PKCS1-V1_5"===b)b={encode:I},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,u.n.bitLength());return n.rsa.encrypt(d,u,c)}};return u};n.wrapRsaPrivateKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,
455
+[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(n.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(a).getBytes())])};n.privateKeyFromAsn1=function(b){var c={},d=[];g.validate(b,C,c,d)&&(b=g.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!g.validate(b,w,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),
456
+c.errors=d,c;var e,h,m,l,u,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();h=a.util.createBuffer(c.privateKeyPrime1).toHex();m=a.util.createBuffer(c.privateKeyPrime2).toHex();l=a.util.createBuffer(c.privateKeyExponent1).toHex();u=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return n.setRsaPrivateKey(new k(d,16),new k(b,
457
+16),new k(e,16),new k(h,16),new k(m,16),new k(l,16),new k(u,16),new k(c,16))};n.privateKeyToAsn1=n.privateKeyToRSAPrivateKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.e)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.d)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.p)),g.create(g.Class.UNIVERSAL,
458
+g.Type.INTEGER,!1,l(a.q)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.dP)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.dQ)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.qInv))])};n.publicKeyFromAsn1=function(b){var c={},d=[];if(g.validate(b,E,c,d)){d=g.derToOid(c.publicKeyOid);if(d!==n.oids.rsaEncryption)throw c=Error("Cannot read public key. Unknown OID."),c.oid=d,c;b=c.rsaPublicKey}d=[];if(!g.validate(b,y,c,d))throw c=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),
459
+c.errors=d,c;d=a.util.createBuffer(c.publicKeyModulus).toHex();c=a.util.createBuffer(c.publicKeyExponent).toHex();return n.setRsaPublicKey(new k(d,16),new k(c,16))};n.publicKeyToAsn1=n.publicKeyToSubjectPublicKeyInfo=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(n.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,
460
+!1,[n.publicKeyToRSAPublicKey(a)])])};n.publicKeyToRSAPublicKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,l(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||
461
+{};c.defined=c.defined||{};if(c.defined.rsa)return c.rsa;c.defined.rsa=!0;for(var m=0;m<e.length;++m)e[m](c);return c.rsa}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rsa","require module ./asn1 ./jsbn ./oids ./pkcs1 ./prime ./random ./util".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,
462
+b){return a.start().update(b).digest().getBytes()}if("undefined"===typeof d)var d=a.jsbn.BigInteger;var e=a.asn1,l=a.pki=a.pki||{};l.pbe=a.pbe=a.pbe||{};var r=l.oids,k={name:"EncryptedPrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encryptionOid"},
463
{name:"AlgorithmIdentifier.parameters",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},g={name:"PBES2Algorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",
464
tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,onstructed:!0,capture:"kdfIterationCount"}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:e.Class.UNIVERSAL,
465
-type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},p={name:"pkcs-12PbeParams",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"salt"},
466
-{name:"pkcs-12PbeParams.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"iterations"}]};l.encryptPrivateKeyInfo=function(b,c,d){d=d||{};d.saltSize=d.saltSize||8;d.count=d.count||2048;d.algorithm=d.algorithm||"aes128";var g=a.random.getBytesSync(d.saltSize),k=d.count,m=e.integerToDer(k),p;if(0===d.algorithm.indexOf("aes")||"des"===d.algorithm){var A,y;switch(d.algorithm){case "aes128":A=p=16;d=q["aes128-CBC"];y=a.aes.createEncryptionCipher;break;case "aes192":p=24;
467
-A=16;d=q["aes192-CBC"];y=a.aes.createEncryptionCipher;break;case "aes256":p=32;A=16;d=q["aes256-CBC"];y=a.aes.createEncryptionCipher;break;case "des":A=p=8;d=q.desCBC;y=a.des.createEncryptionCipher;break;default:throw g=Error("Cannot encrypt private key. Unknown encryption algorithm."),g.algorithm=d.algorithm,g;}var E=a.pkcs5.pbkdf2(c,g,k,p);c=a.random.getBytesSync(A);k=y(E);k.start(c);k.update(e.toDer(b));k.finish();b=k.output.getBytes();g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,
468
-e.Type.OID,!1,e.oidToDer(q.pkcs5PBES2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(q.pkcs5PBKDF2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,g),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,m.getBytes())])]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d).getBytes()),e.create(e.Class.UNIVERSAL,
469
-e.Type.OCTETSTRING,!1,c)])])])}else if("3des"===d.algorithm)p=24,d=new a.util.ByteBuffer(g),E=l.pbe.generatePkcs12Key(c,d,1,k,p),c=l.pbe.generatePkcs12Key(c,d,2,k,p),k=a.des.createEncryptionCipher(E),k.start(c),k.update(e.toDer(b)),k.finish(),b=k.output.getBytes(),g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(q["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,
465
+type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},n={name:"pkcs-12PbeParams",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"salt"},
466
+{name:"pkcs-12PbeParams.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"iterations"}]};l.encryptPrivateKeyInfo=function(b,c,d){d=d||{};d.saltSize=d.saltSize||8;d.count=d.count||2048;d.algorithm=d.algorithm||"aes128";var g=a.random.getBytesSync(d.saltSize),k=d.count,m=e.integerToDer(k),n;if(0===d.algorithm.indexOf("aes")||"des"===d.algorithm){var A,z;switch(d.algorithm){case "aes128":A=n=16;d=r["aes128-CBC"];z=a.aes.createEncryptionCipher;break;case "aes192":n=24;
467
+A=16;d=r["aes192-CBC"];z=a.aes.createEncryptionCipher;break;case "aes256":n=32;A=16;d=r["aes256-CBC"];z=a.aes.createEncryptionCipher;break;case "des":A=n=8;d=r.desCBC;z=a.des.createEncryptionCipher;break;default:throw g=Error("Cannot encrypt private key. Unknown encryption algorithm."),g.algorithm=d.algorithm,g;}var D=a.pkcs5.pbkdf2(c,g,k,n);c=a.random.getBytesSync(A);k=z(D);k.start(c);k.update(e.toDer(b));k.finish();b=k.output.getBytes();g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,
468
+e.Type.OID,!1,e.oidToDer(r.pkcs5PBES2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.pkcs5PBKDF2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,g),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,m.getBytes())])]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d).getBytes()),e.create(e.Class.UNIVERSAL,
469
+e.Type.OCTETSTRING,!1,c)])])])}else if("3des"===d.algorithm)n=24,d=new a.util.ByteBuffer(g),D=l.pbe.generatePkcs12Key(c,d,1,k,n),c=l.pbe.generatePkcs12Key(c,d,2,k,n),k=a.des.createEncryptionCipher(D),k.start(c),k.update(e.toDer(b)),k.finish(),b=k.output.getBytes(),g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,
470
!1,g),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,m.getBytes())])]);else throw g=Error("Cannot encrypt private key. Unknown encryption algorithm."),g.algorithm=d.algorithm,g;return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[g,e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,b)])};l.decryptPrivateKeyInfo=function(b,c){var d=null,g={},m=[];if(!e.validate(b,k,g,m))throw d=Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=m,d;m=e.derToOid(g.encryptionOid);
471
m=l.pbe.getCipher(m,g.encryptionParams,c);g=a.util.createBuffer(g.encryptedData);m.update(g);m.finish()&&(d=e.fromDer(m.output));return d};l.encryptedPrivateKeyToPem=function(b,c){var d={type:"ENCRYPTED PRIVATE KEY",body:e.toDer(b).getBytes()};return a.pem.encode(d,{maxline:c})};l.encryptedPrivateKeyFromPem=function(b){b=a.pem.decode(b)[0];if("ENCRYPTED PRIVATE KEY"!==b.type){var c=Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');c.headerType=
472
b.type;throw c;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return e.fromDer(b.body)};l.encryptRsaPrivateKey=function(b,c,d){d=d||{};if(!d.legacy)return b=l.wrapRsaPrivateKey(l.privateKeyToAsn1(b)),b=l.encryptPrivateKeyInfo(b,c,d),l.encryptedPrivateKeyToPem(b);var g,k,m;switch(d.algorithm){case "aes128":d="AES-128-CBC";k=16;g=a.random.getBytesSync(16);m=a.aes.createEncryptionCipher;break;case "aes192":d="AES-192-CBC";
473
k=24;g=a.random.getBytesSync(16);m=a.aes.createEncryptionCipher;break;case "aes256":d="AES-256-CBC";k=32;g=a.random.getBytesSync(16);m=a.aes.createEncryptionCipher;break;case "3des":d="DES-EDE3-CBC";k=24;g=a.random.getBytesSync(8);m=a.des.createEncryptionCipher;break;case "des":d="DES-CBC";k=8;g=a.random.getBytesSync(8);m=a.des.createEncryptionCipher;break;default:throw b=Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+d.algorithm+'".'),b.algorithm=d.algorithm,b;}c=a.pbe.opensslDeriveBytes(c,
474
g.substr(0,8),k);c=m(c);c.start(g);c.update(e.toDer(l.privateKeyToAsn1(b)));c.finish();b={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:d,parameters:a.util.bytesToHex(g).toUpperCase()},body:c.output.getBytes()};return a.pem.encode(b)};l.decryptRsaPrivateKey=function(b,c){var d=null,g=a.pem.decode(b)[0];if("ENCRYPTED PRIVATE KEY"!==g.type&&"PRIVATE KEY"!==g.type&&"RSA PRIVATE KEY"!==g.type)throw d=Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".'),
475
d.headerType=d,d;if(g.procType&&"ENCRYPTED"===g.procType.type){var k,m;switch(g.dekInfo.algorithm){case "DES-CBC":k=8;m=a.des.createDecryptionCipher;break;case "DES-EDE3-CBC":k=24;m=a.des.createDecryptionCipher;break;case "AES-128-CBC":k=16;m=a.aes.createDecryptionCipher;break;case "AES-192-CBC":k=24;m=a.aes.createDecryptionCipher;break;case "AES-256-CBC":k=32;m=a.aes.createDecryptionCipher;break;case "RC2-40-CBC":k=5;m=function(b){return a.rc2.createDecryptionCipher(b,40)};break;case "RC2-64-CBC":k=
476
-8;m=function(b){return a.rc2.createDecryptionCipher(b,64)};break;case "RC2-128-CBC":k=16;m=function(b){return a.rc2.createDecryptionCipher(b,128)};break;default:throw d=Error('Could not decrypt private key; unsupported encryption algorithm "'+g.dekInfo.algorithm+'".'),d.algorithm=g.dekInfo.algorithm,d;}var q=a.util.hexToBytes(g.dekInfo.parameters);k=a.pbe.opensslDeriveBytes(c,q.substr(0,8),k);m=m(k);m.start(q);m.update(a.util.createBuffer(g.body));if(m.finish())d=m.output.getBytes();else return d}else d=
477
-g.body;d="ENCRYPTED PRIVATE KEY"===g.type?l.decryptPrivateKeyInfo(e.fromDer(d),c):e.fromDer(d);null!==d&&(d=l.privateKeyFromAsn1(d));return d};l.pbe.generatePkcs12Key=function(b,c,d,e,g,h){var k,m;if("undefined"===typeof h||null===h)h=a.md.sha1.create();var y=h.digestLength,l=h.blockLength,q=new a.util.ByteBuffer,p=new a.util.ByteBuffer;if(null!==b&&void 0!==b){for(m=0;m<b.length;m++)p.putInt16(b.charCodeAt(m));p.putInt16(0)}b=p.length();var r=c.length(),v=new a.util.ByteBuffer;v.fillWithByte(d,l);
478
-var z=l*Math.ceil(r/l);d=new a.util.ByteBuffer;for(m=0;m<z;m++)d.putByte(c.at(m%r));z=l*Math.ceil(b/l);c=new a.util.ByteBuffer;for(m=0;m<z;m++)c.putByte(p.at(m%b));p=d;p.putBuffer(c);c=Math.ceil(g/y);for(d=1;d<=c;d++){z=new a.util.ByteBuffer;z.putBytes(v.bytes());z.putBytes(p.bytes());for(m=0;m<e;m++)h.start(),h.update(z.getBytes()),z=h.digest();var B=new a.util.ByteBuffer;for(m=0;m<l;m++)B.putByte(z.at(m%y));var J=Math.ceil(r/l)+Math.ceil(b/l),R=new a.util.ByteBuffer;for(k=0;k<J;k++){var S=new a.util.ByteBuffer(p.getBytes(l)),
479
-V=511;for(m=B.length()-1;0<=m;m--)V>>=8,V+=B.at(m)+S.at(m),S.setAt(m,V&255);R.putBuffer(S)}p=R;q.putBuffer(z)}q.truncate(q.length()-g);return q};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.pbe.getCipherForPKCS12PBE(a,b,c);default:throw b=Error("Cannot read encrypted PBE data block. Unsupported OID."),b.oid=a,b.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC",
476
+8;m=function(b){return a.rc2.createDecryptionCipher(b,64)};break;case "RC2-128-CBC":k=16;m=function(b){return a.rc2.createDecryptionCipher(b,128)};break;default:throw d=Error('Could not decrypt private key; unsupported encryption algorithm "'+g.dekInfo.algorithm+'".'),d.algorithm=g.dekInfo.algorithm,d;}var r=a.util.hexToBytes(g.dekInfo.parameters);k=a.pbe.opensslDeriveBytes(c,r.substr(0,8),k);m=m(k);m.start(r);m.update(a.util.createBuffer(g.body));if(m.finish())d=m.output.getBytes();else return d}else d=
477
+g.body;d="ENCRYPTED PRIVATE KEY"===g.type?l.decryptPrivateKeyInfo(e.fromDer(d),c):e.fromDer(d);null!==d&&(d=l.privateKeyFromAsn1(d));return d};l.pbe.generatePkcs12Key=function(b,c,d,e,g,h){var k,m;if("undefined"===typeof h||null===h)h=a.md.sha1.create();var z=h.digestLength,l=h.blockLength,r=new a.util.ByteBuffer,n=new a.util.ByteBuffer;if(null!==b&&void 0!==b){for(m=0;m<b.length;m++)n.putInt16(b.charCodeAt(m));n.putInt16(0)}b=n.length();var q=c.length(),v=new a.util.ByteBuffer;v.fillWithByte(d,l);
478
+var x=l*Math.ceil(q/l);d=new a.util.ByteBuffer;for(m=0;m<x;m++)d.putByte(c.at(m%q));x=l*Math.ceil(b/l);c=new a.util.ByteBuffer;for(m=0;m<x;m++)c.putByte(n.at(m%b));n=d;n.putBuffer(c);c=Math.ceil(g/z);for(d=1;d<=c;d++){x=new a.util.ByteBuffer;x.putBytes(v.bytes());x.putBytes(n.bytes());for(m=0;m<e;m++)h.start(),h.update(x.getBytes()),x=h.digest();var B=new a.util.ByteBuffer;for(m=0;m<l;m++)B.putByte(x.at(m%z));var K=Math.ceil(q/l)+Math.ceil(b/l),P=new a.util.ByteBuffer;for(k=0;k<K;k++){var S=new a.util.ByteBuffer(n.getBytes(l)),
479
+ca=511;for(m=B.length()-1;0<=m;m--)ca>>=8,ca+=B.at(m)+S.at(m),S.setAt(m,ca&255);P.putBuffer(S)}n=P;r.putBuffer(x)}r.truncate(r.length()-g);return r};l.pbe.getCipher=function(a,b,c){switch(a){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(a,b,c);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.pbe.getCipherForPKCS12PBE(a,b,c);default:throw b=Error("Cannot read encrypted PBE data block. Unsupported OID."),b.oid=a,b.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC",
480
"pbewithSHAAnd40BitRC2-CBC"],b;}};l.pbe.getCipherForPBES2=function(b,c,d){var k={};b=[];if(!e.validate(c,g,k,b)){var m=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");m.errors=b;throw m;}b=e.derToOid(k.kdfOid);if(b!==l.oids.pkcs5PBKDF2)throw m=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),m.oid=b,m.supportedOids=["pkcs5PBKDF2"],m;b=e.derToOid(k.encOid);if(b!==l.oids["aes128-CBC"]&&
481
-b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw m=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),m.oid=b,m.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],m;c=k.kdfSalt;var q=a.util.createBuffer(k.kdfIterationCount),q=q.getInt(q.length()<<3),p;switch(l.oids[b]){case "aes128-CBC":p=16;m=a.aes.createDecryptionCipher;break;case "aes192-CBC":p=24;m=a.aes.createDecryptionCipher;break;
482
-case "aes256-CBC":p=32;m=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":p=24;m=a.des.createDecryptionCipher;break;case "desCBC":p=8,m=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,q,p);k=k.encIv;m=m(b);m.start(k);return m};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var g={},k=[];if(!e.validate(c,p,g,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(g.salt),g=a.util.createBuffer(g.iterations),
481
+b!==l.oids["aes192-CBC"]&&b!==l.oids["aes256-CBC"]&&b!==l.oids["des-EDE3-CBC"]&&b!==l.oids.desCBC)throw m=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),m.oid=b,m.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],m;c=k.kdfSalt;var r=a.util.createBuffer(k.kdfIterationCount),r=r.getInt(r.length()<<3),n;switch(l.oids[b]){case "aes128-CBC":n=16;m=a.aes.createDecryptionCipher;break;case "aes192-CBC":n=24;m=a.aes.createDecryptionCipher;break;
482
+case "aes256-CBC":n=32;m=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":n=24;m=a.des.createDecryptionCipher;break;case "desCBC":n=8,m=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,r,n);k=k.encIv;m=m(b);m.start(k);return m};l.pbe.getCipherForPKCS12PBE=function(b,c,d){var g={},k=[];if(!e.validate(c,n,g,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=a.util.createBuffer(g.salt),g=a.util.createBuffer(g.iterations),
483
g=g.getInt(g.length()<<3),m;switch(b){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:m=24;c=8;b=a.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:m=5;c=8;b=function(b,c){var d=a.rc2.createDecryptionCipher(b,40);d.start(c,null);return d};break;default:throw d=Error("Cannot read PKCS #12 PBE data block. Unsupported OID."),d.oid=b,d;}m=l.pbe.generatePkcs12Key(d,k,1,g,m);d=l.pbe.generatePkcs12Key(d,k,2,g,c);return b(m,d)};l.pbe.opensslDeriveBytes=function(b,d,e,g){if("undefined"===
484
-typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k<e;++l,k+=16)h.push(c(g,h[l-1]+b+d));return h.join("").substr(0,e)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pbe)return c.pbe;c.defined.pbe=!0;for(var m=
485
-0;m<e.length;++m)e[m](c);return c.pbe}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbe","require module ./aes ./asn1 ./des ./md ./oids ./pem ./pbkdf2 ./random ./rc2 ./rsa ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1,d=a.pkcs7asn1=a.pkcs7asn1||{};a.pkcs7=
484
+typeof g||null===g)g=a.md.md5.create();null===d&&(d="");for(var h=[c(g,b+d)],k=16,l=1;k<e;++l,k+=16)h.push(c(g,h[l-1]+b+d));return h.join("").substr(0,e)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pbe)return c.pbe;c.defined.pbe=!0;for(var m=
485
+0;m<e.length;++m)e[m](c);return c.pbe}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbe","require module ./aes ./asn1 ./des ./md ./oids ./pem ./pbkdf2 ./random ./rc2 ./rsa ./util".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1,d=a.pkcs7asn1=a.pkcs7asn1||{};a.pkcs7=
486
a.pkcs7||{};a.pkcs7.asn1=d;a={name:"ContentInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:c.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};d.contentInfoValidator=a;var e={name:"EncryptedContentInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",
487
tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:c.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",
488
tagClass:c.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};d.envelopedDataValidator={name:"EnvelopedData",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:c.Class.UNIVERSAL,type:c.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(e)};d.encryptedDataValidator={name:"EncryptedData",
@@ -493,117 +493,117 @@ value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,t
493
constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:c.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]}]}]};d.recipientInfoValidator={name:"RecipientInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,
494
constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,
495
value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:c.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
496
-typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7asn1)return c.pkcs7asn1;c.defined.pkcs7asn1=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pkcs7asn1}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs7asn1",
497
-["require","module","./asn1","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.mgf=a.mgf||{};(a.mgf.mgf1=a.mgf1=a.mgf1||{}).create=function(b){return{generate:function(c,d){for(var e=new a.util.ByteBuffer,l=Math.ceil(d/b.digestLength),k=0;k<l;k++){var g=new a.util.ByteBuffer;g.putInt32(k);b.start();b.update(c+g.getBytes());e.putBuffer(b.digest())}e.truncate(e.length()-d);return e.getBytes()}}}}if("function"!==typeof a)if("object"===typeof module&&
498
-module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.mgf1)return c.mgf1;c.defined.mgf1=!0;for(var m=0;m<e.length;++m)e[m](c);return c.mgf1}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,
499
-Array.prototype.slice.call(arguments,0))};a("js/mgf1",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.mgf=a.mgf||{};a.mgf.mgf1=a.mgf1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
500
-{};if(c.defined.mgf)return c.mgf;c.defined.mgf=!0;for(var m=0;m<e.length;++m)e[m](c);return c.mgf}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/mgf",["require","module","./mgf1"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.pss=a.pss||{}).create=function(b){3===arguments.length&&
501
-(b={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var c=b.md,d=b.mgf,e=c.digestLength,l=b.salt||null;"string"===typeof l&&(l=a.util.createBuffer(l));var k;if("saltLength"in b)k=b.saltLength;else if(null!==l)k=l.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==l&&l.length()!==k)throw Error("Given salt length does not match length of given salt.");var g=b.prng||a.random;return{encode:function(b,m){var q,p=m-1,w=Math.ceil(p/8),F=b.digest().getBytes();
502
-if(w<e+k+2)throw Error("Message is too long to encrypt.");var H;H=null===l?g.getBytesSync(k):l.bytes();q=new a.util.ByteBuffer;q.fillWithByte(0,8);q.putBytes(F);q.putBytes(H);c.start();c.update(q.getBytes());F=c.digest().getBytes();q=new a.util.ByteBuffer;q.fillWithByte(0,w-k-e-2);q.putByte(1);q.putBytes(H);var D=q.getBytes(),A=w-e-1,y=d.generate(F,A);H="";for(q=0;q<A;q++)H+=String.fromCharCode(D.charCodeAt(q)^y.charCodeAt(q));p=65280>>8*w-p&255;H=String.fromCharCode(H.charCodeAt(0)&~p)+H.substr(1);
503
-return H+F+String.fromCharCode(188)},verify:function(b,g,m){var l;l=m-1;m=Math.ceil(l/8);g=g.substr(-m);if(m<e+k+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==g.charCodeAt(m-1))throw Error("Encoded message does not end in 0xBC.");var q=m-e-1,p=g.substr(0,q);g=g.substr(q,e);var H=65280>>8*m-l&255;if(0!==(p.charCodeAt(0)&H))throw Error("Bits beyond keysize not zero as expected.");var D=d.generate(g,q),A="";for(l=0;l<q;l++)A+=String.fromCharCode(p.charCodeAt(l)^D.charCodeAt(l));
504
-A=String.fromCharCode(A.charCodeAt(0)&~H)+A.substr(1);m=m-e-k-2;for(l=0;l<m;l++)if(0!==A.charCodeAt(l))throw Error("Leftmost octets not zero as expected");if(1!==A.charCodeAt(m))throw Error("Inconsistent PSS signature, 0x01 marker not found");m=A.substr(-k);q=new a.util.ByteBuffer;q.fillWithByte(0,8);q.putBytes(b);q.putBytes(m);c.start();c.update(q.getBytes());b=c.digest().getBytes();return g===b}}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,
505
-module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pss)return c.pss;c.defined.pss=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pss}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pss",
506
-["require","module","./random","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b){"string"===typeof b&&(b={shortName:b});for(var d=null,e,g=0;null===d&&g<a.attributes.length;++g)e=a.attributes[g],b.type&&b.type===e.type?d=e:b.name&&b.name===e.name?d=e:b.shortName&&b.shortName===e.shortName&&(d=e);return d}function d(b){var c=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),e;b=b.attributes;for(var k=0;k<b.length;++k){e=b[k];
507
-var h=e.value,m=g.Type.PRINTABLESTRING;"valueTagClass"in e&&(m=e.valueTagClass,m===g.Type.UTF8&&(h=a.util.encodeUtf8(h)));e=g.create(g.Class.UNIVERSAL,g.Type.SET,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(e.type).getBytes()),g.create(g.Class.UNIVERSAL,m,!1,h)])]);c.value.push(e)}return c}function e(a){for(var b,c=0;c<a.length;++c){b=a[c];"undefined"===typeof b.name&&(b.type&&b.type in p.oids?b.name=p.oids[b.type]:b.shortName&&b.shortName in
508
-C&&(b.name=p.oids[C[b.shortName]]));if("undefined"===typeof b.type)if(b.name&&b.name in p.oids)b.type=p.oids[b.name];else throw a=Error("Attribute type not specified."),a.attribute=b,a;"undefined"===typeof b.shortName&&b.name&&b.name in C&&(b.shortName=C[b.name]);if(b.type===u.extensionRequest&&(b.valueConstructed=!0,b.valueTagClass=g.Type.SEQUENCE,!b.value&&b.extensions)){b.value=[];for(var d=0;d<b.extensions.length;++d)b.value.push(p.certificateExtensionToAsn1(l(b.extensions[d])))}if("undefined"===
509
-typeof b.value)throw a=Error("Attribute value not specified."),a.attribute=b,a;}}function l(b,c){c=c||{};"undefined"===typeof b.name&&b.id&&b.id in p.oids&&(b.name=p.oids[b.id]);if("undefined"===typeof b.id)if(b.name&&b.name in p.oids)b.id=p.oids[b.name];else{var d=Error("Extension ID not specified.");d.extension=b;throw d;}if("undefined"!==typeof b.value)return b;if("keyUsage"===b.name){var e=d=0,k=0;b.digitalSignature&&(e|=128,d=7);b.nonRepudiation&&(e|=64,d=6);b.keyEncipherment&&(e|=32,d=5);b.dataEncipherment&&
496
+typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7asn1)return c.pkcs7asn1;c.defined.pkcs7asn1=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pkcs7asn1}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs7asn1",
497
+["require","module","./asn1","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.mgf=a.mgf||{};(a.mgf.mgf1=a.mgf1=a.mgf1||{}).create=function(b){return{generate:function(c,d){for(var e=new a.util.ByteBuffer,l=Math.ceil(d/b.digestLength),k=0;k<l;k++){var g=new a.util.ByteBuffer;g.putInt32(k);b.start();b.update(c+g.getBytes());e.putBuffer(b.digest())}e.truncate(e.length()-d);return e.getBytes()}}}}if("function"!==typeof a)if("object"===typeof module&&
498
+module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.mgf1)return c.mgf1;c.defined.mgf1=!0;for(var m=0;m<e.length;++m)e[m](c);return c.mgf1}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,
499
+Array.prototype.slice.call(arguments,0))};a("js/mgf1",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.mgf=a.mgf||{};a.mgf.mgf1=a.mgf1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
500
+{};if(c.defined.mgf)return c.mgf;c.defined.mgf=!0;for(var m=0;m<e.length;++m)e[m](c);return c.mgf}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/mgf",["require","module","./mgf1"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.pss=a.pss||{}).create=function(b){3===arguments.length&&
501
+(b={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var c=b.md,d=b.mgf,e=c.digestLength,l=b.salt||null;"string"===typeof l&&(l=a.util.createBuffer(l));var k;if("saltLength"in b)k=b.saltLength;else if(null!==l)k=l.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==l&&l.length()!==k)throw Error("Given salt length does not match length of given salt.");var g=b.prng||a.random;return{encode:function(b,m){var r,n=m-1,y=Math.ceil(n/8),E=b.digest().getBytes();
502
+if(y<e+k+2)throw Error("Message is too long to encrypt.");var I;I=null===l?g.getBytesSync(k):l.bytes();r=new a.util.ByteBuffer;r.fillWithByte(0,8);r.putBytes(E);r.putBytes(I);c.start();c.update(r.getBytes());E=c.digest().getBytes();r=new a.util.ByteBuffer;r.fillWithByte(0,y-k-e-2);r.putByte(1);r.putBytes(I);var F=r.getBytes(),A=y-e-1,z=d.generate(E,A);I="";for(r=0;r<A;r++)I+=String.fromCharCode(F.charCodeAt(r)^z.charCodeAt(r));n=65280>>8*y-n&255;I=String.fromCharCode(I.charCodeAt(0)&~n)+I.substr(1);
503
+return I+E+String.fromCharCode(188)},verify:function(b,g,m){var l;l=m-1;m=Math.ceil(l/8);g=g.substr(-m);if(m<e+k+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==g.charCodeAt(m-1))throw Error("Encoded message does not end in 0xBC.");var r=m-e-1,n=g.substr(0,r);g=g.substr(r,e);var I=65280>>8*m-l&255;if(0!==(n.charCodeAt(0)&I))throw Error("Bits beyond keysize not zero as expected.");var F=d.generate(g,r),A="";for(l=0;l<r;l++)A+=String.fromCharCode(n.charCodeAt(l)^F.charCodeAt(l));
504
+A=String.fromCharCode(A.charCodeAt(0)&~I)+A.substr(1);m=m-e-k-2;for(l=0;l<m;l++)if(0!==A.charCodeAt(l))throw Error("Leftmost octets not zero as expected");if(1!==A.charCodeAt(m))throw Error("Inconsistent PSS signature, 0x01 marker not found");m=A.substr(-k);r=new a.util.ByteBuffer;r.fillWithByte(0,8);r.putBytes(b);r.putBytes(m);c.start();c.update(r.getBytes());b=c.digest().getBytes();return g===b}}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,
505
+module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pss)return c.pss;c.defined.pss=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pss}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pss",
506
+["require","module","./random","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b){"string"===typeof b&&(b={shortName:b});for(var d=null,e,g=0;null===d&&g<a.attributes.length;++g)e=a.attributes[g],b.type&&b.type===e.type?d=e:b.name&&b.name===e.name?d=e:b.shortName&&b.shortName===e.shortName&&(d=e);return d}function d(b){var c=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),e;b=b.attributes;for(var k=0;k<b.length;++k){e=b[k];
507
+var h=e.value,m=g.Type.PRINTABLESTRING;"valueTagClass"in e&&(m=e.valueTagClass,m===g.Type.UTF8&&(h=a.util.encodeUtf8(h)));e=g.create(g.Class.UNIVERSAL,g.Type.SET,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(e.type).getBytes()),g.create(g.Class.UNIVERSAL,m,!1,h)])]);c.value.push(e)}return c}function e(a){for(var b,c=0;c<a.length;++c){b=a[c];"undefined"===typeof b.name&&(b.type&&b.type in n.oids?b.name=n.oids[b.type]:b.shortName&&b.shortName in
508
+C&&(b.name=n.oids[C[b.shortName]]));if("undefined"===typeof b.type)if(b.name&&b.name in n.oids)b.type=n.oids[b.name];else throw a=Error("Attribute type not specified."),a.attribute=b,a;"undefined"===typeof b.shortName&&b.name&&b.name in C&&(b.shortName=C[b.name]);if(b.type===u.extensionRequest&&(b.valueConstructed=!0,b.valueTagClass=g.Type.SEQUENCE,!b.value&&b.extensions)){b.value=[];for(var d=0;d<b.extensions.length;++d)b.value.push(n.certificateExtensionToAsn1(l(b.extensions[d])))}if("undefined"===
509
+typeof b.value)throw a=Error("Attribute value not specified."),a.attribute=b,a;}}function l(b,c){c=c||{};"undefined"===typeof b.name&&b.id&&b.id in n.oids&&(b.name=n.oids[b.id]);if("undefined"===typeof b.id)if(b.name&&b.name in n.oids)b.id=n.oids[b.name];else{var d=Error("Extension ID not specified.");d.extension=b;throw d;}if("undefined"!==typeof b.value)return b;if("keyUsage"===b.name){var e=d=0,k=0;b.digitalSignature&&(e|=128,d=7);b.nonRepudiation&&(e|=64,d=6);b.keyEncipherment&&(e|=32,d=5);b.dataEncipherment&&
510
(e|=16,d=4);b.keyAgreement&&(e|=8,d=3);b.keyCertSign&&(e|=4,d=2);b.cRLSign&&(e|=2,d=1);b.encipherOnly&&(e|=1,d=0);b.decipherOnly&&(k|=128,d=7);d=String.fromCharCode(d);0!==k?d+=String.fromCharCode(e)+String.fromCharCode(k):0!==e&&(d+=String.fromCharCode(e));b.value=g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,d)}else if("basicConstraints"===b.name)b.value=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),b.cA&&b.value.value.push(g.create(g.Class.UNIVERSAL,g.Type.BOOLEAN,!1,String.fromCharCode(255))),
511
"pathLenConstraint"in b&&b.value.value.push(g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(b.pathLenConstraint).getBytes()));else if("extKeyUsage"===b.name)for(e in b.value=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),d=b.value.value,b)!0===b[e]&&(e in u?d.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(u[e]).getBytes())):-1!==e.indexOf(".")&&d.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(e).getBytes())));else if("nsCertType"===b.name)e=d=0,b.client&&(e|=128,
512
d=7),b.server&&(e|=64,d=6),b.email&&(e|=32,d=5),b.objsign&&(e|=16,d=4),b.reserved&&(e|=8,d=3),b.sslCA&&(e|=4,d=2),b.emailCA&&(e|=2,d=1),b.objCA&&(e|=1,d=0),d=String.fromCharCode(d),0!==e&&(d+=String.fromCharCode(e)),b.value=g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,d);else if("subjectAltName"===b.name||"issuerAltName"===b.name)for(b.value=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),k=0;k<b.altNames.length;++k){e=b.altNames[k];d=e.value;if(7===e.type&&e.ip){if(d=a.util.bytesFromIP(e.ip),
513
null===d)throw d=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.'),d.extension=b,d;}else 8===e.type&&(d=e.oid?g.oidToDer(g.oidToDer(e.oid)):g.oidToDer(d));b.value.value.push(g.create(g.Class.CONTEXT_SPECIFIC,e.type,!1,d))}else"subjectKeyIdentifier"===b.name&&c.cert&&(d=c.cert.generateSubjectKeyIdentifier(),b.subjectKeyIdentifier=d.toHex(),b.value=g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,d.getBytes()));if("undefined"===typeof b.value)throw d=Error("Extension value not specified."),
514
-d.extension=b,d;return b}function q(a,b){switch(a){case u["RSASSA-PSS"]:var c=[];void 0!==b.hash.algorithmOid&&c.push(g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(b.hash.algorithmOid).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")])]));void 0!==b.mgf.algorithmOid&&c.push(g.create(g.Class.CONTEXT_SPECIFIC,1,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,
514
+d.extension=b,d;return b}function r(a,b){switch(a){case u["RSASSA-PSS"]:var c=[];void 0!==b.hash.algorithmOid&&c.push(g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(b.hash.algorithmOid).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")])]));void 0!==b.mgf.algorithmOid&&c.push(g.create(g.Class.CONTEXT_SPECIFIC,1,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,
515
!1,g.oidToDer(b.mgf.algorithmOid).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(b.mgf.hash.algorithmOid).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")])])]));void 0!==b.saltLength&&c.push(g.create(g.Class.CONTEXT_SPECIFIC,2,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(b.saltLength).getBytes())]));return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,c);default:return g.create(g.Class.UNIVERSAL,g.Type.NULL,
516
!1,"")}}function k(b){var c=g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===b.attributes.length)return c;b=b.attributes;for(var d=0;d<b.length;++d){var e=b[d],k=e.value,h=g.Type.UTF8;"valueTagClass"in e&&(h=e.valueTagClass);h===g.Type.UTF8&&(k=a.util.encodeUtf8(k));var m=!1;"valueConstructed"in e&&(m=e.valueConstructed);e=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(e.type).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SET,!0,[g.create(g.Class.UNIVERSAL,
517
-h,m,k)])]);c.value.push(e)}return c}var g=a.asn1,p=a.pki=a.pki||{},u=p.oids,C={};C.CN=u.commonName;C.commonName="CN";C.C=u.countryName;C.countryName="C";C.L=u.localityName;C.localityName="L";C.ST=u.stateOrProvinceName;C.stateOrProvinceName="ST";C.O=u.organizationName;C.organizationName="O";C.OU=u.organizationalUnitName;C.organizationalUnitName="OU";C.E=u.emailAddress;C.emailAddress="E";var x=a.pki.rsa.publicKeyValidator,w={name:"Certificate",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,
517
+h,m,k)])]);c.value.push(e)}return c}var g=a.asn1,n=a.pki=a.pki||{},u=n.oids,C={};C.CN=u.commonName;C.commonName="CN";C.C=u.countryName;C.countryName="C";C.L=u.localityName;C.localityName="L";C.ST=u.stateOrProvinceName;C.stateOrProvinceName="ST";C.O=u.organizationName;C.organizationName="O";C.OU=u.organizationalUnitName;C.organizationalUnitName="OU";C.E=u.emailAddress;C.emailAddress="E";var w=a.pki.rsa.publicKeyValidator,y={name:"Certificate",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,
518
value:[{name:"Certificate.TBSCertificate",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,
519
capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:g.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,
520
constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:g.Class.UNIVERSAL,type:g.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:g.Class.UNIVERSAL,type:g.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},
521
-{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:g.Class.UNIVERSAL,type:g.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:g.Class.UNIVERSAL,type:g.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},x,{name:"Certificate.TBSCertificate.issuerUniqueID",
521
+{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:g.Class.UNIVERSAL,type:g.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:g.Class.UNIVERSAL,type:g.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},w,{name:"Certificate.TBSCertificate.issuerUniqueID",
522
tagClass:g.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,capture:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:g.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,capture:"certSubjectUniqueId"}]},
523
{name:"Certificate.TBSCertificate.extensions",tagClass:g.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:g.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},
524
-{name:"Certificate.signatureValue",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,capture:"certSignature"}]},F={name:"rsapss",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,type:g.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,
524
+{name:"Certificate.signatureValue",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,capture:"certSignature"}]},E={name:"rsapss",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,type:g.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,
525
type:g.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:g.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,type:g.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:g.Class.UNIVERSAL,
526
type:g.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:g.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:g.Class.UNIVERSAL,type:g.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:g.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",
527
-tagClass:g.Class.UNIVERSAL,type:g.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},H={name:"CertificationRequest",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[{name:"CertificationRequestInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",
528
-tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},x,{name:"CertificationRequestInfo.attributes",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",
527
+tagClass:g.Class.UNIVERSAL,type:g.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},I={name:"CertificationRequest",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[{name:"CertificationRequestInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",
528
+tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},w,{name:"CertificationRequestInfo.attributes",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",
529
tagClass:g.Class.UNIVERSAL,type:g.Type.SET,constructed:!0}]}]}]},{name:"CertificationRequest.signatureAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:g.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:g.Class.UNIVERSAL,
530
-type:g.Type.BITSTRING,constructed:!1,capture:"csrSignature"}]};p.RDNAttributesAsArray=function(a,b){for(var c=[],d,e,n,k=0;k<a.value.length;++k){d=a.value[k];for(var h=0;h<d.value.length;++h)n={},e=d.value[h],n.type=g.derToOid(e.value[0].value),n.value=e.value[1].value,n.valueTagClass=e.value[1].type,n.type in u&&(n.name=u[n.type],n.name in C&&(n.shortName=C[n.name])),b&&(b.update(n.type),b.update(n.value)),c.push(n)}return c};p.CRIAttributesAsArray=function(a){for(var b=[],c=0;c<a.length;++c)for(var d=
531
-a[c],e=g.derToOid(d.value[0].value),d=d.value[1].value,n=0;n<d.length;++n){var k={};k.type=e;k.value=d[n].value;k.valueTagClass=d[n].type;k.type in u&&(k.name=u[k.type],k.name in C&&(k.shortName=C[k.name]));if(k.type===u.extensionRequest){k.extensions=[];for(var h=0;h<k.value.length;++h)k.extensions.push(p.certificateExtensionFromAsn1(k.value[h]))}b.push(k)}return b};var D=function(a,b,c){var d={};if(a!==u["RSASSA-PSS"])return d;c&&(d={hash:{algorithmOid:u.sha1},mgf:{algorithmOid:u.mgf1,hash:{algorithmOid:u.sha1}},
532
-saltLength:20});c={};a=[];if(!g.validate(b,F,c,a))throw b=Error("Cannot read RSASSA-PSS parameter block."),b.errors=a,b;void 0!==c.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=g.derToOid(c.hashOid));void 0!==c.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=g.derToOid(c.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=g.derToOid(c.maskGenHashOid));void 0!==c.saltLength&&(d.saltLength=c.saltLength.charCodeAt(0));return d};p.certificateFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE"!==
533
-b.type&&"X509 CERTIFICATE"!==b.type&&"TRUSTED CERTIFICATE"!==b.type)throw c=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'),c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");d=g.fromDer(b.body,d);return p.certificateFromAsn1(d,c)};p.certificateToPem=function(b,c){var d={type:"CERTIFICATE",body:g.toDer(p.certificateToAsn1(b)).getBytes()};
534
-return a.pem.encode(d,{maxline:c})};p.publicKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PUBLIC KEY"!==b.type&&"RSA PUBLIC KEY"!==b.type){var c=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");b=g.fromDer(b.body);return p.publicKeyFromAsn1(b)};p.publicKeyToPem=function(b,c){var d={type:"PUBLIC KEY",
535
-body:g.toDer(p.publicKeyToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};p.publicKeyToRSAPublicKeyPem=function(b,c){var d={type:"RSA PUBLIC KEY",body:g.toDer(p.publicKeyToRSAPublicKey(b)).getBytes()};return a.pem.encode(d,{maxline:c})};p.getPublicKeyFingerprint=function(b,c){c=c||{};var d=c.md||a.md.sha1.create(),e;switch(c.type||"RSAPublicKey"){case "RSAPublicKey":e=g.toDer(p.publicKeyToRSAPublicKey(b)).getBytes();break;case "SubjectPublicKeyInfo":e=g.toDer(p.publicKeyToAsn1(b)).getBytes();
536
-break;default:throw Error('Unknown fingerprint type "'+c.type+'".');}d.start();d.update(e);d=d.digest();if("hex"===c.encoding)return d=d.toHex(),c.delimiter?d.match(/.{2}/g).join(c.delimiter):d;if("binary"===c.encoding)return d.getBytes();if(c.encoding)throw Error('Unknown encoding "'+c.encoding+'".');return d};p.certificationRequestFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE REQUEST"!==b.type)throw c=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".'),
537
-c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certification request from PEM; PEM is encrypted.");d=g.fromDer(b.body,d);return p.certificationRequestFromAsn1(d,c)};p.certificationRequestToPem=function(b,c){var d={type:"CERTIFICATE REQUEST",body:g.toDer(p.certificationRequestToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};p.createCertificate=function(){var b={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=
530
+type:g.Type.BITSTRING,constructed:!1,capture:"csrSignature"}]};n.RDNAttributesAsArray=function(a,b){for(var c=[],d,e,p,k=0;k<a.value.length;++k){d=a.value[k];for(var h=0;h<d.value.length;++h)p={},e=d.value[h],p.type=g.derToOid(e.value[0].value),p.value=e.value[1].value,p.valueTagClass=e.value[1].type,p.type in u&&(p.name=u[p.type],p.name in C&&(p.shortName=C[p.name])),b&&(b.update(p.type),b.update(p.value)),c.push(p)}return c};n.CRIAttributesAsArray=function(a){for(var b=[],c=0;c<a.length;++c)for(var d=
531
+a[c],e=g.derToOid(d.value[0].value),d=d.value[1].value,p=0;p<d.length;++p){var k={};k.type=e;k.value=d[p].value;k.valueTagClass=d[p].type;k.type in u&&(k.name=u[k.type],k.name in C&&(k.shortName=C[k.name]));if(k.type===u.extensionRequest){k.extensions=[];for(var h=0;h<k.value.length;++h)k.extensions.push(n.certificateExtensionFromAsn1(k.value[h]))}b.push(k)}return b};var F=function(a,b,c){var d={};if(a!==u["RSASSA-PSS"])return d;c&&(d={hash:{algorithmOid:u.sha1},mgf:{algorithmOid:u.mgf1,hash:{algorithmOid:u.sha1}},
532
+saltLength:20});c={};a=[];if(!g.validate(b,E,c,a))throw b=Error("Cannot read RSASSA-PSS parameter block."),b.errors=a,b;void 0!==c.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=g.derToOid(c.hashOid));void 0!==c.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=g.derToOid(c.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=g.derToOid(c.maskGenHashOid));void 0!==c.saltLength&&(d.saltLength=c.saltLength.charCodeAt(0));return d};n.certificateFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE"!==
533
+b.type&&"X509 CERTIFICATE"!==b.type&&"TRUSTED CERTIFICATE"!==b.type)throw c=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'),c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");d=g.fromDer(b.body,d);return n.certificateFromAsn1(d,c)};n.certificateToPem=function(b,c){var d={type:"CERTIFICATE",body:g.toDer(n.certificateToAsn1(b)).getBytes()};
534
+return a.pem.encode(d,{maxline:c})};n.publicKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PUBLIC KEY"!==b.type&&"RSA PUBLIC KEY"!==b.type){var c=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");b=g.fromDer(b.body);return n.publicKeyFromAsn1(b)};n.publicKeyToPem=function(b,c){var d={type:"PUBLIC KEY",
535
+body:g.toDer(n.publicKeyToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};n.publicKeyToRSAPublicKeyPem=function(b,c){var d={type:"RSA PUBLIC KEY",body:g.toDer(n.publicKeyToRSAPublicKey(b)).getBytes()};return a.pem.encode(d,{maxline:c})};n.getPublicKeyFingerprint=function(b,c){c=c||{};var d=c.md||a.md.sha1.create(),e;switch(c.type||"RSAPublicKey"){case "RSAPublicKey":e=g.toDer(n.publicKeyToRSAPublicKey(b)).getBytes();break;case "SubjectPublicKeyInfo":e=g.toDer(n.publicKeyToAsn1(b)).getBytes();
536
+break;default:throw Error('Unknown fingerprint type "'+c.type+'".');}d.start();d.update(e);d=d.digest();if("hex"===c.encoding)return d=d.toHex(),c.delimiter?d.match(/.{2}/g).join(c.delimiter):d;if("binary"===c.encoding)return d.getBytes();if(c.encoding)throw Error('Unknown encoding "'+c.encoding+'".');return d};n.certificationRequestFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE REQUEST"!==b.type)throw c=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".'),
537
+c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certification request from PEM; PEM is encrypted.");d=g.fromDer(b.body,d);return n.certificationRequestFromAsn1(d,c)};n.certificationRequestToPem=function(b,c){var d={type:"CERTIFICATE REQUEST",body:g.toDer(n.certificationRequestToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};n.createCertificate=function(){var b={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=
538
null;b.validity={};b.validity.notBefore=new Date;b.validity.notAfter=new Date;b.issuer={};b.issuer.getField=function(a){return c(b.issuer,a)};b.issuer.addField=function(a){e([a]);b.issuer.attributes.push(a)};b.issuer.attributes=[];b.issuer.hash=null;b.subject={};b.subject.getField=function(a){return c(b.subject,a)};b.subject.addField=function(a){e([a]);b.subject.attributes.push(a)};b.subject.attributes=[];b.subject.hash=null;b.extensions=[];b.publicKey=null;b.md=null;b.setSubject=function(a,c){e(a);
539
b.subject.attributes=a;delete b.subject.uniqueId;c&&(b.subject.uniqueId=c);b.subject.hash=null};b.setIssuer=function(a,c){e(a);b.issuer.attributes=a;delete b.issuer.uniqueId;c&&(b.issuer.uniqueId=c);b.issuer.hash=null};b.setExtensions=function(a){for(var c=0;c<a.length;++c)l(a[c],{cert:b});b.extensions=a};b.getExtension=function(a){"string"===typeof a&&(a={name:a});for(var c=null,d,e=0;null===c&&e<b.extensions.length;++e)d=b.extensions[e],a.id&&d.id===a.id?c=d:a.name&&d.name===a.name&&(c=d);return c};
540
-b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=u[b.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certificate digest. Unknown message digest algorithm OID."),e.algorithm=b.md.algorithm,e;b.signatureOid=b.siginfo.algorithmOid=e;b.tbsCertificate=p.getTBSCertificate(b);e=g.toDer(b.tbsCertificate);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(c){var d=!1;if(!b.issued(c)){var d=b.subject,e=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");
540
+b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=u[b.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certificate digest. Unknown message digest algorithm OID."),e.algorithm=b.md.algorithm,e;b.signatureOid=b.siginfo.algorithmOid=e;b.tbsCertificate=n.getTBSCertificate(b);e=g.toDer(b.tbsCertificate);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(c){var d=!1;if(!b.issued(c)){var d=b.subject,e=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");
541
e.expectedIssuer=c.issuer.attributes;e.actualIssuer=d.attributes;throw e;}e=c.md;if(null===e){if(c.signatureOid in u)switch(u[c.signatureOid]){case "sha1WithRSAEncryption":e=a.md.sha1.create();break;case "md5WithRSAEncryption":e=a.md.md5.create();break;case "sha256WithRSAEncryption":e=a.md.sha256.create();break;case "sha512WithRSAEncryption":e=a.md.sha512.create();break;case "RSASSA-PSS":e=a.md.sha256.create()}if(null===e)throw e=Error("Could not compute certificate digest. Unknown signature OID."),
542
-e.signatureOid=c.signatureOid,e;var k=c.tbsCertificate||p.getTBSCertificate(c),k=g.toDer(k);e.update(k.getBytes())}if(null!==e){var h;switch(c.signatureOid){case u.sha1WithRSAEncryption:h=void 0;break;case u["RSASSA-PSS"]:d=u[c.signatureParameters.mgf.hash.algorithmOid];if(void 0===d||void 0===a.md[d])throw e=Error("Unsupported MGF hash function."),e.oid=c.signatureParameters.mgf.hash.algorithmOid,e.name=d,e;h=u[c.signatureParameters.mgf.algorithmOid];if(void 0===h||void 0===a.mgf[h])throw e=Error("Unsupported MGF function."),
542
+e.signatureOid=c.signatureOid,e;var k=c.tbsCertificate||n.getTBSCertificate(c),k=g.toDer(k);e.update(k.getBytes())}if(null!==e){var h;switch(c.signatureOid){case u.sha1WithRSAEncryption:h=void 0;break;case u["RSASSA-PSS"]:d=u[c.signatureParameters.mgf.hash.algorithmOid];if(void 0===d||void 0===a.md[d])throw e=Error("Unsupported MGF hash function."),e.oid=c.signatureParameters.mgf.hash.algorithmOid,e.name=d,e;h=u[c.signatureParameters.mgf.algorithmOid];if(void 0===h||void 0===a.mgf[h])throw e=Error("Unsupported MGF function."),
543
e.oid=c.signatureParameters.mgf.algorithmOid,e.name=h,e;h=a.mgf[h].create(a.md[d].create());d=u[c.signatureParameters.hash.algorithmOid];if(void 0===d||void 0===a.md[d])throw{message:"Unsupported RSASSA-PSS hash function.",oid:c.signatureParameters.hash.algorithmOid,name:d};h=a.pss.create(a.md[d].create(),h,c.signatureParameters.saltLength)}d=b.publicKey.verify(e.digest().getBytes(),c.signature,h)}return d};b.isIssuer=function(a){var c=!1,d=b.issuer;a=a.subject;if(d.hash&&a.hash)c=d.hash===a.hash;
544
-else if(d.attributes.length===a.attributes.length)for(var c=!0,e,g,n=0;c&&n<d.attributes.length;++n)if(e=d.attributes[n],g=a.attributes[n],e.type!==g.type||e.value!==g.value)c=!1;return c};b.issued=function(a){return a.isIssuer(b)};b.generateSubjectKeyIdentifier=function(){return p.getPublicKeyFingerprint(b.publicKey,{type:"RSAPublicKey"})};b.verifySubjectKeyIdentifier=function(){for(var c=u.subjectKeyIdentifier,d=0;d<b.extensions.length;++d){var e=b.extensions[d];if(e.id===c)return c=b.generateSubjectKeyIdentifier().getBytes(),
545
-a.util.hexToBytes(e.subjectKeyIdentifier)===c}return!1};return b};p.certificateFromAsn1=function(b,d){var k={},l=[];if(!g.validate(b,w,k,l))throw k=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate."),k.errors=l,k;if("string"!==typeof k.certSignature){for(var l="\x00",q=0;q<k.certSignature.length;++q)l+=g.toDer(k.certSignature[q]).getBytes();k.certSignature=l}l=g.derToOid(k.publicKeyOid);if(l!==p.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");
546
-var r=p.createCertificate();r.version=k.certVersion?k.certVersion.charCodeAt(0):0;l=a.util.createBuffer(k.certSerialNumber);r.serialNumber=l.toHex();r.signatureOid=a.asn1.derToOid(k.certSignatureOid);r.signatureParameters=D(r.signatureOid,k.certSignatureParams,!0);r.siginfo.algorithmOid=a.asn1.derToOid(k.certinfoSignatureOid);r.siginfo.parameters=D(r.siginfo.algorithmOid,k.certinfoSignatureParams,!1);l=a.util.createBuffer(k.certSignature);++l.read;r.signature=l.getBytes();l=[];void 0!==k.certValidity1UTCTime&&
544
+else if(d.attributes.length===a.attributes.length)for(var c=!0,e,g,p=0;c&&p<d.attributes.length;++p)if(e=d.attributes[p],g=a.attributes[p],e.type!==g.type||e.value!==g.value)c=!1;return c};b.issued=function(a){return a.isIssuer(b)};b.generateSubjectKeyIdentifier=function(){return n.getPublicKeyFingerprint(b.publicKey,{type:"RSAPublicKey"})};b.verifySubjectKeyIdentifier=function(){for(var c=u.subjectKeyIdentifier,d=0;d<b.extensions.length;++d){var e=b.extensions[d];if(e.id===c)return c=b.generateSubjectKeyIdentifier().getBytes(),
545
+a.util.hexToBytes(e.subjectKeyIdentifier)===c}return!1};return b};n.certificateFromAsn1=function(b,d){var k={},l=[];if(!g.validate(b,y,k,l))throw k=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate."),k.errors=l,k;if("string"!==typeof k.certSignature){for(var l="\x00",r=0;r<k.certSignature.length;++r)l+=g.toDer(k.certSignature[r]).getBytes();k.certSignature=l}l=g.derToOid(k.publicKeyOid);if(l!==n.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");
546
+var q=n.createCertificate();q.version=k.certVersion?k.certVersion.charCodeAt(0):0;l=a.util.createBuffer(k.certSerialNumber);q.serialNumber=l.toHex();q.signatureOid=a.asn1.derToOid(k.certSignatureOid);q.signatureParameters=F(q.signatureOid,k.certSignatureParams,!0);q.siginfo.algorithmOid=a.asn1.derToOid(k.certinfoSignatureOid);q.siginfo.parameters=F(q.siginfo.algorithmOid,k.certinfoSignatureParams,!1);l=a.util.createBuffer(k.certSignature);++l.read;q.signature=l.getBytes();l=[];void 0!==k.certValidity1UTCTime&&
547
l.push(g.utcTimeToDate(k.certValidity1UTCTime));void 0!==k.certValidity2GeneralizedTime&&l.push(g.generalizedTimeToDate(k.certValidity2GeneralizedTime));void 0!==k.certValidity3UTCTime&&l.push(g.utcTimeToDate(k.certValidity3UTCTime));void 0!==k.certValidity4GeneralizedTime&&l.push(g.generalizedTimeToDate(k.certValidity4GeneralizedTime));if(2<l.length)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(2>l.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");
548
-r.validity.notBefore=l[0];r.validity.notAfter=l[1];r.tbsCertificate=k.tbsCertificate;if(d){r.md=null;if(r.signatureOid in u)switch(l=u[r.signatureOid],l){case "sha1WithRSAEncryption":r.md=a.md.sha1.create();break;case "md5WithRSAEncryption":r.md=a.md.md5.create();break;case "sha256WithRSAEncryption":r.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":r.md=a.md.sha512.create();break;case "RSASSA-PSS":r.md=a.md.sha256.create()}if(null===r.md)throw k=Error("Could not compute certificate digest. Unknown signature OID."),
549
-k.signatureOid=r.signatureOid,k;l=g.toDer(r.tbsCertificate);r.md.update(l.getBytes())}l=a.md.sha1.create();r.issuer.getField=function(a){return c(r.issuer,a)};r.issuer.addField=function(a){e([a]);r.issuer.attributes.push(a)};r.issuer.attributes=p.RDNAttributesAsArray(k.certIssuer,l);k.certIssuerUniqueId&&(r.issuer.uniqueId=k.certIssuerUniqueId);r.issuer.hash=l.digest().toHex();l=a.md.sha1.create();r.subject.getField=function(a){return c(r.subject,a)};r.subject.addField=function(a){e([a]);r.subject.attributes.push(a)};
550
-r.subject.attributes=p.RDNAttributesAsArray(k.certSubject,l);k.certSubjectUniqueId&&(r.subject.uniqueId=k.certSubjectUniqueId);r.subject.hash=l.digest().toHex();r.extensions=k.certExtensions?p.certificateExtensionsFromAsn1(k.certExtensions):[];r.publicKey=p.publicKeyFromAsn1(k.subjectPublicKeyInfo);return r};p.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;c<a.value.length;++c)for(var d=a.value[c],e=0;e<d.value.length;++e)b.push(p.certificateExtensionFromAsn1(d.value[e]));return b};p.certificateExtensionFromAsn1=
548
+q.validity.notBefore=l[0];q.validity.notAfter=l[1];q.tbsCertificate=k.tbsCertificate;if(d){q.md=null;if(q.signatureOid in u)switch(l=u[q.signatureOid],l){case "sha1WithRSAEncryption":q.md=a.md.sha1.create();break;case "md5WithRSAEncryption":q.md=a.md.md5.create();break;case "sha256WithRSAEncryption":q.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=a.md.sha512.create();break;case "RSASSA-PSS":q.md=a.md.sha256.create()}if(null===q.md)throw k=Error("Could not compute certificate digest. Unknown signature OID."),
549
+k.signatureOid=q.signatureOid,k;l=g.toDer(q.tbsCertificate);q.md.update(l.getBytes())}l=a.md.sha1.create();q.issuer.getField=function(a){return c(q.issuer,a)};q.issuer.addField=function(a){e([a]);q.issuer.attributes.push(a)};q.issuer.attributes=n.RDNAttributesAsArray(k.certIssuer,l);k.certIssuerUniqueId&&(q.issuer.uniqueId=k.certIssuerUniqueId);q.issuer.hash=l.digest().toHex();l=a.md.sha1.create();q.subject.getField=function(a){return c(q.subject,a)};q.subject.addField=function(a){e([a]);q.subject.attributes.push(a)};
550
+q.subject.attributes=n.RDNAttributesAsArray(k.certSubject,l);k.certSubjectUniqueId&&(q.subject.uniqueId=k.certSubjectUniqueId);q.subject.hash=l.digest().toHex();q.extensions=k.certExtensions?n.certificateExtensionsFromAsn1(k.certExtensions):[];q.publicKey=n.publicKeyFromAsn1(k.subjectPublicKeyInfo);return q};n.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;c<a.value.length;++c)for(var d=a.value[c],e=0;e<d.value.length;++e)b.push(n.certificateExtensionFromAsn1(d.value[e]));return b};n.certificateExtensionFromAsn1=
551
function(b){var c={};c.id=g.derToOid(b.value[0].value);c.critical=!1;b.value[1].type===g.Type.BOOLEAN?(c.critical=0!==b.value[1].value.charCodeAt(0),c.value=b.value[2].value):c.value=b.value[1].value;if(c.id in u)if(c.name=u[c.id],"keyUsage"===c.name){b=g.fromDer(c.value);var d=0,e=0;1<b.value.length&&(d=b.value.charCodeAt(1),e=2<b.value.length?b.value.charCodeAt(2):0);c.digitalSignature=128===(d&128);c.nonRepudiation=64===(d&64);c.keyEncipherment=32===(d&32);c.dataEncipherment=16===(d&16);c.keyAgreement=
552
8===(d&8);c.keyCertSign=4===(d&4);c.cRLSign=2===(d&2);c.encipherOnly=1===(d&1);c.decipherOnly=128===(e&128)}else if("basicConstraints"===c.name)b=g.fromDer(c.value),c.cA=0<b.value.length&&b.value[0].type===g.Type.BOOLEAN?0!==b.value[0].value.charCodeAt(0):!1,d=null,0<b.value.length&&b.value[0].type===g.Type.INTEGER?d=b.value[0].value:1<b.value.length&&(d=b.value[1].value),null!==d&&(c.pathLenConstraint=g.derToInteger(d));else if("extKeyUsage"===c.name)for(b=g.fromDer(c.value),d=0;d<b.value.length;++d)e=
553
g.derToOid(b.value[d].value),e in u?c[u[e]]=!0:c[e]=!0;else if("nsCertType"===c.name)b=g.fromDer(c.value),d=0,1<b.value.length&&(d=b.value.charCodeAt(1)),c.client=128===(d&128),c.server=64===(d&64),c.email=32===(d&32),c.objsign=16===(d&16),c.reserved=8===(d&8),c.sslCA=4===(d&4),c.emailCA=2===(d&2),c.objCA=1===(d&1);else if("subjectAltName"===c.name||"issuerAltName"===c.name)for(c.altNames=[],b=g.fromDer(c.value),e=0;e<b.value.length;++e){var d=b.value[e],k={type:d.type,value:d.value};c.altNames.push(k);
554
-switch(d.type){case 7:k.ip=a.util.bytesToIP(d.value);break;case 8:k.oid=g.derToOid(d.value)}}else"subjectKeyIdentifier"===c.name&&(b=g.fromDer(c.value),c.subjectKeyIdentifier=a.util.bytesToHex(b.value));return c};p.certificationRequestFromAsn1=function(b,d){var k={},l=[];if(!g.validate(b,H,k,l))throw k=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest."),k.errors=l,k;if("string"!==typeof k.csrSignature){for(var l="\x00",q=0;q<k.csrSignature.length;++q)l+=
555
-g.toDer(k.csrSignature[q]).getBytes();k.csrSignature=l}l=g.derToOid(k.publicKeyOid);if(l!==p.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var r=p.createCertificationRequest();r.version=k.csrVersion?k.csrVersion.charCodeAt(0):0;r.signatureOid=a.asn1.derToOid(k.csrSignatureOid);r.signatureParameters=D(r.signatureOid,k.csrSignatureParams,!0);r.siginfo.algorithmOid=a.asn1.derToOid(k.csrSignatureOid);r.siginfo.parameters=D(r.siginfo.algorithmOid,k.csrSignatureParams,!1);l=
556
-a.util.createBuffer(k.csrSignature);++l.read;r.signature=l.getBytes();r.certificationRequestInfo=k.certificationRequestInfo;if(d){r.md=null;if(r.signatureOid in u)switch(l=u[r.signatureOid],l){case "sha1WithRSAEncryption":r.md=a.md.sha1.create();break;case "md5WithRSAEncryption":r.md=a.md.md5.create();break;case "sha256WithRSAEncryption":r.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":r.md=a.md.sha512.create();break;case "RSASSA-PSS":r.md=a.md.sha256.create()}if(null===r.md)throw k=
557
-Error("Could not compute certification request digest. Unknown signature OID."),k.signatureOid=r.signatureOid,k;l=g.toDer(r.certificationRequestInfo);r.md.update(l.getBytes())}l=a.md.sha1.create();r.subject.getField=function(a){return c(r.subject,a)};r.subject.addField=function(a){e([a]);r.subject.attributes.push(a)};r.subject.attributes=p.RDNAttributesAsArray(k.certificationRequestInfoSubject,l);r.subject.hash=l.digest().toHex();r.publicKey=p.publicKeyFromAsn1(k.subjectPublicKeyInfo);r.getAttribute=
558
-function(a){return c(r,a)};r.addAttribute=function(a){e([a]);r.attributes.push(a)};r.attributes=p.CRIAttributesAsArray(k.certificationRequestInfoAttributes||[]);return r};p.createCertificationRequest=function(){var b={version:0,signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=null;b.subject={};b.subject.getField=function(a){return c(b.subject,a)};b.subject.addField=function(a){e([a]);b.subject.attributes.push(a)};b.subject.attributes=[];b.subject.hash=null;b.publicKey=null;b.attributes=
554
+switch(d.type){case 7:k.ip=a.util.bytesToIP(d.value);break;case 8:k.oid=g.derToOid(d.value)}}else"subjectKeyIdentifier"===c.name&&(b=g.fromDer(c.value),c.subjectKeyIdentifier=a.util.bytesToHex(b.value));return c};n.certificationRequestFromAsn1=function(b,d){var k={},l=[];if(!g.validate(b,I,k,l))throw k=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest."),k.errors=l,k;if("string"!==typeof k.csrSignature){for(var l="\x00",r=0;r<k.csrSignature.length;++r)l+=
555
+g.toDer(k.csrSignature[r]).getBytes();k.csrSignature=l}l=g.derToOid(k.publicKeyOid);if(l!==n.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var q=n.createCertificationRequest();q.version=k.csrVersion?k.csrVersion.charCodeAt(0):0;q.signatureOid=a.asn1.derToOid(k.csrSignatureOid);q.signatureParameters=F(q.signatureOid,k.csrSignatureParams,!0);q.siginfo.algorithmOid=a.asn1.derToOid(k.csrSignatureOid);q.siginfo.parameters=F(q.siginfo.algorithmOid,k.csrSignatureParams,!1);l=
556
+a.util.createBuffer(k.csrSignature);++l.read;q.signature=l.getBytes();q.certificationRequestInfo=k.certificationRequestInfo;if(d){q.md=null;if(q.signatureOid in u)switch(l=u[q.signatureOid],l){case "sha1WithRSAEncryption":q.md=a.md.sha1.create();break;case "md5WithRSAEncryption":q.md=a.md.md5.create();break;case "sha256WithRSAEncryption":q.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=a.md.sha512.create();break;case "RSASSA-PSS":q.md=a.md.sha256.create()}if(null===q.md)throw k=
557
+Error("Could not compute certification request digest. Unknown signature OID."),k.signatureOid=q.signatureOid,k;l=g.toDer(q.certificationRequestInfo);q.md.update(l.getBytes())}l=a.md.sha1.create();q.subject.getField=function(a){return c(q.subject,a)};q.subject.addField=function(a){e([a]);q.subject.attributes.push(a)};q.subject.attributes=n.RDNAttributesAsArray(k.certificationRequestInfoSubject,l);q.subject.hash=l.digest().toHex();q.publicKey=n.publicKeyFromAsn1(k.subjectPublicKeyInfo);q.getAttribute=
558
+function(a){return c(q,a)};q.addAttribute=function(a){e([a]);q.attributes.push(a)};q.attributes=n.CRIAttributesAsArray(k.certificationRequestInfoAttributes||[]);return q};n.createCertificationRequest=function(){var b={version:0,signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=null;b.subject={};b.subject.getField=function(a){return c(b.subject,a)};b.subject.addField=function(a){e([a]);b.subject.attributes.push(a)};b.subject.attributes=[];b.subject.hash=null;b.publicKey=null;b.attributes=
559
[];b.getAttribute=function(a){return c(b,a)};b.addAttribute=function(a){e([a]);b.attributes.push(a)};b.md=null;b.setSubject=function(a){e(a);b.subject.attributes=a;b.subject.hash=null};b.setAttributes=function(a){e(a);b.attributes=a};b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=u[b.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certification request digest. Unknown message digest algorithm OID."),e.algorithm=b.md.algorithm,e;b.signatureOid=b.siginfo.algorithmOid=
560
-e;b.certificationRequestInfo=p.getCertificationRequestInfo(b);e=g.toDer(b.certificationRequestInfo);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(){var c=!1,d=b.md;if(null===d){if(b.signatureOid in u)switch(u[b.signatureOid]){case "sha1WithRSAEncryption":d=a.md.sha1.create();break;case "md5WithRSAEncryption":d=a.md.md5.create();break;case "sha256WithRSAEncryption":d=a.md.sha256.create();break;case "sha512WithRSAEncryption":d=a.md.sha512.create();break;case "RSASSA-PSS":d=a.md.sha256.create()}if(null===
561
-d)throw d=Error("Could not compute certification request digest. Unknown signature OID."),d.signatureOid=b.signatureOid,d;var e=b.certificationRequestInfo||p.getCertificationRequestInfo(b),e=g.toDer(e);d.update(e.getBytes())}if(null!==d){var k;switch(b.signatureOid){case u["RSASSA-PSS"]:c=u[b.signatureParameters.mgf.hash.algorithmOid];if(void 0===c||void 0===a.md[c])throw d=Error("Unsupported MGF hash function."),d.oid=b.signatureParameters.mgf.hash.algorithmOid,d.name=c,d;k=u[b.signatureParameters.mgf.algorithmOid];
560
+e;b.certificationRequestInfo=n.getCertificationRequestInfo(b);e=g.toDer(b.certificationRequestInfo);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(){var c=!1,d=b.md;if(null===d){if(b.signatureOid in u)switch(u[b.signatureOid]){case "sha1WithRSAEncryption":d=a.md.sha1.create();break;case "md5WithRSAEncryption":d=a.md.md5.create();break;case "sha256WithRSAEncryption":d=a.md.sha256.create();break;case "sha512WithRSAEncryption":d=a.md.sha512.create();break;case "RSASSA-PSS":d=a.md.sha256.create()}if(null===
561
+d)throw d=Error("Could not compute certification request digest. Unknown signature OID."),d.signatureOid=b.signatureOid,d;var e=b.certificationRequestInfo||n.getCertificationRequestInfo(b),e=g.toDer(e);d.update(e.getBytes())}if(null!==d){var k;switch(b.signatureOid){case u["RSASSA-PSS"]:c=u[b.signatureParameters.mgf.hash.algorithmOid];if(void 0===c||void 0===a.md[c])throw d=Error("Unsupported MGF hash function."),d.oid=b.signatureParameters.mgf.hash.algorithmOid,d.name=c,d;k=u[b.signatureParameters.mgf.algorithmOid];
562
if(void 0===k||void 0===a.mgf[k])throw d=Error("Unsupported MGF function."),d.oid=b.signatureParameters.mgf.algorithmOid,d.name=k,d;k=a.mgf[k].create(a.md[c].create());c=u[b.signatureParameters.hash.algorithmOid];if(void 0===c||void 0===a.md[c])throw d=Error("Unsupported RSASSA-PSS hash function."),d.oid=b.signatureParameters.hash.algorithmOid,d.name=c,d;k=a.pss.create(a.md[c].create(),k,b.signatureParameters.saltLength)}c=b.publicKey.verify(d.digest().getBytes(),b.signature,k)}return c};return b};
563
-p.getTBSCertificate=function(b){var c=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(b.version).getBytes())]),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber)),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(b.siginfo.algorithmOid).getBytes()),q(b.siginfo.algorithmOid,b.siginfo.parameters)]),d(b.issuer),g.create(g.Class.UNIVERSAL,
564
-g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.UTCTIME,!1,g.dateToUtcTime(b.validity.notBefore)),g.create(g.Class.UNIVERSAL,g.Type.UTCTIME,!1,g.dateToUtcTime(b.validity.notAfter))]),d(b.subject),p.publicKeyToAsn1(b.publicKey)]);b.issuer.uniqueId&&c.value.push(g.create(g.Class.CONTEXT_SPECIFIC,1,!0,[g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,String.fromCharCode(0)+b.issuer.uniqueId)]));b.subject.uniqueId&&c.value.push(g.create(g.Class.CONTEXT_SPECIFIC,2,!0,[g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,
565
-!1,String.fromCharCode(0)+b.subject.uniqueId)]));0<b.extensions.length&&c.value.push(p.certificateExtensionsToAsn1(b.extensions));return c};p.getCertificationRequestInfo=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(a.version).getBytes()),d(a.subject),p.publicKeyToAsn1(a.publicKey),k(a)])};p.distinguishedNameToAsn1=function(a){return d(a)};p.certificateToAsn1=function(a){var b=a.tbsCertificate||p.getTBSCertificate(a);
566
-return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[b,g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(a.signatureOid).getBytes()),q(a.signatureOid,a.signatureParameters)]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};p.certificateExtensionsToAsn1=function(a){var b=g.create(g.Class.CONTEXT_SPECIFIC,3,!0,[]),c=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);b.value.push(c);for(var d=0;d<a.length;++d)c.value.push(p.certificateExtensionToAsn1(a[d]));
567
-return b};p.certificateExtensionToAsn1=function(a){var b=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);b.value.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(a.id).getBytes()));a.critical&&b.value.push(g.create(g.Class.UNIVERSAL,g.Type.BOOLEAN,!1,String.fromCharCode(255)));var c=a.value;"string"!==typeof a.value&&(c=g.toDer(c).getBytes());b.value.push(g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,c));return b};p.certificationRequestToAsn1=function(a){var b=a.certificationRequestInfo||
568
-p.getCertificationRequestInfo(a);return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[b,g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(a.signatureOid).getBytes()),q(a.signatureOid,a.signatureParameters)]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};p.createCaStore=function(b){function c(b){if(!b.hash){var g=a.md.sha1.create();b.attributes=p.RDNAttributesAsArray(d(b),g);b.hash=g.digest().toHex()}return e.certs[b.hash]||
569
-null}var e={certs:{},getIssuer:function(a){return c(a.issuer)},addCertificate:function(b){"string"===typeof b&&(b=a.pki.certificateFromPem(b));if(!b.subject.hash){var c=a.md.sha1.create();b.subject.attributes=p.RDNAttributesAsArray(d(b.subject),c);b.subject.hash=c.digest().toHex()}b.subject.hash in e.certs?(c=e.certs[b.subject.hash],a.util.isArray(c)||(c=[c]),c.push(b)):e.certs[b.subject.hash]=b},hasCertificate:function(b){var d=c(b.subject);if(!d)return!1;a.util.isArray(d)||(d=[d]);b=g.toDer(p.certificateToAsn1(b)).getBytes();
570
-for(var e=0;e<d.length;++e){var k=g.toDer(p.certificateToAsn1(d[e])).getBytes();if(b===k)return!0}return!1}};if(b)for(var k=0;k<b.length;++k)e.addCertificate(b[k]);return e};p.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};
571
-p.verifyCertificateChain=function(b,c,d){c=c.slice(0);var e=c.slice(0),g=new Date,k=!0,h=null,m=0;do{var l=c.shift(),u=null,q=!1;if(g<l.validity.notBefore||g>l.validity.notAfter)h={message:"Certificate is not valid yet or has expired.",error:p.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:g};if(null===h){u=c[0]||b.getIssuer(l);null===u&&l.isIssuer(l)&&(q=!0,u=l);if(u){var x=u;a.util.isArray(x)||(x=[x]);for(var w=!1;!w&&0<x.length;){u=x.shift();
572
-try{w=u.verify(l)}catch(D){}}w||(h={message:"Certificate signature is invalid.",error:p.certificateError.bad_certificate})}null!==h||u&&!q||b.hasCertificate(l)||(h={message:"Certificate is not trusted.",error:p.certificateError.unknown_ca})}null===h&&u&&!l.isIssuer(u)&&(h={message:"Certificate issuer is invalid.",error:p.certificateError.bad_certificate});if(null===h)for(x={keyUsage:!0,basicConstraints:!0},w=0;null===h&&w<l.extensions.length;++w){var v=l.extensions[w];!v.critical||v.name in x||(h=
573
-{message:"Certificate has an unsupported critical extension.",error:p.certificateError.unsupported_certificate})}null!==h||k&&(0!==c.length||u&&!q)||(k=l.getExtension("basicConstraints"),l=l.getExtension("keyUsage"),null!==l&&(l.keyCertSign&&null!==k||(h={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:p.certificateError.bad_certificate})),
574
-null!==h||null===k||k.cA||(h={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:p.certificateError.bad_certificate}),null===h&&null!==l&&"pathLenConstraint"in k&&m-1>k.pathLenConstraint&&(h={message:"Certificate basicConstraints pathLenConstraint violated.",error:p.certificateError.bad_certificate}));l=null===h?!0:h.error;k=d?d(l,m,e):l;if(!0===k)h=null;else{!0===l&&(h={message:"The application rejected the certificate.",error:p.certificateError.bad_certificate});
575
-if(k||0===k)"object"!==typeof k||a.util.isArray(k)?"string"===typeof k&&(h.error=k):(k.message&&(h.message=k.message),k.error&&(h.error=k.error));throw h;}k=!1;++m}while(0<c.length);return!0}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.x509)return c.x509;
576
-c.defined.x509=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pki}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/x509","require module ./aes ./asn1 ./des ./md ./mgf ./oids ./pem ./pss ./rsa ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d,e){for(var g=
577
-[],k=0;k<a.length;k++)for(var h=0;h<a[k].safeBags.length;h++){var n=a[k].safeBags[h];if(void 0===e||n.type===e)null===b?g.push(n):void 0!==n.attributes[b]&&0<=n.attributes[b].indexOf(d)&&g.push(n)}return g}function d(b){if(b.composed||b.constructed){for(var c=a.util.createBuffer(),e=0;e<b.value.length;++e)c.putBytes(b.value[e].value);b.composed=b.constructed=!1;b.value=c.getBytes()}return b}function e(b,c,h,m){c=k.fromDer(c,h);if(c.tagClass!==k.Class.UNIVERSAL||c.type!==k.Type.SEQUENCE||!0!==c.constructed)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");
578
-for(var p=0;p<c.value.length;p++){var q={},x=[];if(!k.validate(c.value[p],u,q,x))throw b=Error("Cannot read ContentInfo."),b.errors=x,b;var x={encrypted:!1},r=null,r=q.content.value[0];switch(k.derToOid(q.contentType)){case g.oids.data:if(r.tagClass!==k.Class.UNIVERSAL||r.type!==k.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");r=d(r).value;break;case g.oids.encryptedData:var w=m,q={},F=[];if(!k.validate(r,a.pkcs7.asn1.encryptedDataValidator,q,F))throw b=Error("Cannot read EncryptedContentInfo."),
579
-b.errors=F,b;r=k.derToOid(q.contentType);if(r!==g.oids.data)throw b=Error("PKCS#12 EncryptedContentInfo ContentType is not Data."),b.oid=r,b;r=k.derToOid(q.encAlgorithm);r=g.pbe.getCipher(r,q.encParameter,w);q=d(q.encryptedContentAsn1);q=a.util.createBuffer(q.value);r.update(q);if(!r.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");r=r.output.getBytes();x.encrypted=!0;break;default:throw b=Error("Unsupported PKCS#12 contentType."),b.contentType=k.derToOid(q.contentType),b;}x.safeBags=
580
-l(r,h,m);b.safeContents.push(x)}}function l(a,b,c){if(!b&&0===a.length)return[];a=k.fromDer(a,b);if(a.tagClass!==k.Class.UNIVERSAL||a.type!==k.Type.SEQUENCE||!0!==a.constructed)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var d=[],e=0;e<a.value.length;e++){var h={},n=[];if(!k.validate(a.value[e],x,h,n))throw a=Error("Cannot read SafeBag."),a.errors=n,a;var m={type:k.derToOid(h.bagId),attributes:p(h.bagAttributes)};d.push(m);var u,q,w=h.bagValue.value[0];switch(m.type){case g.oids.pkcs8ShroudedKeyBag:if(w=
581
-g.decryptPrivateKeyInfo(w,c),null===w)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case g.oids.keyBag:try{m.key=g.privateKeyFromAsn1(w)}catch(v){m.key=null,m.asn1=w}continue;case g.oids.certBag:u=F;q=function(){if(k.derToOid(h.certId)!==g.oids.x509Certificate){var a=Error("Unsupported certificate type, only X.509 supported.");a.oid=k.derToOid(h.certId);throw a;}a=k.fromDer(h.cert,b);try{m.cert=g.certificateFromAsn1(a,!0)}catch(c){m.cert=null,m.asn1=a}};break;default:throw a=
582
-Error("Unsupported PKCS#12 SafeBag type."),a.oid=m.type,a;}if(void 0!==u&&!k.validate(w,u,h,n))throw a=Error("Cannot read PKCS#12 "+u.name),a.errors=n,a;q()}return d}function p(a){var b={};if(void 0!==a)for(var c=0;c<a.length;++c){var d={},e=[];if(!k.validate(a[c],w,d,e))throw a=Error("Cannot read PKCS#12 BagAttribute."),a.errors=e,a;e=k.derToOid(d.oid);if(void 0!==g.oids[e]){b[g.oids[e]]=[];for(var h=0;h<d.values.length;++h)b[g.oids[e]].push(d.values[h].value)}}return b}var k=a.asn1,g=a.pki,q=a.pkcs12=
563
+n.getTBSCertificate=function(b){var c=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(b.version).getBytes())]),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber)),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(b.siginfo.algorithmOid).getBytes()),r(b.siginfo.algorithmOid,b.siginfo.parameters)]),d(b.issuer),g.create(g.Class.UNIVERSAL,
564
+g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.UTCTIME,!1,g.dateToUtcTime(b.validity.notBefore)),g.create(g.Class.UNIVERSAL,g.Type.UTCTIME,!1,g.dateToUtcTime(b.validity.notAfter))]),d(b.subject),n.publicKeyToAsn1(b.publicKey)]);b.issuer.uniqueId&&c.value.push(g.create(g.Class.CONTEXT_SPECIFIC,1,!0,[g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,String.fromCharCode(0)+b.issuer.uniqueId)]));b.subject.uniqueId&&c.value.push(g.create(g.Class.CONTEXT_SPECIFIC,2,!0,[g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,
565
+!1,String.fromCharCode(0)+b.subject.uniqueId)]));0<b.extensions.length&&c.value.push(n.certificateExtensionsToAsn1(b.extensions));return c};n.getCertificationRequestInfo=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(a.version).getBytes()),d(a.subject),n.publicKeyToAsn1(a.publicKey),k(a)])};n.distinguishedNameToAsn1=function(a){return d(a)};n.certificateToAsn1=function(a){var b=a.tbsCertificate||n.getTBSCertificate(a);
566
+return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[b,g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(a.signatureOid).getBytes()),r(a.signatureOid,a.signatureParameters)]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};n.certificateExtensionsToAsn1=function(a){var b=g.create(g.Class.CONTEXT_SPECIFIC,3,!0,[]),c=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);b.value.push(c);for(var d=0;d<a.length;++d)c.value.push(n.certificateExtensionToAsn1(a[d]));
567
+return b};n.certificateExtensionToAsn1=function(a){var b=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);b.value.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(a.id).getBytes()));a.critical&&b.value.push(g.create(g.Class.UNIVERSAL,g.Type.BOOLEAN,!1,String.fromCharCode(255)));var c=a.value;"string"!==typeof a.value&&(c=g.toDer(c).getBytes());b.value.push(g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,c));return b};n.certificationRequestToAsn1=function(a){var b=a.certificationRequestInfo||
568
+n.getCertificationRequestInfo(a);return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[b,g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(a.signatureOid).getBytes()),r(a.signatureOid,a.signatureParameters)]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};n.createCaStore=function(b){function c(b){if(!b.hash){var g=a.md.sha1.create();b.attributes=n.RDNAttributesAsArray(d(b),g);b.hash=g.digest().toHex()}return e.certs[b.hash]||
569
+null}var e={certs:{},getIssuer:function(a){return c(a.issuer)},addCertificate:function(b){"string"===typeof b&&(b=a.pki.certificateFromPem(b));if(!b.subject.hash){var c=a.md.sha1.create();b.subject.attributes=n.RDNAttributesAsArray(d(b.subject),c);b.subject.hash=c.digest().toHex()}b.subject.hash in e.certs?(c=e.certs[b.subject.hash],a.util.isArray(c)||(c=[c]),c.push(b)):e.certs[b.subject.hash]=b},hasCertificate:function(b){var d=c(b.subject);if(!d)return!1;a.util.isArray(d)||(d=[d]);b=g.toDer(n.certificateToAsn1(b)).getBytes();
570
+for(var e=0;e<d.length;++e){var k=g.toDer(n.certificateToAsn1(d[e])).getBytes();if(b===k)return!0}return!1}};if(b)for(var k=0;k<b.length;++k)e.addCertificate(b[k]);return e};n.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};
571
+n.verifyCertificateChain=function(b,c,d){c=c.slice(0);var e=c.slice(0),g=new Date,k=!0,h=null,l=0;do{var m=c.shift(),u=null,r=!1;if(g<m.validity.notBefore||g>m.validity.notAfter)h={message:"Certificate is not valid yet or has expired.",error:n.certificateError.certificate_expired,notBefore:m.validity.notBefore,notAfter:m.validity.notAfter,now:g};if(null===h){u=c[0]||b.getIssuer(m);null===u&&m.isIssuer(m)&&(r=!0,u=m);if(u){var w=u;a.util.isArray(w)||(w=[w]);for(var F=!1;!F&&0<w.length;){u=w.shift();
572
+try{F=u.verify(m)}catch(y){}}F||(h={message:"Certificate signature is invalid.",error:n.certificateError.bad_certificate})}null!==h||u&&!r||b.hasCertificate(m)||(h={message:"Certificate is not trusted.",error:n.certificateError.unknown_ca})}null===h&&u&&!m.isIssuer(u)&&(h={message:"Certificate issuer is invalid.",error:n.certificateError.bad_certificate});if(null===h)for(w={keyUsage:!0,basicConstraints:!0},F=0;null===h&&F<m.extensions.length;++F){var v=m.extensions[F];!v.critical||v.name in w||(h=
573
+{message:"Certificate has an unsupported critical extension.",error:n.certificateError.unsupported_certificate})}null!==h||k&&(0!==c.length||u&&!r)||(k=m.getExtension("basicConstraints"),m=m.getExtension("keyUsage"),null!==m&&(m.keyCertSign&&null!==k||(h={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:n.certificateError.bad_certificate})),
574
+null!==h||null===k||k.cA||(h={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:n.certificateError.bad_certificate}),null===h&&null!==m&&"pathLenConstraint"in k&&l-1>k.pathLenConstraint&&(h={message:"Certificate basicConstraints pathLenConstraint violated.",error:n.certificateError.bad_certificate}));m=null===h?!0:h.error;k=d?d(m,l,e):m;if(!0===k)h=null;else{!0===m&&(h={message:"The application rejected the certificate.",error:n.certificateError.bad_certificate});
575
+if(k||0===k)"object"!==typeof k||a.util.isArray(k)?"string"===typeof k&&(h.error=k):(k.message&&(h.message=k.message),k.error&&(h.error=k.error));throw h;}k=!1;++l}while(0<c.length);return!0}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.x509)return c.x509;
576
+c.defined.x509=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pki}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/x509","require module ./aes ./asn1 ./des ./md ./mgf ./oids ./pem ./pss ./rsa ./util".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d,e){for(var g=
577
+[],k=0;k<a.length;k++)for(var h=0;h<a[k].safeBags.length;h++){var p=a[k].safeBags[h];if(void 0===e||p.type===e)null===b?g.push(p):void 0!==p.attributes[b]&&0<=p.attributes[b].indexOf(d)&&g.push(p)}return g}function d(b){if(b.composed||b.constructed){for(var c=a.util.createBuffer(),e=0;e<b.value.length;++e)c.putBytes(b.value[e].value);b.composed=b.constructed=!1;b.value=c.getBytes()}return b}function e(b,c,h,m){c=k.fromDer(c,h);if(c.tagClass!==k.Class.UNIVERSAL||c.type!==k.Type.SEQUENCE||!0!==c.constructed)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");
578
+for(var n=0;n<c.value.length;n++){var r={},w=[];if(!k.validate(c.value[n],u,r,w))throw b=Error("Cannot read ContentInfo."),b.errors=w,b;var w={encrypted:!1},q=null,q=r.content.value[0];switch(k.derToOid(r.contentType)){case g.oids.data:if(q.tagClass!==k.Class.UNIVERSAL||q.type!==k.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");q=d(q).value;break;case g.oids.encryptedData:var y=m,r={},E=[];if(!k.validate(q,a.pkcs7.asn1.encryptedDataValidator,r,E))throw b=Error("Cannot read EncryptedContentInfo."),
579
+b.errors=E,b;q=k.derToOid(r.contentType);if(q!==g.oids.data)throw b=Error("PKCS#12 EncryptedContentInfo ContentType is not Data."),b.oid=q,b;q=k.derToOid(r.encAlgorithm);q=g.pbe.getCipher(q,r.encParameter,y);r=d(r.encryptedContentAsn1);r=a.util.createBuffer(r.value);q.update(r);if(!q.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");q=q.output.getBytes();w.encrypted=!0;break;default:throw b=Error("Unsupported PKCS#12 contentType."),b.contentType=k.derToOid(r.contentType),b;}w.safeBags=
580
+l(q,h,m);b.safeContents.push(w)}}function l(a,b,c){if(!b&&0===a.length)return[];a=k.fromDer(a,b);if(a.tagClass!==k.Class.UNIVERSAL||a.type!==k.Type.SEQUENCE||!0!==a.constructed)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var d=[],e=0;e<a.value.length;e++){var h={},p=[];if(!k.validate(a.value[e],w,h,p))throw a=Error("Cannot read SafeBag."),a.errors=p,a;var m={type:k.derToOid(h.bagId),attributes:n(h.bagAttributes)};d.push(m);var r,u,y=h.bagValue.value[0];switch(m.type){case g.oids.pkcs8ShroudedKeyBag:if(y=
581
+g.decryptPrivateKeyInfo(y,c),null===y)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case g.oids.keyBag:try{m.key=g.privateKeyFromAsn1(y)}catch(v){m.key=null,m.asn1=y}continue;case g.oids.certBag:r=E;u=function(){if(k.derToOid(h.certId)!==g.oids.x509Certificate){var a=Error("Unsupported certificate type, only X.509 supported.");a.oid=k.derToOid(h.certId);throw a;}a=k.fromDer(h.cert,b);try{m.cert=g.certificateFromAsn1(a,!0)}catch(c){m.cert=null,m.asn1=a}};break;default:throw a=
582
+Error("Unsupported PKCS#12 SafeBag type."),a.oid=m.type,a;}if(void 0!==r&&!k.validate(y,r,h,p))throw a=Error("Cannot read PKCS#12 "+r.name),a.errors=p,a;u()}return d}function n(a){var b={};if(void 0!==a)for(var c=0;c<a.length;++c){var d={},e=[];if(!k.validate(a[c],y,d,e))throw a=Error("Cannot read PKCS#12 BagAttribute."),a.errors=e,a;e=k.derToOid(d.oid);if(void 0!==g.oids[e]){b[g.oids[e]]=[];for(var h=0;h<d.values.length;++h)b[g.oids[e]].push(d.values[h].value)}}return b}var k=a.asn1,g=a.pki,r=a.pkcs12=
583
a.pkcs12||{},u={name:"ContentInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},C={name:"PFX",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"version"},
584
u,{name:"PFX.macData",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",
585
-tagClass:k.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},x={name:"SafeBag",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,
586
-value:[{name:"SafeBag.bagId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},w={name:"Attribute",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,
587
-capture:"oid"},{name:"Attribute.attrValues",tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0,capture:"values"}]},F={name:"CertBag",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:k.Class.UNIVERSAL,type:k.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};
588
-q.pkcs12FromAsn1=function(b,l,p){"string"===typeof l?(p=l,l=!0):void 0===l&&(l=!0);var u={};if(!k.validate(b,C,u,[]))throw l=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX."),l.errors=l,l;var x={version:u.version.charCodeAt(0),safeContents:[],getBags:function(b){var d={},e;"localKeyId"in b?e=b.localKeyId:"localKeyIdHex"in b&&(e=a.util.hexToBytes(b.localKeyIdHex));void 0===e&&!("friendlyName"in b)&&"bagType"in b&&(d[b.bagType]=c(x.safeContents,null,null,b.bagType));void 0!==e&&
589
-(d.localKeyId=c(x.safeContents,"localKeyId",e,b.bagType));"friendlyName"in b&&(d.friendlyName=c(x.safeContents,"friendlyName",b.friendlyName,b.bagType));return d},getBagsByFriendlyName:function(a,b){return c(x.safeContents,"friendlyName",a,b)},getBagsByLocalKeyId:function(a,b){return c(x.safeContents,"localKeyId",a,b)}};if(3!==u.version.charCodeAt(0))throw l=Error("PKCS#12 PFX of version other than 3 not supported."),l.version=u.version.charCodeAt(0),l;if(k.derToOid(u.contentType)!==g.oids.data)throw l=
590
-Error("Only PKCS#12 PFX in password integrity mode supported."),l.oid=k.derToOid(u.contentType),l;b=u.content.value[0];if(b.tagClass!==k.Class.UNIVERSAL||b.type!==k.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");b=d(b);if(u.mac){var w=null,z=0,r=k.derToOid(u.macAlgorithm);switch(r){case g.oids.sha1:w=a.md.sha1.create();z=20;break;case g.oids.sha256:w=a.md.sha256.create();z=32;break;case g.oids.sha384:w=a.md.sha384.create();z=48;break;case g.oids.sha512:w=a.md.sha512.create();
591
-z=64;break;case g.oids.md5:w=a.md.md5.create(),z=16}if(null===w)throw Error("PKCS#12 uses unsupported MAC algorithm: "+r);var r=new a.util.ByteBuffer(u.macSalt),F="macIterations"in u?parseInt(a.util.bytesToHex(u.macIterations),16):1,z=q.generateKey(p,r,3,F,z,w),r=a.hmac.create();r.start(w,z);r.update(b.value);if(r.getMac().getBytes()!==u.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?");}e(x,b.value,l,p);return x};q.toPkcs12Asn1=function(b,c,d,e){e=e||{};e.saltSize=e.saltSize||
592
-8;e.count=e.count||2048;e.algorithm=e.algorithm||e.encAlgorithm||"aes128";"useMac"in e||(e.useMac=!0);"localKeyId"in e||(e.localKeyId=null);"generateLocalKeyId"in e||(e.generateLocalKeyId=!0);var h=e.localKeyId,l;if(null!==h)h=a.util.hexToBytes(h);else if(e.generateLocalKeyId)if(c){var m=a.util.isArray(c)?c[0]:c;"string"===typeof m&&(m=g.certificateFromPem(m));h=a.md.sha1.create();h.update(k.toDer(g.certificateToAsn1(m)).getBytes());h=h.digest().getBytes()}else h=a.random.getBytes(20);m=[];null!==
593
-h&&m.push(k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.localKeyId).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,h)])]));"friendlyName"in e&&m.push(k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.friendlyName).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,k.Type.BMPSTRING,!1,e.friendlyName)])]));
594
-0<m.length&&(l=k.create(k.Class.UNIVERSAL,k.Type.SET,!0,m));h=[];m=[];null!==c&&(m=a.util.isArray(c)?c:[c]);for(var p=[],u=0;u<m.length;++u){c=m[u];"string"===typeof c&&(c=g.certificateFromPem(c));var x=0===u?l:void 0;c=g.certificateToAsn1(c);c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.certBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.x509Certificate).getBytes()),
595
-k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(c).getBytes())])])]),x]);p.push(c)}0<p.length&&(c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,p),c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(c).getBytes())])]),h.push(c));c=null;null!==b&&(b=g.wrapRsaPrivateKey(g.privateKeyToAsn1(b)),
596
-c=null===d?k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.keyBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[b]),l]):k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.pkcs8ShroudedKeyBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[g.encryptPrivateKeyInfo(b,d,e)]),l]),b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[c]),b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,
597
-[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(b).getBytes())])]),h.push(b));l=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,h);var w;e.useMac&&(h=a.md.sha1.create(),w=new a.util.ByteBuffer(a.random.getBytes(e.saltSize)),e=e.count,b=q.generateKey(d,w,3,e,20),d=a.hmac.create(),d.start(h,b),d.update(k.toDer(l).getBytes()),d=d.getMac(),w=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,
598
-!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.sha1).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,d.getBytes())]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,w.getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(e).getBytes())]));return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,
599
-k.Type.INTEGER,!1,k.integerToDer(3).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(l).getBytes())])]),w])};q.generateKey=a.pbe.generatePkcs12Key}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,
600
-p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs12)return c.pkcs12;c.defined.pkcs12=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pkcs12}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs12","require module ./asn1 ./hmac ./oids ./pkcs7asn1 ./pbe ./random ./rsa ./sha1 ./util ./x509".split(" "),
601
-function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1,d=a.pki=a.pki||{};d.pemToDer=function(b){b=a.pem.decode(b)[0];if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert PEM to DER; PEM is encrypted.");return a.util.createBuffer(b.body)};d.privateKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PRIVATE KEY"!==b.type&&"RSA PRIVATE KEY"!==b.type){var e=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');
585
+tagClass:k.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},w={name:"SafeBag",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,
586
+value:[{name:"SafeBag.bagId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},y={name:"Attribute",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,
587
+capture:"oid"},{name:"Attribute.attrValues",tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0,capture:"values"}]},E={name:"CertBag",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:k.Class.UNIVERSAL,type:k.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};
588
+r.pkcs12FromAsn1=function(b,l,n){"string"===typeof l?(n=l,l=!0):void 0===l&&(l=!0);var u={};if(!k.validate(b,C,u,[]))throw l=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX."),l.errors=l,l;var w={version:u.version.charCodeAt(0),safeContents:[],getBags:function(b){var d={},e;"localKeyId"in b?e=b.localKeyId:"localKeyIdHex"in b&&(e=a.util.hexToBytes(b.localKeyIdHex));void 0===e&&!("friendlyName"in b)&&"bagType"in b&&(d[b.bagType]=c(w.safeContents,null,null,b.bagType));void 0!==e&&
589
+(d.localKeyId=c(w.safeContents,"localKeyId",e,b.bagType));"friendlyName"in b&&(d.friendlyName=c(w.safeContents,"friendlyName",b.friendlyName,b.bagType));return d},getBagsByFriendlyName:function(a,b){return c(w.safeContents,"friendlyName",a,b)},getBagsByLocalKeyId:function(a,b){return c(w.safeContents,"localKeyId",a,b)}};if(3!==u.version.charCodeAt(0))throw l=Error("PKCS#12 PFX of version other than 3 not supported."),l.version=u.version.charCodeAt(0),l;if(k.derToOid(u.contentType)!==g.oids.data)throw l=
590
+Error("Only PKCS#12 PFX in password integrity mode supported."),l.oid=k.derToOid(u.contentType),l;b=u.content.value[0];if(b.tagClass!==k.Class.UNIVERSAL||b.type!==k.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");b=d(b);if(u.mac){var y=null,x=0,q=k.derToOid(u.macAlgorithm);switch(q){case g.oids.sha1:y=a.md.sha1.create();x=20;break;case g.oids.sha256:y=a.md.sha256.create();x=32;break;case g.oids.sha384:y=a.md.sha384.create();x=48;break;case g.oids.sha512:y=a.md.sha512.create();
591
+x=64;break;case g.oids.md5:y=a.md.md5.create(),x=16}if(null===y)throw Error("PKCS#12 uses unsupported MAC algorithm: "+q);var q=new a.util.ByteBuffer(u.macSalt),E="macIterations"in u?parseInt(a.util.bytesToHex(u.macIterations),16):1,x=r.generateKey(n,q,3,E,x,y),q=a.hmac.create();q.start(y,x);q.update(b.value);if(q.getMac().getBytes()!==u.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?");}e(w,b.value,l,n);return w};r.toPkcs12Asn1=function(b,c,d,e){e=e||{};e.saltSize=e.saltSize||
592
+8;e.count=e.count||2048;e.algorithm=e.algorithm||e.encAlgorithm||"aes128";"useMac"in e||(e.useMac=!0);"localKeyId"in e||(e.localKeyId=null);"generateLocalKeyId"in e||(e.generateLocalKeyId=!0);var h=e.localKeyId,m;if(null!==h)h=a.util.hexToBytes(h);else if(e.generateLocalKeyId)if(c){var l=a.util.isArray(c)?c[0]:c;"string"===typeof l&&(l=g.certificateFromPem(l));h=a.md.sha1.create();h.update(k.toDer(g.certificateToAsn1(l)).getBytes());h=h.digest().getBytes()}else h=a.random.getBytes(20);l=[];null!==
593
+h&&l.push(k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.localKeyId).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,h)])]));"friendlyName"in e&&l.push(k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.friendlyName).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,k.Type.BMPSTRING,!1,e.friendlyName)])]));
594
+0<l.length&&(m=k.create(k.Class.UNIVERSAL,k.Type.SET,!0,l));h=[];l=[];null!==c&&(l=a.util.isArray(c)?c:[c]);for(var n=[],u=0;u<l.length;++u){c=l[u];"string"===typeof c&&(c=g.certificateFromPem(c));var w=0===u?m:void 0;c=g.certificateToAsn1(c);c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.certBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.x509Certificate).getBytes()),
595
+k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(c).getBytes())])])]),w]);n.push(c)}0<n.length&&(c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,n),c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(c).getBytes())])]),h.push(c));c=null;null!==b&&(b=g.wrapRsaPrivateKey(g.privateKeyToAsn1(b)),
596
+c=null===d?k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.keyBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[b]),m]):k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.pkcs8ShroudedKeyBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[g.encryptPrivateKeyInfo(b,d,e)]),m]),b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[c]),b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,
597
+[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(b).getBytes())])]),h.push(b));m=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,h);var y;e.useMac&&(h=a.md.sha1.create(),y=new a.util.ByteBuffer(a.random.getBytes(e.saltSize)),e=e.count,b=r.generateKey(d,y,3,e,20),d=a.hmac.create(),d.start(h,b),d.update(k.toDer(m).getBytes()),d=d.getMac(),y=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,
598
+!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.sha1).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,d.getBytes())]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,y.getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(e).getBytes())]));return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,
599
+k.Type.INTEGER,!1,k.integerToDer(3).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(g.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(m).getBytes())])]),y])};r.generateKey=a.pbe.generatePkcs12Key}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,
600
+n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs12)return c.pkcs12;c.defined.pkcs12=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pkcs12}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs12","require module ./asn1 ./hmac ./oids ./pkcs7asn1 ./pbe ./random ./rsa ./sha1 ./util ./x509".split(" "),
601
+function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1,d=a.pki=a.pki||{};d.pemToDer=function(b){b=a.pem.decode(b)[0];if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert PEM to DER; PEM is encrypted.");return a.util.createBuffer(b.body)};d.privateKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PRIVATE KEY"!==b.type&&"RSA PRIVATE KEY"!==b.type){var e=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');
602
e.headerType=b.type;throw e;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert private key from PEM; PEM is encrypted.");b=c.fromDer(b.body);return d.privateKeyFromAsn1(b)};d.privateKeyToPem=function(b,e){var l={type:"RSA PRIVATE KEY",body:c.toDer(d.privateKeyToAsn1(b)).getBytes()};return a.pem.encode(l,{maxline:e})};d.privateKeyInfoToPem=function(b,d){var e={type:"PRIVATE KEY",body:c.toDer(b).getBytes()};return a.pem.encode(e,{maxline:d})}}if("function"!==typeof a)if("object"===
603
-typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pki)return c.pki;c.defined.pki=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pki}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,
604
-Array.prototype.slice.call(arguments,0))};a("js/pki","require module ./asn1 ./oids ./pbe ./pem ./pbkdf2 ./pkcs12 ./pss ./rsa ./util ./x509".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=function(b,c,d,e){var g=a.util.createBuffer(),k=b.length>>1,h=k+(b.length&1),l=b.substr(0,h),h=b.substr(k,h);b=a.util.createBuffer();k=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);k.start("MD5",l);l=a.util.createBuffer();b.putBytes(d);
605
-for(var p=0;p<m;++p)k.start(null,null),k.update(b.getBytes()),b.putBuffer(k.digest()),k.start(null,null),k.update(b.bytes()+d),l.putBuffer(k.digest());k.start("SHA1",h);h=a.util.createBuffer();b.clear();b.putBytes(d);for(p=0;p<c;++p)k.start(null,null),k.update(b.getBytes()),b.putBuffer(k.digest()),k.start(null,null),k.update(b.bytes()+d),h.putBuffer(k.digest());g.putBytes(a.util.xorBytes(l.getBytes(),h.getBytes(),e));return g},d=function(b,c,d){d=!1;try{var e=b.deflate(c.fragment.getBytes());c.fragment=
606
-a.util.createBuffer(e);c.length=e.length;d=!0}catch(g){}return d},e=function(b,c,d){d=!1;try{var e=b.inflate(c.fragment.getBytes());c.fragment=a.util.createBuffer(e);c.length=e.length;d=!0}catch(g){}return d},l=function(b,c){var d=0;switch(c){case 1:d=b.getByte();break;case 2:d=b.getInt16();break;case 3:d=b.getInt24();break;case 4:d=b.getInt32()}return a.util.createBuffer(b.getBytes(d))},p=function(a,b,c){a.putInt(c.length(),b<<3);a.putBuffer(c)},k={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,
603
+typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pki)return c.pki;c.defined.pki=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pki}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,
604
+Array.prototype.slice.call(arguments,0))};a("js/pki","require module ./asn1 ./oids ./pbe ./pem ./pbkdf2 ./pkcs12 ./pss ./rsa ./util ./x509".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=function(b,c,d,e){var g=a.util.createBuffer(),k=b.length>>1,h=k+(b.length&1),l=b.substr(0,h),h=b.substr(k,h);b=a.util.createBuffer();k=a.hmac.create();d=c+d;var m=Math.ceil(e/16);c=Math.ceil(e/20);k.start("MD5",l);l=a.util.createBuffer();b.putBytes(d);
605
+for(var n=0;n<m;++n)k.start(null,null),k.update(b.getBytes()),b.putBuffer(k.digest()),k.start(null,null),k.update(b.bytes()+d),l.putBuffer(k.digest());k.start("SHA1",h);h=a.util.createBuffer();b.clear();b.putBytes(d);for(n=0;n<c;++n)k.start(null,null),k.update(b.getBytes()),b.putBuffer(k.digest()),k.start(null,null),k.update(b.bytes()+d),h.putBuffer(k.digest());g.putBytes(a.util.xorBytes(l.getBytes(),h.getBytes(),e));return g},d=function(b,c,d){d=!1;try{var e=b.deflate(c.fragment.getBytes());c.fragment=
606
+a.util.createBuffer(e);c.length=e.length;d=!0}catch(g){}return d},e=function(b,c,d){d=!1;try{var e=b.inflate(c.fragment.getBytes());c.fragment=a.util.createBuffer(e);c.length=e.length;d=!0}catch(g){}return d},l=function(b,c){var d=0;switch(c){case 1:d=b.getByte();break;case 2:d=b.getInt16();break;case 3:d=b.getInt24();break;case 4:d=b.getInt32()}return a.util.createBuffer(b.getBytes(d))},n=function(a,b,c){a.putInt(c.length(),b<<3);a.putBuffer(c)},k={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,
607
minor:2},TLS_1_2:{major:3,minor:3}}};k.SupportedVersions=[k.Versions.TLS_1_1,k.Versions.TLS_1_0];k.Version=k.SupportedVersions[0];k.MaxFragment=15360;k.ConnectionEnd={server:0,client:1};k.PRFAlgorithm={tls_prf_sha256:0};k.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};k.CipherType={stream:0,block:1,aead:2};k.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};k.CompressionMethod={none:0,deflate:1};k.ContentType={change_cipher_spec:20,alert:21,handshake:22,
608
application_data:23,heartbeat:24};k.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20};k.Alert={};k.Alert.Level={warning:1,fatal:2};k.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,
609
certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100};k.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};k.CipherSuites={};k.getCipherSuite=function(a){var b=null,c;for(c in k.CipherSuites){var d=k.CipherSuites[c];if(d.id[0]===a.charCodeAt(0)&&d.id[1]===a.charCodeAt(1)){b=d;break}}return b};
@@ -613,52 +613,52 @@ l(c,1));h=d-(h-c.length());if(0<h){for(d=l(c,2);0<d.length();)e.extensions.push(
613
send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.protocol_version}});if(g)b.session.cipherSuite=k.getCipherSuite(e.cipher_suite);else for(d=a.util.createBuffer(e.cipher_suites.bytes());0<d.length()&&(b.session.cipherSuite=k.getCipherSuite(d.getBytes(2)),null===b.session.cipherSuite););if(null===b.session.cipherSuite)return b.error(b,{message:"No cipher suites in common.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.handshake_failure},cipherSuite:a.util.bytesToHex(e.cipher_suite)});
614
b.session.compressionMethod=g?e.compression_method:k.CompressionMethod.none}return e};k.createSecurityParameters=function(a,b){var c=a.entity===k.ConnectionEnd.client,d=b.random.bytes(),e=c?a.session.sp.client_random:d,c=c?d:k.createRandom().getBytes();a.session.sp={entity:a.entity,prf_algorithm:k.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,
615
compression_algorithm:a.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:e,server_random:c}};k.handleServerHello=function(a,b,c){b=k.parseHelloMessage(a,b,c);if(!a.fail){if(b.version.minor<=a.version.minor)a.version.minor=b.version.minor;else return a.error(a,{message:"Incompatible TLS version.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.protocol_version}});a.session.version=a.version;c=b.session_id.bytes();0<c.length&&c===a.session.id?
616
-(a.expect=x,a.session.resuming=!0,a.session.sp.server_random=b.random.bytes()):(a.expect=g,a.session.resuming=!1,k.createSecurityParameters(a,b));a.session.id=c;a.process()}};k.handleClientHello=function(b,c,d){c=k.parseHelloMessage(b,c,d);if(!b.fail){var e=c.session_id.bytes();d=null;if(b.sessionCache)if(d=b.sessionCache.getSession(e),null===d)e="";else if(d.version.major!==c.version.major||d.version.minor>c.version.minor)d=null,e="";0===e.length&&(e=a.random.getBytes(32));b.session.id=e;b.session.clientHelloVersion=
617
-c.version;b.session.sp={};if(d)b.version=b.session.version=d.version,b.session.sp=d.sp;else{for(var g,e=1;e<k.SupportedVersions.length&&!(g=k.SupportedVersions[e],g.minor<=c.version.minor);++e);b.version={major:g.major,minor:g.minor};b.session.version=b.version}null!==d?(b.expect=E,b.session.resuming=!0,b.session.sp.client_random=c.random.bytes()):(b.expect=!1!==b.verifyClient?D:A,b.session.resuming=!1,k.createSecurityParameters(b,c));b.open=!0;k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,
616
+(a.expect=w,a.session.resuming=!0,a.session.sp.server_random=b.random.bytes()):(a.expect=g,a.session.resuming=!1,k.createSecurityParameters(a,b));a.session.id=c;a.process()}};k.handleClientHello=function(b,c,d){c=k.parseHelloMessage(b,c,d);if(!b.fail){var e=c.session_id.bytes();d=null;if(b.sessionCache)if(d=b.sessionCache.getSession(e),null===d)e="";else if(d.version.major!==c.version.major||d.version.minor>c.version.minor)d=null,e="";0===e.length&&(e=a.random.getBytes(32));b.session.id=e;b.session.clientHelloVersion=
617
+c.version;b.session.sp={};if(d)b.version=b.session.version=d.version,b.session.sp=d.sp;else{for(var g,e=1;e<k.SupportedVersions.length&&!(g=k.SupportedVersions[e],g.minor<=c.version.minor);++e);b.version={major:g.major,minor:g.minor};b.session.version=b.version}null!==d?(b.expect=D,b.session.resuming=!0,b.session.sp.client_random=c.random.bytes()):(b.expect=!1!==b.verifyClient?F:A,b.session.resuming=!1,k.createSecurityParameters(b,c));b.open=!0;k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,
618
data:k.createServerHello(b)}));b.session.resuming?(k.queue(b,k.createRecord(b,{type:k.ContentType.change_cipher_spec,data:k.createChangeCipherSpec()})),b.state.pending=k.createConnectionState(b),b.state.current.write=b.state.pending.write,k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createFinished(b)}))):(k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createCertificate(b)})),b.fail||(k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createServerKeyExchange(b)})),
619
!1!==b.verifyClient&&k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createCertificateRequest(b)})),k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createServerHelloDone(b)}))));k.flush(b);b.process()}};k.handleCertificate=function(b,c,d){if(3>d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});d=l(c.fragment,3);var e,g;c=[];try{for(;0<d.length();)e=
620
-l(d,3),g=a.asn1.fromDer(e),e=a.pki.certificateFromAsn1(g,!0),c.push(e)}catch(h){return b.error(b,{message:"Could not parse certificate list.",cause:h,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate}})}e=b.entity===k.ConnectionEnd.client;!e&&!0!==b.verifyClient||0!==c.length?0===c.length?b.expect=e?q:A:(e?b.session.serverCertificate=c[0]:b.session.clientCertificate=c[0],k.verifyCertificateChain(b,c)&&(b.expect=e?q:A)):b.error(b,{message:e?"No server certificate provided.":
620
+l(d,3),g=a.asn1.fromDer(e),e=a.pki.certificateFromAsn1(g,!0),c.push(e)}catch(h){return b.error(b,{message:"Could not parse certificate list.",cause:h,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate}})}e=b.entity===k.ConnectionEnd.client;!e&&!0!==b.verifyClient||0!==c.length?0===c.length?b.expect=e?r:A:(e?b.session.serverCertificate=c[0]:b.session.clientCertificate=c[0],k.verifyCertificateChain(b,c)&&(b.expect=e?r:A)):b.error(b,{message:e?"No server certificate provided.":
621
"No client certificate provided.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});b.process()};k.handleServerKeyExchange=function(a,b,c){if(0<c)return a.error(a,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.unsupported_certificate}});a.expect=u;a.process()};k.handleClientKeyExchange=function(b,c,d){if(48>d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.",
622
send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.unsupported_certificate}});c=l(c.fragment,2).getBytes();d=null;if(b.getPrivateKey)try{d=b.getPrivateKey(b,b.session.serverCertificate),d=a.pki.privateKeyFromPem(d)}catch(e){b.error(b,{message:"Could not get private key.",cause:e,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}});
623
-try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=E;null!==b.session.clientCertificate&&(b.expect=y);b.process()};k.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:k.Alert.Level.fatal,
623
+try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=D;null!==b.session.clientCertificate&&(b.expect=z);b.process()};k.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:k.Alert.Level.fatal,
624
description:k.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:l(b,1),certificate_authorities:l(b,2)};a.session.certificateRequest=b;a.expect=C;a.process()};k.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=l(d,2).getBytes();var e=a.util.createBuffer();e.putBuffer(b.session.md5.digest());
625
-e.putBuffer(b.session.sha1.digest());e=e.getBytes();try{if(!b.session.clientCertificate.publicKey.verify(e,d,"NONE"))throw Error("CertificateVerify signature does not match.");b.session.md5.update(c);b.session.sha1.update(c)}catch(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.handshake_failure}})}b.expect=E;b.process()};k.handleServerHelloDone=function(b,c,d){if(0<d)return b.error(b,{message:"Invalid ServerHelloDone message. Invalid length.",
625
+e.putBuffer(b.session.sha1.digest());e=e.getBytes();try{if(!b.session.clientCertificate.publicKey.verify(e,d,"NONE"))throw Error("CertificateVerify signature does not match.");b.session.md5.update(c);b.session.sha1.update(c)}catch(g){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.handshake_failure}})}b.expect=D;b.process()};k.handleServerHelloDone=function(b,c,d){if(0<d)return b.error(b,{message:"Invalid ServerHelloDone message. Invalid length.",
626
send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.record_overflow}});if(null===b.serverCertificate&&(c={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.insufficient_security}},d=b.verify(b,c.alert.description,0,[]),!0!==d)){if(d||0===d)"object"!==typeof d||a.util.isArray(d)?"number"===typeof d&&(c.alert.description=d):(d.message&&(c.message=d.message),d.alert&&(c.alert.description=d.alert));
627
-return b.error(b,c)}null!==b.session.certificateRequest&&(c=k.createRecord(b,{type:k.ContentType.handshake,data:k.createCertificate(b)}),k.queue(b,c));c=k.createRecord(b,{type:k.ContentType.handshake,data:k.createClientKeyExchange(b)});k.queue(b,c);b.expect=H;c=function(a,b){null!==a.session.certificateRequest&&null!==a.session.clientCertificate&&k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createCertificateVerify(a,b)}));k.queue(a,k.createRecord(a,{type:k.ContentType.change_cipher_spec,
628
-data:k.createChangeCipherSpec()}));a.state.pending=k.createConnectionState(a);a.state.current.write=a.state.pending.write;k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createFinished(a)}));a.expect=x;k.flush(a);a.process()};if(null===b.session.certificateRequest||null===b.session.clientCertificate)return c(b,null);k.getClientSignature(b,c)};k.handleChangeCipherSpec=function(a,b){if(1!==b.fragment.getByte())return a.error(a,{message:"Invalid ChangeCipherSpec message received.",send:!0,
629
-alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});var c=a.entity===k.ConnectionEnd.client;if(a.session.resuming&&c||!a.session.resuming&&!c)a.state.pending=k.createConnectionState(a);a.state.current.read=a.state.pending.read;if(!a.session.resuming&&c||a.session.resuming&&!c)a.state.pending=null;a.expect=c?w:L;a.process()};k.handleFinished=function(b,d,e){e=d.fragment;e.read-=4;var g=e.bytes();e.read+=4;d=d.fragment.getBytes();e=a.util.createBuffer();e.putBuffer(b.session.md5.digest());
627
+return b.error(b,c)}null!==b.session.certificateRequest&&(c=k.createRecord(b,{type:k.ContentType.handshake,data:k.createCertificate(b)}),k.queue(b,c));c=k.createRecord(b,{type:k.ContentType.handshake,data:k.createClientKeyExchange(b)});k.queue(b,c);b.expect=I;c=function(a,b){null!==a.session.certificateRequest&&null!==a.session.clientCertificate&&k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createCertificateVerify(a,b)}));k.queue(a,k.createRecord(a,{type:k.ContentType.change_cipher_spec,
628
+data:k.createChangeCipherSpec()}));a.state.pending=k.createConnectionState(a);a.state.current.write=a.state.pending.write;k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createFinished(a)}));a.expect=w;k.flush(a);a.process()};if(null===b.session.certificateRequest||null===b.session.clientCertificate)return c(b,null);k.getClientSignature(b,c)};k.handleChangeCipherSpec=function(a,b){if(1!==b.fragment.getByte())return a.error(a,{message:"Invalid ChangeCipherSpec message received.",send:!0,
629
+alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});var c=a.entity===k.ConnectionEnd.client;if(a.session.resuming&&c||!a.session.resuming&&!c)a.state.pending=k.createConnectionState(a);a.state.current.read=a.state.pending.read;if(!a.session.resuming&&c||a.session.resuming&&!c)a.state.pending=null;a.expect=c?y:M;a.process()};k.handleFinished=function(b,d,e){e=d.fragment;e.read-=4;var g=e.bytes();e.read+=4;d=d.fragment.getBytes();e=a.util.createBuffer();e.putBuffer(b.session.md5.digest());
630
e.putBuffer(b.session.sha1.digest());var h=b.entity===k.ConnectionEnd.client;e=c(b.session.sp.master_secret,h?"server finished":"client finished",e.getBytes(),12);if(e.getBytes()!==d)return b.error(b,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.decrypt_error}});b.session.md5.update(g);b.session.sha1.update(g);if(b.session.resuming&&h||!b.session.resuming&&!h)k.queue(b,k.createRecord(b,{type:k.ContentType.change_cipher_spec,
631
-data:k.createChangeCipherSpec()})),b.state.current.write=b.state.pending.write,b.state.pending=null,k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createFinished(b)}));b.expect=h?F:U;b.handshaking=!1;++b.handshakes;b.peerCertificate=h?b.session.serverCertificate:b.session.clientCertificate;k.flush(b);b.isConnected=!0;b.connected(b);b.process()};k.handleAlert=function(a,b){var c=b.fragment,c={level:c.getByte(),description:c.getByte()},d;switch(c.description){case k.Alert.Description.close_notify:d=
631
+data:k.createChangeCipherSpec()})),b.state.current.write=b.state.pending.write,b.state.pending=null,k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createFinished(b)}));b.expect=h?E:U;b.handshaking=!1;++b.handshakes;b.peerCertificate=h?b.session.serverCertificate:b.session.clientCertificate;k.flush(b);b.isConnected=!0;b.connected(b);b.process()};k.handleAlert=function(a,b){var c=b.fragment,c={level:c.getByte(),description:c.getByte()},d;switch(c.description){case k.Alert.Description.close_notify:d=
632
"Connection closed.";break;case k.Alert.Description.unexpected_message:d="Unexpected message.";break;case k.Alert.Description.bad_record_mac:d="Bad record MAC.";break;case k.Alert.Description.decryption_failed:d="Decryption failed.";break;case k.Alert.Description.record_overflow:d="Record overflow.";break;case k.Alert.Description.decompression_failure:d="Decompression failed.";break;case k.Alert.Description.handshake_failure:d="Handshake failure.";break;case k.Alert.Description.bad_certificate:d=
633
"Bad certificate.";break;case k.Alert.Description.unsupported_certificate:d="Unsupported certificate.";break;case k.Alert.Description.certificate_revoked:d="Certificate revoked.";break;case k.Alert.Description.certificate_expired:d="Certificate expired.";break;case k.Alert.Description.certificate_unknown:d="Certificate unknown.";break;case k.Alert.Description.illegal_parameter:d="Illegal parameter.";break;case k.Alert.Description.unknown_ca:d="Unknown certificate authority.";break;case k.Alert.Description.access_denied:d=
634
"Access denied.";break;case k.Alert.Description.decode_error:d="Decode error.";break;case k.Alert.Description.decrypt_error:d="Decrypt error.";break;case k.Alert.Description.export_restriction:d="Export restriction.";break;case k.Alert.Description.protocol_version:d="Unsupported protocol version.";break;case k.Alert.Description.insufficient_security:d="Insufficient security.";break;case k.Alert.Description.internal_error:d="Internal error.";break;case k.Alert.Description.user_canceled:d="User canceled.";
635
break;case k.Alert.Description.no_renegotiation:d="Renegotiation not supported.";break;default:d="Unknown error."}if(c.description===k.Alert.Description.close_notify)return a.close();a.error(a,{message:d,send:!1,origin:a.entity===k.ConnectionEnd.client?"server":"client",alert:c});a.process()};k.handleHandshake=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt24();if(g>d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+
636
4);d.read+=4;e in Z[b.entity][b.expect]?(b.entity!==k.ConnectionEnd.server||b.open||b.fail||(b.handshaking=!0,b.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:a.md.md5.create(),sha1:a.md.sha1.create()}),e!==k.HandshakeType.hello_request&&e!==k.HandshakeType.certificate_verify&&e!==k.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),Z[b.entity][b.expect][e](b,c,g)):
637
k.handleUnexpected(b,c)};k.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};k.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===k.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();k.queue(b,k.createRecord(b,{type:k.ContentType.heartbeat,data:k.createHeartbeat(k.HeartbeatMessageType.heartbeat_response,d)}));k.flush(b)}else if(e===k.HeartbeatMessageType.heartbeat_response){if(d!==
638
-b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var g=1,q=2,u=3,C=4,x=5,w=6,F=7,H=8,D=1,A=2,y=3,E=4,L=5,U=6,r=k.handleUnexpected,P=k.handleChangeCipherSpec,T=k.handleAlert,M=k.handleHandshake,ba=k.handleApplicationData,R=k.handleHeartbeat,S=[];S[k.ConnectionEnd.client]=[[r,T,M,r,R],[r,T,M,r,R],[r,T,M,r,R],[r,T,M,r,R],[r,T,M,r,R],[P,T,r,r,R],[r,T,M,r,R],[r,T,M,ba,R],[r,T,M,r,R]];S[k.ConnectionEnd.server]=[[r,T,M,r,R],[r,
639
-T,M,r,R],[r,T,M,r,R],[r,T,M,r,R],[P,T,r,r,R],[r,T,M,r,R],[r,T,M,ba,R],[r,T,M,r,R]];var P=k.handleHelloRequest,T=k.handleCertificate,M=k.handleServerKeyExchange,ba=k.handleCertificateRequest,R=k.handleServerHelloDone,V=k.handleFinished,Z=[];Z[k.ConnectionEnd.client]=[[r,r,k.handleServerHello,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[P,r,r,r,r,r,r,r,r,r,r,T,M,ba,R,r,r,r,r,r,r],[P,r,r,r,r,r,r,r,r,r,r,r,M,ba,R,r,r,r,r,r,r],[P,r,r,r,r,r,r,r,r,r,r,r,r,ba,R,r,r,r,r,r,r],[P,r,r,r,r,r,r,r,r,r,r,r,r,r,R,r,r,r,
640
-r,r,r],[P,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[P,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,V],[P,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[P,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r]];Z[k.ConnectionEnd.server]=[[r,k.handleClientHello,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,T,r,r,r,r,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,k.handleClientKeyExchange,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,k.handleCertificateVerify,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[r,r,
641
-r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,V],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r]];k.generateKeys=function(a,b){var d=b.client_random+b.server_random;a.session.resuming||(b.master_secret=c(b.pre_master_secret,"master secret",d,48).bytes(),b.pre_master_secret=null);var d=b.server_random+b.client_random,e=2*b.mac_key_length+2*b.enc_key_length,g=a.version.major===k.Versions.TLS_1_0.major&&a.version.minor===k.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);
638
+b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var g=1,r=2,u=3,C=4,w=5,y=6,E=7,I=8,F=1,A=2,z=3,D=4,M=5,U=6,q=k.handleUnexpected,G=k.handleChangeCipherSpec,V=k.handleAlert,T=k.handleHandshake,ba=k.handleApplicationData,P=k.handleHeartbeat,S=[];S[k.ConnectionEnd.client]=[[q,V,T,q,P],[q,V,T,q,P],[q,V,T,q,P],[q,V,T,q,P],[q,V,T,q,P],[G,V,q,q,P],[q,V,T,q,P],[q,V,T,ba,P],[q,V,T,q,P]];S[k.ConnectionEnd.server]=[[q,V,T,q,P],[q,
639
+V,T,q,P],[q,V,T,q,P],[q,V,T,q,P],[G,V,q,q,P],[q,V,T,q,P],[q,V,T,ba,P],[q,V,T,q,P]];var G=k.handleHelloRequest,V=k.handleCertificate,T=k.handleServerKeyExchange,ba=k.handleCertificateRequest,P=k.handleServerHelloDone,ca=k.handleFinished,Z=[];Z[k.ConnectionEnd.client]=[[q,q,k.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[G,q,q,q,q,q,q,q,q,q,q,V,T,ba,P,q,q,q,q,q,q],[G,q,q,q,q,q,q,q,q,q,q,q,T,ba,P,q,q,q,q,q,q],[G,q,q,q,q,q,q,q,q,q,q,q,q,ba,P,q,q,q,q,q,q],[G,q,q,q,q,q,q,q,q,q,q,q,q,q,P,q,q,q,
640
+q,q,q],[G,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[G,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,ca],[G,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[G,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];Z[k.ConnectionEnd.server]=[[q,k.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,V,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,k.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,k.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,
641
+q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,ca],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];k.generateKeys=function(a,b){var d=b.client_random+b.server_random;a.session.resuming||(b.master_secret=c(b.pre_master_secret,"master secret",d,48).bytes(),b.pre_master_secret=null);var d=b.server_random+b.client_random,e=2*b.mac_key_length+2*b.enc_key_length,g=a.version.major===k.Versions.TLS_1_0.major&&a.version.minor===k.Versions.TLS_1_0.minor;g&&(e+=2*b.fixed_iv_length);
642
d=c(b.master_secret,"key expansion",d,e);e={client_write_MAC_key:d.getBytes(b.mac_key_length),server_write_MAC_key:d.getBytes(b.mac_key_length),client_write_key:d.getBytes(b.enc_key_length),server_write_key:d.getBytes(b.enc_key_length)};g&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};k.createConnectionState=function(a){var b=a.entity===k.ConnectionEnd.client,c=function(){var a={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,
643
cipherState:null,cipherFunction:function(a){return!0},compressionState:null,compressFunction:function(a){return!0},updateSequenceNumber:function(){4294967295===a.sequenceNumber[1]?(a.sequenceNumber[1]=0,++a.sequenceNumber[0]):++a.sequenceNumber[1]}};return a},g={read:c(),write:c()};g.read.update=function(a,b){g.read.cipherFunction(b,g.read)?g.read.compressFunction(a,b,g.read)||a.error(a,{message:"Could not decompress record.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.decompression_failure}}):
644
a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_record_mac}});return!a.fail};g.write.update=function(a,b){g.write.compressFunction(a,b,g.write)?g.write.cipherFunction(b,g.write)||a.error(a,{message:"Could not encrypt record.",send:!1,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}});
645
return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=k.generateKeys(a,c),g.read.macKey=b?c.keys.server_write_MAC_key:c.keys.client_write_MAC_key,g.write.macKey=b?c.keys.client_write_MAC_key:c.keys.server_write_MAC_key,a.session.cipherSuite.initConnectionState(g,a,c),c.compression_algorithm){case k.CompressionMethod.none:break;case k.CompressionMethod.deflate:g.read.compressFunction=e;g.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm.");
646
}return g};k.createRandom=function(){var b=new Date,b=+b+6E4*b.getTimezoneOffset(),c=a.util.createBuffer();c.putInt32(b);c.putBytes(a.random.getBytes(28));return c};k.createRecord=function(a,b){return b.data?{type:b.type,version:{major:a.version.major,minor:a.version.minor},length:b.data.length(),fragment:b.data}:null};k.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return k.createRecord(b,{type:k.ContentType.alert,data:d})};k.createClientHello=
647
-function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d<b.cipherSuites.length;++d){var e=b.cipherSuites[d];c.putByte(e.id[0]);c.putByte(e.id[1])}var g=c.length(),d=a.util.createBuffer();d.putByte(k.CompressionMethod.none);var h=d.length(),e=a.util.createBuffer();if(b.virtualHost){var l=a.util.createBuffer();l.putByte(0);l.putByte(0);var m=a.util.createBuffer();m.putByte(0);p(m,2,a.util.createBuffer(b.virtualHost));var u=a.util.createBuffer();
648
-p(u,2,m);p(l,2,u);e.putBuffer(l)}l=e.length();0<l&&(l+=2);m=b.session.id;g=m.length+1+2+4+28+2+g+1+h+l;h=a.util.createBuffer();h.putByte(k.HandshakeType.client_hello);h.putInt24(g);h.putByte(b.version.major);h.putByte(b.version.minor);h.putBytes(b.session.sp.client_random);p(h,1,a.util.createBuffer(m));p(h,2,c);p(h,1,d);0<l&&p(h,2,e);return h};k.createServerHello=function(b){var c=b.session.id,d=c.length+1+2+4+28+2+1,e=a.util.createBuffer();e.putByte(k.HandshakeType.server_hello);e.putInt24(d);e.putByte(b.version.major);
649
-e.putByte(b.version.minor);e.putBytes(b.session.sp.server_random);p(e,1,a.util.createBuffer(c));e.putByte(b.session.cipherSuite.id[0]);e.putByte(b.session.cipherSuite.id[1]);e.putByte(b.session.compressionMethod);return e};k.createCertificate=function(b){var c=b.entity===k.ConnectionEnd.client,d=null;b.getCertificate&&(d=b.getCertificate(b,c?b.session.certificateRequest:b.session.extensions.server_name.serverNameList));var e=a.util.createBuffer();if(null!==d)try{a.util.isArray(d)||(d=[d]);for(var g=
647
+function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d<b.cipherSuites.length;++d){var e=b.cipherSuites[d];c.putByte(e.id[0]);c.putByte(e.id[1])}var g=c.length(),d=a.util.createBuffer();d.putByte(k.CompressionMethod.none);var h=d.length(),e=a.util.createBuffer();if(b.virtualHost){var l=a.util.createBuffer();l.putByte(0);l.putByte(0);var m=a.util.createBuffer();m.putByte(0);n(m,2,a.util.createBuffer(b.virtualHost));var u=a.util.createBuffer();
648
+n(u,2,m);n(l,2,u);e.putBuffer(l)}l=e.length();0<l&&(l+=2);m=b.session.id;g=m.length+1+2+4+28+2+g+1+h+l;h=a.util.createBuffer();h.putByte(k.HandshakeType.client_hello);h.putInt24(g);h.putByte(b.version.major);h.putByte(b.version.minor);h.putBytes(b.session.sp.client_random);n(h,1,a.util.createBuffer(m));n(h,2,c);n(h,1,d);0<l&&n(h,2,e);return h};k.createServerHello=function(b){var c=b.session.id,d=c.length+1+2+4+28+2+1,e=a.util.createBuffer();e.putByte(k.HandshakeType.server_hello);e.putInt24(d);e.putByte(b.version.major);
649
+e.putByte(b.version.minor);e.putBytes(b.session.sp.server_random);n(e,1,a.util.createBuffer(c));e.putByte(b.session.cipherSuite.id[0]);e.putByte(b.session.cipherSuite.id[1]);e.putByte(b.session.compressionMethod);return e};k.createCertificate=function(b){var c=b.entity===k.ConnectionEnd.client,d=null;b.getCertificate&&(d=b.getCertificate(b,c?b.session.certificateRequest:b.session.extensions.server_name.serverNameList));var e=a.util.createBuffer();if(null!==d)try{a.util.isArray(d)||(d=[d]);for(var g=
650
null,h=0;h<d.length;++h){var l=a.pem.decode(d[h])[0];if("CERTIFICATE"!==l.type&&"X509 CERTIFICATE"!==l.type&&"TRUSTED CERTIFICATE"!==l.type){var m=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');m.headerType=l.type;throw m;}if(l.procType&&"ENCRYPTED"===l.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");var u=a.util.createBuffer(l.body);null===g&&(g=a.asn1.fromDer(u.bytes(),!1));
651
-var q=a.util.createBuffer();p(q,3,u);e.putBuffer(q)}d=a.pki.certificateFromAsn1(g);c?b.session.clientCertificate=d:b.session.serverCertificate=d}catch(r){return b.error(b,{message:"Could not send certificate list.",cause:r,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate}})}b=3+e.length();c=a.util.createBuffer();c.putByte(k.HandshakeType.certificate);c.putInt24(b);p(c,3,e);return c};k.createClientKeyExchange=function(b){var c=a.util.createBuffer();c.putByte(b.session.clientHelloVersion.major);
651
+var r=a.util.createBuffer();n(r,3,u);e.putBuffer(r)}d=a.pki.certificateFromAsn1(g);c?b.session.clientCertificate=d:b.session.serverCertificate=d}catch(q){return b.error(b,{message:"Could not send certificate list.",cause:q,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate}})}b=3+e.length();c=a.util.createBuffer();c.putByte(k.HandshakeType.certificate);c.putInt24(b);n(c,3,e);return c};k.createClientKeyExchange=function(b){var c=a.util.createBuffer();c.putByte(b.session.clientHelloVersion.major);
652
c.putByte(b.session.clientHelloVersion.minor);c.putBytes(a.random.getBytes(46));var d=b.session.sp;d.pre_master_secret=c.getBytes();c=b.session.serverCertificate.publicKey.encrypt(d.pre_master_secret);b=c.length+2;d=a.util.createBuffer();d.putByte(k.HandshakeType.client_key_exchange);d.putInt24(b);d.putInt16(c.length);d.putBytes(c);return d};k.createServerKeyExchange=function(b){return a.util.createBuffer()};k.getClientSignature=function(b,c){var d=a.util.createBuffer();d.putBuffer(b.session.md5.digest());
653
d.putBuffer(b.session.sha1.digest());d=d.getBytes();b.getSignature=b.getSignature||function(b,c,d){var e=null;if(b.getPrivateKey)try{e=b.getPrivateKey(b,b.session.clientCertificate),e=a.pki.privateKeyFromPem(e)}catch(g){b.error(b,{message:"Could not get private key.",cause:g,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}})}null===e?b.error(b,{message:"No private key set.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}}):
654
c=e.sign(c,null);d(b,c)};b.getSignature(b,d,c)};k.createCertificateVerify=function(b,c){var d=c.length+2,e=a.util.createBuffer();e.putByte(k.HandshakeType.certificate_verify);e.putInt24(d);e.putInt16(c.length);e.putBytes(c);return e};k.createCertificateRequest=function(b){var c=a.util.createBuffer();c.putByte(1);var d=a.util.createBuffer(),e;for(e in b.caStore.certs){var g=a.pki.distinguishedNameToAsn1(b.caStore.certs[e].subject);d.putBuffer(a.asn1.toDer(g))}b=1+c.length()+2+d.length();e=a.util.createBuffer();
655
-e.putByte(k.HandshakeType.certificate_request);e.putInt24(b);p(e,1,c);p(e,2,d);return e};k.createServerHelloDone=function(b){b=a.util.createBuffer();b.putByte(k.HandshakeType.server_hello_done);b.putInt24(0);return b};k.createChangeCipherSpec=function(){var b=a.util.createBuffer();b.putByte(1);return b};k.createFinished=function(b){var d=a.util.createBuffer();d.putBuffer(b.session.md5.digest());d.putBuffer(b.session.sha1.digest());d=c(b.session.sp.master_secret,b.entity===k.ConnectionEnd.client?"client finished":
655
+e.putByte(k.HandshakeType.certificate_request);e.putInt24(b);n(e,1,c);n(e,2,d);return e};k.createServerHelloDone=function(b){b=a.util.createBuffer();b.putByte(k.HandshakeType.server_hello_done);b.putInt24(0);return b};k.createChangeCipherSpec=function(){var b=a.util.createBuffer();b.putByte(1);return b};k.createFinished=function(b){var d=a.util.createBuffer();d.putBuffer(b.session.md5.digest());d.putBuffer(b.session.sha1.digest());d=c(b.session.sp.master_secret,b.entity===k.ConnectionEnd.client?"client finished":
656
"server finished",d.getBytes(),12);b=a.util.createBuffer();b.putByte(k.HandshakeType.finished);b.putInt24(d.length());b.putBuffer(d);return b};k.createHeartbeat=function(b,c,d){"undefined"===typeof d&&(d=c.length);var e=a.util.createBuffer();e.putByte(b);e.putInt16(d);e.putBytes(c);b=e.length();e.putBytes(a.random.getBytes(Math.max(16,b-d-3)));return e};k.queue=function(b,c){if(c){if(c.type===k.ContentType.handshake){var d=c.fragment.bytes();b.session.md5.update(d);b.session.sha1.update(d)}if(c.fragment.length()<=
657
k.MaxFragment)d=[c];else{for(var d=[],e=c.fragment.bytes();e.length>k.MaxFragment;)d.push(k.createRecord(b,{type:c.type,data:a.util.createBuffer(e.slice(0,k.MaxFragment))})),e=e.slice(k.MaxFragment);0<e.length&&d.push(k.createRecord(b,{type:c.type,data:a.util.createBuffer(e)}))}for(e=0;e<d.length&&!b.fail;++e){var g=d[e];b.state.current.write.update(b,g)&&b.records.push(g)}}};k.flush=function(a){for(var b=0;b<a.records.length;++b){var c=a.records[b];a.tlsData.putByte(c.type);a.tlsData.putByte(c.version.major);
658
a.tlsData.putByte(c.version.minor);a.tlsData.putInt16(c.fragment.length());a.tlsData.putBuffer(a.records[b].fragment)}a.records=[];return a.tlsDataReady(a)};var aa=function(b){switch(b){case !0:return!0;case a.pki.certificateError.bad_certificate:return k.Alert.Description.bad_certificate;case a.pki.certificateError.unsupported_certificate:return k.Alert.Description.unsupported_certificate;case a.pki.certificateError.certificate_revoked:return k.Alert.Description.certificate_revoked;case a.pki.certificateError.certificate_expired:return k.Alert.Description.certificate_expired;
659
-case a.pki.certificateError.certificate_unknown:return k.Alert.Description.certificate_unknown;case a.pki.certificateError.unknown_ca:return k.Alert.Description.unknown_ca;default:return k.Alert.Description.bad_certificate}},ca=function(b){switch(b){case !0:return!0;case k.Alert.Description.bad_certificate:return a.pki.certificateError.bad_certificate;case k.Alert.Description.unsupported_certificate:return a.pki.certificateError.unsupported_certificate;case k.Alert.Description.certificate_revoked:return a.pki.certificateError.certificate_revoked;
659
+case a.pki.certificateError.certificate_unknown:return k.Alert.Description.certificate_unknown;case a.pki.certificateError.unknown_ca:return k.Alert.Description.unknown_ca;default:return k.Alert.Description.bad_certificate}},O=function(b){switch(b){case !0:return!0;case k.Alert.Description.bad_certificate:return a.pki.certificateError.bad_certificate;case k.Alert.Description.unsupported_certificate:return a.pki.certificateError.unsupported_certificate;case k.Alert.Description.certificate_revoked:return a.pki.certificateError.certificate_revoked;
660
case k.Alert.Description.certificate_expired:return a.pki.certificateError.certificate_expired;case k.Alert.Description.certificate_unknown:return a.pki.certificateError.certificate_unknown;case k.Alert.Description.unknown_ca:return a.pki.certificateError.unknown_ca;default:return a.pki.certificateError.bad_certificate}};k.verifyCertificateChain=function(b,c){try{a.pki.verifyCertificateChain(b.caStore,c,function(c,d,e){aa(c);d=b.verify(b,c,d,e);if(!0!==d){if("object"===typeof d&&!a.util.isArray(d))throw c=
661
-Error("The application rejected the certificate."),c.send=!0,c.alert={level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate},d.message&&(c.message=d.message),d.alert&&(c.alert.description=d.alert),c;d!==c&&(d=ca(d))}return d})}catch(d){var e=d;if("object"!==typeof e||a.util.isArray(e))e={send:!0,alert:{level:k.Alert.Level.fatal,description:aa(d)}};"send"in e||(e.send=!0);"alert"in e||(e.alert={level:k.Alert.Level.fatal,description:aa(e.error)});b.error(b,e)}return!b.fail};k.createSessionCache=
661
+Error("The application rejected the certificate."),c.send=!0,c.alert={level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate},d.message&&(c.message=d.message),d.alert&&(c.alert.description=d.alert),c;d!==c&&(d=O(d))}return d})}catch(d){var e=d;if("object"!==typeof e||a.util.isArray(e))e={send:!0,alert:{level:k.Alert.Level.fatal,description:aa(d)}};"send"in e||(e.send=!0);"alert"in e||(e.alert={level:k.Alert.Level.fatal,description:aa(e.error)});b.error(b,e)}return!b.fail};k.createSessionCache=
662
function(b,c){var d=null;if(b&&b.getSession&&b.setSession&&b.order)d=b;else{d={};d.cache=b||{};d.capacity=Math.max(c||100,1);d.order=[];for(var e in b)d.order.length<=c?d.order.push(e):delete b[e];d.getSession=function(b){var c=null,e=null;b?e=a.util.bytesToHex(b):0<d.order.length&&(e=d.order[0]);if(null!==e&&e in d.cache){c=d.cache[e];delete d.cache[e];for(var g in d.order)if(d.order[g]===e){d.order.splice(g,1);break}}return c};d.setSession=function(b,c){if(d.order.length===d.capacity){var e=d.order.shift();
663
delete d.cache[e]}e=a.util.bytesToHex(b);d.order.push(e);d.cache[e]=c}}return d};k.createConnection=function(b){var c=null,c=b.caStore?a.util.isArray(b.caStore)?a.pki.createCaStore(b.caStore):b.caStore:a.pki.createCaStore(),d=b.cipherSuites||null;if(null===d){var d=[],e;for(e in k.CipherSuites)d.push(k.CipherSuites[e])}e=b.server?k.ConnectionEnd.server:k.ConnectionEnd.client;var g=b.sessionCache?k.createSessionCache(b.sessionCache):null,h={version:{major:k.Version.major,minor:k.Version.minor},entity:e,
664
sessionId:b.sessionId,caStore:c,sessionCache:g,cipherSuites:d,connected:b.connected,virtualHost:b.virtualHost||null,verifyClient:b.verifyClient||!1,verify:b.verify||function(a,b,c,d){return b},getCertificate:b.getCertificate||null,getPrivateKey:b.getPrivateKey||null,getSignature:b.getSignature||null,input:a.util.createBuffer(),tlsData:a.util.createBuffer(),data:a.util.createBuffer(),tlsDataReady:b.tlsDataReady,dataReady:b.dataReady,heartbeatReceived:b.heartbeatReceived,closed:b.closed,error:function(a,
@@ -670,104 +670,104 @@ alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.protocol_versio
670
alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.unexpected_message}})),c.record.ready=!0));c=b}if(!h.fail&&null!==h.record&&h.record.ready)if(b=h.record,d=b.type-k.ContentType.change_cipher_spec,e=S[h.entity][h.expect],d in e)e[d](h,b);else k.handleUnexpected(h,b)}return c};h.prepare=function(b){k.queue(h,k.createRecord(h,{type:k.ContentType.application_data,data:a.util.createBuffer(b)}));return k.flush(h)};h.prepareHeartbeatRequest=function(b,c){b instanceof a.util.ByteBuffer&&(b=
671
b.bytes());"undefined"===typeof c&&(c=b.length);h.expectedHeartbeatPayload=b;k.queue(h,k.createRecord(h,{type:k.ContentType.heartbeat,data:k.createHeartbeat(k.HeartbeatMessageType.heartbeat_request,b,c)}));return k.flush(h)};h.close=function(a){if(!h.fail&&h.sessionCache&&h.session){var b={id:h.session.id,version:h.session.version,sp:h.session.sp};b.sp.keys=null;h.sessionCache.setSession(b.id,b)}if(h.open){h.open=!1;h.input.clear();if(h.isConnected||h.handshaking)h.isConnected=h.handshaking=!1,k.queue(h,
672
k.createAlert(h,{level:k.Alert.Level.warning,description:k.Alert.Description.close_notify})),k.flush(h);h.closed(h)}h.reset(a)};return h};a.tls=a.tls||{};for(var Y in k)"function"!==typeof k[Y]&&(a.tls[Y]=k[Y]);a.tls.prf_tls1=c;a.tls.hmac_sha1=function(b,c,d){var e=a.hmac.create();e.start("SHA1",b);b=a.util.createBuffer();b.putInt32(c[0]);b.putInt32(c[1]);b.putByte(d.type);b.putByte(d.version.major);b.putByte(d.version.minor);b.putInt16(d.length);b.putBytes(d.fragment.bytes());e.update(b.getBytes());
673
-return e.digest().getBytes()};a.tls.createSessionCache=k.createSessionCache;a.tls.createConnection=k.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.tls)return c.tls;c.defined.tls=!0;for(var m=0;m<e.length;++m)e[m](c);return c.tls}},
674
-q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/tls","require module ./asn1 ./hmac ./md ./pem ./pki ./random ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,e,g){e=e.entity===a.tls.ConnectionEnd.client;b.read.cipherState={init:!1,cipher:a.cipher.createDecipher("AES-CBC",
675
-e?g.keys.server_write_key:g.keys.client_write_key),iv:e?g.keys.server_write_IV:g.keys.client_write_IV};b.write.cipherState={init:!1,cipher:a.cipher.createCipher("AES-CBC",e?g.keys.client_write_key:g.keys.server_write_key),iv:e?g.keys.client_write_IV:g.keys.server_write_IV};b.read.cipherFunction=p;b.write.cipherFunction=d;b.read.macLength=b.write.macLength=g.mac_length;b.read.macFunction=b.write.macFunction=k.hmac_sha1}function d(b,c){var g=!1,l=c.macFunction(c.macKey,c.sequenceNumber,b);b.fragment.putBytes(l);
673
+return e.digest().getBytes()};a.tls.createSessionCache=k.createSessionCache;a.tls.createConnection=k.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.tls)return c.tls;c.defined.tls=!0;for(var m=0;m<e.length;++m)e[m](c);return c.tls}},
674
+r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/tls","require module ./asn1 ./hmac ./md ./pem ./pki ./random ./util".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,e,g){e=e.entity===a.tls.ConnectionEnd.client;b.read.cipherState={init:!1,cipher:a.cipher.createDecipher("AES-CBC",
675
+e?g.keys.server_write_key:g.keys.client_write_key),iv:e?g.keys.server_write_IV:g.keys.client_write_IV};b.write.cipherState={init:!1,cipher:a.cipher.createCipher("AES-CBC",e?g.keys.client_write_key:g.keys.server_write_key),iv:e?g.keys.client_write_IV:g.keys.server_write_IV};b.read.cipherFunction=n;b.write.cipherFunction=d;b.read.macLength=b.write.macLength=g.mac_length;b.read.macFunction=b.write.macFunction=k.hmac_sha1}function d(b,c){var g=!1,l=c.macFunction(c.macKey,c.sequenceNumber,b);b.fragment.putBytes(l);
676
c.updateSequenceNumber();l=b.version.minor===k.Versions.TLS_1_0.minor?c.cipherState.init?null:c.cipherState.iv:a.random.getBytesSync(16);c.cipherState.init=!0;var m=c.cipherState.cipher;m.start({iv:l});b.version.minor>=k.Versions.TLS_1_1.minor&&m.output.putBytes(l);m.update(b.fragment);m.finish(e)&&(b.fragment=m.output,b.length=b.fragment.length(),g=!0);return g}function e(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function l(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1-
677
-d;e<c-1;++e)a=a&&b.at(e)==d;a&&b.truncate(d+1)}return a}function p(b,c){var d=!1;++g;d=b.version.minor===k.Versions.TLS_1_0.minor?c.cipherState.init?null:c.cipherState.iv:b.fragment.getBytes(16);c.cipherState.init=!0;var e=c.cipherState.cipher;e.start({iv:d});e.update(b.fragment);var d=e.finish(l),h=c.macLength,m=a.random.getBytesSync(h),q=e.output.length();q>=h?(b.fragment=e.output.getBytes(q-h),m=e.output.getBytes(h)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length=
678
-b.fragment.length();h=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;q=a.hmac.create();q.start("SHA1",e);q.update(m);m=q.digest().getBytes();q.start(null,null);q.update(h);h=q.digest().getBytes();return m===h&&d}var k=a.tls;k.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=k.BulkCipherAlgorithm.aes;a.cipher_type=k.CipherType.block;a.enc_key_length=16;a.block_length=16;
677
+d;e<c-1;++e)a=a&&b.at(e)==d;a&&b.truncate(d+1)}return a}function n(b,c){var d=!1;++g;d=b.version.minor===k.Versions.TLS_1_0.minor?c.cipherState.init?null:c.cipherState.iv:b.fragment.getBytes(16);c.cipherState.init=!0;var e=c.cipherState.cipher;e.start({iv:d});e.update(b.fragment);var d=e.finish(l),h=c.macLength,m=a.random.getBytesSync(h),r=e.output.length();r>=h?(b.fragment=e.output.getBytes(r-h),m=e.output.getBytes(h)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length=
678
+b.fragment.length();h=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;r=a.hmac.create();r.start("SHA1",e);r.update(m);m=r.digest().getBytes();r.start(null,null);r.update(h);h=r.digest().getBytes();return m===h&&d}var k=a.tls;k.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=k.BulkCipherAlgorithm.aes;a.cipher_type=k.CipherType.block;a.enc_key_length=16;a.block_length=16;
679
a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=k.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};k.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=k.BulkCipherAlgorithm.aes;a.cipher_type=k.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=k.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=
680
-20},initConnectionState:c};var g=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aesCipherSuites)return c.aesCipherSuites;c.defined.aesCipherSuites=!0;for(var m=0;m<e.length;++m)e[m](c);return c.aesCipherSuites}},q=a;a=function(b,c){l="string"===
681
-typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aesCipherSuites",["require","module","./aes","./tls"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.debug=a.debug||{};a.debug.storage={};a.debug.get=function(b,c){var d;"undefined"===typeof b?d=a.debug.storage:b in a.debug.storage&&(d="undefined"===typeof c?a.debug.storage[b]:
682
-a.debug.storage[b][c]);return d};a.debug.set=function(b,c,d){b in a.debug.storage||(a.debug.storage[b]={});a.debug.storage[b][c]=d};a.debug.clear=function(b,c){"undefined"===typeof b?a.debug.storage={}:b in a.debug.storage&&("undefined"===typeof c?delete a.debug.storage[b]:delete a.debug.storage[b][c])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=
683
-function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.debug)return c.debug;c.defined.debug=!0;for(var m=0;m<e.length;++m)e[m](c);return c.debug}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/debug",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();
684
-(function(){function b(a){function c(b,d,e,k){b.generate=function(b,c){for(var h=new a.util.ByteBuffer,l=Math.ceil(c/k)+e,m=new a.util.ByteBuffer,p=e;p<l;++p){m.putInt32(p);d.start();d.update(b+m.getBytes());var q=d.digest();h.putBytes(q.getBytes(k))}h.truncate(h.length()-c);return h.getBytes()}}a.kem=a.kem||{};var d=a.jsbn.BigInteger;a.kem.rsa={};a.kem.rsa.create=function(b,c){c=c||{};var e=c.prng||a.random;return{encrypt:function(c,g){var l=Math.ceil(c.n.bitLength()/8),m;do m=(new d(a.util.bytesToHex(e.getBytesSync(l)),
680
+20},initConnectionState:c};var g=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aesCipherSuites)return c.aesCipherSuites;c.defined.aesCipherSuites=!0;for(var m=0;m<e.length;++m)e[m](c);return c.aesCipherSuites}},r=a;a=function(b,c){l="string"===
681
+typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aesCipherSuites",["require","module","./aes","./tls"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.debug=a.debug||{};a.debug.storage={};a.debug.get=function(b,c){var d;"undefined"===typeof b?d=a.debug.storage:b in a.debug.storage&&(d="undefined"===typeof c?a.debug.storage[b]:
682
+a.debug.storage[b][c]);return d};a.debug.set=function(b,c,d){b in a.debug.storage||(a.debug.storage[b]={});a.debug.storage[b][c]=d};a.debug.clear=function(b,c){"undefined"===typeof b?a.debug.storage={}:b in a.debug.storage&&("undefined"===typeof c?delete a.debug.storage[b]:delete a.debug.storage[b][c])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=
683
+function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.debug)return c.debug;c.defined.debug=!0;for(var m=0;m<e.length;++m)e[m](c);return c.debug}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/debug",["require","module"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();
684
+(function(){function b(a){function c(b,d,e,k){b.generate=function(b,c){for(var h=new a.util.ByteBuffer,l=Math.ceil(c/k)+e,m=new a.util.ByteBuffer,n=e;n<l;++n){m.putInt32(n);d.start();d.update(b+m.getBytes());var r=d.digest();h.putBytes(r.getBytes(k))}h.truncate(h.length()-c);return h.getBytes()}}a.kem=a.kem||{};var d=a.jsbn.BigInteger;a.kem.rsa={};a.kem.rsa.create=function(b,c){c=c||{};var e=c.prng||a.random;return{encrypt:function(c,g){var l=Math.ceil(c.n.bitLength()/8),m;do m=(new d(a.util.bytesToHex(e.getBytesSync(l)),
685
16)).mod(c.n);while(m.equals(d.ZERO));m=a.util.hexToBytes(m.toString(16));l-=m.length;0<l&&(m=a.util.fillString(String.fromCharCode(0),l)+m);l=c.encrypt(m,"NONE");m=b.generate(m,g);return{encapsulation:l,key:m}},decrypt:function(a,c,d){a=a.decrypt(c,"NONE");return b.generate(a,d)}}};a.kem.kdf1=function(a,b){c(this,a,0,b||a.digestLength)};a.kem.kdf2=function(a,b){c(this,a,1,b||a.digestLength)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
686
-typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.kem)return c.kem;c.defined.kem=!0;for(var m=0;m<e.length;++m)e[m](c);return c.kem}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/kem",["require","module","./util","./random",
687
-"./jsbn"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.log=a.log||{};a.log.levels="none error warning info debug verbose max".split(" ");var c={},d=[],e=null;a.log.LEVEL_LOCKED=2;a.log.NO_LEVEL_CHECK=4;a.log.INTERPOLATE=8;for(var l=0;l<a.log.levels.length;++l){var p=a.log.levels[l];c[p]={index:l,name:p.toUpperCase()}}a.log.logMessage=function(b){for(var e=c[b.level].index,h=0;h<d.length;++h){var k=d[h];k.flags&a.log.NO_LEVEL_CHECK?k.f(b):e<=c[k.level].index&&
688
-k.f(k,b)}};a.log.prepareStandard=function(a){"standard"in a||(a.standard=c[a.level].name+" ["+a.category+"] "+a.message)};a.log.prepareFull=function(b){if(!("full"in b)){var c=[b.message],c=c.concat([]);b.full=a.util.format.apply(this,c)}};a.log.prepareStandardFull=function(b){"standardFull"in b||(a.log.prepareStandard(b),b.standardFull=b.standard)};p=["error","warning","info","debug","verbose"];for(l=0;l<p.length;++l)(function(b){a.log[b]=function(c,d){var e=Array.prototype.slice.call(arguments).slice(2);
689
-a.log.logMessage({timestamp:new Date,level:b,category:c,message:d,arguments:e})}})(p[l]);a.log.makeLogger=function(b){b={flags:0,f:b};a.log.setLevel(b,"none");return b};a.log.setLevel=function(b,c){var d=!1;if(b&&!(b.flags&a.log.LEVEL_LOCKED))for(var e=0;e<a.log.levels.length;++e)if(c==a.log.levels[e]){b.level=c;d=!0;break}return d};a.log.lock=function(b,c){b.flags="undefined"===typeof c||c?b.flags|a.log.LEVEL_LOCKED:b.flags&~a.log.LEVEL_LOCKED};a.log.addLogger=function(a){d.push(a)};if("undefined"!==
686
+typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.kem)return c.kem;c.defined.kem=!0;for(var m=0;m<e.length;++m)e[m](c);return c.kem}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/kem",["require","module","./util","./random",
687
+"./jsbn"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.log=a.log||{};a.log.levels="none error warning info debug verbose max".split(" ");var c={},d=[],e=null;a.log.LEVEL_LOCKED=2;a.log.NO_LEVEL_CHECK=4;a.log.INTERPOLATE=8;for(var l=0;l<a.log.levels.length;++l){var n=a.log.levels[l];c[n]={index:l,name:n.toUpperCase()}}a.log.logMessage=function(b){for(var e=c[b.level].index,h=0;h<d.length;++h){var k=d[h];k.flags&a.log.NO_LEVEL_CHECK?k.f(b):e<=c[k.level].index&&
688
+k.f(k,b)}};a.log.prepareStandard=function(a){"standard"in a||(a.standard=c[a.level].name+" ["+a.category+"] "+a.message)};a.log.prepareFull=function(b){if(!("full"in b)){var c=[b.message],c=c.concat([]);b.full=a.util.format.apply(this,c)}};a.log.prepareStandardFull=function(b){"standardFull"in b||(a.log.prepareStandard(b),b.standardFull=b.standard)};n=["error","warning","info","debug","verbose"];for(l=0;l<n.length;++l)(function(b){a.log[b]=function(c,d){var e=Array.prototype.slice.call(arguments).slice(2);
689
+a.log.logMessage({timestamp:new Date,level:b,category:c,message:d,arguments:e})}})(n[l]);a.log.makeLogger=function(b){b={flags:0,f:b};a.log.setLevel(b,"none");return b};a.log.setLevel=function(b,c){var d=!1;if(b&&!(b.flags&a.log.LEVEL_LOCKED))for(var e=0;e<a.log.levels.length;++e)if(c==a.log.levels[e]){b.level=c;d=!0;break}return d};a.log.lock=function(b,c){b.flags="undefined"===typeof c||c?b.flags|a.log.LEVEL_LOCKED:b.flags&~a.log.LEVEL_LOCKED};a.log.addLogger=function(a){d.push(a)};if("undefined"!==
690
typeof console&&"log"in console){if(console.error&&console.warn&&console.info&&console.debug)var k={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},e=function(b,c){a.log.prepareStandard(c);var d=k[c.level],e=[c.standard],e=e.concat(c.arguments.slice());d.apply(console,e)};else e=function(b,c){a.log.prepareStandardFull(c);console.log(c.standardFull)};e=a.log.makeLogger(e);a.log.setLevel(e,"debug");a.log.addLogger(e)}else console={log:function(){}};
691
-null!==e&&(l=a.util.getQueryVariables(),"console.level"in l&&a.log.setLevel(e,l["console.level"].slice(-1)[0]),"console.lock"in l&&"true"==l["console.lock"].slice(-1)[0]&&a.log.lock(e));a.log.consoleLogger=e}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.log)return c.log;
692
-c.defined.log=!0;for(var m=0;m<e.length;++m)e[m](c);return c.log}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/log",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){var d={},e=[];if(!u.validate(b,C.asn1.recipientInfoValidator,d,e))throw b=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo."),
691
+null!==e&&(l=a.util.getQueryVariables(),"console.level"in l&&a.log.setLevel(e,l["console.level"].slice(-1)[0]),"console.lock"in l&&"true"==l["console.lock"].slice(-1)[0]&&a.log.lock(e));a.log.consoleLogger=e}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.log)return c.log;
692
+c.defined.log=!0;for(var m=0;m<e.length;++m)e[m](c);return c.log}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/log",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){var d={},e=[];if(!u.validate(b,C.asn1.recipientInfoValidator,d,e))throw b=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo."),
693
b.errors=e,b;return{version:d.version.charCodeAt(0),issuer:a.pki.RDNAttributesAsArray(d.issuer),serialNumber:a.util.createBuffer(d.serial).toHex(),encryptedContent:{algorithm:u.derToOid(d.encAlgorithm),parameter:d.encParameter.value,content:d.encKey}}}function d(b){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,u.integerToDer(b.version).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:b.issuer}),
694
u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber))]),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(b.encryptedContent.algorithm).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")]),u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,b.encryptedContent.content)])}function e(a){for(var b=[],c=0;c<a.length;++c)b.push(d(a[c]));return b}function l(b){var c=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,
695
u.Type.INTEGER,!1,u.integerToDer(b.version).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:b.issuer}),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber))]),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(b.digestAlgorithm).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")])]);b.authenticatedAttributesAsn1&&c.value.push(b.authenticatedAttributesAsn1);c.value.push(u.create(u.Class.UNIVERSAL,
696
-u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(b.signatureAlgorithm).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")]));c.value.push(u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,b.signature));if(0<b.unauthenticatedAttributes.length){for(var d=u.create(u.Class.CONTEXT_SPECIFIC,1,!0,[]),e=0;e<b.unauthenticatedAttributes.length;++e)d.values.push(p(b.unauthenticatedAttributes[e]));c.value.push(d)}return c}function p(b){var c;if(b.type===a.pki.oids.contentType)c=
696
+u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(b.signatureAlgorithm).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")]));c.value.push(u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,b.signature));if(0<b.unauthenticatedAttributes.length){for(var d=u.create(u.Class.CONTEXT_SPECIFIC,1,!0,[]),e=0;e<b.unauthenticatedAttributes.length;++e)d.values.push(n(b.unauthenticatedAttributes[e]));c.value.push(d)}return c}function n(b){var c;if(b.type===a.pki.oids.contentType)c=
697
u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(b.value).getBytes());else if(b.type===a.pki.oids.messageDigest)c=u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,b.value.bytes());else if(b.type===a.pki.oids.signingTime){c=new Date("Jan 1, 1950 00:00:00Z");var d=new Date("Jan 1, 2050 00:00:00Z"),e=b.value;if("string"===typeof e)var g=Date.parse(e),e=isNaN(g)?13===e.length?u.utcTimeToDate(e):u.generalizedTimeToDate(e):new Date(g);c=e>=c&&e<d?u.create(u.Class.UNIVERSAL,u.Type.UTCTIME,!1,u.dateToUtcTime(e)):
698
u.create(u.Class.UNIVERSAL,u.Type.GENERALIZEDTIME,!1,u.dateToGeneralizedTime(e))}return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(b.type).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SET,!0,[c])])}function k(b){return[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(a.pki.oids.data).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(b.algorithm).getBytes()),u.create(u.Class.UNIVERSAL,
699
u.Type.OCTETSTRING,!1,b.parameter.getBytes())]),u.create(u.Class.CONTEXT_SPECIFIC,0,!0,[u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,b.content.getBytes())])]}function g(b,c,d){var e={};if(!u.validate(c,d,e,[]))throw b=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message."),b.errors=b,b;if(u.derToOid(e.contentType)!==a.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(e.encryptedContent){c="";if(a.util.isArray(e.encryptedContent))for(d=
700
0;d<e.encryptedContent.length;++d){if(e.encryptedContent[d].type!==u.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");c+=e.encryptedContent[d].value}else c=e.encryptedContent;b.encryptedContent={algorithm:u.derToOid(e.encAlgorithm),parameter:a.util.createBuffer(e.encParameter.value),content:a.util.createBuffer(c)}}if(e.content){c="";if(a.util.isArray(e.content))for(d=0;d<e.content.length;++d){if(e.content[d].type!==u.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");
701
-c+=e.content[d].value}else c=e.content;b.content=a.util.createBuffer(c)}b.version=e.version.charCodeAt(0);return b.rawCapture=e}function q(b){if(void 0===b.encryptedContent.key)throw Error("Symmetric key not available.");if(void 0===b.content){var c;switch(b.encryptedContent.algorithm){case a.pki.oids["aes128-CBC"]:case a.pki.oids["aes192-CBC"]:case a.pki.oids["aes256-CBC"]:c=a.aes.createDecryptionCipher(b.encryptedContent.key);break;case a.pki.oids.desCBC:case a.pki.oids["des-EDE3-CBC"]:c=a.des.createDecryptionCipher(b.encryptedContent.key);
701
+c+=e.content[d].value}else c=e.content;b.content=a.util.createBuffer(c)}b.version=e.version.charCodeAt(0);return b.rawCapture=e}function r(b){if(void 0===b.encryptedContent.key)throw Error("Symmetric key not available.");if(void 0===b.content){var c;switch(b.encryptedContent.algorithm){case a.pki.oids["aes128-CBC"]:case a.pki.oids["aes192-CBC"]:case a.pki.oids["aes256-CBC"]:c=a.aes.createDecryptionCipher(b.encryptedContent.key);break;case a.pki.oids.desCBC:case a.pki.oids["des-EDE3-CBC"]:c=a.des.createDecryptionCipher(b.encryptedContent.key);
702
break;default:throw Error("Unsupported symmetric cipher, OID "+b.encryptedContent.algorithm);}c.start(b.encryptedContent.parameter);c.update(b.encryptedContent.content);if(!c.finish())throw Error("Symmetric decryption failed.");b.content=c.output}}var u=a.asn1,C=a.pkcs7=a.pkcs7||{};C.messageFromPem=function(b){b=a.pem.decode(b)[0];if("PKCS7"!==b.type){var c=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===
703
b.procType.type)throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");b=u.fromDer(b.body);return C.messageFromAsn1(b)};C.messageToPem=function(b,c){var d={type:"PKCS7",body:u.toDer(b.toAsn1()).getBytes()};return a.pem.encode(d,{maxline:c})};C.messageFromAsn1=function(b){var c={},d=[];if(!u.validate(b,C.asn1.contentInfoValidator,c,d))throw c=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo."),c.errors=d,c;d=u.derToOid(c.contentType);switch(d){case a.pki.oids.envelopedData:d=
704
C.createEnvelopedData();break;case a.pki.oids.encryptedData:d=C.createEncryptedData();break;case a.pki.oids.signedData:d=C.createSignedData();break;default:throw Error("Cannot read PKCS#7 message. ContentType with OID "+d+" is not (yet) supported.");}d.fromAsn1(c.content.value[0]);return d};C.createSignedData=function(){var b=null;return b={type:a.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(c){g(b,
705
c,C.asn1.signedDataValidator);b.certificates=[];b.crls=[];b.digestAlgorithmIdentifiers=[];b.contentInfo=null;b.signerInfos=[];c=b.rawCapture.certificates.value;for(var d=0;d<c.length;++d)b.certificates.push(a.pki.certificateFromAsn1(c[d]))},toAsn1:function(){b.contentInfo||b.sign();for(var c=[],d=0;d<b.certificates.length;++d)c.push(a.pki.certificateToAsn1(b.certificates[d]));var d=[],e=u.create(u.Class.CONTEXT_SPECIFIC,0,!0,[u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,
706
u.Type.INTEGER,!1,u.integerToDer(b.version).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SET,!0,b.digestAlgorithmIdentifiers),b.contentInfo])]);0<c.length&&e.value[0].value.push(u.create(u.Class.CONTEXT_SPECIFIC,0,!0,c));0<d.length&&e.value[0].value.push(u.create(u.Class.CONTEXT_SPECIFIC,1,!0,d));e.value[0].value.push(u.create(u.Class.UNIVERSAL,u.Type.SET,!0,b.signerInfos));return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(b.type).getBytes()),
707
e])},addSigner:function(c){var d=c.issuer,e=c.serialNumber;c.certificate&&(e=c.certificate,"string"===typeof e&&(e=a.pki.certificateFromPem(e)),d=e.issuer.attributes,e=e.serialNumber);var g=c.key;if(!g)throw Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof g&&(g=a.pki.privateKeyFromPem(g));var h=c.digestAlgorithm||a.pki.oids.sha1;switch(h){case a.pki.oids.sha1:case a.pki.oids.sha256:case a.pki.oids.sha384:case a.pki.oids.sha512:case a.pki.oids.md5:break;default:throw Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+
708
-h);}c=c.authenticatedAttributes||[];if(0<c.length){for(var k=!1,l=!1,m=0;m<c.length;++m){var p=c[m];if(!k&&p.type===a.pki.oids.contentType){if(k=!0,l)break}else if(!l&&p.type===a.pki.oids.messageDigest&&(l=!0,k))break}if(!k||!l)throw Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.");}b.signers.push({key:g,version:1,issuer:d,serialNumber:e,digestAlgorithm:h,
708
+h);}c=c.authenticatedAttributes||[];if(0<c.length){for(var k=!1,l=!1,m=0;m<c.length;++m){var n=c[m];if(!k&&n.type===a.pki.oids.contentType){if(k=!0,l)break}else if(!l&&n.type===a.pki.oids.messageDigest&&(l=!0,k))break}if(!k||!l)throw Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.");}b.signers.push({key:g,version:1,issuer:d,serialNumber:e,digestAlgorithm:h,
709
signatureAlgorithm:a.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(){if("object"!==typeof b.content||null===b.contentInfo)if(b.contentInfo=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(a.pki.oids.data).getBytes())]),"content"in b){var c;b.content instanceof a.util.ByteBuffer?c=b.content.bytes():"string"===typeof b.content&&(c=a.util.encodeUtf8(b.content));b.contentInfo.value.push(u.create(u.Class.CONTEXT_SPECIFIC,
710
0,!0,[u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,c)]))}if(0!==b.signers.length){c={};for(var d=0;d<b.signers.length;++d){var e=b.signers[d],g=e.digestAlgorithm;g in c||(c[g]=a.md[a.pki.oids[g]].create());e.md=0===e.authenticatedAttributes.length?c[g]:a.md[a.pki.oids[g]].create()}b.digestAlgorithmIdentifiers=[];for(g in c)b.digestAlgorithmIdentifiers.push(u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(g).getBytes()),u.create(u.Class.UNIVERSAL,
711
u.Type.NULL,!1,"")]));if(2>b.contentInfo.value.length)throw Error("Could not sign PKCS#7 message; there is no content to sign.");var g=u.derToOid(b.contentInfo.value[0].value),d=b.contentInfo.value[1],d=d.value[0],h=u.toDer(d);h.getByte();u.getBerValueLength(h);var h=h.getBytes(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;d<b.signers.length;++d){e=b.signers[d];if(0===e.authenticatedAttributes.length){if(g!==a.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.");
712
-}else{e.authenticatedAttributesAsn1=u.create(u.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var h=u.create(u.Class.UNIVERSAL,u.Type.SET,!0,[]),m=0;m<e.authenticatedAttributes.length;++m){var q=e.authenticatedAttributes[m];q.type===a.pki.oids.messageDigest?q.value=c[e.digestAlgorithm].digest():q.type!==a.pki.oids.signingTime||q.value||(q.value=k);h.value.push(p(q));e.authenticatedAttributesAsn1.value.push(p(q))}h=u.toDer(h).getBytes();e.md.start().update(h)}e.signature=e.key.sign(e.md,"RSASSA-PKCS1-V1_5")}c=
712
+}else{e.authenticatedAttributesAsn1=u.create(u.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var h=u.create(u.Class.UNIVERSAL,u.Type.SET,!0,[]),m=0;m<e.authenticatedAttributes.length;++m){var r=e.authenticatedAttributes[m];r.type===a.pki.oids.messageDigest?r.value=c[e.digestAlgorithm].digest():r.type!==a.pki.oids.signingTime||r.value||(r.value=k);h.value.push(n(r));e.authenticatedAttributesAsn1.value.push(n(r))}h=u.toDer(h).getBytes();e.md.start().update(h)}e.signature=e.key.sign(e.md,"RSASSA-PKCS1-V1_5")}c=
713
b;g=b.signers;k=[];for(d=0;d<g.length;++d)k.push(l(g[d]));c.signerInfos=k}},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.");},addCertificate:function(c){"string"===typeof c&&(c=a.pki.certificateFromPem(c));b.certificates.push(c)},addCertificateRevokationList:function(a){throw Error("PKCS#7 CRL support not yet implemented.");}}};C.createEncryptedData=function(){var b=null;return b={type:a.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},
714
-fromAsn1:function(a){g(b,a,C.asn1.encryptedDataValidator)},decrypt:function(a){void 0!==a&&(b.encryptedContent.key=a);q(b)}}};C.createEnvelopedData=function(){var b=null;return b={type:a.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(a){var d=g(b,a,C.asn1.envelopedDataValidator);a=b;for(var d=d.recipientInfos.value,e=[],h=0;h<d.length;++h)e.push(c(d[h]));a.recipients=e},toAsn1:function(){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,
714
+fromAsn1:function(a){g(b,a,C.asn1.encryptedDataValidator)},decrypt:function(a){void 0!==a&&(b.encryptedContent.key=a);r(b)}}};C.createEnvelopedData=function(){var b=null;return b={type:a.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(a){var d=g(b,a,C.asn1.envelopedDataValidator);a=b;for(var d=d.recipientInfos.value,e=[],h=0;h<d.length;++h)e.push(c(d[h]));a.recipients=e},toAsn1:function(){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,
715
!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(b.type).getBytes()),u.create(u.Class.CONTEXT_SPECIFIC,0,!0,[u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,u.integerToDer(b.version).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SET,!0,e(b.recipients)),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,k(b.encryptedContent))])])])},findRecipient:function(a){for(var c=a.issuer.attributes,d=0;d<b.recipients.length;++d){var e=b.recipients[d],g=e.issuer;if(e.serialNumber===
716
a.serialNumber&&g.length===c.length){for(var h=!0,k=0;k<c.length;++k)if(g[k].type!==c[k].type||g[k].value!==c[k].value){h=!1;break}if(h)return e}}return null},decrypt:function(c,d){if(void 0===b.encryptedContent.key&&void 0!==c&&void 0!==d)switch(c.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:case a.pki.oids.desCBC:var e=d.decrypt(c.encryptedContent.content);b.encryptedContent.key=a.util.createBuffer(e);break;default:throw Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm);
717
-}q(b)},addRecipient:function(c){b.recipients.push({version:0,issuer:c.issuer.attributes,serialNumber:c.serialNumber,encryptedContent:{algorithm:a.pki.oids.rsaEncryption,key:c.publicKey}})},encrypt:function(c,d){if(void 0===b.encryptedContent.content){d=d||b.encryptedContent.algorithm;c=c||b.encryptedContent.key;var e,g,h;switch(d){case a.pki.oids["aes128-CBC"]:g=e=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes192-CBC"]:e=24;g=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes256-CBC"]:e=
717
+}r(b)},addRecipient:function(c){b.recipients.push({version:0,issuer:c.issuer.attributes,serialNumber:c.serialNumber,encryptedContent:{algorithm:a.pki.oids.rsaEncryption,key:c.publicKey}})},encrypt:function(c,d){if(void 0===b.encryptedContent.content){d=d||b.encryptedContent.algorithm;c=c||b.encryptedContent.key;var e,g,h;switch(d){case a.pki.oids["aes128-CBC"]:g=e=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes192-CBC"]:e=24;g=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes256-CBC"]:e=
718
32;g=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["des-EDE3-CBC"]:e=24;g=8;h=a.des.createEncryptionCipher;break;default:throw Error("Unsupported symmetric cipher, OID "+d);}if(void 0===c)c=a.util.createBuffer(a.random.getBytes(e));else if(c.length()!=e)throw Error("Symmetric key has wrong length; got "+c.length()+" bytes, expected "+e+".");b.encryptedContent.algorithm=d;b.encryptedContent.key=c;b.encryptedContent.parameter=a.util.createBuffer(a.random.getBytes(g));e=h(c);e.start(b.encryptedContent.parameter.copy());
719
e.update(b.content);if(!e.finish())throw Error("Symmetric encryption failed.");b.encryptedContent.content=e.output}for(e=0;e<b.recipients.length;++e)if(g=b.recipients[e],void 0===g.encryptedContent.content)switch(g.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:g.encryptedContent.content=g.encryptedContent.key.encrypt(b.encryptedContent.key.data);break;default:throw Error("Unsupported asymmetric cipher, OID "+g.encryptedContent.algorithm);}}}}}if("function"!==typeof a)if("object"===typeof module&&
720
-module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7)return c.pkcs7;c.defined.pkcs7=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pkcs7}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,
721
-Array.prototype.slice.call(arguments,0))};a("js/pkcs7","require module ./aes ./asn1 ./des ./oids ./pem ./pkcs7asn1 ./random ./util ./x509".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d){var e=d.toString(16);"8"<=e[0]&&(e="00"+e);e=a.util.hexToBytes(e);b.putInt32(e.length);b.putBytes(e)}function d(a,b){a.putInt32(b.length);a.putString(b)}function e(){for(var b=a.md.sha1.create(),c=arguments.length,d=0;d<c;++d)b.update(arguments[d]);
722
-return b.digest()}var l=a.ssh=a.ssh||{};l.privateKeyToPutty=function(b,k,g){g=g||"";k=k||"";var l=""===k?"none":"aes256-cbc",p;p="PuTTY-User-Key-File-2: ssh-rsa\r\n"+("Encryption: "+l+"\r\n")+("Comment: "+g+"\r\n");var q=a.util.createBuffer();d(q,"ssh-rsa");c(q,b.e);c(q,b.n);var x=a.util.encode64(q.bytes(),64),w=Math.floor(x.length/66)+1;p+="Public-Lines: "+w+"\r\n";p+=x;x=a.util.createBuffer();c(x,b.d);c(x,b.p);c(x,b.q);c(x,b.qInv);k?(w=x.length()+16-1,w-=w%16,b=e(x.bytes()),b.truncate(b.length()-
723
-w+x.length()),x.putBuffer(b),w=a.util.createBuffer(),w.putBuffer(e("\x00\x00\x00\x00",k)),w.putBuffer(e("\x00\x00\x00\u0001",k)),w=a.aes.createEncryptionCipher(w.truncate(8),"CBC"),w.start(a.util.createBuffer().fillWithByte(0,16)),w.update(x.copy()),w.finish(),w=w.output,w.truncate(16),b=a.util.encode64(w.bytes(),64)):b=a.util.encode64(x.bytes(),64);w=Math.floor(b.length/66)+1;p+="\r\nPrivate-Lines: "+w+"\r\n";p+=b;k=e("putty-private-key-file-mac-key",k);w=a.util.createBuffer();d(w,"ssh-rsa");d(w,
724
-l);d(w,g);w.putInt32(q.length());w.putBuffer(q);w.putInt32(x.length());w.putBuffer(x);g=a.hmac.create();g.start("sha1",k);g.update(w.bytes());return p+="\r\nPrivate-MAC: "+g.digest().toHex()+"\r\n"};l.publicKeyToOpenSSH=function(b,e){e=e||"";var g=a.util.createBuffer();d(g,"ssh-rsa");c(g,b.e);c(g,b.n);return"ssh-rsa "+a.util.encode64(g.bytes())+" "+e};l.privateKeyToOpenSSH=function(b,c){return c?a.pki.encryptRsaPrivateKey(b,c,{legacy:!0,algorithm:"aes128"}):a.pki.privateKeyToPem(b)};l.getPublicKeyFingerprint=
720
+module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7)return c.pkcs7;c.defined.pkcs7=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pkcs7}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,
721
+Array.prototype.slice.call(arguments,0))};a("js/pkcs7","require module ./aes ./asn1 ./des ./oids ./pem ./pkcs7asn1 ./random ./util ./x509".split(" "),function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d){var e=d.toString(16);"8"<=e[0]&&(e="00"+e);e=a.util.hexToBytes(e);b.putInt32(e.length);b.putBytes(e)}function d(a,b){a.putInt32(b.length);a.putString(b)}function e(){for(var b=a.md.sha1.create(),c=arguments.length,d=0;d<c;++d)b.update(arguments[d]);
722
+return b.digest()}var l=a.ssh=a.ssh||{};l.privateKeyToPutty=function(b,k,g){g=g||"";k=k||"";var l=""===k?"none":"aes256-cbc",n;n="PuTTY-User-Key-File-2: ssh-rsa\r\n"+("Encryption: "+l+"\r\n")+("Comment: "+g+"\r\n");var r=a.util.createBuffer();d(r,"ssh-rsa");c(r,b.e);c(r,b.n);var w=a.util.encode64(r.bytes(),64),y=Math.floor(w.length/66)+1;n+="Public-Lines: "+y+"\r\n";n+=w;w=a.util.createBuffer();c(w,b.d);c(w,b.p);c(w,b.q);c(w,b.qInv);k?(y=w.length()+16-1,y-=y%16,b=e(w.bytes()),b.truncate(b.length()-
723
+y+w.length()),w.putBuffer(b),y=a.util.createBuffer(),y.putBuffer(e("\x00\x00\x00\x00",k)),y.putBuffer(e("\x00\x00\x00\u0001",k)),y=a.aes.createEncryptionCipher(y.truncate(8),"CBC"),y.start(a.util.createBuffer().fillWithByte(0,16)),y.update(w.copy()),y.finish(),y=y.output,y.truncate(16),b=a.util.encode64(y.bytes(),64)):b=a.util.encode64(w.bytes(),64);y=Math.floor(b.length/66)+1;n+="\r\nPrivate-Lines: "+y+"\r\n";n+=b;k=e("putty-private-key-file-mac-key",k);y=a.util.createBuffer();d(y,"ssh-rsa");d(y,
724
+l);d(y,g);y.putInt32(r.length());y.putBuffer(r);y.putInt32(w.length());y.putBuffer(w);g=a.hmac.create();g.start("sha1",k);g.update(y.bytes());return n+="\r\nPrivate-MAC: "+g.digest().toHex()+"\r\n"};l.publicKeyToOpenSSH=function(b,e){e=e||"";var g=a.util.createBuffer();d(g,"ssh-rsa");c(g,b.e);c(g,b.n);return"ssh-rsa "+a.util.encode64(g.bytes())+" "+e};l.privateKeyToOpenSSH=function(b,c){return c?a.pki.encryptRsaPrivateKey(b,c,{legacy:!0,algorithm:"aes128"}):a.pki.privateKeyToPem(b)};l.getPublicKeyFingerprint=
725
function(b,e){e=e||{};var g=e.md||a.md.md5.create(),h=a.util.createBuffer();d(h,"ssh-rsa");c(h,b.e);c(h,b.n);g.start();g.update(h.getBytes());g=g.digest();if("hex"===e.encoding)return g=g.toHex(),e.delimiter?g.match(/.{2}/g).join(e.delimiter):g;if("binary"===e.encoding)return g.getBytes();if(e.encoding)throw Error('Unknown encoding "'+e.encoding+'".');return g}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&
726
-(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.ssh)return c.ssh;c.defined.ssh=!0;for(var m=0;m<e.length;++m)e[m](c);return c.ssh}},q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/ssh","require module ./aes ./hmac ./md5 ./sha1 ./util".split(" "),
727
-function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c={},d=0;a.debug.set("forge.task","tasks",c);var e={};a.debug.set("forge.task","queues",e);var l={ready:{}};l.ready.stop="ready";l.ready.start="running";l.ready.cancel="done";l.ready.fail="error";l.running={};l.running.stop="ready";l.running.start="running";l.running.block="blocked";l.running.unblock="running";l.running.sleep="sleeping";l.running.wakeup="running";l.running.cancel="done";l.running.fail=
726
+(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.ssh)return c.ssh;c.defined.ssh=!0;for(var m=0;m<e.length;++m)e[m](c);return c.ssh}},r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/ssh","require module ./aes ./hmac ./md5 ./sha1 ./util".split(" "),
727
+function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c={},d=0;a.debug.set("forge.task","tasks",c);var e={};a.debug.set("forge.task","queues",e);var l={ready:{}};l.ready.stop="ready";l.ready.start="running";l.ready.cancel="done";l.ready.fail="error";l.running={};l.running.stop="ready";l.running.start="running";l.running.block="blocked";l.running.unblock="running";l.running.sleep="sleeping";l.running.wakeup="running";l.running.cancel="done";l.running.fail=
728
"error";l.blocked={};l.blocked.stop="blocked";l.blocked.start="blocked";l.blocked.block="blocked";l.blocked.unblock="blocked";l.blocked.sleep="blocked";l.blocked.wakeup="blocked";l.blocked.cancel="done";l.blocked.fail="error";l.sleeping={};l.sleeping.stop="sleeping";l.sleeping.start="sleeping";l.sleeping.block="sleeping";l.sleeping.unblock="sleeping";l.sleeping.sleep="sleeping";l.sleeping.wakeup="sleeping";l.sleeping.cancel="done";l.sleeping.fail="error";l.done={};l.done.stop="done";l.done.start=
729
-"done";l.done.block="done";l.done.unblock="done";l.done.sleep="done";l.done.wakeup="done";l.done.cancel="done";l.done.fail="error";l.error={};l.error.stop="error";l.error.start="error";l.error.block="error";l.error.unblock="error";l.error.sleep="error";l.error.wakeup="error";l.error.cancel="error";l.error.fail="error";var p=function(a){this.id=-1;this.name=a.name||"?";this.parent=a.parent||null;this.run=a.run;this.subtasks=[];this.error=!1;this.state="ready";this.blocks=0;this.userData=this.swapTime=
730
-this.timeoutId=null;this.id=d++;c[this.id]=this};p.prototype.debug=function(b){a.log.debug("forge.task",b||"","[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",e)};p.prototype.next=function(a,b){"function"===typeof a&&(b=a,a=this.name);var c=new p({run:b,name:a,parent:this});c.state="running";c.type=this.type;c.successCallback=this.successCallback||null;c.failureCallback=this.failureCallback||null;this.subtasks.push(c);return this};p.prototype.parallel=function(b,c){a.util.isArray(b)&&
731
-(c=b,b=this.name);return this.next(b,function(d){d.block(c.length);for(var e=function(b,e){a.task.start({type:b,run:function(a){c[e](a)},success:function(a){d.unblock()},failure:function(a){d.unblock()}})},g=0;g<c.length;g++)e(b+"__parallel-"+d.id+"-"+g,g)})};p.prototype.stop=function(){this.state=l[this.state].stop};p.prototype.start=function(){this.error=!1;this.state=l[this.state].start;"running"===this.state&&(this.start=new Date,this.run(this),g(this,0))};p.prototype.block=function(a){this.blocks+=
732
-"undefined"===typeof a?1:a;0<this.blocks&&(this.state=l[this.state].block)};p.prototype.unblock=function(a){this.blocks-="undefined"===typeof a?1:a;0===this.blocks&&"done"!==this.state&&(this.state="running",g(this,0));return this.blocks};p.prototype.sleep=function(a){this.state=l[this.state].sleep;var b=this;this.timeoutId=setTimeout(function(){b.timeoutId=null;b.state="running";g(b,0)},"undefined"===typeof a?0:a)};p.prototype.wait=function(a){a.wait(this)};p.prototype.wakeup=function(){"sleeping"===
733
-this.state&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state="running",g(this,0))};p.prototype.cancel=function(){this.state=l[this.state].cancel;this.permitsNeeded=0;null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null);this.subtasks=[]};p.prototype.fail=function(a){this.error=!0;q(this,!0);if(a)a.error=this.error,a.swapTime=this.swapTime,a.userData=this.userData,g(a,0);else{if(null!==this.parent){for(a=this.parent;null!==a.parent;)a.error=this.error,a.swapTime=this.swapTime,
734
-a.userData=this.userData,a=a.parent;q(a,!0)}this.failureCallback&&this.failureCallback(this)}};var k=function(a){a.error=!1;a.state=l[a.state].start;setTimeout(function(){"running"===a.state&&(a.swapTime=+new Date,a.run(a),g(a,0))},0)},g=function(a,b){var c=30<b||20<+new Date-a.swapTime,d=function(b){b++;if("running"===a.state)if(c&&(a.swapTime=+new Date),0<a.subtasks.length){var d=a.subtasks.shift();d.error=a.error;d.swapTime=a.swapTime;d.userData=a.userData;d.run(d);d.error||g(d,b)}else q(a),a.error||
735
-null===a.parent||(a.parent.error=a.error,a.parent.swapTime=a.swapTime,a.parent.userData=a.userData,g(a.parent,b))};c?setTimeout(d,0):d(b)},q=function(b,d){b.state="done";delete c[b.id];null===b.parent&&(b.type in e?0===e[b.type].length?a.log.error("forge.task","[%s][%s] task queue empty [%s]",b.id,b.name,b.type):e[b.type][0]!==b?a.log.error("forge.task","[%s][%s] task not first in queue [%s]",b.id,b.name,b.type):(e[b.type].shift(),0===e[b.type].length?delete e[b.type]:e[b.type][0].start()):a.log.error("forge.task",
736
-"[%s][%s] task queue missing [%s]",b.id,b.name,b.type),d||(b.error&&b.failureCallback?b.failureCallback(b):!b.error&&b.successCallback&&b.successCallback(b)))};a.task=a.task||{};a.task.start=function(a){var b=new p({run:a.run,name:a.name||"?"});b.type=a.type;b.successCallback=a.success||null;b.failureCallback=a.failure||null;b.type in e?e[a.type].push(b):(e[b.type]=[b],k(b))};a.task.cancel=function(a){a in e&&(e[a]=[e[a][0]])};a.task.createCondition=function(){var a={tasks:{},wait:function(b){b.id in
737
-a.tasks||(b.block(),a.tasks[b.id]=b)},notify:function(){var b=a.tasks;a.tasks={};for(var c in b)b[c].unblock()}};return a}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,p=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.task)return c.task;c.defined.task=!0;for(var m=0;m<e.length;++m)e[m](c);return c.task}},
738
-q=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/task",["require","module","./debug","./log","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){if("function"!==typeof a)if("object"===typeof module&&module.exports){var b=!0;a=function(a,b){b(c,module)}}else{"undefined"===typeof forge&&(forge={disableNativeCode:!1});
739
-return}var e,l=function(a,b){b.exports=function(b){var c=e.map(function(b){return a(b)});b=b||{};b.defined=b.defined||{};if(b.defined.forge)return b.forge;b.defined.forge=!0;for(var d=0;d<c.length;++d)c[d](b);return b};b.exports.disableNativeCode=!0;b.exports(b.exports)},p=a;a=function(c,l){e="string"===typeof c?l.slice(2):c.slice(2);if(b)return delete a,p.apply(null,Array.prototype.slice.call(arguments,0));a=p;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/forge","require module ./aes ./aesCipherSuites ./asn1 ./cipher ./cipherModes ./debug ./des ./hmac ./kem ./log ./md ./mgf1 ./pbkdf2 ./pem ./pkcs7 ./pkcs1 ./pkcs12 ./pki ./prime ./prng ./pss ./random ./rc2 ./ssh ./task ./tls ./util".split(" "),
740
-function(){l.apply(null,Array.prototype.slice.call(arguments,0))})})();return c("js/forge")});function amtcert_linkCertPrivateKey(b,c){for(var a in b){var d=b[a];try{if(0==xxCertPrivateKeys.length)break;for(var e=forge.pki.publicKeyToPem(forge.pki.certificateFromAsn1(forge.asn1.fromDer(d.X509Certificate)).publicKey).substring(60).replace(/(\r\n|\n|\r)/gm,""),l=0;l<c.length;l++)e===c[l].DERKey+"-----END PUBLIC KEY-----"&&(c[l].XCert=d,d.XPrivateKey=c[l])}catch(p){console.log(p)}}}
741
-function amtcert_loadP12File(b,c,a){try{var d=window.forge.util.decode64(btoa(b)),e=window.forge.asn1.fromDer(d),l=window.forge.pkcs12.pkcs12FromAsn1(e,c),p=l.getBags({bagType:window.forge.pki.oids.pkcs8ShroudedKeyBag});console.assert(p[window.forge.pki.oids.pkcs8ShroudedKeyBag]&&0<p[window.forge.pki.oids.pkcs8ShroudedKeyBag].length);var q=p[window.forge.pki.oids.pkcs8ShroudedKeyBag][0].key,n=window.forge.pki.privateKeyToAsn1(q),m=window.forge.pki.wrapRsaPrivateKey(n);window.forge.asn1.toDer(m).getBytes();
742
-var v=l.getBags({bagType:window.forge.pki.oids.certBag})[window.forge.pki.oids.certBag][0].cert.subject.attributes,h=l.getBags({bagType:forge.pki.oids.certBag})[forge.pki.oids.certBag][0].cert;a(q,v,h);return!0}catch(z){}return!1}function amtcert_signWithCaKey(b,c,a,d,e){c&&null!=c||(c=amtcert_createCertificate(d).key);return amtcert_createCertificate(a,c,b,d,e)}
743
-function amtcert_createCertificate(b,c,a,d,e){var l,p=forge.pki.createCertificate();a?p.publicKey=forge.pki.publicKeyFromPem("-----BEGIN PUBLIC KEY-----"+a+"-----END PUBLIC KEY-----"):(l=forge.pki.rsa.generateKeyPair(2048),p.publicKey=l.publicKey);p.serialNumber=""+Math.floor(1E5*Math.random()+1);p.validity.notBefore=new Date;p.validity.notBefore.setFullYear(p.validity.notBefore.getFullYear()-1);p.validity.notAfter=new Date;p.validity.notAfter.setFullYear(p.validity.notAfter.getFullYear()+30);var q=
744
-[];b.CN&&q.push({name:"commonName",value:b.CN});b.C&&q.push({name:"countryName",value:b.C});b.ST&&q.push({shortName:"ST",value:b.ST});b.O&&q.push({name:"organizationName",value:b.O});p.setSubject(q);c?(b=[],d.CN&&b.push({name:"commonName",value:d.CN}),d.C&&b.push({name:"countryName",value:d.C}),d.ST&&b.push({shortName:"ST",value:d.ST}),d.O&&b.push({name:"organizationName",value:d.O}),p.setIssuer(b)):p.setIssuer(q);void 0==c?p.setExtensions([{name:"basicConstraints",cA:!0},{name:"nsCertType",sslCA:!0,
745
-emailCA:!0,objCA:!0},{name:"subjectKeyIdentifier"}]):(null==e?e={name:"extKeyUsage",serverAuth:!0}:e.name="extKeyUsage",p.setExtensions([{name:"basicConstraints"},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},e,{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0},{name:"subjectKeyIdentifier"}]));c?p.sign(c,forge.md.sha256.create()):p.sign(l.privateKey,forge.md.sha256.create());return a?p:{cert:p,key:l.privateKey}}
729
+"done";l.done.block="done";l.done.unblock="done";l.done.sleep="done";l.done.wakeup="done";l.done.cancel="done";l.done.fail="error";l.error={};l.error.stop="error";l.error.start="error";l.error.block="error";l.error.unblock="error";l.error.sleep="error";l.error.wakeup="error";l.error.cancel="error";l.error.fail="error";var n=function(a){this.id=-1;this.name=a.name||"?";this.parent=a.parent||null;this.run=a.run;this.subtasks=[];this.error=!1;this.state="ready";this.blocks=0;this.userData=this.swapTime=
730
+this.timeoutId=null;this.id=d++;c[this.id]=this};n.prototype.debug=function(b){a.log.debug("forge.task",b||"","[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",e)};n.prototype.next=function(a,b){"function"===typeof a&&(b=a,a=this.name);var c=new n({run:b,name:a,parent:this});c.state="running";c.type=this.type;c.successCallback=this.successCallback||null;c.failureCallback=this.failureCallback||null;this.subtasks.push(c);return this};n.prototype.parallel=function(b,c){a.util.isArray(b)&&
731
+(c=b,b=this.name);return this.next(b,function(d){d.block(c.length);for(var e=function(b,e){a.task.start({type:b,run:function(a){c[e](a)},success:function(a){d.unblock()},failure:function(a){d.unblock()}})},g=0;g<c.length;g++)e(b+"__parallel-"+d.id+"-"+g,g)})};n.prototype.stop=function(){this.state=l[this.state].stop};n.prototype.start=function(){this.error=!1;this.state=l[this.state].start;"running"===this.state&&(this.start=new Date,this.run(this),g(this,0))};n.prototype.block=function(a){this.blocks+=
732
+"undefined"===typeof a?1:a;0<this.blocks&&(this.state=l[this.state].block)};n.prototype.unblock=function(a){this.blocks-="undefined"===typeof a?1:a;0===this.blocks&&"done"!==this.state&&(this.state="running",g(this,0));return this.blocks};n.prototype.sleep=function(a){this.state=l[this.state].sleep;var b=this;this.timeoutId=setTimeout(function(){b.timeoutId=null;b.state="running";g(b,0)},"undefined"===typeof a?0:a)};n.prototype.wait=function(a){a.wait(this)};n.prototype.wakeup=function(){"sleeping"===
733
+this.state&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state="running",g(this,0))};n.prototype.cancel=function(){this.state=l[this.state].cancel;this.permitsNeeded=0;null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null);this.subtasks=[]};n.prototype.fail=function(a){this.error=!0;r(this,!0);if(a)a.error=this.error,a.swapTime=this.swapTime,a.userData=this.userData,g(a,0);else{if(null!==this.parent){for(a=this.parent;null!==a.parent;)a.error=this.error,a.swapTime=this.swapTime,
734
+a.userData=this.userData,a=a.parent;r(a,!0)}this.failureCallback&&this.failureCallback(this)}};var k=function(a){a.error=!1;a.state=l[a.state].start;setTimeout(function(){"running"===a.state&&(a.swapTime=+new Date,a.run(a),g(a,0))},0)},g=function(a,b){var c=30<b||20<+new Date-a.swapTime,d=function(b){b++;if("running"===a.state)if(c&&(a.swapTime=+new Date),0<a.subtasks.length){var d=a.subtasks.shift();d.error=a.error;d.swapTime=a.swapTime;d.userData=a.userData;d.run(d);d.error||g(d,b)}else r(a),a.error||
735
+null===a.parent||(a.parent.error=a.error,a.parent.swapTime=a.swapTime,a.parent.userData=a.userData,g(a.parent,b))};c?setTimeout(d,0):d(b)},r=function(b,d){b.state="done";delete c[b.id];null===b.parent&&(b.type in e?0===e[b.type].length?a.log.error("forge.task","[%s][%s] task queue empty [%s]",b.id,b.name,b.type):e[b.type][0]!==b?a.log.error("forge.task","[%s][%s] task not first in queue [%s]",b.id,b.name,b.type):(e[b.type].shift(),0===e[b.type].length?delete e[b.type]:e[b.type][0].start()):a.log.error("forge.task",
736
+"[%s][%s] task queue missing [%s]",b.id,b.name,b.type),d||(b.error&&b.failureCallback?b.failureCallback(b):!b.error&&b.successCallback&&b.successCallback(b)))};a.task=a.task||{};a.task.start=function(a){var b=new n({run:a.run,name:a.name||"?"});b.type=a.type;b.successCallback=a.success||null;b.failureCallback=a.failure||null;b.type in e?e[a.type].push(b):(e[b.type]=[b],k(b))};a.task.cancel=function(a){a in e&&(e[a]=[e[a][0]])};a.task.createCondition=function(){var a={tasks:{},wait:function(b){b.id in
737
+a.tasks||(b.block(),a.tasks[b.id]=b)},notify:function(){var b=a.tasks;a.tasks={};for(var c in b)b[c].unblock()}};return a}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var l,n=function(a,c){c.exports=function(c){var e=l.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.task)return c.task;c.defined.task=!0;for(var m=0;m<e.length;++m)e[m](c);return c.task}},
738
+r=a;a=function(b,c){l="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/task",["require","module","./debug","./log","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){if("function"!==typeof a)if("object"===typeof module&&module.exports){var b=!0;a=function(a,b){b(c,module)}}else{"undefined"===typeof forge&&(forge={disableNativeCode:!1});
739
+return}var e,l=function(a,b){b.exports=function(b){var c=e.map(function(b){return a(b)});b=b||{};b.defined=b.defined||{};if(b.defined.forge)return b.forge;b.defined.forge=!0;for(var d=0;d<c.length;++d)c[d](b);return b};b.exports.disableNativeCode=!0;b.exports(b.exports)},n=a;a=function(c,l){e="string"===typeof c?l.slice(2):c.slice(2);if(b)return delete a,n.apply(null,Array.prototype.slice.call(arguments,0));a=n;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/forge","require module ./aes ./aesCipherSuites ./asn1 ./cipher ./cipherModes ./debug ./des ./hmac ./kem ./log ./md ./mgf1 ./pbkdf2 ./pem ./pkcs7 ./pkcs1 ./pkcs12 ./pki ./prime ./prng ./pss ./random ./rc2 ./ssh ./task ./tls ./util".split(" "),
740
+function(){l.apply(null,Array.prototype.slice.call(arguments,0))})})();return c("js/forge")});function amtcert_linkCertPrivateKey(b,c){for(var a in b){var d=b[a];try{if(0==xxCertPrivateKeys.length)break;for(var e=forge.pki.publicKeyToPem(forge.pki.certificateFromAsn1(forge.asn1.fromDer(d.X509Certificate)).publicKey).substring(60).replace(/(\r\n|\n|\r)/gm,""),l=0;l<c.length;l++)e===c[l].DERKey+"-----END PUBLIC KEY-----"&&(c[l].XCert=d,d.XPrivateKey=c[l])}catch(n){console.log(n)}}}
741
+function amtcert_loadP12File(b,c,a){try{var d=window.forge.util.decode64(btoa(b)),e=window.forge.asn1.fromDer(d),l=window.forge.pkcs12.pkcs12FromAsn1(e,c),n=l.getBags({bagType:window.forge.pki.oids.pkcs8ShroudedKeyBag});console.assert(n[window.forge.pki.oids.pkcs8ShroudedKeyBag]&&0<n[window.forge.pki.oids.pkcs8ShroudedKeyBag].length);var r=n[window.forge.pki.oids.pkcs8ShroudedKeyBag][0].key,p=window.forge.pki.privateKeyToAsn1(r),m=window.forge.pki.wrapRsaPrivateKey(p);window.forge.asn1.toDer(m).getBytes();
742
+var v=l.getBags({bagType:window.forge.pki.oids.certBag})[window.forge.pki.oids.certBag][0].cert.subject.attributes,h=l.getBags({bagType:forge.pki.oids.certBag})[forge.pki.oids.certBag][0].cert;a(r,v,h);return!0}catch(x){}return!1}function amtcert_signWithCaKey(b,c,a,d,e){c&&null!=c||(c=amtcert_createCertificate(d).key);return amtcert_createCertificate(a,c,b,d,e)}
743
+function amtcert_createCertificate(b,c,a,d,e){var l,n=forge.pki.createCertificate();a?n.publicKey=forge.pki.publicKeyFromPem("-----BEGIN PUBLIC KEY-----"+a+"-----END PUBLIC KEY-----"):(l=forge.pki.rsa.generateKeyPair(2048),n.publicKey=l.publicKey);n.serialNumber=""+Math.floor(1E5*Math.random()+1);n.validity.notBefore=new Date;n.validity.notBefore.setFullYear(n.validity.notBefore.getFullYear()-1);n.validity.notAfter=new Date;n.validity.notAfter.setFullYear(n.validity.notAfter.getFullYear()+30);var r=
744
+[];b.CN&&r.push({name:"commonName",value:b.CN});b.C&&r.push({name:"countryName",value:b.C});b.ST&&r.push({shortName:"ST",value:b.ST});b.O&&r.push({name:"organizationName",value:b.O});n.setSubject(r);c?(b=[],d.CN&&b.push({name:"commonName",value:d.CN}),d.C&&b.push({name:"countryName",value:d.C}),d.ST&&b.push({shortName:"ST",value:d.ST}),d.O&&b.push({name:"organizationName",value:d.O}),n.setIssuer(b)):n.setIssuer(r);void 0==c?n.setExtensions([{name:"basicConstraints",cA:!0},{name:"nsCertType",sslCA:!0,
745
+emailCA:!0,objCA:!0},{name:"subjectKeyIdentifier"}]):(null==e?e={name:"extKeyUsage",serverAuth:!0}:e.name="extKeyUsage",n.setExtensions([{name:"basicConstraints"},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},e,{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0},{name:"subjectKeyIdentifier"}]));c?n.sign(c,forge.md.sha256.create()):n.sign(l.privateKey,forge.md.sha256.create());return a?n:{cert:n,key:l.privateKey}}
746
function _stringToArrayBuffer(b){for(var c=new ArrayBuffer(b.length),a=new Uint8Array(c),d=0,e=b.length;d<e;d++)a[d]=b.charCodeAt(d);return c}function _arrayBufferToString(b){var c="";b=new Uint8Array(b);for(var a=b.byteLength,d=0;d<a;d++)c+=String.fromCharCode(b[d]);return c}script_functionTable1="nop jump set print dialog getitem substr indexof split join length jsonparse jsonstr add substract parseint wsbatchenum wsput wscreate wsdelete wsexec scriptspeed wssubscribe wsunsubscribe readchar signwithdummyca".split(" ");
747
script_functionTable2="encodeuri decodeuri passwordcheck atob btoa hex2str str2hex random md5 maketoarray readshort readshortx readint readsint readintx shorttostr shorttostrx inttostr inttostrx".split(" ");script_functionTableX2=[encodeURI,decodeURI,passwordcheck,window.atob.bind(window),window.btoa.bind(window),hex2rstr,rstr2hex,random,rstr_md5,MakeToArray,ReadShort,ReadShortX,ReadInt,ReadSInt,ReadIntX,ShortToStr,ShortToStrX,IntToStr,IntToStrX];script_functionTable3="pullsystemstatus pulleventlog pullauditlog pullcertificates pullwatchdog pullsystemdefense pullhardware pulluserinfo pullremoteaccess highlightblock disconnect getsidstring getsidbytearray pulleventsubscriptions".split(" ");
748
script_functionTableX3=[PullSystemStatus,PullEventLog,PullAuditLog,PullCertificates,PullWatchdog,PullSystemDefense,PullHardware,PullUserInfo,PullRemoteAccess,script_HighlightBlock,,function(b,c){return GetSidString(c)},function(b,c){return GetSidByteArray(c)},PullEventSubscriptions];
749
function script_setup(b,c){var a={startvars:c};if(6>b.length)return console.error("Invalid script length"),null;if(612182341!=ReadInt(b,0))return console.error("Invalid binary script"),null;if(1<ReadShort(b,4))return console.error("Unsupported script version"),null;a.script=b.substring(6);a.reset=function(b){a.stop();a.ip=0;a.variables=c;a.state=1};a.start=function(b){a.stop();a.stepspeed=b;0<b&&(a.timer=setInterval(function(){a.step()},b))};a.stop=function(){null!=a.timer&&clearInterval(a.timer);
750
a.timer=null;a.stepspeed=0};a.getVar=function(b){return void 0==b?void 0:a.getVarEx(b.split("."),a.variables)};a.getVarEx=function(b,c){try{return void 0==b?void 0:0==b.length?c:a.getVarEx(b.slice(1),c[b[0]])}catch(l){return null}};a.setVar=function(b,c){a.setVarEx(b.split("."),a.variables,c)};a.setVarEx=function(b,c,l){1==b.length?c[b[0]]=l:a.setVarEx(b.slice(1),c[b[0]],l)};a.step=function(){if(1==a.state){if(a.ip<a.script.length){var b=ReadShort(a.script,a.ip),c=ReadShort(a.script,a.ip+2),l=ReadShort(a.script,
751
-a.ip+4),p=a.ip+6,q=[],n;for(n in a.variables)n.startsWith("__")&&delete a.variables[n];for(n=0;n<l;n++){var m=ReadShort(a.script,p),v=a.script.substring(p+2,p+2+m),h=v.charCodeAt(0),v=v.substring(1);if(2>h){for(;1<v.split("{").length;)var z=v.split("{").pop().split("}").shift(),v=v.replace("{"+z+"}",a.getVar(z));1==h&&(a.variables["__"+n]=decodeURI(v),v="__"+n);q.push(v)}if(2==h||3==h)a.variables["__"+n]=ReadSInt(v,0),q.push("__"+n);p+=2+m}a.ip+=c;c=[];for(n=0;10>n;n++)c.push(a.getVar(q[n]));var B;
752
-try{if(1E4>b)switch(b){case 0:break;case 1:if(c[2]){if("<"==c[2]&&c[1]<c[3]||"<="==c[2]&&c[1]<=c[3]||"!="==c[2]&&c[1]!=c[3]||"="==c[2]&&c[1]==c[3]||">="==c[2]&&c[1]>=c[3]||">"==c[2]&&c[1]>c[3])a.ip=c[0]}else a.ip=c[0];break;case 2:void 0==q[1]?delete a.variables[q[0]]:a.setVar(q[0],c[1]);break;case 3:if(a.onConsole)a.onConsole(a.toString(c[0]),a);else console.log(a.toString(c[0]));break;case 4:a.state=2;a.dialog=!0;setDialogMode(11,c[0],c[2],a.xxStepDialogOk,c[1],a);break;case 5:for(n in c[1])c[1][n][c[2]]==
753
-c[3]&&(B=n);break;case 6:B=c[1].substr(c[2],c[3]);break;case 7:B=c[1].indexOf(c[2]);break;case 8:B=c[1].split(c[2]);break;case 9:B=c[1].join(c[2]);break;case 10:B=c[1].length;break;case 11:B=JSON.parse(c[1]);break;case 12:B=JSON.stringify(c[1]);break;case 13:B=c[1]+c[2];break;case 14:B=c[1]-c[2];break;case 15:B=parseInt(c[1]);break;case 16:a.state=2;a.amtstack.BatchEnum(c[0],c[1],a.xxWsmanReturn,a);break;case 17:a.state=2;a.amtstack.Put(c[0],c[1],a.xxWsmanReturn,a);break;case 18:a.state=2;a.amtstack.Create(c[0],
751
+a.ip+4),n=a.ip+6,r=[],p;for(p in a.variables)p.startsWith("__")&&delete a.variables[p];for(p=0;p<l;p++){var m=ReadShort(a.script,n),v=a.script.substring(n+2,n+2+m),h=v.charCodeAt(0),v=v.substring(1);if(2>h){for(;1<v.split("{").length;)var x=v.split("{").pop().split("}").shift(),v=v.replace("{"+x+"}",a.getVar(x));1==h&&(a.variables["__"+p]=decodeURI(v),v="__"+p);r.push(v)}if(2==h||3==h)a.variables["__"+p]=ReadSInt(v,0),r.push("__"+p);n+=2+m}a.ip+=c;c=[];for(p=0;10>p;p++)c.push(a.getVar(r[p]));var B;
752
+try{if(1E4>b)switch(b){case 0:break;case 1:if(c[2]){if("<"==c[2]&&c[1]<c[3]||"<="==c[2]&&c[1]<=c[3]||"!="==c[2]&&c[1]!=c[3]||"="==c[2]&&c[1]==c[3]||">="==c[2]&&c[1]>=c[3]||">"==c[2]&&c[1]>c[3])a.ip=c[0]}else a.ip=c[0];break;case 2:void 0==r[1]?delete a.variables[r[0]]:a.setVar(r[0],c[1]);break;case 3:if(a.onConsole)a.onConsole(a.toString(c[0]),a);else console.log(a.toString(c[0]));break;case 4:a.state=2;a.dialog=!0;setDialogMode(11,c[0],c[2],a.xxStepDialogOk,c[1],a);break;case 5:for(p in c[1])c[1][p][c[2]]==
753
+c[3]&&(B=p);break;case 6:B=c[1].substr(c[2],c[3]);break;case 7:B=c[1].indexOf(c[2]);break;case 8:B=c[1].split(c[2]);break;case 9:B=c[1].join(c[2]);break;case 10:B=c[1].length;break;case 11:B=JSON.parse(c[1]);break;case 12:B=JSON.stringify(c[1]);break;case 13:B=c[1]+c[2];break;case 14:B=c[1]-c[2];break;case 15:B=parseInt(c[1]);break;case 16:a.state=2;a.amtstack.BatchEnum(c[0],c[1],a.xxWsmanReturn,a);break;case 17:a.state=2;a.amtstack.Put(c[0],c[1],a.xxWsmanReturn,a);break;case 18:a.state=2;a.amtstack.Create(c[0],
754
c[1],a.xxWsmanReturn,a);break;case 19:a.state=2;a.amtstack.Delete(c[0],c[1],a.xxWsmanReturn,a);break;case 20:a.state=2;a.amtstack.Exec(c[0],c[1],c[2],a.xxWsmanReturn,a,0,c[3]);break;case 21:a.stepspeed=c[0];null!=a.timer&&(clearInterval(a.timer),a.timer=setInterval(function(){a.step()},a.stepspeed));break;case 22:a.state=2;a.amtstack.Subscribe(c[0],c[1],c[2],a.xxWsmanReturn,a,0,c[3],c[4],c[5],c[6]);break;case 23:a.state=2;a.amtstack.UnSubscribe(c[0],a.xxWsmanReturn,a,0,c[1]);break;case 24:console.log(c[1],
755
-c[2],c[1].charCodeAt(c[2]));B=c[1].charCodeAt(c[2]);break;case 25:a.state=2;amtcert_signWithCaKey(c[0],null,c[1],{CN:"Untrusted Root Certificate"},a.xxSignWithDummyCaReturn);break;default:a.state=9,console.error("Script Error, unknown command: "+b)}else 2E4>b?B=script_functionTableX2[b-1E4](c[1],c[2],c[3],c[4],c[5],c[6]):script_functionTableX3&&script_functionTableX3[b-2E4]&&(B=script_functionTableX3[b-2E4](a,c[1],c[2],c[3],c[4],c[5],c[6]));void 0!=B&&a.setVar(q[0],B)}catch(k){"object"==typeof k&&
756
-(k=k.message),a.setVar("_exception",k)}}1==a.state&&a.ip>=a.script.length&&(a.state=0,a.stop());if(a.onStep)a.onStep(a);return a}};a.xxStepDialogOk=function(b){a.variables.DialogSelect=b;a.state=1;a.dialog=!1;if(a.onStep)a.onStep(a)};a.xxWsmanReturn=function(b,c,l,p){a.setVar(c,l);a.setVar("wsman_result",p);a.setVar("wsman_result_str",httpErrorTable[p]?httpErrorTable[p]:"Error #"+p);a.state=1;if(a.onStep)a.onStep(a)};a.xxSignWithDummyCaReturn=function(b){a.setVar("signed_cert",btoa(_arrayBufferToString(b)));
755
+c[2],c[1].charCodeAt(c[2]));B=c[1].charCodeAt(c[2]);break;case 25:a.state=2;amtcert_signWithCaKey(c[0],null,c[1],{CN:"Untrusted Root Certificate"},a.xxSignWithDummyCaReturn);break;default:a.state=9,console.error("Script Error, unknown command: "+b)}else 2E4>b?B=script_functionTableX2[b-1E4](c[1],c[2],c[3],c[4],c[5],c[6]):script_functionTableX3&&script_functionTableX3[b-2E4]&&(B=script_functionTableX3[b-2E4](a,c[1],c[2],c[3],c[4],c[5],c[6]));void 0!=B&&a.setVar(r[0],B)}catch(k){"object"==typeof k&&
756
+(k=k.message),a.setVar("_exception",k)}}1==a.state&&a.ip>=a.script.length&&(a.state=0,a.stop());if(a.onStep)a.onStep(a);return a}};a.xxStepDialogOk=function(b){a.variables.DialogSelect=b;a.state=1;a.dialog=!1;if(a.onStep)a.onStep(a)};a.xxWsmanReturn=function(b,c,l,n){a.setVar(c,l);a.setVar("wsman_result",n);a.setVar("wsman_result_str",httpErrorTable[n]?httpErrorTable[n]:"Error #"+n);a.state=1;if(a.onStep)a.onStep(a)};a.xxSignWithDummyCaReturn=function(b){a.setVar("signed_cert",btoa(_arrayBufferToString(b)));
757
a.state=1;if(a.onStep)a.onStep(a)};a.toString=function(a){return"object"==typeof a?JSON.stringify(a):a};a.reset();return a}
758
-function script_compile(b,c){var a="",d=b.split("\n"),e={},l=[],p=[],q;for(q in d){var n=d[q];if(n.startsWith("##SWAP ")){var m=n.split(" ");3==m.length&&(p[m[1]]=m[2])}if("#"!=n[0]&&0!=n.length){for(m in p)n=n.split(m).join(p[m]);var v=n.match(/"[^"]*"|[^\s"]+/g);if(0!=v.length)if(":"==n[0])e[v[0].toUpperCase()]=a.length;else{n=script_functionTable1.indexOf(v[0].toLowerCase());-1==n&&(n=script_functionTable2.indexOf(v[0].toLowerCase()),0<=n&&(n+=1E4));-1==n&&(n=script_functionTable3.indexOf(v[0].toLowerCase()),
759
-0<=n&&(n+=2E4));if(-1==n)return c&&c("Unabled to compile, unknown command: "+v[0]),"";var h=ShortToStr(v.length-1),z;for(z in v)if(0!=z)if(":"==v[z][0])l.push([v[z],a.length+h.length+7]),h+=ShortToStr(5)+String.fromCharCode(3)+IntToStr(4294967295);else var B=parseInt(v[z]),h=B==v[z]?h+(ShortToStr(5)+String.fromCharCode(2)+IntToStr(B)):'"'==v[z][0]&&'"'==v[z][v[z].length-1]?h+(ShortToStr(v[z].length-1)+String.fromCharCode(1)+v[z].substring(1,v[z].length-1)):h+(ShortToStr(v[z].length+1)+String.fromCharCode(0)+
760
-v[z]);h=ShortToStr(n)+ShortToStr(h.length+4)+h;a+=h}}}for(q in l){d=l[q][0].toUpperCase();p=l[q][1];m=e[d];if(void 0==m)return c&&c("Unabled to compile, unknown label: "+d),"";a=a.substr(0,p)+IntToStr(m)+a.substr(p+4)}return IntToStr(612182341)+ShortToStr(1)+a}
761
-function script_decompile(b,c){var a="",d=6,e={};if(0<=c)d=c;else{if(6>b.length)return"# Invalid script length";var l=ReadInt(b,0),p=ReadShort(b,4);if(612182341!=l)return"# Invalid binary script: "+l;if(1!=p)return"# Invalid script version"}for(;d<b.length;){var l=ReadShort(b,d),p=ReadShort(b,d+2),q=ReadShort(b,d+4),n=d+6,m="";0<=c||(a+=":label"+(d-6)+"\n");for(var v=0;v<q;v++){var h=ReadShort(b,n),z=b.substring(n+2,n+2+h),B=z.charCodeAt(0);0==B?m+=" "+z.substring(1):1==B?m+=' "'+z.substring(1)+'"':
762
-2==B?m+=" "+ReadInt(z,1):3==B&&(z=ReadInt(z,1),B=e[z],B||(B=":label"+z,e[B]=z),m+=" "+B);n+=2+h}a=1E4>l?a+(script_functionTable1[l]+m+"\n"):2E4<=l?a+(script_functionTable3[l-2E4]+m+"\n"):a+(script_functionTable2[l-1E4]+m+"\n");d+=p;if(0<=c)return a}d=a.split("\n");a="";for(v in d)l=d[v],":"!=l[0]?a+=l+"\n":e[l]&&(a+=l+"\n");return a}
763
-var CreateAmtRemoteDesktop=function(b,c){function a(a,b,c,k,m,n,y,u){var B=a.charCodeAt(b++);u={};var C=0,r=0;if(0==B){if(2==g.bpp)for(m=0;m<y;m++)l(a.charCodeAt(b++)+(a.charCodeAt(b++)<<8),m);else for(m=0;m<y;m++)e(a.charCodeAt(b++),m);d(g.spare,c,k)}else if(1==B)B=a.charCodeAt(b++)+(2==g.bpp?a.charCodeAt(b++)<<8:0),g.canvas.fillStyle="rgb("+(1==g.bpp?(B&224)+","+((B&28)<<3)+","+z((B&3)<<6):(B>>8&248)+","+(B>>3&252)+","+((B&31)<<3))+")",a=v(c,k),k=h(c,k),g.canvas.fillRect(a,k,m,n);else if(1<B&&17>
764
-B){n=4;r=15;if(2==g.bpp){for(m=0;m<B;m++)u[m]=a.charCodeAt(b++)+(a.charCodeAt(b++)<<8);2==B?r=n=1:4>=B&&(n=2,r=3);for(;C<y&&b<a.length;)for(B=a.charCodeAt(b++),m=8-n;0<=m;m-=n)l(u[B>>m&r],C++)}else{for(m=0;m<B;m++)u[m]=a.charCodeAt(b++);2==B?r=n=1:4>=B&&(n=2,r=3);for(;C<y&&b<a.length;)for(B=a.charCodeAt(b++),m=8-n;0<=m;m-=n)e(u[B>>m&r],C++)}d(g.spare,c,k)}else if(128==B){if(2==g.bpp)for(;C<y&&b<a.length;){B=a.charCodeAt(b++)+(a.charCodeAt(b++)<<8);r=1;do r+=m=a.charCodeAt(b++);while(255==m);if(0==
765
-g.rotation)q(B,C,r),C+=r;else for(;0<=--r;)l(B,C++)}else for(;C<y&&b<a.length;){B=a.charCodeAt(b++);r=1;do r+=m=a.charCodeAt(b++);while(255==m);if(0==g.rotation)p(B,C,r),C+=r;else for(;0<=--r;)e(B,C++)}d(g.spare,c,k)}else if(129<B){if(2==g.bpp)for(m=0;m<B-128;m++)u[m]=a.charCodeAt(b++)+(a.charCodeAt(b++)<<8);else for(m=0;m<B-128;m++)u[m]=a.charCodeAt(b++);for(;C<y&&b<a.length;){r=1;m=a.charCodeAt(b++);B=u[m%128];if(127<m){do r+=m=a.charCodeAt(b++);while(255==m)}if(0==g.rotation)2==g.bpp?q(B,C,r):
766
-p(B,C,r),C+=r;else if(2==g.bpp)for(;0<=--r;)l(B,C++);else for(;0<=--r;)e(B,C++)}d(g.spare,c,k)}}function d(a,b,c){if(1!=g.holding){var d=0==g.rotation?b:1==g.rotation?g.canvas.canvas.width-g.sparew2-c:2==g.rotation?g.canvas.canvas.width-g.sparew2-b:3==g.rotation?c:0;c=0==g.rotation?c:1==g.rotation?b:2==g.rotation?g.canvas.canvas.height-g.spareh2-c:3==g.rotation?g.canvas.canvas.height-g.spareh-b:0;g.canvas.putImageData(a,d,c)}}function e(a,b){var c=b<<2;if(0<g.rotation)if(1==g.rotation){var c=b%g.sparew,
767
-d=Math.floor(b/g.sparew);b=c*g.sparew2+(g.sparew2-1-d);c=b<<2}else 2==g.rotation?c=g.sparew*g.spareh*4-4-c:3==g.rotation&&(c=b%g.sparew,d=Math.floor(b/g.sparew),b=(g.sparew2-1-c)*g.sparew2+d,c=b<<2);0==g.graymode?(g.spare.data[c]=a&224,g.spare.data[c+1]=(a&28)<<3,g.spare.data[c+2]=z((a&3)<<6)):g.spare.data[c]=g.spare.data[c+1]=g.spare.data[c+2]=a}function l(a,b){var c=b<<2;if(0<g.rotation)if(1==g.rotation){var c=b%g.sparew,d=Math.floor(b/g.sparew);b=c*g.sparew2+(g.sparew2-1-d);c=b<<2}else 2==g.rotation?
768
-c=g.sparew*g.spareh*4-4-c:3==g.rotation&&(c=b%g.sparew,d=Math.floor(b/g.sparew),b=(g.sparew2-1-c)*g.sparew2+d,c=b<<2);g.spare.data[c]=a>>8&248;g.spare.data[c+1]=a>>3&252;g.spare.data[c+2]=(a&31)<<3}function p(a,b,c){b<<=2;var d=a&224,e=(a&28)<<3;for(a=z((a&3)<<6);0<=--c;)g.spare.data[b]=d,g.spare.data[b+1]=e,g.spare.data[b+2]=a,b+=4}function q(a,b,c){b<<=2;var d=a>>8&248,e=a>>3&252;for(a=(a&31)<<3;0<=--c;)g.spare.data[b]=d,g.spare.data[b+1]=e,g.spare.data[b+2]=a,b+=4}function n(a,b){return 0==g.rotation?
769
-a:1==g.rotation?b:2==g.rotation?g.canvas.canvas.width-a:3==g.rotation?g.canvas.canvas.height-b:0}function m(a,b){return 0==g.rotation?b:1==g.rotation?g.canvas.canvas.width-a:2==g.rotation?g.canvas.canvas.height-b:3==g.rotation?a:0}function v(a,b){return 0==g.rotation||1==g.rotation?a:2==g.rotation?a-g.canvas.canvas.width:3==g.rotation?a-g.canvas.canvas.height:0}function h(a,b){return 0==g.rotation?b:1==g.rotation?b-g.canvas.canvas.width:2==g.rotation?b-g.canvas.canvas.height:3==g.rotation?b:0}function z(a){return 127<
770
-a?a+32:a}function B(){1!=g.holding&&g.Send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(g.rwidth)+ShortToStr(g.rheight))}function k(a,b){b||(b=window.event);if(b.code){var c;c=b;c=c.code.startsWith("Key")&&4==c.code.length?c.code.charCodeAt(3)+(0==c.shiftKey?32:0):c.code.startsWith("Digit")&&6==c.code.length?c.code.charCodeAt(5):c.code.startsWith("Numpad")&&7==c.code.length?c.code.charCodeAt(6):J[c.code];null!=c&&g.sendkey(c,a)}else{c=b.keyCode;173==c&&(c=189);61==c&&(c=187);var d=c;0==b.shiftKey&&
758
+function script_compile(b,c){var a="",d=b.split("\n"),e={},l=[],n=[],r;for(r in d){var p=d[r];if(p.startsWith("##SWAP ")){var m=p.split(" ");3==m.length&&(n[m[1]]=m[2])}if("#"!=p[0]&&0!=p.length){for(m in n)p=p.split(m).join(n[m]);var v=p.match(/"[^"]*"|[^\s"]+/g);if(0!=v.length)if(":"==p[0])e[v[0].toUpperCase()]=a.length;else{p=script_functionTable1.indexOf(v[0].toLowerCase());-1==p&&(p=script_functionTable2.indexOf(v[0].toLowerCase()),0<=p&&(p+=1E4));-1==p&&(p=script_functionTable3.indexOf(v[0].toLowerCase()),
759
+0<=p&&(p+=2E4));if(-1==p)return c&&c("Unabled to compile, unknown command: "+v[0]),"";var h=ShortToStr(v.length-1),x;for(x in v)if(0!=x)if(":"==v[x][0])l.push([v[x],a.length+h.length+7]),h+=ShortToStr(5)+String.fromCharCode(3)+IntToStr(4294967295);else var B=parseInt(v[x]),h=B==v[x]?h+(ShortToStr(5)+String.fromCharCode(2)+IntToStr(B)):'"'==v[x][0]&&'"'==v[x][v[x].length-1]?h+(ShortToStr(v[x].length-1)+String.fromCharCode(1)+v[x].substring(1,v[x].length-1)):h+(ShortToStr(v[x].length+1)+String.fromCharCode(0)+
760
+v[x]);h=ShortToStr(p)+ShortToStr(h.length+4)+h;a+=h}}}for(r in l){d=l[r][0].toUpperCase();n=l[r][1];m=e[d];if(void 0==m)return c&&c("Unabled to compile, unknown label: "+d),"";a=a.substr(0,n)+IntToStr(m)+a.substr(n+4)}return IntToStr(612182341)+ShortToStr(1)+a}
761
+function script_decompile(b,c){var a="",d=6,e={};if(0<=c)d=c;else{if(6>b.length)return"# Invalid script length";var l=ReadInt(b,0),n=ReadShort(b,4);if(612182341!=l)return"# Invalid binary script: "+l;if(1!=n)return"# Invalid script version"}for(;d<b.length;){var l=ReadShort(b,d),n=ReadShort(b,d+2),r=ReadShort(b,d+4),p=d+6,m="";0<=c||(a+=":label"+(d-6)+"\n");for(var v=0;v<r;v++){var h=ReadShort(b,p),x=b.substring(p+2,p+2+h),B=x.charCodeAt(0);0==B?m+=" "+x.substring(1):1==B?m+=' "'+x.substring(1)+'"':
762
+2==B?m+=" "+ReadInt(x,1):3==B&&(x=ReadInt(x,1),B=e[x],B||(B=":label"+x,e[B]=x),m+=" "+B);p+=2+h}a=1E4>l?a+(script_functionTable1[l]+m+"\n"):2E4<=l?a+(script_functionTable3[l-2E4]+m+"\n"):a+(script_functionTable2[l-1E4]+m+"\n");d+=n;if(0<=c)return a}d=a.split("\n");a="";for(v in d)l=d[v],":"!=l[0]?a+=l+"\n":e[l]&&(a+=l+"\n");return a}
763
+var CreateAmtRemoteDesktop=function(b,c){function a(a,b,c,k,m,p,z,u){var B=a.charCodeAt(b++);u={};var C=0,q=0;if(0==B){if(2==g.bpp)for(m=0;m<z;m++)l(a.charCodeAt(b++)+(a.charCodeAt(b++)<<8),m);else for(m=0;m<z;m++)e(a.charCodeAt(b++),m);d(g.spare,c,k)}else if(1==B)B=a.charCodeAt(b++)+(2==g.bpp?a.charCodeAt(b++)<<8:0),g.canvas.fillStyle="rgb("+(1==g.bpp?(B&224)+","+((B&28)<<3)+","+x((B&3)<<6):(B>>8&248)+","+(B>>3&252)+","+((B&31)<<3))+")",a=v(c,k),k=h(c,k),g.canvas.fillRect(a,k,m,p);else if(1<B&&17>
764
+B){p=4;q=15;if(2==g.bpp){for(m=0;m<B;m++)u[m]=a.charCodeAt(b++)+(a.charCodeAt(b++)<<8);2==B?q=p=1:4>=B&&(p=2,q=3);for(;C<z&&b<a.length;)for(B=a.charCodeAt(b++),m=8-p;0<=m;m-=p)l(u[B>>m&q],C++)}else{for(m=0;m<B;m++)u[m]=a.charCodeAt(b++);2==B?q=p=1:4>=B&&(p=2,q=3);for(;C<z&&b<a.length;)for(B=a.charCodeAt(b++),m=8-p;0<=m;m-=p)e(u[B>>m&q],C++)}d(g.spare,c,k)}else if(128==B){if(2==g.bpp)for(;C<z&&b<a.length;){B=a.charCodeAt(b++)+(a.charCodeAt(b++)<<8);q=1;do q+=m=a.charCodeAt(b++);while(255==m);if(0==
765
+g.rotation)r(B,C,q),C+=q;else for(;0<=--q;)l(B,C++)}else for(;C<z&&b<a.length;){B=a.charCodeAt(b++);q=1;do q+=m=a.charCodeAt(b++);while(255==m);if(0==g.rotation)n(B,C,q),C+=q;else for(;0<=--q;)e(B,C++)}d(g.spare,c,k)}else if(129<B){if(2==g.bpp)for(m=0;m<B-128;m++)u[m]=a.charCodeAt(b++)+(a.charCodeAt(b++)<<8);else for(m=0;m<B-128;m++)u[m]=a.charCodeAt(b++);for(;C<z&&b<a.length;){q=1;m=a.charCodeAt(b++);B=u[m%128];if(127<m){do q+=m=a.charCodeAt(b++);while(255==m)}if(0==g.rotation)2==g.bpp?r(B,C,q):
766
+n(B,C,q),C+=q;else if(2==g.bpp)for(;0<=--q;)l(B,C++);else for(;0<=--q;)e(B,C++)}d(g.spare,c,k)}}function d(a,b,c){if(1!=g.holding){var d=0==g.rotation?b:1==g.rotation?g.canvas.canvas.width-g.sparew2-c:2==g.rotation?g.canvas.canvas.width-g.sparew2-b:3==g.rotation?c:0;c=0==g.rotation?c:1==g.rotation?b:2==g.rotation?g.canvas.canvas.height-g.spareh2-c:3==g.rotation?g.canvas.canvas.height-g.spareh-b:0;g.canvas.putImageData(a,d,c)}}function e(a,b){var c=b<<2;if(0<g.rotation)if(1==g.rotation){var c=b%g.sparew,
767
+d=Math.floor(b/g.sparew);b=c*g.sparew2+(g.sparew2-1-d);c=b<<2}else 2==g.rotation?c=g.sparew*g.spareh*4-4-c:3==g.rotation&&(c=b%g.sparew,d=Math.floor(b/g.sparew),b=(g.sparew2-1-c)*g.sparew2+d,c=b<<2);0==g.graymode?(g.spare.data[c]=a&224,g.spare.data[c+1]=(a&28)<<3,g.spare.data[c+2]=x((a&3)<<6)):g.spare.data[c]=g.spare.data[c+1]=g.spare.data[c+2]=a}function l(a,b){var c=b<<2;if(0<g.rotation)if(1==g.rotation){var c=b%g.sparew,d=Math.floor(b/g.sparew);b=c*g.sparew2+(g.sparew2-1-d);c=b<<2}else 2==g.rotation?
768
+c=g.sparew*g.spareh*4-4-c:3==g.rotation&&(c=b%g.sparew,d=Math.floor(b/g.sparew),b=(g.sparew2-1-c)*g.sparew2+d,c=b<<2);g.spare.data[c]=a>>8&248;g.spare.data[c+1]=a>>3&252;g.spare.data[c+2]=(a&31)<<3}function n(a,b,c){b<<=2;var d=a&224,e=(a&28)<<3;for(a=x((a&3)<<6);0<=--c;)g.spare.data[b]=d,g.spare.data[b+1]=e,g.spare.data[b+2]=a,b+=4}function r(a,b,c){b<<=2;var d=a>>8&248,e=a>>3&252;for(a=(a&31)<<3;0<=--c;)g.spare.data[b]=d,g.spare.data[b+1]=e,g.spare.data[b+2]=a,b+=4}function p(a,b){return 0==g.rotation?
769
+a:1==g.rotation?b:2==g.rotation?g.canvas.canvas.width-a:3==g.rotation?g.canvas.canvas.height-b:0}function m(a,b){return 0==g.rotation?b:1==g.rotation?g.canvas.canvas.width-a:2==g.rotation?g.canvas.canvas.height-b:3==g.rotation?a:0}function v(a,b){return 0==g.rotation||1==g.rotation?a:2==g.rotation?a-g.canvas.canvas.width:3==g.rotation?a-g.canvas.canvas.height:0}function h(a,b){return 0==g.rotation?b:1==g.rotation?b-g.canvas.canvas.width:2==g.rotation?b-g.canvas.canvas.height:3==g.rotation?b:0}function x(a){return 127<
770
+a?a+32:a}function B(){1!=g.holding&&g.Send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(g.rwidth)+ShortToStr(g.rheight))}function k(a,b){b||(b=window.event);if(b.code){var c;c=b;c=c.code.startsWith("Key")&&4==c.code.length?c.code.charCodeAt(3)+(0==c.shiftKey?32:0):c.code.startsWith("Digit")&&6==c.code.length?c.code.charCodeAt(5):c.code.startsWith("Numpad")&&7==c.code.length?c.code.charCodeAt(6):K[c.code];null!=c&&g.sendkey(c,a)}else{c=b.keyCode;173==c&&(c=189);61==c&&(c=187);var d=c;0==b.shiftKey&&
771
65<=c&&90>=c&&(d=c+32);112<=c&&124>=c&&(d=c+65358);8==c&&(d=65288);9==c&&(d=65289);13==c&&(d=65293);16==c&&(d=65505);17==c&&(d=65507);18==c&&(d=65513);27==c&&(d=65307);33==c&&(d=65365);34==c&&(d=65366);35==c&&(d=65367);36==c&&(d=65360);37==c&&(d=65361);38==c&&(d=65362);39==c&&(d=65363);40==c&&(d=65364);45==c&&(d=65379);46==c&&(d=65535);96<=c&&105>=c&&(d=c-48);106==c&&(d=42);107==c&&(d=43);109==c&&(d=45);110==c&&(d=46);111==c&&(d=47);186==c&&(d=59);187==c&&(d=61);188==c&&(d=44);189==c&&(d=45);190==
772
c&&(d=46);191==c&&(d=47);192==c&&(d=96);219==c&&(d=91);220==c&&(d=92);221==c&&(d=93);222==c&&(d=39);g.sendkey(d,a)}return g.haltEvent(b)}var g={};g.canvasid=b;g.scrolldiv=c;g.canvas=Q(b).getContext("2d");g.protocol=2;g.state=0;g.acc="";g.ScreenWidth=960;g.ScreenHeight=700;g.width=0;g.height=0;g.rwidth=0;g.rheight=0;g.bpp=2;g.graymode=0;g.useZRLE=!0;g.showmouse=!0;g.buttonmask=0;g.spare=null;g.sparew=0;g.spareh=0;g.sparew2=0;g.spareh2=0;g.sparecache={};g.ZRLEfirst=1;g.onScreenSizeChange=null;g.frameRateDelay=
773
0;g.noMouseRotate=!1;g.rotation=0;g.kvmDataSupported=!1;g.onKvmData=null;g.onKvmDataPending=[];g.onKvmDataAck=-1;g.holding=!1;g.lastKeepAlive=Date.now();g.mNagleTimer=null;g.mx=0;g.my=0;g.inflate=ZLIB.inflateInit(-15);g.Debug=function(a){console.log(a)};g.xxStateChange=function(a){0==a?(g.canvas.fillStyle="#000000",g.canvas.fillRect(0,0,g.width,g.height),g.canvas.canvas.width=g.rwidth=g.width=640,g.canvas.canvas.height=g.rheight=g.height=400,QS(g.canvasid).cursor="auto",g.inflate=ZLIB.inflateInit(-15)):
@@ -775,137 +775,137 @@ g.showmouse||(QS(g.canvasid).cursor="none")};g.ProcessData=function(b){if(b)for(
775
c=24+b;g.canvas.canvas.width=g.rwidth=g.width=g.ScreenWidth=ReadShort(g.acc,0);g.canvas.canvas.height=g.rheight=g.height=g.ScreenHeight=ReadShort(g.acc,2);b="";g.useZRLE&&(b+=IntToStr(16));b+=IntToStr(0);b+=IntToStr(1092);g.Send(String.fromCharCode(2,0)+ShortToStr(b.length/4+1)+b+IntToStr(-223));0==g.graymode?1==g.bpp&&g.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)):(g.bpp=1,1==g.graymode&&g.Send(String.fromCharCode(0,0,0,0,8,
776
8,0,1)+ShortToStr(255)+ShortToStr(0)+ShortToStr(0)+String.fromCharCode(0,0,0,0,0,0)),2==g.graymode&&g.Send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(15)+ShortToStr(0)+ShortToStr(0)+String.fromCharCode(0,0,0,0,0,0)));g.state=4;g.parent&&g.parent.xxStateChange(3);B();if(null!=g.onScreenSizeChange)g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight)}else if(4==g.state)switch(g.acc.charCodeAt(0)){case 0:if(4>g.acc.length)return;g.state=100+ReadShort(g.acc,2);c=4;break;case 2:c=1;break;case 3:if(8>
777
g.acc.length)return;b=ReadInt(g.acc,4)+8;if(g.acc.length<b)return;var h=g.acc;if(8>h.length)c=0;else if(b=ReadInt(g.acc,4)+8,h.length<b)c=0;else{if(null!=g.onKvmData&&(h=h.substring(8,b),16<=h.length&&"\x00KvmDataChannel"==h.substring(0,15))){0==g.kvmDataSupported&&(g.kvmDataSupported=!0,console.log("KVM Data Channel Supported."));if(-1==g.onKvmDataAck&&16==h.length||0!=h.charCodeAt(15))g.onKvmDataAck=!0;urlvars&&urlvars.kvmdatatrace&&console.log("KVM-Recv("+(h.length-16)+"): "+h.substring(16));if(16<
778
-h.length)g.onKvmData(h.substring(16));1==g.onKvmDataAck&&0<g.onKvmDataPending.length&&g.sendKvmData(g.onKvmDataPending.shift())}c=b}}else if(100<g.state&&12<=g.acc.length){b=ReadShort(g.acc,0);var h=ReadShort(g.acc,2),c=ReadShort(g.acc,4),k=ReadShort(g.acc,6),m=c*k,p=ReadInt(g.acc,8);if(17>p){if(1>c||64<c||1>k||64<k)return console.log("Invalid tile size ("+c+","+k+"), disconnecting."),g.Stop();if(g.sparew!=c||g.spareh!=k){g.sparew=g.sparew2=c;g.spareh=g.spareh2=k;if(1==g.rotation||3==g.rotation)g.sparew2=
779
-k,g.spareh2=c;var n=g.sparew2+"x"+g.spareh2;g.spare=g.sparecache[n];if(!g.spare){g.sparecache[n]=g.spare=g.canvas.createImageData(g.sparew2,g.spareh2);for(var q=g.sparew2*g.spareh2<<2,n=3;n<q;n+=4)g.spare.data[n]=255}}}if(4294967073==p){if(g.canvas.canvas.width=g.ScreenWidth=g.rwidth=g.width=c,g.canvas.canvas.height=g.ScreenHeight=g.rheight=g.height=k,g.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(g.width)+ShortToStr(g.height)),c=12,null!=g.onScreenSizeChange)g.onScreenSizeChange(g,g.ScreenWidth,
780
-g.ScreenHeight)}else if(0==p){p=12;c=12+m*g.bpp;if(g.acc.length<c)break;if(2==g.bpp)for(n=0;n<m;n++)l(g.acc.charCodeAt(p++)+(g.acc.charCodeAt(p++)<<8),n);else for(n=0;n<m;n++)e(g.acc.charCodeAt(p++),n);d(g.spare,b,h)}else if(16==p){if(16>g.acc.length)break;n=ReadInt(g.acc,12);if(g.acc.length<16+n)break;p=16;5<n&&0==g.acc.charCodeAt(p)&&ReadShortX(g.acc,p+1)==n-5?a(g.acc,p+5,b,h,c,k,m,n):(p=g.inflate.inflate(g.acc.substring(p,p+n-0)),0<p.length?a(p,0,b,h,c,k,m,p.length):g.Debug("Invalid deflate data"));
781
-c=16+n}else return g.Debug("Unknown Encoding: "+p+", HEX: "+rstr2hex(g.acc)),g.Stop();100==--g.state&&(g.state=4,0==g.frameRateDelay?B():setTimeout(B,g.frameRateDelay))}if(0==c)break;g.acc=g.acc.substring(c)}};g.hold=function(a){if(g.holding!=a)if(g.holding=a,g.canvas.fillStyle="#000000",g.canvas.fillRect(0,0,g.width,g.height),0==g.holding){if(g.canvas.canvas.width!=g.width||g.canvas.canvas.height!=g.height)if(g.canvas.canvas.width=g.width,g.canvas.canvas.height=g.height,null!=g.onScreenSizeChange)g.onScreenSizeChange(g,
778
+h.length)g.onKvmData(h.substring(16));1==g.onKvmDataAck&&0<g.onKvmDataPending.length&&g.sendKvmData(g.onKvmDataPending.shift())}c=b}}else if(100<g.state&&12<=g.acc.length){b=ReadShort(g.acc,0);var h=ReadShort(g.acc,2),c=ReadShort(g.acc,4),k=ReadShort(g.acc,6),m=c*k,n=ReadInt(g.acc,8);if(17>n){if(1>c||64<c||1>k||64<k)return console.log("Invalid tile size ("+c+","+k+"), disconnecting."),g.Stop();if(g.sparew!=c||g.spareh!=k){g.sparew=g.sparew2=c;g.spareh=g.spareh2=k;if(1==g.rotation||3==g.rotation)g.sparew2=
779
+k,g.spareh2=c;var p=g.sparew2+"x"+g.spareh2;g.spare=g.sparecache[p];if(!g.spare){g.sparecache[p]=g.spare=g.canvas.createImageData(g.sparew2,g.spareh2);for(var r=g.sparew2*g.spareh2<<2,p=3;p<r;p+=4)g.spare.data[p]=255}}}if(4294967073==n){if(g.canvas.canvas.width=g.ScreenWidth=g.rwidth=g.width=c,g.canvas.canvas.height=g.ScreenHeight=g.rheight=g.height=k,g.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(g.width)+ShortToStr(g.height)),c=12,null!=g.onScreenSizeChange)g.onScreenSizeChange(g,g.ScreenWidth,
780
+g.ScreenHeight)}else if(0==n){n=12;c=12+m*g.bpp;if(g.acc.length<c)break;if(2==g.bpp)for(p=0;p<m;p++)l(g.acc.charCodeAt(n++)+(g.acc.charCodeAt(n++)<<8),p);else for(p=0;p<m;p++)e(g.acc.charCodeAt(n++),p);d(g.spare,b,h)}else if(16==n){if(16>g.acc.length)break;p=ReadInt(g.acc,12);if(g.acc.length<16+p)break;n=16;5<p&&0==g.acc.charCodeAt(n)&&ReadShortX(g.acc,n+1)==p-5?a(g.acc,n+5,b,h,c,k,m,p):(n=g.inflate.inflate(g.acc.substring(n,n+p-0)),0<n.length?a(n,0,b,h,c,k,m,n.length):g.Debug("Invalid deflate data"));
781
+c=16+p}else return g.Debug("Unknown Encoding: "+n+", HEX: "+rstr2hex(g.acc)),g.Stop();100==--g.state&&(g.state=4,0==g.frameRateDelay?B():setTimeout(B,g.frameRateDelay))}if(0==c)break;g.acc=g.acc.substring(c)}};g.hold=function(a){if(g.holding!=a)if(g.holding=a,g.canvas.fillStyle="#000000",g.canvas.fillRect(0,0,g.width,g.height),0==g.holding){if(g.canvas.canvas.width!=g.width||g.canvas.canvas.height!=g.height)if(g.canvas.canvas.width=g.width,g.canvas.canvas.height=g.height,null!=g.onScreenSizeChange)g.onScreenSizeChange(g,
782
g.ScreenWidth,g.ScreenHeight);g.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(g.width)+ShortToStr(g.height))}else g.UnGrabMouseInput(),g.UnGrabKeyInput()};g.tcanvas=null;g.setRotation=function(a){for(;0>a;)a+=4;a%=4;if(1==g.holding)g.rotation=a;else{if(a==g.rotation)return!0;var b=g.canvas.canvas.width,c=g.canvas.canvas.height;if(1==g.rotation||3==g.rotation)b=g.canvas.canvas.height,c=g.canvas.canvas.width;null==g.tcanvas&&(g.tcanvas=document.createElement("canvas"));var d=g.tcanvas.getContext("2d");
783
d.setTransform(1,0,0,1,0,0);d.canvas.width=b;d.canvas.height=c;d.rotate(-90*g.rotation*Math.PI/180);0==g.rotation&&d.drawImage(g.canvas.canvas,0,0);1==g.rotation&&d.drawImage(g.canvas.canvas,-g.canvas.canvas.width,0);2==g.rotation&&d.drawImage(g.canvas.canvas,-g.canvas.canvas.width,-g.canvas.canvas.height);3==g.rotation&&d.drawImage(g.canvas.canvas,0,-g.canvas.canvas.height);if(0==g.rotation||2==g.rotation)g.canvas.canvas.height=b,g.canvas.canvas.width=c;if(1==g.rotation||3==g.rotation)g.canvas.canvas.height=
784
c,g.canvas.canvas.width=b;g.canvas.setTransform(1,0,0,1,0,0);g.canvas.rotate(90*a*Math.PI/180);g.rotation=a;g.canvas.drawImage(g.tcanvas,v(0,0),h(0,0));g.width=g.canvas.canvas.width;g.height=g.canvas.canvas.height;if(null!=g.onScreenResize)g.onScreenResize(g,g.width,g.height,g.CanvasId);return!0}};g.Start=function(){g.state=0;g.acc="";g.ZRLEfirst=1;g.inflate.inflateReset();g.onKvmDataPending=[];g.onKvmDataAck=-1;g.kvmDataSupported=!1;for(var a in g.sparecache)delete g.sparecache[a]};g.Stop=function(){g.UnGrabMouseInput();
785
-g.UnGrabKeyInput();g.parent&&g.parent.Stop()};g.Send=function(a){g.parent&&g.parent.Send(a)};var J={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,
785
+g.UnGrabKeyInput();g.parent&&g.parent.Stop()};g.Send=function(a){g.parent&&g.parent.Send(a)};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,
786
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};g.sendkey=function(a,b){if("object"==typeof a)for(var c in a)g.sendkey(a[c][0],a[c][1]);else g.Send(String.fromCharCode(4,b,0,0)+IntToStr(a))};g.sendKvmData=
787
function(a){!0!==g.onKvmDataAck?g.onKvmDataPending.push(a):(urlvars&&urlvars.kvmdatatrace&&console.log("KVM-Send("+a.length+"): "+a),a="\x00KvmDataChannel\x00"+a,g.Send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a),g.onKvmDataAck=!1)};g.sendKeepAlive=function(){g.lastKeepAlive<Date.now()-5E3&&(g.lastKeepAlive=Date.now(),g.Send(String.fromCharCode(6,0,0,0)+IntToStr(16)+"\x00KvmDataChannel\x00"))};g.SendCtrlAltDelMsg=function(){g.sendcad()};g.sendcad=function(){g.sendkey(65507,1);g.sendkey(65513,
788
1);g.sendkey(65535,1);g.sendkey(65535,0);g.sendkey(65513,0);g.sendkey(65507,0)};var u=!1,C=!1;g.GrabMouseInput=function(){if(1!=u){var a=g.canvas.canvas;a.onmouseup=g.mouseup;a.onmousedown=g.mousedown;a.onmousemove=g.mousemove;u=!0}};g.UnGrabMouseInput=function(){if(0!=u){var a=g.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;u=!1}};g.GrabKeyInput=function(){1!=C&&(document.onkeyup=g.handleKeyUp,document.onkeydown=g.handleKeyDown,document.onkeypress=g.handleKeys,C=!0)};g.UnGrabKeyInput=
789
function(){0!=C&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,C=!1)};g.handleKeys=function(a){return g.haltEvent(a)};g.handleKeyUp=function(a){return k(0,a)};g.handleKeyDown=function(a){return k(1,a)};g.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};g.mousedown=function(a){g.buttonmask|=1<<a.button;return g.mousemove(a,1)};g.mouseup=function(a){g.buttonmask&=65535-(1<<a.button);return g.mousemove(a,1)};g.mousemove=
790
-function(a,b){if(4>g.state)return!0;var d=g.getPositionOfControl(Q(g.canvasid));g.mx=(a.pageX-d[0])*(g.canvas.canvas.height/Q(g.canvasid).offsetHeight);g.my=(a.pageY-d[1]+(c?c.scrollTop:0))*(g.canvas.canvas.width/Q(g.canvasid).offsetWidth);1!=g.noMouseRotate&&(g.mx2=n(g.mx,g.my),g.my=m(g.mx,g.my),g.mx=g.mx2);1==b?(g.Send(String.fromCharCode(5,g.buttonmask)+ShortToStr(g.mx)+ShortToStr(g.my)),null!=g.mNagleTimer&&(clearTimeout(g.mNagleTimer),g.mNagleTimer=null)):null==g.mNagleTimer&&(g.mNagleTimer=
790
+function(a,b){if(4>g.state)return!0;var d=g.getPositionOfControl(Q(g.canvasid));g.mx=(a.pageX-d[0])*(g.canvas.canvas.height/Q(g.canvasid).offsetHeight);g.my=(a.pageY-d[1]+(c?c.scrollTop:0))*(g.canvas.canvas.width/Q(g.canvasid).offsetWidth);1!=g.noMouseRotate&&(g.mx2=p(g.mx,g.my),g.my=m(g.mx,g.my),g.mx=g.mx2);1==b?(g.Send(String.fromCharCode(5,g.buttonmask)+ShortToStr(g.mx)+ShortToStr(g.my)),null!=g.mNagleTimer&&(clearTimeout(g.mNagleTimer),g.mNagleTimer=null)):null==g.mNagleTimer&&(g.mNagleTimer=
791
setTimeout(function(){g.Send(String.fromCharCode(5,g.buttonmask)+ShortToStr(g.mx)+ShortToStr(g.my));g.mNagleTimer=null},50));return g.haltEvent(a)};g.getPositionOfControl=function(a){var b=Array(2);for(b[0]=b[1]=0;a;)b[0]+=a.offsetLeft,b[1]+=a.offsetTop,a=a.offsetParent;return b};return g},CreateAgentRemoteDesktop=function(b,c){var a={};a.CanvasId=b;"string"===typeof b&&(a.CanvasId=Q(b));a.Canvas=a.CanvasId.getContext("2d");a.scrolldiv=c;a.State=0;a.PendingOperations=[];a.tilesReceived=0;a.TilesDrawn=
792
0;a.KillDraw=0;a.ipad=!1;a.tabletKeyboardVisible=!1;a.LastX=0;a.LastY=0;a.touchenabled=0;a.submenuoffset=0;a.touchtimer=null;a.TouchArray={};a.connectmode=0;a.connectioncount=0;a.rotation=0;a.protocol=2;a.debugmode=0;a.firstUpKeys=[];a.stopInput=!1;a.localKeyMap=!0;a.altPressed=!1;a.ctrlPressed=!1;a.shiftPressed=!1;a.sessionid=0;a.username;a.oldie=!1;a.CompressionLevel=50;a.ScalingLevel=1024;a.FrameRateTimer=50;a.FirstDraw=!1;a.ScreenWidth=960;a.ScreenHeight=700;a.width=960;a.height=960;a.onScreenSizeChange=
793
null;a.onMessage=null;a.onConnectCountChanged=null;a.onDebugMessage=null;a.onTouchEnabledChanged=null;a.onDisplayinfo=null;a.accumulator=null;a.Start=function(){a.State=0;a.accumulator=null};a.Stop=function(){a.setRotation(0);a.UnGrabKeyInput();a.UnGrabMouseInput();a.touchenabled=0;if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId);a.Canvas.clearRect(0,0,a.CanvasId.width,a.CanvasId.height)};a.xxStateChange=function(b){if(a.State!=b)switch(a.State=b,a.CanvasId.style.cursor=
794
-"default",b){case 0:a.Stop()}};a.send=function(b){1<a.debugmode&&console.log("KSend("+b.length+"): "+rstr2hex(b));null!=a.parent&&a.parent.send(b)};a.ProcessPictureMsg=function(b,c,d){var q=new Image;q.xcount=a.tilesReceived++;var n=a.tilesReceived;q.src="data:image/jpeg;base64,"+btoa(b.substring(4,b.length));q.onload=function(){if(null!=a.Canvas&&a.KillDraw<n&&0!=a.State)for(a.PendingOperations.push([n,2,q,c,d]);a.DoPendingOperations(););};q.error=function(){console.log("DecodeTileError")}};a.DoPendingOperations=
794
+"default",b){case 0:a.Stop()}};a.send=function(b){1<a.debugmode&&console.log("KSend("+b.length+"): "+rstr2hex(b));null!=a.parent&&a.parent.send(b)};a.ProcessPictureMsg=function(b,c,d){var r=new Image;r.xcount=a.tilesReceived++;var p=a.tilesReceived;r.src="data:image/jpeg;base64,"+btoa(b.substring(4,b.length));r.onload=function(){if(null!=a.Canvas&&a.KillDraw<p&&0!=a.State)for(a.PendingOperations.push([p,2,r,c,d]);a.DoPendingOperations(););};r.error=function(){console.log("DecodeTileError")}};a.DoPendingOperations=
795
function(){if(0==a.PendingOperations.length)return!1;for(var b=0;b<a.PendingOperations.length;b++){var c=a.PendingOperations[b];if(c[0]==a.TilesDrawn+1)return 1==c[1]?a.ProcessCopyRectMsg(c[2]):2==c[1]&&(a.Canvas.drawImage(c[2],a.rotX(c[3],c[4]),a.rotY(c[3],c[4])),delete c[2]),a.PendingOperations.splice(b,1),delete c,a.TilesDrawn++,a.TilesDrawn==a.tilesReceived&&a.KillDraw<a.TilesDrawn&&(a.KillDraw=a.TilesDrawn=a.tilesReceived=0),!0}a.oldie&&0<a.PendingOperations.length&&a.TilesDrawn++;return!1};
796
-a.ProcessCopyRectMsg=function(b){var c=((b.charCodeAt(0)&255)<<8)+(b.charCodeAt(1)&255),d=((b.charCodeAt(2)&255)<<8)+(b.charCodeAt(3)&255),q=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&255),n=((b.charCodeAt(6)&255)<<8)+(b.charCodeAt(7)&255),m=((b.charCodeAt(8)&255)<<8)+(b.charCodeAt(9)&255);b=((b.charCodeAt(10)&255)<<8)+(b.charCodeAt(11)&255);a.Canvas.drawImage(Canvas.canvas,c,d,m,b,q,n,m,b)};a.SendUnPause=function(){a.send(String.fromCharCode(0,8,0,5,0))};a.SendPause=function(){a.send(String.fromCharCode(0,
797
-8,0,5,1))};a.SendCompressionLevel=function(b,c,d,q){c&&(a.CompressionLevel=c);d&&(a.ScalingLevel=d);q&&(a.FrameRateTimer=q);a.send(String.fromCharCode(0,5,0,10,b,a.CompressionLevel)+a.shortToStr(a.ScalingLevel)+a.shortToStr(a.FrameRateTimer))};a.SendRefresh=function(){a.send(String.fromCharCode(0,6,0,4))};a.ProcessScreenMsg=function(b,c){0<a.debugmode&&console.log("ScreenSize: "+b+" x "+c);a.Canvas.setTransform(1,0,0,1,0,0);a.rotation=0;a.FirstDraw=!0;a.ScreenWidth=a.width=b;a.ScreenHeight=a.height=
796
+a.ProcessCopyRectMsg=function(b){var c=((b.charCodeAt(0)&255)<<8)+(b.charCodeAt(1)&255),d=((b.charCodeAt(2)&255)<<8)+(b.charCodeAt(3)&255),r=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&255),p=((b.charCodeAt(6)&255)<<8)+(b.charCodeAt(7)&255),m=((b.charCodeAt(8)&255)<<8)+(b.charCodeAt(9)&255);b=((b.charCodeAt(10)&255)<<8)+(b.charCodeAt(11)&255);a.Canvas.drawImage(Canvas.canvas,c,d,m,b,r,p,m,b)};a.SendUnPause=function(){a.send(String.fromCharCode(0,8,0,5,0))};a.SendPause=function(){a.send(String.fromCharCode(0,
797
+8,0,5,1))};a.SendCompressionLevel=function(b,c,d,r){c&&(a.CompressionLevel=c);d&&(a.ScalingLevel=d);r&&(a.FrameRateTimer=r);a.send(String.fromCharCode(0,5,0,10,b,a.CompressionLevel)+a.shortToStr(a.ScalingLevel)+a.shortToStr(a.FrameRateTimer))};a.SendRefresh=function(){a.send(String.fromCharCode(0,6,0,4))};a.ProcessScreenMsg=function(b,c){0<a.debugmode&&console.log("ScreenSize: "+b+" x "+c);a.Canvas.setTransform(1,0,0,1,0,0);a.rotation=0;a.FirstDraw=!0;a.ScreenWidth=a.width=b;a.ScreenHeight=a.height=
798
c;for(a.KillDraw=a.tilesReceived;0<a.PendingOperations.length;)a.PendingOperations.shift();a.SendCompressionLevel(1);a.SendUnPause();if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId)};a.ProcessData=function(b){for(var c=0;c<b.length;)c+=a.ProcessDataEx(b.substring(c))};a.ProcessDataEx=function(b){null!=a.accumulator&&(b=a.accumulator+b,a.accumulator=null);1<a.debugmode&&console.log("KRecv("+b.length+"): "+rstr2hex(b.substring(0,Math.min(b.length,40))));
799
-if(!(4>b.length)){var c=null,d=0,q=0,n=ReadShort(b,0),m=ReadShort(b,2),v=0;if(27==n&&8==m){if(12>b.length)return;n=ReadShort(b,8);m=ReadInt(b,4);if(m+8>b.length){a.accumulator=b;return}b=b.substring(8);v=8}m!=b.length&&0<a.debugmode&&console.log(m,b.length,m==b.length);if(18<=n&&65!=n)console.error("Invalid KVM command "+n+" of size "+m),console.log("Invalid KVM data",b.length,rstr2hex(b.substring(0,40))+"...");else if(m>b.length)a.accumulator=b;else{if(3==n||4==n||7==n)c=b.substring(4,m),d=((c.charCodeAt(0)&
800
-255)<<8)+(c.charCodeAt(1)&255),q=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0<a.debugmode&&console.log("CMD"+n+" at X="+d+" Y="+q);switch(n){case 3:if(a.FirstDraw)a.onResize();a.ProcessPictureMsg(c,d,q);break;case 4:if(a.FirstDraw)a.onResize();a.TilesDrawn==a.tilesReceived?a.ProcessCopyRectMsg(c):a.PendingOperations.push([++tilesReceived,1,c]);break;case 7:a.ProcessScreenMsg(d,q);a.SendKeyMsgKC(a.KeyAction.UP,16);a.SendKeyMsgKC(a.KeyAction.UP,17);a.SendKeyMsgKC(a.KeyAction.UP,18);a.SendKeyMsgKC(a.KeyAction.UP,
801
-91);a.SendKeyMsgKC(a.KeyAction.UP,92);a.SendKeyMsgKC(a.KeyAction.UP,16);a.send(String.fromCharCode(0,14,0,4));break;case 11:c=0;d={};q=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&255);if(0<q)for(c=((b.charCodeAt(6+2*q)&255)<<8)+(b.charCodeAt(7+2*q)&255),n=0;n<q;n++){var h=((b.charCodeAt(6+2*n)&255)<<8)+(b.charCodeAt(7+2*n)&255);d[h]=65535==h?"All Displays":"Display "+h}if(null!=a.onDisplayinfo)a.onDisplayinfo(a,d,c);break;case 14:a.touchenabled=1;a.TouchArray={};if(null!=a.onTouchEnabledChanged)a.onTouchEnabledChanged(a.touchenabled);
799
+if(!(4>b.length)){var c=null,d=0,r=0,p=ReadShort(b,0),m=ReadShort(b,2),v=0;if(27==p&&8==m){if(12>b.length)return;p=ReadShort(b,8);m=ReadInt(b,4);if(m+8>b.length){a.accumulator=b;return}b=b.substring(8);v=8}m!=b.length&&0<a.debugmode&&console.log(m,b.length,m==b.length);if(18<=p&&65!=p)console.error("Invalid KVM command "+p+" of size "+m),console.log("Invalid KVM data",b.length,rstr2hex(b.substring(0,40))+"...");else if(m>b.length)a.accumulator=b;else{if(3==p||4==p||7==p)c=b.substring(4,m),d=((c.charCodeAt(0)&
800
+255)<<8)+(c.charCodeAt(1)&255),r=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0<a.debugmode&&console.log("CMD"+p+" at X="+d+" Y="+r);switch(p){case 3:if(a.FirstDraw)a.onResize();a.ProcessPictureMsg(c,d,r);break;case 4:if(a.FirstDraw)a.onResize();a.TilesDrawn==a.tilesReceived?a.ProcessCopyRectMsg(c):a.PendingOperations.push([++tilesReceived,1,c]);break;case 7:a.ProcessScreenMsg(d,r);a.SendKeyMsgKC(a.KeyAction.UP,16);a.SendKeyMsgKC(a.KeyAction.UP,17);a.SendKeyMsgKC(a.KeyAction.UP,18);a.SendKeyMsgKC(a.KeyAction.UP,
801
+91);a.SendKeyMsgKC(a.KeyAction.UP,92);a.SendKeyMsgKC(a.KeyAction.UP,16);a.send(String.fromCharCode(0,14,0,4));break;case 11:c=0;d={};r=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&255);if(0<r)for(c=((b.charCodeAt(6+2*r)&255)<<8)+(b.charCodeAt(7+2*r)&255),p=0;p<r;p++){var h=((b.charCodeAt(6+2*p)&255)<<8)+(b.charCodeAt(7+2*p)&255);d[h]=65535==h?"All Displays":"Display "+h}if(null!=a.onDisplayinfo)a.onDisplayinfo(a,d,c);break;case 14:a.touchenabled=1;a.TouchArray={};if(null!=a.onTouchEnabledChanged)a.onTouchEnabledChanged(a.touchenabled);
802
break;case 15:a.TouchArray={};break;case 16:a.connectioncount=ReadInt(b,4);if(null!=a.onConnectCountChanged)a.onConnectCountChanged(a.connectioncount,a);break;case 17:if(null!=a.onMessage)a.onMessage(b.substring(4,m),a);break;case 65:if(b=b.substring(4),"."!=b[0]){if(console.log(b),null!=a.parent&&(a.parent.consoleMessage=b,a.parent.onConsoleMessageChange))a.parent.onConsoleMessageChange(a.parent,b)}else console.log("KVM: "+b.substring(1))}return m+v}}};a.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};
803
a.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5,DBLCLICK:6};a.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};a.Alternate=0;var d={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,
804
-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};a.SendKeyMsg=function(b,c){if(null!=b)if(c||(c=window.event),c.code&&0==a.localKeyMap){var p;p=c;p=p.code.startsWith("Key")&&4==p.code.length?p.code.charCodeAt(3):p.code.startsWith("Digit")&&
805
-6==p.code.length?p.code.charCodeAt(5):p.code.startsWith("Numpad")&&7==p.code.length?p.code.charCodeAt(6)+48:d[p.code];null!=p&&a.SendKeyMsgKC(b,p)}else p=c.keyCode,59==p?p=186:173==p?p=189:61==p&&(p=187),a.SendKeyMsgKC(b,p)};a.SendMessage=function(b){3==a.State&&a.send(String.fromCharCode(0,17)+a.shortToStr(4+b.length)+b)};a.SendKeyMsgKC=function(b,c){if(3==a.State)if("object"==typeof b)for(var d in b)a.SendKeyMsgKC(b[d][0],b[d][1]);else a.send(String.fromCharCode(0,a.InputType.KEY,0,6,b-1,c))};a.sendcad=
804
+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};a.SendKeyMsg=function(b,c){if(null!=b)if(c||(c=window.event),c.code&&0==a.localKeyMap){var n;n=c;n=n.code.startsWith("Key")&&4==n.code.length?n.code.charCodeAt(3):n.code.startsWith("Digit")&&
805
+6==n.code.length?n.code.charCodeAt(5):n.code.startsWith("Numpad")&&7==n.code.length?n.code.charCodeAt(6)+48:d[n.code];null!=n&&a.SendKeyMsgKC(b,n)}else n=c.keyCode,59==n?n=186:173==n?n=189:61==n&&(n=187),a.SendKeyMsgKC(b,n)};a.SendMessage=function(b){3==a.State&&a.send(String.fromCharCode(0,17)+a.shortToStr(4+b.length)+b)};a.SendKeyMsgKC=function(b,c){if(3==a.State)if("object"==typeof b)for(var d in b)a.SendKeyMsgKC(b[d][0],b[d][1]);else a.send(String.fromCharCode(0,a.InputType.KEY,0,6,b-1,c))};a.sendcad=
806
function(){a.SendCtrlAltDelMsg()};a.SendCtrlAltDelMsg=function(){3==a.State&&a.send(String.fromCharCode(0,a.InputType.CTRLALTDEL,0,4))};a.SendEscKey=function(){3==a.State&&a.send(String.fromCharCode(0,a.InputType.KEY,0,6,0,27,0,a.InputType.KEY,0,6,1,27))};a.SendStartMsg=function(){a.SendKeyMsgKC(a.KeyAction.EXDOWN,91);a.SendKeyMsgKC(a.KeyAction.EXUP,91)};a.SendCharmsMsg=function(){a.SendKeyMsgKC(a.KeyAction.EXDOWN,91);a.SendKeyMsgKC(a.KeyAction.DOWN,67);a.SendKeyMsgKC(a.KeyAction.UP,67);a.SendKeyMsgKC(a.KeyAction.EXUP,
807
-91)};a.SendTouchMsg1=function(b,c,d,q){3==a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(14)+String.fromCharCode(1,b)+a.intToStr(c)+a.shortToStr(d)+a.shortToStr(q))};a.SendTouchMsg2=function(b,c){var d="",q,n;for(n in a.TouchArray)n==b?q=c:1==a.TouchArray[n].f?(q=65542,a.TouchArray[n].f=3):q=2==a.TouchArray[n].f?262144:131078,d+=String.fromCharCode(n)+a.intToStr(q)+a.shortToStr(a.TouchArray[n].x)+a.shortToStr(a.TouchArray[n].y),2==a.TouchArray[n].f&&delete a.TouchArray[n];3==
808
-a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(5+d.length)+String.fromCharCode(2)+d);0==Object.keys(a.TouchArray).length&&null!=a.touchtimer&&(clearInterval(a.touchtimer),a.touchtimer=null)};a.SendMouseMsg=function(b,c){if(3==a.State&&null!=b&&null!=a.Canvas){c||(c=window.event);var d=a.Canvas.canvas.height/a.CanvasId.clientHeight,q=a.Canvas.canvas.width/a.CanvasId.clientWidth,n=a.GetPositionOfControl(a.Canvas.canvas),q=(c.pageX-n[0])*q,d=(c.pageY-n[1])*d;c.addx&&(q+=c.addx);
809
-c.addy&&(d+=c.addy);if(0<=q&&q<=a.Canvas.canvas.width&&0<=d&&d<=a.Canvas.canvas.height){var m=n=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?n=a.MouseButton.LEFT:2==c.which?n=a.MouseButton.MIDDLE:n=a.MouseButton.RIGHT:c.button&&(0==c.button?n=a.MouseButton.LEFT:1==c.button?n=a.MouseButton.MIDDLE:n=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?m=-120*c.detail:c.wheelDelta&&(m=3*c.wheelDelta));var v="",v=b==a.KeyAction.DBLCLICK?String.fromCharCode(0,a.InputType.MOUSE,0,10,0,136,
810
-q/256&255,q&255,d/256&255,d&255):b==a.KeyAction.SCROLL?String.fromCharCode(0,a.InputType.MOUSE,0,12,0,0,q/256&255,q&255,d/256&255,d&255,m/256&255,m&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?n:2*n&255,q/256&255,q&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};a.GetDisplayNumbers=function(){a.send(String.fromCharCode(0,11,0,4))};a.SetDisplay=function(b){console.log("Set display",b);a.send(String.fromCharCode(0,
807
+91)};a.SendTouchMsg1=function(b,c,d,r){3==a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(14)+String.fromCharCode(1,b)+a.intToStr(c)+a.shortToStr(d)+a.shortToStr(r))};a.SendTouchMsg2=function(b,c){var d="",r,p;for(p in a.TouchArray)p==b?r=c:1==a.TouchArray[p].f?(r=65542,a.TouchArray[p].f=3):r=2==a.TouchArray[p].f?262144:131078,d+=String.fromCharCode(p)+a.intToStr(r)+a.shortToStr(a.TouchArray[p].x)+a.shortToStr(a.TouchArray[p].y),2==a.TouchArray[p].f&&delete a.TouchArray[p];3==
808
+a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(5+d.length)+String.fromCharCode(2)+d);0==Object.keys(a.TouchArray).length&&null!=a.touchtimer&&(clearInterval(a.touchtimer),a.touchtimer=null)};a.SendMouseMsg=function(b,c){if(3==a.State&&null!=b&&null!=a.Canvas){c||(c=window.event);var d=a.Canvas.canvas.height/a.CanvasId.clientHeight,r=a.Canvas.canvas.width/a.CanvasId.clientWidth,p=a.GetPositionOfControl(a.Canvas.canvas),r=(c.pageX-p[0])*r,d=(c.pageY-p[1])*d;c.addx&&(r+=c.addx);
809
+c.addy&&(d+=c.addy);if(0<=r&&r<=a.Canvas.canvas.width&&0<=d&&d<=a.Canvas.canvas.height){var m=p=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?p=a.MouseButton.LEFT:2==c.which?p=a.MouseButton.MIDDLE:p=a.MouseButton.RIGHT:c.button&&(0==c.button?p=a.MouseButton.LEFT:1==c.button?p=a.MouseButton.MIDDLE:p=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?m=-120*c.detail:c.wheelDelta&&(m=3*c.wheelDelta));var v="",v=b==a.KeyAction.DBLCLICK?String.fromCharCode(0,a.InputType.MOUSE,0,10,0,136,
810
+r/256&255,r&255,d/256&255,d&255):b==a.KeyAction.SCROLL?String.fromCharCode(0,a.InputType.MOUSE,0,12,0,0,r/256&255,r&255,d/256&255,d&255,m/256&255,m&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?p:2*p&255,r/256&255,r&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(v),a.Alternate=1):a.Alternate=0:a.send(v)}}};a.GetDisplayNumbers=function(){a.send(String.fromCharCode(0,11,0,4))};a.SetDisplay=function(b){console.log("Set display",b);a.send(String.fromCharCode(0,
811
12,0,6,b>>8,b&255))};a.intToStr=function(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)};a.shortToStr=function(a){return String.fromCharCode(a>>8&255,a&255)};a.onResize=function(){if(0!=a.ScreenWidth&&0!=a.ScreenHeight&&(a.Canvas.canvas.width!=a.ScreenWidth||a.Canvas.canvas.height!=a.ScreenHeight)){if(a.FirstDraw&&(a.Canvas.canvas.width=a.ScreenWidth,a.Canvas.canvas.height=a.ScreenHeight,a.Canvas.fillRect(0,0,a.ScreenWidth,a.ScreenHeight),null!=a.onScreenSizeChange))a.onScreenSizeChange(a,
812
a.ScreenWidth,a.ScreenHeight,a.CanvasId);a.FirstDraw=!1}};a.xxMouseInputGrab=!1;a.xxKeyInputGrab=!1;a.xxMouseMove=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.NONE,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxMouseUp=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.UP,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxMouseDown=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.DOWN,b);b.preventDefault&&
813
b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxMouseDblClick=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.DBLCLICK,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxDOMMouseScroll=function(b){return 3==a.State?(a.SendMouseMsg(a.KeyAction.SCROLL,b),!1):!0};a.xxMouseWheel=function(b){return 3==a.State?(a.SendMouseMsg(a.KeyAction.SCROLL,b),!1):!0};a.xxKeyUp=function(b){3==a.State&&a.SendKeyMsg(a.KeyAction.UP,b);b.preventDefault&&
814
b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxKeyDown=function(b){3==a.State&&a.SendKeyMsg(a.KeyAction.DOWN,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxKeyPress=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};a.handleKeys=function(b){return 1==a.stopInput||3!=desktop.State?!1:a.xxKeyPress(b)};a.handleKeyUp=function(b){if(1==a.stopInput||3!=desktop.State)return!1;if(5>a.firstUpKeys.length&&
815
(a.firstUpKeys.push(b.keyCode),5==a.firstUpKeys.length)){var c=a.firstUpKeys.join(",");if("16,17,91,91,16"==c||"16,17,18,91,92"==c)a.stopInput=!0}16==b.keyCode&&(a.shiftPressed=!1);17==b.keyCode&&(a.ctrlPressed=!1);18==b.keyCode&&(a.altPressed=!1);return a.xxKeyUp(b)};a.handleKeyDown=function(b){if(1==a.stopInput||3!=desktop.State)return!1;16==b.keyCode&&(a.shiftPressed=!0);17==b.keyCode&&(a.ctrlPressed=!0);18==b.keyCode&&(a.altPressed=!0);return a.xxKeyDown(b)};a.handleReleaseKeys=function(){a.shiftPressed&&
816
a.SendKeyMsgKC(a.KeyAction.UP,16);a.ctrlPressed&&a.SendKeyMsgKC(a.KeyAction.UP,17);a.altPressed&&a.SendKeyMsgKC(a.KeyAction.UP,18);a.shiftPressed=a.ctrlPressed=a.altPressed=!1};a.mousedblclick=function(b){return 1==a.stopInput?!1:a.xxMouseDblClick(b)};a.mousedown=function(b){return 1==a.stopInput?!1:a.xxMouseDown(b)};a.mouseup=function(b){return 1==a.stopInput?!1:a.xxMouseUp(b)};a.mousemove=function(b){return 1==a.stopInput?!1:a.xxMouseMove(b)};a.mousewheel=function(b){return 1==a.stopInput?!1:a.xxMouseWheel(b)};
817
-a.xxMsTouchEvent=function(b){if(4!=b.originalEvent.pointerType){b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();if("MSPointerDown"==b.type||"MSPointerMove"==b.type||"MSPointerUp"==b.type){var c=0,d=b.originalEvent.pointerId%256,q=Canvas.canvas.width/a.CanvasId.clientWidth*b.offsetX,n=Canvas.canvas.height/a.CanvasId.clientHeight*b.offsetY;"MSPointerDown"==b.type?c=65542:"MSPointerMove"==b.type?c=131078:"MSPointerUp"==b.type&&(c=262144);a.TouchArray[d]||(a.TouchArray[d]=
818
-{x:q,y:n});a.SendTouchMsg2(d,c);"MSPointerUp"==b.type&&delete a.TouchArray[d]}else alert(b.type);return!0}};a.xxTouchStart=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(KeyAction.DOWN,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var q=
819
-b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[q]||(a.TouchArray[q]={x:Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),y:Canvas.canvas.height/a.CanvasId.clientHeight*(b.originalEvent.touches[d].pageY-c[1]),f:1})}0<Object.keys(a.TouchArray).length&&null==touchtimer&&(a.touchtimer=setInterval(function(){a.SendTouchMsg2(256,0)},50))}};a.xxTouchMove=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<
820
-b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(a.KeyAction.NONE,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var q=b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[q]&&(a.TouchArray[q].x=a.Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),a.TouchArray[q].y=a.Canvas.canvas.height/
817
+a.xxMsTouchEvent=function(b){if(4!=b.originalEvent.pointerType){b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();if("MSPointerDown"==b.type||"MSPointerMove"==b.type||"MSPointerUp"==b.type){var c=0,d=b.originalEvent.pointerId%256,r=Canvas.canvas.width/a.CanvasId.clientWidth*b.offsetX,p=Canvas.canvas.height/a.CanvasId.clientHeight*b.offsetY;"MSPointerDown"==b.type?c=65542:"MSPointerMove"==b.type?c=131078:"MSPointerUp"==b.type&&(c=262144);a.TouchArray[d]||(a.TouchArray[d]=
818
+{x:r,y:p});a.SendTouchMsg2(d,c);"MSPointerUp"==b.type&&delete a.TouchArray[d]}else alert(b.type);return!0}};a.xxTouchStart=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(KeyAction.DOWN,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var r=
819
+b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[r]||(a.TouchArray[r]={x:Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),y:Canvas.canvas.height/a.CanvasId.clientHeight*(b.originalEvent.touches[d].pageY-c[1]),f:1})}0<Object.keys(a.TouchArray).length&&null==touchtimer&&(a.touchtimer=setInterval(function(){a.SendTouchMsg2(256,0)},50))}};a.xxTouchMove=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<
820
+b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(a.KeyAction.NONE,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var r=b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[r]&&(a.TouchArray[r].x=a.Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),a.TouchArray[r].y=a.Canvas.canvas.height/
821
a.CanvasId.clientHeight*(b.originalEvent.touches[d].pageY-c[1]))}}};a.xxTouchEnd=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled)1<b.originalEvent.touches.length||(b.which=1,b.pageX=LastX,b.pageY=LastY,a.SendMouseMsg(KeyAction.UP,b));else for(var c in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[c].identifier){var d=b.originalEvent.changedTouches[c].identifier%256;a.TouchArray[d]&&(a.TouchArray[d].f=2)}};a.GrabMouseInput=function(){if(1!=
822
a.xxMouseInputGrab){var b=a.CanvasId;b.onmousemove=a.xxMouseMove;b.onmouseup=a.xxMouseUp;b.onmousedown=a.xxMouseDown;b.touchstart=a.xxTouchStart;b.touchmove=a.xxTouchMove;b.touchend=a.xxTouchEnd;b.MSPointerDown=a.xxMsTouchEvent;b.MSPointerMove=a.xxMsTouchEvent;b.MSPointerUp=a.xxMsTouchEvent;navigator.userAgent.match(/mozilla/i)?b.DOMMouseScroll=a.xxDOMMouseScroll:b.onmousewheel=a.xxMouseWheel;a.xxMouseInputGrab=!0}};a.UnGrabMouseInput=function(){if(0!=a.xxMouseInputGrab){var b=a.CanvasId;b.onmousemove=
823
null;b.onmouseup=null;b.onmousedown=null;b.touchstart=null;b.touchmove=null;b.touchend=null;b.MSPointerDown=null;b.MSPointerMove=null;b.MSPointerUp=null;navigator.userAgent.match(/mozilla/i)?b.DOMMouseScroll=null:b.onmousewheel=null;a.xxMouseInputGrab=!1}};a.GrabKeyInput=function(){1!=a.xxKeyInputGrab&&(document.onkeyup=a.xxKeyUp,document.onkeydown=a.xxKeyDown,document.onkeypress=a.xxKeyPress,a.xxKeyInputGrab=!0)};a.UnGrabKeyInput=function(){0!=a.xxKeyInputGrab&&(document.onkeyup=null,document.onkeydown=
824
null,document.onkeypress=null,a.xxKeyInputGrab=!1)};a.GetPositionOfControl=function(a){var b=Array(2);for(b[0]=b[1]=0;a;)b[0]+=a.offsetLeft,b[1]+=a.offsetTop,a=a.offsetParent;return b};a.crotX=function(b,c){if(0==a.rotation)return b;if(1==a.rotation)return c;if(2==a.rotation)return a.Canvas.canvas.width-b;if(3==a.rotation)return a.Canvas.canvas.height-c};a.crotY=function(b,c){if(0==a.rotation)return c;if(1==a.rotation)return a.Canvas.canvas.width-b;if(2==a.rotation)return a.Canvas.canvas.height-c;
825
if(3==a.rotation)return b};a.rotX=function(b,c){if(0==a.rotation||1==a.rotation)return b;if(2==a.rotation)return b-a.Canvas.canvas.width;if(3==a.rotation)return b-a.Canvas.canvas.height};a.rotY=function(b,c){if(0==a.rotation||3==a.rotation)return c;if(1==a.rotation)return c-a.Canvas.canvas.width;if(2==a.rotation)return c-a.Canvas.canvas.height};a.tcanvas=null;a.setRotation=function(b){for(;0>b;)b+=4;b%=4;if(b==a.rotation)return!0;var c=a.Canvas.canvas.width,d=a.Canvas.canvas.height;if(1==a.rotation||
826
-3==a.rotation)c=a.Canvas.canvas.height,d=a.Canvas.canvas.width;null==a.tcanvas&&(a.tcanvas=document.createElement("canvas"));var q=a.tcanvas.getContext("2d");q.setTransform(1,0,0,1,0,0);q.canvas.width=c;q.canvas.height=d;q.rotate(-90*a.rotation*Math.PI/180);0==a.rotation&&q.drawImage(a.Canvas.canvas,0,0);1==a.rotation&&q.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,0);2==a.rotation&&q.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,-a.Canvas.canvas.height);3==a.rotation&&q.drawImage(a.Canvas.canvas,
826
+3==a.rotation)c=a.Canvas.canvas.height,d=a.Canvas.canvas.width;null==a.tcanvas&&(a.tcanvas=document.createElement("canvas"));var r=a.tcanvas.getContext("2d");r.setTransform(1,0,0,1,0,0);r.canvas.width=c;r.canvas.height=d;r.rotate(-90*a.rotation*Math.PI/180);0==a.rotation&&r.drawImage(a.Canvas.canvas,0,0);1==a.rotation&&r.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,0);2==a.rotation&&r.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,-a.Canvas.canvas.height);3==a.rotation&&r.drawImage(a.Canvas.canvas,
827
0,-a.Canvas.canvas.height);if(0==a.rotation||2==a.rotation)a.Canvas.canvas.height=c,a.Canvas.canvas.width=d;if(1==a.rotation||3==a.rotation)a.Canvas.canvas.height=d,a.Canvas.canvas.width=c;a.Canvas.setTransform(1,0,0,1,0,0);a.Canvas.rotate(90*b*Math.PI/180);a.rotation=b;a.Canvas.drawImage(a.tcanvas,a.rotX(0,0),a.rotY(0,0));a.ScreenWidth=a.Canvas.canvas.width;a.ScreenHeight=a.Canvas.canvas.height;if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId);return!0};
828
a.MuchTheSame=function(a,b){return 4>Math.abs(a-b)};a.Debug=function(a){console.log(a)};a.getIEVersion=function(){var a=-1;"Microsoft Internet Explorer"==navigator.appName&&null!=/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)&&(a=parseFloat(RegExp.$1));return a};a.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};return a},CreateKvmDataChannel=function(b,c,a){var d={};d.m=c;c.parent=d;d.webchannel=b;d.State=0;d.protocol=c.protocol;
829
-d.onStateChanged=null;d.onControlMsg=null;d.debugmode=0;d.keepalive=a;d.rtcKeepAlive=null;d.Start=function(){1==d.debugmode&&console.log("start");d.xxStateChange(3);d.webchannel.onmessage=d.xxOnMessage;d.rtcKeepAlive=setInterval(d.xxSendRtcKeepAlive,3E4)};var e=new FileReader,l=!1,p=[];e.readAsBinaryString?e.onload=function(a){d.xxOnSocketData(a.target.result);0==p.length?l=!1:e.readAsBinaryString(new Blob([p.shift()]))}:e.readAsArrayBuffer&&(e.onloadend=function(a){d.xxOnSocketData(a.target.result);
830
-0==p.length?l=!1:e.readAsArrayBuffer(p.shift())});d.xxOnMessage=function(a){if("string"==typeof a.data){if(null!=d.onControlMsg)d.onControlMsg(a.data)}else if("object"==typeof a.data)if(1==l)p.push(a.data);else if(e.readAsBinaryString)l=!0,e.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)l=!0,e.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,v=0;v<c;v++)b+=String.fromCharCode(a[v]);d.xxOnSocketData(b)}else d.xxOnSocketData(a.data)};d.xxOnSocketData=
829
+d.onStateChanged=null;d.onControlMsg=null;d.debugmode=0;d.keepalive=a;d.rtcKeepAlive=null;d.Start=function(){1==d.debugmode&&console.log("start");d.xxStateChange(3);d.webchannel.onmessage=d.xxOnMessage;d.rtcKeepAlive=setInterval(d.xxSendRtcKeepAlive,3E4)};var e=new FileReader,l=!1,n=[];e.readAsBinaryString?e.onload=function(a){d.xxOnSocketData(a.target.result);0==n.length?l=!1:e.readAsBinaryString(new Blob([n.shift()]))}:e.readAsArrayBuffer&&(e.onloadend=function(a){d.xxOnSocketData(a.target.result);
830
+0==n.length?l=!1:e.readAsArrayBuffer(n.shift())});d.xxOnMessage=function(a){if("string"==typeof a.data){if(null!=d.onControlMsg)d.onControlMsg(a.data)}else if("object"==typeof a.data)if(1==l)n.push(a.data);else if(e.readAsBinaryString)l=!0,e.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)l=!0,e.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,v=0;v<c;v++)b+=String.fromCharCode(a[v]);d.xxOnSocketData(b)}else d.xxOnSocketData(a.data)};d.xxOnSocketData=
831
function(a){if(a){if("object"===typeof a){var b="";a=new Uint8Array(a);for(var c=a.byteLength,e=0;e<c;e++)b+=String.fromCharCode(a[e]);a=b}else if("string"!==typeof a)return;return d.m.ProcessData(a)}};d.sendCtrlMsg=function(a){"string"==typeof a&&(d.webchannel.send(a),urlvars&&urlvars.webrtctrace&&console.log("WebRTC-Send("+d.State+"): ",typeof a,a),null!=d.keepalive&&d.keepalive.sendKeepAlive())};d.send=function(a){if("string"==typeof a){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=
832
a.charCodeAt(c);a=b}urlvars&&urlvars.webrtctrace&&console.log("WebRTC-Send("+d.State+"): ",typeof a,a);d.webchannel.send(a)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(){1==d.debugmode&&console.log("stop");null!=d.rtcKeepAlive&&(clearInterval(d.rtcKeepAlive),d.rtcKeepAlive=null);d.xxStateChange(0)};d.xxSendRtcKeepAlive=function(){urlvars&&urlvars.webrtctrace&&console.log("WebRTC-SendKeepAlive()");
833
-d.sendCtrlMsg(JSON.stringify({action:"ping"}))};return d},CreateAmtRemoteTerminal=function(b,c){function a(b){if("\x00"!=b&&7!=b.charCodeAt()){var c=b.charCodeAt();1==q.terminalEmulation?0!=(c&128)&&(b=String.fromCharCode(U[c&127])):2==q.terminalEmulation&&0!=(c&128)&&(b=String.fromCharCode(r[c&127]));switch(c){case 16:b=" ";break;case 24:b="\u2191";break;case 25:b="\u2193"}B>q.width&&(B=q.width);k>q.height-1&&(k=q.height-1);switch(b){case "\b":0<B&&(B--,D&&d(" "));break;case "\t":b=8-B%8;for(c=0;c<
834
-b;c++)a(" ");break;case "\n":k++;k>y[1]&&(q.recordLineTobackBuffer(0),p(1),k=y[1]);q.lineFeed="\r";B=0;break;case "\r":B=0;break;default:B>=q.width&&(B=0,z&&k++,k>=q.height-1&&(p(1),k=q.height-1)),d(b),B++}}}function d(a){H[k][B]=a;F[k][B]=(v<<6)+(h<<12)+m}function e(){for(var a=(v<<6)+(h<<12)+m,b=B;b<q.width;b++)H[k][b]=" ",F[k][b]=a}function l(a){for(var b=(v<<6)+(h<<12)+m,c=0;c<q.width;c++)H[a][c]=" ",F[a][c]=b}function p(a){var b;for(b=y[0];b<=y[1]-a;b++)H[b]=H[b+a],F[b]=F[b+a];for(b=y[1]-a+1;b<=
835
-y[1];b++)for(H[b]=[],F[b]=[],a=0;a<q.width;a++)H[b][a]=" ",F[b][a]=448}var q={};q.DivId=b;q.DivElement=document.getElementById(b);q.protocol=1;c&&c.protocol&&(q.protocol=c.protocol);q.terminalEmulation=1;q.fxEmulation=0;q.lineFeed="\r\n";q.debugmode=0;q.width=80;q.height=25;q.heightLock=0;var n="000000 BB0000 00BB00 BBBB00 0000BB BB00BB 00BBBB BBBBBB 555555 FF5555 55FF55 FFFF55 5555FF FF55FF 55FFFF FFFFFF".split(" "),m=0,v=7,h=0,z=!0,B=0,k=0,g=0,J=0,u=0,C=[],x=0,w=0,F=[],H=[],D=!1,A=!0,y,E=!1,L=[];
836
-q.title=null;q.onTitleChange=null;q.Start=function(){};q.Init=function(a,b){q.width=a?a:80;q.height=b?b:25;for(var c=0;c<q.height;c++){H[c]=[];F[c]=[];for(var d=0;d<q.width;d++)H[c][d]=" ",F[c][d]=448}q.TermInit();q.TermDraw()};q.xxStateChange=function(a){3==a&&null!=c&&1==c.xterm&&q.TermSendKeys("stty rows "+q.height+" cols "+q.width+"\nclear\n")};q.ProcessData=function(b){2==q.debugmode&&console.log("TRecv("+b.length+"): "+rstr2hex(b));0==q.terminalEmulation&&(b=decode_utf8(b));null!=q.capture&&
837
-(q.capture+=b);for(var c=0;c<b.length;c++){var d=String.fromCharCode(b.charCodeAt(c)),n=b.charCodeAt(c);switch(u){case 0:switch(n){case 27:u=1;C=[];w=x=0;break;default:a(d)}break;case 1:switch(d){case "[":u=2;break;case "(":u=4;break;case ")":u=5;break;case "]":u=6;break;case "=":E=!0;u=0;break;case ">":E=!1;u=0;break;case "7":g=B;J=k;u=0;break;case "8":B=g;k=J;u=0;break;case "M":for(n=y[1];n>=y[0]+1;n--)for(var p=0;p<q.width;p++)H[n][p]=H[n-1][p],F[n][p]=F[n-1][p];for(n=y[0]+1-1;n>y[0]-1;n--)for(p=
838
-0;p<q.width;p++)H[n][p]=" ",F[n][p]=448;u=0;break;default:console.log("unknown terminal short code",d),u=0}break;case 2:if("0"<=d&&"9">=d){C[x]=C[x]?10*C[x]+(d-0):d-0;break}else if(";"==d){x++;break}else if("?"==d){w=1;break}else{C[0]||(C[0]=0);var n=C,p=x+1,r=w;if(1==r)switch(d){case "l":25==n[0]&&(A=!1);break;case "h":25==n[0]&&(A=!0)}else if(0==r){var D=void 0;switch(d){case "c":q.TermResetScreen();break;case "A":1==p&&(0==n[0]?k--:k-=n[0],0>k&&(k=0));break;case "B":1==p&&(0==n[0]?k++:k+=n[0],
839
-k>q.height&&(k=q.height));break;case "C":1==p&&(0==n[0]?B++:B+=n[0],B>q.width&&(B=q.width));break;case "D":1==p&&(0==n[0]?B--:B-=n[0],0>B&&(B=0));break;case "d":1==p&&(k=n[0]-1,k>q.height&&(k=q.height),0>k&&(k=0));break;case "G":1==p&&(B=n[0]-1,0>B&&(B=0),B>q.width-1&&(B=q.width-1));break;case "P":d=1;1==p&&(d=n[0]);for(D=B;D<q.width-d;D++)H[k][D]=H[k][D+d],F[k][D]=F[k][D+d];for(D=q.width-d;D<q.width;D++)H[k][D]=" ",F[k][D]=448;break;case "L":D=1;1==p&&(D=n[0]);0==D&&(D=1);for(n=y[1];n>=k+D;n--)H[n]=
840
-H[n-D],F[n]=F[n-D];for(n=k;n<k+D;n++)for(H[n]=[],F[n]=[],d=0;d<q.width;d++)H[n][d]=" ",F[n][d]=448;break;case "J":if(1==p&&2==n[0])q.TermClear((h<<12)+(v<<6)),k=B=0,L=[];else if(0==p||1==p&&0==n[0])for(e(),D=k+1;D<q.height;D++)l(D);else if(1==p&&1==n[0])for(e(),D=0;D<k-1;D++)l(D);break;case "H":2==p?(1>n[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>q.height&&(n[0]=q.height),n[1]>q.width&&(n[1]=q.width),k=n[0]-1,B=n[1]-1):B=k=0;break;case "m":for(D=0;D<p;D++)n[D]&&0!=n[D]?1==n[D]?8>v&&(v+=8):2==n[D]||22==n[D]?
841
-8<=v&&(v-=8):7==n[D]?m=2:27==n[D]?m=0:30<=n[D]&&37>=n[D]?(d=8<=v,v=n[D]-30,d&&8>=v&&(v+=8)):40<=n[D]&&47>=n[D]?h=n[D]-40:90<=n[D]&&99>=n[D]?v=n[D]-82:100<=n[D]&&109>=n[D]&&(h=n[D]-92):(h=0,v=7,m=0);break;case "K":if(0!=p&&(1!=p||n[0]&&0!=n[0])){if(1==p)if(1==n[0])for(n=(v<<6)+(h<<12)+m,p=0;p<B;p++)H[k][p]=" ",F[k][p]=n;else 2==n[0]&&l(k)}else e();break;case "h":z=!0;break;case "l":z=!1;break;case "r":2==p&&(y=[n[0]-1,n[1]-1]);0>y[0]&&(y[0]=0);y[0]>q.height-1&&(y[0]=q.height-1);0>y[1]&&(y[1]=0);y[1]>
842
-q.height-1&&(y[1]=q.height-1);y[0]>y[1]&&(y[0]=y[1]);break;case "S":d=1;1==p&&(d=n[0]);for(n=y[0];n<=y[1]-d;n++)for(p=0;p<q.width;p++)H[n][p]=H[n+d][p],F[n][p]=F[n+d][p];for(n=y[1]-d+1;n<y[1];n++)for(p=0;p<q.width;p++)H[n][p]=" ",F[n][p]=448;break;case "M":d=1;1==p&&(d=n[0]);for(n=k;n<=y[1]-d;n++)for(p=0;p<q.width;p++)H[n][p]=H[n+d][p],F[n][p]=F[n+d][p];for(n=y[1]-d+1;n<y[1];n++)for(p=0;p<q.width;p++)H[n][p]=" ",F[n][p]=448;break;case "T":d=1;1==p&&(d=n[0]);for(n=y[1];n>y[0]+d;n--)for(p=0;p<q.width;p++)H[n][p]=
843
-H[n-d][p],F[n][p]=F[n-d][p];for(n=y[0]+d;n>y[0];n--)for(p=0;p<q.width;p++)H[n][p]=" ",F[n][p]=448;break;case "X":d=1;for(1==p&&(d=n[0]);0<d&&0<B;)H[k][B]=" ",B--,d--;break;default:console.log("unknown terminal code",d,n,r)}}u=0}break;case 4:u=0;break;case 5:u=0;break;case 6:if(n=d.charCodeAt(0),";"==d)x++;else if(7==n){n=C;if(0!=n.length&&(p=parseInt(n[0]),(0==p||2==p)&&1<n.length&&"?"!=n[1]&&q.onTitleChange))q.onTitleChange(q,q.title=n[1]);u=0}else C[x]=C[x]?C[x]+d:d}}q.TermDraw()};q.ProcessVt100String=
844
-function(b){for(var c=0;c<b.length;c++)a(String.fromCharCode(b.charCodeAt(c)))};var U=[199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402,225,237,243,250,241,209,170,218,191,8976,172,189,188,161,171,187,9619,9618,9617,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9576,9560,9554,9555,9579,9578,9496,9484,9608,
845
-9604,9611,9616,9600,945,223,915,960,931,963,181,964,966,952,8486,948,8734,248,949,8719,8801,177,8805,8806,8992,8993,247,8776,176,8226,183,8730,8319,178,8718,160],r=[199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402,225,237,243,250,241,209,170,218,191,8976,172,189,188,161,174,187,9619,9618,9617,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,
846
-9552,9580,9575,9576,9572,9573,9576,9560,9554,9555,9579,9578,9496,9484,9608,9604,9611,9616,9600,945,223,915,960,931,963,181,964,966,952,8486,948,8734,248,949,8719,8801,177,8805,8806,8992,8993,247,8776,176,8226,183,8730,8319,178,8718,160];q.TermClear=function(a){for(var b=0;b<q.height;b++)for(var c=0;c<q.width;c++)H[b][c]=" ",F[b][c]=a;L=[]};q.TermResetScreen=function(){m=0;v=7;h=0;z=A=!0;B=k=0;D=!1;y=[0,q.height-1];E=!1;q.TermClear(448)};q.TermSendKeys=function(a){2==q.debugmode&&console.log("TSend("+
847
-a.length+"): "+rstr2hex(a),a);q.parent&&q.parent.Send(a)};q.TermSendKey=function(a){2==q.debugmode&&console.log("TSend(1): "+rstr2hex(String.fromCharCode(a)),a);q.parent&&q.parent.Send(String.fromCharCode(a))};q.TermHandleKeys=function(a){if(!a.ctrlKey)return 127==a.which?q.TermSendKey(8):13==a.which?q.TermSendKeys(q.lineFeed):0!=a.which&&q.TermSendKey(a.which),!1;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation()};q.TermHandleKeyUp=function(a){if(8!=a.which&&32!=a.which&&
848
-9!=a.which)return!0;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};q.TermHandleKeyDown=function(a){if(65<=a.which&&90>=a.which&&1==a.ctrlKey)q.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return q.TermSendKeys(String.fromCharCode(27)),!0;if(1==E){if(37==a.which)return q.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return q.TermSendKeys(String.fromCharCode(27,79,65)),!0;
849
-if(39==a.which)return q.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return q.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return q.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return q.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return q.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return q.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return q.TermSendKeys(String.fromCharCode(27,91,53,126)),
850
-!0;if(34==a.which)return q.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return q.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return q.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return q.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return q.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return q.TermSendKeys("\t"),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),!0;var b=[80,
851
-81,119,120,116,117,113,114,112,77],c=[49,50,51,52,53,54,55,56,57,48,33,64],d=[80,81,82,83,84,85,86,87,88,89,90,91];if(111<a.which&124>a.which&&0==a.repeat){if(0==q.fxEmulation&&122>a.which)return q.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==q.fxEmulation)return q.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==q.fxEmulation)return q.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;q.TermSendKey(a.which);
852
-a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};q.recordLineTobackBuffer=function(a){var b;b=q.TermDrawLine("",a,"");a=b[0];b=b[1];L.push(a+b+"<br>")};q.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h<q.width;++h)switch(d=F[b][h],B==h&&k==b&&A&&(d|=2),d!=e&&(a+=c,c="",e=6,g=12,d&2&&(e=12,g=6),a+='<span style="color:#'+n[d>>e&63]+";background-color:#"+n[d>>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c="</span>"+c,e=d),d=H[b][h],d){case "&":a+="&";
853
-break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};q.TermDraw=function(){for(var a="",b="",c=0;c<q.height;++c)a=q.TermDrawLine(b,c,a),b=a[0],a=a[1],c!=q.height-1&&(b+="<br>");800<L.length&&(L=L.slice(L.length-800));c=L.join("");q.DivElement.innerHTML="<font size='4'><b>"+c+b+a+"</b></font>";q.DivElement.scrollTop=q.DivElement.scrollHeight};q.TermInit=function(){q.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?q.Init(c.width,c.height):
854
-q.Init();return q},ZLIB=ZLIB||{};
833
+d.sendCtrlMsg(JSON.stringify({action:"ping"}))};return d},CreateAmtRemoteTerminal=function(b,c){function a(b){if("\x00"!=b&&7!=b.charCodeAt()){var c=b.charCodeAt();1==r.terminalEmulation?0!=(c&128)&&(b=String.fromCharCode(q[c&127])):2==r.terminalEmulation&&0!=(c&128)&&(b=String.fromCharCode(G[c&127]));switch(c){case 16:b=" ";break;case 24:b="\u2191";break;case 25:b="\u2193"}B>r.width&&(B=r.width);k>r.height-1&&(k=r.height-1);switch(b){case "\b":0<B&&(B--,F&&d(" "));break;case "\t":b=8-B%8;for(c=0;c<
834
+b;c++)a(" ");break;case "\n":k++;k>z[1]&&(r.recordLineTobackBuffer(0),n(1),k=z[1]);r.lineFeed="\r";B=0;break;case "\r":B=0;break;default:B>=r.width&&(B=0,x&&k++,k>=r.height-1&&(n(1),k=r.height-1)),d(b),B++}}}function d(a){I[k][B]=a;E[k][B]=(v<<6)+(h<<12)+m}function e(){for(var a=(v<<6)+(h<<12)+m,b=B;b<r.width;b++)I[k][b]=" ",E[k][b]=a}function l(a){for(var b=(v<<6)+(h<<12)+m,c=0;c<r.width;c++)I[a][c]=" ",E[a][c]=b}function n(a){var b;for(b=z[0];b<=z[1]-a;b++)I[b]=I[b+a],E[b]=E[b+a];for(b=z[1]-a+1;b<=
835
+z[1];b++)for(I[b]=[],E[b]=[],a=0;a<r.width;a++)I[b][a]=" ",E[b][a]=448}var r={};r.DivId=b;r.DivElement=document.getElementById(b);r.protocol=1;c&&c.protocol&&(r.protocol=c.protocol);r.terminalEmulation=1;r.fxEmulation=0;r.lineFeed="\r\n";r.debugmode=0;r.width=80;r.height=25;r.heightLock=0;var p="000000 BB0000 00BB00 BBBB00 0000BB BB00BB 00BBBB BBBBBB 555555 FF5555 55FF55 FFFF55 5555FF FF55FF 55FFFF FFFFFF".split(" "),m=0,v=7,h=0,x=!0,B=0,k=0,g=0,K=0,u=0,C=[],w=0,y=0,E=[],I=[],F=!1,A=!0,z,D=!1,M=[],
836
+U="";r.title=null;r.onTitleChange=null;r.Start=function(){};r.Init=function(a,b){r.width=a?a:80;r.height=b?b:25;for(var c=0;c<r.height;c++){I[c]=[];E[c]=[];for(var d=0;d<r.width;d++)I[c][d]=" ",E[c][d]=448}r.TermInit();r.TermDraw()};r.xxStateChange=function(a){3==a&&null!=c&&1==c.xterm&&r.TermSendKeys("stty rows "+r.height+" cols "+r.width+"\nclear\n")};r.ProcessData=function(b){2==r.debugmode&&console.log("TRecv("+b.length+"): "+rstr2hex(b));null!=r.capture&&(r.capture+=b);if(0==r.terminalEmulation)try{b=
837
+decode_utf8(U+b)}catch(c){U+=b;return}U="";for(var d=0;d<b.length;d++){var p=String.fromCharCode(b.charCodeAt(d)),n=b.charCodeAt(d);switch(u){case 0:switch(n){case 27:u=1;C=[];y=w=0;break;default:a(p)}break;case 1:switch(p){case "[":u=2;break;case "(":u=4;break;case ")":u=5;break;case "]":u=6;break;case "=":D=!0;u=0;break;case ">":D=!1;u=0;break;case "7":g=B;K=k;u=0;break;case "8":B=g;k=K;u=0;break;case "M":for(n=z[1];n>=z[0]+1;n--)for(var q=0;q<r.width;q++)I[n][q]=I[n-1][q],E[n][q]=E[n-1][q];for(n=
838
+z[0]+1-1;n>z[0]-1;n--)for(q=0;q<r.width;q++)I[n][q]=" ",E[n][q]=448;u=0;break;default:console.log("unknown terminal short code",p),u=0}break;case 2:if("0"<=p&&"9">=p){C[w]=C[w]?10*C[w]+(p-0):p-0;break}else if(";"==p){w++;break}else if("?"==p){y=1;break}else{C[0]||(C[0]=0);var n=C,q=w+1,F=y;if(1==F)switch(p){case "l":25==n[0]&&(A=!1);break;case "h":25==n[0]&&(A=!0)}else if(0==F){var G=void 0;switch(p){case "c":r.TermResetScreen();break;case "A":1==q&&(0==n[0]?k--:k-=n[0],0>k&&(k=0));break;case "B":1==
839
+q&&(0==n[0]?k++:k+=n[0],k>r.height&&(k=r.height));break;case "C":1==q&&(0==n[0]?B++:B+=n[0],B>r.width&&(B=r.width));break;case "D":1==q&&(0==n[0]?B--:B-=n[0],0>B&&(B=0));break;case "d":1==q&&(k=n[0]-1,k>r.height&&(k=r.height),0>k&&(k=0));break;case "G":1==q&&(B=n[0]-1,0>B&&(B=0),B>r.width-1&&(B=r.width-1));break;case "P":p=1;1==q&&(p=n[0]);for(G=B;G<r.width-p;G++)I[k][G]=I[k][G+p],E[k][G]=E[k][G+p];for(G=r.width-p;G<r.width;G++)I[k][G]=" ",E[k][G]=448;break;case "L":G=1;1==q&&(G=n[0]);0==G&&(G=1);
840
+for(n=z[1];n>=k+G;n--)I[n]=I[n-G],E[n]=E[n-G];for(n=k;n<k+G;n++)for(I[n]=[],E[n]=[],p=0;p<r.width;p++)I[n][p]=" ",E[n][p]=448;break;case "J":if(1==q&&2==n[0])r.TermClear((h<<12)+(v<<6)),k=B=0,M=[];else if(0==q||1==q&&0==n[0])for(e(),G=k+1;G<r.height;G++)l(G);else if(1==q&&1==n[0])for(e(),G=0;G<k-1;G++)l(G);break;case "H":2==q?(1>n[0]&&(n[0]=1),1>n[1]&&(n[1]=1),n[0]>r.height&&(n[0]=r.height),n[1]>r.width&&(n[1]=r.width),k=n[0]-1,B=n[1]-1):B=k=0;break;case "m":for(G=0;G<q;G++)n[G]&&0!=n[G]?1==n[G]?
841
+8>v&&(v+=8):2==n[G]||22==n[G]?8<=v&&(v-=8):7==n[G]?m=2:27==n[G]?m=0:30<=n[G]&&37>=n[G]?(p=8<=v,v=n[G]-30,p&&8>=v&&(v+=8)):40<=n[G]&&47>=n[G]?h=n[G]-40:90<=n[G]&&99>=n[G]?v=n[G]-82:100<=n[G]&&109>=n[G]&&(h=n[G]-92):(h=0,v=7,m=0);break;case "K":if(0!=q&&(1!=q||n[0]&&0!=n[0])){if(1==q)if(1==n[0])for(n=(v<<6)+(h<<12)+m,q=0;q<B;q++)I[k][q]=" ",E[k][q]=n;else 2==n[0]&&l(k)}else e();break;case "h":x=!0;break;case "l":x=!1;break;case "r":2==q&&(z=[n[0]-1,n[1]-1]);0>z[0]&&(z[0]=0);z[0]>r.height-1&&(z[0]=r.height-
842
+1);0>z[1]&&(z[1]=0);z[1]>r.height-1&&(z[1]=r.height-1);z[0]>z[1]&&(z[0]=z[1]);break;case "S":p=1;1==q&&(p=n[0]);for(n=z[0];n<=z[1]-p;n++)for(q=0;q<r.width;q++)I[n][q]=I[n+p][q],E[n][q]=E[n+p][q];for(n=z[1]-p+1;n<z[1];n++)for(q=0;q<r.width;q++)I[n][q]=" ",E[n][q]=448;break;case "M":p=1;1==q&&(p=n[0]);for(n=k;n<=z[1]-p;n++)for(q=0;q<r.width;q++)I[n][q]=I[n+p][q],E[n][q]=E[n+p][q];for(n=z[1]-p+1;n<z[1];n++)for(q=0;q<r.width;q++)I[n][q]=" ",E[n][q]=448;break;case "T":p=1;1==q&&(p=n[0]);for(n=z[1];n>z[0]+
843
+p;n--)for(q=0;q<r.width;q++)I[n][q]=I[n-p][q],E[n][q]=E[n-p][q];for(n=z[0]+p;n>z[0];n--)for(q=0;q<r.width;q++)I[n][q]=" ",E[n][q]=448;break;case "X":p=1;G=B;F=k;for(1==q&&(p=n[0]);0<p&&F<r.height;)I[F][G]=" ",G++,p--,G>=r.width&&(G=0,F++);break;default:console.log("unknown terminal code",p,n,F)}}u=0}break;case 4:u=0;break;case 5:u=0;break;case 6:if(n=p.charCodeAt(0),";"==p)w++;else if(7==n){n=C;if(0!=n.length&&(q=parseInt(n[0]),(0==q||2==q)&&1<n.length&&"?"!=n[1]&&r.onTitleChange))r.onTitleChange(r,
844
+r.title=n[1]);u=0}else C[w]=C[w]?C[w]+p:p}}r.TermDraw()};r.ProcessVt100String=function(b){for(var c=0;c<b.length;c++)a(String.fromCharCode(b.charCodeAt(c)))};var q=[199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402,225,237,243,250,241,209,170,218,191,8976,172,189,188,161,171,187,9619,9618,9617,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,
845
+9552,9580,9575,9576,9572,9573,9576,9560,9554,9555,9579,9578,9496,9484,9608,9604,9611,9616,9600,945,223,915,960,931,963,181,964,966,952,8486,948,8734,248,949,8719,8801,177,8805,8806,8992,8993,247,8776,176,8226,183,8730,8319,178,8718,160],G=[199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402,225,237,243,250,241,209,170,218,191,8976,172,189,188,161,174,187,9619,9618,9617,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,
846
+9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9576,9560,9554,9555,9579,9578,9496,9484,9608,9604,9611,9616,9600,945,223,915,960,931,963,181,964,966,952,8486,948,8734,248,949,8719,8801,177,8805,8806,8992,8993,247,8776,176,8226,183,8730,8319,178,8718,160];r.TermClear=function(a){for(var b=0;b<r.height;b++)for(var c=0;c<r.width;c++)I[b][c]=" ",E[b][c]=a;M=[]};r.TermResetScreen=function(){m=0;v=7;h=0;x=A=!0;B=k=0;F=!1;z=[0,r.height-1];D=!1;r.TermClear(448);
847
+U=""};r.TermSendKeys=function(a){2==r.debugmode&&console.log("TSend("+a.length+"): "+rstr2hex(a),a);r.parent&&r.parent.Send(a)};r.TermSendKey=function(a){2==r.debugmode&&console.log("TSend(1): "+rstr2hex(String.fromCharCode(a)),a);r.parent&&r.parent.Send(String.fromCharCode(a))};r.TermHandleKeys=function(a){if(!a.ctrlKey)return 127==a.which?r.TermSendKey(8):13==a.which?r.TermSendKeys(r.lineFeed):0!=a.which&&r.TermSendKey(a.which),!1;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation()};
848
+r.TermHandleKeyUp=function(a){if(8!=a.which&&32!=a.which&&9!=a.which)return!0;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};r.TermHandleKeyDown=function(a){if(65<=a.which&&90>=a.which&&1==a.ctrlKey)r.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return r.TermSendKeys(String.fromCharCode(27)),!0;if(1==D){if(37==a.which)return r.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return r.TermSendKeys(String.fromCharCode(27,
849
+79,65)),!0;if(39==a.which)return r.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return r.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return r.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return r.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return r.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return r.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return r.TermSendKeys(String.fromCharCode(27,
850
+91,53,126)),!0;if(34==a.which)return r.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return r.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return r.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return r.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return r.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return r.TermSendKeys("\t"),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),!0;
851
+var b=[80,81,119,120,116,117,113,114,112,77],c=[49,50,51,52,53,54,55,56,57,48,33,64],d=[80,81,82,83,84,85,86,87,88,89,90,91];if(111<a.which&124>a.which&&0==a.repeat){if(0==r.fxEmulation&&122>a.which)return r.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==r.fxEmulation)return r.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==r.fxEmulation)return r.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;r.TermSendKey(a.which);
852
+a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};r.recordLineTobackBuffer=function(a){var b;b=r.TermDrawLine("",a,"");a=b[0];b=b[1];M.push(a+b+"<br>")};r.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h<r.width;++h)switch(d=E[b][h],B==h&&k==b&&A&&(d|=2),d!=e&&(a+=c,c="",e=6,g=12,d&2&&(e=12,g=6),a+='<span style="color:#'+p[d>>e&63]+";background-color:#"+p[d>>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c="</span>"+c,e=d),d=I[b][h],d){case "&":a+="&";
853
+break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};r.TermDraw=function(){for(var a="",b="",c=0;c<r.height;++c)a=r.TermDrawLine(b,c,a),b=a[0],a=a[1],c!=r.height-1&&(b+="<br>");800<M.length&&(M=M.slice(M.length-800));c=M.join("");r.DivElement.innerHTML="<font size='4'><b>"+c+b+a+"</b></font>";r.DivElement.scrollTop=r.DivElement.scrollHeight};r.TermInit=function(){r.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?r.Init(c.width,c.height):
854
+r.Init();return r},ZLIB=ZLIB||{};
855
"undefined"===typeof ZLIB.common_initialized&&(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.total_out=this.avail_out=this.next_out=this.total_in=this.avail_in=this.next_in=0;this.state=this.msg=null;
856
this.adler=this.data_type=0;this.output_data=this.input_data="";this.error=0;this.checksum_function=null},ZLIB.gz_header=function(){this.xflags=this.time=this.text=0;this.os=255;this.extra=null;this.extra_max=this.extra_len=0;this.name=null;this.name_max=0;this.comment=null;this.done=this.hcrc=this.comm_max=0},ZLIB.common_initialized=!0);"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js");
857
-(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,h=2==b?a.nlen:0,k=a.codes,l;l=1==b?a.nlen:2==b?a.ndist:19;var m,n,p,q,v,w,z,B,F,H,G,I,X,da,fa,ga,ha,O,K=Array(16);v=Array(16);for(m=0;15>=m;m++)K[m]=0;for(n=0;n<l;n++)K[g[h+n]]++;q=d;for(p=15;1<=p&&0==K[p];p--);q>p&&(q=p);if(0==p)return I={op:64,bits:1,val:0},k[c++]=I,k[c++]=I,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d<p&&0==K[d];d++);q<d&&(q=d);for(m=w=1;15>=m;m++)if(w<<=1,w-=K[m],0>w)return-1;if(0<w&&
858
-(0==b||1!=p))return a.next=c,-1;v[1]=0;for(m=1;15>m;m++)v[m+1]=v[m]+K[m];for(n=0;n<l;n++)0!=g[h+n]&&(e[v[g[h+n]]++]=n);switch(b){case 0:da=ga=e;ha=fa=0;O=19;break;case 1:da=J;fa=-257;ga=u;ha=-257;O=256;break;default:da=C,ga=x,ha=fa=0,O=-1}n=B=0;m=d;X=c;l=q;v=0;H=-1;z=1<<q;G=z-1;if(1==b&&852<=z||2==b&&592<=z)return a.next=c,1;for(;;){I={op:0,bits:m-v,val:0};e[n]<O?I.val=e[n]:e[n]>O?(I.op=ga[ha+e[n]],I.val=da[fa+e[n]]):I.op=96;w=1<<m-v;d=F=1<<l;do F-=w,k[X+(B>>>v)+F]=I;while(0!=F);for(w=1<<m-1;B&w;)w>>>=
859
-1;0!=w?(B&=w-1,B+=w):B=0;n++;if(0==--K[m]){if(m==p)break;m=g[h+e[n]]}if(m>q&&(B&G)!=H){0==v&&(v=q);X+=d;l=m-v;for(w=1<<l;l+v<p;){w-=K[l+v];if(0>=w)break;l++;w<<=1}z+=1<<l;if(1==b&&852<=z||2==b&&592<=z)return a.next=c,1;H=B&G;k[c+H]={op:l,bits:q,val:X-c}}}0!=B&&(k[X+B]={op:64,bits:m-v,val:0});a.next=c+z;2==b?a.distbits=q:a.lenbits=q;return 0}function c(a){var b,c=Array(a);for(b=0;b<a;b++)c[b]=0;return c}function a(a,b,c){return a&&b in a?a[b]:c}function d(){return 0}function e(){var a;this.total=this.check=
860
-this.dmax=this.flags=this.havedict=this.wrap=this.last=this.mode=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.next=this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=this.distcode=this.lencode=this.extra=this.offset=this.length=this.bits=this.hold=0;this.lens=c(320);this.work=c(288);this.codes=Array(1444);var b={op:0,bits:0,val:0};for(a=0;1444>a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function l(a){var b;w||(w=eval("([ {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}])"));
861
-F||(F=eval("([ {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}])"));
862
-a.lencode=0;a.distcode=512;for(b=0;512>b;b++)a.codes[b]=w[b];for(b=0;32>b;b++)a.codes[b+512]=F[b];a.lenbits=9;a.distbits=5}function p(a,b){a.state.check=a.checksum_function(a.state.check,[b&255,b>>>8&255],0,2)}function q(a,b){b.strm=a;b.left=a.avail_out;b.next=a.next_in;b.have=a.avail_in;b.hold=a.state.hold;b.bits=a.state.bits;return b}function n(a){var b=a.strm;b.next_in=a.next;b.avail_out=a.left;b.avail_in=a.have;b.state.hold=a.hold;b.state.bits=a.bits}function m(a){a.hold=0;a.bits=0}function v(a){if(0==
863
-a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<<a.bits;a.bits+=8;return!0}function h(a,b){for(;a.bits<b;)if(!v(a))return!1;return!0}function z(a,b){return a.hold&(1<<b)-1}function B(a,b){a.hold>>>=b;a.bits-=b}function k(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function g(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var J=[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],u=[16,16,16,16,16,16,16,16,17,17,17,17,
864
-18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69],C=[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],x=[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 ";ZLIB.inflateResetKeep=function(a){var b;if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;b=a.state;a.total_in=a.total_out=b.total=0;a.msg=null;b.wrap&&(a.adler=
857
+(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,h=2==b?a.nlen:0,k=a.codes,l;l=1==b?a.nlen:2==b?a.ndist:19;var m,n,p,r,v,x,y,B,E,I,H,J,X,da,fa,ga,ha,R,L=Array(16);v=Array(16);for(m=0;15>=m;m++)L[m]=0;for(n=0;n<l;n++)L[g[h+n]]++;r=d;for(p=15;1<=p&&0==L[p];p--);r>p&&(r=p);if(0==p)return J={op:64,bits:1,val:0},k[c++]=J,k[c++]=J,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d<p&&0==L[d];d++);r<d&&(r=d);for(m=x=1;15>=m;m++)if(x<<=1,x-=L[m],0>x)return-1;if(0<x&&
858
+(0==b||1!=p))return a.next=c,-1;v[1]=0;for(m=1;15>m;m++)v[m+1]=v[m]+L[m];for(n=0;n<l;n++)0!=g[h+n]&&(e[v[g[h+n]]++]=n);switch(b){case 0:da=ga=e;ha=fa=0;R=19;break;case 1:da=K;fa=-257;ga=u;ha=-257;R=256;break;default:da=C,ga=w,ha=fa=0,R=-1}n=B=0;m=d;X=c;l=r;v=0;I=-1;y=1<<r;H=y-1;if(1==b&&852<=y||2==b&&592<=y)return a.next=c,1;for(;;){J={op:0,bits:m-v,val:0};e[n]<R?J.val=e[n]:e[n]>R?(J.op=ga[ha+e[n]],J.val=da[fa+e[n]]):J.op=96;x=1<<m-v;d=E=1<<l;do E-=x,k[X+(B>>>v)+E]=J;while(0!=E);for(x=1<<m-1;B&x;)x>>>=
859
+1;0!=x?(B&=x-1,B+=x):B=0;n++;if(0==--L[m]){if(m==p)break;m=g[h+e[n]]}if(m>r&&(B&H)!=I){0==v&&(v=r);X+=d;l=m-v;for(x=1<<l;l+v<p;){x-=L[l+v];if(0>=x)break;l++;x<<=1}y+=1<<l;if(1==b&&852<=y||2==b&&592<=y)return a.next=c,1;I=B&H;k[c+I]={op:l,bits:r,val:X-c}}}0!=B&&(k[X+B]={op:64,bits:m-v,val:0});a.next=c+y;2==b?a.distbits=r:a.lenbits=r;return 0}function c(a){var b,c=Array(a);for(b=0;b<a;b++)c[b]=0;return c}function a(a,b,c){return a&&b in a?a[b]:c}function d(){return 0}function e(){var a;this.total=this.check=
860
+this.dmax=this.flags=this.havedict=this.wrap=this.last=this.mode=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.next=this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=this.distcode=this.lencode=this.extra=this.offset=this.length=this.bits=this.hold=0;this.lens=c(320);this.work=c(288);this.codes=Array(1444);var b={op:0,bits:0,val:0};for(a=0;1444>a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function l(a){var b;y||(y=eval("([ {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}])"));
861
+E||(E=eval("([ {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}])"));
862
+a.lencode=0;a.distcode=512;for(b=0;512>b;b++)a.codes[b]=y[b];for(b=0;32>b;b++)a.codes[b+512]=E[b];a.lenbits=9;a.distbits=5}function n(a,b){a.state.check=a.checksum_function(a.state.check,[b&255,b>>>8&255],0,2)}function r(a,b){b.strm=a;b.left=a.avail_out;b.next=a.next_in;b.have=a.avail_in;b.hold=a.state.hold;b.bits=a.state.bits;return b}function p(a){var b=a.strm;b.next_in=a.next;b.avail_out=a.left;b.avail_in=a.have;b.state.hold=a.hold;b.state.bits=a.bits}function m(a){a.hold=0;a.bits=0}function v(a){if(0==
863
+a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<<a.bits;a.bits+=8;return!0}function h(a,b){for(;a.bits<b;)if(!v(a))return!1;return!0}function x(a,b){return a.hold&(1<<b)-1}function B(a,b){a.hold>>>=b;a.bits-=b}function k(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function g(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var K=[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],u=[16,16,16,16,16,16,16,16,17,17,17,17,
864
+18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69],C=[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],w=[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 ";ZLIB.inflateResetKeep=function(a){var b;if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;b=a.state;a.total_in=a.total_out=b.total=0;a.msg=null;b.wrap&&(a.adler=
865
b.wrap&1);b.mode=0;b.last=0;b.havedict=0;b.dmax=32768;b.head=null;b.hold=0;b.bits=0;b.lencode=0;b.distcode=0;b.next=0;b.sane=1;b.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(a,b){var c,e;if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;e=a.state;"undefined"===typeof b&&(b=15);0>b?(c=0,b=-b):(c=(b>>>4)+1,48>b&&(b&=15));a.checksum_function=1==c&&"function"===typeof ZLIB.adler32?ZLIB.adler32:2==c&&"function"===typeof ZLIB.crc32?ZLIB.crc32:d;if(b&&(8>b||15<b))return ZLIB.Z_STREAM_ERROR;e.window&&e.wbits!=
866
-b&&(e.window=null);e.wrap=c;e.wbits=b;e.wsize=0;e.whave=0;e.wnext=0;return ZLIB.inflateResetKeep(a)};ZLIB.inflateInit=function(a){var b=new ZLIB.z_stream;b.state=new e;ZLIB.inflateReset(b,a);return b};ZLIB.inflatePrime=function(a,b,c){if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;a=a.state;if(0>b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16<b||32<a.bits+b)return ZLIB.Z_STREAM_ERROR;a.hold+=(c&(1<<b)-1)<<a.bits;a.bits+=b;return ZLIB.Z_OK};var w=null,F=null,H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];
867
-ZLIB.inflate=function(a,c){var d,e,u,w,r,x=-1,C=-1,F;if(!a||!a.state||!a.input_data&&0!=a.avail_in)return ZLIB.Z_STREAM_ERROR;d=a.state;11==d.mode&&(d.mode=12);e={};q(a,e);u=e.have;w=e.left;F=ZLIB.Z_OK;a:for(;;)switch(d.mode){case 0:if(0==d.wrap){d.mode=12;break}if(!h(e,16))break a;if(d.wrap&2&&35615==e.hold){d.check=a.checksum_function(0,null,0,0);p(a,e.hold);m(e);d.mode=1;break}d.flags=0;null!==d.head&&(d.head.done=-1);if(!(d.wrap&1)||((z(e,8)<<8)+(e.hold>>>8))%31){a.msg="incorrect header check";
868
-d.mode=29;break}if(z(e,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}B(e,4);x=z(e,4)+8;if(0==d.wbits)d.wbits=x;else if(x>d.wbits){a.msg="invalid window size";d.mode=29;break}d.dmax=1<<x;a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=e.hold&512?9:11;m(e);break;case 1:if(!h(e,16))break a;d.flags=e.hold;if((d.flags&255)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}if(d.flags&57344){a.msg="unknown header flags set";d.mode=29;break}null!==d.head&&
869
-(d.head.text=e.hold>>>8&1);d.flags&512&&p(a,e.hold);m(e);d.mode=2;case 2:if(!h(e,32))break a;null!==d.head&&(d.head.time=e.hold);d.flags&512&&(r=e.hold,a.state.check=a.checksum_function(a.state.check,[r&255,r>>>8&255,r>>>16&255,r>>>24&255],0,4));m(e);d.mode=3;case 3:if(!h(e,16))break a;null!==d.head&&(d.head.xflags=e.hold&255,d.head.os=e.hold>>>8);d.flags&512&&p(a,e.hold);m(e);d.mode=4;case 4:if(d.flags&1024){if(!h(e,16))break a;d.length=e.hold;null!==d.head&&(d.head.extra_len=e.hold);d.flags&512&&
870
-p(a,e.hold);m(e);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(r=d.length,r>e.have&&(r=e.have),r&&(null!==d.head&&null!==d.head.extra&&(x=d.head.extra_len-d.length,d.head.extra+=a.input_data.substring(e.next,e.next+(x+r>d.head.extra_max?d.head.extra_max-x:r))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,e.next,r)),e.have-=r,e.next+=r,d.length-=r),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==e.have)break a;null!==
871
-d.head&&null===d.head.name&&(d.head.name="");r=0;do{x=a.input_data.charAt(e.next+r);r++;if("\x00"===x)break;null!==d.head&&d.length<d.head.name_max&&(d.head.name+=x,d.length++)}while(r<e.have);d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,e.next,r));e.have-=r;e.next+=r;if("\x00"!==x)break a}else null!==d.head&&(d.head.name=null);d.length=0;d.mode=7;case 7:if(d.flags&4096){if(0==e.have)break a;r=0;null!==d.head&&null===d.head.comment&&(d.head.comment="");do{x=a.input_data.charAt(e.next+
872
-r);r++;if("\x00"===x)break;null!==d.head&&d.length<d.head.comm_max&&(d.head.comment+=x,d.length++)}while(r<e.have);d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,e.next,r));e.have-=r;e.next+=r;if("\x00"!==x)break a}else null!==d.head&&(d.head.comment=null);d.mode=8;case 8:if(d.flags&512){if(!h(e,16))break a;if(e.hold!=(d.check&65535)){a.msg="header crc mismatch";d.mode=29;break}m(e)}null!==d.head&&(d.head.hcrc=d.flags>>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,
873
-0,0);d.mode=11;break;case 9:if(!h(e,32))break a;a.adler=d.check=g(e.hold);m(e);d.mode=10;case 10:if(0==d.havedict)return n(e),ZLIB.Z_NEED_DICT;a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;case 11:if(c==ZLIB.Z_BLOCK||c==ZLIB.Z_TREES)break a;case 12:if(d.last){k(e);d.mode=26;break}if(!h(e,3))break a;d.last=z(e,1);B(e,1);switch(z(e,2)){case 0:d.mode=13;break;case 1:l(d);d.mode=19;if(c==ZLIB.Z_TREES){B(e,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}B(e,
874
-2);break;case 13:k(e);if(!h(e,32))break a;if((e.hold&65535)!=(e.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=e.hold&65535;m(e);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(r=d.length){r>e.have&&(r=e.have);r>e.left&&(r=e.left);if(0==r)break a;a.output_data+=a.input_data.substring(e.next,e.next+r);a.next_out+=r;e.have-=r;e.next+=r;e.left-=r;d.length-=r;break}d.mode=11;break;case 16:if(!h(e,14))break a;d.nlen=z(e,5)+257;B(e,5);d.ndist=z(e,
875
-5)+1;B(e,5);d.ncode=z(e,4)+4;B(e,4);if(286<d.nlen||30<d.ndist){a.msg="too many length or distance symbols";d.mode=29;break}d.have=0;d.mode=17;case 17:for(;d.have<d.ncode;){if(!h(e,3))break a;r=z(e,3);d.lens[H[d.have++]]=r;B(e,3)}for(;19>d.have;)d.lens[H[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(F=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18;case 18:for(;d.have<d.nlen+d.ndist;){for(;;){r=d.codes[d.lencode+z(e,d.lenbits)];if(r.bits<=e.bits)break;if(!v(e))break a}if(16>
876
-r.val)B(e,r.bits),d.lens[d.have++]=r.val;else{if(16==r.val){if(!h(e,r.bits+2))break a;B(e,r.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}x=d.lens[d.have-1];r=3+z(e,2);B(e,2)}else if(17==r.val){if(!h(e,r.bits+3))break a;B(e,r.bits);x=0;r=3+z(e,3);B(e,3)}else{if(!h(e,r.bits+7))break a;B(e,r.bits);x=0;r=11+z(e,7);B(e,7)}if(d.have+r>d.nlen+d.ndist){a.msg="invalid bit length repeat";d.mode=29;break}for(;r--;)d.lens[d.have++]=x}}if(29==d.mode)break;if(0==d.lens[256]){a.msg="invalid code -- missing end-of-block";
877
-d.mode=29;break}d.next=0;d.lencode=d.next;d.lenbits=9;if(F=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(F=b(d,2)){a.msg="invalid distances set";d.mode=29;break}d.mode=19;if(c==ZLIB.Z_TREES)break a;case 19:d.mode=20;case 20:if(6<=e.have&&258<=e.left){n(e);r=a;var J=C=x=void 0,R=void 0,S=void 0,V=void 0,Z=void 0,aa=void 0,ca=void 0,Y=void 0,N=void 0,G=void 0,I=void 0,X=void 0,da=void 0,fa=void 0,ga=void 0,ha=void 0,O=void 0,K=void 0,W=void 0,ia=void 0,
878
-ea=-1,O=-1,x=r.state,C=r.input_data,J=r.next_in,R=J+r.avail_in-5,S=r.next_out,V=S-(w-r.avail_out),Z=S+(r.avail_out-257),aa=x.wsize,ca=x.whave,Y=x.wnext,N=x.window,G=x.hold,I=x.bits,X=x.codes,da=x.lencode,fa=x.distcode,ga=(1<<x.lenbits)-1,ha=(1<<x.distbits)-1;b:do c:for(15>I&&(G+=(C.charCodeAt(J++)&255)<<I,I+=8,G+=(C.charCodeAt(J++)&255)<<I,I+=8),O=X[da+(G&ga)];;){K=O.bits;G>>>=K;I-=K;K=O.op;if(0==K)r.output_data+=String.fromCharCode(O.val),S++;else if(K&16){W=O.val;if(K&=15)I<K&&(G+=(C.charCodeAt(J++)&
879
-255)<<I,I+=8),W+=G&(1<<K)-1,G>>>=K,I-=K;15>I&&(G+=(C.charCodeAt(J++)&255)<<I,I+=8,G+=(C.charCodeAt(J++)&255)<<I,I+=8);O=X[fa+(G&ha)];d:for(;;){K=O.bits;G>>>=K;I-=K;K=O.op;if(K&16){ia=O.val;K&=15;I<K&&(G+=(C.charCodeAt(J++)&255)<<I,I+=8,I<K&&(G+=(C.charCodeAt(J++)&255)<<I,I+=8));ia+=G&(1<<K)-1;G>>>=K;I-=K;K=S-V;if(ia>K){K=ia-K;if(K>ca&&x.sane){r.msg="invalid distance too far back";x.mode=29;break b}ea=0;O=-1;ea=0==Y?ea+(aa-K):ea+(Y-K);K<W&&(W-=K,r.output_data+=N.substring(ea,ea+K),S+=K,ea=-1,O=S-ia)}else ea=
880
--1,O=S-ia;if(0<=ea)r.output_data+=N.substring(ea,ea+W),S+=W;else{K=W;K>S-O&&(K=S-O);r.output_data+=r.output_data.substring(O,O+K);S+=K;W-=K;O+=K;for(S+=W;2<W;)r.output_data+=r.output_data.charAt(O++),r.output_data+=r.output_data.charAt(O++),r.output_data+=r.output_data.charAt(O++),W-=3;W&&(r.output_data+=r.output_data.charAt(O++),1<W&&(r.output_data+=r.output_data.charAt(O++)))}}else if(0==(K&64)){O=X[fa+(O.val+(G&(1<<K)-1))];continue d}else{r.msg="invalid distance code";x.mode=29;break b}break d}}else if(0==
881
-(K&64)){O=X[da+(O.val+(G&(1<<K)-1))];continue c}else{K&32?x.mode=11:(r.msg="invalid literal/length code",x.mode=29);break b}break c}while(J<R&&S<Z);W=I>>>3;J-=W;I-=W<<3;G&=(1<<I)-1;r.next_in=J;r.next_out=S;r.avail_in=J<R?5+(R-J):5-(J-R);r.avail_out=S<Z?257+(Z-S):257-(S-Z);x.hold=G;x.bits=I;q(a,e);11==d.mode&&(d.back=-1);break}for(d.back=0;;){r=d.codes[d.lencode+z(e,d.lenbits)];if(r.bits<=e.bits)break;if(!v(e))break a}if(r.op&&0==(r.op&240)){for(x=r;;){r=d.codes[d.lencode+x.val+(z(e,x.bits+x.op)>>>
882
-x.bits)];if(x.bits+r.bits<=e.bits)break;if(!v(e))break a}B(e,x.bits);d.back+=x.bits}B(e,r.bits);d.back+=r.bits;d.length=r.val;if(0==r.op){d.mode=25;break}if(r.op&32){d.back=-1;d.mode=11;break}if(r.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=r.op&15;d.mode=21;case 21:if(d.extra){if(!h(e,d.extra))break a;d.length+=z(e,d.extra);B(e,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){r=d.codes[d.distcode+z(e,d.distbits)];if(r.bits<=e.bits)break;if(!v(e))break a}if(0==
883
-(r.op&240)){for(x=r;;){r=d.codes[d.distcode+x.val+(z(e,x.bits+x.op)>>>x.bits)];if(x.bits+r.bits<=e.bits)break;if(!v(e))break a}B(e,x.bits);d.back+=x.bits}B(e,r.bits);d.back+=r.bits;if(r.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=r.val;d.extra=r.op&15;d.mode=23;case 23:if(d.extra){if(!h(e,d.extra))break a;d.offset+=z(e,d.extra);B(e,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==e.left)break a;r=w-e.left;if(d.offset>r){r=d.offset-r;if(r>d.whave&&d.sane){a.msg="invalid distance too far back";
884
-d.mode=29;break}r>d.wnext?(r-=d.wnext,x=d.wsize-r):x=d.wnext-r;C=-1;r>d.length&&(r=d.length)}else x=-1,C=a.next_out-d.offset,r=d.length;r>e.left&&(r=e.left);e.left-=r;d.length-=r;if(0<=x)a.output_data+=d.window.substring(x,x+r),a.next_out+=r;else{a.next_out+=r;do a.output_data+=a.output_data.charAt(C++);while(--r)}0==d.length&&(d.mode=20);break;case 25:if(0==e.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;e.left--;d.mode=20;break;case 26:if(d.wrap){if(!h(e,32))break a;w-=
885
-e.left;a.total_out+=w;d.total+=w;w&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-w,w));w=e.left;if((d.flags?e.hold:g(e.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}m(e)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!h(e,32))break a;if(e.hold!=(d.total&4294967295)){a.msg="incorrect length check";d.mode=29;break}m(e)}d.mode=28;case 28:F=ZLIB.Z_STREAM_END;break a;case 29:F=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}n(e);
886
-if(d.wsize||w!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))e=a.state,r=a.output_data.length,null===e.window&&(e.window=""),0==e.wsize&&(e.wsize=1<<e.wbits),e.window=r>=e.wsize?a.output_data.substring(r-e.wsize):e.whave+r<e.wsize?e.window+a.output_data:e.window.substring(e.whave-(e.wsize-r))+a.output_data,e.whave=e.window.length,e.wnext=e.whave<e.wsize?e.whave:0;u-=a.avail_in;w-=a.avail_out;a.total_in+=u;a.total_out+=w;d.total+=w;d.wrap&&w&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,
887
-0,a.output_data.length));a.data_type=d.bits+(d.last?64:0)+(11==d.mode?128:0)+(19==d.mode||14==d.mode?256:0);(0==u&&0==w||c==ZLIB.Z_FINISH)&&F==ZLIB.Z_OK&&(F=ZLIB.Z_BUF_ERROR);return F};ZLIB.inflateEnd=function(a){if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;a.state.window=null;a.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(b,c){var d,e;this.input_data=b;this.next_in=a(c,"next_in",0);this.avail_in=a(c,"avail_in",b.length-this.next_in);d=a(c,"flush",ZLIB.Z_SYNC_FLUSH);e=a(c,"avail_out",
866
+b&&(e.window=null);e.wrap=c;e.wbits=b;e.wsize=0;e.whave=0;e.wnext=0;return ZLIB.inflateResetKeep(a)};ZLIB.inflateInit=function(a){var b=new ZLIB.z_stream;b.state=new e;ZLIB.inflateReset(b,a);return b};ZLIB.inflatePrime=function(a,b,c){if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;a=a.state;if(0>b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16<b||32<a.bits+b)return ZLIB.Z_STREAM_ERROR;a.hold+=(c&(1<<b)-1)<<a.bits;a.bits+=b;return ZLIB.Z_OK};var y=null,E=null,I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];
867
+ZLIB.inflate=function(a,c){var d,e,u,y,q,w=-1,C=-1,E;if(!a||!a.state||!a.input_data&&0!=a.avail_in)return ZLIB.Z_STREAM_ERROR;d=a.state;11==d.mode&&(d.mode=12);e={};r(a,e);u=e.have;y=e.left;E=ZLIB.Z_OK;a:for(;;)switch(d.mode){case 0:if(0==d.wrap){d.mode=12;break}if(!h(e,16))break a;if(d.wrap&2&&35615==e.hold){d.check=a.checksum_function(0,null,0,0);n(a,e.hold);m(e);d.mode=1;break}d.flags=0;null!==d.head&&(d.head.done=-1);if(!(d.wrap&1)||((x(e,8)<<8)+(e.hold>>>8))%31){a.msg="incorrect header check";
868
+d.mode=29;break}if(x(e,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}B(e,4);w=x(e,4)+8;if(0==d.wbits)d.wbits=w;else if(w>d.wbits){a.msg="invalid window size";d.mode=29;break}d.dmax=1<<w;a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=e.hold&512?9:11;m(e);break;case 1:if(!h(e,16))break a;d.flags=e.hold;if((d.flags&255)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}if(d.flags&57344){a.msg="unknown header flags set";d.mode=29;break}null!==d.head&&
869
+(d.head.text=e.hold>>>8&1);d.flags&512&&n(a,e.hold);m(e);d.mode=2;case 2:if(!h(e,32))break a;null!==d.head&&(d.head.time=e.hold);d.flags&512&&(q=e.hold,a.state.check=a.checksum_function(a.state.check,[q&255,q>>>8&255,q>>>16&255,q>>>24&255],0,4));m(e);d.mode=3;case 3:if(!h(e,16))break a;null!==d.head&&(d.head.xflags=e.hold&255,d.head.os=e.hold>>>8);d.flags&512&&n(a,e.hold);m(e);d.mode=4;case 4:if(d.flags&1024){if(!h(e,16))break a;d.length=e.hold;null!==d.head&&(d.head.extra_len=e.hold);d.flags&512&&
870
+n(a,e.hold);m(e);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(q=d.length,q>e.have&&(q=e.have),q&&(null!==d.head&&null!==d.head.extra&&(w=d.head.extra_len-d.length,d.head.extra+=a.input_data.substring(e.next,e.next+(w+q>d.head.extra_max?d.head.extra_max-w:q))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,e.next,q)),e.have-=q,e.next+=q,d.length-=q),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==e.have)break a;null!==
871
+d.head&&null===d.head.name&&(d.head.name="");q=0;do{w=a.input_data.charAt(e.next+q);q++;if("\x00"===w)break;null!==d.head&&d.length<d.head.name_max&&(d.head.name+=w,d.length++)}while(q<e.have);d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,e.next,q));e.have-=q;e.next+=q;if("\x00"!==w)break a}else null!==d.head&&(d.head.name=null);d.length=0;d.mode=7;case 7:if(d.flags&4096){if(0==e.have)break a;q=0;null!==d.head&&null===d.head.comment&&(d.head.comment="");do{w=a.input_data.charAt(e.next+
872
+q);q++;if("\x00"===w)break;null!==d.head&&d.length<d.head.comm_max&&(d.head.comment+=w,d.length++)}while(q<e.have);d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,e.next,q));e.have-=q;e.next+=q;if("\x00"!==w)break a}else null!==d.head&&(d.head.comment=null);d.mode=8;case 8:if(d.flags&512){if(!h(e,16))break a;if(e.hold!=(d.check&65535)){a.msg="header crc mismatch";d.mode=29;break}m(e)}null!==d.head&&(d.head.hcrc=d.flags>>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,
873
+0,0);d.mode=11;break;case 9:if(!h(e,32))break a;a.adler=d.check=g(e.hold);m(e);d.mode=10;case 10:if(0==d.havedict)return p(e),ZLIB.Z_NEED_DICT;a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;case 11:if(c==ZLIB.Z_BLOCK||c==ZLIB.Z_TREES)break a;case 12:if(d.last){k(e);d.mode=26;break}if(!h(e,3))break a;d.last=x(e,1);B(e,1);switch(x(e,2)){case 0:d.mode=13;break;case 1:l(d);d.mode=19;if(c==ZLIB.Z_TREES){B(e,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}B(e,
874
+2);break;case 13:k(e);if(!h(e,32))break a;if((e.hold&65535)!=(e.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=e.hold&65535;m(e);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(q=d.length){q>e.have&&(q=e.have);q>e.left&&(q=e.left);if(0==q)break a;a.output_data+=a.input_data.substring(e.next,e.next+q);a.next_out+=q;e.have-=q;e.next+=q;e.left-=q;d.length-=q;break}d.mode=11;break;case 16:if(!h(e,14))break a;d.nlen=x(e,5)+257;B(e,5);d.ndist=x(e,
875
+5)+1;B(e,5);d.ncode=x(e,4)+4;B(e,4);if(286<d.nlen||30<d.ndist){a.msg="too many length or distance symbols";d.mode=29;break}d.have=0;d.mode=17;case 17:for(;d.have<d.ncode;){if(!h(e,3))break a;q=x(e,3);d.lens[I[d.have++]]=q;B(e,3)}for(;19>d.have;)d.lens[I[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(E=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18;case 18:for(;d.have<d.nlen+d.ndist;){for(;;){q=d.codes[d.lencode+x(e,d.lenbits)];if(q.bits<=e.bits)break;if(!v(e))break a}if(16>
876
+q.val)B(e,q.bits),d.lens[d.have++]=q.val;else{if(16==q.val){if(!h(e,q.bits+2))break a;B(e,q.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}w=d.lens[d.have-1];q=3+x(e,2);B(e,2)}else if(17==q.val){if(!h(e,q.bits+3))break a;B(e,q.bits);w=0;q=3+x(e,3);B(e,3)}else{if(!h(e,q.bits+7))break a;B(e,q.bits);w=0;q=11+x(e,7);B(e,7)}if(d.have+q>d.nlen+d.ndist){a.msg="invalid bit length repeat";d.mode=29;break}for(;q--;)d.lens[d.have++]=w}}if(29==d.mode)break;if(0==d.lens[256]){a.msg="invalid code -- missing end-of-block";
877
+d.mode=29;break}d.next=0;d.lencode=d.next;d.lenbits=9;if(E=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(E=b(d,2)){a.msg="invalid distances set";d.mode=29;break}d.mode=19;if(c==ZLIB.Z_TREES)break a;case 19:d.mode=20;case 20:if(6<=e.have&&258<=e.left){p(e);q=a;var K=C=w=void 0,P=void 0,S=void 0,ca=void 0,Z=void 0,aa=void 0,O=void 0,Y=void 0,N=void 0,H=void 0,J=void 0,X=void 0,da=void 0,fa=void 0,ga=void 0,ha=void 0,R=void 0,L=void 0,W=void 0,ia=void 0,
878
+ea=-1,R=-1,w=q.state,C=q.input_data,K=q.next_in,P=K+q.avail_in-5,S=q.next_out,ca=S-(y-q.avail_out),Z=S+(q.avail_out-257),aa=w.wsize,O=w.whave,Y=w.wnext,N=w.window,H=w.hold,J=w.bits,X=w.codes,da=w.lencode,fa=w.distcode,ga=(1<<w.lenbits)-1,ha=(1<<w.distbits)-1;b:do c:for(15>J&&(H+=(C.charCodeAt(K++)&255)<<J,J+=8,H+=(C.charCodeAt(K++)&255)<<J,J+=8),R=X[da+(H&ga)];;){L=R.bits;H>>>=L;J-=L;L=R.op;if(0==L)q.output_data+=String.fromCharCode(R.val),S++;else if(L&16){W=R.val;if(L&=15)J<L&&(H+=(C.charCodeAt(K++)&
879
+255)<<J,J+=8),W+=H&(1<<L)-1,H>>>=L,J-=L;15>J&&(H+=(C.charCodeAt(K++)&255)<<J,J+=8,H+=(C.charCodeAt(K++)&255)<<J,J+=8);R=X[fa+(H&ha)];d:for(;;){L=R.bits;H>>>=L;J-=L;L=R.op;if(L&16){ia=R.val;L&=15;J<L&&(H+=(C.charCodeAt(K++)&255)<<J,J+=8,J<L&&(H+=(C.charCodeAt(K++)&255)<<J,J+=8));ia+=H&(1<<L)-1;H>>>=L;J-=L;L=S-ca;if(ia>L){L=ia-L;if(L>O&&w.sane){q.msg="invalid distance too far back";w.mode=29;break b}ea=0;R=-1;ea=0==Y?ea+(aa-L):ea+(Y-L);L<W&&(W-=L,q.output_data+=N.substring(ea,ea+L),S+=L,ea=-1,R=S-ia)}else ea=
880
+-1,R=S-ia;if(0<=ea)q.output_data+=N.substring(ea,ea+W),S+=W;else{L=W;L>S-R&&(L=S-R);q.output_data+=q.output_data.substring(R,R+L);S+=L;W-=L;R+=L;for(S+=W;2<W;)q.output_data+=q.output_data.charAt(R++),q.output_data+=q.output_data.charAt(R++),q.output_data+=q.output_data.charAt(R++),W-=3;W&&(q.output_data+=q.output_data.charAt(R++),1<W&&(q.output_data+=q.output_data.charAt(R++)))}}else if(0==(L&64)){R=X[fa+(R.val+(H&(1<<L)-1))];continue d}else{q.msg="invalid distance code";w.mode=29;break b}break d}}else if(0==
881
+(L&64)){R=X[da+(R.val+(H&(1<<L)-1))];continue c}else{L&32?w.mode=11:(q.msg="invalid literal/length code",w.mode=29);break b}break c}while(K<P&&S<Z);W=J>>>3;K-=W;J-=W<<3;H&=(1<<J)-1;q.next_in=K;q.next_out=S;q.avail_in=K<P?5+(P-K):5-(K-P);q.avail_out=S<Z?257+(Z-S):257-(S-Z);w.hold=H;w.bits=J;r(a,e);11==d.mode&&(d.back=-1);break}for(d.back=0;;){q=d.codes[d.lencode+x(e,d.lenbits)];if(q.bits<=e.bits)break;if(!v(e))break a}if(q.op&&0==(q.op&240)){for(w=q;;){q=d.codes[d.lencode+w.val+(x(e,w.bits+w.op)>>>
882
+w.bits)];if(w.bits+q.bits<=e.bits)break;if(!v(e))break a}B(e,w.bits);d.back+=w.bits}B(e,q.bits);d.back+=q.bits;d.length=q.val;if(0==q.op){d.mode=25;break}if(q.op&32){d.back=-1;d.mode=11;break}if(q.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=q.op&15;d.mode=21;case 21:if(d.extra){if(!h(e,d.extra))break a;d.length+=x(e,d.extra);B(e,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){q=d.codes[d.distcode+x(e,d.distbits)];if(q.bits<=e.bits)break;if(!v(e))break a}if(0==
883
+(q.op&240)){for(w=q;;){q=d.codes[d.distcode+w.val+(x(e,w.bits+w.op)>>>w.bits)];if(w.bits+q.bits<=e.bits)break;if(!v(e))break a}B(e,w.bits);d.back+=w.bits}B(e,q.bits);d.back+=q.bits;if(q.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=q.val;d.extra=q.op&15;d.mode=23;case 23:if(d.extra){if(!h(e,d.extra))break a;d.offset+=x(e,d.extra);B(e,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==e.left)break a;q=y-e.left;if(d.offset>q){q=d.offset-q;if(q>d.whave&&d.sane){a.msg="invalid distance too far back";
884
+d.mode=29;break}q>d.wnext?(q-=d.wnext,w=d.wsize-q):w=d.wnext-q;C=-1;q>d.length&&(q=d.length)}else w=-1,C=a.next_out-d.offset,q=d.length;q>e.left&&(q=e.left);e.left-=q;d.length-=q;if(0<=w)a.output_data+=d.window.substring(w,w+q),a.next_out+=q;else{a.next_out+=q;do a.output_data+=a.output_data.charAt(C++);while(--q)}0==d.length&&(d.mode=20);break;case 25:if(0==e.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;e.left--;d.mode=20;break;case 26:if(d.wrap){if(!h(e,32))break a;y-=
885
+e.left;a.total_out+=y;d.total+=y;y&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-y,y));y=e.left;if((d.flags?e.hold:g(e.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}m(e)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!h(e,32))break a;if(e.hold!=(d.total&4294967295)){a.msg="incorrect length check";d.mode=29;break}m(e)}d.mode=28;case 28:E=ZLIB.Z_STREAM_END;break a;case 29:E=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}p(e);
886
+if(d.wsize||y!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))e=a.state,q=a.output_data.length,null===e.window&&(e.window=""),0==e.wsize&&(e.wsize=1<<e.wbits),e.window=q>=e.wsize?a.output_data.substring(q-e.wsize):e.whave+q<e.wsize?e.window+a.output_data:e.window.substring(e.whave-(e.wsize-q))+a.output_data,e.whave=e.window.length,e.wnext=e.whave<e.wsize?e.whave:0;u-=a.avail_in;y-=a.avail_out;a.total_in+=u;a.total_out+=y;d.total+=y;d.wrap&&y&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,
887
+0,a.output_data.length));a.data_type=d.bits+(d.last?64:0)+(11==d.mode?128:0)+(19==d.mode||14==d.mode?256:0);(0==u&&0==y||c==ZLIB.Z_FINISH)&&E==ZLIB.Z_OK&&(E=ZLIB.Z_BUF_ERROR);return E};ZLIB.inflateEnd=function(a){if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;a.state.window=null;a.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=function(b,c){var d,e;this.input_data=b;this.next_in=a(c,"next_in",0);this.avail_in=a(c,"avail_in",b.length-this.next_in);d=a(c,"flush",ZLIB.Z_SYNC_FLUSH);e=a(c,"avail_out",
888
-1);var g="";do{this.avail_out=0<=e?e:16384;this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,d);if(0<=e)return this.output_data;g+=this.output_data;if(0<this.avail_out)break}while(this.error==ZLIB.Z_OK);return g};ZLIB.z_stream.prototype.inflateReset=function(a){return ZLIB.inflateReset(this,a)}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js");
889
-(function(){function b(a,b,c,l){var p,q;p=a>>>16&65535;a&=65535;if(1==l)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),p+=a,65521<=p&&(p-=65521),a|p<<16;if(null===b)return 1;if(16>l){for(;l--;)a+=b.charCodeAt(c++)&255,p+=a;65521<=a&&(a-=65521);return a|p%65521<<16}for(;5552<=l;){l-=5552;q=347;do a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&
890
-255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a;while(--q);a%=65521;p%=65521}if(l){for(;16<=l;)l-=16,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&
891
-255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a;for(;l--;)a+=b.charCodeAt(c++)&255,p+=a;a%=65521;p%=65521}return a|p<<16}function c(a,b,c,l){var p,q;p=a>>>16&65535;a&=65535;if(1==l)return a+=b[c],65521<=a&&(a-=65521),p+=a,65521<=p&&(p-=65521),
892
-a|p<<16;if(null===b)return 1;if(16>l){for(;l--;)a+=b[c++],p+=a;65521<=a&&(a-=65521);return a|p%65521<<16}for(;5552<=l;){l-=5552;q=347;do a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a;while(--q);a%=65521;p%=65521}if(l){for(;16<=l;)l-=16,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=
893
-a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a;for(;l--;)a+=b[c++],p+=a;a%=65521;p%=65521}return a|p<<16}ZLIB.adler32=function(a,d,e,l){return"string"===typeof d?b(a,d,e,l):c(a,d,e,l)};ZLIB.adler32_combine=function(a,b,c){var l,p;if(0>c)return 4294967295;p=c%65521;c=a&65535;l=p*c%65521;c+=(b&65535)+65521-1;l+=(a>>16&65535)+(b>>16&65535)+65521-p;65521<=c&&(c-=65521);65521<=c&&(c-=
889
+(function(){function b(a,b,c,l){var n,r;n=a>>>16&65535;a&=65535;if(1==l)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),a|n<<16;if(null===b)return 1;if(16>l){for(;l--;)a+=b.charCodeAt(c++)&255,n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=l;){l-=5552;r=347;do a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&
890
+255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;while(--r);a%=65521;n%=65521}if(l){for(;16<=l;)l-=16,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&
891
+255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a,a+=b.charCodeAt(c++)&255,n+=a;for(;l--;)a+=b.charCodeAt(c++)&255,n+=a;a%=65521;n%=65521}return a|n<<16}function c(a,b,c,l){var n,r;n=a>>>16&65535;a&=65535;if(1==l)return a+=b[c],65521<=a&&(a-=65521),n+=a,65521<=n&&(n-=65521),
892
+a|n<<16;if(null===b)return 1;if(16>l){for(;l--;)a+=b[c++],n+=a;65521<=a&&(a-=65521);return a|n%65521<<16}for(;5552<=l;){l-=5552;r=347;do a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;while(--r);a%=65521;n%=65521}if(l){for(;16<=l;)l-=16,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=
893
+a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a,a+=b[c++],n+=a;for(;l--;)a+=b[c++],n+=a;a%=65521;n%=65521}return a|n<<16}ZLIB.adler32=function(a,d,e,l){return"string"===typeof d?b(a,d,e,l):c(a,d,e,l)};ZLIB.adler32_combine=function(a,b,c){var l,n;if(0>c)return 4294967295;n=c%65521;c=a&65535;l=n*c%65521;c+=(b&65535)+65521-1;l+=(a>>16&65535)+(b>>16&65535)+65521-n;65521<=c&&(c-=65521);65521<=c&&(c-=
894
65521);131042<=l&&(l-=131042);65521<=l&&(l-=65521);return c|l<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js");
895
-(function(){function b(a,b){var c,p=0;for(c=0;b;)b&1&&(c^=a[p]),b>>=1,p++;return c}function c(a,c){var l;for(l=0;32>l;l++)a[l]=b(c,c[l])}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,
895
+(function(){function b(a,b){var c,n=0;for(c=0;b;)b&1&&(c^=a[n]),b>>=1,n++;return c}function c(a,c){var l;for(l=0;32>l;l++)a[l]=b(c,c[l])}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,
896
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,
897
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,
898
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,
899
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,
900
-1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];ZLIB.crc32=function(b,c,l,p){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=p;)b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=
901
-a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,p-=8;if(p){do b=a[(b^c.charCodeAt(l++))&255]^b>>>8;while(--p)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=p;)b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&
902
-255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,p-=8;if(p){do b=a[(b^c[l++])&255]^b>>>8;while(--p)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,e,l){var p,q,n,m;if(0>=l)return a;n=Array(32);m=Array(32);m[0]=3988292384;for(p=q=1;32>p;p++)m[p]=q,q<<=1;c(n,m);c(m,n);do{c(n,m);l&1&&(a=b(n,a));l>>=1;if(0==l)break;c(m,n);l&1&&(a=b(m,a));l>>=1}while(0!=l);return a^e}})();
903
-var saveAs=saveAs||function(b){if("undefined"===typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var c=b.document.createElementNS("http://www.w3.org/1999/xhtml","a"),a="download"in c,d=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),e=b.webkitRequestFileSystem,l=b.requestFileSystem||e||b.mozRequestFileSystem,p=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},q=0,n=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()};
904
-b.chrome?c():setTimeout(c,500)},m=function(a,b,c){b=[].concat(b);for(var d=b.length;d--;){var e=a["on"+b[d]];if("function"===typeof e)try{e.call(a,c||a)}catch(h){p(h)}}},v=function(a){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\ufeff",a],{type:a.type}):a},h=function(h,k,g){g||(h=v(h));var p=this;g=h.type;var u=!1,z,x,w=function(){m(p,["writestart","progress","write","writeend"])},F=function(){if(x&&d&&"undefined"!==typeof FileReader){var a=
905
-new FileReader;a.onloadend=function(){var b=a.result;x.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));p.readyState=p.DONE;w()};a.readAsDataURL(h);p.readyState=p.INIT}else{if(u||!z)z=(b.URL||b.webkitURL||b).createObjectURL(h);x?x.location.href=z:void 0==b.open(z,"_blank")&&d&&(b.location.href=z);p.readyState=p.DONE;w();n(z)}},H=function(a){return function(){if(p.readyState!==p.DONE)return a.apply(this,arguments)}},D={create:!0,exclusive:!1},A;p.readyState=p.INIT;k||(k="download");if(a)z=
906
-(b.URL||b.webkitURL||b).createObjectURL(h),c.href=z,c.download=k,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);w();n(z);p.readyState=p.DONE});else{b.chrome&&g&&"application/octet-stream"!==g&&(A=h.slice||h.webkitSlice,h=A.call(h,0,h.size,"application/octet-stream"),u=!0);e&&"download"!==k&&(k+=".download");if("application/octet-stream"===g||e)x=b;l?(q+=h.size,l(b.TEMPORARY,q,H(function(a){a.root.getDirectory("saved",D,H(function(a){var b=function(){a.getFile(k,D,H(function(a){a.createWriter(H(function(b){b.onwriteend=
907
-function(b){x.location.href=a.toURL();p.readyState=p.DONE;m(p,"writeend",b);n(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&F()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=p["on"+a]});b.write(h);p.abort=function(){b.abort();p.readyState=p.DONE};p.readyState=p.WRITING}),F)}),F)};a.getFile(k,{create:!1},H(function(a){a.remove();b()}),H(function(a){a.code===a.NOT_FOUND_ERR?b():F()}))}),F)}),F)):F()}},z=h.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a,
908
-b,c){c||(a=v(a));return navigator.msSaveOrOpenBlob(a,b||"download")};z.abort=function(){this.readyState=this.DONE;m(this,"abort")};z.readyState=z.INIT=0;z.WRITING=1;z.DONE=2;z.error=z.onwritestart=z.onprogress=z.onwrite=z.onabort=z.onerror=z.onwriteend=null;return function(a,b,c){return new h(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content);
900
+1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];ZLIB.crc32=function(b,c,l,n){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=
901
+a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,b=a[(b^c.charCodeAt(l++))&255]^b>>>8,n-=8;if(n){do b=a[(b^c.charCodeAt(l++))&255]^b>>>8;while(--n)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=n;)b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&
902
+255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,b=a[(b^c[l++])&255]^b>>>8,n-=8;if(n){do b=a[(b^c[l++])&255]^b>>>8;while(--n)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,e,l){var n,r,p,m;if(0>=l)return a;p=Array(32);m=Array(32);m[0]=3988292384;for(n=r=1;32>n;n++)m[n]=r,r<<=1;c(p,m);c(m,p);do{c(p,m);l&1&&(a=b(p,a));l>>=1;if(0==l)break;c(m,p);l&1&&(a=b(m,a));l>>=1}while(0!=l);return a^e}})();
903
+var saveAs=saveAs||function(b){if("undefined"===typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var c=b.document.createElementNS("http://www.w3.org/1999/xhtml","a"),a="download"in c,d=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),e=b.webkitRequestFileSystem,l=b.requestFileSystem||e||b.mozRequestFileSystem,n=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},r=0,p=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()};
904
+b.chrome?c():setTimeout(c,500)},m=function(a,b,c){b=[].concat(b);for(var d=b.length;d--;){var e=a["on"+b[d]];if("function"===typeof e)try{e.call(a,c||a)}catch(h){n(h)}}},v=function(a){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\ufeff",a],{type:a.type}):a},h=function(h,k,g){g||(h=v(h));var n=this;g=h.type;var u=!1,x,w,y=function(){m(n,["writestart","progress","write","writeend"])},E=function(){if(w&&d&&"undefined"!==typeof FileReader){var a=
905
+new FileReader;a.onloadend=function(){var b=a.result;w.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));n.readyState=n.DONE;y()};a.readAsDataURL(h);n.readyState=n.INIT}else{if(u||!x)x=(b.URL||b.webkitURL||b).createObjectURL(h);w?w.location.href=x:void 0==b.open(x,"_blank")&&d&&(b.location.href=x);n.readyState=n.DONE;y();p(x)}},I=function(a){return function(){if(n.readyState!==n.DONE)return a.apply(this,arguments)}},F={create:!0,exclusive:!1},A;n.readyState=n.INIT;k||(k="download");if(a)x=
906
+(b.URL||b.webkitURL||b).createObjectURL(h),c.href=x,c.download=k,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);y();p(x);n.readyState=n.DONE});else{b.chrome&&g&&"application/octet-stream"!==g&&(A=h.slice||h.webkitSlice,h=A.call(h,0,h.size,"application/octet-stream"),u=!0);e&&"download"!==k&&(k+=".download");if("application/octet-stream"===g||e)w=b;l?(r+=h.size,l(b.TEMPORARY,r,I(function(a){a.root.getDirectory("saved",F,I(function(a){var b=function(){a.getFile(k,F,I(function(a){a.createWriter(I(function(b){b.onwriteend=
907
+function(b){w.location.href=a.toURL();n.readyState=n.DONE;m(n,"writeend",b);p(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&E()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=n["on"+a]});b.write(h);n.abort=function(){b.abort();n.readyState=n.DONE};n.readyState=n.WRITING}),E)}),E)};a.getFile(k,{create:!1},I(function(a){a.remove();b()}),I(function(a){a.code===a.NOT_FOUND_ERR?b():E()}))}),E)}),E)):E()}},x=h.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a,
908
+b,c){c||(a=v(a));return navigator.msSaveOrOpenBlob(a,b||"download")};x.abort=function(){this.readyState=this.DONE;m(this,"abort")};x.readyState=x.INIT=0;x.WRITING=1;x.DONE=2;x.error=x.onwritestart=x.onprogress=x.onwrite=x.onabort=x.onerror=x.onwriteend=null;return function(a,b,c){return new h(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content);
909
"undefined"!==typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!==typeof define&&null!==define&&null!=define.amd&&define([],function(){return saveAs});
910
var version="0.8.0",urlvars={},amtstack,wsstack=null,AllWsman="AMT_8021xCredentialContext AMT_8021XProfile AMT_ActiveFilterStatistics AMT_AgentPresenceCapabilities AMT_AgentPresenceInterfacePolicy AMT_AgentPresenceService AMT_AgentPresenceWatchdog AMT_AgentPresenceWatchdogAction AMT_AlarmClockService IPS_AlarmClockOccurrence AMT_AssetTable AMT_AssetTableService AMT_AuditLog AMT_AuditPolicyRule AMT_AuthorizationService AMT_BootCapabilities AMT_BootSettingData AMT_ComplexFilterEntryBase AMT_CRL AMT_CryptographicCapabilities AMT_EACCredentialContext AMT_EndpointAccessControlService AMT_EnvironmentDetectionInterfacePolicy AMT_EnvironmentDetectionSettingData AMT_EthernetPortSettings AMT_EventLogEntry AMT_EventManagerService AMT_EventSubscriber AMT_FilterEntryBase AMT_FilterInSystemDefensePolicy AMT_GeneralSettings AMT_GeneralSystemDefenseCapabilities AMT_Hdr8021Filter AMT_HeuristicPacketFilterInterfacePolicy AMT_HeuristicPacketFilterSettings AMT_HeuristicPacketFilterStatistics AMT_InterfacePolicy AMT_IPHeadersFilter AMT_KerberosSettingData AMT_ManagementPresenceRemoteSAP AMT_MessageLog AMT_MPSUsernamePassword AMT_NetworkFilter AMT_NetworkPortDefaultSystemDefensePolicy AMT_NetworkPortSystemDefenseCapabilities AMT_NetworkPortSystemDefensePolicy AMT_PCIDevice AMT_PETCapabilities AMT_PETFilterForTarget AMT_PETFilterSetting AMT_ProvisioningCertificateHash AMT_PublicKeyCertificate AMT_PublicKeyManagementCapabilities AMT_PublicKeyManagementService AMT_PublicPrivateKeyPair AMT_RedirectionService AMT_RemoteAccessCapabilities AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule AMT_RemoteAccessService AMT_SetupAndConfigurationService AMT_SNMPEventSubscriber AMT_StateTransitionCondition AMT_SystemDefensePolicy AMT_SystemDefensePolicyInService AMT_SystemDefenseService AMT_SystemPowerScheme AMT_ThirdPartyDataStorageAdministrationService AMT_ThirdPartyDataStorageService AMT_TimeSynchronizationService AMT_TLSCredentialContext AMT_TLSProtocolEndpoint AMT_TLSProtocolEndpointCollection AMT_TLSSettingData AMT_TrapTargetForService AMT_UserInitiatedConnectionService AMT_WebUIService AMT_WiFiPortConfigurationService CIM_AbstractIndicationSubscription CIM_Account CIM_AccountManagementCapabilities CIM_AccountManagementService CIM_AccountOnSystem CIM_AdminDomain CIM_AlertIndication CIM_AssignedIdentity CIM_AssociatedPowerManagementService CIM_AuthenticationService CIM_AuthorizationService CIM_BIOSElement CIM_BIOSFeature CIM_BIOSFeatureBIOSElements CIM_BootConfigSetting CIM_BootService CIM_BootSettingData CIM_BootSourceSetting CIM_Capabilities CIM_Card CIM_Chassis CIM_Chip CIM_Collection CIM_Component CIM_ComputerSystem CIM_ComputerSystemPackage CIM_ConcreteComponent CIM_ConcreteDependency CIM_Controller CIM_CoolingDevice CIM_Credential CIM_CredentialContext CIM_CredentialManagementService CIM_Dependency CIM_DeviceSAPImplementation CIM_ElementCapabilities CIM_ElementConformsToProfile CIM_ElementLocation CIM_ElementSettingData CIM_ElementSoftwareIdentity CIM_ElementStatisticalData CIM_EnabledLogicalElement CIM_EnabledLogicalElementCapabilities CIM_EthernetPort CIM_Fan CIM_FilterCollection CIM_FilterCollectionSubscription CIM_HostedAccessPoint CIM_HostedDependency CIM_HostedService CIM_Identity CIM_IEEE8021xCapabilities CIM_IEEE8021xSettings CIM_Indication CIM_IndicationService CIM_InstalledSoftwareIdentity CIM_KVMRedirectionSAP CIM_LANEndpoint CIM_ListenerDestination CIM_ListenerDestinationWSManagement CIM_Location CIM_Log CIM_LogEntry CIM_LogicalDevice CIM_LogicalElement CIM_LogicalPort CIM_LogicalPortCapabilities CIM_LogManagesRecord CIM_ManagedCredential CIM_ManagedElement CIM_ManagedSystemElement CIM_MediaAccessDevice CIM_MemberOfCollection CIM_Memory CIM_MessageLog CIM_NetworkPort CIM_NetworkPortCapabilities CIM_NetworkPortConfigurationService CIM_OrderedComponent CIM_OwningCollectionElement CIM_OwningJobElement CIM_PCIController CIM_PhysicalComponent CIM_PhysicalElement CIM_PhysicalElementLocation CIM_PhysicalFrame CIM_PhysicalMemory CIM_PhysicalPackage CIM_Policy CIM_PolicyAction CIM_PolicyCondition CIM_PolicyInSystem CIM_PolicyRule CIM_PolicyRuleInSystem CIM_PolicySet CIM_PolicySetAppliesToElement CIM_PolicySetInSystem CIM_PowerManagementCapabilities CIM_PowerManagementService CIM_PowerSupply CIM_Privilege CIM_PrivilegeManagementCapabilities CIM_PrivilegeManagementService CIM_ProcessIndication CIM_Processor CIM_ProtocolEndpoint CIM_ProvidesServiceToElement CIM_Realizes CIM_RecordForLog CIM_RecordLog CIM_RedirectionService CIM_ReferencedProfile CIM_RegisteredProfile CIM_RemoteAccessAvailableToElement CIM_RemoteIdentity CIM_RemotePort CIM_RemoteServiceAccessPoint CIM_Role CIM_RoleBasedAuthorizationService CIM_RoleBasedManagementCapabilities CIM_RoleLimitedToTarget CIM_SAPAvailableForElement CIM_SecurityService CIM_Sensor CIM_Service CIM_ServiceAccessBySAP CIM_ServiceAccessPoint CIM_ServiceAffectsElement CIM_ServiceAvailableToElement CIM_ServiceSAPDependency CIM_ServiceServiceDependency CIM_SettingData CIM_SharedCredential CIM_SoftwareElement CIM_SoftwareFeature CIM_SoftwareFeatureSoftwareElements CIM_SoftwareIdentity CIM_StatisticalData CIM_StorageExtent CIM_System CIM_SystemBIOS CIM_SystemComponent CIM_SystemDevice CIM_SystemPackaging CIM_UseOfLog CIM_Watchdog CIM_WiFiEndpoint CIM_WiFiEndpointCapabilities CIM_WiFiEndpointSettings CIM_WiFiPort CIM_WiFiPortCapabilities IPS_AdminProvisioningRecord IPS_ClientProvisioningRecord IPS_HostBasedSetupService IPS_HostIPSettings IPS_HTTPProxyService IPS_HTTPProxyAccessPoint IPS_IderSessionUsingPort IPS_IPv6PortSettings IPS_KVMRedirectionSettingData IPS_KvmSessionUsingPort IPS_ManualProvisioningRecord IPS_OptInService IPS_ProvisioningAuditRecord IPS_ProvisioningRecordLog IPS_RasSessionUsingPort IPS_ScreenConfigurationService IPS_ScreenSettingData IPS_SecIOService IPS_SessionUsingPort IPS_SolSessionUsingPort IPS_TLSProvisioningRecord IPS_WatchDogAction".split(" "),disconnecturl=
911
null,terminal,currentView=0,LoadingHtml="<div style=text-align:center;padding-top:20px>Loading...<div>",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encoding:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1},currentMeshNode=null,webcompilerfeatures="AgentPresence Alarms AuditLog Certificates ComputerSelectorToolbar Desktop DesktopInband DesktopInbandFiles Desktop-Multi DesktopRotation Desktop-Settings DesktopType EventLog EventSubscriptions FileSaver HardwareInfo IDER IDERDebug IDERStats Inflate Look-MeshCentral Mode-MeshCentral2 NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Scripting Scripting-Editor Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "),
@@ -921,7 +921,7 @@ function getCurrentMeshNode(){return currentMeshNode}function setConnectionState
921
function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(50).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeyUp(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeyUp(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeyUp(b)}}
922
function handleKeyDown(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(50).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeyDown(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeyDown(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeyDown(b)}}
923
function handleKeyPress(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(50).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeys(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeys(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeys(b)}}var connectFunc=null,connectFuncTag=null;
924
-function connect(b,c,a,d,e,l,p){go(0);fullscreenonly=!1;connectFunc=l;connectFuncTag=p;1==urlvars.kvm&&go(14);if(1==urlvars.kvmfull||1==urlvars.kvmonly)go(14),deskToggleFull(1==urlvars.kvmonly);1==urlvars.sol&&go(13);wsstack=WsmanStackCreateService(b,c,a,d,e);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QV("go12",!0);QV("go20",!0);QH(30,"");QH(41,"");amtversion=amtversionmin=amtFirstPull=
924
+function connect(b,c,a,d,e,l,n){go(0);fullscreenonly=!1;connectFunc=l;connectFuncTag=n;1==urlvars.kvm&&go(14);if(1==urlvars.kvmfull||1==urlvars.kvmonly)go(14),deskToggleFull(1==urlvars.kvmonly);1==urlvars.sol&&go(13);wsstack=WsmanStackCreateService(b,c,a,d,e);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QV("go12",!0);QV("go20",!0);QH(30,"");QH(41,"");amtversion=amtversionmin=amtFirstPull=
925
0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(17,LoadingHtml);QH(21,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(22,"");QH(18,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(23,LoadingHtml);eventmessages=null;QH(19,"");QH(20,LoadingHtml);auditLog=null;QH(51,"");
926
QH(52,LoadingHtml);xxCertificates=null;QH(53,LoadingHtml);QH(26,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(54,LoadingHtml);QH(56,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive=
927
!1;QH(55,LoadingHtml);QE(45,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(50,!1),Q(50).checked=!0);QE(46,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(13,!1);fupdatescript()}
@@ -940,23 +940,23 @@ function processSystemStatus(b,c,a,d){if(void 0==a.IPS_ScreenConfigurationServic
940
function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","Failed to set time, status = "+d):0!=a.Body.ReturnValue?messagebox("","Failed to set time, error: "+a.Body.ReturnValueStr):(b=new Date,b=Math.round((b.getTime()-6E4*b.getTimezoneOffset())/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})}
941
var DMTFPowerStates=";;Power on;Light sleep;Deep sleep;Power cycle (Soft off);Off - Hard;Hibernate (Off soft);Soft off;Power cycle (Off-hard);Master bus reset;Diagnostic interrupt (NMI);Not applicable;Off - Soft graceful;Off - Hard graceful;Master bus reset graceful;Power cycle (Off - Soft graceful);Power cycle (Off - Hard graceful);Diagnostic interrupt (INIT)".split(";");
942
function updateSystemStatus(){if(amtsysstate&&!(99<currentView)){var b=0,c,a,d=TableStart(),e="",l=amtsysstate.AMT_GeneralSettings.response;a="<i>Unknown</i>";if(null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length){a=DMTFPowerStates[amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState];if(9<amtversion&&"Power on"==a&&amtsysstate.CIM_EnabledLogicalElement&&amtsysstate.CIM_EnabledLogicalElement.responses&&
943
-0<amtsysstate.CIM_EnabledLogicalElement.responses.length)for(var p in amtsysstate.CIM_EnabledLogicalElement.responses){var q=amtsysstate.CIM_EnabledLogicalElement.responses[p];"IPS_PowerManagementService"==q.CreationClassName&&3==q.OSPowerSavingState&&(a="Standby (Connected)")}QH(30,a);QH(41,a)}l.PowerSource&&(a+=[", Plugged-in",", On Battery"][l.PowerSource]);d+=TableEntry("Power",addLink(a,"showPowerActionDlg()"));c=l.HostName;a=l.DomainName;null!=a&&0<a.length&&(c+="."+a);
944
-c=0==c.length?"<i>None</i>":EscapeHtml(c);d+=TableEntry("Name & Domain",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));HardwareInventory&&(d+=TableEntry("System ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var q="",n=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==n.ProvisioningState&&5<amtversion&&(q=" activated in Admin Control Mode (ACM)",4==n.ProvisioningMode&&(q=" activated in Client Control Mode (CCM)",
945
-b=9));d+=TableEntry("Intel® ME","v"+getItem(amtlogicalelements,"InstanceID","AMT").VersionString+q)}null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length&&(QV(29,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState),QV(40,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState));if(200==amtsysstate.AMT_RedirectionService.status){var m=
946
-amtfeatures[0]=1==amtsysstate.AMT_RedirectionService.response.ListenerEnabled,v=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),q=amtfeatures[2]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),h=amtfeatures[3]=void 0;5<amtversion&&null!=amtsysstate.CIM_KVMRedirectionSAP&&(QV("go14",!0),h=amtfeatures[3]=6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState&&2==amtsysstate.CIM_KVMRedirectionSAP.response.RequestedState||2==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState||
947
-6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState);m&&(e+=", Redirection Port");v&&(e+=", Serial-over-LAN");q&&(e+=", IDE-Redirect");h&&(e+=", KVM");""==e&&(e=" None");d+=TableEntry("Active Features",addLinkConditional(e.substring(2),"showFeaturesDlg()",xxAccountAdminName))}null!=amtsysstate.IPS_KVMRedirectionSettingData&&amtsysstate.IPS_KVMRedirectionSettingData.response&&(q=amtsysstate.IPS_KVMRedirectionSettingData.response,e="Primary display",7<amtversion&&void 0!==q.DefaultScreen&&255>
948
-q.DefaultScreen&&(e=["Primary display","Secondary display","3rd display"][q.DefaultScreen]),e='<span title="The default remote display is the '+e.toLowerCase()+'">'+e+"</span>",1==q.Is5900PortEnabled&&(e+=", Port 5900 enabled"),1==q.OptInPolicy&&(e+=", "+q.OptInPolicyTimeout+" second"+(0<q.OptInPolicyTimeout?"s":"")+" opt-in"),e+=", "+q.SessionTimeout+" minute"+(0<q.SessionTimeout?"s":"")+" session timeout",9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService?((q=0!=(amtsysstate.IPS_ScreenConfigurationService.response.EnabledState&
949
-1))&&(e+=", Blanking Allowed"),QV(47,q),Q(48).checked=!1):QV(47,!1),d+=TableEntry("Remote Desktop",addLinkConditional(e,"showDesktopSettingsDlg()",xxAccountAdminName)));QV(27,!m||!v);QV(28,xxAccountAdminName);QV(38,!m||!h);QV(39,xxAccountAdminName);5<amtversion&&null!=amtsysstate.IPS_OptInService&&void 0!=amtsysstate.IPS_OptInService.response&&(e="Unknown state",m=amtsysstate.IPS_OptInService.response.OptInRequired,
950
-0==m&&(e="Not Required"),1==m&&(e="Required for KVM only"),4294967295==m&&(e="Always Required"),1==amtsysstate.IPS_OptInService.response.CanModifyOptInPolicy&&(e=addLinkConditional(e,"showConsentDlg()",xxAccountAdminName)),d+=TableEntry("User Consent",e));if(null!=AmtSystemPowerSchemes)for(e=amtsysstate.CIM_ElementSettingData.responses,p=0;p<e.length;p++)if(e[p].SettingData&&1==e[p].IsCurrent&&"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemPowerScheme"==e[p].SettingData.ReferenceParameters.ResourceURI)for(m=
951
-e[p].SettingData.ReferenceParameters.SelectorSet.Selector[1].Value,q=0;q<AmtSystemPowerSchemes.length;q++)AmtSystemPowerSchemes[q].SchemeGUID==m&&(d+=TableEntry("Power Policy",addLinkConditional(AmtSystemPowerSchemes[q].Description.split(":")[1],'showPowerPolicyDlg("'+m+'")',xxAccountAdminName)));amtdeltatime&&(d+=TableEntry("Date & Time",addLinkConditional((new Date((new Date).getTime()+amtdeltatime)).toLocaleString(),"syncClock()",xxAccountAdminName)));e=AddRefreshButton("PullSystemStatus()")+" ";
943
+0<amtsysstate.CIM_EnabledLogicalElement.responses.length)for(var n in amtsysstate.CIM_EnabledLogicalElement.responses){var r=amtsysstate.CIM_EnabledLogicalElement.responses[n];"IPS_PowerManagementService"==r.CreationClassName&&3==r.OSPowerSavingState&&(a="Standby (Connected)")}QH(30,a);QH(41,a)}l.PowerSource&&(a+=[", Plugged-in",", On Battery"][l.PowerSource]);d+=TableEntry("Power",addLink(a,"showPowerActionDlg()"));c=l.HostName;a=l.DomainName;null!=a&&0<a.length&&(c+="."+a);
944
+c=0==c.length?"<i>None</i>":EscapeHtml(c);d+=TableEntry("Name & Domain",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));HardwareInventory&&(d+=TableEntry("System ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var r="",p=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==p.ProvisioningState&&5<amtversion&&(r=" activated in Admin Control Mode (ACM)",4==p.ProvisioningMode&&(r=" activated in Client Control Mode (CCM)",
945
+b=9));d+=TableEntry("Intel® ME","v"+getItem(amtlogicalelements,"InstanceID","AMT").VersionString+r)}null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length&&(QV(29,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState),QV(40,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState));if(200==amtsysstate.AMT_RedirectionService.status){var m=
946
+amtfeatures[0]=1==amtsysstate.AMT_RedirectionService.response.ListenerEnabled,v=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),r=amtfeatures[2]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),h=amtfeatures[3]=void 0;5<amtversion&&null!=amtsysstate.CIM_KVMRedirectionSAP&&(QV("go14",!0),h=amtfeatures[3]=6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState&&2==amtsysstate.CIM_KVMRedirectionSAP.response.RequestedState||2==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState||
947
+6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState);m&&(e+=", Redirection Port");v&&(e+=", Serial-over-LAN");r&&(e+=", IDE-Redirect");h&&(e+=", KVM");""==e&&(e=" None");d+=TableEntry("Active Features",addLinkConditional(e.substring(2),"showFeaturesDlg()",xxAccountAdminName))}null!=amtsysstate.IPS_KVMRedirectionSettingData&&amtsysstate.IPS_KVMRedirectionSettingData.response&&(r=amtsysstate.IPS_KVMRedirectionSettingData.response,e="Primary display",7<amtversion&&void 0!==r.DefaultScreen&&255>
948
+r.DefaultScreen&&(e=["Primary display","Secondary display","3rd display"][r.DefaultScreen]),e='<span title="The default remote display is the '+e.toLowerCase()+'">'+e+"</span>",1==r.Is5900PortEnabled&&(e+=", Port 5900 enabled"),1==r.OptInPolicy&&(e+=", "+r.OptInPolicyTimeout+" second"+(0<r.OptInPolicyTimeout?"s":"")+" opt-in"),e+=", "+r.SessionTimeout+" minute"+(0<r.SessionTimeout?"s":"")+" session timeout",9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService?((r=0!=(amtsysstate.IPS_ScreenConfigurationService.response.EnabledState&
949
+1))&&(e+=", Blanking Allowed"),QV(47,r),Q(48).checked=!1):QV(47,!1),d+=TableEntry("Remote Desktop",addLinkConditional(e,"showDesktopSettingsDlg()",xxAccountAdminName)));QV(27,!m||!v);QV(28,xxAccountAdminName);QV(38,!m||!h);QV(39,xxAccountAdminName);5<amtversion&&null!=amtsysstate.IPS_OptInService&&void 0!=amtsysstate.IPS_OptInService.response&&(e="Unknown state",m=amtsysstate.IPS_OptInService.response.OptInRequired,
950
+0==m&&(e="Not Required"),1==m&&(e="Required for KVM only"),4294967295==m&&(e="Always Required"),1==amtsysstate.IPS_OptInService.response.CanModifyOptInPolicy&&(e=addLinkConditional(e,"showConsentDlg()",xxAccountAdminName)),d+=TableEntry("User Consent",e));if(null!=AmtSystemPowerSchemes)for(e=amtsysstate.CIM_ElementSettingData.responses,n=0;n<e.length;n++)if(e[n].SettingData&&1==e[n].IsCurrent&&"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemPowerScheme"==e[n].SettingData.ReferenceParameters.ResourceURI)for(m=
951
+e[n].SettingData.ReferenceParameters.SelectorSet.Selector[1].Value,r=0;r<AmtSystemPowerSchemes.length;r++)AmtSystemPowerSchemes[r].SchemeGUID==m&&(d+=TableEntry("Power Policy",addLinkConditional(AmtSystemPowerSchemes[r].Description.split(":")[1],'showPowerPolicyDlg("'+m+'")',xxAccountAdminName)));amtdeltatime&&(d+=TableEntry("Date & Time",addLinkConditional((new Date((new Date).getTime()+amtdeltatime)).toLocaleString(),"syncClock()",xxAccountAdminName)));e=AddRefreshButton("PullSystemStatus()")+" ";
952
e+=AddButton("Power Actions...","showPowerActionDlg()")+" ";e+=AddButton("Save State...","saveEntireAmtState()")+" ";e+=AddButton("Run Script...","script_runScriptDlg()")+" ";d+=TableEnd(e);QH(17,d);d="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>"+TableEnd("<div> "+AddRefreshButton("PullSystemStatus(1)")+" Changing network settings may cause this page to becaume unavailable.");d=d+"<br><h2>General Settings</h2>"+TableStart();e="";"<i>None</i>"!=
953
c&&(1==l.SharedFQDN&&(e=", shared with OS"),0==l.SharedFQDN&&(e=", different from OS"));d+=TableEntry("Name & Domain",addLinkConditional(c+e,"showEditNameDlg(1)",xxAccountAdminName));c="Disabled";1==l.DDNSUpdateEnabled?c="Enabled each "+l.DDNSPeriodicUpdateInterval+" minutes, TTL is "+l.DDNSTTL+" minutes":1==l.DDNSUpdateByDHCPServerEnabled&&(c="Update by DHCP server");d+=TableEntry("Dynamic DNS",addLinkConditional(c,"showEditDnsDlg()",xxAccountAdminName));d+=TableEnd();for(a in amtsysstate.AMT_EthernetPortSettings.responses){c=
954
-amtsysstate.AMT_EthernetPortSettings.responses[a];if(c.WLANLinkProtectionLevel||1==a)amtwirelessif=a;if(0!=a||amtwirelessif==a||"00-00-00-00-00-00"!=c.MACAddress){0==a&&b++;d+="<br><h2>"+(amtwirelessif==a?"Wireless":"Wired")+" Interface</h2>";d+=TableStart();d+=TableEntry("Link state",1==c.LinkIsUp?"Link is up":"Link is down");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);e=[];for(p in c.LinkPolicy)1==c.LinkPolicy[p]&&e.push("S0/AC"),14==c.LinkPolicy[p]&&e.push("Sx/AC"),16==c.LinkPolicy[p]&&
955
-e.push("S0/DC"),224==c.LinkPolicy[p]&&e.push("Sx/DC");0==e.length&&e.push("");d+=TableEntry("Link policy",addLinkConditional(0==e.length?"Not available":"Available in: "+e.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("MAC address",c.MACAddress));amtwirelessif==a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("State",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",
954
+amtsysstate.AMT_EthernetPortSettings.responses[a];if(c.WLANLinkProtectionLevel||1==a)amtwirelessif=a;if(0!=a||amtwirelessif==a||"00-00-00-00-00-00"!=c.MACAddress){0==a&&b++;d+="<br><h2>"+(amtwirelessif==a?"Wireless":"Wired")+" Interface</h2>";d+=TableStart();d+=TableEntry("Link state",1==c.LinkIsUp?"Link is up":"Link is down");if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);e=[];for(n in c.LinkPolicy)1==c.LinkPolicy[n]&&e.push("S0/AC"),14==c.LinkPolicy[n]&&e.push("Sx/AC"),16==c.LinkPolicy[n]&&
955
+e.push("S0/DC"),224==c.LinkPolicy[n]&&e.push("Sx/DC");0==e.length&&e.push("");d+=TableEntry("Link policy",addLinkConditional(0==e.length?"Not available":"Available in: "+e.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("MAC address",c.MACAddress));amtwirelessif==a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("State",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",
956
xxAccountAdminName)),s=xxWireless.CIM_WiFiEndpoint.response.LANID,d+=TableEntry("Radio State",xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+", SSID: "+(s?s:"<i>None</i>")));amtwirelessif!=a&&(d+=TableEntry("Respond to ping",addLinkConditional(["Disabled","ICMP response","RMCP response","ICMP & RMCP response"][l.PingResponseEnabled+(l.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),e=1==c.DHCPEnabled?"Automatic using DHCP server":"Static IP address",1==c.IpSyncEnabled&&
957
(e+=", IP sync with OS"),d+=TableEntry("IPv4 state",addLinkConditional(e,"showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("IPv4 address",isIpAddress(c.IPAddress,"None"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("IPv4 gateway / Mask",c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"None")));e=c.PrimaryDNS;isIpAddress(e)&&(c.SecondaryDNS&&(e+=" / "+c.SecondaryDNS),d+=TableEntry("IPv4 domain name server",e));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5<amtversion){c=amtsysstate.IPS_IPv6PortSettings.responses[a];
958
-var m="Disabled",z,e=amtsysstate.CIM_ElementSettingData.responses;for(p=0;p<e.length;p++)e[p].SettingData&&e[p].SettingData.ReferenceParameters.SelectorSet.Selector.Value=="Intel(r) IPS IPv6 Settings "+a&&(z=1==e[p].IsCurrent);1==z&&(e=isIpAddress(c.IPv6Address)||isIpAddress(c.DefaultRouter)||isIpAddress(c.PrimaryDNS)||isIpAddress(c.SecondaryDNS),m="Enabled, Automatic "+(e?"& manual":"")+" addresses");d+=TableEntry("IPv6 state",addLinkConditional(m,"showIPv6StateDlg("+a+","+z+")",xxAccountAdminName));
959
-if(1==z){if(c.CurrentAddressInfo&&0<c.CurrentAddressInfo.length){c.CurrentAddressInfo=MakeToArray(c.CurrentAddressInfo);ipv6addr="";for(p=0;p<c.CurrentAddressInfo.length;p++)0<ipv6addr.length&&(ipv6addr+=", "),ipv6addr+=c.CurrentAddressInfo[p].split(",")[0];d+=TableEntry("IPv6 address",addLink(ipv6addr,"showIPv6AddrDlg("+a+',"'+c.CurrentAddressInfo+'")'))}else d+=TableEntry("IPv6 address","None");isIpAddress(c.CurrentDefaultRouter)&&(d+=TableEntry("IPv6 default router",c.CurrentDefaultRouter));isIpAddress(c.CurrentPrimaryDNS)&&
958
+var m="Disabled",x,e=amtsysstate.CIM_ElementSettingData.responses;for(n=0;n<e.length;n++)e[n].SettingData&&e[n].SettingData.ReferenceParameters.SelectorSet.Selector.Value=="Intel(r) IPS IPv6 Settings "+a&&(x=1==e[n].IsCurrent);1==x&&(e=isIpAddress(c.IPv6Address)||isIpAddress(c.DefaultRouter)||isIpAddress(c.PrimaryDNS)||isIpAddress(c.SecondaryDNS),m="Enabled, Automatic "+(e?"& manual":"")+" addresses");d+=TableEntry("IPv6 state",addLinkConditional(m,"showIPv6StateDlg("+a+","+x+")",xxAccountAdminName));
959
+if(1==x){if(c.CurrentAddressInfo&&0<c.CurrentAddressInfo.length){c.CurrentAddressInfo=MakeToArray(c.CurrentAddressInfo);ipv6addr="";for(n=0;n<c.CurrentAddressInfo.length;n++)0<ipv6addr.length&&(ipv6addr+=", "),ipv6addr+=c.CurrentAddressInfo[n].split(",")[0];d+=TableEntry("IPv6 address",addLink(ipv6addr,"showIPv6AddrDlg("+a+',"'+c.CurrentAddressInfo+'")'))}else d+=TableEntry("IPv6 address","None");isIpAddress(c.CurrentDefaultRouter)&&(d+=TableEntry("IPv6 default router",c.CurrentDefaultRouter));isIpAddress(c.CurrentPrimaryDNS)&&
960
(e=c.CurrentPrimaryDNS,isIpAddress(c.CurrentSecondaryDNS)&&(e+=" / "+c.CurrentSecondaryDNS),d+=TableEntry("IPv6 domain name server",e))}}d+=TableEnd()}}1!=urlvars.kvmonly&&0==fullscreenonly&&(-1!=amtwirelessif&&0==(amtFirstPull&2)&&PullWireless(),QH(21,d),1==b&&0==(amtFirstPull&4)&&PullSystemDefense(),0==(amtFirstPull&8)&&(11<amtversion||11==amtversion&&5<amtversionmin)&&PullStorage());0==currentView&&go(1,1)}}
961
function isIpAddress(b,c){return b&&null!=b&&0<b.length&&"::"!=b&&"::0"!=b?b:c}
962
function showLinkPolicyDlg(b){if(!xxdialogMode){var c=amtsysstate.AMT_EthernetPortSettings.responses[b],a;a=""+("<label><input type=checkbox id=d11p1 value=1 "+(0<=c.LinkPolicy.indexOf(1)?"checked":"")+">Available in S0/AC - Powered on & plugged in</label><br>");a+="<label><input type=checkbox id=d11p2 value=14 "+(0<=c.LinkPolicy.indexOf(14)?"checked":"")+">Available in Sx/AC - Sleeping & plugged in</label><br>";a+="<label><input type=checkbox id=d11p3 value=16 "+(0<=c.LinkPolicy.indexOf(16)?"checked":
@@ -977,8 +977,8 @@ function showDesktopSettingsDlgOk3(b,c,a,d){200!=d?messagebox("Error","Screen Bl
977
var processMessageLog0responses=null;
978
function processMessageLog0(b,c,a,d){200==d&&(d&&QV("go6",!0),a&&(processMessageLog0responses=a),b="",c="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>",null!=processMessageLog0responses&&(b=1==processMessageLog0responses[0].IsFrozen?AddButton("Un-freeze Log","FreezeLog(0)"):AddButton("Freeze Log","FreezeLog(1)")),c+=TableEnd("<div style=float:right><input id=eventFilter placeholder=Filter style=margin:4px onkeyup=eventFilter()> </div><div> "+AddRefreshButton("PullEventLog(1)")+
979
AddButton("Clear Log","ClearLog()")+AddButton("Save...","SaveEventLog()")+b),QH(19,c+"<br>"))}function SaveEventLog(){xxdialogMode||null==eventmessages||SaveJsonFile("IntelAmtEventlog","events","Intel AMT Event Log",eventmessages)}var eventmessages=null;
980
-function processMessageLog1(b,c){eventmessages=c;var a,d=0,e;e="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=80px><p><td><td><td><tr><td class=r1 style=width:90px><b> Event</b><td class=r1 style=width:110px><b>Time</b><td class=r1 style=width:160px><b>Source</b><td class=r1><b>Description</b>";for(a in c){d++;var l=1,p=c[a];8<=p.EventSeverity&&(l=2);16<=p.EventSeverity&&(l=3);e+="<tr id=xamtevent"+a+" class=r3 onclick=showEventDetails("+
981
-a+")><td class=r1><p><div class=icon"+l+" style=display:block;float:left;margin-left:5px;margin-right:5px></div>"+(parseInt(a)+1)+'<td class=r1 title="'+p.Time.toLocaleString()+'">'+p.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br>"+p.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<td class=r1>"+p.EntityStr.replace("(r)","®")+"<td class=r1>"+p.Desc}e+=TableEnd(0==d?" ":"");QH(20,e+"<br>");processMessageLog0()}
980
+function processMessageLog1(b,c){eventmessages=c;var a,d=0,e;e="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=80px><p><td><td><td><tr><td class=r1 style=width:90px><b> Event</b><td class=r1 style=width:110px><b>Time</b><td class=r1 style=width:160px><b>Source</b><td class=r1><b>Description</b>";for(a in c){d++;var l=1,n=c[a];8<=n.EventSeverity&&(l=2);16<=n.EventSeverity&&(l=3);e+="<tr id=xamtevent"+a+" class=r3 onclick=showEventDetails("+
981
+a+")><td class=r1><p><div class=icon"+l+" style=display:block;float:left;margin-left:5px;margin-right:5px></div>"+(parseInt(a)+1)+'<td class=r1 title="'+n.Time.toLocaleString()+'">'+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br>"+n.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<td class=r1>"+n.EntityStr.replace("(r)","®")+"<td class=r1>"+n.Desc}e+=TableEnd(0==d?" ":"");QH(20,e+"<br>");processMessageLog0()}
982
function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(b){xxdialogMode||(QH(62,"Clear event log?"),setDialogMode(1,"Event Log",3,ClearLogEx))}function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("Event Log","Unable to clear, Error: "+d):PullEventLog()})}
983
function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="<div style=text-align:left>"+addHtmlValue("Time",c.Time.toLocaleString());a+=addHtmlValue("Source",c.EntityStr.replace("(r)","®"));a+=addHtmlValue("Description",c.Desc);a+=MoreStart();a+=addHtmlValue("Device Address",c.DeviceAddress);a+=addHtmlValue("Entity",c.Entity);a+=addHtmlValue("Entity Instance",c.EntityInstance);var d="",e;for(e in c.EventData)0<d.length&&(d+=","),d+=c.EventData[e];a+=addHtmlValue("Data",d);a+=addHtmlValue("Offset",
984
c.EventOffset);a+=addHtmlValue("Sensor Type",c.EventSensorType);a+=addHtmlValue("Severity",c.EventSeverity);a+=addHtmlValue("Source Type",c.EventSourceType);a+=addHtmlValue("Type",c.EventType);a+=addHtmlValue("Sensor Number",c.SensorNumber);a+=MoreEnd();a+="</div>";messagebox(format("Event #{0} Details",b+1),a)}}
@@ -999,8 +999,8 @@ function newSubscriptionButtonOk(){var b=0==Q("subuser").value.length?void 0:Q("
999
function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AMT_AuditLog",processAuditLog0))}var auditLog=null,auditLogEnabledStates="Unknown;Other;Enabled;Disabled;Shutting Down;Not Applicable;Enabled but Offline;In Test;Deferred;Quiesce;Starting".split(";");
1000
function processAuditLog0(b,c,a,d){200==d&&(QV("go15",!0),c=a[0].AuditState,b=c&1?"Disabled":"Enabled",c&2&&(b+=", Locked"),c&4&&(b+=", Almost Full"),c&8&&(b+=", Full"),c&16&&(b+=", NoKey"),c="<h1>Audit Log Settings</h1>"+TableStart(),c+=TableEntry("State",b),c+=TableEntry("Storage",a[0].CurrentNumberOfRecords+" record(s), "+a[0].PercentageFree+"% free"),c+=TableEntry("Overwrite policy",2==a[0].OverwritePolicy?"Wraps when full":"Never overwrites"),c+=TableEnd(),QH(51,c),amtstack.GetAuditLog(processAuditLog1))}
1001
function processAuditLog1(b,c){auditLog=c;var a,d;d="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>"+(TableEnd("<div style=float:right><input id=auditFilter placeholder=Filter style=margin:4px onkeyup=auditFilter()> </div><div> "+AddRefreshButton("PullAuditLog(1)")+AddButton("Save...","SaveAuditLog()")+AddButton("Clear Log","ClearAuditLog()"))+"<br>");if(0==c.length)d="No audit log events found.";else{var e=0;d+="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=80px><p><td><td><td><tr><td class=r1 style=width:110px> <b>Time</b><td class=r1 style=width:260px><b>Initiator</b><td class=r1><b>Action</b>";
1002
-for(a in c){var l=c[a],p=l.AuditApp,q=l.Initiator;e++;var n="";0<l.NetAddress.length&&(n=l.NetAddress.replace("0000:0000:0000:0000:0000:0000:0000:0001","::1"));l.Event&&(p+=", "+l.Event);null!=l.ExStr&&(p+=", "+l.ExStr);""!=q&&""!=n&&(q+=", ");d+="<tr id=xamtaudit"+a+" class=r3 onclick=showAuditDetails("+a+')><td class=r1 title="'+l.Time.toLocaleString()+'"> '+l.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br> "+l.Time.toLocaleTimeString("en",
1003
-{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<td class=r1>"+q+n+"<td class=r1>"+p}d+=TableEnd(0==e?" ":"")+"<br>"}QH(52,d)}function auditFilter(){var b=Q("auditFilter").value.toLowerCase(),c;for(c in auditLog)QV("xamtaudit"+c,""==b||0<=JSON.stringify(auditLog[c]).toLowerCase().indexOf(b))}function SaveAuditLog(){xxdialogMode||null==auditLog||SaveJsonFile("IntelAmtAuditlog","auditevents","Intel AMT Audit Log",auditLog)}
1002
+for(a in c){var l=c[a],n=l.AuditApp,r=l.Initiator;e++;var p="";0<l.NetAddress.length&&(p=l.NetAddress.replace("0000:0000:0000:0000:0000:0000:0000:0001","::1"));l.Event&&(n+=", "+l.Event);null!=l.ExStr&&(n+=", "+l.ExStr);""!=r&&""!=p&&(r+=", ");d+="<tr id=xamtaudit"+a+" class=r3 onclick=showAuditDetails("+a+')><td class=r1 title="'+l.Time.toLocaleString()+'"> '+l.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br> "+l.Time.toLocaleTimeString("en",
1003
+{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<td class=r1>"+r+p+"<td class=r1>"+n}d+=TableEnd(0==e?" ":"")+"<br>"}QH(52,d)}function auditFilter(){var b=Q("auditFilter").value.toLowerCase(),c;for(c in auditLog)QV("xamtaudit"+c,""==b||0<=JSON.stringify(auditLog[c]).toLowerCase().indexOf(b))}function SaveAuditLog(){xxdialogMode||null==auditLog||SaveJsonFile("IntelAmtAuditlog","auditevents","Intel AMT Audit Log",auditLog)}
1004
function ClearAuditLog(b){QH(62,"Clear audit log?");setDialogMode(1,"Audit Log",3,ClearAuditLogEx)}function ClearAuditLogEx(){var b=amtstack.AMT_AuditLog_SetAuditLock(1,0,b,function(){amtstack.AMT_AuditLog_ClearLog(function(){amtstack.AMT_AuditLog_SetAuditLock(0,2,b,function(){setTimeout(PullAuditLog,1E3)})})})}function ShowAuditLogSettings(){xxdialogMode||amtstack.AMT_AuditLog_RequestStateChange(2,0,AuditLogSettingsCompleted)}
1005
function AuditLogSettingsCompleted(b,c,a,d){200==d?PullAuditLog():messagebox("Audit Log","Error: "+d)}
1006
function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="<div style=text-align:left>"+addHtmlValue("Time",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("Initiator",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("Address",a.NetAddress));d+=addHtmlValue("Application",a.AuditApp);d+=addHtmlValue("Event",a.Event);if(null!=a.ExStr)d+=addHtmlValue("Extended Data",a.ExStr);else if(0<a.Ex.length){var e="";for(c in a.Ex)0<e.length&&(e+=","),e+=a.Ex.charCodeAt(c);""!=e&&(d+=addHtmlValue("Data Values",
@@ -1087,12 +1087,12 @@ function AddDefenseFilter(){if(!xxdialogMode){var b;b="<div style=height:26px;ma
1087
b+="<div style=height:26px;margin-top:4px id=filterdatadiv><input id=filterdata style=float:right;width:260px maxlength=8 onkeyup=AddDefenseFilterUpdate()><div style=padding-top:4px>Packets / second</div></div>";b+="<div style=height:26px;margin-top:4px><select id=filteraction style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=false>Do Nothing<option value=1>Event on match</select><div style=padding-top:4px>Event Log</div></div>";setDialogMode(11,"Add System Defense Filter",
1088
3,AddDefenseFilterOk,b);AddDefenseFilterUpdate()}}
1089
function AddDefenseFilterOk(){if(1>=Q("filtertype").value){var b=0==Q("filtertype").value?2048:2054,c={"InstanceID ":0,Name:Q("filtername").value,CreationClassName:0,SystemName:0,SystemCreationClassName:0,HdrProtocolID8021:b,FilterProfile:Q("filterprofile").value,FilterDirection:Q("filterdir").value,ActionEventOnMatch:Q("filteraction").value};2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_Hdr8021Filter",c,AddDefenseFilterOk2)}else{var b=2==Q("filtertype").value?
1090
-4:6,c={"InstanceID ":0,Name:Q("filtername").value,CreationClassName:0,SystemName:0,SystemCreationClassName:0,HdrIPVersion:b,FilterProfile:Q("filterprofile").value,FilterDirection:Q("filterdir").value,ActionEventOnMatch:Q("filteraction").value},a=Q("ipfilter").value.split(","),d;for(d in a){var e=a[d].indexOf("="),l=a[d].substring(0,e),e=a[d].substring(e+1),p=xxSystemDefenceFilters[l];p||(l="Hdr"+l,p=xxSystemDefenceFilters[l]);p&&(2==p&&4==b?(e=e.split("."),4==e.length&&(c[l]=rstr2hex(String.fromCharCode(parseInt(e[0]),
1090
+4:6,c={"InstanceID ":0,Name:Q("filtername").value,CreationClassName:0,SystemName:0,SystemCreationClassName:0,HdrIPVersion:b,FilterProfile:Q("filterprofile").value,FilterDirection:Q("filterdir").value,ActionEventOnMatch:Q("filteraction").value},a=Q("ipfilter").value.split(","),d;for(d in a){var e=a[d].indexOf("="),l=a[d].substring(0,e),e=a[d].substring(e+1),n=xxSystemDefenceFilters[l];n||(l="Hdr"+l,n=xxSystemDefenceFilters[l]);n&&(2==n&&4==b?(e=e.split("."),4==e.length&&(c[l]=rstr2hex(String.fromCharCode(parseInt(e[0]),
1091
parseInt(e[1]),parseInt(e[2]),parseInt(e[3]))))):c[l]=e)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0<Q("filtername").value.length;b&&2==Q("filterprofile").value&&(b=parseInt(Q("filterdata").value),b=0<b&&4294967295>b);QE("c48",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)}
1092
function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("Add System Defense Filter","Unable to add filter, error #"+d):PullSystemDefense()}
1093
-function showFilterDetails(b,c){if(!xxdialogMode){var a,d,e,l;0==b?(l="AMT_Hdr8021Filter",e="Ethernet Traffic",d=xxSystemDefense[l].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="All Ethernet Protocol "+d.HdrProtocolID8021)):(l="AMT_IPHeadersFilter",e="IP Traffic",d=xxSystemDefense[l].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="All IP Protocol "+d.HdrIPVersion));var p;p=""+addHtmlValue("Name",EscapeHtml(d.Name));p+=addHtmlValue("Type",e);p+=addHtmlValue("Matching Traffic",
1094
-a);p+=addHtmlValue("Direction",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var q in xxSystemDefenceFilters)d[q]&&(a=q,e=d[q],b=xxSystemDefenceFilters[q],2==b&&4==e.length&&(e=hex2rstr(e),e=e.charCodeAt(0)+"."+e.charCodeAt(1)+"."+e.charCodeAt(2)+"."+e.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),p+=addHtmlValue("Filter "+a,e));p+=addHtmlValue("Event on match",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Ethernet Filter #"+d.InstanceID,5,showFilterDetailsOk,
1095
-p,[l,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Remove Filter","Unable to remove filter, make sure it's not in use."):PullSystemDefense()}var xxAddDefensePolicyFilters;
1093
+function showFilterDetails(b,c){if(!xxdialogMode){var a,d,e,l;0==b?(l="AMT_Hdr8021Filter",e="Ethernet Traffic",d=xxSystemDefense[l].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="All Ethernet Protocol "+d.HdrProtocolID8021)):(l="AMT_IPHeadersFilter",e="IP Traffic",d=xxSystemDefense[l].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="All IP Protocol "+d.HdrIPVersion));var n;n=""+addHtmlValue("Name",EscapeHtml(d.Name));n+=addHtmlValue("Type",e);n+=addHtmlValue("Matching Traffic",
1094
+a);n+=addHtmlValue("Direction",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var r in xxSystemDefenceFilters)d[r]&&(a=r,e=d[r],b=xxSystemDefenceFilters[r],2==b&&4==e.length&&(e=hex2rstr(e),e=e.charCodeAt(0)+"."+e.charCodeAt(1)+"."+e.charCodeAt(2)+"."+e.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),n+=addHtmlValue("Filter "+a,e));n+=addHtmlValue("Event on match",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Ethernet Filter #"+d.InstanceID,5,showFilterDetailsOk,
1095
+n,[l,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Remove Filter","Unable to remove filter, make sure it's not in use."):PullSystemDefense()}var xxAddDefensePolicyFilters;
1096
function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='<div style=height:26px;margin-top:4px><input id=policyname title="<policy name>:<policy precedence number>" style=float:right;width:260px maxlength=16 onkeyup=AddDefensePolicyUpdate()><div style=padding-top:4px>Name</div></div><div style=height:26px;margin-top:4px><select id=policytx title="Default action to take for outbound traffic" style=float:right;width:133px><option value=0>Allow<option value=1>Drop<option value=2>Allow,Count<option value=3>Drop,Count<option value=4>Allow,Count,Event<option value=5>Drop,Count,Event</select><select id=policyrx style=float:right;width:133px title="Default action to take for inbound traffic"><option value=0>Allow<option value=1>Drop<option value=2>Allow,Count<option value=3>Drop,Count<option value=4>Allow,Count,Event<option value=5>Drop,Count,Event</select><div style=padding-top:4px>Default TX / RX</div></div>';b+=
1097
"<div id=policyFilters></div>";if(0<xxSystemDefense.AMT_Hdr8021Filter.responses.length||0<xxSystemDefense.AMT_IPHeadersFilter.responses.length){b+="<div style=height:26px;margin-top:4px><div style=float:right><select id=xfilter style=width:186px>";for(var c in xxSystemDefense.AMT_Hdr8021Filter.responses){var a=xxSystemDefense.AMT_Hdr8021Filter.responses[c];b+="<option value="+a.InstanceID+">"+a.Name}for(c in xxSystemDefense.AMT_IPHeadersFilter.responses)a=xxSystemDefense.AMT_IPHeadersFilter.responses[c],
1098
b+="<option value="+a.InstanceID+">"+a.Name;b+="</select><input id=addFilterButton type=button value=Add style=width:80px onclick=addFilterButton()></div><div style=padding-top:4px>Add Filter</div></div>"}setDialogMode(11,"Add System Defense Policy",3,AddDefensePolicyOk,b);AddDefensePolicyUpdate()}}function addFilterButton(){0<=xxAddDefensePolicyFilters.indexOf(Q("xfilter").value)||(xxAddDefensePolicyFilters.push(Q("xfilter").value),AddDefensePolicyUpdate())}
@@ -1129,14 +1129,14 @@ function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByTagNa
1129
function PullUserInfo(){xxAccountFetch=1;delete xxAccountAdminName;xxAccountRealmInfo={};amtstack.AMT_AuthorizationService_GetAdminAclEntry(getAdminAclEntryResponse);amtstack.AMT_AuthorizationService_EnumerateUserAclEntries(1,enumerateUserAclEntriesResponse)}function getAdminAclEntryResponse(b,c,a,d){200==d&&(xxAccountRealmInfo[-1]={AccessPermission:999,DigestUsername:a.Body.Username,Realms:null},xxAccountAdminName=a.Body.Username,updateAccounts())}
1130
function enumerateUserAclEntriesResponse(b,c,a,d){if(200==d){methodcheck(a);QV("go11",!0);xxAccountFetch=a.Body.Handles.length;for(var e in a.Body.Handles)b=a.Body.Handles[e],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}}
1131
function getUserAclEntryExResponse(b,c,a,d,e){xxAccountFetch--;200==d&&(a.Body.Handle=e,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[e]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,e){200==d&&(xxAccountEnabledInfo[e]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,e){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(e,getAclEnabledStateResponse,e))}
1132
-function updateAccounts(){if(!(0<xxAccountFetch)){var b=TableStart2(),b=b+"<tr><td class=r1 style=padding-left:15px><br>Manage the Intel® AMT user accounts for this computer.<br><br>",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,e=!1,l=0;a.DigestUsername?(d=a.DigestUsername,e="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(l=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!e){var p="";if(999!=a.AccessPermission){2==
1133
-l&&(p+="Disabled, ");var q=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Realms[c]]&&q++;0<=a.Realms.indexOf(20)&&(p+="Auditor, ");p=0<=a.Realms.indexOf(3)?p+"Administrator":1==q?p+"1 realm":p+(q+" realms")}else p+="Administrator",a.Handle=-1;b+="<div class=itemBar onclick=showUserDetails("+a.Handle+")><div style=float:right>";0<l&&xxAccountAdminName&&(b+=" "+AddButton2(1==l?"Disable":"Enable","changeAccountStateButton(event,"+a.Handle+","+l+")"));!e&&xxAccountAdminName&&(b+=" "+AddButton2("Edit...",
1134
-"changeAccountButton(event,"+a.Handle+")"));b+='</div><div style=padding-top:3px;width:330px;float:left;overflow-x:hidden title="'+d+'"><b>'+d+"</b></div><div style=padding-top:3px>"+p+"</div></div>"}}c='<div style=float:right;margin-right:8px><a title="Toggle hidden accounts" style=color:gray;cursor:pointer onclick=toggleAccountButton()>'+(showHiddenAccounts?"▲":"▼")+"</a></div><div> "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("New Account",
1132
+function updateAccounts(){if(!(0<xxAccountFetch)){var b=TableStart2(),b=b+"<tr><td class=r1 style=padding-left:15px><br>Manage the Intel® AMT user accounts for this computer.<br><br>",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,e=!1,l=0;a.DigestUsername?(d=a.DigestUsername,e="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(l=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!e){var n="";if(999!=a.AccessPermission){2==
1133
+l&&(n+="Disabled, ");var r=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Realms[c]]&&r++;0<=a.Realms.indexOf(20)&&(n+="Auditor, ");n=0<=a.Realms.indexOf(3)?n+"Administrator":1==r?n+"1 realm":n+(r+" realms")}else n+="Administrator",a.Handle=-1;b+="<div class=itemBar onclick=showUserDetails("+a.Handle+")><div style=float:right>";0<l&&xxAccountAdminName&&(b+=" "+AddButton2(1==l?"Disable":"Enable","changeAccountStateButton(event,"+a.Handle+","+l+")"));!e&&xxAccountAdminName&&(b+=" "+AddButton2("Edit...",
1134
+"changeAccountButton(event,"+a.Handle+")"));b+='</div><div style=padding-top:3px;width:330px;float:left;overflow-x:hidden title="'+d+'"><b>'+d+"</b></div><div style=padding-top:3px>"+n+"</div></div>"}}c='<div style=float:right;margin-right:8px><a title="Toggle hidden accounts" style=color:gray;cursor:pointer onclick=toggleAccountButton()>'+(showHiddenAccounts?"▲":"▼")+"</a></div><div> "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("New Account",
1135
"newAccountButton()"));b+="<br><td class=r1>"+TableEnd(c+"</div>");QH(23,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,e){methodcheck(a)||PullUserInfo()}function changeAccountStateButton(b,c,a){haltEvent(b);xxdialogMode||amtstack.AMT_AuthorizationService_SetAclEnabledState(c,1==a?!1:!0,setAclEnabledStateResponse,c)}
1136
function changeAccountButton(b,c){haltEvent(b);xxdialogMode||(updateRealms(xxAccountRealmInfo[c].Realms),d2username.value=xxAccountRealmInfo[c].DigestUsername?xxAccountRealmInfo[c].DigestUsername:GetSidString(atob(xxAccountRealmInfo[c].KerberosUserSid)),d2password1.value=d2password2.value="",d2permission.value=xxAccountRealmInfo[c].AccessPermission,setDialogMode(2,"Edit Account",-1==c?3:7,function(a){changeAccountButtonEx(c,a)}),updateAccountDialog())}
1137
function newAccountButton(){xxdialogMode||(updateRealms([]),d2username.value=d2password1.value=d2password2.value="",d2permission.value=2,setDialogMode(2,"New Account",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())}
1138
-function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,e=d2permission.value,l=d2password1.value,p=GetSidByteArray(Q("d2username").value),q=null;if(0==d.length||l!=d2password2.value){messagebox("Account Error","Invalid Parameters");return}null==p?q=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+l)):(d=null,p=btoa(p));if(-1!=b)for(var n in amtstack.RealmNames)(amtstack.RealmNames[n]||3==n)&&Q("rx"+n).checked&&a.push(n);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,
1139
-q,p,e,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,q,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,q,p,e,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,e){methodcheck(a)||PullUserInfo()}
1138
+function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,e=d2permission.value,l=d2password1.value,n=GetSidByteArray(Q("d2username").value),r=null;if(0==d.length||l!=d2password2.value){messagebox("Account Error","Invalid Parameters");return}null==n?r=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+l)):(d=null,n=btoa(n));if(-1!=b)for(var p in amtstack.RealmNames)(amtstack.RealmNames[p]||3==p)&&Q("rx"+p).checked&&a.push(p);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,
1139
+r,n,e,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,r,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,r,n,e,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,e){methodcheck(a)||PullUserInfo()}
1140
function updateRealms(b){QV(63,null!=b);if(null!=b){var c="<li><label><input type=checkbox onchange=updateAccountDialog() id=rx3"+(0<=b.indexOf(3)?" checked":"")+">Administrator</label></li><hr />",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="<li><label><input type=checkbox onchange=updateAccountDialog() id=rx"+a+d+">"+amtstack.RealmNames[a]+"</label></li>")}QH(64,c)}}
1141
function updateAccountDialog(){var b=!0;if("none"!=Q(63).style.display){var b=!1,c;for(c in amtstack.RealmNames)(amtstack.RealmNames[c]||3==c)&&Q("rx"+c).checked&&(b=!0)}b&&(b=0<d2username.value.length&&passwordcheck(d2password1.value)&&d2password1.value==d2password2.value);QE("c48",b)}var xxUserPermissions=["Local only","Network only","All (Local & Network)"];
1142
function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="<div style=text-align:left>",d,e=c.DigestUsername;e||(e=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Name",e);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("State",1==xxAccountEnabledInfo[b].Enabled?"Enabled":"Disabled"));if(e==xxAccountAdminName)a+=addHtmlValue("Permission","Administrator");else{var a=a+addHtmlValue("Permission",xxUserPermissions[c.AccessPermission]),l="";if(0<=c.Realms.indexOf(3))l="Administrator",
@@ -1147,7 +1147,7 @@ function wsmanFilter(){var b=c0.value.toLowerCase(),c;for(c in AllWsman)QV("WSB-
1147
function onTerminalStateChange(b,c){c4.value=0==c?"Connect":"Disconnect";Q(31).textContent=StatusStrs[c];QE(36,3==c);switch(c){case 0:b.m.TermResetScreen();b.m.TermDraw();3==xxdialogMode&&setDialogMode();QV("termRecordIcon",!1);break;case 3:1==b.serverIsRecording&&QV("termRecordIcon",!0)}}function termPaste(){terminal.m.TermSendKeys(d3pastetextarea.value)}function termSendKey(b){terminal.m.TermSendKey(b)}
1148
function termToggleSize(){80==terminal.m.width?(Q(33).value="100x30",terminal.m.Init(100,30)):(Q(33).value="80x25",terminal.m.Init(80,25))}var terminalEmulations=["UTF8 Terminal","Extended ASCII","Intel ASCII"];function termToggleType(){terminal.m.terminalEmulation=(terminal.m.terminalEmulation+1)%3;Q(35).value=terminalEmulations[terminal.m.terminalEmulation]}
1149
function termToggleFx(){Q(34).value=["Intel (F10 = ESC+[OM)","Alternate (F10 = ESC+0)","VT100+ (F10 = ESC+[OY)"][terminal.m.fxEmulation=(terminal.m.fxEmulation+1)%3]}function termToggleCr(){"\r\n"==terminal.m.lineFeed?(Q(32).value="LF",terminal.m.lineFeed="\n"):(Q(32).value="CR+LF",terminal.m.lineFeed="\r\n")}
1150
-function terminalCaptureToggle(){if(void 0==terminal.m.capture)terminal.m.capture="",c3.value="Stop Capture";else{if(0<terminal.m.capture.length){var b="TerminalCapture",c=new Date;amtsysstate&&(b+="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);saveAs(data2blob(terminal.m.capture),b+".txt")}delete terminal.m.capture;
1150
+function terminalCaptureToggle(b){if(!xxdialogMode)if(void 0==terminal.m.capture)terminal.m.capture="",c3.value="Stop Capture";else{if(0<terminal.m.capture.length){b="TerminalCapture";var c=new Date;amtsysstate&&(b+="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);saveAs(data2blob(terminal.m.capture),b+".txt")}delete terminal.m.capture;
1151
c3.value="Start Capture"}}function terminal_FileSelectHandler(b){haltEvent(b);if(3==terminal.State&&null!=b.dataTransfer&&1==b.dataTransfer.files.length){var c=new FileReader;c.onload=terminal_onSetupBinRead;c.readAsText(b.dataTransfer.files[0])}}function terminal_onSetupBinRead(b){d3pastetextarea.value=b.target.result;setDialogMode(3,"Paste",3,termPaste)}var desktopScreenInfo=null,desktopPollTimer=null,webRtcDesktop=null;
1152
function webRtcDesktopReset(){if(null!=webRtcDesktop){null!=webRtcDesktop.softdesktop&&(webRtcDesktop.softdesktop.Stop(),webRtcDesktop.softdesktop=null);if(null!=webRtcDesktop.webchannel){try{webRtcDesktop.webchannel.close()}catch(b){}webRtcDesktop.webchannel=null}if(null!=webRtcDesktop.webrtc){try{webRtcDesktop.webrtc.close()}catch(b){}webRtcDesktop.webrtc=null}webRtcDesktop=null;desktop.m.hold(!1);Q(42).textContent=StatusStrs[desktop.State];p24files=null;p24downloadFileCancel();p24uploadFileCancel();
1153
QV("go24",!1);24==currentView&&go(14)}}
@@ -1180,10 +1180,10 @@ function dmousemove(b){xxdialogMode||Q(50).checked||(null!=webRtcDesktop&&null!=
1180
function drotate(b){b=desktop.m.rotation+b;desktop.m.setRotation(b);null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop&&null!=webRtcDesktop.softdesktop.m&&webRtcDesktop.softdesktop.m.setRotation(b);center()}var p24files=null,p24filetree=null,p24targetpath=null,p24filetreelocation=[];
1181
function onFilesControlData(b){if(0<b.length&&123!=b.charCodeAt(0))p24gotDownloadBinaryData(b);else if(b=JSON.parse(b),"download"==b.action)p24gotDownloadCommand(b);else if("upload"==b.action)p24gotUploadData(b);else if("pong"!=b.action)if(b.path=b.path.replace(/\//g,"\\"),null!=p24filetree&&b.path==p24filetree.path){var c=p24getCheckedNames();p24filetree=b;p24updateFiles(c)}else{for(var c=b.path.split("/").join("\\"),a=p24targetpath.split("/").join("\\");0<c.length&&"\\"==c[0];)c=c.substring(1);
1182
for(;0<a.length&&"\\"==a[0];)a=a.substring(1);if(c==a||"\\"==b.path&&""==p24targetpath)p24filetree=b,p24updateFiles()}}function p24getCheckedNames(){for(var b=[],c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked&&b.push(p24filetree.dir[c[a].value].n);return b}
1183
-function p24updateFiles(b){var c="",a="",d="<a style=cursor:pointer onclick=p24folderup(0)>Root</a>",e=p24filetree.path.split("\\");p24filetreelocation=[];for(var l in e)""!=e[l]&&p24filetreelocation.push(e[l]);for(l in p24filetreelocation)d+=" / <a style=cursor:pointer onclick=p24folderup("+(parseInt(l)+1)+")>"+p24filetreelocation[l]+"</a>";var e=p24filetreelocation.join("/"),p=p24sort_files(p24filetree.dir);for(l in p){var q=p[l],n=q.n,m;m=70<n.length?'<span title="'+EscapeHtml(n)+'">'+EscapeHtml(n.substring(0,
1184
-70))+"...</span>":EscapeHtml(n);var n=EscapeHtml(n),v="";null!=q.d&&(v=new Date(q.d),v=v.getMonth()+1+"/"+v.getDate()+"/"+v.getFullYear()+" "+v.toLocaleTimeString()+" ");var h="";null!=q.s&&(h=getFileSizeStr(q.s));var z="";3>q.t?z='<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value="'+q.nx+'"> <span style=float:right title=""></span><span><div class=fileIcon'+q.t+'></div><a style=cursor:pointer onclick=p24folderset("'+
1185
-encodeURIComponent(q.nx)+'")>'+m+"</a></span></div>":(z=m,0<q.s&&(z='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p24downloadfile("'+encodeURIComponent(e+"/"+n)+'","'+encodeURIComponent(n)+'",'+q.s+')">'+m+"</a>"),z='<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value="'+q.nx+'"> <span class=fsize>'+v+"</span><span style=float:right>"+h+"</span><span><div class=fileIcon"+q.t+"></div>"+z+"</span></div>");
1186
-3>q.t?c+=z:a+=z}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),l=0;l<c.length;l++)0<=b.indexOf(p24filetree.dir[c[l].value].n)&&(c[l].checked=!0);p24setActions()}function p24folderset(b){p24targetpath=joinPaths(p24filetree.path,p24filetree.dir[b].n).split("\\").join("/");p24files.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:p24targetpath}))}
1183
+function p24updateFiles(b){var c="",a="",d="<a style=cursor:pointer onclick=p24folderup(0)>Root</a>",e=p24filetree.path.split("\\");p24filetreelocation=[];for(var l in e)""!=e[l]&&p24filetreelocation.push(e[l]);for(l in p24filetreelocation)d+=" / <a style=cursor:pointer onclick=p24folderup("+(parseInt(l)+1)+")>"+p24filetreelocation[l]+"</a>";var e=p24filetreelocation.join("/"),n=p24sort_files(p24filetree.dir);for(l in n){var r=n[l],p=r.n,m;m=70<p.length?'<span title="'+EscapeHtml(p)+'">'+EscapeHtml(p.substring(0,
1184
+70))+"...</span>":EscapeHtml(p);var p=EscapeHtml(p),v="";null!=r.d&&(v=new Date(r.d),v=v.getMonth()+1+"/"+v.getDate()+"/"+v.getFullYear()+" "+v.toLocaleTimeString()+" ");var h="";null!=r.s&&(h=getFileSizeStr(r.s));var x="";3>r.t?x='<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value="'+r.nx+'"> <span style=float:right title=""></span><span><div class=fileIcon'+r.t+'></div><a style=cursor:pointer onclick=p24folderset("'+
1185
+encodeURIComponent(r.nx)+'")>'+m+"</a></span></div>":(x=m,0<r.s&&(x='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p24downloadfile("'+encodeURIComponent(e+"/"+p)+'","'+encodeURIComponent(p)+'",'+r.s+')">'+m+"</a>"),x='<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value="'+r.nx+'"> <span class=fsize>'+v+"</span><span style=float:right>"+h+"</span><span><div class=fileIcon"+r.t+"></div>"+x+"</span></div>");
1186
+3>r.t?c+=x:a+=x}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),l=0;l<c.length;l++)0<=b.indexOf(p24filetree.dir[c[l].value].n)&&(c[l].checked=!0);p24setActions()}function p24folderset(b){p24targetpath=joinPaths(p24filetree.path,p24filetree.dir[b].n).split("\\").join("/");p24files.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:p24targetpath}))}
1187
function p24folderup(b){if(null==b)p24filetreelocation.pop();else for(;p24filetreelocation.length>b;)p24filetreelocation.pop();p24targetpath=p24filetreelocation.join("/");p24files.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:p24targetpath}))}var p24sortorder;function p24sort_filename(b,c){return b.ln>c.ln?1*p24sortorder:b.ln<c.ln?-1*p24sortorder:0}function p24sort_timestamp(b,c){return b.d>c.d?1*p24sortorder:b.d<c.d?-1*p24sortorder:0}
1188
function p24sort_bysize(b,c){return b.s==c.s?p24sort_filename(b,c):(b.s-c.s)*p24sortorder}function p24sort_files(b){var c=[],a=Q("p24sortdropdown").value,d;for(d in b)b[d].nx=d,null==b[d].s&&(b[d].s=0),null==b[d].n&&(b[d].n=d),b[d].ln=b[d].n.toLowerCase(),c.push(b[d]);p24sortorder=1;3<a&&(p24sortorder=-1,a-=3);1==a?c.sort(p24sort_filename):2==a?c.sort(p24sort_bysize):3==a&&c.sort(p24sort_timestamp);return c}
1189
function p24setActions(){if(null==p24filetree)QE("p24DeleteFileButton",!1),QE("p24NewFolderButton",!1),QE("p24UploadButton",!1),QE("p24RenameFileButton",!1),QE("p24SelectAllButton",!1),Q("p24SelectAllButton").value="Select All",QE("p24RefreshButton",!1),QE("p24CutButton",!1),QE("p24CopyButton",!1),QE("p24PasteButton",!1);else{var b=p24getFileSelCount(),c=p24getFileCount(),a=p24getFileSelCount(!1),d="win32"==webRtcDesktop.platform;QE("p24DeleteFileButton",0<b&&(0<p24filetreelocation.length||0==d));
@@ -1217,8 +1217,8 @@ null,c=null;1==Q("floppyImageInput").files.length&&(b=Q("floppyImageInput").file
1217
function iderStart3(b,c,a){iderStop();ider=CreateAmtRedirect(CreateAmtRemoteIder());ider.onStateChanged=onIderStateChange;ider.m.floppy=b;ider.m.cdrom=c;ider.m.iderStart=a;ider.m.sectorStats=iderSectorStats;ider.tlsv1only=amtstack.wsman.comm.tlsv1only;ider.Start(currentMeshNode._id,16994,"*","*",0);QV("IDERDiskMapButton",!0)}
1218
function iderStop(){ider&&(ider.m.Stop(),ider.onStateChanged=null,ider.m.onDialogPrompt=null,delete ider);iderTimer&&(clearInterval(iderTimer),delete iderTimer);iderToggleDiskMap(!1)}function onIderStateChange(b,c){QE("c2",3!=c);QE("c8",3!=c);QE("c1",3!=c);QE("c7",3!=c);QV(9,3==c);center();3==c?(urlvars.norefresh||(iderTimer=setInterval(onIderTimer,500)),onIderTimer()):iderTimer&&(clearInterval(iderTimer),delete iderTimer)}
1219
function onIderTimer(){ider.m.Update&&ider.m.Update();-1==ider.m.bytesFromAmt?iderStop():QH(10,"<b>"+(ider.m.server?"Server ":"")+"IDE-R Session</b>, Connected, "+ider.m.bytesFromAmt+" in, "+ider.m.bytesToAmt+" out.")}var heatMapWidth=600,heatMapDividor={};
1220
-function iderSectorStats(b,c,a,d,e){var l=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),p=l.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0<a)for(;8E3<a/heatMapDividor[c];)heatMapDividor[c]*=2;c?(QV("cdromHeatMap",a),QH("cdromHeatMapText",format("<b>CDROM</b>, blocks are {0} bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format("<b>Floppy</b>, blocks are {0} bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;e/=c;if(0==b)l.height=6*(Math.floor(a/
1221
-(heatMapWidth/6))+(a%heatMapWidth?1:0)),p.fillStyle="rgba(225,250,225,1)",p.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&p.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),p.fillStyle="rgba(0,0,0,0.3)";else for(b=d;b<d+e;b++)sectorHeat(p,b,6,c)}function sectorHeat(b,c,a,d){b.fillRect(c%(heatMapWidth/a)*a,Math.floor(c/(heatMapWidth/a))*a,a,a)}
1220
+function iderSectorStats(b,c,a,d,e){var l=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),n=l.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0<a)for(;8E3<a/heatMapDividor[c];)heatMapDividor[c]*=2;c?(QV("cdromHeatMap",a),QH("cdromHeatMapText",format("<b>CDROM</b>, blocks are {0} bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format("<b>Floppy</b>, blocks are {0} bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;e/=c;if(0==b)l.height=6*(Math.floor(a/
1221
+(heatMapWidth/6))+(a%heatMapWidth?1:0)),n.fillStyle="rgba(225,250,225,1)",n.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&n.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),n.fillStyle="rgba(0,0,0,0.3)";else for(b=d;b<d+e;b++)sectorHeat(n,b,6,c)}function sectorHeat(b,c,a,d){b.fillRect(c%(heatMapWidth/a)*a,Math.floor(c/(heatMapWidth/a))*a,a,a)}
1222
function iderToggleDiskMap(b){var c="none"!=QS("iderHeatmap").display;null==b&&(b=!c);xxdialogMode&&(b=!1);QS("iderHeatmap").display=b?"":"none"}function onIderDialogPrompt(b,c,a){iderCodeBlock&&(document.body.removeChild(iderCodeBlock),delete iderCodeBlock);c.js&&(b=document.createElement("script"),b.text=c.js,iderCodeBlock=document.body.appendChild(b));setDialogMode(11,"Storage Redirection",a?a:3,onIderDialogPromptOk,c.html)}
1223
function onIderDialogPromptOk(b){1==b?window.iderServerCall?ider.m.dialogPrompt(window.iderServerCall()):ider.m.dialogPrompt():iderStop()}function iderServerStart(){iderStop();ider=CreateAmtRemoteServerIder();null!=ider&&(ider.onStateChanged=onIderStateChange,ider.m.sectorStats=iderSectorStats,ider.m.onDialogPrompt=onIderDialogPrompt,ider.tlsv1only=amtstack.wsman.comm.tlsv1only,ider.Start(currentMeshNode._id,16994,"*","*",0))}
1224
var xxRemoteAccess=null,xxEnvironementDetection=null,xxCiraServers=null,xxUserInitiatedCira=null,xxUserInitiatedEnabledState={32768:"Disabled",32769:"BIOS enabled",32770:"OS enable",32771:"BIOS & OS enabled"},xxRemoteAccessCredentiaLinks=null,xxMPSUserPass=null,xxPolicies=null;
@@ -1242,7 +1242,7 @@ function editMpsPolicyUpdate(){var b=11<amtversion||11==amtversion&&6<=amtversio
1242
function editMpsPolicyOk(){var b=xxEditMpsPolicyType;"User"==b&&(b="User Initiated");getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",b)?amtstack.Delete("AMT_RemoteAccessPolicyRule",{PolicyRuleName:b},editMpsPolicyOk2):editMpsPolicyOk2()}
1243
function editMpsPolicyOk2(b,c,a,d){b=11<amtversion||11==amtversion&&6<=amtversion;if(-1==Q("d2server1").value)PullRemoteAccess();else{c=0;"Alert"==xxEditMpsPolicyType&&(c=1);"Periodic"==xxEditMpsPolicyType&&(c=2);a=null;2==c&&(a=Q("d2ttype").value,d=IntToStr(Q("d2timer").value),1==a&&(d=Q("d2timer").value.split(":"),d=IntToStr(parseInt(d[0]))+IntToStr(parseInt(d[1]))),a=btoa(IntToStr(a)+d));var e,l;0<=Q("d2server1").value&&(e='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
1244
xxCiraServers[Q("d2server1").value].Name+"</Selector></SelectorSet></ReferenceParameters>");0<=Q("d2server1").value&&1<xxCiraServers.length&&0<=Q("d2server2").value&&(l='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
1245
-xxCiraServers[Q("d2server2").value].Name+"</Selector></SelectorSet></ReferenceParameters>");d=[];var p=[];b?e&&(0==Q("d2server1cira").value?d.push(e):p.push(e),l&&(0==Q("d2server2cira").value?d.push(l):p.push(l))):e&&(d.push(e),l&&d.push(l));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(c,Q("d2lifetime").value,a,d,p,PullRemoteAccess)}}var editEnvironmentDetectionTmp;
1245
+xxCiraServers[Q("d2server2").value].Name+"</Selector></SelectorSet></ReferenceParameters>");d=[];var n=[];b?e&&(0==Q("d2server1cira").value?d.push(e):n.push(e),l&&(0==Q("d2server2cira").value?d.push(l):n.push(l))):e&&(d.push(e),l&&d.push(l));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(c,Q("d2lifetime").value,a,d,n,PullRemoteAccess)}}var editEnvironmentDetectionTmp;
1246
function editEnvironmentDetection(b){1!=b&&(editEnvironmentDetectionTmp=xxEnvironementDetection.DetectionStrings?Clone(xxEnvironementDetection.DetectionStrings):[]);var c="";xxAccountAdminName&&(c+="Enter up to 5 intranet domain suffix. If the computer is outside these domains, Intel® AMT local ports will be closed and remote server connections will be active.<br><br>");0==editEnvironmentDetectionTmp.length&&(c+="<i>No intranet domains, Environement detection disabled.</i><br>");for(var a in editEnvironmentDetectionTmp)c+=
1247
"<div class=itemBar style=margin-right:0><div style=float:right>"+AddButton2("Remove","editEnvironmentDetectionRemove("+a+")")+'</div><div style=padding-top:3px;max-width:260px;overflow:hidden title="'+editEnvironmentDetectionTmp[a]+'"><b>'+editEnvironmentDetectionTmp[a]+"</b></div></div>";xxAccountAdminName&&5>editEnvironmentDetectionTmp.length&&(c+="<br><input id=edInput placeholder=intranet.org style=width:276px onkeyup=edInputChg() maxlength=63><input type=button id=edAdd value=Add style=width:80px;margin-left:5px onclick=editEnvironmentDetectionAdd()>");
1248
1==b?QH(65,c):setDialogMode(11,"Environment Detection",xxAccountAdminName?3:1,editEnvironmentDetectionDlg,c);edInputChg()}function editEnvironmentDetectionDlg(){if(xxAccountAdminName){var b=Clone(xxEnvironementDetection);b.DetectionStrings=editEnvironmentDetectionTmp;amtstack.Put("AMT_EnvironmentDetectionSettingData",b,editEnvironmentDetectionDlg2,0,1)}}
@@ -1321,10 +1321,10 @@ function powerActionResponse3(b,c,a,d){console.log("powerActionResponse3("+c+","
1321
function checkConsentDisplay(){amtstack.Get("IPS_SecIOService",checkConsentDisplayResponse1)}var xxchangeConsentDisplay=!1;
1322
function checkConsentDisplayResponse1(b,c,a,d){200==d&&(a.Body.DefaultScreen&&(a.Body.DefaultScreen=parseInt(a.Body.DefaultScreen)),a.Body.NumberOfScreens&&(a.Body.NumberOfScreens=parseInt(a.Body.NumberOfScreens)),1==xxchangeConsentDisplay?(xxchangeConsentDisplay=!1,a.Body.DefaultScreen=d6Display.value,amtstack.Put("IPS_SecIOService",a.Body,checkConsentDisplayResponse1)):(d6Display.value=a.Body.DefaultScreen,QV("d6ThirdDisplay",2<a.Body.NumberOfScreens)))}
1323
var xxStorage=null,xxStorageVendors=[],xxStorageApplications=[];function PullStorage(){amtFirstPull|=8;wsstack.comm.PerformAjax("",PullStorageResponse,null,0,"/amt-storage/","GET")}
1324
-function PullStorageResponse(b,c,a){0==amtstack.PendingBatchOperations&&refreshButtons(!0);if(200==c){QV("go21",!0);for(c=0;32>c;c++){do a=b.length,b=b.replace(String.fromCharCode(c),"");while(a>b.length)}try{xxStorage=JSON.parse(b)}catch(z){return}xxStorageVendors=[];xxStorageApplications=[];b=xxStorage.content;if(Array.isArray(b)){a={};for(c in b){var d=b[c].vendor?b[c].vendor:"";a[d]||(a[d]={});var e=b[c].app?b[c].app:"";a[d][e]||(a[d][e]={});b[c].name&&(a[d][e][b[c].name]=b[c])}xxStorage.content=
1325
-b=a}else{if(b["index.htm"]||b["logon.htm"])b[""]={"":{}};b["index.htm"]&&(b[""][""]["index.htm"]=b["index.htm"],delete b["index.htm"]);b["logon.htm"]&&(b[""][""]["logon.htm"]=b["logon.htm"],delete b["logon.htm"])}a=0;var d=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT storage for this computer.<br><br>",l,p,e="";for(c in b){var q=0,n;for(n in b[c]){q++;var m=0,v;for(v in b[c][n]){m++;if(c!=l||n!=p)""!=e&&(d+=e,e="<br>"),l=c,p=n,e=""!=c?e+EscapeHtml(c+" / "+n):e+
1326
-"Root";var h='"'+c+(""!=c?"/":"")+n+(""!=n?"/":"")+v+'"',e=e+('<div class=itemBar onclick=showStorageDetails("'+c+'","'+n+'","'+v+'",'+h+")><div style=float:right>"),e=e+(" "+AddButton2("Download","DownloadFromStorage("+h+',"'+v+'",event)')),e=e+("</div><div style=padding-top:3px><b>"+EscapeHtml(v)+"</b>, <i>"+b[c][n][v].size+" bytes</i></div></div>");a++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(n)&&xxStorageApplications.push(n)}0==m&&(wsstack.comm.PerformAjax("",
1327
-function(){},null,0,"/amt-storage/"+c+"/"+n,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==q&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=e&&(d+=e);0==a&&(d+="<div style=padding-left:15px><br><i>No files found.</i></div><br>");d+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullStorage()")+AddButton("Upload...","UploadToStorage()"));QH(57,d)}else QH(57,"Unable to load storage data...<br/>"+
1324
+function PullStorageResponse(b,c,a){0==amtstack.PendingBatchOperations&&refreshButtons(!0);if(200==c){QV("go21",!0);for(c=0;32>c;c++){do a=b.length,b=b.replace(String.fromCharCode(c),"");while(a>b.length)}try{xxStorage=JSON.parse(b)}catch(x){return}xxStorageVendors=[];xxStorageApplications=[];b=xxStorage.content;if(Array.isArray(b)){a={};for(c in b){var d=b[c].vendor?b[c].vendor:"";a[d]||(a[d]={});var e=b[c].app?b[c].app:"";a[d][e]||(a[d][e]={});b[c].name&&(a[d][e][b[c].name]=b[c])}xxStorage.content=
1325
+b=a}else{if(b["index.htm"]||b["logon.htm"])b[""]={"":{}};b["index.htm"]&&(b[""][""]["index.htm"]=b["index.htm"],delete b["index.htm"]);b["logon.htm"]&&(b[""][""]["logon.htm"]=b["logon.htm"],delete b["logon.htm"])}a=0;var d=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT storage for this computer.<br><br>",l,n,e="";for(c in b){var r=0,p;for(p in b[c]){r++;var m=0,v;for(v in b[c][p]){m++;if(c!=l||p!=n)""!=e&&(d+=e,e="<br>"),l=c,n=p,e=""!=c?e+EscapeHtml(c+" / "+p):e+
1326
+"Root";var h='"'+c+(""!=c?"/":"")+p+(""!=p?"/":"")+v+'"',e=e+('<div class=itemBar onclick=showStorageDetails("'+c+'","'+p+'","'+v+'",'+h+")><div style=float:right>"),e=e+(" "+AddButton2("Download","DownloadFromStorage("+h+',"'+v+'",event)')),e=e+("</div><div style=padding-top:3px><b>"+EscapeHtml(v)+"</b>, <i>"+b[c][p][v].size+" bytes</i></div></div>");a++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(p)&&xxStorageApplications.push(p)}0==m&&(wsstack.comm.PerformAjax("",
1327
+function(){},null,0,"/amt-storage/"+c+"/"+p,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==r&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=e&&(d+=e);0==a&&(d+="<div style=padding-left:15px><br><i>No files found.</i></div><br>");d+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullStorage()")+AddButton("Upload...","UploadToStorage()"));QH(57,d)}else QH(57,"Unable to load storage data...<br/>"+
1328
AddButton("Refresh","PullStorage()"))}function showStorageDetails(b,c,a,d){if(!xxdialogMode){var e="",l=xxStorage.content[b][c][a];""!=b&&(e+=addHtmlValue("Vendor",b));""!=c&&(e+=addHtmlValue("Application",c));e+=addHtmlValue("Name",a);e+=addHtmlValue("Size",l.size+" bytes");l.link&&(e+=addHtmlValue("Link",l.link));setDialogMode(11,"Storage Item",5,showStorageDetailsEx,e,d)}}
1329
function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")}function storageDeleteResponse(b,c){200!=c?messagebox("Storage",format("Unable to delete file (ERR{0}), check that the computer is powered on.",c)):PullStorage()}function DownloadFromStorage(b,c,a){xxdialogMode||(haltEvent(a),wsstack.comm.PerformAjax("",DownloadFromStorageEx,c,0,"/amt-storage/"+b,"GET"))}
1330
function DownloadFromStorageEx(b,c,a){200!=c||null==b?console.log(c,"Data = null"):saveAs(data2blob(b),a)}function OpenFromStorage(b,c){if(!xxdialogMode){haltEvent(c);var a=window.open("http://"+wsstack.comm.host+":"+wsstack.comm.port+"/amt-storage/"+b,"_blank");a.opener=null;a.focus()}}function PushToStorage(b,c,a){var d=null;7E3<c.length&&(d=[b,c.substring(7E3)],c=c.substring(0,7E3));wsstack.comm.PerformAjax(c,PushToStorageResponse,d,0,"/amt-storage/"+b+(1==a?"?append=":""),"PUT")}
@@ -1361,21 +1361,21 @@ function scriptLoadStartingBlocks(){var b=new XMLHttpRequest;b.onload=function()
1361
function scriptViewButton(b){script_BuilderView=b;QV("scripteditor",0==b);QV("scriptbuilder",1==b);QV("viewEditorButton",script_BuildingBlocks&&1==b);QV("viewBuilderButton",script_BuildingBlocks&&0==b)}
1362
function script_setBuildBlocks(b){script_BuildingBlocks=b;var c="";if(b)for(var a in b)95!=a.charCodeAt(0)&&(c+="<div id=sblock_"+a+' style=cursor:pointer;background-color:#ccc;width:auto;padding:5px;margin:2px ondblclick=script_faddblock("'+a+'") draggable=true ondragstart=script_fondragstart(event,this) ondragend=script_fondragend(event,this) title="'+b[a].desc+'"',c+=">"+b[a].name+"</div>");QH("blocks",c);script_fonfilterchanged();scriptViewButton(script_BuildingBlocks?1:0)}
1363
function script_faddblock(b){var c=Clone(script_BuildingBlocks[b]);c.id=Math.random();c.xname=b;script_BlockScript.push(c);script_BlockScriptSelectedId=script_BlockScript.length-1;fupdatescript()}function script_feditblock(b){xxdialogMode||setDialogMode(11,format("Edit {0}",script_BuildingBlocks[b].name),3,script_feditblockEx,"Edit this block? This operation will reset the block editor and load the block code into the code editor.",b)}
1364
-function script_feditblockEx(b,c){script_newScriptDlgOk();scriptViewButton(0);var a,d=script_BuildingBlocks[c];a=""+("##!BLOCK!##\r\n#id="+c+"\r\n#name="+d.name+"\r\n#desc="+d.desc+"\r\n##!BLOCK!##\r\n");for(var e in d.vars){var l=d.vars[e];a+="##!VAR!##\r\n#id="+e+"\r\n#name="+l.name+"\r\n#desc="+l.desc+"\r\n#type="+l.type+"\r\n";l.maxlength&&(a+="#maxlength="+l.maxlength+"\r\n");if(l.values)for(var p in l.values)a+="#values-"+p+"="+l.values[p]+"\r\n";a+="#value="+l.value+"\r\n##SWAP %%%"+e+"%%% "+
1364
+function script_feditblockEx(b,c){script_newScriptDlgOk();scriptViewButton(0);var a,d=script_BuildingBlocks[c];a=""+("##!BLOCK!##\r\n#id="+c+"\r\n#name="+d.name+"\r\n#desc="+d.desc+"\r\n##!BLOCK!##\r\n");for(var e in d.vars){var l=d.vars[e];a+="##!VAR!##\r\n#id="+e+"\r\n#name="+l.name+"\r\n#desc="+l.desc+"\r\n#type="+l.type+"\r\n";l.maxlength&&(a+="#maxlength="+l.maxlength+"\r\n");if(l.values)for(var n in l.values)a+="#values-"+n+"="+l.values[n]+"\r\n";a+="#value="+l.value+"\r\n##SWAP %%%"+e+"%%% "+
1365
l.value+"\r\n"}a+="##!VAR!##\r\n##SWAP %%%~%%% 0\r\n\r\n##!BLOCK!##\r\n"+d.code+"\r\n##!BLOCK!##\r\n";Q("scriptarea").value=a}
1366
-function script_fConvertScriptToJsonBlock(b){var c={};b=b.split("##!BLOCK!##\n");var a=b[1].split("\n"),d;for(d in a){var e=a[d].split("=");2==e.length&&(c[e[0].substring(1)]=e[1])}c.vars={};scriptvariables=b[2].split("##!VAR!##\n");for(d in scriptvariables){var a=scriptvariables[d].split("\n"),l={},p={},q=0,n;for(n in a)e=a[n].split("="),2==e.length&&e[1]&&e[0]&&0<e[0].length&&("#values-"==e[0].substring(0,8)?(p[e[0].substring(8)]=e[1],q++):l[e[0].substring(1)]=e[1]);l.id&&(0<q&&(l.values=p),a=l.id,
1366
+function script_fConvertScriptToJsonBlock(b){var c={};b=b.split("##!BLOCK!##\n");var a=b[1].split("\n"),d;for(d in a){var e=a[d].split("=");2==e.length&&(c[e[0].substring(1)]=e[1])}c.vars={};scriptvariables=b[2].split("##!VAR!##\n");for(d in scriptvariables){var a=scriptvariables[d].split("\n"),l={},n={},r=0,p;for(p in a)e=a[p].split("="),2==e.length&&e[1]&&e[0]&&0<e[0].length&&("#values-"==e[0].substring(0,8)?(n[e[0].substring(8)]=e[1],r++):l[e[0].substring(1)]=e[1]);l.id&&(0<r&&(l.values=n),a=l.id,
1367
delete l.id,c.vars[a]=l)}c.code=b[3];a=c.id;delete c.id;d={};d[a]=c;return JSON.stringify(d,null," ")}function script_fonfilterchanged(){var b=Q("blockfilter").value.toLowerCase(),c;for(c in script_BuildingBlocks)95!=c.charCodeAt(0)&&QV("sblock_"+c,0<=script_BuildingBlocks[c].name.toLowerCase().indexOf(b)||0<=script_BuildingBlocks[c].desc.toLowerCase().indexOf(b))}var script_fonclickDblClickDetectIndex=null,script_fonclickDblClickDetectTime=null;
1368
function script_fonclick(b,c){if(!xxdialogMode){script_BlockScriptSelectedId=null;c&&(c=fgetParentWithId(c),c.id.startsWith("xblock_")&&(script_BlockScriptSelectedId=c.id.substring(7)));fupdatescript();haltEvent(b);if(script_fonclickDblClickDetectIndex==script_BlockScriptSelectedId&&250>(new Date).getTime()-script_fonclickDblClickDetectTime)return script_foneditclick(script_BlockScriptSelectedId);script_fonclickDblClickDetectIndex=script_BlockScriptSelectedId;script_fonclickDblClickDetectTime=(new Date).getTime()}}
1369
function script_fondragstart(b,c){xxdialogMode||(c=fgetParentWithId(c),c.style.opacity="0.4",b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("scriptbuilder/block",c.id))}function script_fondragend(b,c){xxdialogMode||(c=fgetParentWithId(c),c.style.opacity="1.0")}function script_fondragenter(b,c){xxdialogMode||(fgetParentWithId(c).style["border-top"]="solid 2px black")}
1370
function script_fondragleave(b,c){if(!xxdialogMode){b=b.originalEvent||b;var a=document.elementFromPoint(b.pageX,b.pageY);c.contains(a)||(fgetParentWithId(c).style["border-top"]="none")}}
1371
function script_fondrop(b,c){if(!xxdialogMode){c=fgetParentWithId(c);var a,d=b.dataTransfer.getData("scriptbuilder/block"),e=parseInt(c.id.substring(7));""==d?documentFileSelectHandler(b):(d.startsWith("sblock_")?(a=Clone(script_BuildingBlocks[d.substring(7)]),a.id=Math.random(),a.xname=d.substring(7)):(d=parseInt(d.substring(7)),a=script_BlockScript[d],script_BlockScript.splice(d,1),e>d&&e--),"scriptblocks"==c.id?(a&&script_BlockScript.push(a),script_BlockScriptSelectedId=script_BlockScript.length-
1372
1):(script_BlockScript.splice(e,0,a),script_BlockScriptSelectedId=e),fupdatescript(),haltEvent(b))}}
1373
-function script_foneditclick(b){if(!xxdialogMode){var c=script_BlockScript[b];script_BlockScriptSelectedId=b;fupdatescript();if(null!=c){var a=c.vars?7:5,d=c.desc+"<br><br>";if(c.vars)for(var e in c.vars){var l=c.vars[e].value,p="";c.vars[e].maxlength&&(p+=" maxlength="+c.vars[e].maxlength);2==c.vars[e].type&&(p+=" onkeypress='return numbersOnly(event)'");if(1==c.vars[e].type||2==c.vars[e].type)l='<input title="'+c.vars[e].desc+'" id=scriptXvalue_'+e+' value="'+c.vars[e].value+'" '+p+" style=width:100%></input>";
1374
-if(3==c.vars[e].type){var l="<select title='"+c.vars[e].desc+"' id=scriptXvalue_"+e+" style=width:100%;padding:0;margin:0>",q;for(q in c.vars[e].values)l+="<option value="+q+(q==c.vars[e].value?" selected":"")+">"+c.vars[e].values[q]+"</option>";l+="</select>"}4==c.vars[e].type&&(l='<input type=password autocomplete=off title="'+c.vars[e].desc+'" id=scriptXvalue_'+e+' value="'+c.vars[e].value+'" '+p+" style=width:100%></input>");5==c.vars[e].type&&(l="");6==c.vars[e].type&&(l='<input type=file title="'+
1375
-c.vars[e].desc+'" id=scriptXvalue_'+e+" "+p+" style=width:100%></input>");d+='<table style=width:100% title="'+c.vars[e].desc+'"><td style=width:120px>'+c.vars[e].name+"<td><b>"+l+"</b></table>";if(5==c.vars[e].type){var d=d+("<ul id=scriptXvalue_"+e+' style="list-style-type:none;height:100px;overflow:auto;width:100%;border:1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0">'),n;for(n in c.vars[e].values)l="",0<=c.vars[e].value.indexOf(n)&&(l=" checked"),d+="<li><label><input type=checkbox id=scriptXvaluex_"+
1376
-e+"-"+n+""+l+">"+c.vars[e].values[n]+"</label></li>";d+="</ul>"}}}setDialogMode(11,c.name,a,script_foneditclickEx,d,b)}}
1377
-function script_foneditclickEx(b,c){if(!xxdialogMode){if(2==b)script_BlockScript.splice(c,1),script_BlockScriptSelectedId==c&&(script_BlockScriptSelectedId=null);else{var a=script_BlockScript[c];if(a.vars)for(var d in a.vars)if(5==a.vars[d].type){a.vars[d].value=[];for(var e in a.vars[d].values)Q("scriptXvaluex_"+d+"-"+e).checked&&a.vars[d].value.push(e)}else if(6==a.vars[d].type){var l=Q("scriptXvalue_"+d);if(1==l.files.length){var p=new FileReader;p.onload=function(b){a.vars[d].value=btoa(b.target.result);
1378
-fupdatescript()};p.readAsBinaryString(l.files[0])}}else a.vars[d].value=Q("scriptXvalue_"+d).value}fupdatescript()}}function fgetParentWithId(b){for(;!b.id;)b=b.parentElement;return b}
1373
+function script_foneditclick(b){if(!xxdialogMode){var c=script_BlockScript[b];script_BlockScriptSelectedId=b;fupdatescript();if(null!=c){var a=c.vars?7:5,d=c.desc+"<br><br>";if(c.vars)for(var e in c.vars){var l=c.vars[e].value,n="";c.vars[e].maxlength&&(n+=" maxlength="+c.vars[e].maxlength);2==c.vars[e].type&&(n+=" onkeypress='return numbersOnly(event)'");if(1==c.vars[e].type||2==c.vars[e].type)l='<input title="'+c.vars[e].desc+'" id=scriptXvalue_'+e+' value="'+c.vars[e].value+'" '+n+" style=width:100%></input>";
1374
+if(3==c.vars[e].type){var l="<select title='"+c.vars[e].desc+"' id=scriptXvalue_"+e+" style=width:100%;padding:0;margin:0>",r;for(r in c.vars[e].values)l+="<option value="+r+(r==c.vars[e].value?" selected":"")+">"+c.vars[e].values[r]+"</option>";l+="</select>"}4==c.vars[e].type&&(l='<input type=password autocomplete=off title="'+c.vars[e].desc+'" id=scriptXvalue_'+e+' value="'+c.vars[e].value+'" '+n+" style=width:100%></input>");5==c.vars[e].type&&(l="");6==c.vars[e].type&&(l='<input type=file title="'+
1375
+c.vars[e].desc+'" id=scriptXvalue_'+e+" "+n+" style=width:100%></input>");d+='<table style=width:100% title="'+c.vars[e].desc+'"><td style=width:120px>'+c.vars[e].name+"<td><b>"+l+"</b></table>";if(5==c.vars[e].type){var d=d+("<ul id=scriptXvalue_"+e+' style="list-style-type:none;height:100px;overflow:auto;width:100%;border:1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0">'),p;for(p in c.vars[e].values)l="",0<=c.vars[e].value.indexOf(p)&&(l=" checked"),d+="<li><label><input type=checkbox id=scriptXvaluex_"+
1376
+e+"-"+p+""+l+">"+c.vars[e].values[p]+"</label></li>";d+="</ul>"}}}setDialogMode(11,c.name,a,script_foneditclickEx,d,b)}}
1377
+function script_foneditclickEx(b,c){if(!xxdialogMode){if(2==b)script_BlockScript.splice(c,1),script_BlockScriptSelectedId==c&&(script_BlockScriptSelectedId=null);else{var a=script_BlockScript[c];if(a.vars)for(var d in a.vars)if(5==a.vars[d].type){a.vars[d].value=[];for(var e in a.vars[d].values)Q("scriptXvaluex_"+d+"-"+e).checked&&a.vars[d].value.push(e)}else if(6==a.vars[d].type){var l=Q("scriptXvalue_"+d);if(1==l.files.length){var n=new FileReader;n.onload=function(b){a.vars[d].value=btoa(b.target.result);
1378
+fupdatescript()};n.readAsBinaryString(l.files[0])}}else a.vars[d].value=Q("scriptXvalue_"+d).value}fupdatescript()}}function fgetParentWithId(b){for(;!b.id;)b=b.parentElement;return b}
1379
function fupdatescript(){var b="",c;for(c in script_BlockScript){b+="<div id=xblock_"+c+" style=cursor:pointer;min-height:24px;background-color:#"+(script_BlockScriptSelectedId==c?"aaa":"ccc")+';width:auto;padding:5px;margin:2px draggable=true onclick=script_fonclick(event,this) ondragenter=script_fondragenter(event,this) ondragleave=script_fondragleave(event,this) ondragstart=script_fondragstart(event,this) ondragend=script_fondragend(event,this) ondrop=script_fondrop(event,this) title="'+script_BlockScript[c].desc+
1380
'"';b+="><input style=float:right type=button value=Edit... onclick=script_foneditclick("+c+")><div style=font-size:16px><b>"+script_BlockScript[c].name+"</b>";if(script_BlockScript[c].vars){var a=0,b=b+'<table class="scriptBlockVar us" cellpadding=0 cellspacing=0 style=width:100%;border-radius:5px;margin-top:8px>',d;for(d in script_BlockScript[c].vars){var e=script_BlockScript[c].vars[d].value;4==script_BlockScript[c].vars[d].type&&0<script_BlockScript[c].vars[d].value.length&&(e="*****");3==script_BlockScript[c].vars[d].type&&
1381
(e=script_BlockScript[c].vars[d].values[script_BlockScript[c].vars[d].value]);6==script_BlockScript[c].vars[d].type&&(e=script_BlockScript[c].vars[d].value?"Binary file, "+script_BlockScript[c].vars[d].value.length+" bytes":"Not set");b+='<tr title="'+script_BlockScript[c].vars[d].desc+'"><td width=200px style="'+(0<a?"border-top:1px solid #a810a8":"")+'"><p>'+script_BlockScript[c].vars[d].name+'<td style="'+(0<a?"border-top:1px solid #a810a8":"")+'">'+e;a++}b+="<tr><td style=height:3px></table>"}b+=
@@ -1394,12 +1394,12 @@ function setDialogMode(b,c,a,d,e,l){xxdialogMode=b;xxdialogFunc=d;xxdialogButton
1394
function dialogclose(b){var c=xxdialogFunc,a=xxdialogButtons,d=xxdialogTag;setDialogMode();(a&8||b)&&c&&c(b,d)}
1395
function center(){QS("dialog").left=(getDocWidth()-400)/2+"px";var b=0,c=Q(8).offsetHeight-(0==fullscreen?126:53);""==QS(11).display&&(b+=32);""==QS(9).display&&(b+=32);QS(16).height=Q(8).offsetHeight-b-(0==fullscreen?16:0)+"px";QS("Desk")["max-height"]=c-b+"px";QS("Desk")["max-width"]=Q(8).offsetWidth-(0==fullscreen?32:0)+"px";0!=Q(43).offsetWidth&&(QS("Desk")["max-width"]=Q(43).offsetWidth);
1396
fullscreen?(QS(16)["overflow-y"]="hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(16)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(62,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(62,c);setDialogMode(1,b)}
1397
-function SaveJsonFile(b,c,a,d){var e="",l={},p=new Date;amtsysstate&&(e="-"+amtsysstate.AMT_GeneralSettings.response.HostName,l={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(l.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));e+="-"+p.getFullYear()+"-"+("0"+(p.getMonth()+1)).slice(-2)+"-"+("0"+
1398
-p.getDate()).slice(-2)+"-"+("0"+p.getHours()).slice(-2)+"-"+("0"+p.getMinutes()).slice(-2);l[c]=d;saveAs(data2blob(JSON.stringify(l,null," ").replace(/\n/g,"\r\n")),b+e+".json")}var httpErrorTable={200:"OK",401:"Authentication Error",408:"Timeout Error",601:"WSMAN Parsing Error",602:"Unable to parse HTTP response header",603:"Unexpected HTTP enum response",604:"Unexpected HTTP pull response",997:"Invalid Digest Realm"};
1397
+function SaveJsonFile(b,c,a,d){var e="",l={},n=new Date;amtsysstate&&(e="-"+amtsysstate.AMT_GeneralSettings.response.HostName,l={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(l.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));e+="-"+n.getFullYear()+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+("0"+
1398
+n.getDate()).slice(-2)+"-"+("0"+n.getHours()).slice(-2)+"-"+("0"+n.getMinutes()).slice(-2);l[c]=d;saveAs(data2blob(JSON.stringify(l,null," ").replace(/\n/g,"\r\n")),b+e+".json")}var httpErrorTable={200:"OK",401:"Authentication Error",408:"Timeout Error",601:"WSMAN Parsing Error",602:"Unable to parse HTTP response header",603:"Unexpected HTTP enum response",604:"Unexpected HTTP pull response",997:"Invalid Digest Realm"};
1399
function errcheck(b,c){if(null==wsstack||amtstack!=c)return!0;200!=b&&9!=b&&(setDialogMode(),wsstack.comm.FailAllError=999,amtstack.CancelAllQueries(999),QH(5,httpErrorTable[b]?httpErrorTable[b]:format("Error #{0}",b)),401==b&&QH(5,'Authentication Error<br /><br /><input type=button value="Set new credentials" onclick=meshcentral2credCallback(true)></input>'),go(100),QS(3).width=0);return 200!=b}
1400
function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(15).src.endsWith(a))Q(15).src=a;QV(16,!1);QV(14,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(14,!1);QV(16,!0);QV(4,100==b);QV(6,100>b);for(var a=0;80>a;a++){QV("p"+a,a==b);var d=QS("go"+a);d&&(d["background-color"]=a==b?"#abcae1":"");d&&(d["background-color"]=a==b?"gray":"")}currentView=b;center()}}
1401
function portsFromHost(b,c){var a=decodeURIComponent(b).split(":"),d=0==c?16992:16993,e=0==c?16994:16995;1<a.length&&(d=parseInt(a[1]));2<a.length&&(e=parseInt(a[2]));return{host:a[0],http:d,redir:e}}function addLink(b,c){return"<a style=cursor:pointer;color:blue onclick='"+c+"'>♦ "+b+"</a>"}function addLinkConditional(b,c,a){return a?addLink(b,c):b}function haltEvent(b){b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1}
1402
-function addOption(b,c,a){var d=document.createElement("option");d.text=c;d.value=a;Q(b).add(d)}function addDisabledOption(b,c,a){var d=document.createElement("option");d.text=c;d.value=a;d.disabled=1;Q(b).add(d)}function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,e=0,l;for(l in b){var p=b.charCodeAt(l);64<p&&91>p?c=1:96<p&&123>p?a=1:47<p&&58>p?d=1:e=1}return 4==c+a+d+e}
1402
+function addOption(b,c,a){var d=document.createElement("option");d.text=c;d.value=a;Q(b).add(d)}function addDisabledOption(b,c,a){var d=document.createElement("option");d.text=c;d.value=a;d.disabled=1;Q(b).add(d)}function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,e=0,l;for(l in b){var n=b.charCodeAt(l);64<n&&91>n?c=1:96<n&&123>n?a=1:47<n&&58>n?d=1:e=1}return 4==c+a+d+e}
1403
function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Call Error",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"<table class='log1 us' cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=200px><p><td>"}function TableStart2(){return"<table class='log1 us' cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><p><td>"}
1404
function TableEntry(b,c){return"<tr><td class=r1><p>"+b+"<td class=r1>"+c}function FullTable(b,c){var a=TableStart();for(i in b)i&&b[i]&&(a+=TableEntry(i,b[i]));return a+TableEnd(c)}function TableEnd(b){return"<tr><td colspan=2><p>"+(b?b:"")+"</table>"}function AddButton(b,c){return"<input type=button value='"+b+"' onclick='"+c+"' style=margin:4px>"}function AddButton2(b,c,a){return"<input type=button value='"+b+"' onclick='"+c+"' "+a+">"}
1405
function AddRefreshButton(b){return"<input type=button name=refreshbtn value=Refresh onclick='refreshButtons(false);"+b+"' style=margin:4px "+(0==refreshButtonsState?"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>'}
public/scripts/amt-terminal-0.0.2.js
+16
-2
@@ -49,6 +49,12 @@ var CreateAmtRemoteTerminal = function (divid, options) {
49
var _scrollRegion;
50
var _altKeypadMode = false;
51
var scrollBackBuffer = [];
52
+ // ###BEGIN###{Terminal-Enumation-UTF8}
53
+ //var utf8decodeBuffer = '';
54
+ // ###END###{Terminal-Enumation-UTF8}
55
+ // ###BEGIN###{Terminal-Enumation-All}
56
+ var utf8decodeBuffer = '';
57
+ // ###END###{Terminal-Enumation-All}
58
obj.title = null;
59
obj.onTitleChange = null;
60
@@ -73,10 +79,12 @@ var CreateAmtRemoteTerminal = function (divid, options) {
79
obj.ProcessData = function (str) {
80
if (obj.debugmode == 2) { console.log("TRecv(" + str.length + "): " + rstr2hex(str)); }
81
// ###BEGIN###{Terminal-Enumation-UTF8}
76
- //str = decode_utf8(str);
82
+ //try { str = decode_utf8(utf8decodeBuffer + str); } catch (ex) { utf8decodeBuffer += str; return; } // If we get data in the middle of a UTF-8 code, buffer it for next time.
83
+ //utf8decodeBuffer = '';
84
// ###END###{Terminal-Enumation-UTF8}
85
// ###BEGIN###{Terminal-Enumation-All}
79
- if (obj.terminalEmulation == 0) { str = decode_utf8(str); }
86
+ if (obj.terminalEmulation == 0) { try { str = decode_utf8(utf8decodeBuffer + str); } catch (ex) { utf8decodeBuffer += str; return; } } // If we get data in the middle of a UTF-8 code, buffer it for next time.
87
+ utf8decodeBuffer = '';
88
// ###END###{Terminal-Enumation-All}
89
if (obj.capture != null) obj.capture += str; _ProcessVt100EscString(str); obj.TermDraw();
90
}
@@ -604,6 +612,12 @@ var CreateAmtRemoteTerminal = function (divid, options) {
612
_scrollRegion = [0, (obj.height - 1)];
613
_altKeypadMode = false;
614
obj.TermClear(7 << 6);
615
+ // ###BEGIN###{Terminal-Enumation-UTF8}
616
+ //utf8decodeBuffer = '';
617
+ // ###END###{Terminal-Enumation-UTF8}
618
+ // ###BEGIN###{Terminal-Enumation-All}
619
+ utf8decodeBuffer = '';
620
+ // ###END###{Terminal-Enumation-All}
621
}
622
623
function _EraseCursorToEol() {
public/translations/player-min_cs.htm
new
+1
@@ -0,0 +1 @@
1
+<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><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,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script src=scripts/agent-desktop-0.0.2.js></script><script src=scripts/amt-desktop-0.0.2.js></script><script src=scripts/amt-terminal-0.0.2.js></script><script src=scripts/zlib.js></script><script src=scripts/zlib-inflate.js></script><script src=scripts/zlib-adler32.js></script><script src=scripts/zlib-crc32.js></script><body style=overflow:hidden;background-color:#000><div id=p11 class=noselect style=overflow:hidden><div id=deskarea0><div id=deskarea1 class=areaHead><div class=toright2><div class=deskareaicon title="Toggle View Mode"onclick=toggleAspectRatio(1)>⇲</div></div><div><input id=OpenFileButton type=button value="Otevřít soubor..."onclick=openfile()> <span id=deskstatus></span></div></div><div id=deskarea2><div class=areaProgress><div id=progressbar></div></div></div><div id=deskarea3x style="max-height:calc(100vh - 54px);height:calc(100vh - 54px)"onclick=togglePause()><div id=bigok style="display:none;left:calc((100vh / 2))"><b>✓</b></div><div id=bigfail style="display:none;left:calc((100vh / 2))"><b>✗</b></div><div id=metadatadiv style=padding:20px;color:#d3d3d3;text-align:left;display:none></div><div id=DeskParent><canvas id=Desk width=640 height=480></canvas></div><div id=TermParent style=display:none><pre id=Term></pre></div><div id=p11DeskConsoleMsg style=display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:#ff0;background-color:rgba(0,0,0,.6);padding:10px;border-radius:5px onclick=clearConsoleMsg()></div></div><div id=deskarea4 class=areaFoot><div class=toright2><div id=timespan style=padding-top:4px;padding-right:4px>00:00:00</div></div><div> <input id=PlayButton type=button value=Play disabled onclick=play()> <input id=PauseButton type=button value=Pause disabled onclick=pause()> <input id=RestartButton type=button value=Restart disabled onclick=restart()> <select id=PlaySpeed onchange=this.blur()><option value=4>1/4 Speed<option value=2>1/2 Speed<option value=1 selected>Normalní rychlost<option value=0.5>2x rychlost<option value=0.25>4x Speed<option value=0.1>10x Speed</select></div></div></div><div id=dialog class=noselect style=display:none><div id=dialogHeader><div tabindex=0 id=id_dialogclose onclick=setDialogMode() onkeypress='"Enter"==event.key&&setDialogMode()'>✖</div><div id=id_dialogtitle></div></div><div id=dialogBody><div id=dialog1><div id=id_dialogMessage></div></div><div id=dialog2><div id=id_dialogOptions></div></div></div><div id=idx_dlgButtonBar><input id=idx_dlgCancelButton type=button value=Zrušit onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK onclick=dialogclose(1)><div><input id=idx_dlgDeleteButton type=button value=Smazat style=display:none onclick=dialogclose(2)></div></div></div></div><script>var recFile=null,recFilePtr=0,recFileStartTime=0,recFileLastTime=0,recFileEndTime=0,recFileMetadata=null,recFileProtocol=0,agentDesktop=null,amtDesktop=null,playing=!1,readState=0,waitTimer=null,waitTimerArgs=null,deskAspectRatio=0,currentDeltaTimeTotalSec=0;function start(){window.onresize=deskAdjust,document.ondrop=ondrop,document.ondragover=ondragover,document.ondragleave=ondragleave,document.onkeypress=onkeypress,Q("PlaySpeed").value=1,cleanup()}function readNextBlock(l){if(recFilePtr+16>recFile.size)QS("progressbar").width="100%",l(-1);else{var e=new FileReader;e.onload=function(){var e=ReadShort(this.result,0),t=ReadShort(this.result,2),a=ReadInt(this.result,4),r=(ReadInt(this.result,8)<<32)+ReadInt(this.result,12);if(recFilePtr+16+a>recFile.size)QS("progressbar").width="100%",l(-1);else{var i=new FileReader;i.onload=function(){recFilePtr+=16+a,QS("progressbar").width=0==recFileEndTime?Math.floor(recFilePtr/recFile.size*100)+"%":Math.floor((recFileLastTime-recFileStartTime)/(recFileEndTime-recFileStartTime)*100)+"%",l(e,t,r,this.result)},i.readAsBinaryString(recFile.slice(recFilePtr+16,recFilePtr+16+a))}},e.readAsBinaryString(recFile.slice(recFilePtr,recFilePtr+16))}}function readLastBlock(i){if(recFile.size<32)i(-1);else{var e=new FileReader;e.onload=function(){var e=ReadShort(this.result,0),t=ReadShort(this.result,2),a=ReadInt(this.result,4),r=(ReadInt(this.result,8)<<32)+ReadInt(this.result,12);3==e&&16==a&&"MeshCentralMCREC"==this.result.substring(16,32)?i(e,t,r):i(-1)},e.readAsBinaryString(recFile.slice(recFile.size-32,recFile.size))}}function addInfo(e,t){return null==t?"":addInfoNoEsc(e,EscapeHtml(t))}function addInfoNoEsc(e,t){return null==t?"":"<span style=color:gray>"+EscapeHtml(e)+"</span>: <span style=font-size:20px>"+t+"</span><br/>"}function processFirstBlock(e,t,a,r){if(recFileProtocol=0,1==e&&0==t){try{recFileMetadata=JSON.parse(r)}catch(e){return void cleanup()}if(null!=recFileMetadata&&"MeshCentralRelaySession"==recFileMetadata.magic&&1==recFileMetadata.ver){var i="";if(i+=addInfo("Time",recFileMetadata.time),0!=recFileEndTime){var l=Math.floor((recFileEndTime-a)/1e3);i+=addInfo("Duration",format("{0} second{1}",l,1<l?"s":""))}if(i+=addInfo("Uživatel",recFileMetadata.username),i+=addInfo("UserID",recFileMetadata.userid),i+=addInfo("SessionID",recFileMetadata.sessionid),recFileMetadata.ipaddr1&&recFileMetadata.ipaddr2&&(i+=addInfo("Addresses",format("{0} to {1}",recFileMetadata.ipaddr1,recFileMetadata.ipaddr2))),recFileMetadata.devicename&&(i+=addInfo("DeviceName",recFileMetadata.devicename)),i+=addInfo("NodeID",recFileMetadata.nodeid),recFileMetadata.protocol){var n=recFileMetadata.protocol;1==n?n="MeshCentral Terminal":2==n?n="MeshCentral Desktop":100==n?n="Intel® AMT WSMAN":101==n&&(n="Intel® AMT Redirection"),i+=addInfoNoEsc("Protokol",n)}QV("DeskParent",!0),QV("TermParent",!1),1==recFileMetadata.protocol?(recFileProtocol=1,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a):2==recFileMetadata.protocol?(recFileProtocol=2,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a,(agentDesktop=CreateAgentRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,agentDesktop.State=3,deskAdjust()):101==recFileMetadata.protocol&&(recFileProtocol=101,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a,(amtDesktop=CreateAmtRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,amtDesktop.State=3,amtDesktop.Start(),deskAdjust()),QV("metadatadiv",!0),QH("metadatadiv",i),QH("deskstatus",recFile.name)}else cleanup()}else cleanup()}function processBlock(e,t,a,r){if(e<0)pause();else{var i=Math.round((a-recFileLastTime)*parseFloat(Q("PlaySpeed").value));i<5?processBlockEx(e,t,a,r):(waitTimerArgs=[e,t,a,r],waitTimer=setTimeout(function(){waitTimer=null,processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3])},i))}}function processBlockEx(e,t,a,r){if(0!=playing){var i=0!=(1&t),l=0!=(2&t),n=Math.floor((a-recFileStartTime)/1e3);if(currentDeltaTimeTotalSec!=n){currentDeltaTimeTotalSec=n;var o=Math.floor(n/3600);n-=3600*o;var s=Math.floor(n/60);n-=60*o;var c=Math.floor(n);QH("timespan",pad2(o)+":"+pad2(s)+":"+pad2(c))}2==e&&i&&!l?1==recFileProtocol?agentTerminal.ProcessData(r):2==recFileProtocol?agentDesktop.ProcessData(r):101==recFileProtocol&&(0==readState&&"4100000000000000"==rstr2hex(r)?(readState=1,8<r.length&&amtDesktop.ProcessData(r.substring(8))):1==readState&&amtDesktop.ProcessData(r)):2==e&&i&&l&&101==recFileProtocol&&"0000000008080001000700070003050200000000"==rstr2hex(r)&&(amtDesktop.bpp=1),recFileLastTime=a,playing&&readNextBlock(processBlock)}}function cleanup(){recFilePtr=0,playing=!1,(recFileMetadata=recFile=null)!=agentDesktop&&(agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height),agentDesktop=null),null!=amtDesktop&&(amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height),amtDesktop=null),recFileEndTime=currentDeltaTimeTotalSec=readState=0,(agentTerminal=waitTimerArgs=null)!=waitTimer&&(clearTimeout(waitTimer),waitTimer=null),QH("deskstatus",""),QE("PlayButton",!1),QE("PauseButton",!1),QE("RestartButton",!1),QS("progressbar").width="0px",QH("timespan","00:00:00"),QV("metadatadiv",!0),QH("metadatadiv",'<span style="font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:28px">MeshCentral Session Player</span><br /><br /><span style=color:gray>Drag & drop a .mcrec file or click "Open File..."</span>'),QV("DeskParent",!0),QV("TermParent",!1)}function ondrop(e){if(haltEvent(e),QV("bigfail",!1),QV("bigok",!1),null!=e.dataTransfer){var t=[];for(var a in e.dataTransfer.files)null!=e.dataTransfer.files[a].type&&null!=e.dataTransfer.files[a].size&&0!=e.dataTransfer.files[a].size&&e.dataTransfer.files[a].name.endsWith(".mcrec")&&t.push(e.dataTransfer.files[a]);0!=t.length&&(cleanup(),recFile=t[0],recFilePtr=0,readNextBlock(processFirstBlock),readLastBlock(function(e,t,a){recFileEndTime=3==e?a:0}))}}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,dragtimer=null;function ondragover(e){haltEvent(e),null!=dragtimer&&(clearTimeout(dragtimer),dragtimer=null);QV("bigok",!0),QV("bigfail",!1)}function ondragleave(e){haltEvent(e),dragtimer=setTimeout(function(){QV("bigfail",!1),QV("bigok",!1),dragtimer=null},10)}function onkeypress(e){xxdialogMode||(" "==e.key&&(togglePause(),haltEvent(e)),"1"==e.key&&(Q("PlaySpeed").value=4,haltEvent(e)),"2"==e.key&&(Q("PlaySpeed").value=2,haltEvent(e)),"3"==e.key&&(Q("PlaySpeed").value=1,haltEvent(e)),"4"==e.key&&(Q("PlaySpeed").value=.5,haltEvent(e)),"5"==e.key&&(Q("PlaySpeed").value=.25,haltEvent(e)),"6"==e.key&&(Q("PlaySpeed").value=.1,haltEvent(e)),"0"==e.key&&(pause(),restart(),haltEvent(e)))}function openfile(){setDialogMode(2,"Otevřít soubor...",3,openfileEx,'<input type=file name=files id=p2fileinput style=width:100% accept=".mcrec" onchange="openfileChanged()" />'),QE("idx_dlgOkButton",!1)}function openfileEx(){var e=Q("p2fileinput").files;if(null!=e){var t=[];for(var a in e)null!=e[a].type&&null!=e[a].size&&0!=e[a].size&&e[a].name.endsWith(".mcrec")&&t.push(e[a])}0!=t.length&&(cleanup(),recFile=t[0],recFilePtr=0,readNextBlock(processFirstBlock),readLastBlock(function(e,t,a){recFileEndTime=3==e?a:0}),Q("OpenFileButton").blur())}function openfileChanged(){var e=Q("p2fileinput").files;if(null!=e){var t=[];for(var a in e)null!=e[a].type&&null!=e[a].size&&0!=e[a].size&&e[a].name.endsWith(".mcrec")&&t.push(e[a])}QE("idx_dlgOkButton",1==t.length)}function togglePause(){return null!=recFile&&(1==playing?pause():recFilePtr!=recFile.size&&play()),!1}function play(){Q("PlayButton").blur(),1!=playing&&0!=recFileProtocol&&(playing=!0,QV("metadatadiv",!1),QE("PlayButton",!1),QE("PauseButton",!0),QE("RestartButton",!1),1==recFileProtocol&&null==agentTerminal&&(QV("DeskParent",!1),QV("TermParent",!0),agentTerminal=CreateAmtRemoteTerminal("Term",{}),agentTerminal.State=3),readNextBlock(processBlock))}function pause(){Q("PauseButton").blur(),0!=playing&&(playing=!1,QE("PlayButton",recFilePtr!=recFile.size),QE("PauseButton",!1),QE("RestartButton",0!=recFilePtr),null!=waitTimer&&(clearTimeout(waitTimer),waitTimer=null,processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]),waitTimerArgs=null))}function restart(){Q("RestartButton").blur(),1!=playing&&(currentDeltaTimeTotalSec=readState=recFilePtr=0,QV("metadatadiv",!0),QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),QS("progressbar").width="0px",QH("timespan","00:00:00"),QV("DeskParent",!0),QV("TermParent",!1),agentDesktop?agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height):amtDesktop?(amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height),(amtDesktop=CreateAmtRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,amtDesktop.State=3,amtDesktop.Start()):agentTerminal=agentTerminal&&null)}function clearConsoleMsg(){QH("p11DeskConsoleMsg","")}function toggleAspectRatio(e){1===e&&(deskAspectRatio=(deskAspectRatio+1)%3),deskAdjust()}function deskAdjust(){var e=Q("DeskParent").clientHeight,t=Q("DeskParent").clientWidth,a=Q("Desk").height,r=Q("Desk").width;if(2==deskAspectRatio)QS("Desk")["margin-top"]=null,QS("Desk").height="100%",QS("Desk").width="100%",QS("DeskParent").overflow="hidden";else if(1==deskAspectRatio)QS("Desk")["margin-top"]="0px",QS("Desk").height=a+"px",QS("Desk").width=r+"px",QS("DeskParent").overflow="scroll";else{if(a/r<e/t){var i=a*t/r+"px";QS("Desk").height=i,QS("Desk").width="100%"}else{var l=r*e/a+"px";QS("Desk").height="100%",QS("Desk").width=l}QS("Desk")["margin-top"]=null,QS("DeskParent").overflow="hidden"}}var xxcurrentView=-1;function setDialogMode(e,t,a,r,i,l){xxdialogMode=e,xxdialogFunc=r,xxdialogButtons=a,xxdialogTag=l,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&a),QV("idx_dlgCancelButton",2&a),QV("id_dialogclose",2&a||8&a),QV("idx_dlgDeleteButton",4&a),QV("idx_dlgButtonBar",7&a),t&&QH("id_dialogtitle",t);for(var n=1;n<3;n++)QV("dialog"+n,n==e);QV("dialog",e),i&&(2==e?QH("id_dialogOptions",i):QH("id_dialogMessage",i))}function dialogclose(e){var t=xxdialogFunc,a=xxdialogButtons,r=xxdialogTag;setDialogMode(),(8&a||e)&&t&&t(e,r)}function messagebox(e,t){setSessionActivity(),QH("id_dialogMessage",t),setDialogMode(1,e,1)}function statusbox(e,t){setSessionActivity(),QH("id_dialogMessage",t),setDialogMode(1,e)}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function pad2(e){var t="00"+e;return t.substr(t.length-2)}function format(e){var a=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,t){return void 0!==a[t]?a[t]:e})}start()</script>
\ No newline at end of file
public/translations/player_cs.htm
new
+537
@@ -0,0 +1,537 @@
1
+<!DOCTYPE html><html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head>
2
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3
+ <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
4
+ <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
5
+ <meta name="apple-mobile-web-app-capable" content="yes">
6
+ <meta name="format-detection" content="telephone=no">
7
+ <link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS">
8
+ <script type="text/javascript" src="scripts/common-0.0.1.js"></script>
9
+ <script type="text/javascript" src="scripts/agent-desktop-0.0.2.js"></script>
10
+ <script type="text/javascript" src="scripts/amt-desktop-0.0.2.js"></script>
11
+ <script type="text/javascript" src="scripts/amt-terminal-0.0.2.js"></script>
12
+ <script type="text/javascript" src="scripts/zlib.js"></script>
13
+ <script type="text/javascript" src="scripts/zlib-inflate.js"></script>
14
+ <script type="text/javascript" src="scripts/zlib-adler32.js"></script>
15
+ <script type="text/javascript" src="scripts/zlib-crc32.js"></script>
16
+</head>
17
+<body style="overflow:hidden;background-color:black">
18
+ <div id="p11" class="noselect" style="overflow:hidden">
19
+ <div id="deskarea0">
20
+ <div id="deskarea1" class="areaHead">
21
+ <div class="toright2">
22
+ <div class="deskareaicon" title="Toggle View Mode" onclick="toggleAspectRatio(1)">⇲</div>
23
+ </div>
24
+ <div>
25
+ <input id="OpenFileButton" type="button" value="Otevřít soubor..." onclick="openfile()">
26
+ <span id="deskstatus"></span>
27
+ </div>
28
+ </div>
29
+ <div id="deskarea2" style="">
30
+ <div class="areaProgress"><div id="progressbar" style=""></div></div>
31
+ </div>
32
+ <div id="deskarea3x" style="max-height:calc(100vh - 54px);height:calc(100vh - 54px);" onclick="togglePause()">
33
+ <div id="bigok" style="display:none;left:calc((100vh / 2))"><b>✓</b></div>
34
+ <div id="bigfail" style="display:none;left:calc((100vh / 2))"><b>✗</b></div>
35
+ <div id="metadatadiv" style="padding:20px;color:lightgrey;text-align:left;display:none"></div>
36
+ <div id="DeskParent">
37
+ <canvas id="Desk" width="640" height="480"></canvas>
38
+ </div>
39
+ <div id="TermParent" style="display:none">
40
+ <pre id="Term"></pre>
41
+ </div>
42
+ <div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="clearConsoleMsg()"></div>
43
+ </div>
44
+ <div id="deskarea4" class="areaFoot">
45
+ <div class="toright2">
46
+ <div id="timespan" style="padding-top:4px;padding-right:4px">00:00:00</div>
47
+ </div>
48
+ <div>
49
+
50
+ <input id="PlayButton" type="button" value="Play" disabled="disabled" onclick="play()">
51
+ <input id="PauseButton" type="button" value="Pause" disabled="disabled" onclick="pause()">
52
+ <input id="RestartButton" type="button" value="Restart" disabled="disabled" onclick="restart()">
53
+ <select id="PlaySpeed" onchange="this.blur();">
54
+ <option value="4">1/4 Speed</option>
55
+ <option value="2">1/2 Speed</option>
56
+ <option value="1" selected="">Normalní rychlost</option>
57
+ <option value="0.5">2x rychlost</option>
58
+ <option value="0.25">4x Speed</option>
59
+ <option value="0.1">10x Speed</option>
60
+ </select>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ <div id="dialog" class="noselect" style="display:none">
65
+ <div id="dialogHeader">
66
+ <div tabindex="0" id="id_dialogclose" onclick="setDialogMode()" onkeypress="if (event.key == 'Enter') setDialogMode()">✖</div>
67
+ <div id="id_dialogtitle"></div>
68
+ </div>
69
+ <div id="dialogBody">
70
+ <div id="dialog1">
71
+ <div id="id_dialogMessage" style=""></div>
72
+ </div>
73
+ <div id="dialog2" style="">
74
+ <div id="id_dialogOptions"></div>
75
+ </div>
76
+ </div>
77
+ <div id="idx_dlgButtonBar">
78
+ <input id="idx_dlgCancelButton" type="button" value="Zrušit" style="" onclick="dialogclose(0)">
79
+ <input id="idx_dlgOkButton" type="button" value="OK" style="" onclick="dialogclose(1)">
80
+ <div><input id="idx_dlgDeleteButton" type="button" value="Smazat" style="display:none" onclick="dialogclose(2)"></div>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ <script>
85
+ var recFile = null;
86
+ var recFilePtr = 0;
87
+ var recFileStartTime = 0;
88
+ var recFileLastTime = 0;
89
+ var recFileEndTime = 0;
90
+ var recFileMetadata = null;
91
+ var recFileProtocol = 0;
92
+ var agentDesktop = null;
93
+ var amtDesktop = null;
94
+ var playing = false;
95
+ var readState = 0;
96
+ var waitTimer = null;
97
+ var waitTimerArgs = null;
98
+ var deskAspectRatio = 0;
99
+ var currentDeltaTimeTotalSec = 0;
100
+
101
+ function start() {
102
+ window.onresize = deskAdjust;
103
+ document.ondrop = ondrop;
104
+ document.ondragover = ondragover;
105
+ document.ondragleave = ondragleave;
106
+ document.onkeypress = onkeypress;
107
+ Q('PlaySpeed').value = 1;
108
+ cleanup();
109
+ }
110
+
111
+ function readNextBlock(func) {
112
+ if ((recFilePtr + 16) > recFile.size) { QS('progressbar').width = '100%'; func(-1); } else {
113
+ var fr = new FileReader();
114
+ fr.onload = function () {
115
+ var type = ReadShort(this.result, 0);
116
+ var flags = ReadShort(this.result, 2);
117
+ var size = ReadInt(this.result, 4);
118
+ var time = (ReadInt(this.result, 8) << 32) + ReadInt(this.result, 12);
119
+ if ((recFilePtr + 16 + size) > recFile.size) { QS('progressbar').width = '100%'; func(-1); } else {
120
+ var fr2 = new FileReader();
121
+ fr2.onload = function () {
122
+ recFilePtr += (16 + size);
123
+ if (recFileEndTime == 0) {
124
+ // File pointer progress bar
125
+ QS('progressbar').width = Math.floor(100 * (recFilePtr / recFile.size)) + '%';
126
+ } else {
127
+ // Time progress bar
128
+ QS('progressbar').width = Math.floor(((recFileLastTime - recFileStartTime) / (recFileEndTime - recFileStartTime)) * 100) + '%';
129
+ }
130
+ func(type, flags, time, this.result);
131
+ };
132
+ fr2.readAsBinaryString(recFile.slice(recFilePtr + 16, recFilePtr + 16 + size));
133
+ }
134
+ };
135
+ fr.readAsBinaryString(recFile.slice(recFilePtr, recFilePtr + 16));
136
+ }
137
+ }
138
+
139
+ function readLastBlock(func) {
140
+ if (recFile.size < 32) { func(-1); } else {
141
+ var fr = new FileReader();
142
+ fr.onload = function () {
143
+ var type = ReadShort(this.result, 0);
144
+ var flags = ReadShort(this.result, 2);
145
+ var size = ReadInt(this.result, 4);
146
+ var time = (ReadInt(this.result, 8) << 32) + ReadInt(this.result, 12);
147
+ if ((type == 3) && (size == 16) && (this.result.substring(16, 32) == 'MeshCentralMCREC')) { func(type, flags, time); } else { func(-1); }
148
+ };
149
+ fr.readAsBinaryString(recFile.slice(recFile.size - 32, recFile.size));
150
+ }
151
+ }
152
+
153
+ function addInfo(name, value) { if (value == null) return ''; return addInfoNoEsc(name, EscapeHtml(value)); }
154
+
155
+ function addInfoNoEsc(name, value) {
156
+ if (value == null) return '';
157
+ return '<span style=color:gray>' + EscapeHtml(name) + '</span>: <span style=font-size:20px>' + value + '</span><br/>';
158
+ }
159
+
160
+ function processFirstBlock(type, flags, time, data) {
161
+ recFileProtocol = 0;
162
+ if ((type != 1) || (flags != 0)) { cleanup(); return; }
163
+ try { recFileMetadata = JSON.parse(data) } catch (ex) { cleanup(); return; }
164
+ if ((recFileMetadata == null) || (recFileMetadata.magic != 'MeshCentralRelaySession') || (recFileMetadata.ver != 1)) { cleanup(); return; }
165
+ var x = '';
166
+ x += addInfo("Time", recFileMetadata.time);
167
+ if (recFileEndTime != 0) { var secs = Math.floor((recFileEndTime - time) / 1000); x += addInfo("Duration", format("{0} second{1}", secs, (secs > 1) ? 's' : '')); }
168
+ x += addInfo("Uživatel", recFileMetadata.username);
169
+ x += addInfo("UserID", recFileMetadata.userid);
170
+ x += addInfo("SessionID", recFileMetadata.sessionid);
171
+ if (recFileMetadata.ipaddr1 && recFileMetadata.ipaddr2) { x += addInfo("Addresses", format("{0} to {1}", recFileMetadata.ipaddr1, recFileMetadata.ipaddr2)); }
172
+ if (recFileMetadata.devicename) { x += addInfo("DeviceName", recFileMetadata.devicename); }
173
+ x += addInfo("NodeID", recFileMetadata.nodeid);
174
+ if (recFileMetadata.protocol) {
175
+ var p = recFileMetadata.protocol;
176
+ if (p == 1) { p = "MeshCentral Terminal"; }
177
+ else if (p == 2) { p = "MeshCentral Desktop"; }
178
+ else if (p == 100) { p = "Intel® AMT WSMAN"; }
179
+ else if (p == 101) { p = "Intel® AMT Redirection"; }
180
+ x += addInfoNoEsc("Protokol", p);
181
+ }
182
+ QV('DeskParent', true);
183
+ QV('TermParent', false);
184
+ if (recFileMetadata.protocol == 1) {
185
+ // MeshCentral remote terminal
186
+ recFileProtocol = 1;
187
+ x += '<br /><br /><span style=color:gray>' + "Press [space] to play/pause." + '</span>';
188
+ QE('PlayButton', true);
189
+ QE('PauseButton', false);
190
+ QE('RestartButton', false);
191
+ recFileStartTime = recFileLastTime = time;
192
+ }
193
+ else if (recFileMetadata.protocol == 2) {
194
+ // MeshCentral remote desktop
195
+ recFileProtocol = 2;
196
+ x += '<br /><br /><span style=color:gray>' + "Press [space] to play/pause." + '</span>';
197
+ QE('PlayButton', true);
198
+ QE('PauseButton', false);
199
+ QE('RestartButton', false);
200
+ recFileStartTime = recFileLastTime = time;
201
+ agentDesktop = CreateAgentRemoteDesktop('Desk');
202
+ agentDesktop.onScreenSizeChange = deskAdjust;
203
+ agentDesktop.State = 3;
204
+ deskAdjust();
205
+ }
206
+ else if (recFileMetadata.protocol == 101) {
207
+ // Intel AMT Redirection
208
+ recFileProtocol = 101;
209
+ x += '<br /><br /><span style=color:gray>Press [space] to play/pause.</span>';
210
+ QE('PlayButton', true);
211
+ QE('PauseButton', false);
212
+ QE('RestartButton', false);
213
+ recFileStartTime = recFileLastTime = time;
214
+ amtDesktop = CreateAmtRemoteDesktop('Desk');
215
+ amtDesktop.onScreenSizeChange = deskAdjust;
216
+ amtDesktop.State = 3;
217
+ amtDesktop.Start();
218
+ deskAdjust();
219
+ }
220
+ QV('metadatadiv', true);
221
+ QH('metadatadiv', x);
222
+ QH('deskstatus', recFile.name);
223
+ }
224
+
225
+ function processBlock(type, flags, time, data) {
226
+ if (type < 0) { pause(); return; }
227
+ var waitTime = Math.round((time - recFileLastTime) * parseFloat(Q('PlaySpeed').value));
228
+ if (waitTime < 5) {
229
+ processBlockEx(type, flags, time, data);
230
+ } else {
231
+ waitTimerArgs = [type, flags, time, data]
232
+ waitTimer = setTimeout(function () { waitTimer = null; processBlockEx(waitTimerArgs[0], waitTimerArgs[1], waitTimerArgs[2], waitTimerArgs[3]); }, waitTime);
233
+ }
234
+ }
235
+
236
+ function processBlockEx(type, flags, time, data) {
237
+ if (playing == false) return;
238
+ var flagBinary = (flags & 1) != 0, flagUser = (flags & 2) != 0;
239
+
240
+ // Update the clock
241
+ var deltaTimeTotalSec = Math.floor((time - recFileStartTime) / 1000);
242
+ if (currentDeltaTimeTotalSec != deltaTimeTotalSec) {
243
+ currentDeltaTimeTotalSec = deltaTimeTotalSec;
244
+ var deltaTimeHours = Math.floor(deltaTimeTotalSec / 3600);
245
+ deltaTimeTotalSec -= (deltaTimeHours * 3600)
246
+ var deltaTimeMinutes = Math.floor(deltaTimeTotalSec / 60);
247
+ deltaTimeTotalSec -= (deltaTimeHours * 60)
248
+ var deltaTimeSeconds = Math.floor(deltaTimeTotalSec);
249
+ QH('timespan', pad2(deltaTimeHours) + ':' + pad2(deltaTimeMinutes) + ':' + pad2(deltaTimeSeconds))
250
+ }
251
+
252
+ if ((type == 2) && flagBinary && !flagUser) {
253
+ // Device --> User data
254
+ if (recFileProtocol == 1) {
255
+ // MeshCentral Terminal
256
+ agentTerminal.ProcessData(data);
257
+ } else if (recFileProtocol == 2) {
258
+ // MeshCentral Remote Desktop
259
+ agentDesktop.ProcessData(data);
260
+ } else if (recFileProtocol == 101) {
261
+ // Intel AMT KVM
262
+ if ((readState == 0) && (rstr2hex(data) == '4100000000000000')) {
263
+ // We are not authenticated, KVM data starts here.
264
+ readState = 1;
265
+ if (data.length > 8) { amtDesktop.ProcessData(data.substring(8)); }
266
+ } else if (readState == 1) {
267
+ amtDesktop.ProcessData(data);
268
+ }
269
+ }
270
+ } else if ((type == 2) && flagBinary && flagUser) {
271
+ // User --> Device data
272
+ if (recFileProtocol == 101) {
273
+ // Intel AMT KVM
274
+ if (rstr2hex(data) == '0000000008080001000700070003050200000000') { amtDesktop.bpp = 1; } // Switch to 1 byte per pixel.
275
+ }
276
+ }
277
+
278
+ recFileLastTime = time;
279
+ if (playing) { readNextBlock(processBlock); }
280
+ }
281
+
282
+ function cleanup() {
283
+ recFile = null;
284
+ recFilePtr = 0;
285
+ recFileMetadata = null;
286
+ playing = false;
287
+ if (agentDesktop != null) { agentDesktop.Canvas.clearRect(0, 0, agentDesktop.CanvasId.width, agentDesktop.CanvasId.height); agentDesktop = null; }
288
+ if (amtDesktop != null) { amtDesktop.canvas.clearRect(0, 0, amtDesktop.CanvasId.width, amtDesktop.CanvasId.height); amtDesktop = null; }
289
+ readState = 0;
290
+ waitTimerArgs = null;
291
+ currentDeltaTimeTotalSec = 0;
292
+ recFileEndTime = 0;
293
+ agentTerminal = null;
294
+ if (waitTimer != null) { clearTimeout(waitTimer); waitTimer = null; }
295
+ QH('deskstatus', '');
296
+ QE('PlayButton', false);
297
+ QE('PauseButton', false);
298
+ QE('RestartButton', false);
299
+ QS('progressbar').width = '0px';
300
+ QH('timespan', '00:00:00');
301
+ QV('metadatadiv', true);
302
+ QH('metadatadiv', '<span style=\"font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:28px\">MeshCentral Session Player</span><br /><br /><span style=color:gray>' + "Drag & drop a .mcrec file or click \"Open File...\"" + '</span>');
303
+ QV('DeskParent', true);
304
+ QV('TermParent', false);
305
+ }
306
+
307
+ function ondrop(e) {
308
+ haltEvent(e);
309
+ QV('bigfail', false);
310
+ QV('bigok', false);
311
+
312
+ // Check if these are files we can upload, remove all folders.
313
+ if (e.dataTransfer == null) return;
314
+ var files = [];
315
+ for (var i in e.dataTransfer.files) {
316
+ if ((e.dataTransfer.files[i].type != null) && (e.dataTransfer.files[i].size != null) && (e.dataTransfer.files[i].size != 0) && (e.dataTransfer.files[i].name.endsWith('.mcrec'))) {
317
+ files.push(e.dataTransfer.files[i]);
318
+ }
319
+ }
320
+ if (files.length == 0) return;
321
+ cleanup();
322
+ recFile = files[0];
323
+ recFilePtr = 0;
324
+ readNextBlock(processFirstBlock);
325
+ readLastBlock(function (type, flags, time) { if (type == 3) { recFileEndTime = time; } else { recFileEndTime = 0; } });
326
+ }
327
+
328
+ var dragtimer = null;
329
+ function ondragover(e) {
330
+ haltEvent(e);
331
+ if (dragtimer != null) { clearTimeout(dragtimer); dragtimer = null; }
332
+ var ac = true;
333
+ QV('bigok', ac);
334
+ QV('bigfail', !ac);
335
+ }
336
+
337
+ function ondragleave(e) {
338
+ haltEvent(e);
339
+ dragtimer = setTimeout(function () { QV('bigfail', false); QV('bigok', false); dragtimer = null; }, 10);
340
+ }
341
+
342
+ function onkeypress(e) {
343
+ if (xxdialogMode) return;
344
+ if (e.key == ' ') { togglePause(); haltEvent(e); }
345
+ if (e.key == '1') { Q('PlaySpeed').value = 4; haltEvent(e); }
346
+ if (e.key == '2') { Q('PlaySpeed').value = 2; haltEvent(e); }
347
+ if (e.key == '3') { Q('PlaySpeed').value = 1; haltEvent(e); }
348
+ if (e.key == '4') { Q('PlaySpeed').value = 0.5; haltEvent(e); }
349
+ if (e.key == '5') { Q('PlaySpeed').value = 0.25; haltEvent(e); }
350
+ if (e.key == '6') { Q('PlaySpeed').value = 0.1; haltEvent(e); }
351
+ if (e.key == '0') { pause(); restart(); haltEvent(e); }
352
+ }
353
+
354
+ function openfile() {
355
+ var x = '<input type=file name=files id=p2fileinput style=width:100% accept=".mcrec" onchange="openfileChanged()" />';
356
+ setDialogMode(2, "Otevřít soubor...", 3, openfileEx, x);
357
+ QE('idx_dlgOkButton', false);
358
+ }
359
+
360
+ function openfileEx() {
361
+ var xfiles = Q('p2fileinput').files;
362
+ if (xfiles != null) { var files = []; for (var i in xfiles) { if ((xfiles[i].type != null) && (xfiles[i].size != null) && (xfiles[i].size != 0) && (xfiles[i].name.endsWith('.mcrec'))) { files.push(xfiles[i]); } } }
363
+ if (files.length == 0) return;
364
+ cleanup();
365
+ recFile = files[0];
366
+ recFilePtr = 0;
367
+ readNextBlock(processFirstBlock);
368
+ readLastBlock(function (type, flags, time) { if (type == 3) { recFileEndTime = time; } else { recFileEndTime = 0; } });
369
+ Q('OpenFileButton').blur();
370
+ }
371
+
372
+ function openfileChanged() {
373
+ var xfiles = Q('p2fileinput').files;
374
+ if (xfiles != null) { var files = []; for (var i in xfiles) { if ((xfiles[i].type != null) && (xfiles[i].size != null) && (xfiles[i].size != 0) && (xfiles[i].name.endsWith('.mcrec'))) { files.push(xfiles[i]); } } }
375
+ QE('idx_dlgOkButton', files.length == 1);
376
+ }
377
+
378
+ function togglePause() {
379
+ if (recFile != null) { if (playing == true) { pause(); } else { if (recFilePtr != recFile.size) { play(); } } } return false;
380
+ }
381
+
382
+ function play() {
383
+ Q('PlayButton').blur();
384
+ if ((playing == true) || (recFileProtocol == 0)) return;
385
+ playing = true;
386
+ QV('metadatadiv', false);
387
+ QE('PlayButton', false);
388
+ QE('PauseButton', true);
389
+ QE('RestartButton', false);
390
+ if ((recFileProtocol == 1) && (agentTerminal == null)) {
391
+ QV('DeskParent', false);
392
+ QV('TermParent', true);
393
+ agentTerminal = CreateAmtRemoteTerminal('Term', {});
394
+ agentTerminal.State = 3;
395
+ }
396
+ readNextBlock(processBlock);
397
+ }
398
+
399
+ function pause() {
400
+ Q('PauseButton').blur();
401
+ if (playing == false) return;
402
+ playing = false;
403
+ QE('PlayButton', recFilePtr != recFile.size);
404
+ QE('PauseButton', false);
405
+ QE('RestartButton', recFilePtr != 0);
406
+ if (waitTimer != null) {
407
+ clearTimeout(waitTimer);
408
+ waitTimer = null;
409
+ processBlockEx(waitTimerArgs[0], waitTimerArgs[1], waitTimerArgs[2], waitTimerArgs[3]);
410
+ waitTimerArgs = null;
411
+ }
412
+ }
413
+
414
+ function restart() {
415
+ Q('RestartButton').blur();
416
+ if (playing == true) return;
417
+ recFilePtr = 0;
418
+ readState = 0;
419
+ currentDeltaTimeTotalSec = 0;
420
+ QV('metadatadiv', true);
421
+ QE('PlayButton', true);
422
+ QE('PauseButton', false);
423
+ QE('RestartButton', false);
424
+ QS('progressbar').width = '0px';
425
+ QH('timespan', '00:00:00');
426
+ QV('DeskParent', true);
427
+ QV('TermParent', false);
428
+ if (agentDesktop) {
429
+ agentDesktop.Canvas.clearRect(0, 0, agentDesktop.CanvasId.width, agentDesktop.CanvasId.height);
430
+ } else if (amtDesktop) {
431
+ amtDesktop.canvas.clearRect(0, 0, amtDesktop.CanvasId.width, amtDesktop.CanvasId.height);
432
+ amtDesktop = CreateAmtRemoteDesktop('Desk');
433
+ amtDesktop.onScreenSizeChange = deskAdjust;
434
+ amtDesktop.State = 3;
435
+ amtDesktop.Start();
436
+ } else if (agentTerminal) {
437
+ agentTerminal = null;
438
+ }
439
+ }
440
+
441
+ function clearConsoleMsg() { QH('p11DeskConsoleMsg', ''); }
442
+
443
+ // Toggle the web page to full screen
444
+ function toggleAspectRatio(toggle) {
445
+ if (toggle === 1) { deskAspectRatio = ((deskAspectRatio + 1) % 3); }
446
+ deskAdjust();
447
+ }
448
+
449
+ function deskAdjust() {
450
+ var parentH = Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth;
451
+ var deskH = Q('Desk').height, deskW = Q('Desk').width;
452
+
453
+ if (deskAspectRatio == 2) {
454
+ // Scale mode
455
+ QS('Desk')['margin-top'] = null;
456
+ QS('Desk').height = '100%';
457
+ QS('Desk').width = '100%';
458
+ QS('DeskParent').overflow = 'hidden';
459
+ } else if (deskAspectRatio == 1) {
460
+ // Zoomed mode
461
+ QS('Desk')['margin-top'] = '0px';
462
+ //QS('Desk')['margin-left'] = '0px';
463
+ QS('Desk').height = deskH + 'px';
464
+ QS('Desk').width = deskW + 'px';
465
+ QS('DeskParent').overflow = 'scroll';
466
+ } else {
467
+ // Fixed aspect ratio
468
+ if ((parentH / parentW) > (deskH / deskW)) {
469
+ var hNew = ((deskH * parentW) / deskW) + 'px';
470
+ //if (webPageFullScreen || fullscreen) {
471
+ //QS('deskarea3x').height = null;
472
+ //} else {
473
+ // QS('deskarea3x').height = hNew;
474
+ //QS('deskarea3x').height = null;
475
+ //}
476
+ QS('Desk').height = hNew;
477
+ QS('Desk').width = '100%';
478
+ } else {
479
+ var wNew = ((deskW * parentH) / deskH) + 'px';
480
+ //if (webPageFullScreen || fullscreen) {
481
+ //QS('Desk').height = null;
482
+ //} else {
483
+ QS('Desk').height = '100%';
484
+ //}
485
+ QS('Desk').width = wNew;
486
+ }
487
+ QS('Desk')['margin-top'] = null;
488
+ QS('DeskParent').overflow = 'hidden';
489
+ }
490
+ }
491
+
492
+ //
493
+ // POPUP DIALOG
494
+ //
495
+
496
+ // null = Hidden, 1 = Generic Message
497
+ var xxdialogMode;
498
+ var xxdialogFunc;
499
+ var xxdialogButtons;
500
+ var xxdialogTag;
501
+ var xxcurrentView = -1;
502
+
503
+ // Display a dialog box
504
+ // Parameters: Dialog Mode (0 = none), Dialog Title, Buttons (1 = OK, 2 = Cancel, 3 = OK & Cancel), Call back function(0 = Cancel, 1 = OK), Dialog Content (Mode 2 only)
505
+ function setDialogMode(x, y, b, f, c, tag) {
506
+ xxdialogMode = x;
507
+ xxdialogFunc = f;
508
+ xxdialogButtons = b;
509
+ xxdialogTag = tag;
510
+ QE('idx_dlgOkButton', true);
511
+ QV('idx_dlgOkButton', b & 1);
512
+ QV('idx_dlgCancelButton', b & 2);
513
+ QV('id_dialogclose', (b & 2) || (b & 8));
514
+ QV('idx_dlgDeleteButton', b & 4);
515
+ QV('idx_dlgButtonBar', b & 7);
516
+ if (y) QH('id_dialogtitle', y);
517
+ for (var i = 1; i < 3; i++) { QV('dialog' + i, i == x); } // Edit this line when more dialogs are added
518
+ QV('dialog', x);
519
+ if (c) { if (x == 2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage', c); } }
520
+ }
521
+
522
+ function dialogclose(x) {
523
+ var f = xxdialogFunc, b = xxdialogButtons, t = xxdialogTag;
524
+ setDialogMode();
525
+ if (((b & 8) || x) && f) f(x, t);
526
+ }
527
+
528
+ function messagebox(t, m) { setSessionActivity(); QH('id_dialogMessage', m); setDialogMode(1, t, 1); }
529
+ function statusbox(t, m) { setSessionActivity(); QH('id_dialogMessage', m); setDialogMode(1, t); }
530
+ function haltEvent(e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
531
+ function pad2(num) { var s = '00' + num; return s.substr(s.length - 2); }
532
+ function format(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); };
533
+
534
+ start();
535
+ </script>
536
+
537
+</body></html>
\ No newline at end of file
sample-config.json
+3
@@ -42,6 +42,9 @@
42
"info": "Information about this server"
43
},
44
"_TlsOffload": true,
45
+ "_MpsPort": 44330,
46
+ "_MpsAliasPort": 4433,
47
+ "_MpsAliasHost": "mps.mydomain.com",
48
"_MpsTlsOffload": true,
49
"_No2FactorAuth": true,
50
"_Log": "main,web,webrequest,cert",
translate/translate.json
+309
-1
@@ -27,6 +27,7 @@
27
},
28
{
29
"en": "Storage limit exceed",
30
+ "cs": "Překročen limit pro ukládání",
31
"xloc": [
32
"default.handlebars->13->1071"
33
]
@@ -40,6 +41,7 @@
41
{
42
"en": "Reset Password",
43
"fr": "Réinitialiser le mot de passe",
44
+ "cs": "Reset hesla",
45
"xloc": [
46
"login.handlebars->container->column_l->centralTable->1->0->logincell->resetpasswordpanel->1->7->1->6->1->1",
47
"login-mobile.handlebars->container->page_content->column_l->1->1->0->1->resetpasswordpanel->1->7->1->6->1->1"
@@ -54,6 +56,7 @@
56
},
57
{
58
"en": "Delete selected item?",
59
+ "cs": "Smazat vybraný prvek?",
60
"xloc": [
61
"default.handlebars->13->609",
62
"default.handlebars->13->1092",
@@ -87,6 +90,7 @@
90
},
91
{
92
"en": "Console",
93
+ "cs": "Konzole",
94
"xloc": [
95
"default.handlebars->contextMenu->cxconsole",
96
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDevConsole",
@@ -103,6 +107,7 @@
107
{
108
"en": "Perform power actions on the device",
109
"fr": "Effectuer des actions d'alimentation sur le périphérique",
110
+ "cs": "Akce napájení",
111
"xloc": [
112
"default.handlebars->container->column_l->p11->deskarea0->deskarea1->1",
113
"default.handlebars->container->column_l->p12->termTable->1->1->0->1->1",
@@ -112,6 +117,7 @@
117
},
118
{
119
"en": "Unable to scan this address range.",
120
+ "cs": "Nelze skenovat tento rozsah.",
121
"xloc": [
122
"default.handlebars->13->123"
123
]
@@ -151,6 +157,7 @@
157
{
158
"en": "{0} nodes",
159
"fr": "{0} appareil",
160
+ "cs": "{0} zařízení",
161
"xloc": [
162
"default.handlebars->13->304"
163
]
@@ -164,6 +171,7 @@
171
{
172
"en": "Reset devices",
173
"fr": "Réinitialiser les appareils",
174
+ "cs": "Reset zařízení",
175
"xloc": [
176
"default.handlebars->13->344"
177
]
@@ -185,6 +193,7 @@
193
{
194
"en": "New Device Group",
195
"fr": "Nouveau Group",
196
+ "cs": "Nová skupina zařízení",
197
"xloc": [
198
"default.handlebars->13->524",
199
"default.handlebars->13->889",
@@ -194,6 +203,7 @@
203
},
204
{
205
"en": "Device is detected but power state could not be obtained.",
206
+ "cs": "Zařízení je detekováno, ale nelze zjistit stav.",
207
"xloc": [
208
"default.handlebars->13->317"
209
]
@@ -235,6 +245,7 @@
245
{
246
"en": "Select All",
247
"fr": "Tout Sélectionner",
248
+ "cs": "Vybrat vše",
249
"xloc": [
250
"default.handlebars->meshContextMenu->cxselectall",
251
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->devListToolbar",
@@ -278,6 +289,7 @@
289
{
290
"en": "Agent",
291
"fr": "Agent",
292
+ "cs": "Agent",
293
"xloc": [
294
"default.handlebars->container->column_l->p15->consoleTable->1->6->1->1->1->0->p15outputselecttd->p15outputselect->1",
295
"default.handlebars->13->143",
@@ -289,6 +301,7 @@
301
},
302
{
303
"en": "To add a new computer to device group \\\"{0}\\\", download the mesh agent and install it the computer to manage. This agent has server and device group information embedded within it.",
304
+ "cs": "Pro přidání nového zařízení do skupiny \\\"{0}\\\", si stáhněte agenta a nainstalujte na zařízení, které chcete spravovat. Tento agent již obsahuje veškeré informace pro připojení na server.",
305
"xloc": [
306
"default.handlebars->13->280"
307
]
@@ -301,6 +314,7 @@
314
},
315
{
316
"en": "Power Actions...",
317
+ "cs": "Akce napájení",
318
"xloc": [
319
"default.handlebars->container->column_l->p11->deskarea0->deskarea1->1",
320
"default-mobile.handlebars->container->page_content->column_l->p10->p10desktop->deskarea4->1->3"
@@ -445,6 +459,7 @@
459
},
460
{
461
"en": "Group1, Group2, Group3",
462
+ "cs": "Skupina1, Skupina2, Skupina3",
463
"xloc": [
464
"default-mobile.handlebars->9->223"
465
]
@@ -471,6 +486,7 @@
486
{
487
"en": "1 day",
488
"fr": "1 jour",
489
+ "cs": "1 den",
490
"xloc": [
491
"default.handlebars->13->129",
492
"default.handlebars->13->250",
@@ -559,6 +575,7 @@
575
},
576
{
577
"en": "Paste",
578
+ "cs": "Vložit",
579
"xloc": [
580
"default.handlebars->container->column_l->p5->p5toolbar->1->0->p5filehead->3",
581
"default.handlebars->container->column_l->p12->termTable->1->1->6->1->3",
@@ -582,6 +599,7 @@
599
{
600
"en": " node",
601
"fr": "nœud",
602
+ "cs": " zařízení",
603
"xloc": [
604
"default-mobile.handlebars->9->124"
605
]
@@ -594,6 +612,7 @@
612
},
613
{
614
"en": "Show",
615
+ "cs": "Zobrazit",
616
"xloc": [
617
"default.handlebars->container->column_l->p3->3->1->0->3",
618
"default.handlebars->container->column_l->p16->3->1->0->5",
@@ -604,6 +623,7 @@
623
{
624
"en": "Unlimited",
625
"fr": "Illimité",
626
+ "cs": "Bez limitu",
627
"xloc": [
628
"default.handlebars->13->132",
629
"default.handlebars->13->253",
@@ -612,6 +632,7 @@
632
},
633
{
634
"en": "Log In",
635
+ "cs": "Přihlásit",
636
"xloc": [
637
"login.handlebars->container->column_l->centralTable->1->0->logincell->loginpanel->1->5->1",
638
"login.handlebars->container->column_l->centralTable->1->0->logincell->loginpanel->1->7->1->4->3",
@@ -621,6 +642,7 @@
642
},
643
{
644
"en": "Description",
645
+ "cs": "Popis",
646
"xloc": [
647
"default.handlebars->13->56",
648
"default.handlebars->13->388",
@@ -639,6 +661,7 @@
661
},
662
{
663
"en": "total",
664
+ "cs": "celkově",
665
"xloc": [
666
"default.handlebars->13->1242"
667
]
@@ -697,6 +720,7 @@
720
{
721
"en": "TLS security required",
722
"fr": "Sécurité TLS requise",
723
+ "cs": "TLS vyžadováno",
724
"xloc": [
725
"default.handlebars->13->202",
726
"default.handlebars->13->517",
@@ -706,6 +730,7 @@
730
{
731
"en": "Scan",
732
"fr": "Analyse",
733
+ "cs": "Skenovat",
734
"xloc": [
735
"default.handlebars->13->211"
736
]
@@ -719,6 +744,7 @@
744
},
745
{
746
"en": "{0} megabytes remaining",
747
+ "cs": "{0} megabytů zbývá",
748
"xloc": [
749
"default.handlebars->13->1074"
750
]
@@ -730,19 +756,22 @@
756
]
757
},
758
{
733
- "en": "Device is in powered off state (S5).",
759
+ "en": "Device is in powered off state (S5).",
760
+ "cs": "Zařízení je vypnuto (S5).",
761
"xloc": [
762
"default.handlebars->13->315"
763
]
764
},
765
{
766
"en": "Generate New Tokens",
767
+ "cs": "Generovat nové tokeny",
768
"xloc": [
769
"default.handlebars->13->96"
770
]
771
},
772
{
773
"en": "Confirm delete selected devices(s)?",
774
+ "cs": "Potvrdit smázání vybraných zařízení?",
775
"xloc": [
776
"default.handlebars->13->350"
777
]
@@ -823,6 +852,7 @@
852
{
853
"en": "My Users",
854
"fr": "Mes Utilisateurs",
855
+ "cs": "Uživatelé",
856
"xloc": [
857
"default.handlebars->container->page_leftbar",
858
"default.handlebars->container->topbar->1->1->MainMenuSpan->1->0->MainMenuMyUsers",
@@ -963,6 +993,7 @@
993
},
994
{
995
"en": "General -",
996
+ "cs": "Obecné -",
997
"xloc": [
998
"default.handlebars->container->column_l->p10->1->1->0->1->p10title->3",
999
"default.handlebars->container->column_l->p20->5",
@@ -978,6 +1009,7 @@
1009
{
1010
"en": "Group Action",
1011
"fr": "Action de groupe",
1012
+ "cs": "Akce skupiny",
1013
"xloc": [
1014
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->devListToolbar",
1015
"default.handlebars->13->348"
@@ -1043,6 +1075,7 @@
1075
},
1076
{
1077
"en": "Delete Account",
1078
+ "cs": "Smazat účet",
1079
"xloc": [
1080
"default.handlebars->13->880",
1081
"default-mobile.handlebars->9->40"
@@ -1063,6 +1096,7 @@
1096
},
1097
{
1098
"en": "Upload File",
1099
+ "cs": "Nahrát soubor",
1100
"xloc": [
1101
"default.handlebars->container->dialog->dialogBody->dialog3->d3localmode->1",
1102
"default.handlebars->13->611",
@@ -1317,6 +1351,7 @@
1351
},
1352
{
1353
"en": "Installation Type",
1354
+ "cs": "Typ instalace",
1355
"xloc": [
1356
"default.handlebars->13->254",
1357
"default.handlebars->13->276"
@@ -1355,6 +1390,7 @@
1390
{
1391
"en": "add one",
1392
"fr": "ajoute un",
1393
+ "cs": "přidat",
1394
"xloc": [
1395
"default.handlebars->13->159",
1396
"default.handlebars->13->161"
@@ -1393,6 +1429,7 @@
1429
},
1430
{
1431
"en": "This page does not exist",
1432
+ "cs": "Tato stránka neexistuje",
1433
"xloc": [
1434
"error404.handlebars->container->column_l->3"
1435
]
@@ -1413,6 +1450,7 @@
1450
},
1451
{
1452
"en": "Wake-up",
1453
+ "cs": "Probudit",
1454
"xloc": [
1455
"default.handlebars->13->503",
1456
"default-mobile.handlebars->9->203"
@@ -1434,6 +1472,7 @@
1472
{
1473
"en": "Scaling",
1474
"fr": "Mise à l'échelle",
1475
+ "cs": "Škálování",
1476
"xloc": [
1477
"default.handlebars->container->dialog->dialogBody->dialog7->d7meshkvm->5->1",
1478
"default-mobile.handlebars->dialog->3->dialog7->d7meshkvm->5->3"
@@ -1481,6 +1520,7 @@
1520
{
1521
"en": "Power off devices",
1522
"fr": "Éteindre les appareils",
1523
+ "cs": "Vypnout zařízení",
1524
"xloc": [
1525
"default.handlebars->13->345"
1526
]
@@ -1544,6 +1584,7 @@
1584
{
1585
"en": "Group",
1586
"fr": "Groupe",
1587
+ "cs": "Skupina",
1588
"xloc": [
1589
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarSort->sortselect->1",
1590
"default.handlebars->13->381",
@@ -1613,6 +1654,7 @@
1654
{
1655
"en": "Show server error log",
1656
"fr": "Afficher le journal des erreurs du serveur",
1657
+ "cs": "Zobrazit chyby serveru",
1658
"xloc": [
1659
"default.handlebars->container->column_l->p6->p2ServerActions->3->p2ServerActionsErrors->0"
1660
]
@@ -1653,6 +1695,7 @@
1695
},
1696
{
1697
"en": "Create a new group of devices.",
1698
+ "cs": "Vytvořit novou skupinu zařízení.",
1699
"xloc": [
1700
"default.handlebars->13->162"
1701
]
@@ -1668,6 +1711,7 @@
1711
{
1712
"en": "Send",
1713
"fr": "Envoyer",
1714
+ "cs": "Odeslat",
1715
"xloc": [
1716
"default.handlebars->container->column_l->p11->deskarea0->deskarea4->3",
1717
"default.handlebars->container->column_l->p12->termTable->1->1->6->1->1",
@@ -1719,6 +1763,7 @@
1763
{
1764
"en": "Invite someone to install the mesh agent on this mesh.",
1765
"fr": "Invitez quelqu'un à installer l'agent de maillage sur ce maillage.",
1766
+ "cs": "Pozvat kohokoliv k instalaci agenta pro vzdálené ovládání.",
1767
"xloc": [
1768
"default.handlebars->13->191",
1769
"default.handlebars->13->967"
@@ -1883,6 +1928,7 @@
1928
},
1929
{
1930
"en": "Remote computer is not powered on, click here to issue a power command.",
1931
+ "cs": "Vzdálený počítač není zapnutý, klikněte zde pro zapnutí.",
1932
"xloc": [
1933
"default.handlebars->container->column_l->p11->p11warning2->3",
1934
"default.handlebars->container->column_l->p12->p12warning2->3"
@@ -1891,6 +1937,7 @@
1937
{
1938
"en": "{0} bytes",
1939
"fr": "{0} octets",
1940
+ "cs": "{0} bytů",
1941
"xloc": [
1942
"default.handlebars->13->1087",
1943
"default-mobile.handlebars->9->75"
@@ -1904,6 +1951,7 @@
1951
},
1952
{
1953
"en": "(optional)",
1954
+ "cs": "(volitelné)",
1955
"xloc": [
1956
"default.handlebars->13->259"
1957
]
@@ -2021,12 +2069,14 @@
2069
{
2070
"en": "No devices found.",
2071
"fr": "Aucun périphérique trouvé.",
2072
+ "cs": "Žádné zařízení nalezeno.",
2073
"xloc": [
2074
"default.handlebars->13->370"
2075
]
2076
},
2077
{
2078
"en": "Last agent address",
2079
+ "cs": "Poslední adresa agenta",
2080
"xloc": [
2081
"default.handlebars->13->49",
2082
"default.handlebars->13->50",
@@ -2041,6 +2091,7 @@
2091
},
2092
{
2093
"en": "Delete",
2094
+ "cs": "Smazat",
2095
"xloc": [
2096
"default.handlebars->container->column_l->p5->p5toolbar->1->0->p5filehead->3",
2097
"default.handlebars->container->column_l->p13->p13toolbar->1->2->1->3",
@@ -2057,6 +2108,7 @@
2108
{
2109
"en": "Operation",
2110
"fr": "Opération",
2111
+ "cs": "Operace",
2112
"xloc": [
2113
"default.handlebars->13->341",
2114
"default.handlebars->13->508",
@@ -2084,6 +2136,7 @@
2136
{
2137
"en": "Username",
2138
"fr": "Nom d'utilisateur",
2139
+ "cs": "Uživatel",
2140
"xloc": [
2141
"default.handlebars->13->197",
2142
"default.handlebars->13->227",
@@ -2094,6 +2147,7 @@
2147
},
2148
{
2149
"en": "No Credentials",
2150
+ "cs": "Žádné přihlašovací údaje",
2151
"xloc": [
2152
"default.handlebars->13->435",
2153
"default.handlebars->13->436",
@@ -2109,6 +2163,7 @@
2163
},
2164
{
2165
"en": "Remote clipboard is valid for 60 seconds.",
2166
+ "cs": "Vzdálená schránka je platná 60 sekund.",
2167
"xloc": [
2168
"default.handlebars->13->564"
2169
]
@@ -2138,6 +2193,7 @@
2193
},
2194
{
2195
"en": "Edit Device Notes",
2196
+ "cs": "Upravit popis zařízení",
2197
"xloc": [
2198
"default.handlebars->13->1038",
2199
"default-mobile.handlebars->9->303"
@@ -2161,6 +2217,7 @@
2217
{
2218
"en": "Reset account",
2219
"fr": "Réinitialiser le compte",
2220
+ "cs": "Reset účtu",
2221
"xloc": [
2222
"login.handlebars->container->column_l->centralTable->1->0->logincell->loginpanel->1->resetAccountDiv->3",
2223
"login-mobile.handlebars->container->page_content->column_l->1->1->0->1->loginpanel->1->resetAccountDiv->3"
@@ -2181,6 +2238,7 @@
2238
},
2239
{
2240
"en": "Pass Hint:",
2241
+ "cs": "Nápověda k heslu:",
2242
"xloc": [
2243
"login-mobile.handlebars->container->page_content->column_l->1->1->0->1->createpanel->1->1->9->1->createPanelHint->1"
2244
]
@@ -2201,6 +2259,7 @@
2259
{
2260
"en": "Username:",
2261
"fr": "Nom d'utilisateur:",
2262
+ "cs": "Uživatel:",
2263
"xloc": [
2264
"login.handlebars->container->column_l->centralTable->1->0->logincell->loginpanel->1->7->1->0->loginusername",
2265
"login.handlebars->container->column_l->centralTable->1->0->logincell->createpanel->1->9->1->nuUserRow->nuUser",
@@ -2211,6 +2270,7 @@
2270
{
2271
"en": "My Devices",
2272
"fr": "Mes Appareils",
2273
+ "cs": "Moje zařízení",
2274
"xloc": [
2275
"default.handlebars->container->page_leftbar",
2276
"default.handlebars->container->topbar->1->1->MainMenuSpan->1->0->MainMenuMyDevices",
@@ -2252,6 +2312,7 @@
2312
},
2313
{
2314
"en": "Disconnected",
2315
+ "cs": "Odpojeno",
2316
"xloc": [
2317
"default.handlebars->container->column_l->p11->deskarea0->deskarea1->3->deskstatus",
2318
"default.handlebars->container->column_l->p12->termTable->1->1->0->1->3->termstatus",
@@ -2268,6 +2329,7 @@
2329
},
2330
{
2331
"en": "Old password:",
2332
+ "cs": "Staré heslo:",
2333
"xloc": [
2334
"default.handlebars->13->883",
2335
"default-mobile.handlebars->9->41"
@@ -2275,6 +2337,7 @@
2337
},
2338
{
2339
"en": "Only files less than 200k can be edited.",
2340
+ "cs": "Jen soubory menší než 200k mohou být editovány.",
2341
"xloc": [
2342
"default.handlebars->13->613",
2343
"default-mobile.handlebars->9->253"
@@ -2371,6 +2434,7 @@
2434
},
2435
{
2436
"en": "Details",
2437
+ "cs": "Detaily",
2438
"xloc": [
2439
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDevInfo"
2440
]
@@ -2472,6 +2536,7 @@
2536
{
2537
"en": "Powered",
2538
"fr": "Alimenté",
2539
+ "cs": "Zapnuto",
2540
"xloc": [
2541
"default.handlebars->13->1",
2542
"default.handlebars->13->306",
@@ -2481,6 +2546,7 @@
2546
},
2547
{
2548
"en": "Locked",
2549
+ "cs": "Zamknuto",
2550
"xloc": [
2551
"default.handlebars->13->1126"
2552
]
@@ -2488,6 +2554,7 @@
2554
{
2555
"en": "Quality",
2556
"fr": "Qualité",
2557
+ "cs": "Kvalita",
2558
"xloc": [
2559
"default.handlebars->container->dialog->dialogBody->dialog7->d7meshkvm->3->1",
2560
"default-mobile.handlebars->dialog->3->dialog7->d7meshkvm->3->3"
@@ -2496,6 +2563,7 @@
2563
{
2564
"en": "Cancel",
2565
"fr": "Annuler",
2566
+ "cs": "Zrušit",
2567
"xloc": [
2568
"default.handlebars->container->dialog->idx_dlgButtonBar",
2569
"default.handlebars->13->912",
@@ -2508,12 +2576,14 @@
2576
},
2577
{
2578
"en": "CPU load in the last minute",
2579
+ "cs": "CPU zatížení v poslední minutě",
2580
"xloc": [
2581
"default.handlebars->13->1237"
2582
]
2583
},
2584
{
2585
"en": ", right click on it or press \"control\" and click on the file. Then select \"Open\" and follow the instructions.",
2586
+ "cs": ", poté spusťe instalaci. Postupujte dle instrukcí.",
2587
"xloc": [
2588
"agentinvite.handlebars->container->column_l->5->macostab->3"
2589
]
@@ -2527,6 +2597,7 @@
2597
{
2598
"en": "Last changed: {0}",
2599
"fr": "Dernière modification: {0}",
2600
+ "cs": "Poslední změna: {0}",
2601
"xloc": [
2602
"default.handlebars->13->1200"
2603
]
@@ -2548,6 +2619,7 @@
2619
},
2620
{
2621
"en": "Email Address Change",
2622
+ "cs": "Změna emailové adresy",
2623
"xloc": [
2624
"default.handlebars->13->876",
2625
"default-mobile.handlebars->9->35"
@@ -2555,6 +2627,7 @@
2627
},
2628
{
2629
"en": "Edit Device Group",
2630
+ "cs": "Editovat skupinu zařízení",
2631
"xloc": [
2632
"default.handlebars->13->1008",
2633
"default.handlebars->13->1026",
@@ -2567,6 +2640,7 @@
2640
{
2641
"en": "Sort by name",
2642
"fr": "Trier par nom",
2643
+ "cs": "Třídit podle jména",
2644
"xloc": [
2645
"default.handlebars->container->column_l->p5->p5toolbar->1->2->p5filesubhead->1->p5sortdropdown->1",
2646
"default.handlebars->container->column_l->p11->deskarea0->deskarea3x->DeskTools->deskToolsArea->DeskToolsProcessTab->deskToolsHeader",
@@ -2584,6 +2658,7 @@
2658
},
2659
{
2660
"en": "Copy MAC address to clipboard",
2661
+ "cs": "Kopírovat MAC adresu do schránky",
2662
"xloc": [
2663
"default.handlebars->13->60",
2664
"default.handlebars->13->68"
@@ -2605,12 +2680,14 @@
2680
{
2681
"en": "No devices",
2682
"fr": "Aucun appareil",
2683
+ "cs": "Žádné zařízení",
2684
"xloc": [
2685
"default-mobile.handlebars->9->95"
2686
]
2687
},
2688
{
2689
"en": "Link Expiration",
2690
+ "cs": "Platnost linku",
2691
"xloc": [
2692
"default.handlebars->13->247",
2693
"default.handlebars->13->261"
@@ -2657,6 +2734,7 @@
2734
{
2735
"en": "Last 1000",
2736
"fr": "1000 derniers",
2737
+ "cs": "Posledních 1000",
2738
"xloc": [
2739
"default.handlebars->container->column_l->p3->3->1->0->3->p3limitdropdown->9",
2740
"default.handlebars->container->column_l->p16->3->1->0->5->p16limitdropdown->9",
@@ -2686,6 +2764,7 @@
2764
{
2765
"en": "Large",
2766
"fr": "Grand",
2767
+ "cs": "Velký",
2768
"xloc": [
2769
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarSize->sizeselect->5"
2770
]
@@ -2699,6 +2778,7 @@
2778
{
2779
"en": "New Account...",
2780
"fr": "Nouveau Compte...",
2781
+ "cs": "Nový účet...",
2782
"xloc": [
2783
"default.handlebars->container->column_l->p4->3->1->0->3->3"
2784
]
@@ -2725,6 +2805,7 @@
2805
{
2806
"en": "1 week",
2807
"fr": "1 semaine",
2808
+ "cs": "1 týden",
2809
"xloc": [
2810
"default.handlebars->13->130",
2811
"default.handlebars->13->251",
@@ -2757,6 +2838,7 @@
2838
},
2839
{
2840
"en": "State",
2841
+ "cs": "Stav",
2842
"xloc": [
2843
"default.handlebars->container->column_l->p11->deskarea0->deskarea3x->DeskTools->deskToolsArea->DeskToolsServiceTab->deskToolsServiceHeader->1",
2844
"default.handlebars->13->568"
@@ -2790,6 +2872,7 @@
2872
},
2873
{
2874
"en": "Email is verified",
2875
+ "cs": "Email ověřen",
2876
"xloc": [
2877
"default.handlebars->13->1188"
2878
]
@@ -2822,6 +2905,7 @@
2905
{
2906
"en": "Password",
2907
"fr": "Mot de passe",
2908
+ "cs": "Heslo",
2909
"xloc": [
2910
"default.handlebars->13->199",
2911
"default.handlebars->13->228",
@@ -2837,12 +2921,14 @@
2921
},
2922
{
2923
"en": "Stats",
2924
+ "cs": "Statistiky",
2925
"xloc": [
2926
"default.handlebars->container->topbar->1->1->ServerSubMenuSpan->ServerSubMenu->1->0->ServerStats"
2927
]
2928
},
2929
{
2930
"en": "Check server version",
2931
+ "cs": "Zkontrolovat verzi serveru",
2932
"xloc": [
2933
"default.handlebars->container->column_l->p6->p2ServerActions->3->p2ServerActionsVersion->0"
2934
]
@@ -2877,6 +2963,7 @@
2963
},
2964
{
2965
"en": "Used",
2966
+ "cs": "Použito",
2967
"xloc": [
2968
"default.handlebars->13->1233",
2969
"default.handlebars->13->1235"
@@ -2945,6 +3032,7 @@
3032
},
3033
{
3034
"en": "To add a new computer to device group \\\"{0}\\\", download the mesh agent and install it the computer to manage. This agent installer has server and device group information embedded within it.",
3035
+ "cs": "Pro přidání do skupiny \\\"{0}\\\", si musíte stáhnout agenta a nainstalovat ho na počítači, který chcete spravovat. Tento agent má všechny potřebné informace pro připojení již v sobě.",
3036
"xloc": [
3037
"default.handlebars->13->291"
3038
]
@@ -3032,6 +3120,7 @@
3120
},
3121
{
3122
"en": "To install, cut and paste the following command in a root terminal.",
3123
+ "cs": "Pro instalaci spusťte následující příkaz s právy uživatele root.",
3124
"xloc": [
3125
"agentinvite.handlebars->container->column_l->5->linuxtab->3"
3126
]
@@ -3086,6 +3175,7 @@
3175
},
3176
{
3177
"en": "Events",
3178
+ "cs": "Události",
3179
"xloc": [
3180
"default.handlebars->contextMenu->cxevents",
3181
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDevEvents",
@@ -3114,6 +3204,7 @@
3204
{
3205
"en": "New password:",
3206
"fr": "Nouveau mot de passe:",
3207
+ "cs": "Nové heslo:",
3208
"xloc": [
3209
"default.handlebars->13->884",
3210
"default.handlebars->13->885",
@@ -3174,6 +3265,7 @@
3265
},
3266
{
3267
"en": "Actions",
3268
+ "cs": "Akce",
3269
"xloc": [
3270
"default.handlebars->container->column_l->p11->deskarea0->deskarea1->1",
3271
"default.handlebars->container->column_l->p12->termTable->1->1->0->1->1",
@@ -3273,6 +3365,7 @@
3365
{
3366
"en": "Operating System",
3367
"fr": "Système opérateur",
3368
+ "cs": "Operační systém",
3369
"xloc": [
3370
"default.handlebars->13->40",
3371
"default.handlebars->13->241",
@@ -3288,6 +3381,7 @@
3381
},
3382
{
3383
"en": "Desktop",
3384
+ "cs": "Plocha",
3385
"xloc": [
3386
"default.handlebars->contextMenu->cxdesktop",
3387
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDevDesktop",
@@ -3297,6 +3391,7 @@
3391
},
3392
{
3393
"en": "Medium",
3394
+ "cs": "Středně",
3395
"xloc": [
3396
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarSize->sizeselect->3",
3397
"default.handlebars->container->dialog->dialogBody->dialog7->d7meshkvm->7->d7framelimiter->3",
@@ -3481,6 +3576,7 @@
3576
},
3577
{
3578
"en": "Invitation Link ({0})",
3579
+ "cs": "Link pro pozvání ({0})",
3580
"xloc": [
3581
"default.handlebars->13->133"
3582
]
@@ -3507,6 +3603,7 @@
3603
{
3604
"en": "My Events",
3605
"fr": "Mes Événements",
3606
+ "cs": "Moje události",
3607
"xloc": [
3608
"default.handlebars->container->page_leftbar",
3609
"default.handlebars->container->topbar->1->1->MainMenuSpan->1->0->MainMenuMyEvents",
@@ -3562,6 +3659,7 @@
3659
{
3660
"en": "Add Agent",
3661
"fr": "Ajouter un agent",
3662
+ "cs": "Přidat agenta",
3663
"xloc": [
3664
"default.handlebars->13->190"
3665
]
@@ -3581,6 +3679,7 @@
3679
{
3680
"en": "Add CIRA",
3681
"fr": "Ajouter CIRA",
3682
+ "cs": "Přidat CIRA",
3683
"xloc": [
3684
"default.handlebars->13->180"
3685
]
@@ -3667,6 +3766,7 @@
3766
{
3767
"en": "Up",
3768
"fr": "Up",
3769
+ "cs": "Nahoru",
3770
"xloc": [
3771
"default.handlebars->container->column_l->p5->p5toolbar->1->0->p5filehead->3",
3772
"default.handlebars->container->column_l->p13->p13toolbar->1->2->1->3",
@@ -3677,6 +3777,7 @@
3777
},
3778
{
3779
"en": "General",
3780
+ "cs": "Obecné",
3781
"xloc": [
3782
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDev",
3783
"default.handlebars->container->topbar->1->1->MeshSubMenuSpan->MeshSubMenu->1->0->MeshGeneral",
@@ -3686,12 +3787,14 @@
3787
},
3788
{
3789
"en": "Connect to your home or office devices from anywhere in the world using",
3790
+ "cs": "Přihlašte se na různá svá nebo firemní zařízení odkudkoliv z celého světa",
3791
"xloc": [
3792
"login.handlebars->container->column_l->welcomeText"
3793
]
3794
},
3795
{
3796
"en": "Type",
3797
+ "cs": "Typ",
3798
"xloc": [
3799
"default.handlebars->container->column_l->p11->deskarea0->deskarea4->3",
3800
"default.handlebars->13->575",
@@ -3706,6 +3809,7 @@
3809
{
3810
"en": "Name (optional)",
3811
"fr": "Nom: (optionnel)",
3812
+ "cs": "Jméno (volitelné)",
3813
"xloc": [
3814
"default.handlebars->13->238"
3815
]
@@ -3718,12 +3822,14 @@
3822
},
3823
{
3824
"en": "Select a new group for this device",
3825
+ "cs": "Vyber novou skupinu pro toto zařízení",
3826
"xloc": [
3827
"default.handlebars->13->522"
3828
]
3829
},
3830
{
3831
"en": "Gateway MAC",
3832
+ "cs": "MAC brány",
3833
"xloc": [
3834
"default.handlebars->13->67"
3835
]
@@ -3736,6 +3842,7 @@
3842
},
3843
{
3844
"en": "User + Files",
3845
+ "cs": "Uživatel + Soubory",
3846
"xloc": [
3847
"default.handlebars->13->1129"
3848
]
@@ -3808,6 +3915,7 @@
3915
{
3916
"en": "My Account",
3917
"fr": "Mon Compte",
3918
+ "cs": "Můj účet",
3919
"xloc": [
3920
"default.handlebars->container->page_leftbar",
3921
"default.handlebars->container->topbar->1->1->MainMenuSpan->1->0->MainMenuMyAccount",
@@ -3917,6 +4025,7 @@
4025
},
4026
{
4027
"en": "Filter",
4028
+ "cs": "Filtr",
4029
"xloc": [
4030
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->devListToolbar",
4031
"default.handlebars->container->column_l->p4->3->1->0->3->3"
@@ -3941,6 +4050,7 @@
4050
{
4051
"en": "Architecture",
4052
"fr": "Architecture",
4053
+ "cs": "Architektura",
4054
"xloc": [
4055
"default.handlebars->13->43"
4056
]
@@ -3983,6 +4093,7 @@
4093
},
4094
{
4095
"en": "Last 100",
4096
+ "cs": "Posledních 100",
4097
"fr": "100 dernières",
4098
"xloc": [
4099
"default.handlebars->container->column_l->p41->3->1->p41limitdropdown->1"
@@ -3991,6 +4102,7 @@
4102
{
4103
"en": "Last 120",
4104
"fr": "120 dernières",
4105
+ "cs": "Posledních 120",
4106
"xloc": [
4107
"default.handlebars->container->column_l->p3->3->1->0->3->p3limitdropdown->3",
4108
"default.handlebars->container->column_l->p16->3->1->0->5->p16limitdropdown->3",
@@ -4017,12 +4129,14 @@
4129
},
4130
{
4131
"en": "Account security",
4132
+ "cs": "Nastavení bezpečnosti",
4133
"xloc": [
4134
"default.handlebars->container->column_l->p2->p2AccountSecurity->1->0"
4135
]
4136
},
4137
{
4138
"en": "MeshCentral",
4139
+ "cs": "MeshCentral",
4140
"xloc": [
4141
"login.handlebars->container->column_l->welcomeText->1"
4142
]
@@ -4054,6 +4168,7 @@
4168
},
4169
{
4170
"en": "To uninstall, cut and paste the following command as root.",
4171
+ "cs": "Pro odinstalování spustťe tento příkaz pod s uživatelskými právy root.",
4172
"xloc": [
4173
"agentinvite.handlebars->container->column_l->5->linuxtab->9"
4174
]
@@ -4061,12 +4176,14 @@
4176
{
4177
"en": " Password hint can be used but is not recommanded.",
4178
"fr": "Un indice de mot de passe peut être utilisé mais n'est pas recommandé.",
4179
+ "cs": " Nápověda hesla může být použita, ale není doporučováno.",
4180
"xloc": [
4181
"default.handlebars->13->882"
4182
]
4183
},
4184
{
4185
"en": "{0} second{1} until disconnect",
4186
+ "cs": "{0} sekund{1} do odpojení",
4187
"xloc": [
4188
"default.handlebars->13->23"
4189
]
@@ -4074,6 +4191,7 @@
4191
{
4192
"en": "1 byte",
4193
"fr": "1 octet",
4194
+ "cs": "1 byte",
4195
"xloc": [
4196
"default.handlebars->13->1086",
4197
"default-mobile.handlebars->9->74",
@@ -4094,6 +4212,7 @@
4212
},
4213
{
4214
"en": "No Keys Configured",
4215
+ "cs": "Žádný klíč není zkonfigurován",
4216
"xloc": [
4217
"default.handlebars->13->102"
4218
]
@@ -4113,6 +4232,7 @@
4232
},
4233
{
4234
"en": "Create one",
4235
+ "cs": "Vytvořit",
4236
"xloc": [
4237
"login.handlebars->container->column_l->centralTable->1->0->logincell->loginpanel->1->newAccountDiv->1",
4238
"login-mobile.handlebars->container->page_content->column_l->1->1->0->1->loginpanel->1->newAccountDiv->1"
@@ -4132,6 +4252,7 @@
4252
},
4253
{
4254
"en": "No Terminal",
4255
+ "cs": "Žádný terminál",
4256
"xloc": [
4257
"default.handlebars->13->1053",
4258
"default-mobile.handlebars->9->317"
@@ -4139,6 +4260,7 @@
4260
},
4261
{
4262
"en": "Services",
4263
+ "cs": "Služby",
4264
"xloc": [
4265
"default.handlebars->container->column_l->p11->deskarea0->deskarea3x->DeskTools->deskToolsAreaTop->deskToolsTopTabService"
4266
]
@@ -4159,6 +4281,7 @@
4281
{
4282
"en": "1 month",
4283
"fr": "1 mois",
4284
+ "cs": "1 měsíc",
4285
"xloc": [
4286
"default.handlebars->13->131",
4287
"default.handlebars->13->252",
@@ -4167,6 +4290,7 @@
4290
},
4291
{
4292
"en": "You have been invited to install a software that will allow a remote operator to fully access your computer remotely including the desktop and files.\n Only follow the instructions below if this invitation was expected and you know who will be accessing your computer.\n Selecting your operation system and follow the instructions below.",
4293
+ "cs": "Byla vám doručena pozvánka k instalaci softwaru, který umožňuje vzdálenou správu zařízení.\n Postupujte podle níže uvedených pokynů, pokud jste si vědom toho, že tato pozvánka je legitimní a chcete tento přístup umožnit.\n Vyberte si operační systém a postupujte dle pokynů níže.",
4294
"xloc": [
4295
"agentinvite.handlebars->container->column_l->3"
4296
]
@@ -4181,6 +4305,7 @@
4305
{
4306
"en": "Sort by size",
4307
"fr": "Trier par taille",
4308
+ "cs": "Třídit podle velikosti",
4309
"xloc": [
4310
"default.handlebars->container->column_l->p5->p5toolbar->1->2->p5filesubhead->1->p5sortdropdown->3",
4311
"default.handlebars->container->column_l->p13->p13toolbar->1->4->1->1->p13sortdropdown->3",
@@ -4196,6 +4321,7 @@
4321
},
4322
{
4323
"en": "Delete User {0}",
4324
+ "cs": "Smazat uživatele {0}",
4325
"xloc": [
4326
"default.handlebars->13->1228"
4327
]
@@ -4227,6 +4353,7 @@
4353
},
4354
{
4355
"en": "Columns",
4356
+ "cs": "Buňky",
4357
"xloc": [
4358
"default.handlebars->container->column_l->p1->devListToolbarViewIcons",
4359
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarView->viewselect->1"
@@ -4242,6 +4369,7 @@
4369
},
4370
{
4371
"en": "Copy name to clipboard",
4372
+ "cs": "Zkopírovat jméno do schránky",
4373
"xloc": [
4374
"default.handlebars->13->58"
4375
]
@@ -4254,6 +4382,7 @@
4382
},
4383
{
4384
"en": "Tags",
4385
+ "cs": "Tagy",
4386
"xloc": [
4387
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarSort->sortselect->7",
4388
"default.handlebars->13->548",
@@ -4265,6 +4394,7 @@
4394
{
4395
"en": "Size",
4396
"fr": "Taille",
4397
+ "cs": "Velikost",
4398
"xloc": [
4399
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarSize"
4400
]
@@ -4338,6 +4468,7 @@
4468
},
4469
{
4470
"en": "Checking...",
4471
+ "cs": "Kontrola...",
4472
"xloc": [
4473
"default.handlebars->13->664"
4474
]
@@ -4400,6 +4531,7 @@
4531
{
4532
"en": "Last 8 hours",
4533
"fr": "8 dernières heures",
4534
+ "cs": "Posledních 8 hodin",
4535
"xloc": [
4536
"default.handlebars->container->column_l->p40->3->1->p40time->3"
4537
]
@@ -4453,6 +4585,7 @@
4585
{
4586
"en": "Last 500",
4587
"fr": "500 dernières",
4588
+ "cs": "Posledních 500",
4589
"xloc": [
4590
"default.handlebars->container->column_l->p3->3->1->0->3->p3limitdropdown->7",
4591
"default.handlebars->container->column_l->p16->3->1->0->5->p16limitdropdown->7",
@@ -4463,6 +4596,7 @@
4596
{
4597
"en": "Last week",
4598
"fr": "Dernière semaine",
4599
+ "cs": "Poslední týden",
4600
"xloc": [
4601
"default.handlebars->container->column_l->p40->3->1->p40time->7"
4602
]
@@ -4494,12 +4628,14 @@
4628
},
4629
{
4630
"en": "Agent is online",
4631
+ "cs": "Agent je online",
4632
"xloc": [
4633
"default.handlebars->13->635"
4634
]
4635
},
4636
{
4637
"en": "Power",
4638
+ "cs": "Napájení",
4639
"xloc": [
4640
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarSort->sortselect->3"
4641
]
@@ -4558,6 +4694,7 @@
4694
},
4695
{
4696
"en": "Agent connected",
4697
+ "cs": "Agent připojen",
4698
"xloc": [
4699
"default.handlebars->13->115",
4700
"default.handlebars->13->487",
@@ -4642,6 +4779,7 @@
4779
{
4780
"en": "Good Password",
4781
"fr": "Bon mot de passe",
4782
+ "cs": "Dobré heslo",
4783
"xloc": [
4784
"login.handlebars->5->5",
4785
"login.handlebars->5->9",
@@ -4652,6 +4790,7 @@
4790
{
4791
"en": "Memory",
4792
"fr": "Mémoire",
4793
+ "cs": "Paměť",
4794
"xloc": [
4795
"default.handlebars->container->column_l->p40->3->1->p40type->3",
4796
"default.handlebars->13->36",
@@ -4691,12 +4830,14 @@
4830
},
4831
{
4832
"en": "Log Event",
4833
+ "cs": "Log udalostí",
4834
"xloc": [
4835
"default.handlebars->13->467"
4836
]
4837
},
4838
{
4839
"en": "Add Mesh Agent",
4840
+ "cs": "Přidat agenta",
4841
"xloc": [
4842
"default.handlebars->13->302"
4843
]
@@ -4732,6 +4873,7 @@
4873
},
4874
{
4875
"en": "Frame rate",
4876
+ "cs": "Obnovování",
4877
"xloc": [
4878
"default.handlebars->container->dialog->dialogBody->dialog7->d7meshkvm->7->1"
4879
]
@@ -4751,6 +4893,7 @@
4893
},
4894
{
4895
"en": "Plugins",
4896
+ "cs": "Pluginy",
4897
"xloc": [
4898
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDevPlugins"
4899
]
@@ -4758,6 +4901,7 @@
4901
{
4902
"en": "Name",
4903
"fr": "Nom",
4904
+ "cs": "Jméno",
4905
"xloc": [
4906
"default.handlebars->container->column_l->p11->deskarea0->deskarea3x->DeskTools->deskToolsArea->DeskToolsProcessTab->deskToolsHeader->3",
4907
"default.handlebars->container->column_l->p11->deskarea0->deskarea3x->DeskTools->deskToolsArea->DeskToolsServiceTab->deskToolsServiceHeader->3",
@@ -4916,6 +5060,7 @@
5060
},
5061
{
5062
"en": "Device Action",
5063
+ "cs": "Akce zařízení",
5064
"xloc": [
5065
"default.handlebars->13->509",
5066
"default-mobile.handlebars->9->208"
@@ -4992,6 +5137,7 @@
5137
},
5138
{
5139
"en": "Cut",
5140
+ "cs": "Vyjmout",
5141
"xloc": [
5142
"default.handlebars->container->column_l->p5->p5toolbar->1->0->p5filehead->3",
5143
"default.handlebars->container->column_l->p13->p13toolbar->1->2->1->3",
@@ -5100,6 +5246,7 @@
5246
},
5247
{
5248
"en": "Delete Device",
5249
+ "cs": "Smazat zařízení",
5250
"xloc": [
5251
"default.handlebars->13->472",
5252
"default-mobile.handlebars->9->196"
@@ -5108,6 +5255,7 @@
5255
{
5256
"en": "Reset Account",
5257
"fr": "Réinitialiser le Compte",
5258
+ "cs": "Reset účtu",
5259
"xloc": [
5260
"login.handlebars->container->column_l->centralTable->1->0->logincell->resetpanel->1->7->1->2->1->1",
5261
"login-mobile.handlebars->container->page_content->column_l->1->1->0->1->resetpanel->1->7->1->2->1->1"
@@ -5123,6 +5271,7 @@
5271
},
5272
{
5273
"en": "Change Group",
5274
+ "cs": "Změnit skupinu",
5275
"xloc": [
5276
"default.handlebars->13->470",
5277
"default.handlebars->13->525",
@@ -5192,6 +5341,7 @@
5341
},
5342
{
5343
"en": "Copy",
5344
+ "cs": "Kopírovat",
5345
"xloc": [
5346
"default.handlebars->container->column_l->p5->p5toolbar->1->0->p5filehead->3",
5347
"default.handlebars->container->column_l->p13->p13toolbar->1->2->1->3",
@@ -5211,6 +5361,7 @@
5361
},
5362
{
5363
"en": "Very slow",
5364
+ "cs": "Velmi pomalu",
5365
"xloc": [
5366
"default.handlebars->container->dialog->dialogBody->dialog7->d7meshkvm->7->d7framelimiter->7",
5367
"default-mobile.handlebars->dialog->3->dialog7->d7meshkvm->7->d7framelimiter->7"
@@ -5225,6 +5376,7 @@
5376
},
5377
{
5378
"en": "Copy MacOS agent URL to clipboard",
5379
+ "cs": "Kopírovat odkaz pro MacOS agenta do schránky",
5380
"xloc": [
5381
"default.handlebars->13->293"
5382
]
@@ -5232,6 +5384,7 @@
5384
{
5385
"en": "OS Name",
5386
"fr": "Nom du système",
5387
+ "cs": "Jméno operačního systému",
5388
"xloc": [
5389
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->devListToolbar->7->1"
5390
]
@@ -5293,6 +5446,7 @@
5446
{
5447
"en": "Restrictions",
5448
"fr": "Restrictions",
5449
+ "cs": "Omezení",
5450
"xloc": [
5451
"default.handlebars->13->1186"
5452
]
@@ -5341,6 +5495,7 @@
5495
},
5496
{
5497
"en": "Last seen:",
5498
+ "cs": "Naposledy spatřen:",
5499
"xloc": [
5500
"default.handlebars->13->44",
5501
"default.handlebars->13->495"
@@ -5364,6 +5519,7 @@
5519
},
5520
{
5521
"en": "{0}k left",
5522
+ "cs": "{0}k zbývá",
5523
"xloc": [
5524
"default-mobile.handlebars->9->68"
5525
]
@@ -5388,6 +5544,7 @@
5544
},
5545
{
5546
"en": "MAC address",
5547
+ "cs": "MAC adresa",
5548
"xloc": [
5549
"default.handlebars->13->59"
5550
]
@@ -5423,6 +5580,7 @@
5580
},
5581
{
5582
"en": "{0} gigabytes remaining",
5583
+ "cs": "{0} gigabytů zbývá",
5584
"xloc": [
5585
"default.handlebars->13->1075"
5586
]
@@ -5435,6 +5593,7 @@
5593
},
5594
{
5595
"en": "Don't have an account?",
5596
+ "cs": "Nemáte účet?",
5597
"xloc": [
5598
"login.handlebars->container->column_l->centralTable->1->0->logincell->loginpanel->1->newAccountDiv",
5599
"login-mobile.handlebars->container->page_content->column_l->1->1->0->1->loginpanel->1->newAccountDiv"
@@ -5442,6 +5601,7 @@
5601
},
5602
{
5603
"en": "MQTT connected",
5604
+ "cs": "MQTT připojeno",
5605
"xloc": [
5606
"default.handlebars->13->118",
5607
"default.handlebars->13->493"
@@ -5456,6 +5616,7 @@
5616
{
5617
"en": "Security",
5618
"fr": "Sécurité",
5619
+ "cs": "Bezpečnost",
5620
"xloc": [
5621
"default.handlebars->13->200",
5622
"default.handlebars->13->515",
@@ -5471,6 +5632,7 @@
5632
},
5633
{
5634
"en": "Create a new device group using the options below.",
5635
+ "cs": "Vytvořit novou skupinu zařízení podle nastavení níže.",
5636
"xloc": [
5637
"default.handlebars->13->895"
5638
]
@@ -5526,6 +5688,7 @@
5688
{
5689
"en": "Sort by state",
5690
"fr": "Trier par état",
5691
+ "cs": "Třídit podle stavu",
5692
"xloc": [
5693
"default.handlebars->container->column_l->p11->deskarea0->deskarea3x->DeskTools->deskToolsArea->DeskToolsServiceTab->deskToolsServiceHeader"
5694
]
@@ -5551,6 +5714,7 @@
5714
},
5715
{
5716
"en": "Normal Speed",
5717
+ "cs": "Normalní rychlost",
5718
"xloc": [
5719
"player.htm->p11->deskarea0->deskarea4->3->PlaySpeed->5"
5720
]
@@ -5587,6 +5751,7 @@
5751
},
5752
{
5753
"en": "Remote Agent Installation",
5754
+ "cs": "Instalace agenta pro vzdálený přístup",
5755
"xloc": [
5756
"agentinvite.handlebars->container->column_l->1"
5757
]
@@ -5608,6 +5773,7 @@
5773
{
5774
"en": "Last interfaces update",
5775
"fr": "Dernière mise à jour des interfaces",
5776
+ "cs": "Poslední změna rozhraní",
5777
"xloc": [
5778
"default.handlebars->13->54"
5779
]
@@ -5620,6 +5786,7 @@
5786
},
5787
{
5788
"en": "Console - ",
5789
+ "cs": "Konzole - ",
5790
"xloc": [
5791
"default.handlebars->13->379"
5792
]
@@ -5627,6 +5794,7 @@
5794
{
5795
"en": "Map",
5796
"fr": "Carte",
5797
+ "cs": "Mapa",
5798
"xloc": [
5799
"default.handlebars->container->column_l->p1->devListToolbarViewIcons",
5800
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarView->viewselect->viewselectmapoption"
@@ -5635,6 +5803,7 @@
5803
{
5804
"en": "Success",
5805
"fr": "Succès",
5806
+ "cs": "Úspěch",
5807
"xloc": [
5808
"default.handlebars->13->45"
5809
]
@@ -5642,6 +5811,7 @@
5811
{
5812
"en": "Invite someone to install the mesh agent. An email with be sent with the link to the mesh agent installation for the \\\"{0}\\\" device group.",
5813
"fr": "Invitez quelqu'un à installer l'agent de maillage. Un email doit être envoyé avec le lien vers l’installation de l’agent de maillage pour le groupe de périphériques \\\"{0}\\\".",
5814
+ "cs": "Pozvěte někoho k instalaci agenta. Emailem bude zaslán link s adresou agenta pro skupinu \\\"{0}\\\".",
5815
"xloc": [
5816
"default.handlebars->13->237"
5817
]
@@ -5649,6 +5819,7 @@
5819
{
5820
"en": "Permissions",
5821
"fr": "Permissions",
5822
+ "cs": "Práva",
5823
"xloc": [
5824
"default.handlebars->13->1062",
5825
"default.handlebars->13->1116",
@@ -5683,6 +5854,7 @@
5854
{
5855
"en": "No devices in this group",
5856
"fr": "Aucun appareil dans ce groupe",
5857
+ "cs": "Žádné zařízení v této skupině",
5858
"xloc": [
5859
"default.handlebars->13->160",
5860
"default-mobile.handlebars->9->94"
@@ -5712,6 +5884,7 @@
5884
{
5885
"en": "Terminal",
5886
"fr": "Terminal",
5887
+ "cs": "Terminál",
5888
"xloc": [
5889
"default.handlebars->contextMenu->cxterminal",
5890
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDevTerminal",
@@ -5749,6 +5922,7 @@
5922
{
5923
"en": "Welcome",
5924
"fr": "Bienvenue",
5925
+ "cs": "Vítejte",
5926
"xloc": [
5927
"login.handlebars->container->column_l->1"
5928
]
@@ -5768,12 +5942,14 @@
5942
},
5943
{
5944
"en": ", the real time, open source remote monitoring and management web site. You will need to download and install a management agent on your computers. Once installed, computers will show up in the \"My Devices\" section of this web site and you will be able to monitor them and take control of them.",
5945
+ "cs": ". Jednoduchá správa přes web. Jediné co potřebujete je agent na daném zařízení. Po instalaci uvidíte zařízení v sekci \"Moje zařízení\" a můžete toto zařízení ovládat.",
5946
"xloc": [
5947
"login.handlebars->container->column_l->welcomeText"
5948
]
5949
},
5950
{
5951
"en": "Select an operation to perform on this device.",
5952
+ "cs": "Vyber operaci na tomto zařízení.",
5953
"xloc": [
5954
"default.handlebars->13->502",
5955
"default-mobile.handlebars->9->202"
@@ -5781,6 +5957,7 @@
5957
},
5958
{
5959
"en": "Day",
5960
+ "cs": "Den",
5961
"xloc": [
5962
"default.handlebars->13->510"
5963
]
@@ -5798,6 +5975,7 @@
5975
{
5976
"en": "Remove",
5977
"fr": "Retirer",
5978
+ "cs": "Odstranit",
5979
"xloc": [
5980
"default.handlebars->13->101"
5981
]
@@ -5989,6 +6167,7 @@
6167
},
6168
{
6169
"en": "Fast",
6170
+ "cs": "Rychle",
6171
"xloc": [
6172
"default.handlebars->container->dialog->dialogBody->dialog7->d7meshkvm->7->d7framelimiter->1",
6173
"default-mobile.handlebars->dialog->3->dialog7->d7meshkvm->7->d7framelimiter->1"
@@ -6039,6 +6218,7 @@
6218
},
6219
{
6220
"en": "Download",
6221
+ "cs": "Stažení",
6222
"xloc": [
6223
"download.handlebars->container->page_content->column_l->1"
6224
]
@@ -6244,6 +6424,7 @@
6424
{
6425
"en": "Tools",
6426
"fr": "Outils",
6427
+ "cs": "Nástroje",
6428
"xloc": [
6429
"default.handlebars->container->column_l->p11->deskarea0->deskarea4->1"
6430
]
@@ -6254,6 +6435,7 @@
6435
},
6436
{
6437
"en": "No TLS security",
6438
+ "cs": "Žádné TLS",
6439
"xloc": [
6440
"default.handlebars->13->201",
6441
"default.handlebars->13->516",
@@ -6276,12 +6458,14 @@
6458
},
6459
{
6460
"en": "Enable web notifications",
6461
+ "cs": "Zapnout notifikace prohlížeče",
6462
"xloc": [
6463
"default.handlebars->container->column_l->p2->p2AccountActions->3->accountEnableNotificationsSpan->0"
6464
]
6465
},
6466
{
6467
"en": "Public Link",
6468
+ "cs": "Veřejný odkaz",
6469
"xloc": [
6470
"default.handlebars->13->1083",
6471
"default-mobile.handlebars->9->71"
@@ -6289,6 +6473,7 @@
6473
},
6474
{
6475
"en": "No Tools (MeshCmd/Router)",
6476
+ "cs": "Žádné nástroje (MeshCmd/Router)",
6477
"xloc": [
6478
"default.handlebars->13->1179"
6479
]
@@ -6321,6 +6506,7 @@
6506
},
6507
{
6508
"en": "Processes",
6509
+ "cs": "Procesy",
6510
"xloc": [
6511
"default.handlebars->container->column_l->p11->deskarea0->deskarea3x->DeskTools->deskToolsAreaTop->deskToolsTopTabProcess",
6512
"default-mobile.handlebars->container->page_content->column_l->p10->p10desktop->deskarea3->deskarea3x->DeskTools->DeskToolsBar"
@@ -6335,6 +6521,7 @@
6521
{
6522
"en": "Last 250",
6523
"fr": "250 dernières",
6524
+ "cs": "Posledních 250",
6525
"xloc": [
6526
"default.handlebars->container->column_l->p3->3->1->0->3->p3limitdropdown->5",
6527
"default.handlebars->container->column_l->p16->3->1->0->5->p16limitdropdown->5",
@@ -6357,6 +6544,7 @@
6544
{
6545
"en": "Invite someone to install the mesh agent by sharing an invitation link. This link points the user to installation instructions for the \\\"{0}\\\" device group. The link is public and no account for this server is needed.",
6546
"fr": "Invitez quelqu'un à installer l'agent de maillage en partageant un lien d'invitation. Ce lien renvoie l'utilisateur aux instructions d'installation du groupe de périphériques \\\"{0}\\\". Le lien est public et aucun compte n'est requis pour ce serveur.",
6547
+ "cs": "Pozvěte někoho k instalaci agenta pomocí sdíleného odkazu. Tento link obsahuje instrukce pro instalaci do skupiny \\\"{0}\\\". Link je veřejný a protistrana nepotřebuje žádný účet na tomto serveru.",
6548
"xloc": [
6549
"default.handlebars->13->260"
6550
]
@@ -6375,6 +6563,7 @@
6563
},
6564
{
6565
"en": "Password hint:",
6566
+ "cs": "Nápovšda k heslu:",
6567
"xloc": [
6568
"default.handlebars->13->886",
6569
"default-mobile.handlebars->9->44"
@@ -6382,6 +6571,7 @@
6571
},
6572
{
6573
"en": "Input",
6574
+ "cs": "Vstup",
6575
"xloc": [
6576
"default.handlebars->container->column_l->p11->deskarea0->deskarea4->3->9->DeskControlSpan",
6577
"default-mobile.handlebars->container->page_content->column_l->p10->p10desktop->deskarea4->1->3->11->DeskControlSpan"
@@ -6389,12 +6579,14 @@
6579
},
6580
{
6581
"en": "Device",
6582
+ "cs": "Zařízení",
6583
"xloc": [
6584
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarSort->sortselect->5"
6585
]
6586
},
6587
{
6588
"en": "Device is in deep sleep state (S3).",
6589
+ "cs": "Zařízení je v hlubokém spánku (S3).",
6590
"xloc": [
6591
"default.handlebars->13->311"
6592
]
@@ -6416,6 +6608,7 @@
6608
},
6609
{
6610
"en": "User Name",
6611
+ "cs": "Uživatel",
6612
"xloc": [
6613
"default.handlebars->13->1060"
6614
]
@@ -6445,6 +6638,7 @@
6638
{
6639
"en": "Back",
6640
"fr": "Retour",
6641
+ "cs": "Zpět",
6642
"xloc": [
6643
"default.handlebars->container->column_l->p10->1->1->0->1->p10title->p10BackButton",
6644
"default.handlebars->container->column_l->p11->p11title->p11deviceNameHeader->p11BackButton",
@@ -6475,6 +6669,7 @@
6669
},
6670
{
6671
"en": "Send installation link",
6672
+ "cs": "Odeslat odkaz na instalaci",
6673
"xloc": [
6674
"default.handlebars->13->242"
6675
]
@@ -6501,6 +6696,7 @@
6696
{
6697
"en": "Invite",
6698
"fr": "Inviter",
6699
+ "cs": "Pozvat",
6700
"xloc": [
6701
"default.handlebars->13->192",
6702
"default.handlebars->13->269",
@@ -6550,6 +6746,7 @@
6746
{
6747
"en": "Sleep",
6748
"fr": "Dormir",
6749
+ "cs": "Spánek",
6750
"xloc": [
6751
"default.handlebars->13->2",
6752
"default.handlebars->13->3",
@@ -6609,6 +6806,7 @@
6806
},
6807
{
6808
"en": "Change Password",
6809
+ "cs": "Změnit heslo",
6810
"xloc": [
6811
"default.handlebars->13->888",
6812
"default-mobile.handlebars->9->46"
@@ -6666,6 +6864,7 @@
6864
{
6865
"en": "Add Device Group",
6866
"fr": "Ajouter un groupe",
6867
+ "cs": "Přidat skupinu zařízení",
6868
"xloc": [
6869
"default.handlebars->13->163"
6870
]
@@ -6746,6 +6945,7 @@
6945
{
6946
"en": "My Files",
6947
"fr": "Mes Dossiers",
6948
+ "cs": "Moje soubory",
6949
"xloc": [
6950
"default.handlebars->container->page_leftbar",
6951
"default.handlebars->container->topbar->1->1->MainMenuSpan->1->0->MainMenuMyFiles",
@@ -6799,6 +6999,7 @@
6999
{
7000
"en": "Sort",
7001
"fr": "Trier",
7002
+ "cs": "Třídit",
7003
"xloc": [
7004
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarSort"
7005
]
@@ -6813,6 +7014,7 @@
7014
{
7015
"en": "Upload",
7016
"fr": "Télécharger",
7017
+ "cs": "Nahrát",
7018
"xloc": [
7019
"default.handlebars->container->column_l->p5->p5toolbar->1->0->p5filehead->3",
7020
"default.handlebars->container->column_l->p13->p13toolbar->1->2->1->3",
@@ -6856,6 +7058,7 @@
7058
{
7059
"en": "Power off",
7060
"fr": "Éteindre",
7061
+ "cs": "Vypnout",
7062
"xloc": [
7063
"default.handlebars->13->6",
7064
"default.handlebars->13->506",
@@ -6942,6 +7145,7 @@
7145
},
7146
{
7147
"en": "Change password",
7148
+ "cs": "Změnit heslo",
7149
"xloc": [
7150
"default.handlebars->container->column_l->p2->p2AccountActions->3->13",
7151
"default-mobile.handlebars->container->page_content->column_l->p3->p3info->1->p3AccountActions->7->5->0"
@@ -6962,6 +7166,7 @@
7166
},
7167
{
7168
"en": "Connect",
7169
+ "cs": "Připojit",
7170
"xloc": [
7171
"default.handlebars->container->column_l->p11->deskarea0->deskarea1->3->connectbutton1span",
7172
"default.handlebars->container->column_l->p12->termTable->1->1->0->1->3->connectbutton2span",
@@ -7080,6 +7285,7 @@
7285
{
7286
"en": "Last 60",
7287
"fr": "60 dernières",
7288
+ "cs": "Posledních 60",
7289
"xloc": [
7290
"default.handlebars->container->column_l->p3->3->1->0->3->p3limitdropdown->1",
7291
"default.handlebars->container->column_l->p16->3->1->0->5->p16limitdropdown->1",
@@ -7100,6 +7306,7 @@
7306
},
7307
{
7308
"en": "Logout",
7309
+ "cs": "Odhlásit",
7310
"xloc": [
7311
"default-mobile.handlebars->topMenu->logoutMenuOption->0->0"
7312
]
@@ -7158,6 +7365,7 @@
7365
},
7366
{
7367
"en": "Download File",
7368
+ "cs": "Stáhnout soubor",
7369
"xloc": [
7370
"default.handlebars->13->627",
7371
"default-mobile.handlebars->9->268"
@@ -7184,6 +7392,7 @@
7392
},
7393
{
7394
"en": "Address",
7395
+ "cs": "Adresa",
7396
"xloc": [
7397
"default.handlebars->13->137",
7398
"default.handlebars->13->154"
@@ -7211,6 +7420,7 @@
7420
},
7421
{
7422
"en": "Delete account",
7423
+ "cs": "Smazat účet",
7424
"xloc": [
7425
"default.handlebars->container->column_l->p2->p2AccountActions->3->17",
7426
"default-mobile.handlebars->container->page_content->column_l->p3->p3info->1->p3AccountActions->7->7->0"
@@ -7256,6 +7466,7 @@
7466
},
7467
{
7468
"en": "To remove a mesh agent, download the file below, run it and click \\\"uninstall\\\".",
7469
+ "cs": "Pro odstranění agenta si stáhněte soubor níže, spusťte tento soubor a zvolte \\\"uninstall\\\".",
7470
"xloc": [
7471
"default.handlebars->13->294"
7472
]
@@ -7424,6 +7635,7 @@
7635
{
7636
"en": "Weak Password",
7637
"fr": "Mot de passe faible",
7638
+ "cs": "Slabé heslo",
7639
"xloc": [
7640
"login.handlebars->5->6",
7641
"login.handlebars->5->10",
@@ -7451,6 +7663,7 @@
7663
},
7664
{
7665
"en": "Settings",
7666
+ "cs": "Nastavení",
7667
"xloc": [
7668
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->kvmListToolbar",
7669
"default-mobile.handlebars->container->page_content->column_l->p10->p10desktop->deskarea4->1->3"
@@ -7479,6 +7692,7 @@
7692
{
7693
"en": "Requirements: ",
7694
"fr": "Exigences:",
7695
+ "cs": "Požadavky: ",
7696
"xloc": [
7697
"default.handlebars->13->887"
7698
]
@@ -7523,6 +7737,7 @@
7737
},
7738
{
7739
"en": "General information",
7740
+ "cs": "Obecné informace",
7741
"xloc": [
7742
"default.handlebars->13->356"
7743
]
@@ -7535,6 +7750,7 @@
7750
},
7751
{
7752
"en": ", run it and press \"Install\" or \"Connect\".",
7753
+ "cs": ", spusťte soubor a zvolte \"Install\" nebo \"Connect\".",
7754
"xloc": [
7755
"agentinvite.handlebars->container->column_l->5->wintab64->3",
7756
"agentinvite.handlebars->container->column_l->5->wintab32->3"
@@ -7596,6 +7812,7 @@
7812
},
7813
{
7814
"en": "To add a computer to {0} run the following command. Root credentials will be needed.",
7815
+ "cs": "Pro přidání do {0} spusťte následující příkaz. Je třeba spouštět pod rootem.",
7816
"xloc": [
7817
"default.handlebars->13->289"
7818
]
@@ -7633,6 +7850,7 @@
7850
},
7851
{
7852
"en": "Remote",
7853
+ "cs": "Vzdálený",
7854
"xloc": [
7855
"messenger.handlebars->remoteVideo->1"
7856
]
@@ -7652,6 +7870,7 @@
7870
{
7871
"en": "1 hour",
7872
"fr": "1 heure",
7873
+ "cs": "1 hodina",
7874
"xloc": [
7875
"default.handlebars->13->248",
7876
"default.handlebars->13->262"
@@ -7665,12 +7884,14 @@
7884
},
7885
{
7886
"en": "Plugins -",
7887
+ "cs": "Pluginy -",
7888
"xloc": [
7889
"default.handlebars->container->column_l->p19->1"
7890
]
7891
},
7892
{
7893
"en": "Waiting for other user...",
7894
+ "cs": "Čekání na ostatní uživatele...",
7895
"xloc": [
7896
"messenger.handlebars->13->6"
7897
]
@@ -7683,12 +7904,14 @@
7904
},
7905
{
7906
"en": "Image Encoding",
7907
+ "cs": "Kódovaní obrazu",
7908
"xloc": [
7909
"default.handlebars->container->dialog->dialogBody->dialog7->d7amtkvm->3->1"
7910
]
7911
},
7912
{
7913
"en": "Move to device group",
7914
+ "cs": "Přesunout do skupiny zařízení",
7915
"xloc": [
7916
"default.handlebars->13->346"
7917
]
@@ -7716,6 +7939,7 @@
7939
{
7940
"en": "New Folder",
7941
"fr": "Nouveau Dossier",
7942
+ "cs": "Nový adresář",
7943
"xloc": [
7944
"default.handlebars->container->column_l->p5->p5toolbar->1->0->p5filehead->3",
7945
"default.handlebars->container->column_l->p13->p13toolbar->1->2->1->3",
@@ -7727,6 +7951,7 @@
7951
},
7952
{
7953
"en": "Features",
7954
+ "cs": "Funkce",
7955
"xloc": [
7956
"default.handlebars->13->930"
7957
]
@@ -7746,12 +7971,14 @@
7971
},
7972
{
7973
"en": "7 Day Power State",
7974
+ "cs": "7 denní statistika provozu",
7975
"xloc": [
7976
"default.handlebars->13->512"
7977
]
7978
},
7979
{
7980
"en": "Copy to clipboard",
7981
+ "cs": "Zkopírovat do schránky",
7982
"xloc": [
7983
"agentinvite.handlebars->container->column_l->5->linuxtab",
7984
"agentinvite.handlebars->container->column_l->5->linuxtab"
@@ -7784,12 +8011,14 @@
8011
},
8012
{
8013
"en": "Local",
8014
+ "cs": "Lokální",
8015
"xloc": [
8016
"messenger.handlebars->localVideo->1"
8017
]
8018
},
8019
{
8020
"en": "Lock Account",
8021
+ "cs": "Uzamknout účet",
8022
"xloc": [
8023
"default.handlebars->13->1177"
8024
]
@@ -7797,6 +8026,7 @@
8026
{
8027
"en": "Slow",
8028
"fr": "Lent",
8029
+ "cs": "Pomalu",
8030
"xloc": [
8031
"default.handlebars->container->dialog->dialogBody->dialog7->d7meshkvm->7->d7framelimiter->5",
8032
"default-mobile.handlebars->dialog->3->dialog7->d7meshkvm->7->d7framelimiter->5"
@@ -7860,6 +8090,7 @@
8090
},
8091
{
8092
"en": "Failed",
8093
+ "cs": "Selhalo",
8094
"xloc": [
8095
"default.handlebars->13->46"
8096
]
@@ -7887,6 +8118,7 @@
8118
},
8119
{
8120
"en": "Mesh Agent Console",
8121
+ "cs": "Konzole agenta",
8122
"xloc": [
8123
"default.handlebars->13->1035",
8124
"default-mobile.handlebars->9->300"
@@ -7894,6 +8126,7 @@
8126
},
8127
{
8128
"en": "Server Statistics",
8129
+ "cs": "Statistiky serveru",
8130
"xloc": [
8131
"default.handlebars->container->column_l->p6->8"
8132
]
@@ -7901,6 +8134,7 @@
8134
{
8135
"en": "SelectAll",
8136
"fr": "ToutSélectionner",
8137
+ "cs": "Vybrat vše",
8138
"xloc": [
8139
"default-mobile.handlebars->container->page_content->column_l->p5->p5myfiles->p5toolbar->1->0->1->1",
8140
"default-mobile.handlebars->container->page_content->column_l->p10->p10files->p13toolbar->1->2->1->1"
@@ -7908,6 +8142,7 @@
8142
},
8143
{
8144
"en": "click to reconnect",
8145
+ "cs": "klikni pro opětovné připojení",
8146
"xloc": [
8147
"default.handlebars->container->column_l->p0->p0message->2->0",
8148
"default-mobile.handlebars->container->page_content->column_l->p0->1->p0message->2->0"
@@ -7937,6 +8172,7 @@
8172
{
8173
"en": "Keyboard",
8174
"fr": "Clavier",
8175
+ "cs": "Klávesnice",
8176
"xloc": [
8177
"default-mobile.handlebars->container->page_content->column_l->p10->p10desktop->deskarea4->1->3"
8178
]
@@ -7944,6 +8180,7 @@
8180
{
8181
"en": "Refresh",
8182
"fr": "Rafraîchir",
8183
+ "cs": "Obnovit",
8184
"xloc": [
8185
"default.handlebars->container->column_l->p11->deskarea0->deskarea3x->DeskTools->deskToolsAreaTop->DeskToolsRefreshButton",
8186
"default.handlebars->container->column_l->p13->p13toolbar->1->2->1->3",
@@ -7957,6 +8194,7 @@
8194
{
8195
"en": "Megabytes",
8196
"fr": "Mégaoctets",
8197
+ "cs": "Megabytů",
8198
"xloc": [
8199
"default.handlebars->13->1249"
8200
]
@@ -7981,12 +8219,14 @@
8219
},
8220
{
8221
"en": "Details -",
8222
+ "cs": "Detaily -",
8223
"xloc": [
8224
"default.handlebars->container->column_l->p17->p17title->3"
8225
]
8226
},
8227
{
8228
"en": "Device is in sleep state (S1)",
8229
+ "cs": "Zařízení je ve stavu spánku (S1)",
8230
"xloc": [
8231
"default.handlebars->13->320",
8232
"default-mobile.handlebars->9->112"
@@ -8000,6 +8240,7 @@
8240
},
8241
{
8242
"en": "Setup Method",
8243
+ "cs": "Setup",
8244
"xloc": [
8245
"default.handlebars->13->217"
8246
]
@@ -8036,6 +8277,7 @@
8277
},
8278
{
8279
"en": "Device is in deep sleep state (S3)",
8280
+ "cs": "Zařízení je v hlubokém spánku (S3)",
8281
"xloc": [
8282
"default.handlebars->13->322",
8283
"default-mobile.handlebars->9->114"
@@ -8055,6 +8297,7 @@
8297
},
8298
{
8299
"en": "Open File...",
8300
+ "cs": "Otevřít soubor...",
8301
"xloc": [
8302
"player.htm->p11->deskarea0->deskarea1->3",
8303
"player.htm->3->19"
@@ -8076,6 +8319,7 @@
8319
{
8320
"en": "Strong Password",
8321
"fr": "Mot de passe fort",
8322
+ "cs": "Silné heslo",
8323
"xloc": [
8324
"login.handlebars->5->4",
8325
"login.handlebars->5->8",
@@ -8104,6 +8348,7 @@
8348
},
8349
{
8350
"en": "Download the installer here",
8351
+ "cs": "Stáhnout instalaci zde",
8352
"xloc": [
8353
"agentinvite.handlebars->container->column_l->5->macostab->3->macosurl"
8354
]
@@ -8123,6 +8368,7 @@
8368
},
8369
{
8370
"en": "Activation",
8371
+ "cs": "Aktivace",
8372
"xloc": [
8373
"default.handlebars->13->186",
8374
"default.handlebars->13->188",
@@ -8194,6 +8440,7 @@
8440
},
8441
{
8442
"en": "Files -",
8443
+ "cs": "Soubory -",
8444
"xloc": [
8445
"default.handlebars->container->column_l->p13->p13title->3"
8446
]
@@ -8243,12 +8490,14 @@
8490
},
8491
{
8492
"en": "Perform Agent Action",
8493
+ "cs": "Akce agenta",
8494
"xloc": [
8495
"default.handlebars->13->642"
8496
]
8497
},
8498
{
8499
"en": "Email not verified",
8500
+ "cs": "Email není ověřen",
8501
"xloc": [
8502
"default.handlebars->13->1189"
8503
]
@@ -8298,6 +8547,7 @@
8547
},
8548
{
8549
"en": "Account Reset",
8550
+ "cs": "Reset hesla",
8551
"xloc": [
8552
"login.handlebars->container->column_l->centralTable->1->0->logincell->resetpanel->1->5->1",
8553
"login-mobile.handlebars->container->page_content->column_l->1->1->0->1->resetpanel->1->5->1"
@@ -8305,12 +8555,14 @@
8555
},
8556
{
8557
"en": "Delete Nodes",
8558
+ "cs": "Smazat nody",
8559
"xloc": [
8560
"default.handlebars->13->352"
8561
]
8562
},
8563
{
8564
"en": "Connect to server",
8565
+ "cs": "Připojit se na server",
8566
"xloc": [
8567
"default.handlebars->13->994",
8568
"default.handlebars->13->998"
@@ -8324,6 +8576,7 @@
8576
},
8577
{
8578
"en": "Enable browser notification",
8579
+ "cs": "Zapnout notifikace v prohlížeči",
8580
"xloc": [
8581
"messenger.handlebars->xtop"
8582
]
@@ -8331,6 +8584,7 @@
8584
{
8585
"en": "Password:",
8586
"fr": "Mot de passe:",
8587
+ "cs": "Heslo:",
8588
"xloc": [
8589
"default.handlebars->13->878",
8590
"default.handlebars->13->879",
@@ -8363,6 +8617,7 @@
8617
{
8618
"en": "Select None",
8619
"fr": "Rien sélectionner",
8620
+ "cs": "Vybrat nic",
8621
"xloc": [
8622
"default.handlebars->meshContextMenu->cxselectnone",
8623
"default.handlebars->13->337",
@@ -8378,6 +8633,7 @@
8633
},
8634
{
8635
"en": "Desktops",
8636
+ "cs": "Desktopy",
8637
"xloc": [
8638
"default.handlebars->container->column_l->p1->devListToolbarViewIcons",
8639
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarView->viewselect->5"
@@ -8385,6 +8641,7 @@
8641
},
8642
{
8643
"en": "Device name",
8644
+ "cs": "Název zařízení",
8645
"xloc": [
8646
"default.handlebars->13->369"
8647
]
@@ -8409,6 +8666,7 @@
8666
},
8667
{
8668
"en": "Try again.",
8669
+ "cs": "Zkusit znovu.",
8670
"xloc": [
8671
"default.handlebars->13->92"
8672
]
@@ -8424,6 +8682,7 @@
8682
},
8683
{
8684
"en": "Change your account password by entering the old password and new password twice in the boxes below.",
8685
+ "cs": "Změnit heslo zadáním starého a dvakrát nového hesla níže.",
8686
"xloc": [
8687
"default.handlebars->13->881"
8688
]
@@ -8431,6 +8690,7 @@
8690
{
8691
"en": "Password*",
8692
"fr": "Mot de passe*",
8693
+ "cs": "Heslo*",
8694
"xloc": [
8695
"default.handlebars->13->985",
8696
"default.handlebars->13->986"
@@ -8451,6 +8711,7 @@
8711
},
8712
{
8713
"en": "Wake-up devices",
8714
+ "cs": "Probudit zařízení",
8715
"xloc": [
8716
"default.handlebars->13->342"
8717
]
@@ -8458,6 +8719,7 @@
8719
{
8720
"en": "8 hours",
8721
"fr": "8 heures",
8722
+ "cs": "8 hodin",
8723
"xloc": [
8724
"default.handlebars->13->249",
8725
"default.handlebars->13->263"
@@ -8478,6 +8740,7 @@
8740
},
8741
{
8742
"en": "{0} hour{1}",
8743
+ "cs": "{0} hodina{1}",
8744
"xloc": [
8745
"default.handlebars->13->128"
8746
]
@@ -8491,6 +8754,7 @@
8754
{
8755
"en": "Settings...",
8756
"fr": "Paramètres...",
8757
+ "cs": "Nastavení...",
8758
"xloc": [
8759
"default.handlebars->container->column_l->p11->deskarea0->deskarea1->1"
8760
]
@@ -8498,6 +8762,7 @@
8762
{
8763
"en": "Save a screenshot of the remote desktop",
8764
"fr": "Enregistrer une capture d'écran du bureau distant",
8765
+ "cs": "Uložit screenshot vzdáleného počítače",
8766
"xloc": [
8767
"default.handlebars->container->column_l->p11->deskarea0->deskarea1->1"
8768
]
@@ -8578,6 +8843,7 @@
8843
},
8844
{
8845
"en": "Create Device Group",
8846
+ "cs": "Vytvořit skupinu zařízení",
8847
"xloc": [
8848
"default-mobile.handlebars->9->58"
8849
]
@@ -8605,6 +8871,7 @@
8871
},
8872
{
8873
"en": "Mesh agent is connected and ready for use.",
8874
+ "cs": "Agent je připojen a připraven.",
8875
"xloc": [
8876
"default.handlebars->13->142",
8877
"default.handlebars->13->326",
@@ -8620,6 +8887,7 @@
8887
{
8888
"en": "Small",
8889
"fr": "Petit",
8890
+ "cs": "Malé",
8891
"xloc": [
8892
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarSize->sizeselect->1"
8893
]
@@ -8627,12 +8895,14 @@
8895
{
8896
"en": "1 active session",
8897
"fr": "1 session active",
8898
+ "cs": "1 session aktivní",
8899
"xloc": [
8900
"default.handlebars->13->1216"
8901
]
8902
},
8903
{
8904
"en": "Delete {0} selected items?",
8905
+ "cs": "Smazat {0} vybrané prvky?",
8906
"xloc": [
8907
"default.handlebars->13->608",
8908
"default.handlebars->13->1091",
@@ -8649,6 +8919,7 @@
8919
},
8920
{
8921
"en": "None",
8922
+ "cs": "Nic",
8923
"xloc": [
8924
"default.handlebars->container->column_l->p41->3->3->p41traceStatus",
8925
"default.handlebars->13->25",
@@ -8727,6 +8998,7 @@
8998
},
8999
{
9000
"en": "Delete {0}?",
9001
+ "en": "Smazat {0}?",
9002
"xloc": [
9003
"default-mobile.handlebars->9->216"
9004
]
@@ -8736,6 +9008,7 @@
9008
},
9009
{
9010
"en": "{0} kilobytes remaining",
9011
+ "cs": "{0} kilobytů zbývá",
9012
"xloc": [
9013
"default.handlebars->13->1073"
9014
]
@@ -8749,6 +9022,7 @@
9022
},
9023
{
9024
"en": "Manage Device Group Computers",
9025
+ "cs": "Správa skupin zařízení",
9026
"xloc": [
9027
"default.handlebars->13->1028",
9028
"default.handlebars->13->1046",
@@ -8839,12 +9113,14 @@
9113
},
9114
{
9115
"en": "Send invitation email.",
9116
+ "cs": "Zaslat pozvánku emailem.",
9117
"xloc": [
9118
"default.handlebars->13->1164"
9119
]
9120
},
9121
{
9122
"en": "Full Administrator (all rights)",
9123
+ "cs": "Hlavní administrator (všechna práva)",
9124
"xloc": [
9125
"default.handlebars->13->1043"
9126
]
@@ -8858,6 +9134,7 @@
9134
{
9135
"en": "All",
9136
"fr": "Tout",
9137
+ "cs": "Vše",
9138
"xloc": [
9139
"default-mobile.handlebars->9->73",
9140
"default-mobile.handlebars->9->241",
@@ -8866,6 +9143,7 @@
9143
},
9144
{
9145
"en": "Full administrator",
9146
+ "cs": "Hlavní administrator",
9147
"xloc": [
9148
"default.handlebars->13->1184"
9149
]
@@ -8879,6 +9157,7 @@
9157
},
9158
{
9159
"en": "Storage exceed",
9160
+ "cs": "Uložiště plné",
9161
"xloc": [
9162
"default-mobile.handlebars->9->66"
9163
]
@@ -8891,6 +9170,7 @@
9170
},
9171
{
9172
"en": "No users found.",
9173
+ "cs": "Žádný uživatele nalezen.",
9174
"xloc": [
9175
"default.handlebars->13->1121"
9176
]
@@ -8898,6 +9178,7 @@
9178
{
9179
"en": "Rename",
9180
"fr": "Renommer",
9181
+ "cs": "Přejmenovat",
9182
"xloc": [
9183
"default.handlebars->container->column_l->p5->p5toolbar->1->0->p5filehead->3",
9184
"default.handlebars->container->column_l->p13->p13toolbar->1->2->1->3",
@@ -8917,6 +9198,7 @@
9198
},
9199
{
9200
"en": "Email is verified.",
9201
+ "cs": "Email je ověřen.",
9202
"xloc": [
9203
"default.handlebars->13->1163"
9204
]
@@ -8937,6 +9219,7 @@
9219
},
9220
{
9221
"en": "Device is powered",
9222
+ "cs": "Zařízení je zapnuto",
9223
"xloc": [
9224
"default.handlebars->13->319",
9225
"default-mobile.handlebars->9->111"
@@ -8944,6 +9227,7 @@
9227
},
9228
{
9229
"en": "My Server Stats",
9230
+ "cs": "Statistika serveru",
9231
"xloc": [
9232
"default.handlebars->container->column_l->p40->1"
9233
]
@@ -8964,18 +9248,21 @@
9248
{
9249
"en": "2x Speed",
9250
"fr": "2x vitesse",
9251
+ "cs": "2x rychlost",
9252
"xloc": [
9253
"player.htm->p11->deskarea0->deskarea4->3->PlaySpeed->7"
9254
]
9255
},
9256
{
9257
"en": "Verify Email",
9258
+ "cs": "Ověřit Email",
9259
"xloc": [
9260
"default.handlebars->container->footer->3->verifyEmailId2"
9261
]
9262
},
9263
{
9264
"en": "Toggle tools view",
9265
+ "cs": "Přepnout zobrazení nástrojů",
9266
"xloc": [
9267
"default.handlebars->container->column_l->p11->deskarea0->deskarea4->1"
9268
]
@@ -8992,6 +9279,7 @@
9279
{
9280
"en": " without TLS.",
9281
"fr": "sans TLS.",
9282
+ "cs": " bez TLS.",
9283
"xloc": [
9284
"default.handlebars->13->126"
9285
]
@@ -8999,6 +9287,7 @@
9287
{
9288
"en": "Weak",
9289
"fr": "Faible",
9290
+ "cs": "Slabé",
9291
"xloc": [
9292
"default.handlebars->13->906"
9293
]
@@ -9021,6 +9310,7 @@
9310
},
9311
{
9312
"en": ", click here to enable it.",
9313
+ "cs": ", zde kliknout pro aktivaci.",
9314
"xloc": [
9315
"default.handlebars->container->column_l->p11->p11warning->3->p11warninga",
9316
"default.handlebars->container->column_l->p12->p12warning->3->p12warninga"
@@ -9028,6 +9318,7 @@
9318
},
9319
{
9320
"en": "Agents",
9321
+ "cs": "Agenti",
9322
"xloc": [
9323
"default.handlebars->13->1244"
9324
]
@@ -9086,6 +9377,7 @@
9377
},
9378
{
9379
"en": "Online Users",
9380
+ "cs": "Online uživatelů",
9381
"xloc": [
9382
"default.handlebars->13->1117"
9383
]
@@ -9124,6 +9416,7 @@
9416
},
9417
{
9418
"en": "Protocol",
9419
+ "cs": "Protokol",
9420
"xloc": [
9421
"player.htm->3->15"
9422
]
@@ -9131,6 +9424,7 @@
9424
{
9425
"en": " - Reset in {0} day{1}.",
9426
"fr": "- Réinitialiser dans le {0} jour {1}.",
9427
+ "cs": " - Reset v {0} den{1}.",
9428
"xloc": [
9429
"default.handlebars->13->22",
9430
"default-mobile.handlebars->9->13"
@@ -9138,6 +9432,7 @@
9432
},
9433
{
9434
"en": "Notes",
9435
+ "cs": "Poznámky",
9436
"xloc": [
9437
"default.handlebars->13->465",
9438
"default.handlebars->13->498",
@@ -9177,6 +9472,7 @@
9472
{
9473
"en": "My Server",
9474
"fr": "Mon Serveur",
9475
+ "cs": "Můj server",
9476
"xloc": [
9477
"default.handlebars->container->page_leftbar",
9478
"default.handlebars->container->topbar->1->1->MainMenuSpan->1->0->MainMenuMyServer",
@@ -9210,6 +9506,7 @@
9506
},
9507
{
9508
"en": "Files",
9509
+ "cs": "Soubory",
9510
"xloc": [
9511
"default.handlebars->contextMenu->cxfiles",
9512
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDevFiles",
@@ -9218,6 +9515,7 @@
9515
},
9516
{
9517
"en": "Do nothing",
9518
+ "cs": "Nic",
9519
"xloc": [
9520
"default.handlebars->13->988"
9521
]
@@ -9258,6 +9556,7 @@
9556
},
9557
{
9558
"en": "Folder",
9559
+ "cs": "Adresář",
9560
"xloc": [
9561
"default-mobile.handlebars->container->page_content->column_l->p5->p5myfiles->p5toolbar->1->0->1->1",
9562
"default-mobile.handlebars->container->page_content->column_l->p10->p10files->p13toolbar->1->2->1->1"
@@ -9274,12 +9573,14 @@
9573
},
9574
{
9575
"en": "More",
9576
+ "cs": "Více",
9577
"xloc": [
9578
"default.handlebars->13->1270"
9579
]
9580
},
9581
{
9582
"en": "PowerShell Connect",
9583
+ "cs": "PowerShell připojen",
9584
"xloc": [
9585
"default.handlebars->termShellContextMenu->cxtermps"
9586
]
@@ -9298,6 +9599,7 @@
9599
},
9600
{
9601
"en": "Install",
9602
+ "cs": "Instalace",
9603
"xloc": [
9604
"default.handlebars->13->966"
9605
]
@@ -9310,12 +9612,14 @@
9612
},
9613
{
9614
"en": "Connected.",
9615
+ "cs": "Připojeno.",
9616
"xloc": [
9617
"messenger.handlebars->13->7"
9618
]
9619
},
9620
{
9621
"en": "Limit of 10 file uploads at the same time.",
9622
+ "cs": "Max. 10 souběžně nahrávaných souborů.",
9623
"xloc": [
9624
"messenger.handlebars->13->4",
9625
"messenger.handlebars->13->5"
@@ -9323,6 +9627,7 @@
9627
},
9628
{
9629
"en": "Forgot password?",
9630
+ "cs": "Zapomenuté heslo?",
9631
"xloc": [
9632
"login.handlebars->5->2",
9633
"login-mobile.handlebars->5->2"
@@ -9465,6 +9770,7 @@
9770
{
9771
"en": "Last day",
9772
"fr": "Dernier jour",
9773
+ "cs": "Poslední den",
9774
"xloc": [
9775
"default.handlebars->container->column_l->p40->3->1->p40time->5"
9776
]
@@ -9495,12 +9801,14 @@
9801
},
9802
{
9803
"en": "Language",
9804
+ "cs": "Jazyk",
9805
"xloc": [
9806
"default.handlebars->13->864"
9807
]
9808
},
9809
{
9810
"en": "Dates & Time",
9811
+ "cs": "Datum & čas",
9812
"xloc": [
9813
"default.handlebars->13->865"
9814
]
views/translations/agentinvite-min_cs.handlebars
new
+1
@@ -0,0 +1 @@
1
+<!doctypehtml><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,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><title>MeshCentral - Agent Installation</title><style>.tab{overflow:hidden;border:1px solid #ccc;background-color:#f1f1f1}.tab button{background-color:inherit;float:left;border:none;outline:0;cursor:pointer;padding:14px 16px;transition:.3s}.tab button:hover{background-color:#ddd}.tab button.active{background-color:#8f8}.tabcontent{display:none;padding:6px 12px;border:1px solid #ccc;border-top:none}</style><body id=body onload='"undefined"!=typeof startup&&startup()'style=display:none;overflow:hidden><div id=container><div id=masthead class=noselect style="background:url(logo.png) 0 0;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><p id=logoutControl style="color:#fff;font-size:11px;margin:10px 10px 0">{{{logoutControl}}}</div><div id=page_leftbar><div style=height:16px></div></div><div id=topbar class="noselect style3"style=height:24px;position:relative><div id=uiMenuButton title="User interface selection"onclick=showUserInterfaceSelectMenu()>♦<div id=uiMenu style=display:none><div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class=uiSelector1></div></div><div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class=uiSelector2></div></div><div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class=uiSelector3></div></div><div id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode"><div class=uiSelector4></div></div></div></div></div><div id=column_l style="max-height:calc(100vh - 135px);overflow-y:auto"><h1>Instalace agenta pro vzdálený přístup<span id=groupname></span></h1><p>Byla vám doručena pozvánka k instalaci softwaru, který umožňuje vzdálenou správu zařízení. Postupujte podle níže uvedených pokynů, pokud jste si vědom toho, že tato pozvánka je legitimní a chcete tento přístup umožnit. Vyberte si operační systém a postupujte dle pokynů níže.<div><div class=tab><button id=twintab64 class=tablinks onclick='openTab(event,"wintab64")'>Windows 64bit</button> <button id=twintab32 class=tablinks onclick='openTab(event,"wintab32")'>Windows 32bit</button> <button id=tlinuxtab class=tablinks onclick='openTab(event,"linuxtab")'>Linux</button> <button id=tmacostab class=tablinks onclick='openTab(event,"macostab")'>MacOS</button></div><div id=wintab64 class=tabcontent style=background-color:#fff;color:#000><h3>Microsoft™ Windows 64bit</h3><p><a id=win64url>Download the software here</a>, spusťte soubor a zvolte "Install" nebo "Connect".<div style=text-align:center><img class=winagent-img src=images/winagent.png></div></div><div id=wintab32 class=tabcontent style=background-color:#fff;color:#000><h3>Microsoft™ Windows 32bit</h3><p><a id=win32url>Download the software here</a>, spusťte soubor a zvolte "Install" nebo "Connect".<div style=text-align:center><img class=winagent-img src=images/winagent.png></div></div><div id=linuxtab class=tabcontent style=background-color:#fff;color:#000><h3>Linux</h3><p>Pro instalaci spusťte následující příkaz s právy uživatele root.<div id=linuxinstall style="font-family:courier,'courier new',monospace;margin-left:30px"></div><input type=button value="Zkopírovat do schránky"style=margin-left:30px;margin-top:4px onclick=copyToClipLinuxInstall()><p>Pro odinstalování spustťe tento příkaz pod s uživatelskými právy root.<div id=unlinuxinstall style="font-family:courier,'courier new',monospace;margin-left:30px"></div><input type=button value="Zkopírovat do schránky"style=margin-left:30px;margin-top:4px onclick=copyToClipLinuxUnInstall()><br><br></div><div id=macostab class=tabcontent style=background-color:#fff;color:#000><h3>Apple™ MacOS</h3><p><a id=macosurl>Stáhnout instalaci zde</a>, poté spusťe instalaci. Postupujte dle instrukcí.<div style=text-align:center><img src=images/macosagent.png></div></div></div></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right></table></div></div><script>"use strict";var linuxInstall,linuxUnInstall,uiMode=parseInt(getstore("uiMode",1)),webPageStackMenu=!1,webPageFullScreen=!0,nightMode="1"==getstore("_nightMode","0"),domain="{{{domain}}}",domainUrl="{{{domainurl}}}",meshid="{{{meshid}}}",serverPort="{{{serverport}}}",serverHttps="{{{serverhttps}}}",serverNoProxy="{{{servernoproxy}}}",installFlags="{{{installflags}}}",groupName=decodeURIComponent("{{{meshname}}}");function showUserInterfaceSelectMenu(){Q("uiViewButton1").classList.remove("uiSelectorSel"),Q("uiViewButton2").classList.remove("uiSelectorSel"),Q("uiViewButton3").classList.remove("uiSelectorSel"),Q("uiViewButton4").classList.remove("uiSelectorSel");try{Q("uiViewButton"+uiMode).classList.add("uiSelectorSel")}catch(e){}QV("uiMenu","none"==QS("uiMenu").display),nightMode&&Q("uiViewButton4").classList.add("uiSelectorSel")}function userInterfaceSelectMenu(e){e&&putstore("uiMode",uiMode=e),webPageFullScreen=uiMode<3,webPageStackMenu=!0,toggleFullScreen(0),toggleStackMenu(0),QC("column_l").add("room4submenu")}function toggleNightMode(){(nightMode=!nightMode)?QC("body").add("night"):QC("body").remove("night"),putstore("_nightMode",nightMode?"1":"0")}function toggleFullScreen(e){1===e&&putstore("webPageFullScreen",webPageFullScreen=!webPageFullScreen);0==webPageFullScreen?(QC("body").remove("menu_stack"),QC("body").remove("fullscreen"),QC("body").remove("arg_hide")):QC("body").add("fullscreen"),QV("body",!0)}function toggleStackMenu(e){1==webPageFullScreen&&(1===e&&putstore("webPageStackMenu",webPageStackMenu=!webPageStackMenu),0==webPageStackMenu?QC("body").remove("menu_stack"):QC("body").add("menu_stack"))}function putstore(e,t){try{if("undefined"==typeof localStorage)return;localStorage.setItem(e,t)}catch(e){}}function getstore(e,t){try{if("undefined"==typeof localStorage)return t;var n=localStorage.getItem(e);return null==n||null==n?t:n}catch(e){return t}}function openTab(e,t){var n,s,l;for(s=document.getElementsByClassName("tabcontent"),n=0;n<s.length;n++)s[n].style.display="none";for(l=document.getElementsByClassName("tablinks"),n=0;n<l.length;n++)l[n].className=l[n].className.replace(" active","");document.getElementById(t).style.display="block",null!=e?e.currentTarget.className+=" active":document.getElementById("t"+t).className+=" active"}function setup(){var e=window.location.hostname,t=domainUrl.substring(0,domainUrl.length-1),n="meshagents?id=4&meshid="+meshid;if(0!=installFlags&&(n+="&installflags="+installFlags),Q("win64url").href=n,n="meshagents?id=3&meshid="+meshid,0!=installFlags&&(n+="&installflags="+installFlags),Q("win32url").href=n,n="meshosxagent?id=16&meshid="+meshid,Q("macosurl").href=n,1==serverHttps){var s=443==serverPort?"":":"+serverPort;linuxUnInstall=0==serverNoProxy?(linuxInstall="(wget https://"+e+s+domainUrl+"meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://"+e+s+t+" '"+meshid+"'\r\n","(wget https://"+e+s+domainUrl+"meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"):(linuxInstall="wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://"+e+s+t+" '"+meshid+"'\r\n","wget https://"+e+s+domainUrl+"meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n")}else{s=80==serverPort?"":":"+serverPort;linuxUnInstall=0==serverNoProxy?(linuxInstall="(wget http://"+e+s+domainUrl+"meshagents?script=1 -O ./meshinstall.sh || wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://"+e+s+t+" '"+meshid+"'\r\n","(wget http://"+e+s+domainUrl+"meshagents?script=1 -O ./meshinstall.sh || wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"):(linuxInstall="wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://"+e+s+t+" '"+meshid+"'\r\n","wget http://"+e+s+domainUrl+"meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n")}QH("linuxinstall",linuxInstall),QH("unlinuxinstall",linuxUnInstall),0<=navigator.userAgent.indexOf("Win64")?openTab(null,"wintab64"):0<=navigator.userAgent.indexOf("Windows")?openTab(null,"wintab32"):0<=navigator.userAgent.indexOf("Linux")?openTab(null,"linuxtab"):0<=navigator.userAgent.indexOf("Macintosh")?openTab(null,"macostab"):openTab(null,"wintab64")}function copyToClipLinuxInstall(){copyTextToClip(linuxInstall)}function copyToClipLinuxUnInstall(){copyTextToClip(linuxUnInstall)}function copyTextToClip(e){var t=document.createElement("DIV");t.textContent=e,document.body.appendChild(t),function(e){if(document.selection)(t=document.body.createTextRange()).moveToElementText(e),t.select();else if(window.getSelection){var t;(t=document.createRange()).selectNode(e),window.getSelection().removeAllRanges(),window.getSelection().addRange(t)}}(t),document.execCommand("copy"),t.remove()}""!=groupName&&QH("groupname"," for "+groupName),userInterfaceSelectMenu(),setup()</script>
\ No newline at end of file
views/translations/agentinvite_cs.handlebars
new
+294
@@ -0,0 +1,294 @@
1
+<!DOCTYPE html><html><head>
2
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
4
+ <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
5
+ <meta name="apple-mobile-web-app-capable" content="yes">
6
+ <meta name="format-detection" content="telephone=no">
7
+ <link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS">
8
+ <script type="text/javascript" src="scripts/common-0.0.1.js"></script>
9
+ <title>MeshCentral - Agent Installation</title>
10
+ <style>
11
+ .tab {
12
+ overflow: hidden;
13
+ border: 1px solid #ccc;
14
+ background-color: #f1f1f1;
15
+ }
16
+
17
+ .tab button {
18
+ background-color: inherit;
19
+ float: left;
20
+ border: none;
21
+ outline: none;
22
+ cursor: pointer;
23
+ padding: 14px 16px;
24
+ transition: 0.3s;
25
+ }
26
+
27
+ .tab button:hover {
28
+ background-color: #ddd;
29
+ }
30
+
31
+ .tab button.active {
32
+ background-color: #8f8;
33
+ }
34
+
35
+ .tabcontent {
36
+ display: none;
37
+ padding: 6px 12px;
38
+ border: 1px solid #ccc;
39
+ border-top: none;
40
+ }
41
+
42
+ </style>
43
+</head>
44
+<body id="body" onload="if (typeof(startup) !== 'undefined') startup();" style="display:none;overflow:hidden">
45
+ <div id="container">
46
+ <!-- Begin Masthead -->
47
+ <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;">
48
+ <div style="float:left; height: 66px; color:#c8c8c8; padding-left:20px; padding-top:8px">
49
+ <strong><font style="font-size:46px; font-family: Arial, Helvetica, sans-serif;">{{{title}}}</font></strong>
50
+ </div>
51
+ <div style="float:left; height: 66px; color:#c8c8c8; padding-left:5px; padding-top:14px">
52
+ <strong><font style="font-size:14px; font-family: Arial, Helvetica, sans-serif;">{{{title2}}}</font></strong>
53
+ </div>
54
+ <p id="logoutControl" style="color:white;font-size:11px;margin: 10px 10px 0;">{{{logoutControl}}}</p>
55
+ </div>
56
+ <div id="page_leftbar">
57
+ <div style="height:16px"></div>
58
+ </div>
59
+ <div id="topbar" class="noselect style3" style="height:24px;position:relative">
60
+ <div id="uiMenuButton" title="User interface selection" onclick="showUserInterfaceSelectMenu()">
61
+ ♦
62
+ <div id="uiMenu" style="display:none">
63
+ <div id="uiViewButton1" class="uiSelector" onclick="userInterfaceSelectMenu(1)" title="Left bar interface"><div class="uiSelector1"></div></div>
64
+ <div id="uiViewButton2" class="uiSelector" onclick="userInterfaceSelectMenu(2)" title="Top bar interface"><div class="uiSelector2"></div></div>
65
+ <div id="uiViewButton3" class="uiSelector" onclick="userInterfaceSelectMenu(3)" title="Fixed width interface"><div class="uiSelector3"></div></div>
66
+ <div id="uiViewButton4" class="uiSelector" onclick="toggleNightMode()" title="Toggle night mode"><div class="uiSelector4"></div></div>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ <div id="column_l" style="max-height:calc(100vh - 135px);overflow-y:auto">
71
+ <h1>Instalace agenta pro vzdálený přístup<span id="groupname"></span></h1>
72
+ <p>
73
+ Byla vám doručena pozvánka k instalaci softwaru, který umožňuje vzdálenou správu zařízení.
74
+ Postupujte podle níže uvedených pokynů, pokud jste si vědom toho, že tato pozvánka je legitimní a chcete tento přístup umožnit.
75
+ Vyberte si operační systém a postupujte dle pokynů níže.
76
+ </p>
77
+ <div>
78
+ <div class="tab">
79
+ <button id="twintab64" class="tablinks" onclick="openTab(event, 'wintab64')">Windows 64bit</button>
80
+ <button id="twintab32" class="tablinks" onclick="openTab(event, 'wintab32')">Windows 32bit</button>
81
+ <button id="tlinuxtab" class="tablinks" onclick="openTab(event, 'linuxtab')">Linux</button>
82
+ <button id="tmacostab" class="tablinks" onclick="openTab(event, 'macostab')">MacOS</button>
83
+ </div>
84
+
85
+ <div id="wintab64" class="tabcontent" style="background-color:white;color:black">
86
+ <h3>Microsoft™ Windows 64bit</h3>
87
+ <p><a id="win64url">Download the software here</a>, spusťte soubor a zvolte "Install" nebo "Connect".</p>
88
+ <div style="text-align:center">
89
+ <img class="winagent-img" src="images/winagent.png">
90
+ </div>
91
+ </div>
92
+
93
+ <div id="wintab32" class="tabcontent" style="background-color:white;color:black">
94
+ <h3>Microsoft™ Windows 32bit</h3>
95
+ <p><a id="win32url">Download the software here</a>, spusťte soubor a zvolte "Install" nebo "Connect".</p>
96
+ <div style="text-align:center">
97
+ <img class="winagent-img" src="images/winagent.png">
98
+ </div>
99
+ </div>
100
+
101
+ <div id="linuxtab" class="tabcontent" style="background-color:white;color:black">
102
+ <h3>Linux</h3>
103
+ <p>Pro instalaci spusťte následující příkaz s právy uživatele root.</p>
104
+ <div id="linuxinstall" style="font-family:courier,'courier new',monospace;margin-left:30px"></div>
105
+ <input type="button" value="Zkopírovat do schránky" style="margin-left:30px;margin-top:4px" onclick="copyToClipLinuxInstall()">
106
+ <p>Pro odinstalování spustťe tento příkaz pod s uživatelskými právy root.</p>
107
+ <div id="unlinuxinstall" style="font-family:courier,'courier new',monospace;margin-left:30px"></div>
108
+ <input type="button" value="Zkopírovat do schránky" style="margin-left:30px;margin-top:4px" onclick="copyToClipLinuxUnInstall()">
109
+ <br><br>
110
+ </div>
111
+
112
+ <div id="macostab" class="tabcontent" style="background-color:white;color:black">
113
+ <h3>Apple™ MacOS</h3>
114
+ <p><a id="macosurl">Stáhnout instalaci zde</a>, poté spusťe instalaci. Postupujte dle instrukcí.</p>
115
+ <div style="text-align:center">
116
+ <img src="images/macosagent.png">
117
+ </div>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ <div id="footer">
122
+ <table cellpadding="0" cellspacing="10" style="width: 100%">
123
+ <tbody><tr>
124
+ <td style="text-align:left"></td>
125
+ <td style="text-align:right"></td>
126
+ </tr>
127
+ </tbody></table>
128
+ </div>
129
+ </div>
130
+ <script>
131
+ 'use strict';
132
+ var uiMode = parseInt(getstore('uiMode', 1));
133
+ var webPageStackMenu = false;
134
+ var webPageFullScreen = true;
135
+ var nightMode = (getstore('_nightMode', '0') == '1');
136
+ var domain = "{{{domain}}}";
137
+ var domainUrl = "{{{domainurl}}}";
138
+ var meshid = "{{{meshid}}}";
139
+ var serverPort = "{{{serverport}}}";
140
+ var serverHttps = "{{{serverhttps}}}";
141
+ var serverNoProxy = "{{{servernoproxy}}}";
142
+ var installFlags = "{{{installflags}}}";
143
+ var groupName = decodeURIComponent("{{{meshname}}}");
144
+ if (groupName != '') { QH('groupname', ' for ' + groupName); }
145
+ userInterfaceSelectMenu();
146
+ setup();
147
+
148
+ // Toggle user interface menu
149
+ function showUserInterfaceSelectMenu() {
150
+ Q('uiViewButton1').classList.remove('uiSelectorSel');
151
+ Q('uiViewButton2').classList.remove('uiSelectorSel');
152
+ Q('uiViewButton3').classList.remove('uiSelectorSel');
153
+ Q('uiViewButton4').classList.remove('uiSelectorSel');
154
+ try { Q('uiViewButton' + uiMode).classList.add('uiSelectorSel'); } catch (ex) { }
155
+ QV('uiMenu', (QS('uiMenu').display == 'none'));
156
+ if (nightMode) { Q('uiViewButton4').classList.add('uiSelectorSel'); }
157
+ }
158
+
159
+ function userInterfaceSelectMenu(s) {
160
+ if (s) { uiMode = s; putstore('uiMode', uiMode); }
161
+ webPageFullScreen = (uiMode < 3);
162
+ webPageStackMenu = true;//(uiMode > 1);
163
+ toggleFullScreen(0);
164
+ toggleStackMenu(0);
165
+ QC('column_l').add('room4submenu');
166
+ }
167
+
168
+ function toggleNightMode() {
169
+ nightMode = !nightMode;
170
+ if (nightMode) { QC('body').add('night'); } else { QC('body').remove('night'); }
171
+ putstore('_nightMode', nightMode ? '1' : '0');
172
+ }
173
+
174
+ // Toggle the web page to full screen
175
+ function toggleFullScreen(toggle) {
176
+ if (toggle === 1) { webPageFullScreen = !webPageFullScreen; putstore('webPageFullScreen', webPageFullScreen); }
177
+ var hide = 0;
178
+ //if (args.hide) { hide = parseInt(args.hide); }
179
+ if (webPageFullScreen == false) {
180
+ QC('body').remove("menu_stack");
181
+ QC('body').remove("fullscreen");
182
+ QC('body').remove("arg_hide");
183
+ //if (xxcurrentView >= 10) QC('column_l').add('room4submenu');
184
+ //QV('UserDummyMenuSpan', false);
185
+ //QV('page_leftbar', false);
186
+ } else {
187
+ QC('body').add("fullscreen");
188
+ if (hide & 16) QC('body').add("arg_hide"); // This is replacement for QV('page_leftbar', !(hide & 16));
189
+ //QV('UserDummyMenuSpan', (xxcurrentView < 10) && webPageFullScreen);
190
+ //QV('page_leftbar', true);
191
+ }
192
+ QV('body', true);
193
+ }
194
+
195
+ // If FullScreen, toggle menu to be horisontal or vertical
196
+ function toggleStackMenu(toggle) {
197
+ if (webPageFullScreen == true) {
198
+ if (toggle === 1) {
199
+ webPageStackMenu = !webPageStackMenu;
200
+ putstore('webPageStackMenu', webPageStackMenu);
201
+ }
202
+ if (webPageStackMenu == false) {
203
+ QC('body').remove("menu_stack");
204
+ } else {
205
+ QC('body').add("menu_stack");
206
+ //if (xxcurrentView >= 10) QC('column_l').remove('room4submenu');
207
+ }
208
+ }
209
+ }
210
+
211
+ function putstore(name, val) { try { if (typeof (localStorage) === 'undefined') return; localStorage.setItem(name, val); } catch (e) { } }
212
+ function getstore(name, val) { try { if (typeof (localStorage) === 'undefined') return val; var v = localStorage.getItem(name); if ((v == null) || (v == null)) return val; return v; } catch (e) { return val; } }
213
+
214
+ function openTab(evt, tabname) {
215
+ // Declare all variables
216
+ var i, tabcontent, tablinks;
217
+
218
+ // Get all elements with class="tabcontent" and hide them
219
+ tabcontent = document.getElementsByClassName("tabcontent");
220
+ for (i = 0; i < tabcontent.length; i++) {
221
+ tabcontent[i].style.display = "none";
222
+ }
223
+
224
+ // Get all elements with class="tablinks" and remove the class "active"
225
+ tablinks = document.getElementsByClassName("tablinks");
226
+ for (i = 0; i < tablinks.length; i++) {
227
+ tablinks[i].className = tablinks[i].className.replace(" active", "");
228
+ }
229
+
230
+ // Show the current tab, and add an "active" class to the button that opened the tab
231
+ document.getElementById(tabname).style.display = "block";
232
+ if (evt != null) { evt.currentTarget.className += " active"; } else { document.getElementById('t' + tabname).className += " active"; }
233
+ }
234
+
235
+ var linuxInstall, linuxUnInstall;
236
+ function setup() {
237
+ var servername = window.location.hostname;
238
+ var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
239
+
240
+ // Windows 64bit Setup
241
+ var url = 'meshagents?id=4&meshid=' + meshid;
242
+ if (installFlags != 0) { url += ('&installflags=' + installFlags); }
243
+ Q('win64url').href = url;
244
+
245
+ // Windows 32bit Setup
246
+ url = 'meshagents?id=3&meshid=' + meshid;
247
+ if (installFlags != 0) { url += ('&installflags=' + installFlags); }
248
+ Q('win32url').href = url;
249
+
250
+ // MacOS Setup
251
+ url = 'meshosxagent?id=16&meshid=' + meshid;
252
+ Q('macosurl').href = url;
253
+
254
+ // Linux Setup
255
+ if (serverHttps == 1) {
256
+ var portStr = (serverPort == 443) ? '' : (":" + serverPort);
257
+ if (serverNoProxy == 0) {
258
+ linuxInstall = "(wget https://" + servername + portStr + domainUrl + "meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://" + servername + portStr + domainUrl + "meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://" + servername + portStr + domainUrlNoSlash + " '" + meshid + "'\r\n";
259
+ linuxUnInstall = "(wget https://" + servername + portStr + domainUrl + "meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://" + servername + portStr + domainUrl + "meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
260
+ } else {
261
+ // Server asked that agent be installed to preferably not use a HTTP proxy.
262
+ linuxInstall = "wget https://" + servername + portStr + domainUrl + "meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://" + servername + portStr + domainUrlNoSlash + " '" + meshid + "'\r\n";
263
+ linuxUnInstall = "wget https://" + servername + portStr + domainUrl + "meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
264
+ }
265
+ } else {
266
+ var portStr = (serverPort == 80) ? '' : (":" + serverPort);
267
+ if (serverNoProxy == 0) {
268
+ linuxInstall = "(wget http://" + servername + portStr + domainUrl + "meshagents?script=1 -O ./meshinstall.sh || wget http://" + servername + portStr + domainUrl + "meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://" + servername + portStr + domainUrlNoSlash + " '" + meshid + "'\r\n";
269
+ linuxUnInstall = "(wget http://" + servername + portStr + domainUrl + "meshagents?script=1 -O ./meshinstall.sh || wget http://" + servername + portStr + domainUrl + "meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
270
+ } else {
271
+ // Server asked that agent be installed to preferably not use a HTTP proxy.
272
+ linuxInstall = "wget http://" + servername + portStr + domainUrl + "meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://" + servername + portStr + domainUrlNoSlash + " '" + meshid + "'\r\n";
273
+ linuxUnInstall = "wget http://" + servername + portStr + domainUrl + "meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
274
+ }
275
+ }
276
+ QH('linuxinstall', linuxInstall);
277
+ QH('unlinuxinstall', linuxUnInstall);
278
+
279
+ // Attempt to detect the most likely operating system for this browser
280
+ if (navigator.userAgent.indexOf('Win64') >= 0) { openTab(null, 'wintab64'); }
281
+ else if (navigator.userAgent.indexOf('Windows') >= 0) { openTab(null, 'wintab32'); }
282
+ else if (navigator.userAgent.indexOf('Linux') >= 0) { openTab(null, 'linuxtab'); }
283
+ else if (navigator.userAgent.indexOf('Macintosh') >= 0) { openTab(null, 'macostab'); }
284
+ else { openTab(null, 'wintab64'); }
285
+ }
286
+
287
+ function copyToClipLinuxInstall() { copyTextToClip(linuxInstall); }
288
+ function copyToClipLinuxUnInstall() { copyTextToClip(linuxUnInstall); }
289
+ function copyTextToClip(txt) { function selectElementText(e) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(e); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(e); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } } var e = document.createElement('DIV'); e.textContent = txt; document.body.appendChild(e); selectElementText(e); document.execCommand('copy'); e.remove(); }
290
+
291
+ </script>
292
+
293
+
294
+</body></html>
\ No newline at end of file
views/translations/default-min_cs.handlebars
new
+8694
@@ -0,0 +1,8694 @@
1
+<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><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,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link rel="shortcut icon"type=image/x-icon href={{{domainurl}}}favicon.ico><link keeplink=1 type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><link type=text/css href=styles/ol.css media=screen rel=stylesheet title=CSS><link type=text/css href=styles/ol3-contextmenu.min.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script src=scripts/meshcentral.js></script><script src=scripts/amt-0.2.0.js></script><script src=scripts/amt-wsman-0.2.0.js></script><script src=scripts/amt-desktop-0.0.2.js></script><script src=scripts/amt-terminal-0.0.2.js></script><script src=scripts/zlib.js></script><script src=scripts/zlib-inflate.js></script><script src=scripts/zlib-adler32.js></script><script src=scripts/zlib-crc32.js></script><script src=scripts/amt-redir-ws-0.1.0.js></script><script src=scripts/amt-wsman-ws-0.2.0.js></script><script src=scripts/agent-redir-ws-0.1.1.js></script><script src=scripts/agent-redir-rtc-0.1.0.js></script><script src=scripts/agent-desktop-0.0.2.js></script><script src=scripts/qrcode.min.js></script><script keeplink=1 src=scripts/u2f-api.js></script><script keeplink=1 src=scripts/charts.js></script><script keeplink=1 src=scripts/filesaver.js></script><script keeplink=1 src=scripts/ol.js></script><script keeplink=1 src=scripts/ol3-contextmenu.js></script><title>{{{title}}}</title><body id=body onload='"undefined"!=typeof startup&&startup()'oncontextmenu=handleContextMenu(event) style=display:none;min-width:495px><div id=contextMenu class="contextMenu noselect"style=display:none><div id=cxinfo class=cmtext onclick=cmaction(1,event)><b>Information</b></div><div id=cxdesktop class=cmtext onclick=cmaction(3,event)>Plocha</div><div id=cxterminal class=cmtext onclick=cmaction(2,event)>Terminál</div><div id=cxfiles class=cmtext onclick=cmaction(4,event)>Soubory</div><div id=cxevents class=cmtext onclick=cmaction(5,event)>Události</div><div id=cxconsole class=cmtext onclick=cmaction(6,event)>Konzole</div><hr id=cxmgroupsplit><div id=cxmdesktop class=cmtext onclick=cmaction(7,event) style=display:none>Multi-Desktop</div></div><div id=meshContextMenu class="contextMenu noselect"style=display:none;min-width:0><div id=cxselectall class=cmtext onclick=cmmeshaction(1,event)>Vybrat vše</div><div id=cxselectnone class=cmtext onclick=cmmeshaction(2,event)>Vybrat nic</div></div><div id=termShellContextMenu class="contextMenu noselect"style=display:none;min-width:0><div id=cxtermnorm class=cmtext onclick=cmtermaction(1,event)><b>Normal Connect</b></div><div id=cxtermps class=cmtext onclick=cmtermaction(6,event)>PowerShell připojen</div></div><div id=termShellContextMenuLinux class="contextMenu noselect"style=display:none;min-width:0><div id=cxtermnorm class=cmtext onclick=cmtermaction(1,event)><b>Root Shell</b></div><div id=cxtermps class=cmtext onclick=cmtermaction(8,event)>User Shell</div></div><div id=container><div id=notifiyBox class=notifiyBox style=display:none></div><div id=masthead class=noselect><div class=title>{{{title}}}</div><div class=title2>{{{title2}}}</div><div style=float:right><div id=notificationCount onclick=clickNotificationIcon() class=unselectable style=display:none title="Click to view current notifications">0</div></div><p id=logoutControl>{{{logoutControl}}}<span id=idleTimeoutNotify style=color:#ff0></span></div><div id=page_leftbar><div style=height:16px></div><div id=LeftMenuMyDevices tabindex=0 class="lbbutton lbbuttonsel"title="Moje zařízení"onclick=go(1,event) onkeypress='"Enter"==event.key&&go(1)'><div class=lb2></div></div><div id=LeftMenuMyAccount tabindex=0 class=lbbutton title="Můj účet"onclick=go(2,event) onkeypress='"Enter"==event.key&&go(2)'><div class=lb1></div></div><div id=LeftMenuMyEvents tabindex=0 class=lbbutton title="Moje události"onclick=go(3,event) onkeypress='"Enter"==event.key&&go(3)'><div class=lb3></div></div><div id=LeftMenuMyFiles tabindex=0 class=lbbutton style=display:none title="Moje soubory"onclick=go(5,event) onkeypress='"Enter"==event.key&&go(5)'><div class=lb4></div></div><div id=LeftMenuMyUsers tabindex=0 class=lbbutton style=display:none title=Uživatelé onclick=go(4,event) onkeypress='"Enter"==event.key&&go(4)'><div class=lb5></div></div><div id=LeftMenuMyServer tabindex=0 class=lbbutton style=display:none title="Můj server"onclick=go(6,event) onkeypress='"Enter"==event.key&&go(6)'><div class=lb6></div></div></div><div id=topbar class=noselect><div><div style=position:relative><div tabindex=0 id=uiMenuButton title="User interface selection"onclick=showUserInterfaceSelectMenu() onkeypress='"Enter"==event.key&&showUserInterfaceSelectMenu()'>♦<div id=uiMenu style=display:none><div tabindex=0 id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"onkeypress='"Enter"==event.key&&userInterfaceSelectMenu(1)'><div class=uiSelector1></div></div><div tabindex=0 id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"onkeypress='"Enter"==event.key&&userInterfaceSelectMenu(2)'><div class=uiSelector2></div></div><div tabindex=0 id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"onkeypress='"Enter"==event.key&&userInterfaceSelectMenu(3)'><div class=uiSelector3></div></div><div tabindex=0 id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode"onkeypress='"Enter"==event.key&&toggleNightMode()'><div class=uiSelector4></div></div></div></div><table id=MainMenuSpan cellpadding=0 cellspacing=0 class=style1><tr><td tabindex=0 id=MainMenuMyDevices class="topbar_td style3x"onclick=go(1,event) onkeypress='"Enter"==event.key&&go(1)'>Moje zařízení<td tabindex=0 id=MainMenuMyAccount class="topbar_td style3x"onclick=go(2,event) onkeypress='"Enter"==event.key&&go(2)'>Můj účet<td tabindex=0 id=MainMenuMyEvents class="topbar_td style3x"onclick=go(3,event) onkeypress='"Enter"==event.key&&go(3)'>Moje události<td tabindex=0 id=MainMenuMyFiles class="topbar_td style3x"onclick=go(5,event) onkeypress='"Enter"==event.key&&go(5)'>Moje soubory<td tabindex=0 id=MainMenuMyUsers class="topbar_td style3x"onclick=go(4,event) onkeypress='"Enter"==event.key&&go(4)'>Uživatelé<td tabindex=0 id=MainMenuMyServer class="topbar_td style3x"onclick=go(6,event) onkeypress='"Enter"==event.key&&go(6)'>Můj server<td class="topbar_td_end style3"> </table><div id=MainSubMenuSpan style=display:none><table id=MainSubMenu cellpadding=0 cellspacing=0 class=style1><tr><td tabindex=0 id=MainDev class="topbar_td style3x"onclick=go(10,event) onkeypress='"Enter"==event.key&&go(10)'>Obecné<td tabindex=0 id=MainDevDesktop class="topbar_td style3x"onclick=go(11,event) onkeypress='"Enter"==event.key&&go(11)'>Plocha<td tabindex=0 id=MainDevTerminal class="topbar_td style3x"onclick=go(12,event) onkeypress='"Enter"==event.key&&go(12)'>Terminál<td tabindex=0 id=MainDevFiles class="topbar_td style3x"onclick=go(13,event) onkeypress='"Enter"==event.key&&go(13)'>Soubory<td tabindex=0 id=MainDevEvents class="topbar_td style3x"onclick=go(16,event) onkeypress='"Enter"==event.key&&go(16)'>Události<td tabindex=0 id=MainDevInfo class="topbar_td style3x"onclick=go(17,event) onkeypress='"Enter"==event.key&&go(17)'>Detaily<td tabindex=0 id=MainDevAmt class="topbar_td style3x"onclick=go(14,event) onkeypress='"Enter"==event.key&&go(14)'>Intel® AMT<td tabindex=0 id=MainDevConsole class="topbar_td style3x"onclick=go(15,event) onkeypress='"Enter"==event.key&&go(15)'>Konzole<td tabindex=0 id=MainDevPlugins class="topbar_td style3x"onclick=go(19,event) onkeypress='"Enter"==event.key&&go(19)'>Pluginy<td class="topbar_td_end style3"> </table></div><div id=MeshSubMenuSpan style=display:none><table id=MeshSubMenu cellpadding=0 cellspacing=0 class=style1><tr><td tabindex=0 id=MeshGeneral class="topbar_td style3x"onclick=go(20,event) onkeypress='"Enter"==event.key&&go(20)'>Obecné<td class="topbar_td_end style3"> </table></div><div id=UserSubMenuSpan style=display:none><table id=UserSubMenu cellpadding=0 cellspacing=0 class=style1><tr><td tabindex=0 id=UserGeneral class="topbar_td style3x"onclick=go(30,event) onkeypress='"Enter"==event.key&&go(30)'>Obecné<td tabindex=0 id=UserEvents class="topbar_td style3x"onclick=go(31,event) onkeypress='"Enter"==event.key&&go(31)'>Události<td class="topbar_td_end style3"> </table></div><div id=ServerSubMenuSpan style=display:none><table id=ServerSubMenu cellpadding=0 cellspacing=0 class=style1><tr><td tabindex=0 id=ServerGeneral class="topbar_td style3x"onclick=go(6,event) onkeypress='"Enter"==event.key&&go(6)'>Obecné<td tabindex=0 id=ServerStats class="topbar_td style3x"onclick=go(40,event) onkeypress='"Enter"==event.key&&go(40)'>Statistiky<td tabindex=0 id=ServerConsole class="topbar_td style3x"onclick=go(115,event) onkeypress='"Enter"==event.key&&go(115)'>Konzole<td tabindex=0 id=ServerTrace class="topbar_td style3x"onclick=go(41,event) onkeypress='"Enter"==event.key&&go(41)'>Trace<td tabindex=0 id=ServerPlugins class="topbar_td style3x"onclick=go(42,event) onkeypress='"Enter"==event.key&&go(42)'>Pluginy<td class="topbar_td_end style3"> </table></div><div id=UserDummyMenuSpan><table id=UserDummyMenu cellpadding=0 cellspacing=0 class=style1><tr><td class=style3> </table></div></div></div></div><div id=column_l><div id=p0 style=display:none><div id=p0message><span id=p0span>Server disconnected</span>,<href onclick=reload() style=cursor:pointer><u>klikni pro opětovné připojení</u></href>.</div></div><div id=p1 style=display:none><div style=display:none id=devListToolbarViewIcons><div tabindex=0 id=devViewButton1 class=viewSelector onclick=onDeviceViewChange(1) onkeypress='"Enter"==event.key&&onDeviceViewChange(1)'title=Buňky><div class=viewSelector2></div></div><div tabindex=0 id=devViewButton2 class=viewSelector onclick=onDeviceViewChange(2) onkeypress='"Enter"==event.key&&onDeviceViewChange(2)'title=List><div class=viewSelector1></div></div><div tabindex=0 id=devViewButton3 class=viewSelector onclick=onDeviceViewChange(3) onkeypress='"Enter"==event.key&&onDeviceViewChange(3)'title=Desktopy><div class=viewSelector3></div></div><div tabindex=0 id=devViewButton4 class=viewSelector onclick=onDeviceViewChange(4) onkeypress='"Enter"==event.key&&onDeviceViewChange(4)'title=Mapa><div class=viewSelector4></div></div></div><div><h1>Moje zařízení</h1></div><table id=devListToolbarSpan class=noselect><tr><td class=h1><td id=devListToolbar class=style14 style=display:none> <input type=button id=SelectAllButton onclick=selectallButtonFunction() value="Vybrat vše"> <input type=button id=GroupActionButton disabled value="Akce skupiny"onclick=groupActionFunction()> <input id=SearchInput placeholder=Filtr onchange=masterUpdate(5) onkeyup=masterUpdate(5) autocomplete=off onfocus=onSearchFocus(1) onblur=onSearchFocus(0)> <label><input type=checkbox id=RealNameCheckBox onclick=onRealNameCheckBox()><span title="Show devices operating system name">Jméno operačního systému</span></label><td id=kvmListToolbar class=style14 style=display:none> <input type=button onclick=connectAllKvmFunction() value="Connect All"> <input type=button onclick=disconnectAllKvmFunction() value="Disconnect All"> <label><input type=checkbox id=autoConnectDesktopCheckbox onclick=autoConnectDesktops(event) title="Automatic connect">Auto </label> <input type=button onclick=showMultiDesktopSettings() value=Nastavení> <td id=devMapToolbar class=style14 style=display:none> <input 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 onclick=refreshMap(!1,!0)><td class=auto-style1 style=height:100%><div style=display:none id=devListToolbarView>View <select id=viewselect onchange=onDeviceViewChange()><option value=1>Buňky<option value=2>List<option value=3>Desktopy<option id=viewselectmapoption value=4>Mapa</select></div><div style=display:none id=devListToolbarSort>Třídit <select id=sortselect onchange=masterUpdate(6)><option>Skupina<option>Napájení<option>Zařízení<option>Tagy</select> </div><div style=display:none id=devListToolbarSize>Velikost <select id=sizeselect onchange=onDeviceViewChange()><option value=0>Malé<option value=1>Středně<option value=2>Velký</select> </div><td class=h2></table><div id=NoMeshesPanel style=display:none><table><tr><td valign=top style=width:50px><img src=images/info.png><td><div id=getStarted1>To get started, <a href=# onclick="return account_createMesh()"><strong>click here to create a device group</strong></a>.</div><div id=getStarted2>No device groups.</div></table></div><div id=xdevices class=noselect style=display:none></div><div id=xdevicesmap style=display:none><div id=xmapSearchResultsDlg style=display:none><div id=xmapSearchResultsBck><div id=xmapSearchClose 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></div></div><div id=p2 style=display:none><h1>Můj účet</h1><img id=p2AccountImage alt=""src=images/clipboard-128.png><div id=p2AccountSecurity style=display:none><p><strong>Nastavení bezpečnosti</strong><div style=margin-left:25px><div id=manageAuthApp><div class=p2AccountActions><span id=authAppSetupCheck><strong>✓</strong></span></div><span><a href=# onclick="return account_manageAuthApp()">Manage authenticator app</a><br></span></div><div id=manageHardwareOtp><div class=p2AccountActions><span id=authKeySetupCheck><strong>✓</strong></span></div><span><a href=# onclick="return account_manageHardwareOtp(0)">Manage security keys</a><br></span></div><div id=manageOtp><div class=p2AccountActions><span id=authCodesSetupCheck><strong>✓</strong></span></div><span><a href=# onclick="return account_manageOtp(0)">Manage backup codes</a><br></span></div></div></div><div id=p2AccountActions><p><strong>Account actions</strong><p class=mL><span id=verifyEmailId style=display:none><a href=# onclick="return account_showVerifyEmail()">Verify email</a><br></span><span id=accountEnableNotificationsSpan style=display:none><a href=# onclick="return account_enableNotifications()">Zapnout notifikace prohlížeče</a><br></span><a href=# onclick="return account_showLocalizationSettings()">Localization Settings</a><br><a href=# onclick="return account_showAccountNotifySettings()">Notification Settings</a><br><span id=accountChangeEmailAddressSpan style=display:none><a href=# onclick="return account_showChangeEmail()">Change email address</a><br></span><a href=# onclick="return account_showChangePassword()">Změnit heslo</a><span id=p2nextPasswordUpdateTime></span><br><a href=# onclick="return account_showDeleteAccount()">Smazat účet</a><br></p><br style=clear:both></div><strong>Device Groups</strong> <span id=p2createMeshLink1>( <a href=# onclick="return account_createMesh()"class=newMeshBtn>New</a> )</span><br><br><div id=p2meshes></div><div id=p2noMeshFound style=display:none>No device groups.<span id=p2createMeshLink2> <a href=# onclick="return account_createMesh()"><strong>Get started here!</strong></a></span></div><br style=clear:both></div><div id=p3 style=display:none><h1>Moje události</h1><table class=pTable><tr><td class=h1><td class=auto-style1>Zobrazit <select id=p3limitdropdown onchange=refreshEvents()><option value=60>Posledních 60<option value=120>Posledních 120<option value=250>Posledních 250<option value=500>Posledních 500<option value=1000>Posledních 1000</select> <a href=# onclick=p3showDownloadEventsDialog(2)><img src=images/link4.png height=10 width=10 title="Download Events"style=cursor:pointer></a> <td class=h2></table><div id=p3events></div></div><div id=p4 style=display:none><h1>Uživatelé</h1><table class=pTable><tr><td class=h1><td class=style14><div style=float:right><input type=button onclick=showUserBroadcastDialog() style=margin-right:6px value=Broadcast> <a href=# onclick=p4downloadUserInfo()><img style=cursor:pointer title="Download user information"src=images/link4.png></a><a href=# onclick=p4batchAccountCreate()><img id=p4UserBatchCreate style=cursor:pointer;display:none title="Batch create many user accounts"src=images/link6.png></a></div><div><input id=UserNewAccountButton type=button style=margin-left:6px onclick=showCreateNewAccountDialog() value="Nový účet..."> <input id=UserSearchInput style=width:120px;margin-left:6px placeholder=Filtr onchange=onUserSearchInputChanged() onkeyup=onUserSearchInputChanged() autocomplete=off onfocus=onUserSearchFocus(1) onblur=onUserSearchFocus(0)></div><td class=h2></table><div id=p3users></div></div><div id=p5 style=display:none><h1>Moje soubory</h1><table id=p5toolbar cellpadding=0 cellspacing=0><tr><td id=p5filehead valign=bottom><div id=p5rightOfButtons></div><div><input type=button id=p5FolderUp disabled onclick="return p5folderup()"value=Nahoru> <input type=button id=p5SelectAllButton disabled onclick=p5selectallfile() value="Vybrat vše"> <input type=button id=p5RenameFileButton disabled value=Přejmenovat onclick=p5renamefile()> <input type=button id=p5DeleteFileButton disabled value=Smazat onclick=p5deletefile()> <input type=button id=p5NewFolderButton disabled value="Nový adresář"onclick=p5createfolder()> <input type=button id=p5UploadButton disabled value=Nahrát onclick=p5uploadFile()> <input type=button id=p5CutButton disabled value=Vyjmout onclick=p5copyFile(1)> <input type=button id=p5CopyButton disabled value=Kopírovat onclick=p5copyFile(0)> <input type=button id=p5PasteButton disabled value=Vložit onclick=p5pasteFile()> </div><tr><td id=p5filesubhead><div style=float:right><select id=p5sortdropdown onchange=updateFiles()><option value=1 selected>Třídit podle jména<option value=2>Třídit podle velikosti<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></table><div id=p5filetable><div id=p5PublicShare><div>These files are shared publicly, click "link" to get public url.</div></div><div id=bigok style=display:none><b>✓</b></div><div id=bigfail style=display:none><b>✗</b></div><span id=p5files></span></div><table id=p5toolbarBottom style=width:100% cellpadding=0 cellspacing=0><tr><td class=style6> <span id=p5bottomstatus></span></table></div><div id=p6 style=display:none><img id=MainMeshImage src=serverpic.ashx><h1>Můj server</h1><div id=p2ServerActions><p><strong>Server actions</strong><div class=mL><div id=p2ServerActionsBackup><a href={{{domainurl}}}backup.zip rel="noreferrer noopener"target=_blank>Download server backup</a></div><div id=p2ServerActionsRestore><a href=# onclick="return server_showRestoreDlg()">Restore server with backup</a></div><div id=p2ServerActionsVersion><a href=# onclick="return server_showVersionDlg()">Zkontrolovat verzi serveru</a></div><div id=p2ServerActionsErrors><a href=# onclick="return server_showErrorsDlg()">Zobrazit chyby serveru</a></div></div></div><br><strong>Statistiky serveru</strong><br><br><div id=serverStats><div id=serverCpuChartView style=display:none><div class=chartViewCanvas><canvas id=serverCpuChart></canvas></div><div class=chartViewText id=serverCpuChartText></div></div><div id=serverMemoryChartView style=display:none><div class=chartViewCanvas><canvas id=serverMemoryChart></canvas></div><div class=chartViewText id=serverMemoryChartText></div></div><br><br><div id=serverStatsTable></div></div><div id=serverWarningsDiv style=display:none><br><strong>Server Warnings</strong><br><br><div id=serverWarnings></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 id=p10BackButton><div class=backButton tabindex=0 onclick=goBack() title=Zpět onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Obecné - <span id=p10deviceName></span></h1></div><div id=p10html></div><td style=width:20px><td style=width:200px><a href=# onclick=p10showiconselector()><img id=MainComputerImage></a><div id=MainComputerState></div></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 id=p11BackButton><div class=backButton tabindex=0 onclick=goBack() title=Zpět onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><div 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=p11warning onclick=showFeaturesDlg()><div class=icon2></div><div class=warningbox>Intel® AMT Redirection port or KVM feature is disabled<span id=p11warninga>, zde kliknout pro aktivaci.</span></div></div><div id=p11warning2 onclick=showPowerActionDlg()><div class=icon2></div><div class=warningbox>Vzdálený počítač není zapnutý, klikněte zde pro zapnutí.</div></div><div id=deskarea0 cellpadding=0 cellspacing=0><div id=deskarea1 class=areaHead><div class=toright2><span id=p11power></span> <div class=deskareaicon title="Toggle View Mode"onclick=toggleAspectRatio(1)>⇲</div><div class=deskareaicon title="Rotate Left"onclick=drotate(-1)>↺</div><div class=deskareaicon title="Rotate Right"onclick=drotate(1)>↻</div><div id=deskRecordIcon class=deskareaicon title="Server is recording this session"style=display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px></div><input id=deskFocusBtn type=button title="Toggle focus mode, when active only the region around the mouse is updated"onkeypress=return!1 onkeydown=return!1 value="Focus All"onclick=deskToggleFocus() style=margin-right:3px;display:none> <input id=deskSaveBtn type=button title="Uložit screenshot vzdáleného počítače"onkeypress=return!1 onkeydown=return!1 value=Save... onclick=deskSaveImage() class=mR> <input id=deskActionsBtn type=button title="Akce napájení"onkeypress=return!1 onkeydown=return!1 value=Akce onclick=deviceActionFunction() class=mR> <input id=deskActionsSettings type=button value=Nastavení... title="Edit remote desktop settings"onkeypress=return!1 onkeydown=return!1 onclick=showDesktopSettings() class=mR> <input type=button title="Change the power state of the remote machine"onkeypress=return!1 onkeydown=return!1 value="Akce napájení"onclick=showPowerActionDlg() style=display:none></div><div><div id=idx_deskFullBtn2 onclick=deskToggleFull(event)> ✖</div><input type=button id=autoconnectbutton1 value=AutoConnect onclick=autoConnectDesktop(event) onkeypress=return!1 onkeydown=return!1 style=display:none> <span id=connectbutton1span><input type=button id=connectbutton1 value=Připojit onclick=connectDesktop(event,1) onkeypress=return!1 onkeydown=return!1 disabled></span><span id=connectbutton1hspan> <input type=button id=connectbutton1h value="HW Connect"title="Connect using Intel AMT hardware KVM"onclick=connectDesktop(event,2) onkeypress=return!1 onkeydown=return!1 disabled></span><span id=disconnectbutton1span> <input type=button id=disconnectbutton1 value=Disconnect onclick=connectDesktop(event,0) onkeypress=return!1 onkeydown=return!1></span> <span id=deskstatus>Odpojeno</span></div></div><div id=deskarea2><div class=areaProgress><div id=progressbar></div></div></div><div id=deskarea3x><div id=DeskFocus oncontextmenu=return!1 onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></div><div id=DeskParent><canvas id=Desk width=640 height=480 oncontextmenu=return!1 onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event) onmousewheel=dmousewheel(event)></canvas></div><div id=DeskTools><div id=deskToolsAreaTop><a id=DeskToolsRefreshButton style=right:2px onclick=refreshDeskTools()>Obnovit</a><div id=deskToolsTopTabProcess class=deskToolsTopTab onclick=changeDeskToolTab(0) style=left:0;bottom:0>Procesy</div><div id=deskToolsTopTabService class=deskToolsTopTab onclick=changeDeskToolTab(1) style=display:none;left:90px;color:gray>Služby</div></div><div id=deskToolsArea><div id=DeskToolsProcessTab><div id=deskToolsHeader><a class=colmn1 title="Sort by process id"onclick=sortProcess(0)>PID</a> <a class=colmn2 title="Třídit podle jména"onclick=sortProcess(1)>Jméno</a></div><div id=DeskToolsProcesses></div></div><div id=DeskToolsServiceTab style=display:none><div id=deskToolsServiceHeader><a class=colmn1 style=width:70px title="Třídit podle stavu"onclick=sortService(0)>Stav</a> <a class=colmn2 title="Třídit podle jména"onclick=sortService(1)>Jméno</a></div><div id=DeskToolsServices></div></div></div></div><div id=p11DeskConsoleMsg style=display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:#ff0;background-color:rgba(0,0,0,.6);padding:10px;border-radius:5px onclick=p11clearConsoleMsg()></div></div><div id=deskarea4 class=areaFoot><div class=toright2><span id=DeskTimer title="Session time"></span> <select id=termdisplays style=display:none onchange=deskSetDisplay(event) onkeypress=return!1 onkeydown=return!1></select> <input id=DeskToolsButton type=button value=Nástroje title="Přepnout zobrazení nástrojů"onkeypress=return!1 onkeydown=return!1 onclick=toggleDeskTools()> <span id=DeskChatButton class=deskarea title="Open chat window to this computer"><img src=images/icon-chat.png onclick=deviceChat(event) height=16 width=16 style=padding-top:2px></span><span id=DeskNotifyButton 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 title="Open a web address on the remote computer"><img src=images/icon-url2.png onclick=deviceUrlFunction() height=16 width=16 style=padding-top:2px></span><span id=DeskBackgroundButton title="Toggle remote desktop background"><img src=images/icon-background.png onclick=deviceToggleBackground(event) height=16 width=16 style=padding-top:2px></span></div><div><select id=deskkeys><option value=10>Ctrl+Alt+Del<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<option value=7>Alt-F4<option value=8>Ctrl-W<option value=9>Alt-Tab<option value=11>Win+Left<option value=12>Win+Right</select> <input id=DeskWD type=button value=Odeslat onkeypress=return!1 onkeydown=return!1 onclick=deskSendKeys()> <input id=DeskClip type=button value=Clipboard onkeypress=return!1 onkeydown=return!1 onclick=showDeskClip()> <input id=DeskType type=button value=Typ onkeypress=return!1 onkeydown=return!1 onclick=showDeskType()> <label><span id=DeskControlSpan title="Toggle mouse and keyboard input"><input id=DeskControl type=checkbox onkeypress=return!1 onkeydown=return!1 onclick=toggleKvmControl()>Vstup</span></label> </div></div></div></div><div id=p12 style=display:none><div id=p12title><div id=p12BackButton><div class=backButton tabindex=0 onclick=goBack() title=Zpět onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Terminal - <span id=p12deviceName></span></h1></div><div id=p12warning onclick=showFeaturesDlg()><div class=icon2></div><div class=warningbox>Intel® AMT Redirection port or KVM feature is disabled<span id=p12warninga>, zde kliknout pro aktivaci.</span></div></div><div id=p12warning2 onclick=showPowerActionDlg()><div class=icon2></div><div class=warningbox>Vzdálený počítač není zapnutý, klikněte zde pro zapnutí.</div></div><div id=termTable style=position:relative><table style=width:100% cellpadding=0 cellspacing=0><tr><td class=areaHead><div class=toright2><div id=termRecordIcon class=deskareaicon title="Server is recording this session"style=display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-left:5px></div><input id=termActionsBtn type=button title="Akce napájení"onkeypress=return!1 onkeydown=return!1 value=Akce onclick=deviceActionFunction()></div><div><input type=button id=autoconnectbutton2 value=AutoConnect onclick=autoConnectTerminal(event) onkeypress=return!1 onkeydown=return!1 style=display:none> <span id=connectbutton2span><input type=button id=connectbutton2 value=Připojit onclick=connectTerminal(event,1) onkeypress=return!1 onkeydown=return!1 disabled></span><span id=connectbutton2hspan> <input type=button id=connectbutton2h value="HW Connect"title="Connect using Intel AMT hardware KVM"onclick=connectTerminal(event,2) onkeypress=return!1 onkeydown=return!1 disabled></span><span id=disconnectbutton2span> <input type=button id=disconnectbutton2 value=Disconnect onclick=connectTerminal(event,0) onkeypress=return!1 onkeydown=return!1></span> <span id=termstatus>Odpojeno</span><span id=termtitle></span></div><tr><td><div class=areaProgress><div id=termprogressbar></div></div><tr><td id=termarea3x><pre id=Term></pre><tr><td class=areaFoot><div class=toright2><span id=TermTimer title="Session time"></span> <span id=terminalSettingsButtons style=display:none><input id=id_tcrbutton type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton value=CR+LF title="Toggle what the return key will send"onclick=termToggleCr()> <input id=id_tfxkeysbutton type=button onkeypress=return!1 onkeydown=return!1 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!1 onkeydown=return!1 class=bottombutton value="Extended Ascii"title="Toggle terminal emulation type"onclick=termToggleType()> </span><span id=terminalSizeDropDown><select id=termSizeList onkeypress=return!1><option value=1>80x25<option value=2>100x30<option value=3 selected>Auto</select> </span><select id=specialkeylist onkeypress=return!1></select> <input id=specialkeylistinput type=button onkeypress=return!1 class=bottombutton value=Odeslat title="Send the selected special key"onclick=sendSpecialKey()></div><div> <input type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton id=ctrlcbutton value=Ctl-C onclick='termSendKey(3,"ctrlcbutton")'> <input type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton id=ctrlxbutton value=Ctl-X onclick='termSendKey(24,"ctrlxbutton")'> <input type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton id=escbutton value=ESC onclick='termSendKey(27,"escbutton")'> <input type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton id=bsbutton value=Backspace onclick='termSendKey(8,"bsbutton")'> <input type=button onkeypress=return!1 onkeydown=return!1 class=bottombutton id=pastebutton value=Vložit title="Paste text into the terminal"onclick=showTermPasteDialog()></div></table><div id=p12TermConsoleMsg style=display:none;cursor:pointer;position:absolute;left:30px;top:45px;color:#ff0;background-color:rgba(0,0,0,.6);padding:10px;border-radius:5px onclick=p12clearConsoleMsg()></div></div></div><div id=p13 style=display:none><div id=p13title><div id=p13BackButton style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Zpět onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Soubory - <span id=p13deviceName></span></h1></div><table id=p13toolbar cellpadding=0 cellspacing=0><tr><td class=areaHead><div class=toright2><input id=filesActionsBtn type=button title="Akce napájení"value=Akce onclick=deviceActionFunction()><div id=filesRecordIcon class=deskareaicon title="Server is recording this session"style=display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-left:5px></div></div><div><input id=p13AutoConnect value=AutoConnect onclick=autoConnectFiles(event) type=button style=display:none> <input id=p13Connect value=Připojit onclick=connectFiles(event) type=button> <span id=p13Status>Odpojeno</span></div><tr><td class=areaHead2 valign=bottom><div id=p13rightOfButtons class=toright2></div><div><input type=button id=p13FolderUp disabled onclick=p13folderup() value=Nahoru> <input type=button id=p13SelectAllButton disabled onclick=p13selectallfile() value="Vybrat vše"> <input type=button id=p13RenameFileButton disabled value=Přejmenovat onclick=p13renamefile()> <input type=button id=p13DeleteFileButton disabled value=Smazat onclick=p13deletefile()> <input type=button id=p13ViewFileButton disabled value=Edit onclick=p13viewfile()> <input type=button id=p13NewFolderButton disabled value="Nový adresář"onclick=p13createfolder()> <input type=button id=p13UploadButton disabled value=Nahrát onclick=p13uploadFile()> <input type=button id=p13CutButton disabled value=Vyjmout onclick=p13copyFile(1)> <input type=button id=p13CopyButton disabled value=Kopírovat onclick=p13copyFile(0)> <input type=button id=p13PasteButton disabled value=Vložit onclick=p13pasteFile()> <input type=button id=p13RefreshButton disabled value=Obnovit onclick=p13folderup(9999)> </div><tr><td class=areaHead3><div class=toright2><select id=p13sortdropdown onchange=p13updateFiles()><option value=1 selected>Třídit podle jména<option value=2>Třídit podle velikosti<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></table><div id=p13FilesConsoleMsg style=display:none;cursor:pointer;position:absolute;left:30px;top:165px;color:#ff0;background-color:rgba(0,0,0,.6);padding:10px;border-radius:5px onclick=p13clearConsoleMsg()></div><div id=p13filetable><div id=p13bigok style=display:none><b>✓</b></div><div id=p13bigfail style=display:none><b>✗</b></div><span id=p13files></span></div><table id=p13toolbarBottom cellpadding=0 cellspacing=0><tr><td class=style6> <span id=p13bottomstatus></span></table></div><div id=p14 style=display:none><div id=p14title><div id=p14BackButton style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Zpět onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><div id=devListToolbarViewIcons><div class=viewSelector onclick=deskToggleFull(event) title="Full Screen. Hold shift to browser full screen."><div class=viewSelector5></div></div></div><h1>Intel® AMT - <span id=p14deviceName></span></h1></div><iframe id=p14iframe src={{{domainurl}}}commander.htm></iframe></div><div id=p15 style=display:none><div id=p15title><div id=p15BackButton style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Zpět onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1><span id=p15deviceName></span></h1></div><table id=consoleTable cellpadding=0 cellspacing=0><tr><td class=areaHead><div class=toright2><div 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"> <img onclick=p15downloadConsoleText() style=cursor:pointer;margin-top:6px title="Download console text"src=images/link4.png></div><div id=p15statetext></div><tr><td><div class=areaProgress><div id=consoleprogressbar></div></div><tr><td id=p15agentConsole><pre id=p15agentConsoleText></pre><tr><td class=areaFoot><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 id=p15outputselecttd><select id=p15outputselect><option value=1>Agent<option value=2>MQTT</select><td style=width:1%><input id=id_p15consoleClear type=button class=bottombutton value=Clear onclick=p15consoleClear()></table></table></div><div id=p16 style=display:none><div id=p16title><div id=p16BackButton style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Zpět onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Events - <span id=p16deviceName></span></h1></div><table class=pTable><tr><td class=h1><td class=auto-style1>Zobrazit <select id=p16limitdropdown onchange=refreshDeviceEvents()><option value=60>Posledních 60<option value=120>Posledních 120<option value=250>Posledních 250<option value=500>Posledních 500<option value=1000>Posledních 1000</select> <a href=# onclick=p3showDownloadEventsDialog(1)><img src=images/link4.png height=10 width=10 title="Download Events"style=cursor:pointer></a> <td class=h2></table><div id=p16events></div></div><div id=p17 style=display:none><div id=p17title><div id=p17BackButton style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Zpět onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Detaily - <span id=p17deviceName></span></h1></div><div id=p17info></div></div><div id=p20 style=display:none><picture id=MainMeshImage style=border-width:0;height:200px;width:200px;float:right><source type=image/webp width=200 height=200 srcset=images/webp/mesh-256.webp><img alt=""width=200 height=200 src=images/mesh-256.png></picture><div style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Zpět onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Obecné - <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 tabindex=0 onclick=goBack() title=Zpět onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Obecné - <span id=p30userName></span></h1></div><div id=p30html></div><td style=width:20px><td style=width:200px><picture id=MainUserImage style=border-width:0;height:200px;width:200px;float:right><source type=image/webp width=200 height=200 srcset=images/webp/user-256.webp><img alt=""width=200 height=200 src=images/user-256.png></picture><div style=width:100%;text-align:center><strong><span id=MainUserState></span></strong></div></table><br><div id=p30html2></div><div id=p30html3></div></div><div id=p31 style=display:none><div style=float:left><div class=backButton tabindex=0 onclick=goBack() title=Zpět onkeypress='"Enter"==event.key&&goBack()'><div class=backButtonEx></div></div></div><h1>Events - <span id=p31userName></span></h1><table class=pTable><tr><td class=h1><td class=auto-style1>Zobrazit <select id=p31limitdropdown onchange=refreshUsersEvents()><option value=60>Posledních 60<option value=120>Posledních 120<option value=250>Posledních 250<option value=500>Posledních 500<option value=1000>Posledních 1000</select> <a href=# onclick=p3showDownloadEventsDialog(3)><img src=images/link4.png height=10 width=10 title="Download Events"style=cursor:pointer></a> <td class=h2></table><div id=p31events></div></div><div id=p40 style=display:none><h1>Statistika serveru</h1><div class=areaHead><div class=toright2><select id=p40type onchange=updateServerTimelineStats()><option value=0>Connections<option value=1>Paměť</select> <select id=p40time onchange=updateServerTimelineHours()><option value=3>Last 3 hours<option value=8>Posledních 8 hodin<option value=24>Poslední den<option value=168>Poslední týden<option value=720>Last 30 days</select> <img src=images/link4.png height=10 width=10 title="Download data points (.csv)"style=cursor:pointer onclick=p40downloadEvents()> </div><div><input value=Obnovit type=button onclick=refreshServerTimelineStats()> <label><input id=p40log type=checkbox onclick=updateServerTimelineHours()>Log-X</label></div></div><canvas id=serverMainStats></canvas></div><div id=p41 style=display:none><h1>My Server Tracing</h1><div class=areaHead><div class=toright2>Zobrazit <select id=p41limitdropdown onchange=displayServerTrace()><option value=100>Posledních 100<option value=250>Posledních 250<option value=500>Posledních 500<option value=1000>Posledních 1000</select> <input value=Clear type=button onclick=clearServerTracing()> <img src=images/link4.png height=10 width=10 title="Download trace (.csv)"style=cursor:pointer onclick=p41downloadServerTrace()> </div><div><input value=Tracing type=button onclick=setServerTracing()> <span id=p41traceStatus>Nic</span></div></div><div id=p41events></div></div><div id=p42 style=display:none><h1>My Server Plugins</h1><div class=areaHead><div class=toright2></div><div><input value="Download Plugin"type=button onclick="return pluginHandler.addPluginDlg()"></div></div><div id=pluginRestartNotice class=areaHead style=background-color:gold;display:none><div class=toright2><input value="Refresh Agent Cores"type=button onclick="return distributeCore(),!1"></div><div style=padding:2px><div style=padding:2px><b>Notice:</b> Plugins have been altered, this may require agent core update.</div></div></div><table id=p42tbl><tr class=DevSt><th style=width:26px><th style=width:10px><th class=chName>Jméno<th class=chDescription>Popis<th class=chSite style=text-align:center>Link<th class=chVersion style=text-align:center>Version<th class=chUpgradeAvail style=text-align:center>Latest<th class=chStatus style=text-align:center>Status<th class=chAction style=text-align:center>Action<th style=width:10px></table><div id=pluginNoneNotice style=width:100%;text-align:center;padding-top:10px;display:none><i>No plugins on server.</i></div></div><div id=p43 style=display:none><div id=p43BackButton><div class=backButton tabindex=0 onclick=go(42) title=Zpět onkeypress='"Enter"==event.key&&go(42)'><div class=backButtonEx></div></div></div><h1>My Server Plugins - <span id=p43title></span></h1><iframe id=p43iframe frameborder=0 style="width:100%;height:calc(100vh - 245px);max-height:calc(100vh - 245px)"></iframe></div><div id=p19 style=display:none><h1>Pluginy - <span id=p19deviceName></span></h1><style>#p19headers{padding-right:7px;padding-bottom:10px;font-weight:700;border-bottom:1px dotted #00f}#p19headers>span:nth-child(n+2){border-left:1px solid #000}#p19headers>span{padding-left:4px;padding-right:4px}</style><div id=p19headers></div><div id=p19pages></div></div><br id=column_l_bottomgap></div><div id=footer><div class=footer1>{{{footer}}}</div><div class=footer2><a id=verifyEmailId2 style=display:none href=# onclick=account_showVerifyEmail()>Ověřit Email</a> <a href=terms>Terms & Privacy</a></div></div><div id=dialog class=noselect style=display:none><div id=dialogHeader><div tabindex=0 id=id_dialogclose onclick=setDialogMode() onkeypress='"Enter"==event.key&&setDialogMode()'>✖</div><div id=id_dialogtitle></div></div><div id=dialogBody><div id=dialog1><div id=id_dialogMessage></div></div><div id=dialog2><div id=id_dialogOptions></div></div><div id=dialog3><div id=d3upload><div>File Selection</div><select id=d3uploadMode onchange=d3modechange()><option value=1>Local file upload<option value=2>Server file selection</select></div><div id=d3localmode style=display:none><div>Nahrát soubor</div><form id=d3localmodeform method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input id=d3auth name=auth style=display:none> <input id=d3attrib name=attrib style=display:none> <input type=file id=d3localFile name=files onchange=d3setActions()> <input type=submit id=d3submit style=display:none></form></div><div id=d3servermode><div id=d3serveraction valign=bottom><input type=button id=p3FolderUp disabled onclick=d3folderup() value=Nahoru> </div><div id=d3serverfiles></div></div></div><div id=dialog7><div id=d7meshkvm><h4>Agent Remote Desktop</h4><div><div>Kvalita</div><select id=d7bitmapquality dir=rtl></select></div><div><div>Škálování</div><select id=d7bitmapscaling dir=rtl><option 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><div><div>Obnovování</div><select id=d7framelimiter dir=rtl><option selected value=50>Rychle<option value=100>Středně<option value=400>Pomalu<option value=1000>Velmi pomalu</select></div></div><div id=d7amtkvm><h4>Intel® AMT Hardware KVM</h4><div><div>Kódovaní obrazu</div><select id=d7desktopmode><option value=1>RLE8, Fastest<option value=2>RLE16, Recommended<option value=3>RAW8, Slow<option value=4>RAW16, Very Slow</select></div><div><div>Other Settings</div><div id=d7otherset style=display:block><label style=display:block><input type=checkbox id=d7showfocus>Show Focus Tool</label> <label style=display:block><input type=checkbox id=d7showcursor>Show Local Mouse Cursor</label> <label style=display:block><input type=checkbox id=d7localKeyMap>Local Keyboard Map</label></div></div></div></div></div><div id=idx_dlgButtonBar><input id=idx_dlgCancelButton type=button value=Zrušit onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK onclick=dialogclose(1)><div><input id=idx_dlgDeleteButton type=button value=Smazat style=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=p5fileDragAuthCookie name=auth><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></audio></div><script>'use strict';
2
+
3
+ // Process server-side web state
4
+ var webState = '{{{webstate}}}';
5
+ if (webState != '') { webState = JSON.parse(decodeURIComponent(webState)); }
6
+ for (var i in webState) { localStorage.setItem(i, webState[i]); }
7
+ if (!webState.loctag) { delete localStorage.removeItem('loctag'); }
8
+
9
+ var args;
10
+ var autoReconnect = true;
11
+ var powerStatetable = ['', "Zapnuto", "Spánek", "Spánek", "Spánek", "Hibernating", "Vypnout", "Present"];
12
+ var StatusStrs = ["Odpojeno", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"];
13
+ var sort = 0;
14
+ var searchFocus = 0;
15
+ var mapSearchFocus = 0;
16
+ var userSearchFocus = 0;
17
+ var consoleFocus = 0;
18
+ var showRealNames = false;
19
+ var meshserver = null;
20
+ var meshes = {};
21
+ var meshcount = 0;
22
+ var nodes = null;
23
+ var filetree = {};
24
+ var userinfo = null;
25
+ var serverinfo = null;
26
+ var events = [];
27
+ var users = null;
28
+ var wssessions = null;
29
+ var nodeShortIdent = 0;
30
+ var desktop;
31
+ var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50, localkeymap: false };
32
+ var multidesktopsettings = { quality: 20, scaling: 128, framerate: 1000 };
33
+ var terminal;
34
+ var files;
35
+ var debugLevel = parseInt('{{{debuglevel}}}');
36
+ var features = parseInt('{{{features}}}');
37
+ var sessionTime = parseInt('{{{sessiontime}}}');
38
+ var domain = '{{{domain}}}';
39
+ var domainUrl = '{{{domainurl}}}';
40
+ var authCookie = '{{{authCookie}}}';
41
+ var authRelayCookie = '{{{authRelayCookie}}}';
42
+ var authCookieRenewTimer = null;
43
+ var multiDesktop = {};
44
+ var multiDesktopFilter = null;
45
+ var serverPublicNamePort = '{{{serverDnsName}}}:{{{serverPublicPort}}}';
46
+ var amtScanResults = null;
47
+ var debugmode = 0;
48
+ var clickOnce = (((features & 256) != 0) && detectClickOnce());
49
+ var attemptWebRTC = ((features & 128) != 0);
50
+ var passRequirements = '{{{passRequirements}}}';
51
+ if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); }
52
+ var deskAspectRatio = 0;
53
+ try { deskAspectRatio = parseInt(getstore('deskAspectRatio', '0')); } catch (ex) { }
54
+ var uiMode = parseInt(getstore('uiMode', 1));
55
+ var webPageStackMenu = false;
56
+ var webPageFullScreen = true;
57
+ var nightMode = (getstore('_nightMode', '0') == '1');
58
+ var sessionActivity = Date.now();
59
+ var updateSessionTimer = null;
60
+ var pluginHandlerBuilder = {{{pluginHandler}}};
61
+ var pluginHandler = null;
62
+ if (pluginHandlerBuilder != null) { pluginHandler = new pluginHandlerBuilder(); }
63
+ var installedPluginList = null;
64
+
65
+ // Console Message Display Timers
66
+ var p11DeskConsoleMsgTimer = null;
67
+ var p12TermConsoleMsgTimer = null;
68
+ var p13FilesConsoleMsgTimer = null;
69
+
70
+ function startup() {
71
+ if ((features & 32) == 0) {
72
+ // Guard against other site's top frames (web bugs).
73
+ var loc = null;
74
+ try { loc = top.location.toString().toLowerCase(); } catch (e) { }
75
+ if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; }
76
+ }
77
+
78
+ // Check if we are in debug mode
79
+ args = parseUriArgs();
80
+ if (!args.locale) { var x = getstore('loctag', 0); if ((x != null) && (x != '*')) { args.locale = x; } }
81
+ debugmode = args.debug;
82
+ if (args.webrtc != null) { attemptWebRTC = (args.webrtc == 1); }
83
+ QV('p13AutoConnect', debugmode); // Files
84
+ QV('autoconnectbutton2', debugmode); // Terminal
85
+ QV('autoconnectbutton1', debugmode); // Desktop
86
+ //QV('DeskClip', debugmode); // Clipboard feature, not completed so show in in debug mode only.
87
+
88
+ if (nightMode) { QC('body').add('night'); }
89
+ toggleFullScreen();
90
+
91
+ // Setup page visuals
92
+ if (args.hide) {
93
+ var hide = parseInt(args.hide);
94
+ QV('masthead', !(hide & 1));
95
+ QV('topbar', !(hide & 2));
96
+ QV('footer', !(hide & 4));
97
+ QV('p10title', !(hide & 8));
98
+ QV('p11title', !(hide & 8));
99
+ QV('p12title', !(hide & 8));
100
+ QV('p13title', !(hide & 8));
101
+ QV('p14title', !(hide & 8));
102
+ QV('p15title', !(hide & 8));
103
+ QV('p16title', !(hide & 8));
104
+ //if (hide & 16) {
105
+ // QV('page_leftbar', false);
106
+ // QS('page_content').left = '0px';
107
+ //}
108
+
109
+ // Fix the main grid to zero-height elements we want to hide.
110
+ QS('container')['grid-template-rows'] = ((hide & 1) ? '0' : '66') + 'px ' + ((hide & 2) ? '0' : '24') + 'px auto ' + ((hide & 4) ? '0' : '45') + 'px';
111
+ QS('container')['-ms-grid-rows'] = ((hide & 1) ? '0' : '66') + 'px ' + ((hide & 2) ? '0' : '24') + 'px auto ' + ((hide & 4) ? '0' : '45') + 'px';
112
+
113
+ // Adjust height of remote desktop, files and Intel AMT
114
+ var xh = (((hide & 1) ? 0 : 66) + ((hide & 2) ? 0 : 24) + ((hide & 4) ? 0 : 45) + ((hide & 8) ? 0 : 60)); // 0 to 195
115
+ QS('p3users')['max-height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
116
+ QS('p3events')['height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
117
+ QS('deskarea3x')['height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
118
+ QS('deskarea3x')['max-height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
119
+ QS('p5filetable')['height'] = 'calc(100vh - ' + (160 + xh) + 'px)';
120
+ QS('p13filetable')['height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
121
+ QS('serverMainStats')['height'] = 'calc(100vh - ' + (110 + xh) + 'px)';
122
+ QS('serverMainStats')['max-height'] = 'calc(100vh - ' + (110 + xh) + 'px)';
123
+ QS('xdevices')['max-height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
124
+ QS('xdevicesmap')['max-height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
125
+ QS('p15agentConsole')['height'] = 'calc(100vh - ' + (84 + xh) + 'px)';
126
+ QS('p15agentConsole')['max-height'] = 'calc(100vh - ' + (84 + xh) + 'px)';
127
+ QS('p15agentConsoleText')['height'] = 'calc(100vh - ' + (81 + xh) + 'px)';
128
+ QS('p15agentConsoleText')['max-height'] = 'calc(100vh - ' + (81 + xh) + 'px)';
129
+ QS('p43iframe')['height'] = 'calc(100vh - ' + (84 + xh) + 'px)';
130
+ QS('p43iframe')['max-height'] = 'calc(100vh - ' + (84 + xh) + 'px)';
131
+ }
132
+
133
+ // We are looking at a single device, remove all the back buttons
134
+ if ('{{currentNode}}' != '') {
135
+ QV('p10BackButton', false);
136
+ QV('p11BackButton', false);
137
+ QV('p12BackButton', false);
138
+ QV('p13BackButton', false);
139
+ QV('p14BackButton', false);
140
+ QV('p15BackButton', false);
141
+ QV('p16BackButton', false);
142
+ }
143
+ p1updateInfo();
144
+
145
+ // Setup the context menu
146
+ document.onclick = function (e) { hideContextMenu(); }
147
+ document.onkeypress = ondockeypress;
148
+ document.onkeydown = ondockeydown;
149
+ document.onkeyup = ondockeyup;
150
+ //window.addEventListener('focus', ondocfocus, false);
151
+ window.addEventListener('blur', ondocblur, false);
152
+ window.onresize = function () { masterUpdate(512); }
153
+ setTimeout(function() { masterUpdate(512); }, 200);
154
+
155
+ // Connect to the mesh server
156
+ meshserver = MeshServerCreateControl(domainUrl, authCookie);
157
+ meshserver.onStateChanged = onStateChanged;
158
+ meshserver.onMessage = onMessage;
159
+ meshserver.trace = (args.trace == 1);
160
+ meshserver.Start();
161
+
162
+ // Setup page controls
163
+ Q('sortselect').selectedIndex = sort = getstore('sort', 0);
164
+ Q('sizeselect').selectedIndex = getstore('_viewsize', 1);
165
+ Q('SearchInput').value = getstore('_search', '');
166
+ showRealNames = (getstore('showRealNames', 0) == 1);
167
+ Q('RealNameCheckBox').checked = showRealNames;
168
+ Q('viewselect').value = getstore('_deviceView', 1);
169
+ Q('DeskControl').checked = (getstore('DeskControl', 1) == 1);
170
+ QV('accountChangeEmailAddressSpan', (features & 0x200000) == 0);
171
+
172
+ // Display the page devices
173
+ masterUpdate(3)
174
+ for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); }
175
+ Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel');
176
+
177
+ // Setup upload drag & drop
178
+ Q('p5filetable').addEventListener('drop', p5fileDragDrop, false);
179
+ Q('p5filetable').addEventListener('dragover', p5fileDragOver, false);
180
+ Q('p5filetable').addEventListener('dragleave', p5fileDragLeave, false);
181
+ //Q('p5fileCatchAllInput').addEventListener('drop', p5fileDragDrop, false);
182
+ //Q('p5fileCatchAllInput').addEventListener('dragover', p5fileDragOver, false);
183
+ //Q('p5fileCatchAllInput').addEventListener('dragleave', p5fileDragLeave, false);
184
+
185
+ // Setup upload drag & drop
186
+ Q('p13filetable').addEventListener('drop', p13fileDragDrop, false);
187
+ Q('p13filetable').addEventListener('dragover', p13fileDragOver, false);
188
+ Q('p13filetable').addEventListener('dragleave', p13fileDragLeave, false);
189
+
190
+ // Timeline update interval
191
+ setInterval(updateDeviceTimeline, 120000); // Check every 2 minutes
192
+
193
+ // Load desktop settings
194
+ var t = localStorage.getItem('desktopsettings');
195
+ if (t != null) { desktopsettings = JSON.parse(t); }
196
+ t = localStorage.getItem('multidesktopsettings');
197
+ if (t != null) { multidesktopsettings = JSON.parse(t); }
198
+ applyDesktopSettings();
199
+
200
+ // Terminal special keys
201
+ var x = '';
202
+ for (var c = 1; c < 27; c++) x += '<option value=\'' + c + '\'>' + "Ctrl" + '-' + String.fromCharCode(64 + c) + ' (' + c + ')</option>';
203
+ QH('specialkeylist', x);
204
+
205
+ // Setup server stats panels
206
+ setupGeneralServerStats();
207
+ setupServerTimelineStats();
208
+
209
+ // Setup the user interface in the right mode
210
+ userInterfaceSelectMenu();
211
+
212
+ // If SSPI or LDAP authentication not used, allow batch account creation.
213
+ QV('p4UserBatchCreate', (features & 0x00080000) == 0);
214
+ }
215
+
216
+ // Toggle the web page to full screen
217
+ function toggleAspectRatio(toggle) {
218
+ if (toggle === 1) { deskAspectRatio = ((deskAspectRatio + 1) % 3); putstore('deskAspectRatio', deskAspectRatio); }
219
+ deskAdjust();
220
+ }
221
+
222
+ // If FullScreen, toggle menu to be horisontal or vertical
223
+ function toggleStackMenu(toggle) {
224
+ if (webPageFullScreen == true) {
225
+ if (toggle === 1) {
226
+ webPageStackMenu = !webPageStackMenu;
227
+ putstore('webPageStackMenu', webPageStackMenu);
228
+ }
229
+ if (webPageStackMenu == false) {
230
+ QC('body').remove('menu_stack');
231
+ } else {
232
+ QC('body').add('menu_stack');
233
+ if (xxcurrentView >= 10) QC('column_l').remove('room4submenu');
234
+ }
235
+ deskAdjust();
236
+ }
237
+ }
238
+
239
+ // Toggle user interface menu
240
+ function showUserInterfaceSelectMenu() {
241
+ Q('uiViewButton1').classList.remove('uiSelectorSel');
242
+ Q('uiViewButton2').classList.remove('uiSelectorSel');
243
+ Q('uiViewButton3').classList.remove('uiSelectorSel');
244
+ Q('uiViewButton4').classList.remove('uiSelectorSel');
245
+ try { Q('uiViewButton' + uiMode).classList.add('uiSelectorSel'); } catch (ex) { }
246
+ QV('uiMenu', (QS('uiMenu').display == 'none'));
247
+ //Q('uiViewButton1').focus();
248
+ if (nightMode) { Q('uiViewButton4').classList.add('uiSelectorSel'); }
249
+ }
250
+
251
+ function userInterfaceSelectMenu(s) {
252
+ if (s) { uiMode = s; putstore('uiMode', uiMode); }
253
+ webPageFullScreen = (uiMode < 3);
254
+ webPageStackMenu = (uiMode > 1);
255
+ toggleFullScreen(0);
256
+ toggleStackMenu(0);
257
+ if (webPageStackMenu && (xxcurrentView >= 10)) { QC('column_l').add('room4submenu'); } else { QC('column_l').remove('room4submenu'); }
258
+ }
259
+
260
+ function toggleNightMode() {
261
+ nightMode = !nightMode;
262
+ if (nightMode) { QC('body').add('night'); } else { QC('body').remove('night'); }
263
+ putstore('_nightMode', nightMode?'1':'0');
264
+ }
265
+
266
+ // Toggle the web page to full screen
267
+ function toggleFullScreen(toggle) {
268
+ if (toggle === 1) { webPageFullScreen = !webPageFullScreen; putstore('webPageFullScreen', webPageFullScreen); }
269
+ var hide = 0;
270
+ if (args.hide) { hide = parseInt(args.hide); }
271
+ if (webPageFullScreen == false) {
272
+ QC('body').remove('menu_stack');
273
+ QC('body').remove('fullscreen');
274
+ QC('body').remove('arg_hide');
275
+ if (xxcurrentView >= 10) QC('column_l').add('room4submenu');
276
+ QV('UserDummyMenuSpan', false);
277
+ //QV('page_leftbar', false);
278
+ } else {
279
+ QC('body').add('fullscreen');
280
+ if (hide & 16) QC('body').add('arg_hide'); // This is replacement for QV('page_leftbar', !(hide & 16));
281
+ QV('page_leftbar', !(hide & 16));
282
+ QV('MainMenuSpan', !(hide & 16));
283
+ if (xxcurrentView >= 10) QC('column_l').remove('room4submenu');
284
+ QV('UserDummyMenuSpan', (xxcurrentView < 10) && webPageFullScreen);
285
+ }
286
+ masterUpdate(512);
287
+ QV('body', true);
288
+ }
289
+
290
+ function getNodeFromId(id) { if (nodes != null) { for (var i in nodes) { if (nodes[i]._id == id) return nodes[i]; } } return null; }
291
+ function reload() {
292
+ var x = window.location.href;
293
+ if (x.endsWith('/#')) { x = x.substring(0, x.length - 2); }
294
+ window.location.href = x;
295
+ }
296
+
297
+ function onStateChanged(server, state, prevState, errorCode) {
298
+ if (state == 0) {
299
+ // Control web socket disconnected
300
+ setDialogMode(0); // Close any dialog boxes if present
301
+ go(0); // Go to disconnection panel
302
+
303
+ // Clean up
304
+ powerTimeline = null;
305
+ powerTimelineReq = null;
306
+ powerTimelineNode = null;
307
+ powerTimelineUpdate = null;
308
+ deleteAllNotifications(); // Close and clear notifications if present
309
+ hideContextMenu(); // Hide the context menu if present
310
+ QV('verifyEmailId2', false);
311
+ QV('logoutControl', false);
312
+ if (errorCode == 'noauth') { QH('p0span', "Unable to perform authentication"); return; }
313
+ if (prevState == 2) { if (autoReconnect) { setTimeout(serverPoll, 5000); } } else { QH('p0span', "Unable to connect web socket"); }
314
+ if (authCookieRenewTimer != null) { clearInterval(authCookieRenewTimer); authCookieRenewTimer = null; }
315
+ } else if (state == 2) {
316
+ // Fetch list of meshes, nodes, files
317
+ meshserver.send({ action: 'meshes' });
318
+ meshserver.send({ action: 'nodes', id: '{{currentNode}}' });
319
+ if (pluginHandler != null) { meshserver.send({ action: 'plugins' }); }
320
+ if ('{{currentNode}}' == '') { meshserver.send({ action: 'files' }); }
321
+ if ('{{viewmode}}' == '') { go(1); }
322
+ authCookieRenewTimer = setInterval(function () { meshserver.send({ action: 'authcookie' }); }, 1800000); // Request a cookie refresh every 30 minutes.
323
+ }
324
+ }
325
+
326
+ // Poll the server, if it responds, refresh the page.
327
+ function serverPoll() {
328
+ var xdr = null;
329
+ try { xdr = new XDomainRequest(); } catch (e) { }
330
+ if (!xdr) xdr = new XMLHttpRequest();
331
+ xdr.open('HEAD', window.location.href);
332
+ xdr.timeout = 15000;
333
+ xdr.onload = function () { reload(); };
334
+ xdr.onerror = xdr.ontimeout = function () { setTimeout(serverPoll, 10000); };
335
+ xdr.send();
336
+ }
337
+
338
+ // Return true if this browser supports clickonce
339
+ function detectClickOnce() {
340
+ for (var i in window.navigator.mimeTypes) { if (window.navigator.mimeTypes[i].type == 'application/x-ms-application') { return true; } }
341
+ var userAgent = window.navigator.userAgent.toUpperCase();
342
+ return (userAgent.indexOf('.NET CLR 3.5') >= 0) || (userAgent.indexOf('(WINDOWS NT ') >= 0);
343
+ }
344
+
345
+ function updateSiteAdmin() {
346
+ var noServerBackup = '{{{noServerBackup}}}';
347
+ var siteRights = userinfo.siteadmin;
348
+ if (noServerBackup == 1) { siteRights &= 0xFFFFFFFA; } // If not server backups allowed, remove server backup and restore permissions
349
+
350
+ // Update account actions
351
+ QV('p2AccountSecurity', ((features & 4) == 0) && (serverinfo.domainauth == false) && ((features & 4096) != 0)); // Hide Account Security if in single user mode, domain authentication to 2 factor auth not supported.
352
+ QV('p2AccountActions', ((features & 4) == 0) && (serverinfo.domainauth == false)); // Hide Account Actions if in single user mode or domain authentication
353
+ QV('p2AccountImage', ((features & 4) == 0) && (serverinfo.domainauth == false)); // If account actions are not visible, also remove the image on that panel
354
+ QV('p2ServerActions', siteRights & 21);
355
+ QV('LeftMenuMyServer', siteRights & 21); // 16 + 4 + 1
356
+ QV('MainMenuMyServer', siteRights & 21);
357
+ QV('p2ServerActionsBackup', siteRights & 1);
358
+ QV('p2ServerActionsRestore', siteRights & 4);
359
+ QV('p2ServerActionsVersion', siteRights & 16);
360
+ QV('MainMenuMyFiles', siteRights & 8);
361
+ QV('LeftMenuMyFiles', siteRights & 8);
362
+ if (((siteRights & 8) == 0) && (xxcurrentView == 5)) { setDialogMode(0); go(1); }
363
+ if (currentNode != null) { gotoDevice(currentNode._id, xxcurrentView, true); }
364
+
365
+ // Update user management state
366
+ if ((userinfo.siteadmin & 2) != 0)
367
+ {
368
+ // We are user administrator
369
+ if (users == null) { meshserver.send({ action: 'users' }); }
370
+ if (wssessions == null) { meshserver.send({ action: 'wssessioncount' }); }
371
+ } else {
372
+ // We are not user administrator
373
+ users = null;
374
+ wssessions = null;
375
+ updateUsers();
376
+ if (xxcurrentView == 4 || ((xxcurrentView >= 30) && (xxcurrentView < 40))) { setDialogMode(0); go(1); currentUser = null; }
377
+ }
378
+ meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value) });
379
+ QV('ServerConsole', userinfo.siteadmin === 0xFFFFFFFF);
380
+ QV('ServerTrace', userinfo.siteadmin === 0xFFFFFFFF);
381
+ if ((xxcurrentView == 115) && (userinfo.siteadmin != 0xFFFFFFFF)) { go(6); }
382
+ if ((xxcurrentView == 6) && ((userinfo.siteadmin & 21) == 0)) { go(1); }
383
+
384
+ // If we are site administrator, register to get server statistics
385
+ if ((siteRights & 21) != 0) { meshserver.send({ action: 'serverstats', interval: 10000 }); }
386
+ }
387
+
388
+ // To boost the speed of the web page when even floods occur, this method perform a delayed update on the web page.
389
+ var updateNaggleTimer = null;
390
+ var updateNaggleFlags = 0;
391
+ function masterUpdate(flags) {
392
+ updateNaggleFlags |= flags;
393
+ if (updateNaggleTimer == null) {
394
+ updateNaggleTimer = setTimeout(function () {
395
+ if (updateNaggleFlags & 512) { center(); }
396
+ if (updateNaggleFlags & 1) { onSearchInputChanged(); }
397
+ if (updateNaggleFlags & 2) { onSortSelectChange(false); }
398
+ if (updateNaggleFlags & 128) { updateMeshes(); }
399
+ if (updateNaggleFlags & 4) { updateDevices(); }
400
+ if (updateNaggleFlags & 8) { drawNotifications(); }
401
+ if (updateNaggleFlags & 16) { updateMapMarkers(); }
402
+ if (updateNaggleFlags & 32) { eventsUpdate(); }
403
+ if (updateNaggleFlags & 64) { refreshMap(false, true); }
404
+ if (updateNaggleFlags & 256) { drawDeviceTimeline(); }
405
+ if (updateNaggleFlags & 1024) { deviceEventsUpdate(); }
406
+ if (updateNaggleFlags & 2048) { userEventsUpdate(); }
407
+ if (updateNaggleFlags & 4096) { p20updateMesh(); }
408
+ updateNaggleTimer = null;
409
+ updateNaggleFlags = 0;
410
+ }, 150);
411
+ }
412
+ }
413
+
414
+ var backupCodesWarningDone = false;
415
+ function updateSelf() {
416
+ QV('verifyEmailId', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
417
+ QV('verifyEmailId2', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
418
+ QV('manageOtp', (userinfo.otpsecret == 1) || (userinfo.otphkeys > 0));
419
+ QV('authAppSetupCheck', userinfo.otpsecret == 1);
420
+ QV('authKeySetupCheck', userinfo.otphkeys > 0);
421
+ QV('authCodesSetupCheck', userinfo.otpkeys > 0);
422
+ masterUpdate(4 + 128 + 4096);
423
+
424
+ // Check if backup codes should really be enabled
425
+ if ((backupCodesWarningDone == false) && !(userinfo.otpkeys > 0) && (((userinfo.otpsecret == 1) && !(userinfo.otphkeys > 0)) || ((userinfo.otpsecret != 1) && (userinfo.otphkeys == 1)))) {
426
+ var n = { text: "Please add two-factor backup codes. If the current factor is lost, there is not way to recover this account.", title: "Two factor authentication" };
427
+ addNotification(n);
428
+ backupCodesWarningDone = true;
429
+ }
430
+
431
+ // If we can't create new groups, hide all links that can do that.
432
+ var newGroupsAllowed = ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 64) == 0));
433
+ QV('p2createMeshLink1', newGroupsAllowed);
434
+ QV('p2createMeshLink2', newGroupsAllowed);
435
+ QV('getStarted1', newGroupsAllowed);
436
+ QV('getStarted2', !newGroupsAllowed);
437
+
438
+ if (typeof userinfo.passchange == 'number') {
439
+ if (userinfo.passchange == -1) { QH('p2nextPasswordUpdateTime', " - Reset on next login."); }
440
+ else if ((passRequirements != null) && (typeof passRequirements.reset == 'number')) {
441
+ var seconds = (userinfo.passchange) + (passRequirements.reset * 86400) - Math.floor(Date.now() / 1000);
442
+ if (seconds < 0) { QH('p2nextPasswordUpdateTime', " - Reset on next login."); }
443
+ else if (seconds < 3600) { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} minute{1}.", Math.floor(seconds / 60), addLetterS(Math.floor(seconds / 60)))); }
444
+ else if (seconds < 86400) { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} hour{1}.", Math.floor(seconds / 3600), addLetterS(Math.floor(seconds / 3600)))); }
445
+ else { QH('p2nextPasswordUpdateTime', format(" - Reset v {0} den{1}."), Math.floor(seconds / 86400), addLetterS(Math.floor(seconds / 86400))); }
446
+ }
447
+ }
448
+ }
449
+
450
+ function addLetterS(x) { return (x > 1) ? 's' : ''; }
451
+ function setSessionActivity() { sessionActivity = Date.now(); QH('idleTimeoutNotify', ''); }
452
+ function checkIdleSessionTimeout() {
453
+ var delta = (Date.now() - sessionActivity);
454
+ if (delta > serverinfo.timeout) { window.location.href = 'logout'; } else {
455
+ var ds = Math.round((serverinfo.timeout - delta) / 1000);
456
+ if (ds <= 60) {
457
+ QH('idleTimeoutNotify', '<br />' + format("{0} sekund{1} do odpojení", ds, addLetterS(ds)));
458
+ } else {
459
+ ds = Math.round(ds / 60);
460
+ if (ds <= 5) { QH('idleTimeoutNotify', '<br />' + format("{0} minute{1} until disconnect", ds, addLetterS(ds))); }
461
+ }
462
+ }
463
+ }
464
+
465
+ function onMessage(server, message) {
466
+ switch (message.action) {
467
+ case 'trace': {
468
+ serverTrace.unshift(message);
469
+ displayServerTrace();
470
+ break;
471
+ }
472
+ case 'traceinfo': {
473
+ if (typeof message.traceSources == 'object') {
474
+ if ((message.traceSources != null) && (message.traceSources.length > 0)) {
475
+ serverTraceSources = message.traceSources;
476
+ QH('p41traceStatus', EscapeHtml(message.traceSources.join(', ')));
477
+ } else {
478
+ serverTraceSources = [];
479
+ QH('p41traceStatus', "Nic");
480
+ }
481
+ }
482
+ break;
483
+ }
484
+ case 'serverstats': {
485
+ updateGeneralServerStats(message);
486
+ break;
487
+ }
488
+ case 'serverwarnings': {
489
+ if ((message.warnings != null) && (message.warnings.length > 0)) {
490
+ var x = '';
491
+ for (var i in message.warnings) { x += '<div style=color:red;padding-bottom:6px><b>' + "WARNING: " + message.warnings[i] + '</b></div>'; }
492
+ QH('serverWarnings', x);
493
+ QV('serverWarningsDiv', true);
494
+ }
495
+ break;
496
+ }
497
+ case 'servertimelinestats': {
498
+ setServerTimelineStats(message.events);
499
+ break;
500
+ }
501
+ case 'authcookie': {
502
+ // Got an authentication cookie refresh
503
+ authCookie = message.cookie;
504
+ authRelayCookie = message.rcookie;
505
+ break;
506
+ }
507
+ case 'serverinfo': {
508
+ serverinfo = message.serverinfo;
509
+ if (serverinfo.timeout) { setInterval(checkIdleSessionTimeout, 10000); checkIdleSessionTimeout(); }
510
+ if (debugmode == 1) { console.log('Server time: ', printDateTime(new Date(serverinfo.serverTime))); }
511
+ break;
512
+ }
513
+ case 'userinfo': {
514
+ userinfo = message.userinfo;
515
+ updateSiteAdmin();
516
+ updateSelf();
517
+ break;
518
+ }
519
+ case 'users': {
520
+ users = {};
521
+ for (var m in message.users) { users[message.users[m]._id] = message.users[m]; }
522
+ updateUsers();
523
+ break;
524
+ }
525
+ case 'wssessioncount': {
526
+ wssessions = message.wssessions;
527
+ updateUsers();
528
+ break;
529
+ }
530
+ case 'meshes': {
531
+ meshes = {};
532
+ for (var m in message.meshes) { meshes[message.meshes[m]._id] = message.meshes[m]; }
533
+ masterUpdate(4 + 128);
534
+ break;
535
+ }
536
+ case 'files': {
537
+ filetree = setupBackPointers(message.filetree);
538
+ updateFiles();
539
+ d3updatefiles();
540
+ break;
541
+ }
542
+ case 'nodes': {
543
+ nodes = [];
544
+ for (var m in message.nodes) {
545
+ if (!meshes[m]) { console.log('Invalid mesh (1): ' + m); continue; }
546
+ for (var n in message.nodes[m]) {
547
+ if (message.nodes[m][n]._id == null) { console.log('Invalid node (' + n + '): ' + JSON.stringify(message.nodes)); continue; }
548
+ message.nodes[m][n].namel = message.nodes[m][n].name.toLowerCase();
549
+ 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; }
550
+ message.nodes[m][n].meshnamel = meshes[m].name.toLowerCase();
551
+ message.nodes[m][n].meshid = m;
552
+ message.nodes[m][n].state = (message.nodes[m][n].state)?(message.nodes[m][n].state):0;
553
+ message.nodes[m][n].desc = message.nodes[m][n].desc;
554
+ message.nodes[m][n].ip = message.nodes[m][n].ip;
555
+ if (!message.nodes[m][n].icon) message.nodes[m][n].icon = 1;
556
+ message.nodes[m][n].ident = ++nodeShortIdent;
557
+ nodes.push(message.nodes[m][n]);
558
+ }
559
+ }
560
+ masterUpdate(1 | 2 | 4 | 64);
561
+
562
+ if (xxcurrentView == -1) { if ('{{viewmode}}' != '') { go(parseInt('{{viewmode}}')); } else { setDialogMode(0); go(1); } }
563
+ if ('{{currentNode}}' != '') { gotoDevice('{{currentNode}}',parseInt('{{viewmode}}'));}
564
+ break;
565
+ }
566
+ case 'powertimeline': {
567
+ if (message.nodeid != powerTimelineReq) break;
568
+ powerTimelineNode = message.nodeid;
569
+ powerTimeline = message.timeline;
570
+ powerTimelineUpdate = Date.now() + 300000; // Update every 5 minutes
571
+ for (var i in powerTimeline) { if (i % 2 == 1) { powerTimeline[i] = powerTimeline[i] * 1000; } } // Decompress time
572
+ if (currentNode._id == message.nodeid) { masterUpdate(256); }
573
+ break;
574
+ }
575
+ case 'getsysinfo': {
576
+ if (message.nodeid != powerTimelineReq) break;
577
+ //console.log('getsysinfo', message); // ***********************
578
+ if (message.noinfo === true) {
579
+ QH('p17info', "No information for this device.");
580
+ } else {
581
+ var x = '', s = {};
582
+ if (message.hardware) {
583
+ if (message.hardware.identifiers) {
584
+ var ident = message.hardware.identifiers;
585
+ // BIOS
586
+ x += '<div class=DevSt style=margin-bottom:3px><b>' + "BIOS" + '</b></div>';
587
+ if (ident.bios_vendor) { x += addDetailItem("Vendor", ident.bios_vendor, s); }
588
+ if (ident.bios_version) { x += addDetailItem("Version", ident.bios_version, s); }
589
+ x += '<br />';
590
+
591
+ // Motherboard
592
+ x += '<div class=DevSt style=margin-bottom:3px><b>' + "Motherboard" + '</b></div>';
593
+ if (ident.board_vendor) { x += addDetailItem("Vendor", ident.board_vendor, s); }
594
+ if (ident.board_name) { x += addDetailItem("Jméno", ident.board_name, s); }
595
+ if (ident.board_serial && (ident.board_serial != '')) { x += addDetailItem("Serial", ident.board_serial, s); }
596
+ if (ident.board_version) { x += addDetailItem("Version", ident.board_version, s); }
597
+ if (ident.product_uuid) { x += addDetailItem("Identifier", ident.product_uuid, s); }
598
+ x += '<br />';
599
+ }
600
+
601
+ if (message.hardware.windows) {
602
+ if (message.hardware.windows.memory) {
603
+ // Memory
604
+ x += '<div class=DevSt style=margin-bottom:3px><b>' + "Paměť" + '</b></div>';
605
+
606
+ // Sort Memory
607
+ function memorySort(a, b) { if (a.BankLabel > b.BankLabel) return 1; if (a.BankLabel < b.BankLabel) return -1; return 0; }
608
+ message.hardware.windows.memory.sort(memorySort);
609
+
610
+ x += '<table style=width:100%>';
611
+ for (var i in message.hardware.windows.memory) {
612
+ var m = message.hardware.windows.memory[i];
613
+ x += '<tr><td VALIGN=Top style=width:38px><img src="images/ram2.png" />'
614
+ x += '<td><div style=background-color:lightgray;border-radius:5px;padding:8px>';
615
+ x += '<div><b>' + m.BankLabel + '</b></div>';
616
+ if (m.Capacity) { x += addDetailItem("Capacity / Speed", format("{0} Mb, {1} Mhz", (m.Capacity / 1024 / 1024), m.Speed), s); }
617
+ if (m.PartNumber) { x += addDetailItem("Part Number", ((m.Manufacturer && m.Manufacturer != 'Undefined')?(m.Manufacturer + ', '):'') + m.PartNumber, s); }
618
+ x += '</div>';
619
+ }
620
+ x += '</table><br />';
621
+ }
622
+
623
+ if (message.hardware.windows.osinfo) {
624
+ // Operating System
625
+ var m = message.hardware.windows.osinfo;
626
+ x += '<div class=DevSt style=margin-bottom:3px><b>' + "Operační systém" + '</b></div>';
627
+ if (m.Caption) { x += addDetailItem("Jméno", m.Caption, s); }
628
+ if (m.Version) { x += addDetailItem("Version", m.Version, s); }
629
+ if (m.OSArchitecture) { x += addDetailItem("Architektura", m.OSArchitecture, s); }
630
+ x += '<br />';
631
+ }
632
+
633
+ // Disks
634
+ //x += '<div class=DevSt style=margin-bottom:3px><b>Disks</b></div>';
635
+ //x += '<br />';
636
+ }
637
+ }
638
+
639
+ QH('p17info', x);
640
+ }
641
+ break;
642
+ }
643
+ case 'lastconnect': {
644
+ var node = getNodeFromId(message.nodeid);
645
+ if (node != null) {
646
+ node.lastconnect = message.time;
647
+ node.lastaddr = message.addr;
648
+ if ((currentNode._id == node._id) && (Q('MainComputerState').innerHTML == '')) {
649
+ QH('MainComputerState', '<span>' + "Naposledy spatřen:" + '<br />' + printDateTime(new Date(node.lastconnect)) + '</span>');
650
+ }
651
+ }
652
+ break;
653
+ }
654
+ case 'msg': {
655
+ // Check if this is a message from a node
656
+ if (message.nodeid != null) {
657
+ var index = -1;
658
+ if (nodes != null) { for (var i in nodes) { if (nodes[i]._id == message.nodeid) { index = i; break; } } }
659
+ if (index != -1) {
660
+ // Node was found, dispatch the message
661
+ if (message.type == 'console') { p15consoleReceive(nodes[index], message.value, message.source); } // This is a console message.
662
+ else if (message.type == 'notify') { // This is a notification message.
663
+ var n = getstore('notifications', 0);
664
+ if (((n & 8) == 0) && (message.amtMessage != null)) { break; } // Intel AMT desktop & terminal messages should be ignored.
665
+ var n = { text: message.value, title: message.title, icon: message.icon };
666
+ if (message.nodeid != null) { n.nodeid = message.nodeid; }
667
+ if (message.tag != null) { n.tag = message.tag; }
668
+ if (message.username != null) { n.username = message.username; }
669
+ addNotification(n);
670
+ } else if (message.type == 'ps') {
671
+ showDeskToolsProcesses(message);
672
+ } else if (message.type == 'services') {
673
+ showDeskToolsServices(message);
674
+ } else if ((message.type == 'getclip') && (xxdialogTag == 'clipboard') && (currentNode != null) && (currentNode._id == message.nodeid)) {
675
+ Q('d2clipText').value = message.data;
676
+ } else if ((message.type == 'setclip') && (xxdialogTag == 'clipboard') && (currentNode != null) && (currentNode._id == message.nodeid)) {
677
+ // Display success/fail on the clipboard dialog box.
678
+ QH('dlgClipStatus', message.success ? '<span style=color:green>' + "Úspěch" + '</span>' : '<span style=color:red>' + "Selhalo" + '</span>')
679
+ setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000);
680
+ }
681
+ }
682
+ } else {
683
+ if (message.type == 'notify') { // This is a notification message.
684
+ var n = { text: message.value, title: message.title, icon: message.icon };
685
+ if (message.tag != null) { n.tag = message.tag; }
686
+ if (message.username != null) { n.username = message.username; }
687
+ addNotification(n);
688
+ }
689
+ }
690
+ break;
691
+ }
692
+ case 'getnetworkinfo': {
693
+ if ((currentNode._id == message.nodeid) && (xxdialogMode == 2) && (xxdialogTag == 'if' + message.nodeid)) {
694
+ if (message.netif == null) {
695
+ QH('d2netinfo', "No network interface information available for this device.");
696
+ } else {
697
+ var x = '<div class=dialogText>';
698
+
699
+ if (currentNode.lastconnect) { x += addHtmlValue2("Last agent connection", printDateTime(new Date(currentNode.lastconnect))); }
700
+ if (currentNode.lastaddr) {
701
+ var splitip = currentNode.lastaddr.split(':');
702
+ if (splitip.length > 2) {
703
+ // IPv6
704
+ x += addHtmlValue2("Poslední adresa agenta", currentNode.lastaddr + ' <img src="images/link4.png" title="Copy address to clipboard" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(currentNode.lastaddr) + '\") width=10 height=10>');
705
+ } else {
706
+ // IPv4
707
+ if (isPrivateIP(currentNode.lastaddr)) {
708
+ x += addHtmlValue2("Poslední adresa agenta", splitip[0] + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(splitip[0]) + '\") width=10 height=10>');
709
+ } else {
710
+ x += addHtmlValue2("Poslední adresa agenta", '<a href="https://iplocation.com/?ip=' + splitip[0] + '" rel="noreferrer noopener" target="MeshIPLoopup">' + splitip[0] + '</a> <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(splitip[0]) + '\") width=10 height=10>');
711
+ }
712
+ }
713
+ }
714
+
715
+ x += addHtmlValue2("Poslední změna rozhraní", printDateTime(new Date(message.updateTime)));
716
+ for (var i in message.netif) {
717
+ var net = message.netif[i];
718
+ x += '<hr />'
719
+ if (net.name) { x += addHtmlValue2("Jméno", '<b>' + EscapeHtml(net.name) + '</b>'); }
720
+ if (net.desc) { x += addHtmlValue2("Popis", EscapeHtml(net.desc).replace('(R)', '®').replace('(r)', '®')); }
721
+ if (net.dnssuffix) { x += addHtmlValue2("DNS suffix", EscapeHtml(net.dnssuffix) + ' <img src="images/link4.png" title="' + "Zkopírovat jméno do schránky" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.dnssuffix) + '\") width=10 height=10>'); }
722
+ if (net.mac) { x += addHtmlValue2("MAC adresa", '<a href="https://dnslytics.com/mac-address-lookup/' + net.mac.substring(0, 6) + '" rel="noreferrer noopener" target="MeshMACLoopup">' + EscapeHtml(net.mac.toLowerCase()) + '</a> <img src="images/link4.png" title="' + "Kopírovat MAC adresu do schránky" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.mac.toLowerCase()) + '\") width=10 height=10>'); }
723
+ if (net.v4addr) { x += addHtmlValue2("IPv4 address", EscapeHtml(net.v4addr) + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4addr) + '\") width=10 height=10>'); }
724
+ if (net.v4mask) { x += addHtmlValue2("IPv4 mask", EscapeHtml(net.v4mask) + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4mask) + '\") width=10 height=10>'); }
725
+ if (net.v4gateway) { x += addHtmlValue2("IPv4 gateway", EscapeHtml(net.v4gateway) + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4gateway) + '\") width=10 height=10>'); }
726
+ if (net.gatewaymac) { x += addHtmlValue2("MAC brány", '<a href="https://dnslytics.com/mac-address-lookup/' + net.gatewaymac.substring(0, 6) + '" rel="noreferrer noopener" target="MeshMACLoopup">' + EscapeHtml(net.gatewaymac.toLowerCase()) + '</a> <img src="images/link4.png" title="' + "Kopírovat MAC adresu do schránky" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.gatewaymac.toLowerCase()) + '\") width=10 height=10>'); }
727
+ }
728
+ x += '</div>';
729
+ QH('d2netinfo', x);
730
+ }
731
+ }
732
+ break;
733
+ }
734
+ case 'serverversion': {
735
+ if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerUpdate')) {
736
+ var x = '<div class=dialogText>';
737
+ if (!message.current) { message.current = "Unknown"; }
738
+ if (!message.latest) { message.latest = "Unknown"; }
739
+ x += addHtmlValue2("Current Version", '<b>' + EscapeHtml(message.current) + '</b>');
740
+ x += addHtmlValue2("Latest Version", '<b>' + EscapeHtml(message.latest) + '</b>');
741
+ x += '</div>';
742
+ if ((message.latest.indexOf('.') == -1) || (message.current == message.latest) || ((features & 2048) == 0)) {
743
+ setDialogMode(2, "MeshCentral Version", 1, null, x);
744
+ } else {
745
+ setDialogMode(2, "MeshCentral Version", 3, server_showVersionDlgEx, x + '<br /><label><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> ' + "Check and click OK to start server self-update." + '</label>');
746
+ server_showVersionDlgUpdate();
747
+ }
748
+ }
749
+ break;
750
+ }
751
+ case 'servererrors': {
752
+ if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerErrors')) {
753
+ if (message.data == null) {
754
+ setDialogMode(2, "MeshCentral Server Errors", 1, null, "Server has no error log.");
755
+ } else {
756
+ var x = '<div class="dialogText dialogTextLog"><pre id=d2ServerErrorsLogPre>' + message.data + '<pre></div>';
757
+ setDialogMode(2, "MeshCentral Server Errors", 3, server_showErrorsDlgEx, x + '<br /><div style=float:right><img src=images/link4.png height=10 width=10 title="' + "Download error log" + '" style=cursor:pointer onclick=d2CopyServerErrorsToClip()></div><div><label><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> ' + "Check and click OK to clear error log." + '</label></div>');
758
+ server_showVersionDlgUpdate();
759
+ }
760
+ }
761
+ break;
762
+ }
763
+ case 'serverconsole': {
764
+ p15consoleReceive('serverconsole', message.value);
765
+ break;
766
+ }
767
+ case 'events': {
768
+ if ((message.nodeid != null) && (message.nodeid == currentNode._id)) {
769
+ currentDeviceEvents = message.events;
770
+ masterUpdate(1024);
771
+ } else if ((message.user != null) && (message.user == currentUser.name)) {
772
+ currentUserEvents = message.events;
773
+ masterUpdate(2048);
774
+ } else {
775
+ events = message.events;
776
+ masterUpdate(32);
777
+ }
778
+ break;
779
+ }
780
+ case 'getcookie': {
781
+ if (message.tag == 'clickonce') {
782
+ var basicPort = '{{{serverRedirPort}}}' == '' ? '{{{serverPublicPort}}}' : '{{{serverRedirPort}}}';
783
+ 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');
784
+ var newWindow = window.open(rdpurl, '_blank');
785
+ newWindow.opener = null;
786
+ }
787
+ break;
788
+ }
789
+ case 'getNotes': {
790
+ var n = Q('d2devNotes');
791
+ if (n && (message.id == decodeURIComponent(n.attributes['noteid'].value))) {
792
+ if (message.notes) { QH('d2devNotes', decodeURIComponent(message.notes)); } else { QH('d2devNotes', ''); }
793
+ var ro = (n.attributes['ro'].value == 'true');
794
+ if (ro == false) { // If we have permissions, set read/write on this note.
795
+ n.removeAttribute('readonly');
796
+ QE('idx_dlgOkButton', true);
797
+ QV('idx_dlgOkButton', true);
798
+ focusTextBox('d2devNotes');
799
+ }
800
+ }
801
+ break;
802
+ }
803
+ case 'otpauth-request': {
804
+ if ((xxdialogMode == 2) && (xxdialogTag == 'otpauth-request')) {
805
+ var secret = message.secret;
806
+ if (secret.length == 52) { secret = secret.split(/(.............)/).filter(Boolean).join(' '); }
807
+ else if (secret.length == 32) { secret = secret.split(/(....)/).filter(Boolean).join(' '); secret = secret.substring(0, 20) + '<br/>' + secret.substring(20) }
808
+ 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>');
809
+ new QRCode(Q('qrcode'), { text: message.url, width: 128, height: 128, colorDark: '#000000', colorLight: '#EEE', correctLevel: QRCode.CorrectLevel.H });
810
+ QV('idx_dlgOkButton', true);
811
+ QE('idx_dlgOkButton', false);
812
+ Q('d2otpauthinput').focus();
813
+ }
814
+ break;
815
+ }
816
+ case 'otpauth-setup': {
817
+ if (xxdialogMode) return;
818
+ setDialogMode(2, "Authenticator App", 1, null, message.success ? ('<b style=color:green>' + "Authenticator app 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."));
819
+ break;
820
+ }
821
+ case 'otpauth-clear': {
822
+ if (xxdialogMode) return;
823
+ setDialogMode(2, "Authenticator App", 1, null, message.success ? ('<b>' + "Authenticator application removed." + '</b> ' + "You can reactivate this feature at any time.") : ('<b style=color:red>' + "2-step login activation removal failed." + '</b> ' + "Zkusit znovu."));
824
+ break;
825
+ }
826
+ case 'otpauth-getpasswords': {
827
+ if (xxdialogMode) return;
828
+ var x = "One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";
829
+ x += '<div style="border-radius:6px;border: 2px dashed #888;width:100%;margin-top:8px"><div style="padding:8px;font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold"><table class=selecttext style=width:100%;text-align:center>';
830
+ if (message.passwords) {
831
+ var j = 0, clipb = '';
832
+ for (var i in message.passwords) {
833
+ if (++j % 2) { x += '<tr>'; }
834
+ var p = '' + message.passwords[i].p;
835
+ while (p.length < 8) { p = '0' + p; }
836
+ if (message.passwords[i].u === true) {
837
+ x += '<td>' + p.substring(0, 4) + ' ' + p.substring(4);
838
+ if (clipb != '') { clipb += ' '; }
839
+ clipb += p;
840
+ } else {
841
+ x += '<td><strike style=color:#BBB>' + p.substring(0, 4) + ' ' + p.substring(4); + '</strike>';
842
+ }
843
+ }
844
+ } else {
845
+ x += '<tr><td>' + "No Active Tokens";
846
+ }
847
+ x += '</table></div></div><br />';
848
+ x += '<div><input type=button value=' + "Close" + ' onclick=setDialogMode(0) style=float:right></input>';
849
+ x += '<input type=button value="' + "Generovat nové tokeny" + '" onclick="account_manageOtp(1);"></input>';
850
+ if (message.passwords != null) {
851
+ x += '<input type=button value="' + "Clear Tokens" + '" onclick="account_manageOtp(2);"></input>';
852
+ x += ' <img src=images/link4.png height=10 width=10 title="' + "Copy valid codes to clipboard" + '" style=cursor:pointer onclick=copyTextToClip2("' + encodeURIComponent(clipb) + '")>';
853
+ }
854
+ x += '</div><br />';
855
+ setDialogMode(2, "Manage Backup Codes", 8, null, x, 'otpauth-manage');
856
+ break;
857
+ }
858
+ case 'otp-hkey-get': {
859
+ if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return;
860
+ var start = '<div style="border-radius:6px;border:2px solid #CCC;background-color:#BBB;width:100%;box-sizing:border-box;margin-bottom:6px"><div style="margin:3px;font-family:Arial, Helvetica, sans-serif;font-size:16px;font-weight:bold"><table style=width:100%;text-align:left>';
861
+ var end = '</table></div></div>';
862
+ var x = "<a href=\"https://www.yubico.com/\" rel=\"noreferrer noopener\" target=\"_blank\">Hardware keys</a> are used as secondary login authentication.";
863
+ x += '<div style="max-height:150px;overflow-y:auto;overflow-x:hidden;margin-top:6px;margin-bottom:6px">';
864
+ if (message.keys && message.keys.length > 0) {
865
+ for (var i in message.keys) {
866
+ var key = message.keys[i], type = (key.type == 2)?'OTP':'WebAuthn';
867
+ x += start + '<tr style=margin:5px><td style=width:30px><img width=24 height=18 src="images/hardware-key-' + type + '-24.png" style=margin-top:4px><td style=width:250px>' + key.name + '<td><input type=button value="' + "Odstranit" + '" onclick=account_removehkey(' + key.i + ')></input>' + end;
868
+ }
869
+ } else {
870
+ x += start + '<tr style=text-align:center><td>' + "Žádný klíč není zkonfigurován" + end;
871
+ }
872
+ x += '</div>';
873
+ x += '<div><input type=button value="' + "Close" + '" onclick=setDialogMode(0) style=float:right></input>';
874
+ if ((features & 0x00020000) != 0) { x += '<input id=d2addkey3 type=button value="' + "Add Key" + '" onclick="account_addhkey(3);"></input>'; }
875
+ if ((features & 0x00004000) != 0) { x += '<input id=d2addkey2 type=button value="' + "Add YubiKey® OTP" + '" onclick="account_addhkey(2);"></input>'; }
876
+ x += '</div><br />';
877
+ setDialogMode(2, "Manage Security Keys", 8, null, x, 'otpauth-hardware-manage');
878
+ if (u2fSupported() == false) { QE('d2addkey1', false); }
879
+ break;
880
+ }
881
+ case 'otp-hkey-yubikey-add': {
882
+ if (message.result) {
883
+ meshserver.send({ action: 'otp-hkey-get' }); // Success, ask for the full list of keys.
884
+ } else {
885
+ setDialogMode(2, "Add Security Key", 1, null, '<br />' + "Error, Unable to add key." + '<br /><br />');
886
+ }
887
+ break;
888
+ }
889
+ case 'otp-hkey-setup-response': {
890
+ if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return;
891
+ if (message.result == true) {
892
+ meshserver.send({ action: 'otp-hkey-get' }); // Success, ask for the full list of keys.
893
+ } else {
894
+ setDialogMode(2, "Add Security Key", 1, null, '<br />' + "ERROR: Unable to add key." + '<br /><br />', 'otpauth-hardware-manage');
895
+ }
896
+ break;
897
+ }
898
+ case 'webauthn-startregister': {
899
+ if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return;
900
+ var x = "Press the key button now." + '<br /><br /><div style=width:100%;text-align:center><img width=120 height=117 src="images/hardware-keypress-120.png" /></div><input id=dp1keyname style=display:none value=' + message.name + ' />';
901
+ setDialogMode(2, "Add Security Key", 2, null, x);
902
+
903
+ var publicKey = message.request;
904
+ message.request.challenge = Uint8Array.from(atob(message.request.challenge), function (c) { return c.charCodeAt(0) })
905
+ message.request.user.id = Uint8Array.from(atob(message.request.user.id), function (c) { return c.charCodeAt(0) })
906
+ navigator.credentials.create({ publicKey: publicKey })
907
+ .then(function(newCredentialInfo) {
908
+ // Public key credential
909
+ var r = { rawId: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.rawId))), response: { attestationObject: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.response.attestationObject))), clientDataJSON: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.response.clientDataJSON))) }, type: newCredentialInfo.type };
910
+ meshserver.send({ action: 'webauthn-endregister', response: r });
911
+ setDialogMode(0);
912
+ }, function(error) {
913
+ // Error
914
+ setDialogMode(2, "Add Security Key", 1, null, "ERROR: " + error);
915
+ });
916
+ break;
917
+ }
918
+ case 'event': {
919
+ if (!message.event.nolog) {
920
+ if (currentNode && (message.event.nodeid == currentNode._id)) {
921
+ // If this event has a nodeid and we are looking at this node, update the log in real time.
922
+ currentDeviceEvents.unshift(message.event);
923
+ var eventLimit = parseInt(p16limitdropdown.value);
924
+ while (currentDeviceEvents.length > eventLimit) { currentDeviceEvents.pop(); } // Remove element(s) at the end
925
+ masterUpdate(1024);
926
+ }
927
+
928
+ if (currentUser && (message.event.userid == currentUser._id)) {
929
+ // If this event has a userid and we are looking at this user, update the log in real time.
930
+ currentUserEvents.unshift(message.event);
931
+ var eventLimit = parseInt(p31limitdropdown.value);
932
+ while (currentUserEvents.length > eventLimit) { currentUserEvents.pop(); } // Remove element(s) at the end
933
+ masterUpdate(2048);
934
+ }
935
+
936
+ // Add this event to the master events log.
937
+ events.unshift(message.event);
938
+ var eventLimit = parseInt(p3limitdropdown.value);
939
+ while (events.length > eventLimit) { events.pop(); } // Remove element(s) at the end
940
+ masterUpdate(32);
941
+ }
942
+ if (message.event.noact) break; // Take no action on this event
943
+ switch (message.event.action) {
944
+ case 'userWebState': {
945
+ // New user web state, update the web page as needed
946
+ if (localStorage != null) {
947
+ var oldShowRealNames = localStorage.getItem('showRealNames');
948
+ var oldUiMode = localStorage.getItem('uiMode');
949
+ var oldSort = localStorage.getItem('sort');
950
+ var oldLoctag = localStorage.getItem('loctag');
951
+
952
+ var webstate = JSON.parse(message.event.state);
953
+ for (var i in webstate) { localStorage.setItem(i, webstate[i]); }
954
+
955
+ // Update the web page
956
+ if ((webstate.deskAspectRatio != null) && (webstate.deskAspectRatio != deskAspectRatio)) { deskAspectRatio = webstate.deskAspectRatio; deskAdjust(); }
957
+ if ((webstate.showRealNames != null) && (webstate.showRealNames != oldShowRealNames)) { showRealNames = Q('RealNameCheckBox').checked = (webstate.showRealNames == '1'); masterUpdate(6); }
958
+ if ((webstate.uiMode != null) && (webstate.uiMode != oldUiMode)) { userInterfaceSelectMenu(parseInt(webstate.uiMode)); }
959
+ if ((webstate.sort != null) && (webstate.sort != oldSort)) { document.getElementById('sortselect').selectedIndex = sort = parseInt(webstate.sort); masterUpdate(6); }
960
+ if ((webstate.loctag != null) && (webstate.loctag != oldLoctag)) { if (webstate.loctag != null) { args.locale = webstate.loctag; } else { delete args.locale; } masterUpdate(0xFFFFFFFF); }
961
+ }
962
+ break;
963
+ }
964
+ case 'servertimelinestats': { addServerTimelineStats(message.event.data); break; }
965
+ case 'accountcreate':
966
+ case 'accountchange': {
967
+ // An account was created or changed
968
+ if (userinfo.name == message.event.account.name) {
969
+ var newsiteadmin = message.event.account.siteadmin?message.event.account.siteadmin:0;
970
+ var oldsiteadmin = userinfo.siteadmin?userinfo.siteadmin:0;
971
+ if ((message.event.account.quota != userinfo.quota) || (((userinfo.siteadmin & 8) == 0) && ((message.event.account.siteadmin & 8) != 0))) { meshserver.send({ action: 'files' }); }
972
+ var oldgroups = userinfo.groups;
973
+ userinfo = message.event.account;
974
+ if (oldsiteadmin != newsiteadmin) updateSiteAdmin();
975
+ updateSelf();
976
+
977
+ if ((userinfo.siteadmin & 2) != 0) {
978
+ // Compare our groups
979
+ var og = oldgroups ? oldgroups : [];
980
+ var ng = userinfo.groups ? userinfo.groups : [];
981
+ if (og.join(',') != ng.join(',')) {
982
+ // Our groups have changed, re-ask for a list of users.
983
+ users = wssessions = null;
984
+ meshserver.send({ action: 'users' });
985
+ meshserver.send({ action: 'wssessioncount' });
986
+ }
987
+ }
988
+ }
989
+ if (users == null) break;
990
+
991
+ // Check if the account is part of our user group
992
+ if ((userinfo.groups == null) || (userinfo.groups.length == 0) || (findOne(message.event.account.groups, userinfo.groups) == true)) {
993
+ users[message.event.account._id] = message.event.account; // Part of our groups, update this user.
994
+ } else {
995
+ delete users[message.event.account._id]; // No longer part of our groups, remove this user.
996
+ }
997
+
998
+ updateUsers();
999
+ break;
1000
+ }
1001
+ case 'accountremove': {
1002
+ // An account was removed
1003
+ if (users == null) break;
1004
+ delete users['user/' + domain + '/' + message.event.username.toLowerCase()];
1005
+ updateUsers();
1006
+ break;
1007
+ }
1008
+ case 'createmesh': {
1009
+ // A new mesh was created
1010
+ if ((meshes[message.event.meshid] == null) && (message.event.links[userinfo._id] != 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.
1011
+ meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
1012
+ masterUpdate(4 + 128);
1013
+ meshserver.send({ action: 'files' });
1014
+ }
1015
+ break;
1016
+ }
1017
+ case 'meshchange': {
1018
+ // Update mesh information
1019
+ if (meshes[message.event.meshid] == null) {
1020
+ // This is a new mesh for us
1021
+ meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
1022
+ meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
1023
+ } else {
1024
+ // This is an existing mesh
1025
+ if (message.event.name != null) {
1026
+ meshes[message.event.meshid].name = message.event.name;
1027
+ for (var i in nodes) { if (nodes[i].meshid == message.event.meshid) { nodes[i].meshnamel = message.event.name.toLowerCase(); } }
1028
+ }
1029
+ if (message.event.desc != null) { meshes[message.event.meshid].desc = message.event.desc; }
1030
+ if (message.event.flags != null) { meshes[message.event.meshid].flags = message.event.flags; }
1031
+ if (message.event.consent != null) { meshes[message.event.meshid].consent = message.event.consent; }
1032
+ if (message.event.links) { meshes[message.event.meshid].links = message.event.links; }
1033
+ if (message.event.amt) { meshes[message.event.meshid].amt = message.event.amt; }
1034
+
1035
+ // Check if we lost rights to this mesh in this change.
1036
+ if (meshes[message.event.meshid].links[userinfo._id] == null) {
1037
+ if ((xxcurrentView == 20) && (currentMesh == meshes[message.event.meshid])) go(2);
1038
+ delete meshes[message.event.meshid];
1039
+
1040
+ // Delete all nodes in that mesh
1041
+ var newnodes = [];
1042
+ for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } }
1043
+ nodes = newnodes;
1044
+
1045
+ // If we are looking at a node in the deleted mesh, move back to "My Devices"
1046
+ if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) { setDialogMode(0); go(1); }
1047
+ }
1048
+ }
1049
+ masterUpdate(4 + 128);
1050
+ if (currentNode && (currentNode.meshid == message.event.meshid)) { currentNode = null; if ((xxcurrentView >= 10) && (xxcurrentView < 20)) { go(1); } }
1051
+ //meshserver.send({ action: 'files' }); // TODO: Why do we need to do this??
1052
+
1053
+ // If we are looking at a mesh that is now deleted, move back to "My Account"
1054
+ if (xxcurrentView == 20 && currentMesh._id == message.event.meshid) { masterUpdate(4096); }
1055
+ break;
1056
+ }
1057
+ case 'deletemesh': {
1058
+ // Delete the mesh
1059
+ if (meshes[message.event.meshid]) {
1060
+ delete meshes[message.event.meshid];
1061
+ masterUpdate(128);
1062
+ meshserver.send({ action: 'files' });
1063
+ }
1064
+
1065
+ // Delete all nodes in that mesh
1066
+ var newnodes = [];
1067
+ if (nodes != null) { for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } } }
1068
+ nodes = newnodes;
1069
+ masterUpdate(4);
1070
+
1071
+ // If we are looking at a mesh that is now deleted, move back to "My Account"
1072
+ if (xxcurrentView >= 20 && xxcurrentView < 30 && currentMesh._id == message.event.meshid) { setDialogMode(0); go(2); }
1073
+ // If we are looking at a node in the deleted mesh, move back to "My Devices"
1074
+ if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) { setDialogMode(0); go(1); }
1075
+
1076
+ break;
1077
+ }
1078
+ case 'addnode': {
1079
+ var node = message.event.node;
1080
+ 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.
1081
+ if (getNodeFromId(node._id) != null) break; // This node is already known.
1082
+ node.namel = node.name.toLowerCase();
1083
+ if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1084
+ node.meshnamel = meshes[node.meshid].name.toLowerCase();
1085
+ node.state = 0;
1086
+ if (!node.icon) node.icon = 1;
1087
+ node.ident = ++nodeShortIdent;
1088
+ if (nodes == null) { }
1089
+ nodes.push(node);
1090
+
1091
+ // Web page update
1092
+ masterUpdate(1 | 2 | 4 | 16);
1093
+
1094
+ break;
1095
+ }
1096
+ case 'removenode': {
1097
+ var index = -1;
1098
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1099
+ if (index != -1) {
1100
+ var node = nodes[index];
1101
+ if (currentNode == node) {
1102
+ if (xxcurrentView >= 10 && xxcurrentView < 20) { setDialogMode(0); go(1); }
1103
+ currentNode = null;
1104
+ // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
1105
+ }
1106
+ nodes.splice(index, 1);
1107
+
1108
+ // Web page update
1109
+ masterUpdate(4 | 16);
1110
+ }
1111
+ break;
1112
+ }
1113
+ case 'changenode': {
1114
+ var index = -1;
1115
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1116
+ if (index != -1) {
1117
+ var node = nodes[index];
1118
+
1119
+ // Change the node
1120
+ node.name = message.event.node.name;
1121
+ node.rname = message.event.node.rname;
1122
+ node.users = message.event.node.users;
1123
+ node.host = message.event.node.host;
1124
+ node.desc = message.event.node.desc;
1125
+ node.ip = message.event.node.ip;
1126
+ node.osdesc = message.event.node.osdesc;
1127
+ node.publicip = message.event.node.publicip;
1128
+ node.iploc = message.event.node.iploc;
1129
+ node.wifiloc = message.event.node.wifiloc;
1130
+ node.gpsloc = message.event.node.gpsloc;
1131
+ node.tags = message.event.node.tags;
1132
+ node.userloc = message.event.node.userloc;
1133
+ if (message.event.node.agent != null) {
1134
+ if (node.agent == null) node.agent = {};
1135
+ if (message.event.node.agent.ver != null) { node.agent.ver = message.event.node.agent.ver; }
1136
+ if (message.event.node.agent.id != null) { node.agent.id = message.event.node.agent.id; }
1137
+ if (message.event.node.agent.caps != null) { node.agent.caps = message.event.node.agent.caps; }
1138
+ if (message.event.node.agent.core != null) { node.agent.core = message.event.node.agent.core; } else { if (node.agent.core) { delete node.agent.core; } }
1139
+ node.agent.tag = message.event.node.agent.tag;
1140
+ }
1141
+ if (message.event.node.intelamt != null) {
1142
+ if (node.intelamt == null) node.intelamt = {};
1143
+ if (message.event.node.intelamt.state != null) { node.intelamt.state = message.event.node.intelamt.state; }
1144
+ if (message.event.node.intelamt.host != null) { node.intelamt.user = message.event.node.intelamt.host; }
1145
+ if (message.event.node.intelamt.user != null) { node.intelamt.user = message.event.node.intelamt.user; }
1146
+ if (message.event.node.intelamt.tls != null) { node.intelamt.tls = message.event.node.intelamt.tls; }
1147
+ if (message.event.node.intelamt.ver != null) { node.intelamt.ver = message.event.node.intelamt.ver; }
1148
+ if (message.event.node.intelamt.tag != null) { node.intelamt.tag = message.event.node.intelamt.tag; }
1149
+ if (message.event.node.intelamt.uuid != null) { node.intelamt.uuid = message.event.node.intelamt.uuid; }
1150
+ if (message.event.node.intelamt.realm != null) { node.intelamt.realm = message.event.node.intelamt.realm; }
1151
+ }
1152
+ if (message.event.node.av != null) { node.av = message.event.node.av; }
1153
+ node.namel = node.name.toLowerCase();
1154
+ if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1155
+ if (message.event.node.icon) { node.icon = message.event.node.icon; }
1156
+
1157
+ // Web page update
1158
+ masterUpdate(2 | 4 | 8 | 16);
1159
+ refreshDevice(node._id);
1160
+
1161
+ if ((currentNode == node) && (xxdialogMode != null) && (xxdialogTag == '@xxmap')) { p10showNodeLocationDialog(); }
1162
+ }
1163
+ break;
1164
+ }
1165
+ case 'nodemeshchange': {
1166
+ var index = -1;
1167
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1168
+ if (index != -1) {
1169
+ var node = nodes[index];
1170
+ if (meshes[message.event.newMeshId] == null) {
1171
+ // We don't see the new mesh, remove this device
1172
+
1173
+ // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
1174
+ if (currentNode == node) { if (xxcurrentView >= 10 && xxcurrentView < 20) { setDialogMode(0); go(1); } currentNode = null; }
1175
+ nodes.splice(index, 1);
1176
+ masterUpdate(4 | 16);
1177
+ } else {
1178
+ // We see the new mesh, move this device
1179
+ node.meshid = message.event.newMeshId;
1180
+ node.meshnamel = meshes[message.event.newMeshId].name.toLowerCase();
1181
+ masterUpdate(1 | 2 | 4);
1182
+ }
1183
+ refreshDevice(message.event.nodeid);
1184
+ } else {
1185
+ // This is a new device, add it.
1186
+ var node = message.event.node;
1187
+ 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.
1188
+ node.namel = node.name.toLowerCase();
1189
+ if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1190
+ node.meshnamel = meshes[node.meshid].name.toLowerCase();
1191
+ node.state = 0;
1192
+ if (!node.icon) node.icon = 1;
1193
+ node.ident = ++nodeShortIdent;
1194
+ if (nodes == null) { }
1195
+ nodes.push(node);
1196
+
1197
+ // Web page update
1198
+ masterUpdate(1 | 2 | 4 | 16);
1199
+ }
1200
+ break;
1201
+ }
1202
+ case 'nodeconnect': {
1203
+ // Indicated a node has changed connectivity state
1204
+ var index = -1;
1205
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1206
+ if (index != -1) {
1207
+ var node = nodes[index];
1208
+
1209
+ // Event the connection change if needed
1210
+ var n = getstore('notifications', 0); // Account notification settings
1211
+
1212
+ // Per-group notification settings
1213
+ if (message.event.meshid && userinfo.links && userinfo.links[message.event.meshid] && userinfo.links[message.event.meshid].notify) {
1214
+ n &= userinfo.links[message.event.meshid].notify;
1215
+ } else {
1216
+ n = 0;
1217
+ }
1218
+
1219
+ // Show the notification
1220
+ if (n & 2) {
1221
+ if (((node.conn & 1) == 0) && ((message.event.conn & 1) != 0)) { addNotification({ text: "Agent připojen", title: node.name, icon: node.icon, nodeid: node._id }); }
1222
+ if (((node.conn & 2) == 0) && ((message.event.conn & 2) != 0)) { addNotification({ text: "Intel AMT detected", title: node.name, icon: node.icon, nodeid: node._id }); }
1223
+ if (((node.conn & 4) == 0) && ((message.event.conn & 4) != 0)) { addNotification({ text: "Intel AMT CIRA connected", title: node.name, icon: node.icon, nodeid: node._id }); }
1224
+ if (((node.conn & 16) == 0) && ((message.event.conn & 16) != 0)) { addNotification({ text: "MQTT připojeno", title: node.name, icon: node.icon, nodeid: node._id }); }
1225
+ }
1226
+ if (n & 4) {
1227
+ if (((node.conn & 1) != 0) && ((message.event.conn & 1) == 0)) { addNotification({ text: "Agent disconnected", title: node.name, icon: node.icon, nodeid: node._id }); }
1228
+ if (((node.conn & 2) != 0) && ((message.event.conn & 2) == 0)) { addNotification({ text: "Intel AMT not detected", title: node.name, icon: node.icon, nodeid: node._id }); }
1229
+ if (((node.conn & 4) != 0) && ((message.event.conn & 4) == 0)) { addNotification({ text: "Intel AMT CIRA disconnected", title: node.name, icon: node.icon, nodeid: node._id }); }
1230
+ if (((node.conn & 16) != 0) && ((message.event.conn & 16) == 0)) { addNotification({ text: "MQTT disconnected", title: node.name, icon: node.icon, nodeid: node._id }); }
1231
+ }
1232
+
1233
+ // Change the node connection state
1234
+ node.conn = message.event.conn;
1235
+ node.pwr = message.event.pwr;
1236
+
1237
+ // Web page update
1238
+ masterUpdate(4 | 16);
1239
+ refreshDevice(node._id);
1240
+ }
1241
+ break;
1242
+ }
1243
+ case 'wssessioncount': {
1244
+ // Update the active web socket session count for a user
1245
+ if (wssessions != null) {
1246
+ if (message.event.count == 0 && wssessions['user/' + domain + '/' + message.event.username.toLowerCase()]) {
1247
+ delete wssessions['user/' + domain + '/' + message.event.username.toLowerCase()];
1248
+ } else {
1249
+ wssessions['user/' + domain + '/' + message.event.username.toLowerCase()] = message.event.count;
1250
+ }
1251
+ updateUsers();
1252
+ }
1253
+ break;
1254
+ }
1255
+ case 'login': {
1256
+ // Update the last login time
1257
+ if (users != null && users['user/' + domain + '/' + message.event.username.toLowerCase()]) {
1258
+ users['user/' + domain + '/' + message.event.username.toLowerCase()].login = Math.floor(new Date(message.event.time).getTime() / 1000);
1259
+ }
1260
+ break;
1261
+ }
1262
+ case 'scanamtdevice': {
1263
+ // Populate the Intel AMT scan dialog box with the result of the RMCP scan
1264
+ if ((xxdialogMode == null) || (!Q('dp1range')) || (Q('dp1range').value != message.event.range)) return;
1265
+ var x = '';
1266
+ if (message.event.results == null) {
1267
+ // The scan could not occur because of an error. Likely the user range was invalid.
1268
+ x = '<div style=width:100%;text-align:center;margin-top:12px>' + "Nelze skenovat tento rozsah." + '</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>';
1269
+ } else {
1270
+ // Go thru all the results and populate the dialog box
1271
+ amtScanResults = message.event.results;
1272
+ for (var i in message.event.results) {
1273
+ var r = message.event.results[i], shortname = r.hostname;
1274
+ if (shortname.length > 20) { shortname = shortname.substring(0, 20) + '...'; }
1275
+ var str = '<b title="' + EscapeHtml(r.hostname) + '">' + EscapeHtml(shortname) + '</b> - v' + r.ver;
1276
+ if (r.state == 2) { if (r.tls == 1) { str += " with TLS."; } else { str += " bez TLS."; } } else { str += ' not activated.'; }
1277
+ 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>';
1278
+ }
1279
+ // If no results where found, display a nice message
1280
+ 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>'; }
1281
+ }
1282
+ // Set the html in the dialog box and re-enable the scan button
1283
+ QH('dp1results', x);
1284
+ QE('dp1range', true);
1285
+ QE('dp1rangebutton', true);
1286
+ break;
1287
+ }
1288
+ case 'notify': {
1289
+ var n = { text: message.event.value, title: message.event.title, icon: message.event.icon };
1290
+ if (message.event.tag != null) { n.tag = message.event.tag; }
1291
+ addNotification(n);
1292
+ break;
1293
+ }
1294
+ case 'traceinfo': {
1295
+ if (typeof message.event.traceSources == 'object') {
1296
+ if ((message.event.traceSources != null) && (message.event.traceSources.length > 0)) {
1297
+ serverTraceSources = message.event.traceSources;
1298
+ QH('p41traceStatus', EscapeHtml(message.event.traceSources.join(', ')));
1299
+ } else {
1300
+ serverTraceSources = [];
1301
+ QH('p41traceStatus', "Nic");
1302
+ }
1303
+ }
1304
+ break;
1305
+ }
1306
+ case 'sysinfohash': {
1307
+ // If the sysinfo document has changed and we are looking at it, request an update.
1308
+ if ((currentNode != null) && (message.event.nodeid == powerTimelineReq)) {
1309
+ meshserver.send({ action: 'getsysinfo', nodeid: message.event.nodeid });
1310
+ }
1311
+ break;
1312
+ }
1313
+ case 'stopped': { // Server is stopping.
1314
+ // Disconnect
1315
+ //console.log(message.msg);
1316
+ break;
1317
+ }
1318
+ case 'updatePluginList': {
1319
+ installedPluginList = message.event.list;
1320
+ updatePluginList();
1321
+ break;
1322
+ }
1323
+ case 'pluginStateChange': {
1324
+ if (pluginHandler == null) break;
1325
+ pluginHandler.refreshPluginHandler();
1326
+ break;
1327
+ }
1328
+ default:
1329
+ //console.log('Unknown message.event.action', message.event.action);
1330
+ break;
1331
+ }
1332
+ break;
1333
+ }
1334
+ case 'createInviteLink': { // Agent installation invitation link
1335
+ if (xxdialogTag != message.meshid) break;
1336
+ var servername = serverinfo.name;
1337
+ if ((servername.indexOf('.') == -1) || ((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.
1338
+ var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
1339
+ var url;
1340
+ if (serverinfo.https == true) {
1341
+ var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
1342
+ url = 'https://' + servername + portStr + domainUrl + 'agentinvite?c=' + message.cookie;
1343
+ } else {
1344
+ var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
1345
+ url = 'http://' + servername + portStr + domainUrl + 'agentinvite?c=' + message.cookie;
1346
+ }
1347
+ Q('agentInvitationLink').href = url;
1348
+ var t = format("{0} hodina{1}", message.expire, addLetterS(message.expire));
1349
+ if (message.expire == 24) { t = "1 den"; }
1350
+ if (message.expire == 168) { t = "1 týden"; }
1351
+ if (message.expire == 5040) { t = "1 měsíc"; }
1352
+ if (message.expire == 0) { t = "Bez limitu"; }
1353
+ QH('agentInvitationLink', format("Link pro pozvání ({0})", t));
1354
+ QV('agentInvitationLinkDiv', true);
1355
+ break;
1356
+ }
1357
+ case 'getmqttlogin': {
1358
+ if ((currentNode == null) || (currentNode._id != message.nodeid) || (xxdialogMode != null)) return;
1359
+ var x = "These settings can be used to connect MQTT for this device." + '<br /><br />';
1360
+ delete message.action;
1361
+ delete message.nodeid;
1362
+ x += '<textarea readonly=readonly style=width:100%;resize:none;height:100px;overflow:auto;font-size:12px readonly>' + JSON.stringify(message) + '</textarea>';
1363
+ /*
1364
+ x += addHtmlValue('Username', '<input style=width:230px readonly value="' + message.user + '" />');
1365
+ x += addHtmlValue('Password', '<input style=width:230px readonly value="' + message.pass + '" />');
1366
+ x += addHtmlValue('WS URL', '<input style=width:230px readonly value="' + message.wsUrl + '" />');
1367
+ if (message.mpsUrl && message.mpsCertHash) {
1368
+ x += addHtmlValue('MPS URL', '<input style=width:230px readonly value="' + message.mpsUrl + '" />');
1369
+ x += addHtmlValue('MPS Cert Hash', '<input style=width:230px readonly value="' + message.mpsCertHash + '" />');
1370
+ }
1371
+ */
1372
+ setDialogMode(2, "MQTT Credentials", 1, null, x);
1373
+ break;
1374
+ }
1375
+ case 'stopped': { // Server is stopping.
1376
+ // Disconnect
1377
+ autoReconnect = false;
1378
+ QH('p0span', message.msg);
1379
+ break;
1380
+ }
1381
+ case 'updatePluginList': {
1382
+ installedPluginList = message.list;
1383
+ updatePluginList();
1384
+ break;
1385
+ }
1386
+ case 'pluginVersionsAvailable': {
1387
+ if (pluginHandler == null) break;
1388
+ updatePluginList(message.list);
1389
+ break;
1390
+ }
1391
+ case 'downgradePluginVersions': {
1392
+ var vSelect = '<select id="lastPluginVersion">';
1393
+ message.info.versionList.forEach(function(v) { vSelect += '<option value="' + v.zipball_url + '">' + v.name + '</option>'; });
1394
+ vSelect += '</select>';
1395
+ setDialogMode(2, "Plugin Action", 3, pluginActionEx, format('Select the version to downgrade the plugin: {0}', message.info.name) + '<hr />' + vSelect + '<hr />' + "Please be aware that downgrading is not recommended. Please only do so in the event that a recent upgrade has broken something." + + '<input id="lastPluginAct" type="hidden" value="downgrade" /><input id="lastPluginId" type="hidden" value="' + message.info.id + '" />');
1396
+ break;
1397
+ }
1398
+ case 'pluginError': {
1399
+ setDialogMode(2, "Plugin Error", 1, null, message.msg);
1400
+ break;
1401
+ }
1402
+ case 'plugin': {
1403
+ if ((pluginHandler == null) || (typeof message.plugin != 'string')) break;
1404
+ try { pluginHandler[message.plugin][message.method](server, message); } catch (e) { console.log('Error loading plugin handler ('+ e + ')'); }
1405
+ break;
1406
+ }
1407
+ default:
1408
+ //console.log('Unknown message.action', message.action);
1409
+ break;
1410
+ }
1411
+ }
1412
+
1413
+ //
1414
+ // MY DEVICES
1415
+ //
1416
+
1417
+ function onRealNameCheckBox() {
1418
+ showRealNames = Q('RealNameCheckBox').checked;
1419
+ putstore('showRealNames', showRealNames ? 1 : 0);
1420
+ masterUpdate(6);
1421
+ return;
1422
+ }
1423
+
1424
+ function onDeviceViewChange(i) {
1425
+ if (i != null) { Q('viewselect').value = i; }
1426
+ for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); }
1427
+ Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel');
1428
+ putstore('_deviceView', Q('viewselect').value);
1429
+ putstore('_viewsize', Q('sizeselect').value);
1430
+ masterUpdate(4);
1431
+ setTimeout(function () { masterUpdate(512); }, 200);
1432
+ }
1433
+
1434
+ function ondockeypress(e) {
1435
+ setSessionActivity();
1436
+ if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) {
1437
+ // Check what keys we are allows to send
1438
+ if (currentNode != null) {
1439
+ var mesh = meshes[currentNode.meshid];
1440
+ var meshrights = mesh.links[userinfo._id].rights;
1441
+ var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
1442
+ if (inputAllowed == false) return false;
1443
+ var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
1444
+ if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
1445
+ }
1446
+ return desktop.m.handleKeys(e);
1447
+ }
1448
+ if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) { return terminal.m.TermHandleKeys(e); }
1449
+ if (!xxdialogMode && ((xxcurrentView == 15) || (xxcurrentView == 115))) return agentConsoleHandleKeys(e);
1450
+ if (!xxdialogMode && xxcurrentView == 4) {
1451
+ if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1452
+ var processed = 0;
1453
+ if (e.key) {
1454
+ if (e.key.length === 1 && userSearchFocus == 0) { Q('UserSearchInput').value = ((Q('UserSearchInput').value + e.key)); processed = 1; }
1455
+ if (e.keyCode == 8 && userSearchFocus == 0) { var x = Q('UserSearchInput').value; Q('UserSearchInput').value = x.substring(0, x.length - 1); processed = 1; }
1456
+ if (e.keyCode == 27) { Q('UserSearchInput').value = ''; processed = 1; }
1457
+ } else {
1458
+ if (e.charCode != 0 && userSearchFocus == 0) { Q('UserSearchInput').value = ((Q('UserSearchInput').value + String.fromCharCode(e.charCode))); processed = 1; }
1459
+ }
1460
+ if (processed > 0) { if (processed == 1) { onUserSearchInputChanged(); } return haltEvent(e); }
1461
+ }
1462
+ if (xxdialogMode || xxcurrentView != 1) return;
1463
+ if (e.ctrlKey == true && e.charCode == 96) {
1464
+ showRealNames = !showRealNames;
1465
+ Q('RealNameCheckBox').value = showRealNames;
1466
+ putstore('showRealNames', showRealNames ? 1 : 0);
1467
+ masterUpdate(6)
1468
+ return;
1469
+ }
1470
+ if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1471
+ if (Q('viewselect').value < 3) {
1472
+ var processed = 0;
1473
+ if (e.key) {
1474
+ if (e.key.length === 1 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + e.key)); processed = 1; }
1475
+ if (e.keyCode == 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = x.substring(0, x.length - 1); processed = 1; }
1476
+ if (e.keyCode == 27) { Q('SearchInput').value = ''; processed = 1; }
1477
+ } else {
1478
+ if (e.charCode != 0 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + String.fromCharCode(e.charCode))); processed = 1; }
1479
+ }
1480
+ if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
1481
+ }
1482
+ if (Q('viewselect').value == 3) {
1483
+ if (e.key) {
1484
+ if (e.key.length === 1 && mapSearchFocus == 0) { Q('mapSearchLocation').value = ((Q('mapSearchLocation').value + e.key)); processed = 1; }
1485
+ //if (e.keyCode == 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = x.substring(0, x.length - 1); processed = 1; }
1486
+ if (e.keyCode == 27) { Q('mapSearchLocation').value = ''; mapCloseSearchWindow(); processed = 1; }
1487
+ if (e.keyCode == 13) { getSearchLocation(); }
1488
+ } else {
1489
+ if (e.charCode != 0 && mapSearchFocus == 0) { Q('mapSearchLocation').value = ((Q('mapSearchLocation').value + String.fromCharCode(e.charCode))); processed = 1; }
1490
+ }
1491
+ }
1492
+ }
1493
+
1494
+ function ondockeydown(e) {
1495
+ setSessionActivity();
1496
+ if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) {
1497
+ // Check what keys we are allows to send
1498
+ if (currentNode != null) {
1499
+ var mesh = meshes[currentNode.meshid];
1500
+ var meshrights = mesh.links[userinfo._id].rights;
1501
+ var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
1502
+ if (inputAllowed == false) return false;
1503
+ var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
1504
+ if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
1505
+ }
1506
+ return desktop.m.handleKeyDown(e);
1507
+ }
1508
+ if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) { terminal.m.TermHandleKeyDown(e); if ((e.keyCode >= 37) && (e.keyCode <= 40)) { haltEvent(e); } }
1509
+ if (!xxdialogMode && xxcurrentView == 13 && e.keyCode == 116 && p13filetree != null) { haltEvent(e); return false; } // F5 Refresh on files
1510
+ if (!xxdialogMode && ((xxcurrentView == 15) || (xxcurrentView == 115))) { return agentConsoleHandleKeys(e); }
1511
+ if (!xxdialogMode && xxcurrentView == 4) {
1512
+ if (e.keyCode === 8 && userSearchFocus == 0) { var x = Q('UserSearchInput').value; Q('UserSearchInput').value = (x.substring(0, x.length - 1)); processed = 1; }
1513
+ if (e.keyCode === 27) { Q('UserSearchInput').value = ''; processed = 1; }
1514
+ if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
1515
+ }
1516
+ if (xxdialogMode || xxcurrentView != 1 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1517
+ var processed = 0;
1518
+ if (Q('viewselect').value < 3) {
1519
+ if (e.keyCode === 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = (x.substring(0, x.length - 1)); processed = 1; }
1520
+ if (e.keyCode === 27) { Q('SearchInput').value = ''; processed = 1; }
1521
+ if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
1522
+ }
1523
+ if (Q('viewselect').value == 3) {
1524
+ if (e.keyCode === 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = (x.substring(0, x.length - 1)); processed = 1; }
1525
+ if (e.keyCode === 27) { Q('mapSearchLocation').value = ''; mapCloseSearchWindow(); processed = 1; }
1526
+ }
1527
+ }
1528
+
1529
+ function ondockeyup(e) {
1530
+ setSessionActivity();
1531
+ if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) {
1532
+ // Check what keys we are allows to send
1533
+ if (currentNode != null) {
1534
+ var mesh = meshes[currentNode.meshid];
1535
+ var meshrights = mesh.links[userinfo._id].rights;
1536
+ var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
1537
+ if (inputAllowed == false) return false;
1538
+ var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
1539
+ if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
1540
+ }
1541
+ return desktop.m.handleKeyUp(e);
1542
+ }
1543
+ if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) { return terminal.m.TermHandleKeyUp(e); }
1544
+ if (!xxdialogMode && xxcurrentView == 13 && e.keyCode == 116 && p13filetree != null) { p13folderup(9999); haltEvent(e); return false; } // F5 Refresh on files
1545
+ if (!xxdialogMode && xxcurrentView == 4) { if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
1546
+ if (xxdialogMode && e.keyCode == 27) { dialogclose(0); }
1547
+ if (xxdialogMode || xxcurrentView != 0 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
1548
+ if (Q('viewselect').value < 3) { if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
1549
+ if (Q('viewselect').value == 3) { if ((e.keyCode === 8 && mapSearchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
1550
+ }
1551
+
1552
+ //function ondocfocus() { }
1553
+ // TODO: Add handleReleaseKeys() for Intel AMT.
1554
+ function ondocblur() { if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked && desktop.m.handleReleaseKeys) { return desktop.m.handleReleaseKeys(); } }
1555
+
1556
+ // Highlights the device being hovered
1557
+ function devMouseHover(element, over) {
1558
+ setSessionActivity();
1559
+ var view = Q('viewselect').value;
1560
+ if (view == 1) {
1561
+ var e = element.children[1].children[1];
1562
+ e.children[0].classList.remove('g1s');
1563
+ e.children[1].classList.remove('e2s');
1564
+ e.children[2].classList.remove('g2s');
1565
+ if (over == 1) {
1566
+ e.children[0].classList.add('g1s');
1567
+ e.children[1].classList.add('e2s');
1568
+ e.children[2].classList.add('g2s');
1569
+ }
1570
+ } else if (view == 2) {
1571
+ var e = element;
1572
+ e.children[2].classList.remove('g1s');
1573
+ e.children[4].classList.remove('e2s');
1574
+ e.children[3].classList.remove('g2s');
1575
+ if (over == 1) {
1576
+ e.children[2].classList.add('g1s');
1577
+ e.children[4].classList.add('e2s');
1578
+ e.children[3].classList.add('g2s');
1579
+ }
1580
+ }
1581
+ }
1582
+
1583
+ var deviceHeaderId = 0;
1584
+ var deviceHeaderTotal = 0;
1585
+ var deviceHeadersTitles = {};
1586
+ var deviceHeaderCount;
1587
+ var deviceHeaders = {};
1588
+ var oldviewmode = 0;
1589
+ function updateDevices() {
1590
+ if (nodes == null) { return; }
1591
+ var r = '', c = 0, current = null, count = 0, displayedMeshes = {}, view = Q('viewselect').value, groups = {}, groupCount = {};
1592
+ QV('xdevices', view < 4);
1593
+ QV('xdevicesmap', view == 4);
1594
+ QV('devListToolbar', view < 3);
1595
+ QV('kvmListToolbar', view == 3);
1596
+ QV('devMapToolbar', view == 4);
1597
+ QV('devListToolbarSize', view == 3);
1598
+ QV('NoMeshesPanel', meshcount == 0);
1599
+ //QV('devListToolbarView', (meshcount != 0) && (nodes.length > 0));
1600
+ QV('devListToolbarViewIcons', (meshcount != 0) && (nodes.length > 0));
1601
+ QV('devListToolbarSort', (meshcount != 0) && (nodes.length > 0) && (view < 4));
1602
+ if ((meshcount == 0) || (nodes.length == 0)) { view = 1; sort = 0; }
1603
+ if (view == 4) {
1604
+ setTimeout( function() { if (xxmap.map != null) { xxmap.map.updateSize(); } }, 200);
1605
+ // TODO
1606
+ } else {
1607
+ // 3 wide, list view or desktop view
1608
+ deviceHeaderId = 0;
1609
+ deviceHeaderCount = {};
1610
+ deviceHeaderTotal = 0;
1611
+ deviceHeaders = {};
1612
+ deviceHeadersTitles = {};
1613
+ var kvmDivs = [];
1614
+
1615
+ // Perform node sort
1616
+ if (sort == 0) { nodes.sort(meshSort); }
1617
+ else if (sort == 1) { nodes.sort(powerSort); }
1618
+ else if (sort == 2) { if (showRealNames == true) { nodes.sort(deviceHostSort); } else { nodes.sort(deviceSort); } }
1619
+
1620
+ // Save the list of currently checked nodeid's
1621
+ var checkedNodeids = [], elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
1622
+ for (var i=0;i<elements.length;i++) { if (elements[i].checked) { checkedNodeids.push(elements[i].value); } }
1623
+ if ((oldviewmode < 3) && (view == 3)) { multiDesktopFilter = checkedNodeids; }
1624
+ else if ((oldviewmode == 3) && (view < 3)) { checkedNodeids = multiDesktopFilter; }
1625
+
1626
+ // Compute the width of the device view.
1627
+ var totalDeviceViewWidth = Q('column_l').clientWidth - 60;
1628
+ var deviceBoxWidth = Math.floor(totalDeviceViewWidth / 301);
1629
+ deviceBoxWidth = 301 + Math.floor((totalDeviceViewWidth - (deviceBoxWidth * 301)) / deviceBoxWidth);
1630
+
1631
+ if ((view == 2) && (sort != 3)) {
1632
+ r += '<table style=width:100%;margin-top:4px cellpadding=0 cellspacing=0><th style=color:gray><th style=color:gray;width:120px>' + "User" + '<th style=color:gray;width:120px>' + "Adresa" + '<th style=color:gray;width:100px>' + "Connectivity"; //<th style=color:gray;width:100px>State';
1633
+ }
1634
+
1635
+ // Go thru the list of nodes and display them
1636
+ for (var i in nodes) {
1637
+ var node = nodes[i];
1638
+ if (node.v == false) continue;
1639
+ var mesh2 = meshes[node.meshid], meshlinks = mesh2.links[userinfo._id];
1640
+ if (meshlinks == null) continue;
1641
+ var meshrights = meshlinks.rights;
1642
+ if ((view == 3) && (mesh2.mtype == 1)) continue;
1643
+ if (sort == 0) {
1644
+ // Mesh header
1645
+ if (node.meshid != current) {
1646
+ deviceHeaderSet();
1647
+ var extra = '';
1648
+ if (view == 2) { r += '<tr><td colspan=5>'; }
1649
+ if (meshes[node.meshid].mtype == 1) { extra = '<span class=devHeaderx>' + ", Intel® AMT only" + '</span>'; }
1650
+ if ((view == 1) && (current != null)) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } }
1651
+ if (view == 2) { r += '<div>'; }
1652
+ r += '<div class=DevSt style=width:100%;padding-top:4px><span style=float:right>';
1653
+ r += '<span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx></span>' + extra;
1654
+ r += '</span><span id=MxMESH tabindex=0 style=cursor:pointer onclick=gotoMesh("' + node.meshid + '") onkeypress="if (event.key==\'Enter\') gotoMesh(\'' + node.meshid + '\')">' + EscapeHtml(meshes[node.meshid].name) + '</span>' + getMeshActions(mesh2, meshrights) + '</div>';
1655
+ if (view == 2) { r += '</div>'; }
1656
+ current = node.meshid;
1657
+ displayedMeshes[current] = 1;
1658
+ c = 0;
1659
+ }
1660
+ } else if (sort == 1) {
1661
+ // Power header
1662
+ var pwr = node.pwr?node.pwr:0;
1663
+ if (pwr !== current) {
1664
+ deviceHeaderSet();
1665
+ if ((view == 1) && (current !== null)) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } }
1666
+
1667
+ if (view == 2) { r += '<tr><td>'; }
1668
+ r += '<div class=DevSt style=width:100%;padding-top:4px><span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx style=float:right></span><span>' + PowerStateStr2(node.pwr) + '</span></div>';
1669
+
1670
+ current = pwr;
1671
+ c = 0;
1672
+ }
1673
+ } else if (sort == 2) {
1674
+ // Device header
1675
+ if (current == null) { current = '1'; }
1676
+ }
1677
+
1678
+ count++;
1679
+ var title = EscapeHtml(node.name);
1680
+ if (title.length == 0) { title = '<i>' + "Nic" + '</i>'; }
1681
+ if ((node.rname != null) && (node.rname.length > 0)) { title += ' / ' + EscapeHtml(node.rname); }
1682
+ var name = EscapeHtml(node.name);
1683
+ if (showRealNames == true && node.rname != null) name = EscapeHtml(node.rname);
1684
+ if (name.length == 0) { name = '<i>' + "Nic" + '</i>'; }
1685
+
1686
+ // Node
1687
+ var icon = node.icon;
1688
+ if ((!node.conn) || (node.conn == 0)) { icon += ' gray'; }
1689
+ if (view == 1) {
1690
+ r += '<div id=devs onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=display:inline-block;width:' + deviceBoxWidth + 'px;height:50px;padding-top:1px;padding-bottom:1px><div style=width:22px;height:50%;float:left;padding-top:12px><input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox></div><div style=height:100%;cursor:pointer tabindex=0 onclick=gotoDevice(\'' + node._id + '\',null,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',null,null,event)"><div class="i' + icon + '" style=width:50px;float:left></div><div style=height:100%><div class=g1></div><div class=e2><div class=e1 style=width:' + (deviceBoxWidth - 100) + 'px title="' + title + '">' + name + '</div><div>' + NodeStateStr(node) + '</div></div><div class=g2></div></div></div></div>';
1691
+ } else if (view == 2) {
1692
+ var states = [];
1693
+ if (node.conn) {
1694
+ if ((node.conn & 1) != 0) { states.push('<span title=\"' + "Agent je připojen a připraven." + '\">' + "Agent" + '</span>'); }
1695
+ if ((node.conn & 2) != 0) { states.push('<span title=\"' + "Intel® AMT CIRA is connected and ready for use." + '\">' + "CIRA" + '</span>'); }
1696
+ else if ((node.conn & 4) != 0) { states.push('<span title=\"' + "Intel® AMT is routable." + '\">' + "AMT" + '</span>'); }
1697
+ if ((node.conn & 8) != 0) { states.push('<span title=\"' + "Mesh agent is reachable using another agent as relay." + '\">' + "Relay" + '</span>'); }
1698
+ if ((node.conn & 16) != 0) { states.push('<span title=\"' + "MQTT connection to the device is active." + '\">' + "MQTT" + '</span>'); }
1699
+ }
1700
+ r += '<tr><td><div id=devs class=bar18 tabindex=0 onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=height:18px;width:100%;font-size:medium onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',null,null,event)">';
1701
+ r += '<div class=deviceBarCheckbox><input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox></div>';
1702
+ r += '<div class=deviceBarIcon onclick=gotoDevice(\'' + node._id + '\',null,null,event)><div class=\"j' + icon + '\" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
1703
+ r += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
1704
+ r += '<div style=cursor:pointer;font-size:14px title="' + title + '" onclick=gotoDevice(\'' + node._id + '\',null,null,event)><span style=width:300px>' + name + '</span></div></div></td>';
1705
+ r += '<td style=text-align:center>' + getUserShortStr(node);
1706
+ r += '<td style=text-align:center>' + (node.ip != null ? node.ip : '');
1707
+ r += '<td style=text-align:center>' + states.join(' + ');
1708
+ //r += '<td style=text-align:center>' + (node.pwr != null ? powerStateStrings[node.pwr] : '');
1709
+ r += '</tr>';
1710
+ } else if ((view == 3) && (node.conn & 1) && (((meshrights & 8) || (meshrights & 256)) != 0) && ((node.agent.caps & 1) != 0)) { // Check if we have rights and agent is capable of KVM.
1711
+ if ((multiDesktopFilter) && ((multiDesktopFilter.length == 0) || (multiDesktopFilter.indexOf('devid_' + node._id) >= 0))) {
1712
+ r += '<div id=devs style=display:inline-block;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div tabindex=0 style=padding:3px;cursor:pointer onclick=gotoDevice(\'' + node._id + '\',11,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',11,null,event)">';
1713
+ //r += '<input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox style=float:left>';
1714
+ r += '<div class="j' + icon + '" style=width:16px;float:left></div> ' + name + '</div>';
1715
+ r += '<span onclick=gotoDevice(\'' + node._id + '\',null,null,event)></span><div id=xkvmid_' + node._id.split('/')[2] + '><div id=skvmid_' + node._id.split('/')[2] + ' tabindex=0 style="position:absolute;color:white;left:5px;top:27px;text-shadow:0px 0px 5px #000;z-index:1000;cursor:default" onclick=toggleKvmDevice(\'' + node._id + '\') onkeypress="if (event.key==\'Enter\') toggleKvmDevice(\'' + node._id + '\')">' + "Odpojeno" + '</div></div>';
1716
+ r += '</div>';
1717
+ kvmDivs.push(node._id);
1718
+ }
1719
+ }
1720
+
1721
+ // If we are displaying devices by group, put the device in the right group.
1722
+ if ((sort == 3) && (r != '')) {
1723
+ if (node.tags) {
1724
+ for (var j in node.tags) {
1725
+ var tag = node.tags[j];
1726
+ if (groups[tag] == null) { groups[tag] = r; groupCount[tag] = 1; } else { groups[tag] += r; groupCount[tag] += 1; }
1727
+ if (view == 3) break;
1728
+ }
1729
+ }
1730
+ r = '';
1731
+ }
1732
+
1733
+ deviceHeaderTotal++;
1734
+ if (typeof deviceHeaderCount[node.state] == 'undefined') { deviceHeaderCount[node.state] = 1; } else { deviceHeaderCount[node.state]++; }
1735
+ }
1736
+
1737
+ // Above 32 devices, gray out the auto connect feature.
1738
+ if (kvmDivs.length >= 32) { Q('autoConnectDesktopCheckbox').checked = false; }
1739
+ QE('autoConnectDesktopCheckbox', kvmDivs.length < 32);
1740
+
1741
+ // If displaying devices by groups, sort the group names and display the devices.
1742
+ if (sort == 3) {
1743
+ if (view == 2) { r = '<table style=width:100%;margin-top:4px cellpadding=0 cellspacing=0><th style=color:gray><th style=color:gray;width:120px>' + "User" + '<th style=color:gray;width:120px>' + "Adresa" + '<th style=color:gray;width:100px>' + "Connectivity"; }
1744
+
1745
+ var groupNames = [];
1746
+ for (var i in groups) { groupNames.push(i); }
1747
+ groupNames.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); });
1748
+ for (var j in groupNames) {
1749
+ var i = groupNames[j];
1750
+ if (view == 2) {
1751
+ r += '<tr><td colspan=4><div class=DevSt style=width:100%;padding-top:4px><span class=devHeaderx style=float:right>' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + '</span><span>' + i + '</span></div>' + groups[i];
1752
+ } else {
1753
+ r += '<div class=DevSt style=width:100%;padding-top:4px><span class=devHeaderx style=float:right>' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + '</span><span>' + i + '</span></div>' + groups[i];
1754
+ }
1755
+ }
1756
+ }
1757
+
1758
+ // If there is nothing to display, explain the problem
1759
+ if ((r == '') && (meshcount > 0) && (Q('SearchInput').value != '')) {
1760
+ if (sort == 3) {
1761
+ r = '<div style="margin:30px">' + "No devices are included in any groups, click on a device\'s \"Groups\" to add to a group." + '</div>';
1762
+ } else {
1763
+ r = '<div style="margin:30px">' + "No devices matching this search." + '</div>';
1764
+ }
1765
+ }
1766
+
1767
+ if ((view == 1) && (c == 2)) r += '<td><div style=width:301px></div></td>'; // Adds device padding
1768
+
1769
+ // Display all empty device groups, we need to do this because users can add devices to these at any time.
1770
+ if ((sort == 0) && (Q('SearchInput').value == '') && (view < 3)) {
1771
+ for (var i in meshes) {
1772
+ var mesh = meshes[i], meshlink = mesh.links[userinfo._id];
1773
+ if (meshlink != null) {
1774
+ var meshrights = meshlink.rights;
1775
+ if (displayedMeshes[mesh._id] == null) {
1776
+ if ((current != '') && (r != '')) { r += '</tr></table>'; }
1777
+ r += '<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr><td colspan=3 class=DevSt><span id=MxMESH style=cursor:pointer onclick=gotoMesh("' + mesh._id + '")>' + EscapeHtml(mesh.name) + '</span><span>';
1778
+ r += getMeshActions(mesh, meshrights);
1779
+ r += '</span></td></tr><tr>';
1780
+ if (mesh.mtype == 1) {
1781
+ r += '<td><div style=padding:10px><i>' + "No Intel® AMT devices in this mesh";
1782
+ if ((meshrights & 4) != 0) { r += ', <a href=# style=cursor:pointer onclick=\'return addDeviceToMesh(\"' + mesh._id + '\")\'>' + "přidat" + '</a>'; }
1783
+ }
1784
+ if (mesh.mtype == 2) {
1785
+ r += '<td><div style=padding:10px><i>' + "Žádné zařízení v této skupině";
1786
+ if ((meshrights & 4) != 0) { r += ', <a href=# style=cursor:pointer onclick=\'return addAgentToMesh(\"' + mesh._id + '\")\'>' + "přidat" + '</a>'; }
1787
+ }
1788
+ r += '.</i></div></td>';
1789
+ current = mesh._id;
1790
+ count++;
1791
+ }
1792
+ }
1793
+ }
1794
+ }
1795
+ r += '</tr></table><div style=height:1px></div>'; // This height of 1 div fixes a problem in Linux firefox browsers
1796
+
1797
+ // Add a "Add Device Group" option
1798
+ r += '<div style=border-top-style:solid;border-top-width:1px;border-top-color:#DDDDDD;cursor:pointer;font-size:10px>';
1799
+ if ((view < 3) && (sort == 0) && (meshcount > 0) && ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 64) == 0))) {
1800
+ r += '<a href=# onclick="return account_createMesh()" title=\"' + "Vytvořit novou skupinu zařízení." + '\" style=cursor:pointer>' + "Přidat skupinu zařízení" + '</a> ';
1801
+ }
1802
+ if ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 128) == 0)) {
1803
+ r += '<a href=# onclick=\'return p10showMeshCmdDialog(0)\' style=cursor:pointer title=\"' + "Download MeshCmd, a command line tool that performs many functions." + '\">' + "MeshCmd" + '</a> ';
1804
+ if (navigator.platform.toLowerCase() == 'win32') { r += '<a href=# onclick=\'return p10showMeshRouterDialog()\' style=cursor:pointer title=\"' + "Download MeshCentral Router, a TCP port mapping tool." + '\">' + "Router" + '</a> '; }
1805
+ }
1806
+ r += '</div><br/>';
1807
+
1808
+ QH('xdevices', r);
1809
+ deviceHeaderSet();
1810
+
1811
+ // Re-check nodeid's
1812
+ var elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
1813
+ if (checkedNodeids) { for (var i=0;i<elements.length;i++) { elements[i].checked = (checkedNodeids.indexOf(elements[i].value) >= 0); } }
1814
+
1815
+ for (var i in deviceHeaders) { QH(i, deviceHeaders[i]); }
1816
+ for (var i in deviceHeadersTitles) { Q(i).title = deviceHeadersTitles[i]; }
1817
+ p1updateInfo();
1818
+
1819
+ // Take care of KVM surfaces in desktop view mode
1820
+ if (view == 3) {
1821
+ // Figure out and adjust the size to fill the width of the div
1822
+ var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex];
1823
+ //var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw);
1824
+ var realw = vsize.x + 2, tw = totalDeviceViewWidth - 5, xw = Math.floor(tw / realw);
1825
+ xw = realw + Math.floor((tw - (xw * realw)) / xw);
1826
+ vsize.y = vsize.y * (xw / vsize.x);
1827
+ vsize.x = xw;
1828
+
1829
+ for (var i in multiDesktop) { multiDesktop[i].xxdelete = true; }
1830
+ for (var i in kvmDivs) {
1831
+ var id = kvmDivs[i], shortid = id.split('/')[2], desk = multiDesktop[id];
1832
+ if (desk != null) {
1833
+ // This device already has a canvas, use it.
1834
+ desk.m.CanvasId.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
1835
+ Q('xkvmid_' + shortid).appendChild(desk.m.CanvasId);
1836
+ delete desk.xxdelete;
1837
+ QH('skvmid_' + shortid, ["Odpojeno", "Connecting...", "Setup...", '', ''][((desk.m.State == null)?desk.m.state:desk.m.State)]);
1838
+ } else {
1839
+ var node = getNodeFromId(id);
1840
+ if ((desktopNode == node) && (desktop != null)) { // Check if the main desktop is this device, if it is, use that.
1841
+ // This device already has a canvas, use it.
1842
+ var c = desktop.m.CanvasId;
1843
+ c.setAttribute('id', 'kvmid_' + shortid);
1844
+ c.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
1845
+ c.setAttribute('onclick', 'toggleKvmDevice(\'' + id + '\')');
1846
+ c.removeAttribute('onmousedown');
1847
+ c.removeAttribute('onmouseup');
1848
+ c.removeAttribute('onmousemove');
1849
+ Q('xkvmid_' + shortid).appendChild(c);
1850
+ QH('skvmid_' + shortid, ["Odpojeno", "Connecting...", "Setup...", '', ''][((desktop.m.State == null)?desktop.m.state:desktop.m.State)]);
1851
+ if (desktop.m.SendCompressionLevel) { desktop.m.SendCompressionLevel(1, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); }
1852
+ desktop.shortid = shortid;
1853
+ desktop.onStateChanged = onMultiDesktopStateChange;
1854
+ multiDesktop[id] = desktop;
1855
+ desktop = desktopNode = currentNode = null;
1856
+ // Setup a replacement desktop
1857
+ QH('DeskParent', '<canvas id="Desk" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');
1858
+ } else {
1859
+ // This is a new device, create a canvas for it.
1860
+ var c = document.createElement('canvas');
1861
+ c.setAttribute('id', 'kvmid_' + shortid);
1862
+ c.setAttribute('width', 640);
1863
+ c.setAttribute('height', 480);
1864
+ c.setAttribute('oncontextmenu', 'return false');
1865
+ c.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
1866
+ c.setAttribute('onclick', 'toggleKvmDevice(\'' + id + '\')');
1867
+ try { Q('xkvmid_' + shortid).appendChild(c); } catch (ex) {}
1868
+ // Check if we need to auto-connect
1869
+ if (Q('autoConnectDesktopCheckbox').checked == true) { setTimeout(function() { connectMultiDesktop(node, 1); }, 100); }
1870
+ }
1871
+ }
1872
+ }
1873
+ for (var i in multiDesktop) {
1874
+ // If a device is no longer viewed, disconnect it.
1875
+ if (multiDesktop[i].xxdelete == true) { multiDesktop[i].Stop(); delete multiDesktop[i]; }
1876
+ else if (debugmode && multiDesktop[i].m && multiDesktop[i].m.onScreenSizeChange) {
1877
+ mdeskAdjust(multiDesktop[i].m, multiDesktop[i].m.ScreenWidth, multiDesktop[i].m.ScreenHeight, multiDesktop[i].m.CanvasId); // Adjust screen size change
1878
+ }
1879
+ }
1880
+ deskAdjust();
1881
+ } else {
1882
+ disconnectAllKvmFunction();
1883
+ Q('autoConnectDesktopCheckbox').checked = false;
1884
+ }
1885
+ }
1886
+ oldviewmode = view;
1887
+ }
1888
+
1889
+ function toggleKvmDevice(node) {
1890
+ if (typeof node == 'string') { node = getNodeFromId(node); } // Convert nodeid to node if needed
1891
+ var mesh = meshes[node.meshid], meshrights = mesh.links[userinfo._id].rights;
1892
+ if ((meshrights & 8) || (meshrights & 256)) { // Requires remote control rights or desktop view only rights
1893
+ //var conn = 0;
1894
+ //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)
1895
+ if (node.conn & 1) { connectMultiDesktop(node, 1); }
1896
+ }
1897
+ }
1898
+
1899
+ function getUserShortStr(node) {
1900
+ if (node == null || node.users == null || node.users.length == 0) return '';
1901
+ if (node.users.length > 1) { return '<span title="' + EscapeHtml(node.users.join(', ')) + '">' + nobreak(format("{0} users", node.users.length)) + '</span>'; }
1902
+ var u = node.users[0], su = u, i = u.indexOf('\\');
1903
+ if (i > 0) { su = u.substring(i + 1); }
1904
+ su = EscapeHtml(su);
1905
+ if (su.length > 15) { su = su.substring(0, 14) + '…'; }
1906
+ return '<span title="' + EscapeHtml(u) + '">' + su + '</span>';
1907
+ }
1908
+
1909
+ function autoConnectDesktops() { if (Q('autoConnectDesktopCheckbox').checked == true) { connectAllKvmFunction(); } }
1910
+ function connectAllKvmFunction(force) {
1911
+ if (xxdialogMode) return false;
1912
+ if (force !== true) { // We need to count how many devices will need to be connected, if it's a lot, prompt first.
1913
+ var count = 0;
1914
+ for (var i in nodes) {
1915
+ var node = nodes[i], nodeid = nodes[i]._id;
1916
+ if (multiDesktop[nodeid] == null) {
1917
+ var mesh = meshes[node.meshid], meshrights = mesh.links[userinfo._id].rights;
1918
+ if ((meshrights & 8) || (meshrights & 256)) { // Requires remote control rights or desktop view only rights
1919
+ //var conn = 0;
1920
+ //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)
1921
+ if (node.conn & 1) { count++; }
1922
+ }
1923
+ }
1924
+ }
1925
+ if (count > 8) { setDialogMode(2, "Connect All", 3, function() { connectAllKvmFunction(true); }, format("Are you sure you want to connect to {0} devices?", count)); return; }
1926
+ }
1927
+
1928
+ // Perform connect all
1929
+ for (var i in nodes) { if (multiDesktop[nodes[i]._id] == null) { toggleKvmDevice(nodes[i]._id); } }
1930
+ }
1931
+ function disconnectAllKvmFunction() { if (xxdialogMode) return false; for (var nodeid in multiDesktop) { multiDesktop[nodeid].Stop(); } multiDesktop = {}; }
1932
+ function onMultiDesktopStateChange(desk, state) { try { QH('skvmid_' + desk.shortid, ["Odpojeno", "Connecting...", "Setup...", '', ''][state]); } catch (ex) {} }
1933
+
1934
+ function showMultiDesktopSettings() {
1935
+ QV('d7amtkvm', false);
1936
+ QV('d7meshkvm', true);
1937
+ d7bitmapquality.value = multidesktopsettings.quality;
1938
+ d7bitmapscaling.value = multidesktopsettings.scaling;
1939
+ if (multidesktopsettings.framerate) { d7framelimiter.value = multidesktopsettings.framerate; } else { d7framelimiter.value = 1000; }
1940
+ setDialogMode(7, "Remote Desktop Settings", 3, showMultiDesktopSettingsChanged);
1941
+ }
1942
+
1943
+ function showMultiDesktopSettingsChanged() {
1944
+ multidesktopsettings.quality = d7bitmapquality.value;
1945
+ multidesktopsettings.scaling = d7bitmapscaling.value;
1946
+ multidesktopsettings.framerate = d7framelimiter.value;
1947
+ localStorage.setItem('multidesktopsettings', JSON.stringify(multidesktopsettings));
1948
+ // Make changes to all current connections
1949
+ for (var i in multiDesktop) { multiDesktop[i].m.SendCompressionLevel(1, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); }
1950
+ }
1951
+
1952
+ function connectMultiDesktop(node, contype) {
1953
+ var nodeid = node._id, shortid = nodeid.split('/')[2];
1954
+ var desk = multiDesktop[nodeid];
1955
+ if (desk == null) {
1956
+ if (Q('kvmid_' + shortid) == null) return; // Check if this device is being displayed, if not, exit now.
1957
+ if (contype == 2) {
1958
+ // Setup the Intel AMT remote desktop
1959
+ if ((node.intelamt.user == null) || (node.intelamt.user == '')) { return; }
1960
+ desk = CreateAmtRedirect(CreateAmtRemoteDesktop('kvmid_' + shortid), authCookie);
1961
+ desk.shortid = shortid;
1962
+ //desk.debugmode = debugmode;
1963
+ desk.onStateChanged = onMultiDesktopStateChange;
1964
+ desk.m.bpp = 1;
1965
+ desk.m.useZRLE = true;
1966
+ desk.m.showmouse = true;
1967
+ 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.
1968
+ //desk.m.onScreenSizeChange = deskAdjust;
1969
+ if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust
1970
+ desk.Start(nodeid, 16994, '*', '*', 0);
1971
+ desk.contype = 2;
1972
+ multiDesktop[nodeid] = desk;
1973
+ } else if (contype == 1) {
1974
+ // Setup the Mesh Agent remote desktop
1975
+ desk = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('kvmid_' + shortid), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
1976
+ desk.shortid = shortid;
1977
+ desk.attemptWebRTC = attemptWebRTC;
1978
+ desk.onStateChanged = onMultiDesktopStateChange;
1979
+ //desk.onConsoleMessageChange = function () { console.log('CONSOLEMSG:', desk.consoleMessage); }
1980
+ desk.m.CompressionLevel = multidesktopsettings.quality;
1981
+ desk.m.ScalingLevel = multidesktopsettings.scaling;
1982
+ desk.m.FrameRateTimer = multidesktopsettings.framerate;
1983
+ //desk.m.onDisplayinfo = deskDisplayInfo;
1984
+ //desk.m.onScreenSizeChange = deskAdjust;
1985
+ if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust
1986
+ desk.Start(nodeid);
1987
+ desk.contype = 1;
1988
+ multiDesktop[nodeid] = desk;
1989
+ }
1990
+ } else {
1991
+ // Disconnect and clean up the remote desktop
1992
+ desk.Stop();
1993
+ delete multiDesktop[nodeid];
1994
+ }
1995
+ }
1996
+
1997
+ function getMeshActions(mesh, meshrights) {
1998
+ if ((meshrights & 4) == 0) return '';
1999
+ var r = '';
2000
+ if ((features & 1024) == 0) { // If CIRA is allowed
2001
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new Intel® AMT computer that is located on the internet." + '\" onclick=\'return addCiraDeviceToMesh(\"' + mesh._id + '\")\'>' + "Přidat CIRA" + '</a>';
2002
+ }
2003
+ if (mesh.mtype == 1) {
2004
+ if ((features & 1) == 0) { // If not WAN-Only
2005
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new Intel® AMT computer that is located on the local network." + '\" onclick=\'return addDeviceToMesh(\"' + mesh._id + '\")\'>' + "Add Local" + '</a>';
2006
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new Intel® AMT computer by scanning the local network." + '\" onclick=\'return addAmtScanToMesh(\"' + mesh._id + '\")\'>' + "Scan Network" + '</a>';
2007
+ }
2008
+ if (mesh.amt && (mesh.amt.type == 2)) { // CCM activation
2009
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Perform Intel AMT client control mode (CCM) activation." + '\" onclick=\'return showCcmActivation(\"' + mesh._id + '\")\'>' + "Aktivace" + '</a>';
2010
+ } else if (mesh.amt && (mesh.amt.type == 3) && ((features & 0x00100000) != 0)) { // ACM activation
2011
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Perform Intel AMT admin control mode (ACM) activation." + '\" onclick=\'return showAcmActivation(\"' + mesh._id + '\")\'>' + "Aktivace" + '</a>';
2012
+ }
2013
+ }
2014
+ if (mesh.mtype == 2) {
2015
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new computer to this mesh by installing the mesh agent." + '\" onclick=\'return addAgentToMesh(\"' + mesh._id + '\")\'>' + "Přidat agenta" + '</a>';
2016
+ if ((features & 2) == 0) { r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Pozvat kohokoliv k instalaci agenta pro vzdálené ovládání." + '\" onclick=\'return inviteAgentToMesh(\"' + mesh._id + '\")\'>' + "Pozvat" + '</a>'; }
2017
+ }
2018
+ return r;
2019
+ }
2020
+
2021
+ function addDeviceToMesh(meshid) {
2022
+ if (xxdialogMode) return false;
2023
+ var mesh = meshes[meshid];
2024
+ var x = format("Add a new Intel® AMT device to device group \"{0}\".", EscapeHtml(mesh.name)) + '<br /><br />';
2025
+ x += addHtmlValue("Device Name", '<input id=dp1devicename style=width:230px maxlength=32 autocomplete=off onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
2026
+ x += addHtmlValue("Hostname", '<input id=dp1hostname style=width:230px maxlength=32 autocomplete=off placeholder=\"' + "Same as device name" + '\" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
2027
+ x += addHtmlValue("Uživatel", '<input id=dp1username style=width:230px maxlength=32 autocomplete=off placeholder=\"' + "admin" + '\" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
2028
+ x += addHtmlValue("Heslo", '<input id=dp1password type=password style=width:230px autocomplete=off maxlength=32 onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
2029
+ x += addHtmlValue("Bezpečnost", '<select id=dp1tls style=width:236px><option value=0>' + "Žádné TLS" + '</option><option value=1>' + "TLS vyžadováno" + '</option></select>');
2030
+ setDialogMode(2, "Add Intel® AMT device", 3, addDeviceToMeshEx, x, meshid);
2031
+ validateDeviceToMesh();
2032
+ Q('dp1devicename').focus();
2033
+ return false;
2034
+ }
2035
+
2036
+ // Intel AMT CCM Activation
2037
+ function showCcmActivation(meshid) {
2038
+ if (xxdialogMode) return false;
2039
+ var servername = serverinfo.name, mesh = meshes[meshid];
2040
+ if ((servername.indexOf('.') == -1) || ((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.
2041
+ var url, domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
2042
+ if (serverinfo.https == true) {
2043
+ var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
2044
+ url = 'wss://' + servername + portStr + domainUrl;
2045
+ } else {
2046
+ var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
2047
+ url = 'ws://' + servername + portStr + domainUrl;
2048
+ }
2049
+ var x = format("Perform Intel AMT client control mode (CCM) activation to group \"{0}\" by downloading the MeshCMD tool and running it like this:", EscapeHtml(mesh.name)) + '<br /><br />';
2050
+ x += '<textarea readonly=readonly style=width:100%;resize:none;height:100px;overflow:auto;font-size:12px readonly>meshcmd amtccm --url ' + url + 'amtactivate?id=' + meshid.split('/')[2] + ' --serverhttpshash ' + serverinfo.tlshash + '</textarea>';
2051
+ setDialogMode(2, "Intel® AMT activation", 9, null, x);
2052
+ Q('idx_dlgOkButton').focus();
2053
+ return false;
2054
+ }
2055
+
2056
+ // Intel AMT ACM Activation
2057
+ function showAcmActivation(meshid) {
2058
+ if (xxdialogMode) return false;
2059
+ var servername = serverinfo.name, mesh = meshes[meshid];
2060
+ if ((servername.indexOf('.') == -1) || ((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.
2061
+ var url, domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
2062
+ if (serverinfo.https == true) {
2063
+ var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
2064
+ url = 'wss://' + servername + portStr + domainUrl;
2065
+ } else {
2066
+ var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
2067
+ url = 'ws://' + servername + portStr + domainUrl;
2068
+ }
2069
+ var x = format("Perform Intel AMT admin control mode (ACM) activation to group \"{0}\" by downloading the MeshCMD tool and running it like this:", EscapeHtml(mesh.name)) + '<br /><br />';
2070
+ x += '<textarea readonly=readonly style=width:100%;resize:none;height:100px;overflow:auto;font-size:12px readonly>meshcmd amtacm --url ' + url + 'amtactivate?id=' + meshid.split('/')[2] + ' --serverhttpshash ' + serverinfo.tlshash + '</textarea>';
2071
+ if (serverinfo.amtAcmFqdn != null) {
2072
+ x += ('<div style=margin-top:8px>' + "Intel AMT will need to be set with a Trusted FQDN in MEBx or have a wired LAN on the network:" + ' <b>' + serverinfo.amtAcmFqdn.join(', ') + '</b></div>');
2073
+ }
2074
+ setDialogMode(2, "Intel® AMT activation", 9, null, x);
2075
+ Q('idx_dlgOkButton').focus();
2076
+ return false;
2077
+ }
2078
+
2079
+ // Display the Intel AMT scanning dialog box
2080
+ function addAmtScanToMesh(meshid) {
2081
+ if (xxdialogMode) return false;
2082
+ var x = "Enter a range of IP addresses to scan for Intel AMT devices." + '<br /><br />';
2083
+ 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=\"' + "Skenovat" + '\" onclick=addAmtScanToMeshButton()></input>');
2084
+ x += '<div id=dp1results style="width:100%;height:200px;background-color:white;border:1px gray solid;overflow-y:scroll"></div>';
2085
+ setDialogMode(2, "Scan for Intel® AMT devices", 3, addAmtScanToMeshEx, x, meshid);
2086
+ QE('idx_dlgOkButton', false);
2087
+ 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>');
2088
+ focusTextBox('dp1range');
2089
+ return false;
2090
+ }
2091
+
2092
+ function addAmtScanToMeshKeyUp(e) {
2093
+ if (e.keyCode == 13) { haltEvent(e); addAmtScanToMeshButton(); }
2094
+ }
2095
+
2096
+ // Called when OK is pressed on the Intel AMT scanning box
2097
+ function addAmtScanToMeshEx(button, meshid) {
2098
+ var elements = document.getElementsByClassName('DevScanCheckbox'), checkcount = 0;
2099
+ for (var i=0;i<elements.length;i++) {
2100
+ if (elements[i].checked) {
2101
+ var ipaddr = elements[i].getAttribute('tag');
2102
+ var amtinfo = amtScanResults[ipaddr];
2103
+ meshserver.send({ action: 'addamtdevice', meshid: meshid, devicename: ipaddr, hostname: amtinfo.hostname, amtusername: '', amtpassword: '', amttls: amtinfo.tls });
2104
+ }
2105
+ }
2106
+ }
2107
+
2108
+ // If the user presses the "Scan" button on the Intel AMT scanning dialog box, start a scan.
2109
+ function addAmtScanToMeshButton() {
2110
+ QE('dp1range', false);
2111
+ QE('dp1rangebutton', false);
2112
+ QH('dp1results', '<div style=width:100%;text-align:center;margin-top:12px>' + "Scanning..." + '</div>');
2113
+ meshserver.send({ action: 'scanamtdevice', range: Q('dp1range').value });
2114
+ }
2115
+
2116
+ // Called when a scanned computer is checked or unchecked.
2117
+ function addAmtScanToMeshCheckbox() {
2118
+ var elements = document.getElementsByClassName('DevScanCheckbox'), checkcount = 0;
2119
+ for (var i=0;i<elements.length;i++) { if (elements[i].checked) checkcount++; }
2120
+ QE('idx_dlgOkButton', checkcount > 0);
2121
+ }
2122
+
2123
+ function addCiraDeviceToMesh(meshid) {
2124
+ if (xxdialogMode) return false;
2125
+ var mesh = meshes[meshid];
2126
+
2127
+ // Replace non alphabetic characters (@ and $) with 'X' because MPS username cannot accept it.
2128
+ var meshidx = meshid.split('/')[2].replace(/\@/g, 'X').replace(/\$/g, 'X');
2129
+
2130
+ var y = '<select id=dlgAddCiraSel onclick=dlgAddCiraSelClick() style=width:230px><option value=0>' + "MeshCommander Script" + '</option><option value=1>' + "Manual Username/Password" + '</option>';
2131
+ 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.
2132
+
2133
+ var x = '';
2134
+ x += addHtmlValue("Setup", y);
2135
+ x += '<hr>';
2136
+
2137
+ // Setup CIRA using a MeshCommander script (Pretty Simple)
2138
+ x += '<div id=dlgAddCira0>' + format("To add a new Intel® AMT device to device group \"{0}\" 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.", EscapeHtml(mesh.name)) + '<br /><br />';
2139
+ //x += addHtmlValue('Setup CIRA', '<a href="mescript.ashx?type=1&meshid=' + meshidx.substring(0, 16) + '" download>cira_setup.mescript</a>');
2140
+ x += addHtmlValue("Setup CIRA", '<a href="mescript.ashx?type=1&meshid=' + meshid + '" download>cira_setup.mescript</a>');
2141
+ x += addHtmlValue("Cleanup CIRA", '<a href="mescript.ashx?type=2" download>cira_clean.mescript</a>');
2142
+ x += '</div>';
2143
+
2144
+ // Setup CIRA with user/pass authentication (Somewhat difficult)
2145
+ x += '<div id=dlgAddCira1 style=display:none>' + format("To add a new Intel® AMT device to device group \"{0}\" with CIRA, load the following certificate as trusted root within Intel AMT", EscapeHtml(mesh.name));
2146
+ 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 />'); }
2147
+ x += addHtmlValue("Root Certificate", '<a href=\"' + "MeshServerRootCert.cer" + '\" download>' + "Root Certificate File" + '</a>');
2148
+ x += addHtmlValue("Uživatel", '<input style=width:230px readonly value="' + meshidx.substring(0, 16) + '" />');
2149
+ if (serverinfo.mpspass) { x += addHtmlValue("Heslo", '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpspass) + '" />'); }
2150
+ if (serverinfo != null) { x += addHtmlValue("MPS Server", '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpsname) + ':' + serverinfo.mpsport + '" />'); }
2151
+ x += '</div>';
2152
+
2153
+ // Setup CIRA with certificate authentication (Really difficult, only if TLS offload is not used)
2154
+ if ((features & 16) == 0) {
2155
+ x += '<div id=dlgAddCira2 style=display:none>' + format("To add a new Intel® AMT device to device group \"{0}\" 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.", EscapeHtml(mesh.name)) + '<br /><br />';
2156
+ x += addHtmlValue("Root Certificate", '<a href="MeshServerRootCert.cer" download>' + "Root Certificate File" + '</a>');
2157
+ x += addHtmlValue("Organization", '<input style=width:230px readonly value="' + meshidx + '" />');
2158
+ if (serverinfo != null) { x += addHtmlValue("MPS Server", '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpsname) + ':' + serverinfo.mpsport + '" />'); }
2159
+ x += '</div>';
2160
+ }
2161
+
2162
+ setDialogMode(2, "Add Intel® AMT CIRA device", 2, null, x, 'fileDownload');
2163
+ Q('dlgAddCiraSel').focus();
2164
+ return false;
2165
+ }
2166
+
2167
+ function dlgAddCiraSelClick() {
2168
+ var val = Q('dlgAddCiraSel').value;
2169
+ QV('dlgAddCira0', val == 0);
2170
+ QV('dlgAddCira1', val == 1);
2171
+ QV('dlgAddCira2', val == 2);
2172
+ }
2173
+
2174
+ // Return true is the input string looks like an email address
2175
+ function checkEmail(str) {
2176
+ var x = str.split('@');
2177
+ var ok = ((x.length == 2) && (x[0].length > 0) && (x[1].split('.').length > 1) && (x[1].length > 2));
2178
+ if (ok == true) { var y = x[1].split('.'); for (var i in y) { if (y[i].length == 0) { ok = false; } } }
2179
+ return ok;
2180
+ }
2181
+
2182
+ function inviteAgentToMesh(meshid) {
2183
+ if (xxdialogMode) return false;
2184
+ var x = '', mesh = meshes[meshid];
2185
+ if (features & 64) {
2186
+ x += addHtmlValue("Invitation Type", '<select id=d2InviteType onchange=d2ChangedInviteType() style=width:236px><option value=0>Link invitation</option><option value=1>Email invitation</option></select>') + '<hr />';
2187
+ x += '<div id=emailInviteDiv style=display:none>' + format("Pozvěte někoho k instalaci agenta. Emailem bude zaslán link s adresou agenta pro skupinu \"{0}\".", EscapeHtml(mesh.name)) + '<br /><br />';
2188
+ x += addHtmlValue("Jméno (volitelné)", '<input id=agentInviteName value="" style=width:230px maxlength=64 />');
2189
+ x += addHtmlValue("Email", '<input id=agentInviteEmail style=width:230px placeholder=\"' + "example@email.com" + '\" onkeyup=validateAgentInvite()></input>');
2190
+ x += addHtmlValue("Operační systém", '<select id=agentInviteNameOs onchange=d2ChangedInviteType() style=width:236px><option value=4>' + "Odeslat odkaz na instalaci" + '</option><option value=0 selected>' + "Any supported" + '</option><option value=1>' + "Windows only" + '</option><option value=3>' + "Apple MacOS only" + '</option><option value=2>' + "Linux only" + '</option></select>');
2191
+ x += '<div id=d2agentexpirediv>';
2192
+ x += addHtmlValue("Platnost linku", '<select id=agentInviteExpire style=width:236px><option value=1>' + "1 hodina" + '</option><option value=8>' + "8 hodin" + '</option><option value=24>' + "1 den" + '</option><option value=168>' + "1 týden" + '</option><option value=5040>' + "1 měsíc" + '</option><option value=0>' + "Bez limitu" + '</option></select>');
2193
+ x += '</div>';
2194
+ x += addHtmlValue("Typ instalace", '<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>');
2195
+ x += addHtmlValue("Message" + '<br />' + "(volitelné)", '<textarea id=agentInviteMessage value="" style=width:230px;height:100px;resize:none maxlength=1024 /></textarea>');
2196
+ x += '</div>';
2197
+ }
2198
+ x += '<div id=urlInviteDiv>' + format("Pozvěte někoho k instalaci agenta pomocí sdíleného odkazu. Tento link obsahuje instrukce pro instalaci do skupiny \"{0}\". Link je veřejný a protistrana nepotřebuje žádný účet na tomto serveru.", EscapeHtml(mesh.name)) + '<br /><br />';
2199
+ x += addHtmlValue("Platnost linku", '<select id=d2inviteExpire style=width:236px onchange=d2RequestInvitationLink()><option value=1>' + "1 hodina" + '</option><option value=8>' + "8 hodin" + '</option><option value=24>' + "1 den" + '</option><option value=168>' + "1 týden" + '</option><option value=5040>' + "1 měsíc" + '</option><option value=0>' + "Bez limitu" + '</option></select>');
2200
+ x += '<div id=agentInvitationLinkDiv style="text-align:center;font-size:large;margin:16px;display:none"><a href=# id=agentInvitationLink target="_blank" style=cursor:pointer></a> <img src=images/link4.png height=10 width=10 title=\"' + "Copy link to clipboard" + '\" style=cursor:pointer onclick=d2CopyInviteToClip()></div></div>';
2201
+ setDialogMode(2, "Pozvat", 3, performAgentInvite, x, meshid);
2202
+ if (features & 64) { Q('d2InviteType').focus(); d2ChangedInviteType(); } else { Q('d2inviteExpire').focus(); validateAgentInvite(); }
2203
+ d2RequestInvitationLink();
2204
+ return false;
2205
+ }
2206
+
2207
+ function d2RequestInvitationLink() {
2208
+ meshserver.send({ action: 'createInviteLink', meshid: xxdialogTag, expire: parseInt(Q('d2inviteExpire').value), flags: 0 });
2209
+ }
2210
+
2211
+ function d2ChangedInviteType() {
2212
+ QV('urlInviteDiv', Q('d2InviteType').value == 0);
2213
+ QV('d2agentexpirediv', Q('agentInviteNameOs').value == 4);
2214
+ QV('emailInviteDiv', Q('d2InviteType').value == 1);
2215
+ validateAgentInvite();
2216
+ }
2217
+
2218
+ function d2CopyInviteToClip() { copyTextToClip(Q('agentInvitationLink').href); }
2219
+
2220
+ function validateAgentInvite() {
2221
+ if ((features & 64) && (Q('d2InviteType').value == 1)) {
2222
+ QE('idx_dlgOkButton', checkEmail(Q('agentInviteEmail').value));
2223
+ QV('idx_dlgCancelButton', true);
2224
+ } else {
2225
+ QE('idx_dlgOkButton', true);
2226
+ QV('idx_dlgCancelButton', false);
2227
+ }
2228
+ }
2229
+
2230
+ function performAgentInvite(button, meshid) {
2231
+ if ((features & 64) && (Q('d2InviteType').value == 1)) {
2232
+ 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, expire: parseInt(Q('agentInviteExpire').value) });
2233
+ }
2234
+ }
2235
+
2236
+ function addAgentToMesh(meshid) {
2237
+ if (xxdialogMode) return false;
2238
+ var mesh = meshes[meshid], x = '', installType = 0;
2239
+ x += addHtmlValue("Operační systém", '<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>' + "Windows" + '</option><option value=1>' + "Linux / BSD" + '</option><option value=2>' + "Apple MacOS" + '</option><option value=3>' + "Windows (UnInstall)" + '</option><option value=4>' + "Linux / BSD (UnInstall)" + '</option></select>');
2240
+ x += '<div id=aginsTypeDiv>';
2241
+ x += addHtmlValue("Typ instalace", '<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>');
2242
+ x += '</div><hr>';
2243
+
2244
+ // \/:*?"<>|
2245
+ var meshfilename = mesh.name
2246
+ meshfilename = meshfilename.split('\\').join('').split('/').join('').split(':').join('').split('*').join('').split('?').join('').split('"').join('').split('<').join('').split('>').join('').split('|').join('').split(' ').join('').split('\'').join('');
2247
+
2248
+ // Windows agent install
2249
+ //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 />";
2250
+ x += '<div id=agins_windows>' + format("Pro přidání nového zařízení do skupiny \"{0}\", si stáhněte agenta a nainstalujte na zařízení, které chcete spravovat. Tento agent již obsahuje veškeré informace pro připojení na server.", EscapeHtml(mesh.name)) + '<br /><br />';
2251
+ x += addHtmlValue("Mesh Agent", '<a id=aginsw32lnk href="meshagents?id=3&meshid=' + meshid.split('/')[2] + '&installflags=0" download onclick="setDialogMode(0)" title=\"' + "32bit version of the MeshAgent" + '\">' + "Windows (.exe)" + '</a> <img src=images/link4.png height=10 width=10 title="Copy Windows 32bit agent URL to clipboard" style=cursor:pointer onclick=copyAgentUrl("meshagents?id=3&meshid=' + meshid.split('/')[2] + '&installflags=",1)>');
2252
+ x += addHtmlValue("Mesh Agent", '<a id=aginsw64lnk href="meshagents?id=4&meshid=' + meshid.split('/')[2] + '&installflags=0" download onclick="setDialogMode(0)" title=\"' + "64bit version of the MeshAgent" + '\">' + "Windows x64 (.exe)" + '</a> <img src=images/link4.png height=10 width=10 title="Copy Windows 64bit agent URL to clipboard" style=cursor:pointer onclick=copyAgentUrl("meshagents?id=4&meshid=' + meshid.split('/')[2] + '&installflags=",1)>');
2253
+ if (debugmode > 0) { x += addHtmlValue("Settings File", '<a id=aginswmshlnk href="meshsettings?id=' + meshid.split('/')[2] + '&installflags=0" rel="noreferrer noopener" target="_blank">' + format("{0} settings (.msh)", EscapeHtml(mesh.name)) + '</a>'); }
2254
+ x += '</div>';
2255
+
2256
+ // Linux agent install
2257
+ x += '<div id=agins_linux style=display:none>' + format("Pro přidání do {0} spusťte následující příkaz. Je třeba spouštět pod rootem.", EscapeHtml(mesh.name)) + '<br />';
2258
+ 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>';
2259
+ x += '<div style=\'font-size:x-small\'>' + "* For BSD, run \"pkg install wget sudo bash\" first." + '</div></div>';
2260
+
2261
+ // MacOS agent install
2262
+ x += '<div id=agins_osx style=display:none>' + format("Pro přidání do skupiny \"{0}\", si musíte stáhnout agenta a nainstalovat ho na počítači, který chcete spravovat. Tento agent má všechny potřebné informace pro připojení již v sobě.", EscapeHtml(mesh.name)) + '<br /><br />';
2263
+ x += addHtmlValue("Mesh Agent", '<a href="meshosxagent?id=16&meshid=' + meshid.split('/')[2] + '" rel="noreferrer noopener" target="_blank" title="64bit version of MacOS Mesh Agent">MacOS Agent (64bit)</a> <img src=images/link4.png height=10 width=10 title="' + "Kopírovat odkaz pro MacOS agenta do schránky" + '" style=cursor:pointer onclick=copyAgentUrl("meshosxagent?id=16&meshid=' + meshid.split('/')[2] + '",0)>');
2264
+ x += '</div>';
2265
+
2266
+ // Windows agent uninstall
2267
+ x += '<div id=agins_windows_un style=display:none>' + "Pro odstranění agenta si stáhněte soubor níže, spusťte tento soubor a zvolte \"uninstall\"." + '<br /><br />';
2268
+ x += addHtmlValue("Mesh Agent", '<a href="meshagents?id=3" download onclick="setDialogMode(0)" title="' + "32bit version of the MeshAgent" + '">' + "Windows (.exe)" + '</a>');
2269
+ x += addHtmlValue("Mesh Agent", '<a href="meshagents?id=4" download onclick="setDialogMode(0)" title="' + "64bit version of the MeshAgent" + '">' + "Windows x64 (.exe)" + '</a>');
2270
+ x += '</div>';
2271
+
2272
+ // Linux agent uninstall
2273
+ x += '<div id=agins_linux_un style=display:none>' + "To remove a mesh agent, run the following command. Root credentials will be needed." + '<br />';
2274
+ 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>';
2275
+ x += '</div>';
2276
+
2277
+ setDialogMode(2, "Přidat agenta", 2, null, x, 'fileDownload');
2278
+ var servername = serverinfo.name;
2279
+ if ((servername.indexOf('.') == -1) || ((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.
2280
+ var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
2281
+
2282
+ if (serverinfo.https == true)
2283
+ {
2284
+ var portStr = (serverinfo.port == 443)?'':(':' + serverinfo.port);
2285
+ if ((features & 0x2000) == 0)
2286
+ {
2287
+ Q('agins_linux_area').value = '(wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
2288
+ Q('agins_linux_area_un').value = '(wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
2289
+ }
2290
+ else
2291
+ {
2292
+ // Server asked that agent be installed to preferably not use a HTTP proxy.
2293
+ Q('agins_linux_area').value = 'wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
2294
+ Q('agins_linux_area_un').value = 'wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
2295
+ }
2296
+ }
2297
+ else
2298
+ {
2299
+ var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
2300
+ if ((features & 0x2000) == 0)
2301
+ {
2302
+ Q('agins_linux_area').value = '(wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 -O ./meshinstall.sh || wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
2303
+ Q('agins_linux_area_un').value = '(wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 -O ./meshinstall.sh || wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
2304
+ }
2305
+ else
2306
+ {
2307
+ // Server asked that agent be installed to preferably not use a HTTP proxy.
2308
+ Q('agins_linux_area').value = 'wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
2309
+ Q('agins_linux_area_un').value = 'wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
2310
+ }
2311
+ }
2312
+ Q('aginsSelect').focus();
2313
+ addAgentToMeshClick();
2314
+ return false;
2315
+ }
2316
+
2317
+ function copyAgentUrl(url,addflag) {
2318
+ var servername = serverinfo.name;
2319
+ if ((servername.indexOf('.') == -1) || ((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.
2320
+ var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
2321
+ var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
2322
+ var c = 'https://' + servername + portStr + domainUrl + url;
2323
+ if (addflag == 1) c += Q('aginsType').value;
2324
+ copyTextToClip(c);
2325
+ }
2326
+
2327
+ function addAgentToMeshClick() {
2328
+ var v = Q('aginsSelect').value;
2329
+ QV('agins_windows', v == 0);
2330
+ QV('agins_linux', v == 1);
2331
+ QV('agins_osx', v == 2);
2332
+ QV('agins_windows_un', v == 3);
2333
+ QV('agins_linux_un', v == 4);
2334
+ QV('aginsTypeDiv', v == 0);
2335
+
2336
+ // Fix the links if needed
2337
+ Q('aginsw32lnk').href = (Q('aginsw32lnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value;
2338
+ Q('aginsw64lnk').href = (Q('aginsw64lnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value;
2339
+ if (debugmode > 0) { Q('aginswmshlnk').href = (Q('aginswmshlnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value; }
2340
+ }
2341
+
2342
+ function validateDeviceToMesh() {
2343
+ QE('idx_dlgOkButton', (Q('dp1devicename').value.length > 0) && (passwordcheck(Q('dp1password').value)));
2344
+ }
2345
+
2346
+ function addDeviceToMeshEx(button, meshid) {
2347
+ var amtuser = Q('dp1username').value;
2348
+ if (amtuser == '') amtuser = 'admin';
2349
+ var host = Q('dp1hostname').value;
2350
+ if (host == '') host = Q('dp1devicename').value;
2351
+ meshserver.send({ action: 'addamtdevice', meshid: meshid, devicename: Q('dp1devicename').value, hostname: host, amtusername: amtuser, amtpassword: Q('dp1password').value, amttls: Q('dp1tls').value });
2352
+ }
2353
+
2354
+ function deviceHeaderSet() {
2355
+ if (deviceHeaderId == 0) { deviceHeaderId = 1; return; }
2356
+ deviceHeaders['DevxHeader' + deviceHeaderId] = ((deviceHeaderTotal == 1) ? "1 node" : format("{0} zařízení", deviceHeaderTotal));
2357
+ //var title = '';
2358
+ //for (x in deviceHeaderCount) { if (title.length > 0) title += ', '; title += deviceHeaderCount[x] + ' ' + PowerStateStr2(x); }
2359
+ //deviceHeadersTitles["DevxHeader" + deviceHeaderId] = title;
2360
+ deviceHeaderId++;
2361
+ deviceHeaderCount = {};
2362
+ deviceHeaderTotal = 0;
2363
+ }
2364
+
2365
+ var powerStateStrings = ['', '<span title=\"' + "Device is powered on." + '\">' + "Zapnuto" + '</span>', '<span title=\"' + "Device is in sleep state (S1)." + '\">' + "Sleeping" + '</span>', '<span title=\"' + "Device is in sleep state (S2)." + '\">' + "Sleeping" + '</span>', '<span title=\"' + "Zařízení je v hlubokém spánku (S3)." + '\">' + "Deep Sleep" + '</span>', '<span title=\"' + "Device is in hibernating state (S4)." + '\">' + "Hibernating" + '</span>', '<span title=\"' + "Zařízení je vypnuto (S5)." + '\">' + "Soft-Off" + '</span>', '<span title=\"' + "Zařízení je detekováno, ale nelze zjistit stav." + '\">' + "Present" + '</span>'];
2366
+ var powerStateStrings2 = ['', "Zařízení je zapnuto", "Zařízení je ve stavu spánku (S1)", "Device is in sleep state (S2)", "Zařízení je v hlubokém spánku (S3)", "Device is hibernating (S4)", "Device is in soft-off state (S5)", "Device is present, but power state cannot be determined"];
2367
+ var powerColorTable = ['pwsTransparent', 'pwsBlack', 'pwsBlue', 'pwsBlue2', 'pwsLightblue', 'pwsBlueviolet', 'pwsDarkgreen', 'pwsLightseagreen', 'pwsLightseagreen2'];
2368
+ function NodeStateStr(node) {
2369
+ var states = [];
2370
+ if (node.state > 0 && node.state < powerStatetable.length) state.push(powerStatetable[node.state]);
2371
+ if (node.conn) {
2372
+ if ((node.conn & 1) != 0) { states.push('<span title=\"' + "Agent je připojen a připraven." + '\">' + "Agent" + '</span>'); }
2373
+ if ((node.conn & 2) != 0) { states.push('<span title=\"' + "Intel® AMT CIRA is connected and ready for use." + '\">' + "CIRA" + '</span>'); }
2374
+ else if ((node.conn & 4) != 0) { states.push('<span title=\"' + "Intel® AMT is routable." + '\">' + "AMT" + '</span>'); }
2375
+ if ((node.conn & 8) != 0) { states.push('<span title=\"' + "Mesh agent is reachable using another agent as relay." + '\">' + "Relay" + '</span>'); }
2376
+ if ((node.conn & 16) != 0) { states.push('<span title=\"' + "MQTT connection to the device is active." + '\">' + "MQTT" + '</span>'); }
2377
+ }
2378
+ if ((node.pwr != null) && (node.pwr != 0)) { states.push(powerStateStrings[node.pwr]); }
2379
+ return states.join(', ');
2380
+ }
2381
+
2382
+ function PowerStateStr(x) {
2383
+ if (x < powerStatetable.length) return powerStatetable[x];
2384
+ return '';
2385
+ }
2386
+
2387
+ function PowerStateStr2(x) {
2388
+ if ((x != 0) && (x < powerStatetable.length)) return powerStatetable[x];
2389
+ return "Unknown";
2390
+ }
2391
+
2392
+ function selectallButtonFunction() {
2393
+ var elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
2394
+ for (var i=0;i<elements.length;i++) { if (elements[i].checked === true) checkcount++; }
2395
+ for (var i=0;i<elements.length;i++) { elements[i].checked = (checkcount == 0); }
2396
+ p1updateInfo();
2397
+ }
2398
+
2399
+ function p1updateInfo() {
2400
+ var elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
2401
+ for (var i=0;i<elements.length;i++) { if (elements[i].checked === true) { checkcount++; } }
2402
+ if (checkcount > 0) {
2403
+ QE('GroupActionButton', true);
2404
+ Q('SelectAllButton').value = "Vybrat nic";
2405
+ QV('cxmgroupsplit', true);
2406
+ QV('cxmdesktop', true);
2407
+ } else {
2408
+ QE('GroupActionButton', false);
2409
+ Q('SelectAllButton').value = "Vybrat vše";
2410
+ QV('cxmgroupsplit', false);
2411
+ QV('cxmdesktop', false);
2412
+ }
2413
+ }
2414
+
2415
+ function groupActionFunction() {
2416
+ var addedOptions = '', nodeids = getCheckedDevices();
2417
+
2418
+ // Check if any of the selected devices have a MQTT connection active
2419
+ if (features & 0x00400000) {
2420
+ for (var i in nodeids) { if ((getNodeFromId(nodeids[i]).conn & 16) != 0) { addedOptions += '<option value=103>' + "Send MQTT Message" + '</option>'; break; } }
2421
+ }
2422
+
2423
+ // Display the "Uninstall Agent" option if allowed and we selected connected devices.
2424
+ for (var i in nodeids) {
2425
+ var node = getNodeFromId(nodeids[i]);
2426
+ var mesh = meshes[node.meshid];
2427
+ var meshrights = mesh.links[userinfo._id].rights;
2428
+ if (((node.conn & 1) != 0) && ((meshrights & 32768) != 0)) { addedOptions += '<option value=104>' + "Uninstall Agent" + '</option>'; break; }
2429
+ }
2430
+
2431
+ var x = "Select an operation to perform on all selected devices. Actions will be performed only with proper rights." + '<br /><br />';
2432
+ x += addHtmlValue("Operace", '<select id=d2groupop><option value=100>' + "Probudit zařízení" + '</option><option value=4>' + "Sleep devices" + '</option><option value=3>' + "Reset zařízení" + '</option><option value=2>' + "Vypnout zařízení" + '</option><option value=102>' + "Přesunout do skupiny zařízení" + '</option>' + addedOptions + '<option value=101>' + "Delete devices" + '</option></select>');
2433
+ setDialogMode(2, "Akce skupiny", 3, groupActionFunctionEx, x);
2434
+ }
2435
+
2436
+ // Get the list of checked devices, removes any duplicates.
2437
+ function getCheckedDevices() {
2438
+ var nodeids = [], elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
2439
+ 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); } } } }
2440
+ return nodeids;
2441
+ }
2442
+
2443
+ function groupActionFunctionEx() {
2444
+ var op = Q('d2groupop').value;
2445
+ if (op == 100) {
2446
+ // Group wake
2447
+ meshserver.send({ action: 'wakedevices', nodeids: getCheckedDevices() });
2448
+ } else if (op == 101) {
2449
+ // Group delete, ask for confirmation
2450
+ var x = "Potvrdit smázání vybraných zařízení?" + '<br /><br />';
2451
+ x += '<label><input id=d2check type=checkbox onchange=d2groupActionFunctionDelEx() />' + "Confirm" + '</label>';
2452
+ setDialogMode(2, "Smazat nody", 3, groupActionFunctionDelEx, x);
2453
+ QE('idx_dlgOkButton', false);
2454
+ } else if (op == 102) {
2455
+ // Move computers to a different group
2456
+ p10showChangeGroupDialog(getCheckedDevices());
2457
+ } else if (op == 103) {
2458
+ // Send MQTT Message
2459
+ p10showSendMqttMsgDialog(getCheckedDevices());
2460
+ } else if (op == 104) {
2461
+ // Uninstall agent
2462
+ p10showSendUninstallAgentDialog(getCheckedDevices());
2463
+ } else {
2464
+ // Power operation
2465
+ meshserver.send({ action: 'poweraction', nodeids: getCheckedDevices(), actiontype: parseInt(op) });
2466
+ }
2467
+ }
2468
+
2469
+ function d2groupActionFunctionDelEx() { QE('idx_dlgOkButton', Q('d2check').checked); }
2470
+ function groupActionFunctionDelEx() { meshserver.send({ action: 'removedevices', nodeids: getCheckedDevices() }); }
2471
+
2472
+ function onSortSelectChange(skipsave) {
2473
+ sort = document.getElementById('sortselect').selectedIndex;
2474
+ if (!skipsave) { putstore('sort', sort); }
2475
+ }
2476
+
2477
+ 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; }
2478
+ 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; }
2479
+ function deviceSort(a, b) { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; }
2480
+ function deviceHostSort(a, b) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; }
2481
+ function onSearchFocus(x) { searchFocus = x; }
2482
+ function onMapSearchFocus(x) { mapSearchFocus = x; }
2483
+ function onUserSearchFocus(x) { userSearchFocus = x; }
2484
+ function onConsoleFocus(x) { consoleFocus = x; }
2485
+
2486
+ function onSearchInputChanged() {
2487
+ var x = Q('SearchInput').value.toLowerCase().trim(); putstore('_search', x);
2488
+ var userSearch = null, ipSearch = null, groupSearch = null;
2489
+ if (x.startsWith('user:')) { userSearch = x.substring(5); }
2490
+ else if (x.startsWith('u:')) { userSearch = x.substring(2); }
2491
+ else if (x.startsWith('ip:')) { ipSearch = x.substring(3); }
2492
+ else if (x.startsWith('group:')) { groupSearch = x.substring(6); }
2493
+ else if (x.startsWith('g:')) { groupSearch = x.substring(2); }
2494
+
2495
+ if (x == '') {
2496
+ // No search
2497
+ for (var d in nodes) { nodes[d].v = true; }
2498
+ } else if (ipSearch != null) {
2499
+ // IP address search
2500
+ for (var d in nodes) { nodes[d].v = ((nodes[d].ip != null) && (nodes[d].ip.indexOf(ipSearch) >= 0)); }
2501
+ } else if (groupSearch != null) {
2502
+ // Group filter
2503
+ for (var d in nodes) { nodes[d].v = (meshes[nodes[d].meshid].name.toLowerCase().indexOf(groupSearch) >= 0); }
2504
+ } else if (userSearch != null) {
2505
+ // User search
2506
+ for (var d in nodes) {
2507
+ nodes[d].v = false;
2508
+ if (nodes[d].users && nodes[d].users.length > 0) { for (var i in nodes[d].users) { if (nodes[d].users[i].toLowerCase().indexOf(userSearch) >= 0) { nodes[d].v = true; } } }
2509
+ }
2510
+ } else {
2511
+ // Device name search
2512
+ try {
2513
+ var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
2514
+ for (var d in nodes) {
2515
+ nodes[d].v = (rx.test(nodes[d].name.toLowerCase())) || (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase()));
2516
+ if ((nodes[d].v == false) && nodes[d].tags) {
2517
+ for (var s in nodes[d].tags) {
2518
+ if (rx.test(nodes[d].tags[s].toLowerCase())) {
2519
+ nodes[d].v = true;
2520
+ break;
2521
+ } else {
2522
+ nodes[d].v = false;
2523
+ }
2524
+ }
2525
+ }
2526
+ }
2527
+ } catch (ex) { for (var d in nodes) { nodes[d].v = true; } }
2528
+ }
2529
+ }
2530
+
2531
+ var contextelement = null;
2532
+ function handleContextMenu(event) {
2533
+ hideContextMenu();
2534
+ var scrollLeft = (window.pageXOffset !== null) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
2535
+ var scrollTop = (window.pageYOffset !== null) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
2536
+ var elem = document.elementFromPoint(event.pageX - scrollLeft, event.pageY - scrollTop);
2537
+ if (elem && elem != null && elem.id == 'connectbutton2' && currentNode && currentNode.agent && (currentNode.agent.id > 0) && (currentNode.agent.id < 5)) {
2538
+ contextelement = elem;
2539
+ var contextmenudiv = document.getElementById('termShellContextMenu');
2540
+ contextmenudiv.style.left = event.pageX + 'px';
2541
+ contextmenudiv.style.top = event.pageY + 'px';
2542
+ contextmenudiv.style.display = 'block';
2543
+ } else if (elem && elem != null && elem.id == 'connectbutton2' && currentNode && currentNode.agent && (currentNode.agent.id > 4)) {
2544
+ contextelement = elem;
2545
+ var contextmenudiv = document.getElementById('termShellContextMenuLinux');
2546
+ contextmenudiv.style.left = event.pageX + 'px';
2547
+ contextmenudiv.style.top = event.pageY + 'px';
2548
+ contextmenudiv.style.display = 'block';
2549
+ } else if (elem && elem != null && elem.id == 'MxMESH') {
2550
+ contextelement = elem;
2551
+ var contextmenudiv = document.getElementById('meshContextMenu');
2552
+ contextmenudiv.style.left = event.pageX + 'px';
2553
+ contextmenudiv.style.top = event.pageY + 'px';
2554
+ contextmenudiv.style.display = 'block';
2555
+ /*} else if (elem && elem != null && elem.classList.contains('pluginTab')) {
2556
+ contextelement = elem;
2557
+ var contextmenudiv = document.getElementById('pluginTabContextMenu');
2558
+ contextmenudiv.style.left = event.pageX + 'px';
2559
+ contextmenudiv.style.top = event.pageY + 'px';
2560
+ contextmenudiv.style.display = 'block';*/
2561
+ } else {
2562
+ while (elem && elem != null && elem.id != 'devs') { elem = elem.parentElement; }
2563
+ if (!elem || elem == null) return true;
2564
+ contextelement = elem;
2565
+ var contextmenudiv = document.getElementById('contextMenu');
2566
+ contextmenudiv.style.left = event.pageX + 'px';
2567
+ contextmenudiv.style.top = event.pageY + 'px';
2568
+ contextmenudiv.style.display = 'block';
2569
+
2570
+ // Get the node and set the menu options
2571
+ var nodeid = contextelement.children[1].attributes.onclick.value;
2572
+ var node = getNodeFromId(nodeid.substring(12, nodeid.length - 18));
2573
+ var mesh = meshes[node.meshid];
2574
+ var meshlinks = mesh.links[userinfo._id];
2575
+ var meshrights = meshlinks.rights;
2576
+ var consoleRights = ((meshrights & 16) != 0);
2577
+
2578
+ // Check if we have terminal and file access
2579
+ var terminalAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 512) == 0));
2580
+ var fileAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 1024) == 0));
2581
+
2582
+ 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)));
2583
+ 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) && terminalAccess);
2584
+ QV('cxfiles', ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 4) != 0))) && (meshrights & 8) && fileAccess);
2585
+ QV('cxevents', (node.intelamt != null) && ((node.intelamt.state == 2) || (node.conn & 2)) && (meshrights & 8));
2586
+ QV('cxconsole', (consoleRights && (mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 8) != 0))) && (meshrights & 8));
2587
+ }
2588
+
2589
+ return haltEvent(event);
2590
+ }
2591
+
2592
+ function cmaction(action,event) {
2593
+ var nodeid = contextelement.children[1].attributes.onclick.value;
2594
+ nodeid = nodeid.substring(12, nodeid.length - 18);
2595
+ if (action == 7) { Q('viewselect').value = 3; Q('viewselect').onchange(); Q('autoConnectDesktopCheckbox').checked = true; Q('autoConnectDesktopCheckbox').onclick(); } // Multi-Desktop
2596
+ if ((action > 0) && (action < 7)) {
2597
+ var panel = [0, 10, 12, 11, 13, 16, 15][action]; // (invalid), General, Desktop, Terminal, Files, Events, Console
2598
+ if (event && (event.shiftKey == true)) {
2599
+ // Open the device in a different tab
2600
+ window.open(window.location.origin + '?node=' + nodeid.split('/')[2] + '&viewmode=' + panel + '&hide=16', 'meshcentral:' + nodeid);
2601
+ } else {
2602
+ // Go to the right panel
2603
+ gotoDevice(nodeid, panel);
2604
+
2605
+ // If possible, connect...
2606
+ var mesh = meshes[currentNode.meshid];
2607
+ if ((currentNode.conn & 1) && (mesh.mtype == 2)) {
2608
+ if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 1); } // Desktop
2609
+ if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal
2610
+ if ((panel == 13) && (files == null)) { connectFiles(null); } // files
2611
+ }
2612
+ }
2613
+ }
2614
+ }
2615
+
2616
+ function cmmeshaction(action) {
2617
+ var meshid = contextelement.attributes.onclick.value.substring(10, contextelement.attributes.onclick.value.length - 2);
2618
+ var elements = document.getElementsByClassName('DeviceCheckbox');
2619
+ if ((action == 1) || (action == 2)) {
2620
+ for (var i = 0; i < elements.length; i++) {
2621
+ if ((elements[i].attributes) && (elements[i].attributes['class']['value'].split(' ')[0] == meshid)) { elements[i].checked = (action == 1); }
2622
+ }
2623
+ }
2624
+ //if (action == 3) { window.location = "multidesktop.aspx?mesh=" + meshid + "&auto=1"; }
2625
+ p1updateInfo();
2626
+ }
2627
+
2628
+ function cmtermaction(action) {
2629
+ connectTerminal(null, 1, { protocol: action });
2630
+ }
2631
+
2632
+ /*
2633
+ function pluginTabClose() {
2634
+ var pluginTab = contextelement;
2635
+ var pname = pluginTab.getAttribute('x-data-plugin-sname');
2636
+ var pdiv = Q('plugin-'+pname);
2637
+ pdiv.parentNode.removeChild(pdiv);
2638
+ pluginTab.parentNode.removeChild(pluginTab);
2639
+ QV('p42', true);
2640
+ goPlugin(-1);
2641
+ }
2642
+ */
2643
+
2644
+ function hideContextMenu() {
2645
+ QV('contextMenu', false);
2646
+ QV('meshContextMenu', false);
2647
+ QV('termShellContextMenu', false);
2648
+ QV('termShellContextMenuLinux', false);
2649
+ //QV('pluginTabContextMenu', false);
2650
+ contextelement = null;
2651
+ }
2652
+
2653
+ //
2654
+ // DEVICES MAP
2655
+ //
2656
+
2657
+ // Maps code starts from here. Initialize all the variables
2658
+ var xxmap = {
2659
+ map: null,
2660
+ contextmenu: null,
2661
+ activeInteractions: [], // Save Modified features in this list
2662
+ showindex: 0,
2663
+ markersSource: null, // Initialize a Source Vector
2664
+ markersLayer: null,
2665
+ mapLayer: null, // Create a tile and use OSM source
2666
+ mapView: null, // Sets the initial view
2667
+ }
2668
+
2669
+ // Add a feature for every Node and change style if connection status changes
2670
+ function updateMapMarkers(selectedMesh) {
2671
+ if ((xxmap != null) && (xxmap.map == null)) { try { loadmap(); } catch (ex) { console.error('loadmap() exception', ex); } }
2672
+ if (xxmap == null) return;
2673
+ var boundingBox = null;
2674
+ for (var i in nodes) {
2675
+ try {
2676
+ var loc = map_parseNodeLoc(nodes[i]), feature = xxmap.markersSource.getFeatureById(nodes[i]._id);
2677
+ if ((loc != null) && ((nodes[i].meshid == selectedMesh) || (selectedMesh == null))) { // Draw markers for devices with locations
2678
+ var lat = loc[0], lon = loc[1], type = loc[2];
2679
+ 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; } }
2680
+ if (feature == null) { addFeature(nodes[i]); boundingBox[4] = 1; } else { updateFeature(nodes[i], feature); feature.setStyle(markerStyle(nodes[i], loc[2])); } // Update Feature
2681
+ } else {
2682
+ if (feature) { xxmap.markersSource.removeFeature(feature); }
2683
+ }
2684
+ } catch (ex) { console.error('updateMapMarkers() exception', ex, JSON.stringify(nodes[i])); }
2685
+ }
2686
+ return boundingBox;
2687
+ }
2688
+
2689
+ // Show node details on hovering over a feature
2690
+ var map_cm_popup = new ol.Overlay({ element: Q('xmap-info-window'), positioning: 'bottom-center', stopEvent: false });
2691
+
2692
+ // Edit Marker item
2693
+ var map_cm_editMarker = { text: "Modify node location", callback: function (obj) { modifyMarkerloc(obj.data); } };
2694
+
2695
+ // Clear Marker item
2696
+ var map_cm_clearMarker = { text: "Remove node location", callback: function (obj) {
2697
+ meshserver.send({ action: 'changedevice', nodeid: obj.data.a, userloc: [] }); // Clear the user position marker
2698
+ }};
2699
+
2700
+ // Save Marker item
2701
+ var map_cm_saveMarker = { text: "Save node location", callback: function (obj) { saveMarkerloc(obj.data); } };
2702
+
2703
+ // Build a context menu for a feature
2704
+ var map_cm_nodemenu_items = [
2705
+ { text: "Obecné informace", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 10); } } },
2706
+ { text: "Plocha", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 11); } } },
2707
+ { text: "Terminál", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 12); } } },
2708
+ { text: "Intel® AMT", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 14); } } },
2709
+ '-',
2710
+ { text: "Zoom-in to extent", callback: function(obj) { var coords = obj.data.getGeometry().getCoordinates(); zoomToLocation(coords, 19); } },
2711
+ { text: "Zoom-out to extent", callback: function(obj) { var coords = obj.data.getGeometry().getCoordinates(); zoomToLocation(coords, 2); } }
2712
+ ];
2713
+
2714
+ // Context menu for clicks other than on feature
2715
+ var contextmenu_items = [
2716
+ { text: "Obnovit", callback: function () { refreshMap(true, true); } },
2717
+ { text: "Zoom to fit extent", callback: function () { zoomToFitExtent(); } },
2718
+ { text: "Center map here", callback: function(obj) { xxmap.mapView.animate({ center: obj.coordinate } ); } },
2719
+ { text: "Place node here", callback: function(obj) { placeNode(obj.coordinate); } }
2720
+ ];
2721
+
2722
+ function stringToIntHash(str) {
2723
+ var hash = 0, i;
2724
+ for (i = 0; i < str.length; i++) { hash = ((hash << 5) - hash) + str.charCodeAt(i); hash |= 0; }
2725
+ return hash;
2726
+ };
2727
+
2728
+ // Get the lat/lon from a node
2729
+ function map_parseNodeLoc(node) {
2730
+ var loc = null, t = 0;
2731
+ if (node.iploc) { loc = node.iploc; t = 1; }
2732
+ if (node.wifiloc) { loc = node.wifiloc; t = 2; }
2733
+ if (node.gpsloc) { loc = node.gpsloc; t = 3; }
2734
+ if (node.userloc) { loc = node.userloc; t = 4; }
2735
+ if ((loc == null) || (typeof loc != 'string')) return null;
2736
+ loc = loc.split(',');
2737
+ if (t == 1) {
2738
+ // If this is IP location, randomize the position a little.
2739
+ return [ parseFloat(loc[0]) + (stringToIntHash(node._id.substring(0, 20)) / 100000000000), parseFloat(loc[1]) + (stringToIntHash(node._id.substring(20)) / 100000000000), t ];
2740
+ } else {
2741
+ // Return the real position
2742
+ return [ parseFloat(loc[0]), parseFloat(loc[1]), t ];
2743
+ }
2744
+ }
2745
+
2746
+ // Load the entire map
2747
+ function loadmap() {
2748
+ if (xxmap == null) return;
2749
+ if ((features & 0x8000) == 0) { QV('viewselectmapoption', false); QV('devViewButton4', false); xxmap = null; return; } // Geolocation not supported
2750
+ try {
2751
+ // Initialize a Source Vector
2752
+ xxmap.markersSource = new ol.source.Vector();
2753
+
2754
+ xxmap.markersLayer = new ol.layer.Vector({
2755
+ source: xxmap.markersSource
2756
+ });
2757
+
2758
+ // Create a tile and use OSM source
2759
+ xxmap.mapLayer = new ol.layer.Tile({ source: new ol.source.OSM() });
2760
+
2761
+ xxmap.mapView = new ol.View({ // Set the initial view
2762
+ center: ol.proj.transform([0, 0], 'EPSG:4326', 'EPSG:3857'),
2763
+ zoom: 2,
2764
+ minZoom: 2,
2765
+ maxZoom: 20,
2766
+ extent: ol.proj.transformExtent([-100000, -69.55, 100000, 69.55], 'EPSG:4326', 'EPSG:3857')
2767
+ });
2768
+
2769
+ xxmap.map = new ol.Map({
2770
+ target: 'xdevicesmap',
2771
+ layers: [xxmap.mapLayer, xxmap.markersLayer],
2772
+ view: xxmap.mapView
2773
+ });
2774
+
2775
+ xxmap.map.addOverlay(map_cm_popup);
2776
+
2777
+ // Goto information tab if a user clicks on a feature
2778
+ xxmap.map.on('click', function(evt) {
2779
+ var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(feat, layer) { return feat; });
2780
+ if (feature) {
2781
+ var nodeid = feature.getId();
2782
+ if (nodeid != null) { gotoDevice(nodeid, 10); } // Goto general info tab
2783
+ else { // For pointer
2784
+ var nodeFeatgoto = getCorrespondingFeature(feature); gotoDevice(nodeFeatgoto.getId(), 10);
2785
+ }
2786
+ }
2787
+ });
2788
+
2789
+ // On hover feature show the name of the node. Also add pointer style
2790
+ xxmap.map.on('pointermove', function(evt) {
2791
+ var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(feat, layer) { return feat; });
2792
+ if (feature) {
2793
+ xxmap.map.getTargetElement().style.cursor = 'pointer';
2794
+ var coord = feature.getGeometry().getCoordinates();
2795
+ // map_cm_popup.setPosition(evt.coordinate);
2796
+ map_cm_popup.setPosition(coord);
2797
+ var featid = feature.getId();
2798
+ if (featid) {
2799
+ QH('xmap-info-window', feature.get('name'));
2800
+ } else {
2801
+ var nodeFeat = getCorrespondingFeature(feature); // Return the node feature associated to pointer.
2802
+ QH('xmap-info-window', nodeFeat.get('name'));
2803
+ }
2804
+ } else {
2805
+ xxmap.map.getTargetElement().style.cursor = '';
2806
+ QH('xmap-info-window', '');
2807
+ }
2808
+ });
2809
+
2810
+ // Initialize context menu for openlayers
2811
+ var contextmenu = new ContextMenu({
2812
+ width: 160,
2813
+ defaultItems: false, // defaultItems are Zoom In/Zoom Out
2814
+ items: contextmenu_items
2815
+ });
2816
+
2817
+ // On right click open the context menu
2818
+ contextmenu.on("open", function (evt) {
2819
+ var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(ft, l){ return ft; });
2820
+ xxmap.contextmenu.clear(); //Clear the context menu
2821
+ if (feature) {
2822
+ var featId = feature.getId();
2823
+ if (featId) { addContextMenuItems(feature); } // Node feature will have an id
2824
+ else { // If the feature is a pointer, Get its corresponding Node feature
2825
+ var nodeFeature = getCorrespondingFeature(feature); //return the node feature associated to pointer.
2826
+ if (nodeFeature) { addContextMenuItems(nodeFeature); }
2827
+ else{ xxmap.contextmenu.extend(contextmenu_items); }
2828
+ }
2829
+ }
2830
+ else { xxmap.contextmenu.extend(contextmenu_items); }
2831
+ });
2832
+ if (xxmap.contextmenu == null) { xxmap.contextmenu = contextmenu; }
2833
+ xxmap.map.addControl(xxmap.contextmenu);
2834
+ //addMeshOptions(); // Adds Mesh names to mesh dropdown
2835
+ } catch (ex) {
2836
+ console.log(ex);
2837
+ QV('viewselectmapoption', false);
2838
+ QV('devViewButton4', false);
2839
+ xxmap = null;
2840
+ }
2841
+ }
2842
+
2843
+ // Add feature on to Map for a Node
2844
+ function addFeature(node, lat, lon) {
2845
+ var existingfeature = getModifiedFeature(node._id); // Check if Corresponding feature was Modified ( Modifed feature are in active interactions list)
2846
+ if (existingfeature) { xxmap.markersSource.addFeature(existingfeature); } // Add that existing feature
2847
+ else { // Add new feature for this node
2848
+ if (!lat && !lon) { var loc = map_parseNodeLoc(node); lat = loc[0]; lon = loc[1]; }
2849
+
2850
+ // 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.
2851
+ if (lon > 180) { lon = 180 - lon; meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: [ lat, lon ] }); }
2852
+
2853
+ if ((lat < 90) && (lat > -90) && (lon < 180) && (lon > -180)) { // Check valid lat/lon
2854
+ 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 });
2855
+ feature.setId(node._id); // Set id for the device as nodeid
2856
+ feature.setStyle(markerStyle(node));
2857
+ xxmap.markersSource.addFeature(feature); // Add the feature to Marker Source
2858
+ }
2859
+ }
2860
+ }
2861
+
2862
+ // Removing any feature from map
2863
+ function removeFeature(node) {
2864
+ var feature = xxmap.markersSource.getFeatureById(node._id);
2865
+ if (feature) { xxmap.markersSource.removeFeature(feature); }
2866
+ }
2867
+
2868
+ // Update feature
2869
+ function updateFeature(node, feature) {
2870
+ if (node.conn != feature.get('status') ) { // Update status if changed
2871
+ feature.set('status',node.conn)
2872
+ feature.setStyle(markerStyle(node));
2873
+ }
2874
+
2875
+ // Since this is IP address location, add some fixed randomness to the location. Avoid pin pile-up.
2876
+ var loc = map_parseNodeLoc(node);
2877
+ if (loc != null) {
2878
+ var lat = loc[0], lon = loc[1];
2879
+ if ((lat != feature.get('lat')) || (lon != feature.get('lon'))) { // Update lat and lon if changed
2880
+ feature.set('lat', lat); feature.set('lon', lon);
2881
+ var modifiedCoordinates = ol.proj.transform([parseFloat(lon), parseFloat(lat)], 'EPSG:4326', 'EPSG:3857');
2882
+ feature.getGeometry().setCoordinates(modifiedCoordinates);
2883
+ }
2884
+ }
2885
+
2886
+ if (node.name != feature.get('name') ) { feature.set('name', node.name); } // Update name
2887
+ }
2888
+
2889
+ // Enable dragging of a marker after edit option is clicked in context menu
2890
+ function modifyMarkerloc(ft){
2891
+ var featid = ft.getId();
2892
+ if (featid) {
2893
+ ft.setStyle(markerStyle(getNodeFromId(ft.a), 4)); // Switch to a user marker
2894
+ if ( !getActiveInteractions(ft)) {
2895
+ var dragInteration = new ol.interaction.Modify({
2896
+ features: new ol.Collection([ft]),
2897
+ pixelTolerance: 10
2898
+ });
2899
+ xxmap.activeInteractions.push({ featureid: featid, feature:ft, interaction: dragInteration }); // Also keep track of Interactions
2900
+ xxmap.map.addInteraction(dragInteration);
2901
+ }
2902
+ }
2903
+ }
2904
+
2905
+ // This will be called when save location option is clicked in context menu
2906
+ function saveMarkerloc(ft){
2907
+ var featid = ft.getId()
2908
+ if (featid) {
2909
+ var actInteraction = getActiveInteractions(ft);
2910
+ if (actInteraction) { // Check if the interaction exists
2911
+ xxmap.map.removeInteraction(actInteraction); //Clear Interaction for that node
2912
+ removeInteraction(featid);
2913
+ var coord = ft.getGeometry().getCoordinates();
2914
+ var v = ol.proj.transform(coord, 'EPSG:3857', 'EPSG:4326');
2915
+ if (v[0] > 180) { v[0] = 180 - v[0]; }
2916
+ var vx = [ v[1], v[0] ]; // Flip the coordinates around, lat/long
2917
+ meshserver.send({ action: 'changedevice', nodeid: featid, userloc: vx }); // Send them to server to save changes
2918
+ }
2919
+ }
2920
+ }
2921
+
2922
+ // Style the Markers
2923
+ function markerStyle(node, type) {
2924
+ if (type == null) {
2925
+ type = 0;
2926
+ if (node.iploc) { type = 1; }
2927
+ if (node.wifiloc) { type = 2; }
2928
+ if (node.gpsloc) { type = 3; }
2929
+ if (node.userloc) { type = 4; }
2930
+ }
2931
+ var types = ['', '-ip','-wifi','-gps','-user'];
2932
+ var color = connStateColor(node);
2933
+ var style = new ol.style.Style({
2934
+ image: new ol.style.Icon({ color: color, anchor: [0.5, 1], src: 'images/mapmarker' + types[type] + '.png' })
2935
+ //stroke: new ol.style.Stroke({ color: '#000', width: 20 })
2936
+ //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 }) })
2937
+ });
2938
+
2939
+ /*
2940
+ deviceMark.setStyle(new ol.style.Style({
2941
+ text: new ol.style.Text({
2942
+ //font: '12px helvetica,sans-serif',
2943
+ text: currentNode.name,
2944
+ textAlign: 'right',
2945
+ offsetX: -10,
2946
+ fill: new ol.style.Fill({ color: '#000' }),
2947
+ stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
2948
+ }),
2949
+ image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) }));
2950
+ */
2951
+
2952
+ return [ style ];
2953
+ }
2954
+
2955
+ // TODO: Add more connection status types. Currently we only change color if connection status changes
2956
+ function connStateColor(nodeConn){
2957
+ if (nodeConn.conn == 1 || nodeConn.conn == 3 || nodeConn.conn == 5) { return '#00ffdd'; } // Green for connected devices
2958
+ return '#C70039'; // Red if the Agent is not connected
2959
+ }
2960
+
2961
+ // Add save/edit option to context menu
2962
+ function addContextMenuItems(feature) {
2963
+ if (getActiveInteractions(feature)) { // If this feature is modified then display save option in contextmenu
2964
+ map_cm_saveMarker.data = feature;
2965
+ xxmap.contextmenu.push(map_cm_saveMarker);
2966
+ } else {
2967
+ map_cm_editMarker.data = feature;
2968
+ xxmap.contextmenu.push(map_cm_editMarker);
2969
+ var node = getNodeFromId(feature.a);
2970
+ if (node.userloc) {
2971
+ map_cm_clearMarker.data = feature;
2972
+ xxmap.contextmenu.push(map_cm_clearMarker);
2973
+ }
2974
+ }
2975
+ map_cm_nodemenu_items.forEach(function (item){
2976
+ if (item.text == "Zoom-in to extent" || item.text == "Zoom-out to extent") { item.data = feature; }
2977
+ else { if (item != '-') { item.data = feature.getId(); } }
2978
+ });
2979
+ xxmap.contextmenu.extend(map_cm_nodemenu_items);
2980
+ }
2981
+
2982
+ // Return a active Interaction if it exists in activeInteractions list
2983
+ function getActiveInteractions(feature) {
2984
+ var featid = feature.getId();
2985
+ for (var i = 0; i < xxmap.activeInteractions.length; i++) {
2986
+ if (xxmap.activeInteractions[i].featureid == featid) { return xxmap.activeInteractions[i].interaction; }
2987
+ }
2988
+ return false;
2989
+ }
2990
+
2991
+ // Return Modified feature based on Id
2992
+ function getModifiedFeature(featid) {
2993
+ if (featid) {
2994
+ for (var i = 0; i < xxmap.activeInteractions.length; i++) {
2995
+ if (xxmap.activeInteractions[i].featureid == featid) { return xxmap.activeInteractions[i].feature; }
2996
+ }
2997
+ }
2998
+ return null;
2999
+ }
3000
+
3001
+ // Remove Interaction
3002
+ function removeInteraction(ftid) {
3003
+ var index = -1;
3004
+ for (var i = 0; i < xxmap.activeInteractions.length; i++) {
3005
+ if (xxmap.activeInteractions[i].featureid === ftid) { index = i; break; }
3006
+ }
3007
+ if (index >= 0) { xxmap.activeInteractions.splice(index, 1); }
3008
+ }
3009
+
3010
+ // Check if pointer coordinates are equal to features and return node feature
3011
+ function getCorrespondingFeature(pointerFeat) {
3012
+ var pointerCoord = pointerFeat.getGeometry().getCoordinates();
3013
+ for (var i = 0; i < xxmap.activeInteractions.length ; i++) {
3014
+ var modifiedFeatures = xxmap.activeInteractions[i].feature;
3015
+ var fearCoord = modifiedFeatures.getGeometry().getCoordinates();
3016
+ if (fearCoord[0].toFixed(5) == pointerCoord[0].toFixed(5) && fearCoord[1].toFixed(5) == pointerCoord[1].toFixed(5) ) { return modifiedFeatures; }
3017
+ }
3018
+ return null;
3019
+ }
3020
+
3021
+ // Refresh the map and clear list
3022
+ function refreshMap(reset, rebound){
3023
+ if (reset) {
3024
+ xxmap.map.setTarget(null);
3025
+ xxmap.map = null;
3026
+ xxmap.markersSource = null;
3027
+ xxmap.mapView = null;
3028
+ xxmap.mapLayer = null;
3029
+ xxmap.activeInteractions = []; // Clear Active Interaction list
3030
+ }
3031
+ //clearMeshOptions();
3032
+ //onSelectMeshChange();
3033
+ var box = updateMapMarkers();
3034
+ if ((box != null) && (rebound || (box[4] == 1))) {
3035
+ var clat = (box[0] + box[2]) / 2;
3036
+ var clon = (box[1] + box[3]) / 2;
3037
+ var cscale = Math.max(Math.abs(box[0] - box[2]), Math.abs(box[1] - box[3]));
3038
+ var view = xxmap.map.getView();
3039
+ view.setCenter(ol.proj.transform([clon, clat], 'EPSG:4326', 'EPSG:3857'));
3040
+ var i = 360, j = -2;
3041
+ while (i > cscale) { j++; i = i / 2; }
3042
+ view.setZoom(j);
3043
+ }
3044
+ }
3045
+
3046
+ // Called When Place a node option is clicked from context menu
3047
+ function placeNode(coords) {
3048
+ if (xxdialogMode) return;
3049
+ var x = '<div style=margin-bottom:6px><label for=selectnode-search>' + "Search" + '</label>  <input type=text placeholder="' + "Název zařízení" + '" 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>' + "Žádné zařízení nalezeno." + '</div>';
3050
+ for (var i in nodes) {
3051
+ 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 />';
3052
+ 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>';
3053
+ }
3054
+ setDialogMode(2, "Select a node to place", 3, placeNodeEx, x + '</div>', coords);
3055
+ onPlaceNodeInputChange();
3056
+ }
3057
+
3058
+ function placeNodeEx(button, coords) {
3059
+ var elements = document.getElementsByName('PlaceMapDeviceCheckbox');
3060
+ for (var i in elements) {
3061
+ if (elements[i].checked) {
3062
+ var node = getNodeFromId(elements[i].id.substring(0, elements[i].id.length - 8));
3063
+ if (node) {
3064
+ var feature = xxmap.markersSource.getFeatureById(i);
3065
+ var v = ol.proj.transform(coords, 'EPSG:3857', 'EPSG:4326');
3066
+ var vx = [ v[1], v[0] ]; // Flip the coordinates around, lat/long
3067
+ if (feature) {
3068
+ feature.getGeometry().setCoordinates(coords);
3069
+ var activeInteraction = getActiveInteractions(feature);
3070
+ if (activeInteraction) {
3071
+ saveMarkerloc(feature);
3072
+ } else { // If this feature is not saved after its location is changed, then send updated coords to server.
3073
+ meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: vx }); // Send them to server to save changes
3074
+ }
3075
+ } else {
3076
+ meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: vx }); // This Node is not yet added to maps.
3077
+ }
3078
+ }
3079
+ }
3080
+ }
3081
+ }
3082
+
3083
+ // Called when the user changes the search box
3084
+ function onPlaceNodeInputChange() {
3085
+ updatePlaceNodeTable(Q('selectnode-search').value.trim().toLowerCase());
3086
+ }
3087
+
3088
+ // Update the list of devices in the "place on map" table
3089
+ function updatePlaceNodeTable(inputSearch) {
3090
+ var elements = document.getElementsByName('PlaceMapDeviceCheckbox'), count = 0;
3091
+ for (var i in nodes) {
3092
+ var visible = ((nodes[i].namel.indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.indexOf(inputSearch) >= 0));
3093
+ if (visible) { count++; }
3094
+ QV(nodes[i]._id + '-rowid', visible);
3095
+ }
3096
+ QV('noNodesMapPlace', count == 0);
3097
+ /*
3098
+ console.log(selected);
3099
+ for (var i in nodes) {
3100
+ if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) {
3101
+ console.log(selected.indexOf(nodes[i]._id));
3102
+ 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':'') + ' />';
3103
+ 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>';
3104
+ }
3105
+ }
3106
+ if (x == '') { x = '<div style=text-align:center;width:100%>No devices found.</div>'; }
3107
+ QH('placenode', '');
3108
+ */
3109
+ }
3110
+
3111
+ // Called when a user clicks on a device to toggle selection for placement on map.
3112
+ function selectNodeToPlace(e, id) {
3113
+ // Toggle checkbox if needed
3114
+ if (e.target.name != 'PlaceMapDeviceCheckbox') { var inputElement = Q(id + '-checkid'); inputElement.checked = !inputElement.checked; }
3115
+
3116
+ // Check button state
3117
+ var elements = document.getElementsByName('PlaceMapDeviceCheckbox'), checkcount = 0;
3118
+ for (var i in elements) { if (elements[i].checked) checkcount++; }
3119
+ QE('idx_dlgOkButton', checkcount > 0);
3120
+ }
3121
+
3122
+ // Add option for available meshes in mesh Dropdown
3123
+ function addMeshOptions(addMeshid, meshName) {
3124
+ /*
3125
+ var meshOptions = Q('select-mesh');
3126
+ if (addMeshid && meshName) {
3127
+ var option = document.createElement('option');
3128
+ option.value =addMeshid;
3129
+ option.text = meshName;
3130
+ meshOptions.add(option); // Add specific option
3131
+ }
3132
+ else {
3133
+ for (var i in meshes) { // Add all options
3134
+ var option = document.createElement('option');
3135
+ option.value = i;
3136
+ option.text = meshes[i].name;
3137
+ meshOptions.add(option);
3138
+ }
3139
+ }
3140
+ */
3141
+ }
3142
+
3143
+ // Remove/Modify options in Mesh dropdown (if modMeshname is defined then Modify else Remove)
3144
+ function meshOptionRmvMod(delMeshid, modMeshname){
3145
+ /*
3146
+ var meshOptions = Q('select-mesh');
3147
+ if (delMeshid) {
3148
+ var index=-1;
3149
+ for (var i = 1; i < meshOptions.options.length; i++) {
3150
+ if (meshOptions[i].value === delMeshid) { index=i; }
3151
+ }
3152
+ if (index > 0) {
3153
+ if (modMeshname) {
3154
+ meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified
3155
+ }
3156
+ else { meshOptions.remove(index); }
3157
+ }
3158
+ }
3159
+ */
3160
+ }
3161
+
3162
+ //Check if there is any mesh created
3163
+ function meshExists() {
3164
+ for (var i in meshes) { if (meshes[i]) { return true; } }
3165
+ return false;
3166
+ }
3167
+
3168
+ // Reset Mesh dropdown option to 'All' when a current view mesh is deleted.
3169
+ function setMeshView(emeshid) {
3170
+ var selectMeshElement=Q('select-mesh');
3171
+ var selectedIndex = selectMeshElement.selectedIndex;
3172
+ if (selectMeshElement[selectedIndex].value == emeshid) { selectMeshElement[0].selected = true; onSelectMeshChange(); }
3173
+ }
3174
+
3175
+ // Clear all mesh options except 'All'
3176
+ function clearMeshOptions() {
3177
+ /*
3178
+ var meshOptions=Q('select-mesh');
3179
+ for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); }
3180
+ */
3181
+ }
3182
+
3183
+ // Make a http get call- Replace this with AJAX get if jquery is used
3184
+ function getSearchLocation() {
3185
+ try {
3186
+ var searchdata = Q('mapSearchLocation').value.trim();
3187
+ if (searchdata.length > 0) {
3188
+ var xmlhttp = new XMLHttpRequest(); // Compatible with Chrome, Opera, Safari, IE7+, Firefox.
3189
+ xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { formatSearchData(xmlhttp.responseText); } }
3190
+ xmlhttp.open('GET', 'https://nominatim.openstreetmap.org/search?q=' + searchdata + '&format=json', true); // Get request
3191
+ xmlhttp.send();
3192
+ }
3193
+ } catch (e) {}
3194
+ }
3195
+
3196
+ // Format data recieved from nominatim API and display it on content window
3197
+ function formatSearchData(data) {
3198
+ try {
3199
+ QH('xmapSearchResults','');
3200
+ var dataInfo = JSON.parse(data), count = 0, x = '<div class="xmapItem">';
3201
+ for (var i = 0; i < dataInfo.length; i++) {
3202
+ if (dataInfo[i].display_name && dataInfo[i].boundingbox[0] && dataInfo[i].boundingbox[1] && dataInfo[i].boundingbox[2] && dataInfo[i].boundingbox[3]) {
3203
+ count++;
3204
+ var itemclass = (i % 2 == 0)?'xmapItemSel1':'xmapItemSel1';
3205
+ x += '<div class="' + itemclass + '" 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>';
3206
+ }
3207
+ }
3208
+ x += '</div>';
3209
+ if (count == 1) {
3210
+ // If only one result is returned then zoom to that location
3211
+ var extent = [ parseFloat(dataInfo[0].boundingbox[2]), parseFloat(dataInfo[0].boundingbox[0]), parseFloat(dataInfo[0].boundingbox[3]), parseFloat(dataInfo[0].boundingbox[1]) ];
3212
+ zoomToExtent(extent);
3213
+ } else {
3214
+ if (count == 0) { x = '<div style=width:200px>' + "No location found." + '<div>'; }
3215
+ QV('xmapSearchResultsDlg', true);
3216
+ }
3217
+ QH('xmapSearchResults', x);
3218
+ }
3219
+ catch (e) {}
3220
+ }
3221
+
3222
+ // Zoom into the bounding box
3223
+ function mapGotoSelectedLocation(obj) {
3224
+ var objchildren = obj.children;
3225
+ var boundingBox = objchildren[1].innerHTML.split('!#!');
3226
+ var extent = [parseFloat(boundingBox[2]), parseFloat(boundingBox[0]), parseFloat(boundingBox[3]), parseFloat(boundingBox[1])];
3227
+ //Q('search-location').value = objchildren[0].innerHTML;
3228
+ zoomToExtent(extent);
3229
+ mapCloseSearchWindow();
3230
+ }
3231
+
3232
+ // Close the search window
3233
+ function mapCloseSearchWindow() {
3234
+ QH('xmapSearchResults', '');
3235
+ QV('xmapSearchResultsDlg', false);
3236
+ }
3237
+
3238
+ // Zoom to specific cordinates
3239
+ function zoomToLocation(coordinates, zoomVal) {
3240
+ var view = xxmap.map.getView();
3241
+ view.setCenter(coordinates);
3242
+ view.setZoom(zoomVal);
3243
+ }
3244
+
3245
+ function zoomToFitExtent() {
3246
+ var features = xxmap.markersSource.getFeatures();
3247
+ if (features.length > 0) {
3248
+ var extent = xxmap.markersSource.getExtent();
3249
+ xxmap.map.getView().fit(extent, xxmap.map.getSize());
3250
+ }
3251
+ }
3252
+
3253
+ function zoomToExtent(extent){
3254
+ var boundingExtent = ol.proj.transformExtent(extent, ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857'));
3255
+ xxmap.map.getView().fit(boundingExtent, xxmap.map.getSize());
3256
+ }
3257
+
3258
+
3259
+ //
3260
+ // MY DEVICE
3261
+ //
3262
+ function refreshDevice(nodeid) {
3263
+ if (!currentNode || currentNode._id != nodeid) return;
3264
+ gotoDevice(nodeid, xxcurrentView, true);
3265
+ }
3266
+
3267
+ function getNodeRights(nodeid) {
3268
+ var node = getNodeFromId(nodeid), mesh = meshes[node.meshid];
3269
+ return mesh.links[userinfo._id].rights;
3270
+ }
3271
+
3272
+ var currentNode;
3273
+ var powerTimelineNode = null;
3274
+ var powerTimelineReq = null;
3275
+ var powerTimelineUpdate = null;
3276
+ var powerTimeline = null;
3277
+ function getCurrentNode() { return currentNode; };
3278
+ function gotoDevice(nodeid, panel, refresh, event) {
3279
+ // Remind the user to verify the email address
3280
+ if ((userinfo.emailVerified !== true) && (serverinfo.emailcheck == true) && (userinfo.siteadmin != 0xFFFFFFFF)) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until a email address is verified. This is required for password recovery. Go to the \"My Account\" tab to change and verify an email address."); return; }
3281
+
3282
+ // Remind the user to add two factor authentication
3283
+ if ((features & 0x00040000) && !((userinfo.otpsecret == 1) || (userinfo.otphkeys > 0) || (userinfo.otpkeys > 0))) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the \"My Account\" tab and look at the \"Account Security\" section."); return; }
3284
+
3285
+ if (event && (event.shiftKey == true)) {
3286
+ // Open the device in a different tab
3287
+ window.open(window.location.origin + '?node=' + nodeid.split('/')[2] + '&viewmode=10&hide=16', 'meshcentral:' + nodeid);
3288
+ return;
3289
+ }
3290
+
3291
+ //disconnectAllKvmFunction();
3292
+ var node = getNodeFromId(nodeid);
3293
+ var mesh = meshes[node.meshid];
3294
+ var meshrights = mesh.links[userinfo._id].rights;
3295
+ if (!currentNode || currentNode._id != node._id || refresh == true) {
3296
+ currentNode = node;
3297
+
3298
+ // Add node name
3299
+ var nname = EscapeHtml(node.name);
3300
+ if (nname.length == 0) { nname = '<i>' + "Nic" + '</i>'; }
3301
+ if (((meshrights & 4) != 0) && ((!mesh.flags) || ((mesh.flags & 2) == 0))) { nname = '<span tabindex=0 title=\"' + "Click here to edit the server-side device name" + '\" onclick=showEditNodeValueDialog(0) onkeyup="if (event.key == \'Enter\') showEditNodeValueDialog(0)" style=cursor:pointer>' + nname + ' <img class=hoverButton src="images/link5.png" /></span>'; }
3302
+ nname += '<span style=color:#AAA;font-size:small> - ' + EscapeHtml(mesh.name) + '</span>';
3303
+ QH('p10deviceName', nname);
3304
+ QH('p11deviceName', nname);
3305
+ QH('p12deviceName', nname);
3306
+ QH('p13deviceName', nname);
3307
+ QH('p14deviceName', nname);
3308
+ QH('p15deviceName', "Konzole - " + nname);
3309
+ QH('p16deviceName', nname);
3310
+ QH('p17deviceName', nname);
3311
+ QH('p19deviceName', nname);
3312
+
3313
+ // Node attributes
3314
+ var x = '<table style=width:100%>';
3315
+
3316
+ // Attribute: Mesh
3317
+ x += addDeviceAttribute('<span title=\"' + "The name of the device group this computer belong to." + '\">' + "Skupina" + '</span>', '<a href=# title=\"' + "The name of the device group this computer belong to" + '\" onclick=gotoMesh("' + node.meshid + '") style=cursor:pointer>' + EscapeHtml(meshes[node.meshid].name) + '</a>');
3318
+
3319
+ // Attribute: Name
3320
+ 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>'); }
3321
+
3322
+ // Attribute: Host
3323
+ if ((features & 1) == 0) { // If not WAN-only, local hostname is in use
3324
+ if ((meshrights & 4) != 0) {
3325
+ if (node.host) {
3326
+ x += addDeviceAttribute("Hostname", '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>' + EscapeHtml(node.host) + '</span>');
3327
+ } else {
3328
+ x += addDeviceAttribute("Hostname", '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>' + "Nic" + '</i></span>');
3329
+ }
3330
+ } else {
3331
+ x += addDeviceAttribute("Hostname", EscapeHtml(node.host));
3332
+ }
3333
+ }
3334
+
3335
+ // Attribute: Description
3336
+ var description = node.desc?EscapeHtml(node.desc):('<i>' + "Nic" + '</i>');
3337
+ if ((meshrights & 4) != 0) {
3338
+ x += addDeviceAttribute("Popis", '<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>' + description + ' <img class=hoverButton src="images/link5.png" /></span>');
3339
+ } else {
3340
+ x += addDeviceAttribute("Popis", description);
3341
+ }
3342
+
3343
+ // Attribute: Mesh Agent
3344
+ 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", "MacOS 32bit", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32bit", "MacOS 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", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "Unknown", "Unknown", "FreeBSD x86-64"];
3345
+ if ((node.agent != null) && (node.agent.id != null) && (node.agent.ver != null)) {
3346
+ var str = '';
3347
+ if (node.agent.id <= agentsStr.length) { str = agentsStr[node.agent.id]; } else { str = agentsStr[0]; }
3348
+ if (node.agent.ver != 0) { str += ' v' + node.agent.ver; }
3349
+ x += addDeviceAttribute("Mesh Agent", str);
3350
+ }
3351
+
3352
+ // Attribute: Intel AMT
3353
+ if (node.intelamt != null) {
3354
+ var str = '';
3355
+ var provisioningStates = { 0: nobreak("Not Activated (Pre)"), 1: nobreak("Not Activated (In)"), 2: nobreak("Activated") };
3356
+ if (node.intelamt.ver != null && node.intelamt.state == null) { str += '<i>' + "Unknown State" + '</i>, v' + node.intelamt.ver; } else
3357
+
3358
+ if ((node.intelamt.ver == null) && (node.intelamt.state == 2)) { str += '<i>' + "Activated" + '</i>'; }
3359
+ else if ((node.intelamt.ver == null) || (node.intelamt.state == null)) { str += '<i>' + "Unknown Version & State" + '</i>'; }
3360
+ else {
3361
+ str += provisioningStates[node.intelamt.state];
3362
+ if ((node.intelamt.state == 2) && 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>'; } }
3363
+ str += (', v' + node.intelamt.ver);
3364
+ }
3365
+
3366
+ if (node.intelamt.tls == 1) { str += ', <span title=\"' + "Intel AMT is setup with TLS network security" + '\">' + "TLS" + '</span>'; }
3367
+ if (node.intelamt.state == 2) {
3368
+ if (node.intelamt.user == null || node.intelamt.user == '') {
3369
+ if ((meshrights & 4) != 0) {
3370
+ str += ', <i style=color:#FF0000;cursor:pointer title=\"' + "Edit Intel® AMT credentials" + '\" onclick=editDeviceAmtSettings("' + node._id + '")>' + "Žádné přihlašovací údaje" + '</i>';
3371
+ } else {
3372
+ str += ', <i style=color:#FF0000>' + "Žádné přihlašovací údaje" + '</i>';
3373
+ }
3374
+ }
3375
+ str += ' ';
3376
+ if ((meshrights & 4) != 0) {
3377
+ str += '<img src=images/link4.png height=10 width=10 title=\"' + "Edit Intel® AMT credentials" + '\" style=cursor:pointer onclick=editDeviceAmtSettings("' + node._id + '")>';
3378
+ }
3379
+ }
3380
+
3381
+ var meName = '<span title=\"Intel® Manageability Engine\">' + "Intel® ME" + '<span>';
3382
+ if (typeof node.intelamt.sku == 'number') {
3383
+ if ((node.intelamt.sku & 8) != 0) { meName = '<span title=\"' + "Intel® Active Management Technology" + '\">' + "Intel® AMT" + '<span>'; }
3384
+ else if ((node.intelamt.sku & 16) != 0) { meName = '<span title=\"' + "Intel® Standard Manageability" + '\">' + "Intel® SM" + '<span>'; }
3385
+ }
3386
+ x += addDeviceAttribute(meName, str);
3387
+ }
3388
+
3389
+ if (mesh.mtype == 2) {
3390
+ // Attribute: Mesh Agent Tag
3391
+ if ((node.agent != null) && (node.agent.tag != null)) {
3392
+ var tag = EscapeHtml(node.agent.tag);
3393
+ if (tag.startsWith('mailto:')) { tag = '<a href="' + tag + '">' + tag.substring(7) + '</a>'; }
3394
+ x += addDeviceAttribute("Agent Tag", tag);
3395
+ }
3396
+ } else {
3397
+ // Attribute: Intel AMT Tag
3398
+ if ((node.intelamt != null) && (node.intelamt.tag != null)) {
3399
+ var tag = EscapeHtml(node.intelamt.tag);
3400
+ if (tag.startsWith('mailto:')) { tag = '<a href="' + tag + '">' + tag.substring(7) + '</a>'; }
3401
+ x += addDeviceAttribute("Intel® AMT Tag", tag);
3402
+ }
3403
+ }
3404
+
3405
+ // Attribute: Intel AMT
3406
+ //if (node.intelamt && node.intelamt.user) { x += addDeviceAttribute('Intel® AMT', node.intelamt.user); }
3407
+
3408
+ // Operating system description
3409
+ if (node.osdesc) { x += addDeviceAttribute("Operační systém", node.osdesc); }
3410
+
3411
+ // Antivirus
3412
+ if (node.av && node.av.length > 0) {
3413
+ var y = [];
3414
+ for (var i in node.av) {
3415
+ if (node.av[i].product) {
3416
+ var avx = EscapeHtml(node.av[i].product);
3417
+ if (node.av[i].enabled !== true) { avx += ' - <span style=color:red>' + "Disabled" + '</span>'; }
3418
+ if (node.av[i].updated !== true) { avx += ' - <span style=color:red>' + "Out of date" + '</span>'; }
3419
+ if ((node.av[i].enabled == true) && (node.av[i].updated == true)) { avx += ' - <span style=color:green>' + "OK" + '</span>'; }
3420
+ y.push(avx);
3421
+ }
3422
+ }
3423
+ x += addDeviceAttribute("Antivirus", y.join('<br />'));
3424
+ }
3425
+
3426
+ // Active Users
3427
+ if (node.users && node.conn && (node.users.length > 0) && (node.conn & 1)) { x += addDeviceAttribute(format("Active User{0}", ((node.users.length > 1)?'s':'')), node.users.join(', ')); }
3428
+
3429
+ // Attribute: Connectivity (Only show this if more than just the agent is connected).
3430
+ var connectivity = node.conn;
3431
+ if (connectivity && connectivity > 1) {
3432
+ var cstate = [];
3433
+ if ((node.conn & 1) != 0) cstate.push('<span title=\"' + "Agent je připojen a připraven." + '\">' + "Mesh Agent" + '</span>');
3434
+ if ((node.conn & 2) != 0) cstate.push('<span title=\"' + "Intel® AMT CIRA is connected and ready for use." + '\">' + "Intel® AMT CIRA" + '</span>');
3435
+ else if ((node.conn & 4) != 0) cstate.push('<span title=\"' + "Intel® AMT is routable and ready for use." + '\">' + "Intel® AMT" + '</span>');
3436
+ if ((node.conn & 8) != 0) cstate.push('<span title=\"' + "Mesh agent is reachable using another agent as relay." + '\">' + "Mesh Relay" + '</span>');
3437
+ if ((node.conn & 16) != 0) { cstate.push('<span title=\"' + "MQTT connection to the device is active." + '\">' + "MQTT" + '</span>'); }
3438
+ x += addDeviceAttribute("Connectivity", cstate.join(', '));
3439
+ }
3440
+
3441
+ // Node grouping tags
3442
+ var groupingTags = '<i>' + "Nic" + '</i>';
3443
+ if (node.tags != null) { groupingTags = ''; for (var i in node.tags) { groupingTags += '<span class="tagSpan">' + node.tags[i] + '</span>'; } }
3444
+ if ((meshrights & 4) != 0) {
3445
+ x += addDeviceAttribute('Tags', '<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>' + groupingTags + ' <img class=hoverButton src="images/link5.png" /></span>');
3446
+ } else {
3447
+ x += addDeviceAttribute('Tags', groupingTags);
3448
+ }
3449
+
3450
+ x += '</table><br />';
3451
+ // Show action button, only show if we have permissions 4, 8, 64
3452
+ if ((meshrights & 76) != 0) { x += '<input type=button value=\"' + "Akce" + '\" title=\"' + "Akce napájení" + '\" onclick=deviceActionFunction() />'; }
3453
+ x += '<input type=button value=\"' + "Poznámky" + '\" title=\"' + "View notes about this device" + '\" onclick=showNotes(' + ((meshrights & 128) == 0) + ',"' + encodeURIComponent(node._id) + '") />';
3454
+ x += '<input type=button value=\"' + "Log udalostí" + '\" title=\"' + "Write an event for this device" + '\" onclick=writeDeviceEvent("' + encodeURIComponent(node._id) + '") />';
3455
+ //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() />'; }
3456
+ QH('p10html', x);
3457
+
3458
+ // Show node last 7 days timeline
3459
+ masterUpdate(256);
3460
+
3461
+ // Show bottom buttons
3462
+ x = '<div class="p10html3right">';
3463
+ if ((meshrights & 4) != 0) {
3464
+ // TODO: Show change group only if there is another mesh of the same type.
3465
+ x += ' <a href=# onclick=p10showChangeGroupDialog(["' + node._id + '"]) title=\"' + "Move this device to a different device group" + '\">' + "Změnit skupinu" + '</a>';
3466
+ x += ' <a href=# onclick=p10showDeleteNodeDialog("' + node._id + '") title=\"' + "Remove this device" + '\">' + "Smazat zařízení" + '</a>';
3467
+ }
3468
+ x += '</div><div class="p10html3left">';
3469
+ if (mesh.mtype == 2) x += '<a href=# onclick=p10showNodeNetInfoDialog("' + node._id + '") title=\"' + "Show device network interface information" + '\">' + "Interfaces" + '</a> ';
3470
+ if (xxmap != null) x += '<a href=# onclick=p10showNodeLocationDialog("' + node._id + '") title=\"' + "Show device locations information" + '\">' + "Location" + '</a> ';
3471
+ if (((meshrights & 8) != 0) && (mesh.mtype == 2)) x += '<a href=# onclick=p10showMeshCmdDialog(1,"' + node._id + '") title=\"' + "Traffic router used to connect to a device thru this server" + '.\">' + "Router" + '</a> ';
3472
+
3473
+ // RDP link, show this link only of the remote machine is Windows.
3474
+ if (((connectivity & 1) != 0) && (clickOnce == true) && (mesh.mtype == 2) && ((meshrights & 8) != 0)) {
3475
+ if ((node.agent.id > 0) && (node.agent.id < 5)) { x += '<a href=# onclick=p10clickOnce("' + node._id + '","RDP2",3389) title=\"' + "Requires Microsoft ClickOnce support in your browser" + '.\">' + "RDP" + '</a> '; }
3476
+ if (node.agent.id > 4) {
3477
+ x += '<a href=# onclick=p10clickOnce("' + node._id + '","PSSH",22) title=\"' + "Requires Microsoft ClickOnce support in your browser." + '\">' + "Putty" + '</a> ';
3478
+ x += '<a href=# onclick=p10clickOnce("' + node._id + '","WSCP",22) title=\"' + "Requires Microsoft ClickOnce support in your browser." + '\">' + "WinSCP" + '</a> ';
3479
+ }
3480
+ }
3481
+
3482
+ // MQTT options
3483
+ if ((meshrights == 0xFFFFFFFF) && (features & 0x00400000)) { x += '<a href=# onclick=p10showMqttLoginDialog("' + node._id + '") title=\"' + "Get MQTT login credentials for this device." + '\">' + "MQTT Login" + '</a> '; }
3484
+ x += '</div><br>'
3485
+
3486
+ QH('p10html3', x);
3487
+
3488
+ // Set the node power state
3489
+ var powerstate = PowerStateStr(node.state);
3490
+ //if (node.state == 0) { powerstate = 'Unknown State'; }
3491
+ if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "Agent připojen" + '\">' + "Agent připojen" + '</span>'; }
3492
+ if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "Intel® AMT connected" + '\">' + "Intel® AMT connected" + '</span>'; }
3493
+ else if ((connectivity & 4) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "Intel® AMT detected" + '\">' + "Intel® AMT detected" + '</span>'; }
3494
+ if ((connectivity & 16) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "MQTT připojeno" + '\">' + "MQTT channel connected" + '</span>'; }
3495
+ if ((powerstate == '') && node.lastconnect) { powerstate = '<span style=font-size:12px>' + "Naposledy spatřen:" + '<br />' + printDateTime(new Date(node.lastconnect)) + '</span>'; }
3496
+ QH('MainComputerState', powerstate);
3497
+
3498
+ // Set the node icon
3499
+ Q('MainComputerImage').setAttribute('src', 'images/icons256-' + node.icon + '-1.png');
3500
+ Q('MainComputerImage').className = ((!node.conn) || (node.conn == 0)?'gray':'');
3501
+
3502
+ // Check if we have terminal and file access
3503
+ var terminalAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 512) == 0));
3504
+ var fileAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 1024) == 0));
3505
+ var amtAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 2048) == 0));
3506
+
3507
+ // Setup/Refresh the desktop tab
3508
+ if (terminalAccess) { setupTerminal(); }
3509
+ if (fileAccess) { setupFiles(); }
3510
+ var consoleRights = ((meshrights & 16) != 0);
3511
+ if (consoleRights) { setupConsole(); } else { if (panel == 15) { panel = 10; } }
3512
+
3513
+ // Show or hide the tabs
3514
+ // mesh.mtype: 1 = Intel AMT only, 2 = Mesh Agent
3515
+ // node.agent.caps (bitmask): 1 = Desktop, 2 = Terminal, 4 = Files, 8 = Console
3516
+ QV('MainDevDesktop', (((mesh.mtype == 1) && ((typeof node.intelamt.sku !== 'number') || ((node.intelamt.sku & 8) != 0)))
3517
+ || ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 1) != 0) || (node.intelamt && (node.intelamt.state == 2)))))
3518
+ && ((meshrights & 8) || (meshrights & 256))
3519
+ );
3520
+ 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) && terminalAccess);
3521
+ QV('MainDevFiles', ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 4) != 0))) && (meshrights & 8) && fileAccess);
3522
+ QV('MainDevAmt', (node.intelamt != null) && ((node.intelamt.state == 2) || (node.conn & 2)) && (meshrights & 8) && amtAccess);
3523
+ QV('MainDevConsole', (consoleRights && (mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 8) != 0))) && (meshrights & 8));
3524
+ QV('MainDevPlugins', pluginHandler != null);
3525
+ QV('p15uploadCore', (node.agent != null) && (node.agent.caps != null) && ((node.agent.caps & 16) != 0));
3526
+ QH('p15coreName', ((node.agent != null) && (node.agent.core != null))?node.agent.core:'');
3527
+
3528
+ // Setup/Refresh Intel AMT tab
3529
+ var amtFrameNode = Q('p14iframe').contentWindow.getCurrentMeshNode();
3530
+ if ((amtFrameNode != null) && (amtFrameNode._id != currentNode._id)) { Q('p14iframe').contentWindow.disconnect(); }
3531
+ var online = ((node.conn & 6) != 0)?true:false; // If CIRA (2) or AMT (4) connected, enable Commander
3532
+ Q('p14iframe').contentWindow.setConnectionState(online);
3533
+ Q('p14iframe').contentWindow.setFrameHeight('650px');
3534
+ Q('p14iframe').contentWindow.setAuthCallback(updateAmtCredentials);
3535
+
3536
+ // Display "action" button on desktop/terminal/files
3537
+ QV('deskActionsBtn', (meshrights & 72) != 0); // 72 = Wake-up + Remote Control permissions
3538
+ QV('termActionsBtn', (meshrights & 72) != 0);
3539
+ QV('filesActionsBtn', (meshrights & 72) != 0);
3540
+
3541
+ // Request the power timeline
3542
+ if ((powerTimelineNode != currentNode._id) && (powerTimelineReq != currentNode._id)) {
3543
+ QH('p10html2', '');
3544
+ powerTimelineReq = currentNode._id;
3545
+ meshserver.send({ action: 'powertimeline', nodeid: currentNode._id });
3546
+ meshserver.send({ action: 'lastconnect', nodeid: currentNode._id });
3547
+ meshserver.send({ action: 'getsysinfo', nodeid: currentNode._id });
3548
+ QH('p17info', '');
3549
+ }
3550
+
3551
+ // Reset the desktop tools
3552
+ QV('DeskTools', false);
3553
+ showDeskToolsProcesses();
3554
+
3555
+ // Ask for device events
3556
+ refreshDeviceEvents();
3557
+
3558
+ // Update the web page title
3559
+ if ((currentNode) && (xxcurrentView >= 10) && (xxcurrentView < 20)) {
3560
+ document.title = decodeURIComponent('{{{extitle}}}') + ' - ' + currentNode.name + ' - ' + mesh.name;
3561
+ } else {
3562
+ document.title = decodeURIComponent('{{{extitle}}}');
3563
+ }
3564
+
3565
+ // Clear user consent status if present
3566
+ p11clearConsoleMsg();
3567
+ p12clearConsoleMsg();
3568
+ p13clearConsoleMsg();
3569
+
3570
+ // Device refresh plugin handler
3571
+ if (pluginHandler != null) { pluginHandler.callHook('onDeviceRefreshEnd', nodeid, panel, refresh, event); }
3572
+ }
3573
+ setupDesktop(); // Always refresh the desktop, even if we are on the same device, we need to do some canvas switching.
3574
+ if (!panel) panel = 10;
3575
+ go(panel);
3576
+ }
3577
+
3578
+ function writeDeviceEvent(nodeid) {
3579
+ if (xxdialogMode) return;
3580
+ setDialogMode(2, "Add Device Event", 3, writeDeviceEventEx, '<textarea id=d2devEvent style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea><span style=font-size:10px>' + "This will add an entry to this device\'s event log." + '<span>', nodeid);
3581
+ }
3582
+
3583
+ function writeDeviceEventEx(buttons, tag) { meshserver.send({ action: 'setDeviceEvent', nodeid: decodeURIComponent(tag), msg: encodeURIComponent(Q('d2devEvent').value) }); }
3584
+
3585
+ function showNotes(readonly, noteid) {
3586
+ if (xxdialogMode) return;
3587
+ setDialogMode(2, "Poznámky", 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>' + "Device group notes can be viewed and changed by other device group administrators." + '<span>', noteid);
3588
+ meshserver.send({ action: 'getNotes', id: decodeURIComponent(noteid) });
3589
+ }
3590
+
3591
+ function showNotesEx(buttons, tag) { meshserver.send({ action: 'setNotes', id: decodeURIComponent(tag), notes: encodeURIComponent(Q('d2devNotes').value) }); }
3592
+
3593
+ function deviceChat(e) {
3594
+ if (xxdialogMode) return;
3595
+ var url = '/messenger?id=meshmessenger/' + encodeURIComponent(currentNode._id) + '/' + encodeURIComponent(userinfo._id) + '&title=' + currentNode.name;
3596
+ if ((authCookie != null) && (authCookie != '')) { url += '&auth=' + authCookie; }
3597
+ if (e && (e.shiftKey == true)) {
3598
+ window.open(url, 'meshmessenger:' + currentNode._id);
3599
+ } else {
3600
+ window.open(url, 'meshmessenger:' + currentNode._id, 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=560');
3601
+ }
3602
+ meshserver.send({ action: 'meshmessenger', nodeid: decodeURIComponent(currentNode._id) });
3603
+ }
3604
+
3605
+ function deviceToggleBackground() {
3606
+ if (xxdialogMode) return;
3607
+ meshserver.send({ action: 'msg', type: 'deskBackground', nodeid: currentNode._id, op: 1 }); // Toggle desktop background image
3608
+ }
3609
+
3610
+ function deviceUrlFunction() {
3611
+ if (xxdialogMode) return;
3612
+ setDialogMode(2, "Open Page on Device", 3, deviceUrlFunctionEx, '<input id=d2devurl placeholder="http://server.com" style=width:100%;overflow-y:scroll></input>');
3613
+ Q('d2devurl').focus();
3614
+ }
3615
+
3616
+ function deviceUrlFunctionEx() {
3617
+ meshserver.send({ action: 'msg', type: 'openUrl', nodeid: currentNode._id, url: Q('d2devurl').value });
3618
+ }
3619
+
3620
+ function deviceToastFunction() {
3621
+ if (xxdialogMode) return;
3622
+ setDialogMode(2, "Device Notification", 3, deviceToastFunctionEx, '<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>');
3623
+ Q('d2devToast').focus();
3624
+ }
3625
+
3626
+ function deviceToastFunctionEx() {
3627
+ meshserver.send({ action: 'toast', nodeids: [ currentNode._id ], title: 'MeshCentral', msg: Q('d2devToast').value });
3628
+ }
3629
+
3630
+ function deviceActionFunction() {
3631
+ if (xxdialogMode) return;
3632
+ var meshrights = meshes[currentNode.meshid].links[userinfo._id].rights;
3633
+ var x = "Vyber operaci na tomto zařízení." + '<br /><br />';
3634
+ var y = '<select id=d2deviceop style=float:right;width:250px>';
3635
+ if ((meshrights & 64) != 0) { y += '<option value=100>' + "Probudit" + '</option>'; } // Wake-up permission
3636
+ if ((meshrights & 8) != 0) { y += '<option value=4>' + "Spánek" + '</option><option value=3>' + "Reset" + '</option><option value=2>' + "Vypnout" + '</option>'; } // Remote control permission
3637
+ if ((currentNode.conn & 16) != 0) { y += '<option value=103>' + "Send MQTT Message" + '</option>'; }
3638
+ if (((currentNode.conn & 1) != 0) && ((meshrights & 32768) != 0)) { y += '<option value=104>' + "Uninstall Agent" + '</option>'; }
3639
+ y += '</select>';
3640
+ x += addHtmlValue("Operace", y);
3641
+ setDialogMode(2, "Akce zařízení", 3, deviceActionFunctionEx, x);
3642
+ }
3643
+
3644
+ function deviceActionFunctionEx() {
3645
+ var op = Q('d2deviceop').value;
3646
+ if (op == 100) {
3647
+ // Device wake
3648
+ meshserver.send({ action: 'wakedevices', nodeids: [currentNode._id] });
3649
+ } else if (op == 103) {
3650
+ // Send MQTT Message
3651
+ p10showSendMqttMsgDialog([currentNode._id]);
3652
+ } else if (op == 104) {
3653
+ // Uninstall agent
3654
+ p10showSendUninstallAgentDialog([currentNode._id]);
3655
+ } else {
3656
+ // Power operation
3657
+ meshserver.send({ action: 'poweraction', nodeids: [ currentNode._id ], actiontype: parseInt(op) });
3658
+ }
3659
+ }
3660
+
3661
+ // Called when MeshCommander needs new credentials or updated credentials.
3662
+ function updateAmtCredentials(forceDialog) {
3663
+ var node = getNodeFromId(currentNode._id);
3664
+ if ((forceDialog == true) || (node.intelamt.user == null) || (node.intelamt.user == '')) {
3665
+ editDeviceAmtSettings(currentNode._id, updateAmtCredentialsEx);
3666
+ } else {
3667
+ Q('p14iframe').contentWindow.connectButtonfunctionEx();
3668
+ }
3669
+ }
3670
+
3671
+ function updateAmtCredentialsEx(button, tag) {
3672
+ Q('p14iframe').contentWindow.connectButtonfunctionEx();
3673
+ }
3674
+
3675
+ // Look to see if we need to update the device timeline
3676
+ function updateDeviceTimeline() {
3677
+ if ((meshserver.State != 2) || (powerTimelineNode == null) || (powerTimelineUpdate == null) || (currentNode == null)) return;
3678
+ if ((powerTimelineNode == powerTimelineReq) && (currentNode._id == powerTimelineNode) && (powerTimelineUpdate < Date.now())) {
3679
+ powerTimelineUpdate = null;
3680
+ meshserver.send({ action: 'powertimeline', nodeid: currentNode._id });
3681
+ meshserver.send({ action: 'lastconnect', nodeid: currentNode._id });
3682
+ }
3683
+ }
3684
+
3685
+ // Draw device power bars. The bars are 766px wide.
3686
+ function drawDeviceTimeline() {
3687
+ if ((currentNode == null) || (xxcurrentView < 10) || (xxcurrentView > 19)) return;
3688
+ var timeline = null, now = Date.now();
3689
+ if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; }
3690
+
3691
+ // Calculate when the timeline starts
3692
+ var d = new Date();
3693
+ d.setHours(0, 0, 0, 0);
3694
+ d = new Date(d.getTime() - (1000 * 60 * 60 * 24 * 6));
3695
+ var timelineStart = d.getTime();
3696
+
3697
+ // De-compact the timeline
3698
+ var timeline2 = [];
3699
+ if (timeline != null && timeline.length > 1) {
3700
+ timeline2.push([ 0, timeline[1], timeline[0] ]); // Start, End, Power
3701
+ var ct = timeline[1];
3702
+ for (var i = 2; i < timeline.length; i += 2) {
3703
+ var power = timeline[i], dt = now;
3704
+ if (timeline.length > (i + 1)) { dt = timeline[i + 1]; }
3705
+ timeline2.push([ ct, ct + dt, power ]); // Start, End, Power
3706
+ ct = ct + dt;
3707
+ }
3708
+ }
3709
+
3710
+ // Draw the timeline
3711
+ var x = '', count = 1, date = new Date();
3712
+ var totalWidth = Q('masthead').offsetWidth - (160 + 9 + 9 + 14); // Compute the total width of the power bar
3713
+ date.setHours(0, 0, 0, 0);
3714
+ for (var i = 0; i < 7; i++) {
3715
+ var datavalue = '', start = date.getTime(), end = start + (1000 * 60 * 60 * 24);
3716
+ for (var j in timeline2) {
3717
+ var block = timeline2[j];
3718
+ if (isTimeBlockInside(start, end, block[0], block[1]) == true) {
3719
+ var ts = Math.max(start, block[0]);
3720
+ var te = Math.min(Math.min(end, block[1]), now);
3721
+ var width = Math.round(((te - ts) * totalWidth) / 86400000);
3722
+ if (width > 0) {
3723
+ var title = format('{0} from {1} to {2}.', powerStateStrings2[block[2]], printTime(new Date(ts)), printTime(new Date(te)));
3724
+ datavalue += '<div class="pwState ' + powerColor(block[2]) + '" title="' + title + '" style="width:' + width + 'px;"></div>';
3725
+ }
3726
+ }
3727
+ }
3728
+ x += '<tr class=' + (((count % 2) == 0)?'altBack':'') + '><td><div> ' + printDate(date) + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
3729
+ ++count;
3730
+ date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
3731
+ }
3732
+ QH('p10html2', '<table cellpadding=2 cellspacing=0><thead><tr style=><th scope=col style=text-align:center;width:150px>' + "Den" + '</th><th scope=col style=text-align:center><a download href="devicepowerevents.ashx?id=' + currentNode._id + '" onclick="setDialogMode(0)"><img title=\"' + "Download power events" + '\" src="images/link4.png" /></a>' + "7 denní statistika provozu" + '</th></tr></thead><tbody>' + x + '</tbody></table>');
3733
+ }
3734
+
3735
+ // Return a color for the given power state
3736
+ function powerColor(x) { if (x < powerColorTable.length) { return powerColorTable[x]; } return 'pwsYellow'; }
3737
+
3738
+ // Return true if the time block is visible within the start/end period
3739
+ function isTimeBlockInside(start, end, blockStart, blockEnd) {
3740
+ if ((blockStart < start) && (blockEnd > end)) return true; // Block is wider than timespan
3741
+ if ((blockStart > start) && (blockStart < end)) return true;
3742
+ if ((blockEnd > start) && (blockEnd < end)) return true;
3743
+ return false;
3744
+ }
3745
+
3746
+ function addDeviceAttribute(name, value) { return '<tr><td class=style7>' + name + '</td><td class=style9>' + value + '</td></tr>'; }
3747
+
3748
+ function editDeviceAmtSettings(nodeid, func, arg) {
3749
+ if (xxdialogMode) return;
3750
+ var x = '', node = getNodeFromId(nodeid), buttons = 3, meshrights = getNodeRights(nodeid);
3751
+ if ((meshrights & 4) == 0) return;
3752
+ x += addHtmlValue("Uživatel", '<input id=dp10username style=width:230px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
3753
+ x += addHtmlValue("Heslo", '<input id=dp10password type=password style=width:230px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
3754
+ x += addHtmlValue("Bezpečnost", '<select id=dp10tls style=width:236px><option value=0>' + "Žádné TLS" + '</option><option value=1>' + "TLS vyžadováno" + '</option></select>');
3755
+ if ((node.intelamt.user != null) && (node.intelamt.user != '')) { buttons = 7; }
3756
+ setDialogMode(2, "Edit Intel® AMT credentials", buttons, editDeviceAmtSettingsEx, x, { node: node, func: func, arg: arg });
3757
+ if ((node.intelamt.user != null) && (node.intelamt.user != '')) { Q('dp10username').value = node.intelamt.user; } else { Q('dp10username').value = 'admin'; }
3758
+ Q('dp10tls').value = node.intelamt.tls;
3759
+ validateDeviceAmtSettings();
3760
+ }
3761
+
3762
+ function validateDeviceAmtSettings() {
3763
+ QE('idx_dlgOkButton', passwordcheck(Q('dp10password').value));
3764
+ }
3765
+
3766
+ function editDeviceAmtSettingsEx(button, tag) {
3767
+ if (button == 2) {
3768
+ // Delete button pressed, remove credentials
3769
+ meshserver.send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: '', pass: '' } });
3770
+ } else {
3771
+ // Change Intel AMT credentials
3772
+ var amtuser = Q('dp10username').value;
3773
+ if (amtuser == '') amtuser = 'admin';
3774
+ var amtpass = Q('dp10password').value;
3775
+ if (amtpass == '') amtuser = '';
3776
+ meshserver.send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: amtuser, pass: amtpass, tls: Q('dp10tls').value } });
3777
+ tag.node.intelamt.user = amtuser;
3778
+ tag.node.intelamt.tls = Q('dp10tls').value;
3779
+ if (tag.func) { setTimeout(function () { tag.func(null, tag.arg); }, 300); }
3780
+ }
3781
+ }
3782
+
3783
+ function p10showSendMqttMsgDialog(nodeids) {
3784
+ if (xxdialogMode) return false;
3785
+ var x = addHtmlValue("Topic", '<input id=dp2topic style=width:230px maxlength=64 onchange=p10validateSendMqttMsgDialog() onkeyup=p10validateSendMqttMsgDialog(event,1) />');
3786
+ x += addHtmlValue("Message", '<div style=width:230px;margin:0;padding:0><textarea id=dp2msg maxlength=4096 style=width:100%;height:150px;resize:none onchange=p10validateSendMqttMsgDialog() onkeyup=p10validateSendMqttMsgDialog(event,1)></textarea></div>');
3787
+ setDialogMode(2, "Send MQTT message", 3, p10showSendMqttMsgDialogEx, x, nodeids);
3788
+ p10validateSendMqttMsgDialog();
3789
+ Q('dp2topic').focus();
3790
+ return false;
3791
+ }
3792
+
3793
+ function p10validateSendMqttMsgDialog() {
3794
+ QE('idx_dlgOkButton', (Q('dp2topic').value.length > 0) && (Q('dp2msg').value.length > 0));
3795
+ }
3796
+
3797
+ function p10showSendMqttMsgDialogEx(b, nodeids) {
3798
+ meshserver.send({ action: 'sendmqttmsg', nodeids: nodeids, topic: Q('dp2topic').value, msg: Q('dp2msg').value });
3799
+ }
3800
+
3801
+ function p10showSendUninstallAgentDialog(nodeids) {
3802
+ if (xxdialogMode) return false;
3803
+ var x = '';
3804
+ if (nodeids.length > 1) { x = format("Are you sure you want to uninstall the selected {0} agents?", nodeids.length); } else { x = "Are you sure you want to uninstall selected agent?"; }
3805
+ x += '<br /><br />';
3806
+ if (nodeids.length > 1) { x += "This will not remove the devices from the server, but the devices will not longer be able to connect to the server. All remote access to the devices will be lost. The devices must be connected for this command to work."; } else { x += "This will not remove this device from the server, but the device will not longer be able to connect to the server. All remote access to the device will be lost. The device must be connect for this command to work."; }
3807
+ x += '<br /><br /><label style=color:red><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />' + "Confirm" + '</label>';
3808
+ setDialogMode(2, "Uninstall agent", 3, p10showSendUninstallAgentDialogEx, x, nodeids);
3809
+ p10validateSendUninstallAgentDialog();
3810
+ return false;
3811
+ }
3812
+
3813
+ function p10validateSendUninstallAgentDialog() { QE('idx_dlgOkButton', Q('p10check').checked); }
3814
+ function p10showSendUninstallAgentDialogEx(b, nodeids) { meshserver.send({ action: 'uninstallagent', nodeids: nodeids }); }
3815
+
3816
+ function p10showChangeGroupDialog(nodeids) {
3817
+ if (xxdialogMode) return false;
3818
+ var targetMeshId = null;
3819
+ if (nodeids.length == 1) { try { targetMeshId = meshes[getNodeFromId(nodeids[0])]._id; } catch (ex) { } }
3820
+
3821
+ // List all available alternative groups
3822
+ var y = '<select id=p10newGroup style=width:236px>', count = 0;
3823
+ for (var i in meshes) {
3824
+ var meshrights = meshes[i].links[userinfo._id].rights;
3825
+ if ((meshes[i]._id != targetMeshId) && (meshrights & 4)) { count++; y += '<option value=\'' + meshes[i]._id + '\'>' + meshes[i].name + '</option>'; }
3826
+ }
3827
+ y += '</select>';
3828
+
3829
+ if (count > 0) {
3830
+ var x = (nodeids.length == 1) ? ("Vyber novou skupinu pro toto zařízení" + '<br /><br />') : ("Select a new group for selected devices" + '<br /><br />');
3831
+ x += addHtmlValue("Nová skupina zařízení", y);
3832
+ setDialogMode(2, "Změnit skupinu", 3, p10showChangeGroupDialogEx, x, nodeids);
3833
+ } else {
3834
+ setDialogMode(2, "Změnit skupinu", 1, null, "No other device group of same type exists.");
3835
+ }
3836
+ return false;
3837
+ }
3838
+
3839
+ function p10showChangeGroupDialogEx(b, nodeids) {
3840
+ meshserver.send({ action: 'changeDeviceMesh', nodeids: nodeids, meshid: Q('p10newGroup').value });
3841
+ }
3842
+
3843
+ function p10showDeleteNodeDialog(nodeid) {
3844
+ if (xxdialogMode) return false;
3845
+ var x = format("Are you sure you want to delete node {0}?", EscapeHtml(currentNode.name)) + '<br /><br /><label><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />' + "Confirm" + '</label>';
3846
+ setDialogMode(2, "Delete Node", 3, p10showDeleteNodeDialogEx, x, nodeid);
3847
+ p10validateDeleteNodeDialog();
3848
+ return false;
3849
+ }
3850
+
3851
+ function p10validateDeleteNodeDialog() {
3852
+ QE('idx_dlgOkButton', Q('p10check').checked);
3853
+ }
3854
+
3855
+ function p10showDeleteNodeDialogEx(buttons, nodeid) {
3856
+ meshserver.send({ action: 'removedevices', nodeids: [ nodeid ] });
3857
+ }
3858
+
3859
+ function p10clickOnce(nodeid, protocol, port) {
3860
+ meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'clickonce', protocol: protocol });
3861
+ return false;
3862
+ }
3863
+
3864
+ // Show current location
3865
+ var d2map = null;
3866
+ function p10showNodeLocationDialog() {
3867
+ if ((xxdialogMode != null) && (xxdialogTag == '@xxmap')) { setDialogMode(0); } else { if (xxdialogMode) return false; }
3868
+ var markers = [], types = ['iploc', 'wifiloc', 'gpsloc', 'userloc'], boundingBox = null;
3869
+
3870
+ for (var loctype in types) {
3871
+ if (currentNode[types[loctype]] != null) {
3872
+ var loc = currentNode[types[loctype]].split(','), lat = parseFloat(loc[0]), lon = parseFloat(loc[1]);
3873
+ if ((lat < 90) && (lat > -90) && (lon < 180) && (lon > -180)) { // Check valid lat/lon
3874
+ var deviceMark = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.fromLonLat([lon, lat])) });
3875
+ deviceMark.setStyle(markerStyle(currentNode, parseInt(loctype) + 1));
3876
+ markers.push(deviceMark);
3877
+
3878
+ 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; } }
3879
+ }
3880
+ }
3881
+ }
3882
+
3883
+ // Setup the device mark layer
3884
+ var vectorSource = new ol.source.Vector({ features: markers });
3885
+ var vectorLayer = new ol.layer.Vector({ source: vectorSource });
3886
+
3887
+ //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>';
3888
+ var x = '<div id=d2map style=width:100%;height:300px></div>';
3889
+ setDialogMode(2, "Device Location", 1, null, x, '@xxmap');
3890
+
3891
+ var clng = 0, clat = 0, zoom = 8;
3892
+ if (boundingBox != null) {
3893
+ var clat = (boundingBox[0] + boundingBox[2]) / 2;
3894
+ var clng = (boundingBox[1] + boundingBox[3]) / 2;
3895
+ var cscale = Math.max(Math.abs(boundingBox[0] - boundingBox[2]), Math.abs(boundingBox[1] - boundingBox[3]));
3896
+ var i = 360, zoom = -2;
3897
+ while (i > cscale) { zoom++; i = i / 2; }
3898
+ }
3899
+
3900
+ if (markers.length == 1) { zoom = 8; }
3901
+
3902
+ // Setup the map
3903
+ d2map = new ol.Map({
3904
+ target: 'd2map',
3905
+ interactions: ol.interaction.defaults({dragPan:false, mouseWheelZoom:false}),
3906
+ layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }), vectorLayer ],
3907
+ view: new ol.View({ center: ol.proj.fromLonLat([clng, clat]), zoom: zoom })
3908
+ });
3909
+ return false;
3910
+ }
3911
+
3912
+ // Show network interfaces
3913
+ function p10showNodeNetInfoDialog() {
3914
+ if (xxdialogMode) return false;
3915
+ setDialogMode(2, "Network Interfaces", 1, null, '<div id=d2netinfo>' + "Loading..." + '</div>', 'if' + currentNode._id );
3916
+ meshserver.send({ action: 'getnetworkinfo', nodeid: currentNode._id });
3917
+ return false;
3918
+ }
3919
+
3920
+ // Show MeshCentral Router dialog
3921
+ function p10showMeshRouterDialog() {
3922
+ if (xxdialogMode) return;
3923
+ var x = '<div>' + "MeshCentral Router is a Windows tool for TCP port mapping. You can, for example, RDP into a remote device thru this server." + '</div><br />';
3924
+ x += addHtmlValue('Win32 Executable', '<a style=cursor:pointer download href="meshagents?meshaction=winrouter" onclick="setDialogMode(0)">MeshCentralRouter.exe</a>');
3925
+ setDialogMode(2, "MeshCentral Router", 1, null, x, 'fileDownload');
3926
+ }
3927
+
3928
+ // Request MQTT login credentials
3929
+ function p10showMqttLoginDialog(nodeid) { meshserver.send({ action: 'getmqttlogin', nodeid: nodeid }); }
3930
+
3931
+ // Show MeshCmd dialog
3932
+ function p10showMeshCmdDialog(mode, nodeid) {
3933
+ if (xxdialogMode) return;
3934
+ var y = '<select id=aginsSelect onclick=meshCmdOsClick() style=width:236px>';
3935
+ y += '<option value=3>' + "Windows (32bit)" + '</option>';
3936
+ y += '<option value=4>' + "Windows (64bit)" + '</option>';
3937
+ y += '<option value=5>' + "Linux x86 (32bit)" + '</option>';
3938
+ y += '<option value=6>' + "Linux x86 (64bit)" + '</option>';
3939
+ y += '<option value=16>' + "MacOS (64bit)" + '</option>';
3940
+ y += '<option value=25>' + "Linux ARM, Raspberry Pi (32bit)" + '</option>';
3941
+ y += '</select>';
3942
+
3943
+ var x = '';
3944
+ 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 />'; }
3945
+ 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 />'; }
3946
+ x += addHtmlValue('Operating System', y);
3947
+ x += addHtmlValue('MeshCmd', '<a id=meshcmddownloadid href="meshagents?meshcmd=3" download></a>');
3948
+ if (mode == 0) { x += addHtmlValue('Action File', '<a href="meshagents?meshaction=generic" download>MeshAction (.txt)</a>'); }
3949
+ if (mode == 1) { x += addHtmlValue('Action File', '<a href="meshagents?meshaction=route&nodeid=' + nodeid + '" download>MeshAction (.txt)</a>'); }
3950
+ x += '</div>';
3951
+ setDialogMode(2, [ "Download MeshCmd", "Network Router" ][mode], 9, null, x, 'fileDownload');
3952
+ meshCmdOsClick();
3953
+ }
3954
+
3955
+ function meshCmdOsClick() {
3956
+ var os = Q('aginsSelect').value, osn = '', osurl = '';
3957
+ //Q('meshcmddownloadid').href = 'meshagents?meshcmd=' + os;
3958
+ if (os == 3) { osn = 'MeshCmd (Win32 executable)'; }
3959
+ if (os == 4) { osn = 'MeshCmd (Win64 executable)'; }
3960
+ if (os == 5) { osn = 'MeshCmd (Linux x86, 32bit)'; }
3961
+ if (os == 6) { osn = 'MeshCmd (Linux x86, 64bit)'; }
3962
+ if (os == 16) { osn = 'MeshCmd (MacOS, 64bit)'; }
3963
+ if (os == 25) { osn = 'MeshCmd (Linux ARM, 32bit)'; }
3964
+ QH('meshcmddownloadid', osn);
3965
+ Q('meshcmddownloadid').setAttribute('href', 'meshagents?meshcmd=' + os);
3966
+ }
3967
+
3968
+ function p10showiconselector() {
3969
+ if (xxdialogMode) return;
3970
+ var mesh = meshes[currentNode.meshid];
3971
+ var meshrights = mesh.links[userinfo._id].rights;
3972
+ if ((meshrights & 4) == 0) return;
3973
+
3974
+ var x = '<br><div style=display:inline-block;width:40px></div>';
3975
+ x += '<div tabindex=0 style=display:inline-block class=i1 onclick=p10setIcon(1) onkeypress="if (event.key==\'Enter\') p10setIcon(1)"></div>';
3976
+ x += '<div tabindex=0 style=display:inline-block class=i2 onclick=p10setIcon(2) onkeypress="if (event.key==\'Enter\') p10setIcon(2)"></div>';
3977
+ x += '<div tabindex=0 style=display:inline-block class=i3 onclick=p10setIcon(3) onkeypress="if (event.key==\'Enter\') p10setIcon(3)"></div>';
3978
+ x += '<div tabindex=0 style=display:inline-block class=i4 onclick=p10setIcon(4) onkeypress="if (event.key==\'Enter\') p10setIcon(4)"></div>';
3979
+ x += '<div tabindex=0 style=display:inline-block class=i5 onclick=p10setIcon(5) onkeypress="if (event.key==\'Enter\') p10setIcon(5)"></div>';
3980
+ x += '<div tabindex=0 style=display:inline-block class=i6 onclick=p10setIcon(6) onkeypress="if (event.key==\'Enter\') p10setIcon(6)"></div><br><br>';
3981
+ setDialogMode(2, "Icon Selection", 0, null, x);
3982
+ QV('id_dialogclose', true);
3983
+ }
3984
+
3985
+ function p10setIcon(icon) {
3986
+ setDialogMode(0);
3987
+ meshserver.send({ action: 'changedevice', nodeid: currentNode._id, icon: icon });
3988
+ }
3989
+
3990
+ var showEditNodeValueDialog_modes = ["Device Name", "Hostname", "Popis", "Tagy"];
3991
+ var showEditNodeValueDialog_modes2 = ['name', 'host', 'desc', 'tags'];
3992
+ var showEditNodeValueDialog_modes3 = ['', '', '', "Tag1, Tag2, Tag3"];
3993
+ function showEditNodeValueDialog(mode) {
3994
+ if (xxdialogMode) return;
3995
+ var x = addHtmlValue(showEditNodeValueDialog_modes[mode], '<input id=dp10devicevalue maxlength=64 placeholder="' + showEditNodeValueDialog_modes3[mode] + '" onchange=p10editdevicevalueValidate(' + mode + ',event) onkeyup=p10editdevicevalueValidate(' + mode + ',event) />');
3996
+ setDialogMode(2, "Edit Device", 3, showEditNodeValueDialogEx, x, mode);
3997
+ var v = currentNode[showEditNodeValueDialog_modes2[mode]];
3998
+ if (v == null) v = '';
3999
+ if (Array.isArray(v)) { v = v.join(', '); }
4000
+ Q('dp10devicevalue').value = v;
4001
+ p10editdevicevalueValidate();
4002
+ Q('dp10devicevalue').focus();
4003
+ }
4004
+
4005
+ function showEditNodeValueDialogEx(button, mode) {
4006
+ var x = { action: 'changedevice', nodeid: currentNode._id };
4007
+ x[showEditNodeValueDialog_modes2[mode]] = Q('dp10devicevalue').value;
4008
+ meshserver.send(x);
4009
+ }
4010
+
4011
+ function p10editdevicevalueValidate(mode, e) {
4012
+ var x = ((mode > 1) || (Q('dp10devicevalue').value.length > 0));
4013
+ QE('idx_dlgOkButton', x);
4014
+ if ((e != null) && (x == true) && (e.keyCode == 13)) { dialogclose(1); }
4015
+ }
4016
+
4017
+ //
4018
+ // DESKTOP
4019
+ //
4020
+
4021
+ var desktopNode;
4022
+ function setupDesktop() {
4023
+ // Setup the remote desktop
4024
+ if ((desktopNode != currentNode) && (desktop != null)) { desktop.Stop(); desktopNode = null; desktop = null; }
4025
+
4026
+ // If the device desktop is already connected in multi-desktop, use that.
4027
+ if ((desktopNode != currentNode) || (desktop == null)) {
4028
+ var xdesk = multiDesktop[currentNode._id];
4029
+ if (xdesk != null) {
4030
+ // This device already has a canvas, use it.
4031
+ QH('DeskParent', '');
4032
+ var c = xdesk.m.CanvasId;
4033
+ c.setAttribute('id', 'Desk');
4034
+ c.setAttribute('onmousedown', 'dmousedown(event)');
4035
+ c.setAttribute('onmouseup', 'dmouseup(event)');
4036
+ c.setAttribute('onmousemove', 'dmousemove(event)');
4037
+ c.removeAttribute('onclick');
4038
+ Q('DeskParent').appendChild(c);
4039
+ desktop = xdesk;
4040
+ if (desktop.m.SendCompressionLevel) { desktop.m.SendCompressionLevel(1, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate); }
4041
+ desktop.onStateChanged = onDesktopStateChange;
4042
+ desktopNode = currentNode;
4043
+ onDesktopStateChange(desktop, desktop.State);
4044
+ delete multiDesktop[currentNode._id];
4045
+ } else {
4046
+ // Device is not already connected, just setup a blank canvas
4047
+ QH('DeskParent', '<canvas id=Desk oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');
4048
+ desktopNode = currentNode;
4049
+ }
4050
+ // Setup the mouse wheel
4051
+ Q('Desk').addEventListener('DOMMouseScroll', function (e) { return dmousewheel(e); });
4052
+ Q('Desk').addEventListener('mousewheel', function (e) { return dmousewheel(e); });
4053
+ }
4054
+ desktopNode = currentNode;
4055
+ updateDesktopButtons();
4056
+ deskAdjust();
4057
+
4058
+ // On some browsers like IE, we can't save screen shots. Hide the scheenshot/capture buttons.
4059
+ if (!Q('Desk')['toBlob']) { QV('deskSaveBtn', false); }
4060
+ }
4061
+
4062
+ // Show and enable the right buttons
4063
+ function updateDesktopButtons() {
4064
+ var mesh = meshes[currentNode.meshid];
4065
+ var deskState = 0;
4066
+ if (desktop != null) { deskState = desktop.State; }
4067
+ var meshrights = mesh.links[userinfo._id].rights;
4068
+
4069
+ // Show the right buttons
4070
+ QV('disconnectbutton1span', (deskState != 0));
4071
+ QV('connectbutton1span', (deskState == 0) && ((meshrights & 8) || (meshrights & 256)) && (mesh.mtype == 2) && (currentNode.agent.caps & 1));
4072
+ QV('connectbutton1hspan',
4073
+ (deskState == 0) &&
4074
+ (meshrights & 8) &&
4075
+ ((mesh.mtype == 1) ||
4076
+ ((currentNode.intelamt != null) &&
4077
+ (currentNode.intelamt.state == 2) &&
4078
+ (currentNode.intelamt.ver != null) &&
4079
+ (typeof currentNode.intelamt.sku == 'number') &&
4080
+ ((currentNode.intelamt.sku & 8) != 0))
4081
+ )
4082
+ );
4083
+
4084
+ // Show the right settings
4085
+ QV('d7amtkvm', (currentNode.intelamt != null && ((currentNode.intelamt.ver != null) || (mesh.mtype == 1))) && ((deskState == 0) || (desktop.contype == 2)));
4086
+ QV('d7meshkvm', (webRtcDesktop) || ((mesh.mtype == 2) && (currentNode.agent.caps & 1) && ((deskState == false) || (desktop.contype == 1))));
4087
+
4088
+ // Enable buttons
4089
+ var inputAllowed = (meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) == 0));
4090
+ var online = ((currentNode.conn & 1) != 0); // If Agent (1) connected, enable remote desktop
4091
+ QE('connectbutton1', online);
4092
+ var hwonline = ((currentNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal
4093
+ QE('connectbutton1h', hwonline);
4094
+ QE('deskSaveBtn', deskState == 3);
4095
+ QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (deskState != 0) && (desktopsettings.showfocus));
4096
+ QV('DeskClip', (currentNode.agent) && (currentNode.agent.id != 11) && (currentNode.agent.id != 16) && ((desktop == null) || (desktop.contype != 2))); // Clipboard not supported on MacOS
4097
+ QE('DeskClip', deskState == 3);
4098
+ QE('DeskType', deskState == 3);
4099
+ QV('DeskWD', inputAllowed);
4100
+ QE('DeskWD', deskState == 3);
4101
+ QV('deskkeys', inputAllowed);
4102
+ QE('deskkeys', deskState == 3);
4103
+
4104
+ // Display this only if we have Chat & Notify permissions
4105
+ QV('DeskChatButton', ((meshrights & 16384) != 0) && (browserfullscreen == false) && (inputAllowed) && (mesh.mtype == 2) && online);
4106
+ QV('DeskNotifyButton', ((meshrights & 16384) != 0) && (browserfullscreen == false) && (currentNode.agent) && (currentNode.agent.id < 5) && (inputAllowed) && (mesh.mtype == 2) && online);
4107
+
4108
+ QV('DeskToolsButton', (inputAllowed) && (mesh.mtype == 2) && online);
4109
+ QV('DeskOpenWebButton', (browserfullscreen == false) && (inputAllowed) && (mesh.mtype == 2) && online);
4110
+ QV('DeskBackgroundButton', (deskState == 3) && (desktop.contype == 1) && (mesh.mtype == 2) && (currentNode.agent.id != 11) && (currentNode.agent.id != 16) && online);
4111
+ QV('DeskControlSpan', inputAllowed)
4112
+ QV('deskActionsBtn', (browserfullscreen == false));
4113
+ QV('deskActionsSettings', (browserfullscreen == false));
4114
+ if (meshrights & 8) { Q('DeskControl').checked = (getstore('DeskControl', 1) == 1); } else { Q('DeskControl').checked = false; }
4115
+ if (online == false) QV('DeskTools', false);
4116
+ }
4117
+
4118
+ // Debug
4119
+ var autoConnectDesktopTimer = null;
4120
+ function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(connectDesktop, 100); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } }
4121
+
4122
+ function connectDesktop(e, contype) {
4123
+ p11clearConsoleMsg();
4124
+ if (desktop == null) {
4125
+ desktopNode = currentNode;
4126
+ if (contype == 2) {
4127
+ // Setup the Intel AMT remote desktop
4128
+ if ((desktopNode.intelamt.user == null) || (desktopNode.intelamt.user == '')) { editDeviceAmtSettings(desktopNode._id, connectDesktop, 2); return; }
4129
+ desktop = CreateAmtRedirect(CreateAmtRemoteDesktop('Desk'), authCookie);
4130
+ desktop.debugmode = debugmode;
4131
+ desktop.onStateChanged = onDesktopStateChange;
4132
+ desktop.m.bpp = (desktopsettings.encoding == 1 || desktopsettings.encoding == 3) ? 1 : 2;
4133
+ desktop.m.useZRLE = (desktopsettings.encoding < 3);
4134
+ desktop.m.localKeyMap = desktopsettings.localkeymap;
4135
+ desktop.m.showmouse = desktopsettings.showmouse;
4136
+ desktop.m.onScreenSizeChange = deskAdjust;
4137
+ desktop.m.onKvmData = function (x) {
4138
+ //console.log('onKvmData (' + x.length + '): ' + x);
4139
+ // Send the presense probe only once if needed.
4140
+ if (x.length == 0) { if (!desktop.m._sentPresence) { desktop.m._sentPresence = true; desktop.m.sendKvmData(JSON.stringify({ action: 'present', ver: 1 })); } return; }
4141
+ var data = null;
4142
+ try { data = JSON.parse(x); } catch (e) { }
4143
+ if ((data != null) && (data.action != null)) {
4144
+ if (data.action == 'restart') {
4145
+ // Clear WebRTC channel
4146
+ webRtcDesktopReset();
4147
+ desktop.m.sendKvmData(JSON.stringify({ action: 'present', ver: 1 }));
4148
+ } else if ((data.action == 'present') && (webRtcDesktop == null)) {
4149
+ // Setup WebRTC channel
4150
+ webRtcDesktop = { platform: data.platform };
4151
+ var configuration = null; //{ "iceServers": [ { 'urls': 'stun:stun.services.mozilla.com' }, { 'urls': 'stun:stun.l.google.com:19302' } ] };
4152
+ if (typeof RTCPeerConnection !== 'undefined') { webRtcDesktop.webrtc = new RTCPeerConnection(configuration); }
4153
+ else if (typeof webkitRTCPeerConnection !== 'undefined') { webRtcDesktop.webrtc = new webkitRTCPeerConnection(configuration); }
4154
+
4155
+ webRtcDesktop.webchannel = webRtcDesktop.webrtc.createDataChannel("DataChannel", {}); // { ordered: false, maxRetransmits: 2 }
4156
+ webRtcDesktop.webchannel.onopen = function () {
4157
+ // Switch to software KVM
4158
+ //if (urlvars && urlvars['kvmdatatrace']) { console.log('WebRTC Data Channel Open'); }
4159
+ console.log('WebRTC Data Channel Open');
4160
+ Q('deskstatus').textContent = StatusStrs[desktop.State] + ", Soft-KVM";
4161
+ desktop.m.hold(true);
4162
+ webRtcDesktop.webRtcActive = true;
4163
+ webRtcDesktop.softdesktop = CreateKvmDataChannel(webRtcDesktop.webchannel, CreateAgentRemoteDesktop('Desk', Q('id_mainarea')), desktop.m);
4164
+ webRtcDesktop.softdesktop.m.setRotation(desktop.m.rotation);
4165
+ webRtcDesktop.softdesktop.m.onScreenSizeChange = deskAdjust;
4166
+ if (desktopsettings.quality) { webRtcDesktop.softdesktop.m.CompressionLevel = desktopsettings.quality; } // Number from 1 to 100. 50 or less is best.
4167
+ if (desktopsettings.scaling) { webRtcDesktop.softdesktop.m.ScalingLevel = desktopsettings.scaling; }
4168
+ webRtcDesktop.softdesktop.Start();
4169
+
4170
+ // Check if we can get remote file access
4171
+ // ###BEGIN###{DesktopInbandFiles}
4172
+ /*
4173
+ QV('go24', true); // Files
4174
+ downloadFile = null;
4175
+ p24files = webRtcDesktop.softdesktop;
4176
+ p24targetpath = '';
4177
+ webRtcDesktop.softdesktop.onControlMsg = onFilesControlData;
4178
+ webRtcDesktop.softdesktop.sendCtrlMsg(JSON.stringify({ action: 'ls', reqid: 1, path: '' })); // Ask for the root folder
4179
+ */
4180
+ // ###END###{DesktopInbandFiles}
4181
+ }
4182
+ webRtcDesktop.webchannel.onclose = function (event) {
4183
+ //if (urlvars['kvmdatatrace']) { console.log('WebRTC Data Channel Closed'); }
4184
+ console.log('WebRTC Data Channel Closed');
4185
+ webRtcDesktopReset();
4186
+ }
4187
+ webRtcDesktop.webrtc.onicecandidate = function (e) {
4188
+ if (e.candidate == null) {
4189
+ desktop.m.sendKvmData(JSON.stringify({ action: 'offer', ver: 1, sdp: webRtcDesktop.webrtcoffer.sdp }));
4190
+ } else {
4191
+ webRtcDesktop.webrtcoffer.sdp += ('a=' + e.candidate.candidate + '\r\n'); // New candidate, add it to the SDP
4192
+ }
4193
+ }
4194
+ webRtcDesktop.webrtc.oniceconnectionstatechange = function () {
4195
+ if ((webRtcDesktop != null) && (webRtcDesktop.webrtc != null) && ((webRtcDesktop.webrtc.iceConnectionState == 'disconnected') || (webRtcDesktop.webrtc.iceConnectionState == 'failed'))) { /*console.log('WebRTC ICE Failed');*/ webRtcDesktopReset(); }
4196
+ }
4197
+ webRtcDesktop.webrtc.createOffer(function (offer) {
4198
+ // Got the offer
4199
+ webRtcDesktop.webrtcoffer = offer;
4200
+ webRtcDesktop.webrtc.setLocalDescription(offer, function () { }, webRtcDesktopReset);
4201
+ }, webRtcDesktopReset, { mandatory: { OfferToReceiveAudio: false, OfferToReceiveVideo: false } });
4202
+ } else if ((data.action == 'answer') && (webRtcDesktop != null)) {
4203
+ // Complete the WebRTC channel
4204
+ webRtcDesktop.webrtc.setRemoteDescription(new RTCSessionDescription({ type: 'answer', sdp: data.sdp }), function () { }, webRtcDesktopReset);
4205
+ }
4206
+ }
4207
+ };
4208
+ desktop.Start(desktopNode._id, 16994, '*', '*', 0);
4209
+ desktop.contype = 2;
4210
+ } else {
4211
+ // Setup the Mesh Agent remote desktop
4212
+ desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
4213
+ desktop.debugmode = debugmode;
4214
+ desktop.m.debugmode = debugmode;
4215
+ desktop.attemptWebRTC = attemptWebRTC;
4216
+ desktop.onStateChanged = onDesktopStateChange;
4217
+ desktop.onConsoleMessageChange = function () {
4218
+ p11clearConsoleMsg();
4219
+ if (desktop.consoleMessage) {
4220
+ QH('p11DeskConsoleMsg', EscapeHtml(desktop.consoleMessage).split('\n').join('<br />'));
4221
+ QV('p11DeskConsoleMsg', true);
4222
+ p11DeskConsoleMsgTimer = setTimeout(p11clearConsoleMsg, 8000);
4223
+ }
4224
+ }
4225
+ desktop.m.CompressionLevel = desktopsettings.quality; // Number from 1 to 100. 50 or less is best.
4226
+ desktop.m.ScalingLevel = desktopsettings.scaling;
4227
+ desktop.m.FrameRateTimer = desktopsettings.framerate;
4228
+ desktop.m.onDisplayinfo = deskDisplayInfo;
4229
+ desktop.m.onScreenSizeChange = deskAdjust;
4230
+ desktop.Start(desktopNode._id);
4231
+ desktop.contype = 1;
4232
+ }
4233
+ } else {
4234
+ // Disconnect and clean up the remote desktop
4235
+ desktop.Stop();
4236
+ webRtcDesktopReset();
4237
+ desktopNode = desktop = null;
4238
+ if (pluginHandler != null) { pluginHandler.callHook('onDesktopDisconnect'); }
4239
+ }
4240
+ }
4241
+
4242
+ function p11clearConsoleMsg() { QV('p11DeskConsoleMsg', false); if (p11DeskConsoleMsgTimer) { clearTimeout(p11DeskConsoleMsgTimer); p11DeskConsoleMsgTimer = null; } }
4243
+ function p12clearConsoleMsg() { QV('p12TermConsoleMsg', false); if (p12TermConsoleMsgTimer) { clearTimeout(p12TermConsoleMsgTimer); p12TermConsoleMsgTimer = null; } }
4244
+ function p13clearConsoleMsg() { QV('p13FilesConsoleMsg', false); if (p13FilesConsoleMsgTimer) { clearTimeout(p13FilesConsoleMsgTimer); p13FilesConsoleMsgTimer = null; } }
4245
+
4246
+ var webRtcDesktop = null;
4247
+ function webRtcDesktopReset() {
4248
+ if (webRtcDesktop == null) return;
4249
+ if (webRtcDesktop.softdesktop != null) { webRtcDesktop.softdesktop.Stop(); webRtcDesktop.softdesktop = null; }
4250
+ if (webRtcDesktop.webchannel != null) { try { webRtcDesktop.webchannel.close(); } catch (e) { } webRtcDesktop.webchannel = null; }
4251
+ if (webRtcDesktop.webrtc != null) { try { webRtcDesktop.webrtc.close(); } catch (e) { } webRtcDesktop.webrtc = null; }
4252
+ webRtcDesktop = null;
4253
+ // Switch back to hardware KVM
4254
+ if (desktop && desktop.m) {
4255
+ desktop.m.hold(false);
4256
+ Q('deskstatus').textContent = StatusStrs[desktop.State];
4257
+ }
4258
+ // ###BEGIN###{DesktopInbandFiles}
4259
+ /*
4260
+ p24files = null;
4261
+ p24downloadFileCancel() // If any downloads are in process, cancel them.
4262
+ p24uploadFileCancel(); // If any uploads are in process, cancel them.
4263
+ QV('go24', false); // Files
4264
+ if (currentView == 24) { go(14); }
4265
+ */
4266
+ // ###END###{DesktopInbandFiles}
4267
+ }
4268
+
4269
+ function onDesktopStateChange(xdesktop, state) {
4270
+ var xstate = state;
4271
+ if ((xstate == 3) && (xdesktop.contype == 2)) { xstate++; }
4272
+ var str = StatusStrs[xstate];
4273
+ if ((desktop != null) && (desktop.webRtcActive == true)) { str += ", WebRTC"; }
4274
+ //if (desktop.m.stopInput == true) { str += ', Loopback'; }
4275
+ QH('deskstatus', str);
4276
+ switch (state) {
4277
+ case 0:
4278
+ // Disconnect and clean up the remote desktop
4279
+ desktop.Stop();
4280
+ desktopNode = desktop = null;
4281
+ QV('DeskFocus', false);
4282
+ QV('termdisplays', false);
4283
+ QV('deskRecordIcon', false);
4284
+ deskFocusBtn.value = "All Focus";
4285
+ if (fullscreen == true) { deskToggleFull(); }
4286
+ webRtcDesktopReset();
4287
+ deskPreferedStickyDisplay = 0;
4288
+ break;
4289
+ case 2:
4290
+ break;
4291
+ case 3:
4292
+ if (desktop && (desktop.serverIsRecording == true)) { QV('deskRecordIcon', true); }
4293
+ desktop.startTime = new Date();
4294
+ if (updateSessionTimer == null) { updateSessionTimer = setInterval(updateSessionTime, 1000); }
4295
+ break;
4296
+ default:
4297
+ //console.log('Unknown onDesktopStateChange state', state);
4298
+ break;
4299
+ }
4300
+ updateDesktopButtons();
4301
+ deskAdjust();
4302
+ setTimeout(deskAdjust, 50);
4303
+ }
4304
+
4305
+ function updateSessionTime() {
4306
+ // Desktop
4307
+ var seconds = 0;
4308
+ if (desktop && desktop.startTime) {
4309
+ seconds = Math.floor((new Date() - desktop.startTime) / 1000);
4310
+ QH('DeskTimer', zeroPad(Math.floor(seconds / 3600), 2) + ':' + zeroPad((Math.floor(seconds / 60) % 60), 2) + ':' + zeroPad((seconds % 60), 2));
4311
+ } else {
4312
+ QH('DeskTimer', '');
4313
+ }
4314
+
4315
+ // Terminal
4316
+ seconds = 0;
4317
+ if (terminal && terminal.startTime) {
4318
+ seconds = Math.floor((new Date() - terminal.startTime) / 1000);
4319
+ QH('TermTimer', zeroPad(Math.floor(seconds / 3600), 2) + ':' + zeroPad((Math.floor(seconds / 60) % 60), 2) + ':' + zeroPad((seconds % 60), 2));
4320
+ } else {
4321
+ QH('TermTimer', '');
4322
+ }
4323
+
4324
+ if ((desktop == null) && (terminal == null)) { clearInterval(updateSessionTimer); updateSessionTimer = null; }
4325
+ }
4326
+
4327
+ function showDesktopSettings() {
4328
+ if (xxdialogMode) return;
4329
+ applyDesktopSettings();
4330
+ updateDesktopButtons();
4331
+ setDialogMode(7, "Remote Desktop Settings", 3, showDesktopSettingsChanged);
4332
+ }
4333
+
4334
+ function showDesktopSettingsChanged() {
4335
+ desktopsettings.encoding = d7desktopmode.value;
4336
+ desktopsettings.showfocus = d7showfocus.checked;
4337
+ desktopsettings.showmouse = d7showcursor.checked;
4338
+ desktopsettings.quality = d7bitmapquality.value;
4339
+ desktopsettings.scaling = d7bitmapscaling.value;
4340
+ desktopsettings.framerate = d7framelimiter.value;
4341
+ desktopsettings.localkeymap = d7localKeyMap.checked;
4342
+ localStorage.setItem('desktopsettings', JSON.stringify(desktopsettings));
4343
+ applyDesktopSettings();
4344
+ if (desktop) {
4345
+ if (desktop.contype == 1) {
4346
+ if (desktop.State != 0) {
4347
+ desktop.m.SendCompressionLevel(1, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate);
4348
+ }
4349
+ }
4350
+ if (desktop.contype == 2) {
4351
+ if (desktopsettings.showfocus == false) { desktop.m.focusmode = 0; deskFocusBtn.value = "All Focus"; }
4352
+ if (desktop.State != 0) { desktop.Stop(); setTimeout(function () { connectDesktop(null, 2); }, 50); }
4353
+ }
4354
+ }
4355
+ }
4356
+
4357
+ function applyDesktopSettings() {
4358
+ var r = '', ops = (features & 512)?[90,80,70,60,50,40,30,20,10,5,1]:[60,50,40,30,20,10,5,1];
4359
+ for (var i in ops) { r += '<option value=' + ops[i] + '>' + ops[i] + '%</option>'; }
4360
+ QH('d7bitmapquality', r);
4361
+ d7desktopmode.value = desktopsettings.encoding;
4362
+ d7showfocus.checked = desktopsettings.showfocus;
4363
+ d7showcursor.checked = desktopsettings.showmouse;
4364
+ d7bitmapquality.value = 40; // Default value
4365
+ if (ops.indexOf(parseInt(desktopsettings.quality)) >= 0) { d7bitmapquality.value = desktopsettings.quality; }
4366
+ d7bitmapscaling.value = desktopsettings.scaling;
4367
+ if (desktopsettings.framerate) { d7framelimiter.value = desktopsettings.framerate; }
4368
+ if (desktopsettings.localkeymap) { d7localKeyMap.checked = desktopsettings.localkeymap; }
4369
+ QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (desktop.state != 0) && (desktopsettings.showfocus));
4370
+ }
4371
+
4372
+ // Enter browser fullscreen
4373
+ function enterBrowserFullscreen(elem) {
4374
+ if (elem.requestFullscreen) { elem.requestFullscreen(); }
4375
+ else if (elem.msRequestFullscreen) { elem.msRequestFullscreen(); }
4376
+ else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); }
4377
+ else if (elem.webkitRequestFullscreen) { elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); }
4378
+ }
4379
+
4380
+ // Exit browser fullscreen
4381
+ function exitBrowserFullscreen() {
4382
+ if (document.exitFullscreen) { document.exitFullscreen(); }
4383
+ else if (document.msExitFullscreen) { document.msExitFullscreen(); }
4384
+ else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); }
4385
+ else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); }
4386
+ }
4387
+
4388
+ // Return true if the browser is fullscreen. This is a delayed method that will return true/false late. Not very useful.
4389
+ function isBrowserFullscreen() {
4390
+ if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { return false; } else { return true; }
4391
+ }
4392
+
4393
+ var fullscreen = false;
4394
+ var browserfullscreen = false;
4395
+ function deskToggleFull(e) {
4396
+ fullscreen = !fullscreen;
4397
+ if (fullscreen) {
4398
+ QC('body').add("fulldesk");
4399
+ QS('deskarea3x')['height'] = '100%';
4400
+ QS('deskarea3x')['max-height'] = '100%';
4401
+ // If shift is pressed, enter browser full screen.
4402
+ if (e.shiftKey == true) { enterBrowserFullscreen(Q('deskarea0')); browserfullscreen = true; }
4403
+ } else {
4404
+ QC('body').remove("fulldesk");
4405
+ QS('deskarea3x')['height'] = null;
4406
+ QS('deskarea3x')['max-height'] = null;
4407
+ if (browserfullscreen == true) { exitBrowserFullscreen(); browserfullscreen = false; }
4408
+ }
4409
+ deskAdjust();
4410
+ updateDesktopButtons();
4411
+ }
4412
+
4413
+ function deskToggleFocus() {
4414
+ desktop.m.focusmode = (desktop.m.focusmode + 64) % 192;
4415
+ Q('deskFocusBtn').value = ["All Focus", "Small Focus", "Large Focus"][desktop.m.focusmode / 64];
4416
+ }
4417
+
4418
+ function deskAdjust() {
4419
+ var parentH = Q('DeskParent').clientHeight, parentW = Q('DeskParent').clientWidth;
4420
+ var deskH = Q('Desk').height, deskW = Q('Desk').width;
4421
+
4422
+ if (deskAspectRatio == 2) {
4423
+ // Scale mode
4424
+ QS('Desk')['margin-top'] = null;
4425
+ QS('Desk').height = '100%';
4426
+ QS('Desk').width = '100%';
4427
+ //QS('deskarea3x').height = null;
4428
+ QS('DeskParent').overflow = 'hidden';
4429
+ } else if (deskAspectRatio == 1) {
4430
+ // Zoomed mode
4431
+ QS('Desk')['margin-top'] = '0px';
4432
+ QS('Desk').height = deskH + 'px';
4433
+ QS('Desk').width = deskW + 'px';
4434
+ QS('DeskParent').overflow = 'scroll';
4435
+ } else {
4436
+ // Fixed aspect ratio
4437
+ if ((parentH / parentW) > (deskH / deskW)) {
4438
+ var hNew = ((deskH * parentW) / deskW) + 'px';
4439
+ //if (webPageFullScreen || fullscreen) {
4440
+ //QS('deskarea3x').height = null;
4441
+ //} else {
4442
+ // QS('deskarea3x').height = hNew;
4443
+ //QS('deskarea3x').height = null;
4444
+ //}
4445
+ QS('Desk').height = hNew;
4446
+ QS('Desk').width = '100%';
4447
+ } else {
4448
+ var wNew = ((deskW * parentH) / deskH) + 'px';
4449
+ if (webPageFullScreen || fullscreen) {
4450
+ QS('Desk').height = null;
4451
+ } else {
4452
+ QS('Desk').height = '100%';
4453
+ }
4454
+ QS('Desk').width = wNew;
4455
+ }
4456
+ QS('Desk')['margin-top'] = null;
4457
+ QS('DeskParent').overflow = 'hidden';
4458
+ }
4459
+ }
4460
+
4461
+ function mdeskAdjust(mod, sw, sh, cv) {
4462
+ if (!mod || !sw || !sh || !cv) return;
4463
+
4464
+ // Check if we are in single desktop mode
4465
+ if (cv.id == 'Desk') { deskAdjust(); return; }
4466
+
4467
+ // Figure out and adjust the size to fill the width of the div
4468
+ var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex];
4469
+ var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw);
4470
+ xw = realw + Math.floor((tw - (xw * realw)) / xw);
4471
+ vsize.y = vsize.y * (xw / vsize.x);
4472
+ vsize.x = xw;
4473
+ var mh = vsize.y, mw = vsize.x;
4474
+ if (mod.State != 0) { mh = vsize.y; mw = (sw / sh) * vsize.y; }
4475
+ QS(cv.id)['max-height'] = mh + 'px';
4476
+ QS(cv.id)['max-width'] = mw + 'px';
4477
+ QS(cv.id)['margin-top'] = '0';
4478
+ QS(cv.id)['margin-bottom'] = '0';
4479
+ }
4480
+
4481
+ // Remote desktop special key combos for Windows
4482
+ function deskSendKeys() {
4483
+ if (xxdialogMode || desktop == null || desktop.State != 3) return;
4484
+ var ks = Q('deskkeys').value;
4485
+ if (ks == 0) { // WIN+Down arrow
4486
+ if (desktop.contype == 2) {
4487
+ 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
4488
+ } else {
4489
+ 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
4490
+ }
4491
+ } else if (ks == 1) { // WIN+Up arrow
4492
+ if (desktop.contype == 2) {
4493
+ 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
4494
+ } else {
4495
+ 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
4496
+ }
4497
+ } else if (ks == 2) { // WIN+L arrow
4498
+ if (desktop.contype == 2) {
4499
+ desktop.m.sendkey([[0xffe7,1],[0x6c,1],[0x6c,0],[0xffe7,0]]); // Intel AMT: Meta-left down, 'l' press, 'l' release, Meta-left release
4500
+ } else {
4501
+ desktop.sendCtrlMsg('{"action":"lock"}');
4502
+ //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
4503
+ //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.EXDOWN, 0x5B);
4504
+ //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.DOWN, 76);
4505
+ //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.UP, 76);
4506
+ //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.EXUP, 0x5B);
4507
+ }
4508
+ } else if (ks == 3) { // WIN+M arrow
4509
+ if (desktop.contype == 2) {
4510
+ desktop.m.sendkey([[0xffe7,1],[0x6d,1],[0x6d,0],[0xffe7,0]]); // Intel AMT: Meta-left down, 'm' press, 'm' release, Meta-left release
4511
+ } else {
4512
+ 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
4513
+ }
4514
+ } else if (ks == 4) { // Shift+WIN+M arrow
4515
+ if (desktop.contype == 2) {
4516
+ 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
4517
+ } else {
4518
+ 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
4519
+ }
4520
+ } else if (ks == 5) { // WIN
4521
+ if (desktop.contype == 2) {
4522
+ desktop.m.sendkey([[0xffe7,1],[0xffe7,0]]); // Intel AMT: Meta-left down, Meta-left release
4523
+ } else {
4524
+ desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B], [desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, L-Winkey release
4525
+ }
4526
+ } else if (ks == 6) { // WIN+R
4527
+ if (desktop.contype == 2) {
4528
+ desktop.m.sendkey([[0xffe7,1],[0x72,1],[0x72,0],[0xffe7,0]]); // Intel AMT: Meta-left down, 'r' press, 'r' release, Meta-left release
4529
+ } else {
4530
+ 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
4531
+ }
4532
+ } else if (ks == 7) { // ALT-F4
4533
+ if (desktop.contype == 2) {
4534
+ desktop.m.sendkey([[0xffe9,1],[0xffc1,1],[0xffc1,0],[0xffe9,0]]); // Intel AMT: Alt down, 'F4' press, 'F4' release, Alt release
4535
+ } else {
4536
+ desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 18], [desktop.m.KeyAction.DOWN, 115], [desktop.m.KeyAction.UP, 115], [desktop.m.KeyAction.EXUP, 18]]); // MeshAgent: Alt press, 'F4' press, 'F4' release, Alt release
4537
+ }
4538
+ } else if (ks == 8) { // CTRL-W
4539
+ if (desktop.contype == 2) {
4540
+ desktop.m.sendkey([[0xffe3,1],[0x77,1],[0x77,0],[0xffe3,0]]); // Intel AMT: Ctrl down, 'w' press, 'w' release, Ctrl release
4541
+ } else {
4542
+ desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 17], [desktop.m.KeyAction.DOWN, 87], [desktop.m.KeyAction.UP, 87], [desktop.m.KeyAction.EXUP, 17]]); // MeshAgent: Ctrl press, 'W' press, 'W' release, Ctrl release
4543
+ }
4544
+ } else if (ks == 9) { // ALT-TAB
4545
+ if (desktop.contype == 2) {
4546
+ desktop.m.sendkey([[0xffe9, 1], [0xff09, 1], [0xff09, 0], [0xffe9, 0]]); // Intel AMT: Alt down, 'TAB' press, 'TAB' release, Alt release
4547
+ } else {
4548
+ desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 18], [desktop.m.KeyAction.DOWN, 9], [desktop.m.KeyAction.UP, 9], [desktop.m.KeyAction.EXUP, 18]]); // MeshAgent: Alt press, 'TAB' press, 'TAB' release, Alt release
4549
+ }
4550
+ } else if (ks == 10) { // CTRL-ALT-DEL
4551
+ desktop.m.sendcad();
4552
+ } else if (ks == 11) { // WIN-LEFT
4553
+ if (desktop.contype == 2) {
4554
+ desktop.m.sendkey([[0xffe7, 1], [0xff51, 1], [0xff51, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, Left arrow press, Left arrow release, Meta-left release
4555
+ } else {
4556
+ desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.DOWN, 37], [desktop.m.KeyAction.UP, 37], [desktop.m.KeyAction.EXUP, 0x5B]]);
4557
+ }
4558
+ } else if (ks == 12) { // WIN-RIGHT
4559
+ if (desktop.contype == 2) {
4560
+ desktop.m.sendkey([[0xffe7, 1], [0xff53, 1], [0xff53, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, Right arrow press, Right arrow release, Meta-left release
4561
+ } else {
4562
+ desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.DOWN, 39], [desktop.m.KeyAction.UP, 39], [desktop.m.KeyAction.EXUP, 0x5B]]);
4563
+ }
4564
+ }
4565
+ }
4566
+
4567
+ // Remote desktop typing
4568
+ function showDeskType() {
4569
+ if (xxdialogMode || desktop == null || desktop.State != 3) return;
4570
+ Q('DeskType').blur();
4571
+ var x = '<div>' + "Enter text and click OK to remotely type it using a US english keyboard. Make sure to place the remote cursor at the correct position before proceeding." + '<div>';
4572
+ x += '<textarea id=d2typeText style="margin-top:5px;width:100%;height:184px;resize:none" maxlength=2000></textarea>';
4573
+ setDialogMode(2, "Remote Keyboard Entry", 3, showDeskTypeEx, x);
4574
+ Q('d2typeText').focus();
4575
+ }
4576
+
4577
+ var AmtDeskTypeTimer = null;
4578
+ var AmtDeskTypeContent = null;
4579
+ var DeskTypeTranslate = { 39: 222, 42: 106, 43: 107, 44: 188, 45: 189, 46: 190, 47: 191, 59: 186, 61: 187, 91: 219, 92: 220, 93: 221, 96: 192, 191: 111 };
4580
+ var DeskTypeShiftTranslate = { 33: 49, 34: 222, 35: 51, 36: 52, 37: 53, 38: 55, 40: 57, 41: 48, 58: 186, 60: 188, 62: 190, 63: 191, 64: 50, 94: 54, 95: 189, 106: 56, 107: 187, 123: 219, 124: 220, 125: 221, 126: 192 };
4581
+ function showDeskTypeEx() {
4582
+ var txt = Q('d2typeText').value, ltxt = Q('d2typeText').value.toUpperCase(), x = [], shift = false;
4583
+ if (desktop.contype == 2) {
4584
+ // Intel AMT
4585
+ for (var i in txt) { var a = txt.charCodeAt(i); x.push([a, 1], [a, 0]); }
4586
+ AmtDeskTypeContent = x;
4587
+ AmtDeskTypeTimer = setInterval(function () {
4588
+ var key = AmtDeskTypeContent.shift();
4589
+ if (desktop) { desktop.m.sendkey(key[0], key[1]); }
4590
+ if ((desktop == null) || (AmtDeskTypeContent.length == 0)) { clearInterval(AmtDeskTypeTimer); AmtDeskTypeContent = null; }
4591
+ }, 10);
4592
+ } else {
4593
+ // MeshAgent
4594
+ for (var i in txt) {
4595
+ var a = txt.charCodeAt(i), b = ltxt.charCodeAt(i);
4596
+ if (((a >= 65) && (a <= 90)) || ((a >= 97) && (a <= 122))) {
4597
+ if ((a == b) && (shift == false)) { x.push([desktop.m.KeyAction.DOWN, 16]); shift = true; } // LShift down
4598
+ if ((a != b) && (shift == true)) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // LShift up
4599
+ } else if ((a >= 48) && (a <= 57)) {
4600
+ if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up
4601
+ } else if (DeskTypeTranslate[a]) {
4602
+ if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up
4603
+ b = DeskTypeTranslate[a];
4604
+ } else if (DeskTypeShiftTranslate[a]) {
4605
+ if (shift == false) { x.push([desktop.m.KeyAction.DOWN, 16]); shift = true; } // LShift down
4606
+ b = DeskTypeShiftTranslate[a];
4607
+ }
4608
+ x.push([desktop.m.KeyAction.DOWN, b], [desktop.m.KeyAction.UP, b]);
4609
+ }
4610
+ if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up
4611
+ desktop.m.SendKeyMsgKC(x);
4612
+ }
4613
+ }
4614
+
4615
+ // Show clipboard dialog
4616
+ function showDeskClip() {
4617
+ if (xxdialogMode || desktop == null || desktop.State != 3) return;
4618
+ Q('DeskClip').blur();
4619
+ var x = '';
4620
+ x += '<input id=dlgClipGet type=button value="Get Clipboard" style=width:120px onclick=showDeskClipGet()>';
4621
+ x += '<input id=dlgClipSet type=button value="Set Clipboard" style=width:120px onclick=showDeskClipSet()>';
4622
+ x += '<div id=dlgClipStatus style="display:inline-block;margin-left:8px" ></div>';
4623
+ x += '<textarea id=d2clipText style="width:100%;height:184px;resize:none" maxlength=65535></textarea>';
4624
+ x += '<input type=button value="Close" style=width:80px;float:right onclick=dialogclose(0)><div style=height:26px;margin-top:3px><span id=linuxClipWarn style=display:none>' + "Vzdálená schránka je platná 60 sekund." + '</span> </div><div></div>';
4625
+ setDialogMode(2, "Remote Clipboard", 8, null, x, 'clipboard');
4626
+ Q('d2clipText').focus();
4627
+ }
4628
+
4629
+ function showDeskClipGet() {
4630
+ if (desktop == null || desktop.State != 3) return;
4631
+ meshserver.send({ action: 'msg', type: 'getclip', nodeid: currentNode._id });
4632
+ }
4633
+
4634
+ function showDeskClipSet() {
4635
+ if (desktop == null || desktop.State != 3) return;
4636
+ meshserver.send({ action: 'msg', type: 'setclip', nodeid: currentNode._id, data: Q('d2clipText').value });
4637
+ QV('linuxClipWarn', currentNode && currentNode.agent && (currentNode.agent.id > 4) && (currentNode.agent.id != 21) && (currentNode.agent.id != 22));
4638
+ }
4639
+
4640
+ // Send CTRL-ALT-DEL
4641
+ function sendCAD() {
4642
+ if (xxdialogMode || desktop == null || desktop.State != 3) return;
4643
+ desktop.m.sendcad();
4644
+ }
4645
+
4646
+ // Show process dialogs
4647
+ function toggleDeskTools() {
4648
+ if (xxdialogMode) return;
4649
+ if (QS('DeskTools').display == 'none') {
4650
+ QV('DeskTools', true);
4651
+ Q('DeskTools').nodeid = currentNode._id;
4652
+ QH('DeskToolsProcesses', '');
4653
+ QH('DeskToolsServices', '');
4654
+ QV('deskToolsTopTabService', false);
4655
+ changeDeskToolTab(0)
4656
+ refreshDeskTools(0);
4657
+ refreshDeskTools(1);
4658
+ } else {
4659
+ QV('DeskTools', false);
4660
+ }
4661
+ }
4662
+
4663
+ var deskToolTabSelection = 0;
4664
+ function changeDeskToolTab(tabnum) {
4665
+ deskToolTabSelection = tabnum;
4666
+ QV('DeskToolsProcessTab', tabnum == 0);
4667
+ QV('DeskToolsServiceTab', tabnum == 1);
4668
+ QS('deskToolsTopTabProcess')['bottom'] = (tabnum == 0) ? '0px' : '3px';
4669
+ QS('deskToolsTopTabService')['bottom'] = (tabnum == 1) ? '0px' : '3px';
4670
+ QS('deskToolsTopTabProcess')['color'] = (tabnum == 0) ? 'black' : 'gray';
4671
+ QS('deskToolsTopTabService')['color'] = (tabnum == 1) ? 'black' : 'gray';
4672
+ }
4673
+
4674
+ // Refresh all of the desktop tool panels
4675
+ function refreshDeskTools(x) {
4676
+ var sel = (x == null) ? deskToolTabSelection : x;
4677
+ QV('DeskToolsRefreshButton', false);
4678
+ setTimeout(refreshDeskToolsEx, 500);
4679
+ if (sel == 0) meshserver.send({ action: 'msg', type: 'ps', nodeid: currentNode._id });
4680
+ if (sel == 1) meshserver.send({ action: 'msg', type: 'services', nodeid: currentNode._id });
4681
+ }
4682
+ function refreshDeskToolsEx() { QV('DeskToolsRefreshButton', true); }
4683
+ var deskTools = { sort: 1, ssort: 1, msg: null, smsg: null };
4684
+ function sortProcess(sort) { deskTools.sort = sort; showDeskToolsProcesses(deskTools.msg); }
4685
+ function sortService(sort) { deskTools.ssort = sort; showDeskToolsServices(deskTools.smsg); }
4686
+ function sortProcessPid(a, b) { if (a.p > b.p) return 1; if (a.p < b.p) return (-1); return sortProcessName(a, b); }
4687
+ function sortProcessName(a, b) { if (a.d > b.d) return 1; if (a.d < b.d) return (-1); return 0; }
4688
+ function showDeskToolsProcesses(message) {
4689
+ deskTools.msg = message;
4690
+ if (message == null) { QH('DeskToolsProcesses', ''); return; }
4691
+ if (Q('DeskTools').nodeid != message.nodeid) return;
4692
+ var p = [], processes = null;
4693
+ try { processes = JSON.parse(message.value); } catch (e) { }
4694
+ if (processes != null) {
4695
+ for (var pid in processes) { p.push( { p:parseInt(pid), c:processes[pid].cmd, d:processes[pid].cmd.toLowerCase(), u: processes[pid].user } ); }
4696
+ if (deskTools.sort == 0) { p.sort(sortProcessPid); } else if (deskTools.sort == 1) { p.sort(sortProcessName); }
4697
+ var x = '';
4698
+ for (var i in p) {
4699
+ if (p[i].p != 0) {
4700
+ var c = p[i].c;
4701
+ if (c.length > 30) { c = '<span title="' + c + '">' + c.substring(0,30) + '...</span>' }
4702
+ x += '<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>' + p[i].p + '</div><a href=# style=float:right;padding-right:5px;cursor:pointer title="Stop process" onclick=\'return 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>' + c + '</div></div>';
4703
+ }
4704
+ }
4705
+ QH('DeskToolsProcesses', x);
4706
+ }
4707
+ }
4708
+ function showDeskToolsServices(message) {
4709
+ deskTools.smsg = message;
4710
+ if (message == null) { QH('DeskToolsProcesses', ''); return; }
4711
+ if (Q('DeskTools').nodeid != message.nodeid) return;
4712
+ QV('deskToolsTopTabService', true);
4713
+ var s = [], services = null;
4714
+ try { services = JSON.parse(message.value); } catch (e) { }
4715
+ deskTools.services = services;
4716
+ if (services != null) {
4717
+ for (var i in services) {
4718
+ if (services[i].status) {
4719
+ // Windows
4720
+ s.push({ p: capitalizeFirstLetter(services[i].status.state.toLowerCase()), d: services[i].displayName, i: i });
4721
+ } else if (services[i].serviceType) {
4722
+ // Linux (TODO: This the service status is not displayed, not sure start/stop/restart will work).
4723
+ s.push({ p: services[i].serviceType, d: services[i].name, i: i });
4724
+ }
4725
+ }
4726
+ if (deskTools.ssort == 0) { s.sort(sortProcessPid); } else if (deskTools.ssort == 1) { s.sort(sortProcessName); }
4727
+ var x = '';
4728
+ for (var i in s) {
4729
+ if (s[i].p != 0) {
4730
+ var c = s[i].d;
4731
+ if (c.length > 30) { c = '<span title="' + c + '">' + c.substring(0, 30) + '...</span>' }
4732
+ x += '<div onclick=showServiceDetailsDialog(' + s[i].i + ') class=deskToolsBar><div style=width:70px;float:left;padding-right:5px>' + s[i].p + '</div><div>' + c + '</div></div>';
4733
+ }
4734
+ }
4735
+ QH('DeskToolsServices', x);
4736
+ }
4737
+ }
4738
+
4739
+ function showServiceDetailsDialog(index) {
4740
+ if (xxdialogMode) return;
4741
+ var service = deskTools.services[index];
4742
+ if (service != null) {
4743
+ var x = '';
4744
+ if (service.name) { x += addHtmlValue("Jméno", service.name); }
4745
+ if (service.displayName) { x += addHtmlValue("Display name", service.displayName); }
4746
+ if (service.status) {
4747
+ if (service.status.state) { x += addHtmlValue("Stav", capitalizeFirstLetter(service.status.state.toLowerCase())); }
4748
+ if (service.status.pid) { x += addHtmlValue("PID", service.status.pid); }
4749
+ var serviceTypes = [];
4750
+ if (service.status.isFileSystemDriver === true) { serviceTypes.push("FileSystemDriver"); }
4751
+ if (service.status.isInteractive === true) { serviceTypes.push("Interactive"); }
4752
+ if (service.status.isKernelDriver === true) { serviceTypes.push("KernelDriver"); }
4753
+ if (service.status.isOwnProcess === true) { serviceTypes.push("OwnProcess"); }
4754
+ if (service.status.isSharedProcess === true) { serviceTypes.push("SharedProcess"); }
4755
+ if (serviceTypes.length > 0) { x += addHtmlValue("Typ", serviceTypes.join(', ')); }
4756
+ }
4757
+ x += '<br/><div style=float:right;margin-bottom:12px><input type=button value=\"' + "Close" + '\" onclick=showServiceDetailsDialogEx(0,' + index + ')></div><div style=margin-bottom:12px><input type=button value=\"' + "Start" + '\" onclick=showServiceDetailsDialogEx(1,' + index + ')><input type=button value=\"' + "Stop" + '\" onclick=showServiceDetailsDialogEx(2,' + index + ')><input type=button value=\"' + "Restart" + '\" onclick=showServiceDetailsDialogEx(3,' + index + ')></div>';
4758
+ setDialogMode(2, "Service Details", 8, null, x, name);
4759
+ }
4760
+ }
4761
+
4762
+ function showServiceDetailsDialogEx(action, index) {
4763
+ setDialogMode(0);
4764
+ if (action == 0) return;
4765
+ var service = deskTools.services[index];
4766
+ if (service != null) {
4767
+ if (action == 1) { meshserver.send({ action: 'msg', type: 'serviceStart', nodeid: currentNode._id, serviceName: service.name }); }
4768
+ if (action == 2) { meshserver.send({ action: 'msg', type: 'serviceStop', nodeid: currentNode._id, serviceName: service.name }); }
4769
+ if (action == 3) { meshserver.send({ action: 'msg', type: 'serviceRestart', nodeid: currentNode._id, serviceName: service.name }); }
4770
+ setTimeout(function () { refreshDeskTools(1) }, 1000);
4771
+ }
4772
+ }
4773
+
4774
+ // Toggle mouse and keyboard input
4775
+ function toggleKvmControl() { putstore('DeskControl', (Q("DeskControl").checked?1:0)); }
4776
+
4777
+ // Save the desktop image to file
4778
+ function deskSaveImage() {
4779
+ if (xxdialogMode || desktop == null || desktop.State != 3) return;
4780
+ 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);
4781
+ Q('Desk')['toBlob'](function (blob) { saveAs(blob, n + '.jpg'); });
4782
+ }
4783
+
4784
+ function deskDisplayInfo(sender, displays, selDisplay) {
4785
+ var displayCount = 0, displaySelector = '';
4786
+ for (var i in displays) {
4787
+ displayCount++;
4788
+ displaySelector += '<option' + ((selDisplay == i) ? ' selected' : '') + ' value=' + i + '>' + displays[i] + '</option>';
4789
+ if ((deskPreferedStickyDisplay == i) && (selDisplay != deskPreferedStickyDisplay)) { desktop.m.SetDisplay(i); }
4790
+ }
4791
+ QH('termdisplays', displaySelector);
4792
+ QV('termdisplays', displayCount > 1);
4793
+ }
4794
+
4795
+ function deskGetDisplayNumbers(e) { desktop.m.GetDisplayNumbers(); }
4796
+ var deskPreferedStickyDisplay = 0;
4797
+ function deskSetDisplay(e) { desktop.m.SetDisplay(deskPreferedStickyDisplay = parseInt(Q('termdisplays').value)); Q('termdisplays').blur(); }
4798
+
4799
+ // Double click detection. This is important for MacOS.
4800
+ var dblClickDetectArgs = { t:0, x:0, y:0 };
4801
+ function dblClickDetect(e) {
4802
+ if (e.buttons != 1) return;
4803
+ var t = Date.now();
4804
+ if (((t - dblClickDetectArgs.t) < 250) && (Math.abs(e.clientX - dblClickDetectArgs.x) < 2) && (Math.abs(e.clientY - dblClickDetectArgs.y) < 2)) {
4805
+ 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); } }
4806
+ }
4807
+ dblClickDetectArgs.t = t;
4808
+ dblClickDetectArgs.x = e.clientX;
4809
+ dblClickDetectArgs.y = e.clientY;
4810
+ }
4811
+
4812
+ function dmousedown(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; 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); }
4813
+ function dmouseup(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; 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); } }
4814
+ function dmousemove(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; 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); } } }
4815
+ function dmousewheel(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; 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; }
4816
+ function drotate(x) { if (!xxdialogMode && desktop != null) { desktop.m.setRotation(desktop.m.rotation + x); deskAdjust(); deskAdjust(); } }
4817
+ function stopProcess(id, name) { setDialogMode(2, "Process Control", 3, stopProcessEx, format("Stop process #{0} \"{1}\"?", id, name), id); return false; }
4818
+ function stopProcessEx(buttons, tag) { meshserver.send({ action: 'msg', type: 'pskill', nodeid: currentNode._id, value: tag }); setTimeout(refreshDeskTools, 300); }
4819
+
4820
+ //
4821
+ // TERMINAL
4822
+ //
4823
+
4824
+ var terminalNode;
4825
+ function setupTerminal() {
4826
+ // Setup the terminal
4827
+ if ((terminalNode != currentNode) && (terminal != null)) { terminal.Stop(); terminal = null; }
4828
+ terminalNode = currentNode;
4829
+ updateTerminalButtons();
4830
+ }
4831
+
4832
+ // Show and enable the right buttons
4833
+ function updateTerminalButtons() {
4834
+ var mesh = meshes[terminalNode.meshid];
4835
+ var termState = ((terminal != null) && (terminal.state != 0));
4836
+
4837
+ // Show the right buttons
4838
+ QV('disconnectbutton2span', (termState == true));
4839
+ QV('connectbutton2span', (termState == false) && (mesh.mtype == 2) && (currentNode.agent.caps & 2));
4840
+ QV('connectbutton2hspan', (termState == false) && ((terminalNode.intelamt != null) && (mesh.mtype == 1 || terminalNode.intelamt.state == 2) && ((terminalNode.intelamt.ver != null) || (mesh.mtype == 1))));
4841
+
4842
+ // Enable buttons
4843
+ var online = ((terminalNode.conn & 1) != 0); // If Agent (1) connected, enable Terminal
4844
+ QE('connectbutton2', online);
4845
+ var hwonline = ((terminalNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal
4846
+ QE('connectbutton2h', hwonline);
4847
+
4848
+ // Key buttons
4849
+ QE('ctrlcbutton', termState);
4850
+ QE('ctrlxbutton', termState);
4851
+ QE('escbutton', termState);
4852
+ QE('bsbutton', termState);
4853
+ QE('pastebutton', termState);
4854
+ QE('specialkeylist', termState);
4855
+ QE('specialkeylistinput', termState);
4856
+
4857
+ // Terminal settings
4858
+ QV('terminalSettingsButtons', (terminal) && (terminal.contype == 2));
4859
+ if (terminal) {
4860
+ Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation];
4861
+ Q('id_tfxkeysbutton').value = fxEmulations[terminal.m.fxEmulation];
4862
+ Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n')?"CR+LF":"LF";
4863
+ }
4864
+ }
4865
+
4866
+ // Called when the terminal state changes
4867
+ function onTerminalStateChange(xterminal, state) {
4868
+ var xstate = state;
4869
+ if ((xstate == 3) && (xterminal.contype == 2)) { xstate++; }
4870
+ var str = StatusStrs[xstate];
4871
+ if (terminal.webRtcActive == true) { str += ", WebRTC"; }
4872
+ QH('termstatus', str);
4873
+ switch (state) {
4874
+ case 0:
4875
+ // Disconnected, clear the terminal
4876
+ QE('termSizeList', true);
4877
+ QH('termtitle', '');
4878
+ QV('termRecordIcon', false);
4879
+ xterminal.m.TermResetScreen();
4880
+ xterminal.m.TermDraw();
4881
+ if (terminal != null) { terminal.Stop(); terminal = null; }
4882
+ break;
4883
+ case 3:
4884
+ QE('termSizeList', false);
4885
+ if (xterminal && (xterminal.serverIsRecording == true)) { QV('termRecordIcon', true); }
4886
+ terminal.startTime = new Date();
4887
+ if (updateSessionTimer == null) { updateSessionTimer = setInterval(updateSessionTime, 1000); }
4888
+ break;
4889
+ default:
4890
+ QE('termSizeList', false);
4891
+ //console.log('Unhandled onTerminalStateChange state', state);
4892
+ break;
4893
+ }
4894
+ updateTerminalButtons();
4895
+ }
4896
+
4897
+ // DEBUG
4898
+ var autoConnectTerminalTimer = null;
4899
+ function autoConnectTerminal(e) { if (autoConnectTerminalTimer == null) { autoConnectTerminalTimer = setInterval(connectTerminal, 100); } else { clearInterval(autoConnectTerminalTimer); autoConnectTerminalTimer = null; } }
4900
+
4901
+ function connectTerminal(e, contype, options) {
4902
+ p12clearConsoleMsg();
4903
+ if (!terminal) {
4904
+ if (contype == 2) {
4905
+ // Setup the Intel AMT terminal
4906
+ if ((terminalNode.intelamt.user == null) || (terminalNode.intelamt.user == '')) { editDeviceAmtSettings(terminalNode._id, connectTerminal, 2); return; }
4907
+ var termoptions = {};
4908
+ if (Q('termSizeList').value == 2) { termoptions.width = 100; termoptions.height = 30; }
4909
+ terminal = CreateAmtRedirect(CreateAmtRemoteTerminal('Term', termoptions), authCookie);
4910
+ terminal.debugmode = debugmode;
4911
+ terminal.m.debugmode = debugmode;
4912
+ terminal.m.onTitleChange = function (sender, title) { QH('termtitle', ' - ' + EscapeHtml(title)); }
4913
+ terminal.onStateChanged = onTerminalStateChange;
4914
+ terminal.Start(terminalNode._id, 16994, '*', '*', 0);
4915
+ terminal.contype = 2;
4916
+ Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation];
4917
+ } else {
4918
+ // Setup a mesh agent terminal
4919
+ var termoptions = { protocol: ((options != null) && (typeof options.protocol == 'number'))?options.protocol:1 };
4920
+ if ([1, 2, 3, 4, 21, 22].indexOf(currentNode.agent.id) == -1) {
4921
+ if (Q('termSizeList').value == 2) { termoptions.width = 100; termoptions.height = 30; termoptions.xterm = true; }
4922
+ if (Q('termSizeList').value == 3) {
4923
+ // TODO: Try to improve terminal auto-size.
4924
+ termoptions.width = Math.floor((Q('column_l').clientWidth - 60) / 10);
4925
+ termoptions.height = Math.floor((Q('column_l').clientHeight - 120) / 20);
4926
+ termoptions.xterm = true;
4927
+ }
4928
+ }
4929
+
4930
+ // If shift is pressed
4931
+ if ((e && (e.shiftKey == true))) {
4932
+ if (currentNode.agent.id > 4) {
4933
+ if (termoptions.protocol == 1) { termoptions.protocol = 7; } // Switch to user shell
4934
+ } else {
4935
+ if (termoptions.protocol == 1) { termoptions.protocol = 6; } // Switch to Powershell
4936
+ }
4937
+ }
4938
+
4939
+ terminal = CreateAgentRedirect(meshserver, CreateAmtRemoteTerminal('Term', termoptions), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
4940
+ terminal.debugmode = debugmode;
4941
+ terminal.m.debugmode = debugmode;
4942
+ terminal.m.onTitleChange = function (sender, title) { QH('termtitle', ' - ' + EscapeHtml(title)); }
4943
+ terminal.m.lineFeed = ([1, 2, 3, 4, 21, 22].indexOf(currentNode.agent.id) >= 0) ? '\r\n' : '\r'; // On windows, send \r\n, on Linux only \r
4944
+ terminal.attemptWebRTC = attemptWebRTC;
4945
+ terminal.onStateChanged = onTerminalStateChange;
4946
+ terminal.onConsoleMessageChange = function () {
4947
+ p12clearConsoleMsg();
4948
+ if (terminal.consoleMessage) {
4949
+ QH('p12TermConsoleMsg', EscapeHtml(terminal.consoleMessage).split('\n').join('<br />'));
4950
+ QV('p12TermConsoleMsg', true);
4951
+ p12TermConsoleMsgTimer = setTimeout(p12clearConsoleMsg, 8000);
4952
+ }
4953
+ }
4954
+ terminal.Start(terminalNode._id);
4955
+ terminal.contype = 1;
4956
+ terminal.m.terminalEmulation = 0;
4957
+ terminal.m.fxEmulation = 0;
4958
+ Q('id_ttypebutton').value = terminalEmulations[0];
4959
+ }
4960
+ } else {
4961
+ //QH('Term', '');
4962
+ terminal.Stop();
4963
+ terminal = null;
4964
+ }
4965
+ Q('connectbutton2').blur(); // Deselect the connect button so the button does not get key presses.
4966
+ }
4967
+
4968
+ var terminalEmulations = ["UTF8 Terminal", "Extended ASCII", "Intel ASCII"];
4969
+ function termToggleType() {
4970
+ if (!terminal || xxdialogMode) return;
4971
+ terminal.m.terminalEmulation = (terminal.m.terminalEmulation + 1) % 3;
4972
+ Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation];
4973
+ Q('id_ttypebutton').blur(); // Deselect the connect button so the button does not get key presses.
4974
+ }
4975
+
4976
+ var fxEmulations = ["Intel (F10 = ESC+[OM)", "Alternate (F10 = ESC+0)", "VT100+ (F10 = ESC+[OY)"];
4977
+ function termToggleFx() {
4978
+ if (!terminal || xxdialogMode) return;
4979
+ terminal.m.fxEmulation = (terminal.m.fxEmulation + 1) % 3;
4980
+ Q('id_tfxkeysbutton').value = fxEmulations[terminal.m.fxEmulation];
4981
+ Q('id_tfxkeysbutton').blur(); // Deselect the connect button so the button does not get key presses.
4982
+ }
4983
+
4984
+ function termToggleCr() {
4985
+ if (!terminal || xxdialogMode) return;
4986
+ if (terminal.m.lineFeed == '\n') { terminal.m.lineFeed = '\r\n'; } else { terminal.m.lineFeed = '\n'; }
4987
+ Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n') ? "CR+LF" : "LF";
4988
+ }
4989
+
4990
+ function termSendKey(key, id) {
4991
+ if (!terminal || xxdialogMode) return;
4992
+ terminal.m.TermSendKey(key);
4993
+ Q(id).blur(); // Deselect the connect button so the button does not get key presses.
4994
+ }
4995
+
4996
+ function showTermPasteDialog() {
4997
+ if (!terminal || xxdialogMode) return;
4998
+ Q('pastebutton').blur();
4999
+ setDialogMode(2, "Vložit", 3, showTermPasteDialogEx, '<textarea id=d2pasteText style="width:100%;height:184px;resize:none"></textarea>');
This file is too large to show in full.
views/translations/default-mobile-min_cs.handlebars
new
+1
@@ -0,0 +1 @@
1
+<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><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,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link rel="shortcut icon"type=image/x-icon href={{{domainurl}}}favicon.ico><script src=scripts/common-0.0.1.js></script><script src=scripts/meshcentral.js></script><script src=scripts/agent-redir-ws-0.1.1.js></script><script src=scripts/agent-desktop-0.0.2.js></script><script src=scripts/amt-0.2.0.js></script><script src=scripts/amt-redir-ws-0.1.0.js></script><script src=scripts/amt-desktop-0.0.2.js></script><script src=scripts/zlib.js></script><script src=scripts/zlib-inflate.js></script><script src=scripts/zlib-adler32.js></script><script src=scripts/zlib-crc32.js></script><script keeplink=1 src=scripts/filesaver.js></script><title>{{{title}}}</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) 0 0;height:50px;width:50px;border:none}.i2{background:url(../images/icons50.png) -50px 0;height:50px;width:50px;border:none}.i3{background:url(../images/icons50.png) -100px 0;height:50px;width:50px;border:none}.i4{background:url(../images/icons50.png) -150px 0;height:50px;width:50px;border:none}.i5{background:url(../images/icons50.png) -200px 0;height:50px;width:50px;border:none}.i6{background:url(../images/icons50.png) -250px 0;height:50px;width:50px;border:none}.m0{background:url(../images/images16.png) -32px 0;height:16px;width:16px;border:none;float:left}.m1{background:url(../images/images16.png) -16px 0;height:16px;width:16px;border:none;float:left}.m2{background:url(../images/images16.png) -96px 0;height:16px;width:16px;border:none;float:left}.m3{background:url(../images/images16.png) -112px 0;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:#ddd}.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:#fff;clear:both}</style><body onload='"undefined"!=typeof startup&&startup()'style="overflow-y:hidden;margin:0;padding:0;border:0;color:#000;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) 0 0;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 id=topMenuIcon class=noselect style=position:absolute;right:0;top:10px;bottom:50px;color:#c8c8c8;font-size:44px;margin-right:8px;cursor:pointer;display:none 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:0;top:0><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%><span id=p0span>Server disconnected</span>,<href onclick=reload() style=cursor:pointer><u>klikni pro opětovné připojení</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:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div><td><img src=/images/user-50.png width=50 height=50><td><div style=margin-left:5px><strong style=font-size:large><span id=p3userName></span></strong><br></div></table><div id=p3info style=overflow-y:scroll;position:absolute;top:55px;bottom:0;width:100%><div style=margin-left:8px><div id=p3AccountActions><p><strong>Account Security</strong><div style=margin-left:9px;margin-bottom:8px><div id=manageAuthApp style=margin-top:5px;display:none><a onclick=account_manageAuthApp() style=cursor:pointer>Manage authenticator app</a></div><div id=manageOtp style=margin-top:5px;display:none><a onclick=account_manageOtp(0) style=cursor:pointer>Manage backup codes</a></div></div><p><strong>Account Actions</strong><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=changeEmailId style=display:none><a onclick=account_showChangeEmail() style=cursor:pointer>Change email address</a></span></div><div style=margin-top:5px><a onclick=account_showChangePassword() style=cursor:pointer>Změnit heslo</a><span id=p2nextPasswordUpdateTime></span></div><div style=margin-top:5px><a onclick=account_showDeleteAccount() style=cursor:pointer>Smazat účet</a></div></div><br style=clear:both></div><strong>Device Groups</strong> <span id=p3createMeshLink1>( <a onclick=account_createMesh() style=cursor:pointer><img src=images/icon-addnew.png width=12 height=12 border=0> New</a> )</span><br><br><div id=p3meshes></div><div id=p3noMeshFound style=margin-left:9px;display:none>No device groups.<span id=p3createMeshLink2> <a onclick=account_createMesh() style=cursor:pointer><strong>Get started here!</strong></a></span></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:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div><td><img src=/images/user-50.png width=50 height=50><td><div style=margin-left:5px><strong style=font-size:large>Moje soubory</strong><br></div></table><div id=p5myfiles style=overflow-y:scroll;position:absolute;top:55px;bottom:0;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 onclick=p5folderup() value=Nahoru> <input type=button style="width:calc(100%/5 - 5px)"id=p5SelectAllButton disabled onclick=p5selectallfile() value="Vybrat vše"onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5RenameFileButton disabled value=Přejmenovat onclick=p5renamefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5DeleteFileButton disabled value=Smazat onclick=p5deletefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5NewFolderButton disabled value=Adresář onclick=p5createfolder() onkeypress=return!1 onkeydown=return!1></div><div style=width:100%;text-align:center><input type=button style="width:calc(100%/5 - 5px)"id=p5UploadButton disabled value=Nahrát onclick=p5uploadFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5CutButton disabled value=Vyjmout onclick=p5copyFile(1) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5CopyButton disabled value=Kopírovat onclick=p5copyFile(0) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5PasteButton disabled value=Vložit onclick=p5pasteFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p5RefreshButton value=Obnovit onclick=p5refreshFiles() onkeypress=return!1 onkeydown=return!1></div><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 style=text-align:right;padding-right:4px><select id=p5sortdropdown onchange=updateFiles()><option value=1 selected>Třídit podle jména<option value=2>Třídit podle velikosti<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></table></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:0;background-color:#d3d9d6 cellpadding=0 cellspacing=0><tr><td style=text-align:left;padding:3px> <span id=p5bottomstatus></span><td id=p5rightOfButtons style=text-align:right;padding:3px></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:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div><td><a id=MainComputerImage style=cursor:pointer onclick=p10showiconselector()></a><td><div style=margin-left:5px><strong><span id=p10deviceName></span></strong><br><span id=MainComputerState></span></div></table><div id=p10general style=overflow-y:scroll;position:absolute;top:55px;bottom:0;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:0;width:100%;display:none><div id=deskarea1 style=position:absolute;top:0;width:100%;height:25px><div style=padding-top:2px;padding-bottom:2px;background:silver><div style=float:right;text-align:right><span id=p14power></span> <input id=DeskSoftInput style=width:25px;display:none;opacity:.2 onblur=toggleSoftKeys(0) onkeypress="return ondeskkeypress(event)"onkeydown="return ondeskkeydown(event)"onkeyup="return ondeskkeyup(event)"></div><div style=margin-left:3px><input type=button id=connectbutton1 value=Připojit onclick=connectDesktop(event,1) onkeypress=return!1 onkeydown=return!1 disabled> <input type=button id=connectbutton1h value="HW Connect"onclick=connectDesktop(event,2) onkeypress=return!1 onkeydown=return!1 disabled> <input type=button id=disconnectbutton1 value=Disconnect onclick=connectDesktop(event,0) onkeypress=return!1 onkeydown=return!1> <span id=deskstatus>Odpojeno</span></div></div></div><div id=deskarea3 style="position:absolute;top:25px;width:100%;height:calc(100% - 50px)"><div id=deskarea3x style=background:#000;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:0 oncontextmenu=return!1 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 #d3d3d3;display:none"><a id=DeskToolsRefreshButton style=float:right;padding:3px;cursor:pointer onclick=refreshDeskTools()>Obnovit</a><div id=DeskToolsBar style="position:absolute;padding:3px;border-radius:3px 3px 0 0;top:5px;left:4px;bottom:26px;background-color:#d3d3d3;cursor:pointer">Procesy</div><div style=position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:#d3d3d3;text-align:left><div style="border-bottom:1px solid #a9a9a9;padding:3px"><a style=width:50px;padding-right:5px;float:left;cursor:pointer onclick=sortProcess(0)>PID</a><a style=cursor:pointer onclick=sortProcess(1)>Jméno</a></div><div id=DeskToolsProcesses style=overflow-y:scroll;position:absolute;top:24px;bottom:0;width:100%></div></div></div></div></div><div id=deskarea4 style=position:absolute;bottom:0;width:100%;height:25px><div style=padding-top:2px;padding-bottom:2px;background:silver><div style=float:right;text-align:right><select id=termdisplays style=display:none onchange=deskSetDisplay(event) onclick=deskGetDisplayNumbers(event)></select> <span id=DeskToastButton><img src=images/icon-notify.png onclick=deviceToastFunction() height=16 width=16 style=padding-top:2px></span> </div><div><input id=deskActionsBtn type=button style=margin-left:3px onkeypress=return!1 onkeydown=return!1 value=Akce onclick=deviceActionFunction()> <input type=button value=Nastavení onkeypress=return!1 onkeydown=return!1 onclick=showDesktopSettings()> <input type=button onkeypress=return!1 onkeydown=return!1 value="Akce napájení"onclick=showPowerActionDlg() style=display:none> <input id=DeskSpecialKeys type=button value="Special Keys"onkeypress=return!1 onkeydown=return!1 onclick=sendSpecialKeys()> <input id=DeskSoftKeys type=button value=Klávesnice onkeypress=return!1 onkeydown=return!1 onclick=toggleSoftKeys(1)> <label><span id=DeskControlSpan style=display:none><input id=DeskControl type=checkbox onkeypress=return!1 onkeydown=return!1>Vstup</span></label></div></div></div></div><div id=p10files style=overflow-y:scroll;position:absolute;top:55px;bottom:0;width:100%;display:none><table id=p13toolbar style=width:100%;height:111px cellpadding=0 cellspacing=0><tr><td style="background-color:silver;border-bottom:2px solid #000;padding:2px"><div style=float:right;text-align:right><input id=filesActionsBtn type=button onkeypress=return!1 onkeydown=return!1 value=Akce onclick=deviceActionFunction() style=margin-right:2px></div><div style=margin-left:2px><input id=p13AutoConnect value=AutoConnect onclick=autoConnectFiles(event) onkeypress=return!1 onkeydown=return!1 type=button style=display:none> <input id=p13Connect value=Připojit onclick=connectFiles(event) onkeypress=return!1 onkeydown=return!1 type=button> <span id=p13Status>Odpojeno</span></div><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 onclick=p13folderup() value=Nahoru> <input type=button style="width:calc(100%/5 - 5px)"id=p13SelectAllButton disabled onclick=p13selectallfile() value="Vybrat vše"onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13RenameFileButton disabled value=Přejmenovat onclick=p13renamefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13DeleteFileButton disabled value=Smazat onclick=p13deletefile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13NewFolderButton disabled value=Adresář onclick=p13createfolder() onkeypress=return!1 onkeydown=return!1></div><div style=width:100%;text-align:center><input type=button style="width:calc(100%/5 - 5px)"id=p13UploadButton disabled value=Nahrát onclick=p13uploadFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13CutButton disabled value=Vyjmout onclick=p13copyFile(1) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13CopyButton disabled value=Kopírovat onclick=p13copyFile(0) onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13PasteButton disabled value=Vložit onclick=p13pasteFile() onkeypress=return!1 onkeydown=return!1> <input type=button style="width:calc(100%/5 - 5px)"id=p13RefreshButton disabled value=Obnovit onclick=p13folderup(9999) onkeypress=return!1 onkeydown=return!1></div><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 style=text-align:right;padding-right:4px><select id=p13sortdropdown onchange=p13updateFiles()><option value=1 selected>Třídit podle jména<option value=2>Třídit podle velikosti<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></table></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:0 cellpadding=0 cellspacing=0><tr><td style=text-align:left;padding:3px;text-align:center;background-color:#d3d9d6> <span id=p13bottomstatus></span></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:#fff;width:10px;height:10px;border-radius:10px 0 0 0;border-right:1px solid #fff;border-bottom:1px solid #fff"></div></div><div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div><td onclick=p20editmesh(1)><img src=/images/meshicon50.png width=50 height=50><td onclick=p20editmesh(1)><div style=margin-left:5px><strong style=font-size:large><span id=p20meshName></span></strong><br></div></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:0><table id=footerMenu cellpadding=0 cellspacing=0 style=height:32px;width:100%;color:#fff;cursor:pointer;table-layout:fixed></table></div></div><div id=dialog style="z-index:1000;background-color:#eee;box-shadow:0 0 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:#036;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=dialog3 style=margin:auto;margin:3px><select id=deskkeys style=width:100%><option value=10>Ctrl+Alt+Del<option value=11>Tab<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<option value=7>Alt-F4<option value=8>Ctrl-W<option value=9>Alt-Tab</select></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>Kvalita</div></div><div style="margin:3px 0 3px 0"><select id=d7bitmapscaling style=float:right;width:200px;height:20px dir=rtl><option 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>Škálování</div></div><div style="margin:3px 0 3px 0"><select id=d7framelimiter style=float:right;width:200px;height:20px dir=rtl><option selected value=50>Rychle<option value=100>Středně<option value=400>Pomalu<option value=1000>Velmi pomalu</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:#fff"><label><input type=checkbox id=d7showfocus>Show Focus Tool</label><br><label><input type=checkbox id=d7showcursor>Show Local Mouse Cursor</label><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=Zrušit 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:0 0 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:0 0 5px 5px;position:fixed;top:50px;right:5px;width:170px;display:none"><div style="padding:12px;border-top:1px solid gray;color:#000;cursor:pointer"onclick=topMenu(2)>Moje soubory</div><div style="padding:12px;border-top:1px solid gray;color:#000;cursor:pointer"onclick=topMenu(1)>Můj účet</div><div id=logoutMenuOption><a href=/logout><div style="padding:12px;border-top:1px solid gray;color:#000;cursor:pointer">Odhlásit</div></a></div></div><iframe name=fileUploadFrame style=display:none></iframe><script>"use strict";var webState="{{{webstate}}}";for(var i in""!=webState&&(webState=JSON.parse(decodeURIComponent(webState))),webState)localStorage.setItem(i,webState[i]);webState.loctag||localStorage.removeItem("loctag");var files,args=parseUriArgs(),debugLevel=parseInt("{{{debuglevel}}}"),features=parseInt("{{{features}}}"),sessionTime=parseInt("{{{sessiontime}}}"),domain="{{{domain}}}",domainUrl="{{{domainurl}}}",authCookie="{{{authCookie}}}",authRelayCookie="{{{authRelayCookie}}}",authCookieRenewTimer=null,meshserver=null,xdr=null,serverinfo=null,nodes=[],meshes={},filetree={},userinfo=null,users=(serverinfo=null,null),nodeShortIdent=0,serverPublicNamePort="{{{serverDnsName}}}:{{{serverPublicPort}}}",debugmode=!1,attemptWebRTC=0!=(128&features),StatusStrs=["Odpojeno","Connecting...","Setup...","Connected","Intel® AMT Connected"],passRequirements="{{{passRequirements}}}";""!=passRequirements&&(passRequirements=JSON.parse(decodeURIComponent(passRequirements)));var sessionActivity=Date.now();function startup(){if(0==(32&features)){var e=null;try{e=top.location.toString().toLowerCase()}catch(e){}if(top!=self&&(null==e||0==top.active))return void(top.location=self.location)}if(!args.locale){var t=getstore("loctag",0);null!=t&&"*"!=t&&(args.locale=t)}(window.onresize=center)(),QV("changeEmailId",0==(2097152&features)),QH("p1message","Connecting..."),go(1),(meshserver=MeshServerCreateControl(domainUrl,authCookie)).onStateChanged=onStateChanged,meshserver.onMessage=onMessage,meshserver.Start();var o=localStorage.getItem("desktopsettings");null!=o&&(desktopsettings=JSON.parse(o)),applyDesktopSettings()}function onStateChanged(e,t,o,n){if(0==t){if(setDialogMode(0),go(0),"noauth"==n)return void QH("p0span","Unable to perform authentication");2==o?setTimeout(serverPoll,5e3):QH("p0span","Unable to connect web socket"),null!=authCookieRenewTimer&&(clearInterval(authCookieRenewTimer),authCookieRenewTimer=null)}else 2==t&&(meshserver.send({action:"meshes"}),meshserver.send({action:"nodes"}),meshserver.send({action:"files"}),xxcurrentView<2&&go(2),authCookieRenewTimer=setInterval(function(){meshserver.send({action:"authcookie"})},18e5));QV("topMenuIcon",2==t)}function serverPoll(){xdr=null;try{xdr=new XDomainRequest}catch(e){}(xdr=xdr||new XMLHttpRequest).open("HEAD",window.location.href),xdr.timeout=15e3,xdr.onload=function(){reload()},xdr.onerror=xdr.ontimeout=function(){setTimeout(serverPoll,1e4)},xdr.send()}function updateSelf(){if(QV("verifyEmailId",!0!==userinfo.emailVerified&&null!=userinfo.email&&1==serverinfo.emailcheck),QV("manageAuthApp",4096&features),QV("manageOtp",0!=(4096&features)&&(1==userinfo.otpsecret||0<userinfo.otphkeys)),QV("p3createMeshLink1",!1),QV("p3createMeshLink2",!1),"number"==typeof userinfo.passchange)if(-1==userinfo.passchange)QH("p2nextPasswordUpdateTime"," - Reset on next login.");else if(null!=passRequirements&&"number"==typeof passRequirements.reset){var e=userinfo.passchange+86400*passRequirements.reset-Math.floor(Date.now()/1e3);e<0?QH("p2nextPasswordUpdateTime"," - Reset on next login."):e<3600?QH("p2nextPasswordUpdateTime",format(" - Reset in {0} minute{1}.",Math.floor(e/60),addLetterS(Math.floor(e/60)))):e<86400?QH("p2nextPasswordUpdateTime",format(" - Reset in {0} hour{1}.",Math.floor(e/3600),addLetterS(Math.floor(e/3600)))):QH("p2nextPasswordUpdateTime",format(" - Reset v {0} den{1}."),Math.floor(e/86400),addLetterS(Math.floor(e/86400)))}}function addLetterS(e){return 1<e?"s":""}function setSessionActivity(){sessionActivity=Date.now()}function checkIdleSessionTimeout(){Date.now()-sessionActivity>serverinfo.timeout&&(window.location.href="logout")}function onMessage(e,t){switch(t.action){case"serverinfo":(serverinfo=t.serverinfo).timeout&&(setInterval(checkIdleSessionTimeout,1e4),checkIdleSessionTimeout()),QV("p3AccountActions",0==(4&features)&&0==serverinfo.domainauth),QV("logoutMenuOption",0==(4&features)&&0==serverinfo.domainauth);break;case"authcookie":authCookie=t.cookie,authRelayCookie=t.rcookie;break;case"userinfo":userinfo=t.userinfo,QH("p3userName",userinfo.name),updateSelf();break;case"users":for(var o in users={},t.users)users[t.users[o]._id]=t.users[o];updateUsers();break;case"wssessioncount":wssessions=t.wssessions,updateUsers();break;case"meshes":for(var o in meshes={},t.meshes)meshes[t.meshes[o]._id]=t.meshes[o];updateMeshes(),updateDevices();break;case"files":filetree=setupBackPointers(t.filetree),updateFiles();break;case"nodes":for(var o in nodes=[],t.nodes)for(var n in t.nodes[o])meshes[o]?(t.nodes[o][n].namel=t.nodes[o][n].name.toLowerCase(),t.nodes[o][n].rname?t.nodes[o][n].rnamel=t.nodes[o][n].rname.toLowerCase():t.nodes[o][n].rnamel=t.nodes[o][n].namel,t.nodes[o][n].meshnamel=meshes[o].name.toLowerCase(),t.nodes[o][n].meshid=o,t.nodes[o][n].state=t.nodes[o][n].state?t.nodes[o][n].state:0,t.nodes[o][n].desc=t.nodes[o][n].desc,t.nodes[o][n].icon||(t.nodes[o][n].icon=1),t.nodes[o][n].ident=++nodeShortIdent,nodes.push(t.nodes[o][n])):console.log("Invalid mesh (1): "+o);updateDevices(),0==xxcurrentView&&go(parseInt("{{viewmode}}")),gotoDevice("{{currentNode}}",parseInt("{{viewmode}}"));break;case"powertimeline":if(t.nodeid!=powerTimelineReq)break;powerTimelineNode=t.nodeid,powerTimeline=t.timeline,powerTimelineUpdate=Date.now()+3e5,currentNode._id==t.nodeid&&drawDeviceTimeline();break;case"otpauth-request":if(2==xxdialogMode&&"otpauth-request"==xxdialogTag){var i=t.secret;52==i.length?i=i.split(/(.............)/).filter(Boolean).join(" "):32==i.length&&(i=(i=i.split(/(....)/).filter(Boolean).join(" ")).substring(0,20)+"<br/>"+i.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="\' + message.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="'+t.secret+'" style=font-size:15px>'+i+'</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",!0),QE("idx_dlgOkButton",!1),Q("d2otpauthinput").focus()}break;case"otpauth-setup":if(xxdialogMode)return;setDialogMode(2,"Authenticator App",1,null,t.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,"Authenticator App",1,null,t.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"otpauth-getpasswords":if(xxdialogMode)return;var a="One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";if(a+="<div style='border-radius:6px;border: 2px dashed #888;width:100%;margin-top:8px'><div style='padding:8px;font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold'><table style=width:100%;text-align:center>",t.passwords){var s=0;for(var l in t.passwords){++s%2&&(a+="<tr>");for(var r=""+t.passwords[l].p;r.length<8;)r="0"+r;!0===t.passwords[l].u?a+="<td>"+r.substring(0,4)+" "+r.substring(4):a+="<td><strike style=color:#BBB>"+r.substring(0,4)+" "+r.substring(4)}}else a+="<tr><td>No Active Tokens";a+="</table></div></div><br />",a+="<div><input type=button value='Close' onclick=setDialogMode(0) style=float:right></input>",a+="<input type=button value='New Tokens' onclick='account_manageOtp(1);'></input>",null!=t.passwords&&(a+="<input type=button value='Clear' onclick='account_manageOtp(2);'></input>"),setDialogMode(2,"Manage Backup Codes",8,null,a+="</div><br />","otpauth-manage");break;case"event":if(t.event.noact)break;switch(t.event.action){case"userWebState":if(null!=localStorage){var d=JSON.parse(t.event.state);for(var l in d)localStorage.setItem(l,d[l]);null!=d.loctag&&d.loctag!=oldLoctag&&(null!=d.loctag?args.locale=d.loctag:delete args.locale,updateDevices(),updateMeshes())}break;case"accountchange":if(userinfo.name==t.event.account.name){var p=t.event.account.siteadmin?t.event.account.siteadmin:0,c=userinfo.siteadmin?userinfo.siteadmin:0;(t.event.account.quota!=userinfo.quota||0==(8&userinfo.siteadmin)&&0!=(8&t.event.account.siteadmin))&&meshserver.send({action:"files"}),userinfo=t.event.account,c!=p&&updateSiteAdmin(),updateSelf()}break;case"createmesh":null!=t.event.links[userinfo._id]&&(meshes[t.event.meshid]={_id:t.event.meshid,name:t.event.name,mtype:t.event.mtype,desc:t.event.desc,links:t.event.links},updateMeshes(),updateDevices(),meshserver.send({action:"files"}));break;case"meshchange":if(null==meshes[t.event.meshid])meshes[t.event.meshid]={_id:t.event.meshid,name:t.event.name,mtype:t.event.mtype,desc:t.event.desc,links:t.event.links},meshserver.send({action:"nodes"});else{if(meshes[t.event.meshid].name!=t.event.name)for(var l in meshes[t.event.meshid].name=t.event.name,nodes)nodes[l].meshid==t.event.meshid&&(nodes[l].meshnamel=t.event.name.toLowerCase());if(meshes[t.event.meshid].desc=t.event.desc,meshes[t.event.meshid].links=t.event.links,null==meshes[t.event.meshid].links[userinfo._id]){20==xxcurrentView&¤tMesh==meshes[t.event.meshid]&&go(2),delete meshes[t.event.meshid];var u=[];for(var l in nodes)nodes[l].meshid!=t.event.meshid&&u.push(nodes[l]);nodes=u,10<=xxcurrentView&&xxcurrentView<20&¤tNode&¤tNode.meshid==t.event.meshid&&(setDialogMode(0),go(2))}}updateMeshes(),updateDevices(),meshserver.send({action:"files"}),20==xxcurrentView&¤tMesh._id==t.event.meshid&&p20updateMesh();break;case"deletemesh":meshes[t.event.meshid]&&(delete meshes[t.event.meshid],updateMeshes(),meshserver.send({action:"files"}));u=[];for(var l in nodes)nodes[l].meshid!=t.event.meshid&&u.push(nodes[l]);nodes=u,updateDevices(),20<=xxcurrentView&&xxcurrentView<30&¤tMesh._id==t.event.meshid&&(setDialogMode(0),go(2)),10<=xxcurrentView&&xxcurrentView<20&¤tNode&¤tNode.meshid==t.event.meshid&&(setDialogMode(0),go(2));break;case"addnode":var m=t.event.node;if(!meshes[m.meshid])break;if(null!=getNodeFromId(m._id))break;m.namel=m.name.toLowerCase(),m.rname?m.rnamel=m.rname.toLowerCase():m.rnamel=m.namel,m.meshnamel=meshes[m.meshid].name.toLowerCase(),m.state=0,m.icon||(m.icon=1),m.ident=++nodeShortIdent,nodes.push(m),updateDevices();break;case"removenode":var h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h){m=nodes[h];currentNode==m&&(10<=xxcurrentView&&xxcurrentView<20&&(setDialogMode(0),go(2)),currentNode=null),nodes.splice(h,1),updateDevices()}break;case"changenode":h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h)(m=nodes[h]).name=t.event.node.name,m.rname=t.event.node.rname,m.host=t.event.node.host,m.desc=t.event.node.desc,m.publicip=t.event.node.publicip,m.iploc=t.event.node.iploc,m.wifiloc=t.event.node.wifiloc,m.gpsloc=t.event.node.gpsloc,m.tags=t.event.node.tags,m.userloc=t.event.node.userloc,null!=t.event.node.agent&&(null==m.agent&&(m.agent={}),null!=t.event.node.agent.ver&&(m.agent.ver=t.event.node.agent.ver),null!=t.event.node.agent.id&&(m.agent.id=t.event.node.agent.id),null!=t.event.node.agent.caps&&(m.agent.caps=t.event.node.agent.caps),null!=t.event.node.agent.core?m.agent.core=t.event.node.agent.core:m.agent.core&&delete m.agent.core,m.agent.tag=t.event.node.agent.tag),null!=t.event.node.intelamt&&(null==m.intelamt&&(m.intelamt={}),null!=t.event.node.intelamt.state&&(m.intelamt.state=t.event.node.intelamt.state),null!=t.event.node.intelamt.host&&(m.intelamt.user=t.event.node.intelamt.host),null!=t.event.node.intelamt.user&&(m.intelamt.user=t.event.node.intelamt.user),null!=t.event.node.intelamt.tls&&(m.intelamt.tls=t.event.node.intelamt.tls),null!=t.event.node.intelamt.ver&&(m.intelamt.ver=t.event.node.intelamt.ver),null!=t.event.node.intelamt.tag&&(m.intelamt.tag=t.event.node.intelamt.tag),null!=t.event.node.intelamt.uuid&&(m.intelamt.uuid=t.event.node.intelamt.uuid),null!=t.event.node.intelamt.realm&&(m.intelamt.realm=t.event.node.intelamt.realm)),m.namel=m.name.toLowerCase(),m.rname?m.rnamel=m.rname.toLowerCase():m.rnamel=m.namel,t.event.node.icon&&(m.icon=t.event.node.icon),refreshDevice(m._id),updateDevices();break;case"nodemeshchange":h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h){m=nodes[h];null==meshes[t.event.newMeshId]?(currentNode==m&&(10<=xxcurrentView&&xxcurrentView<20&&(setDialogMode(0),go(2)),currentNode=null),nodes.splice(h,1)):(m.meshid=t.event.newMeshId,m.meshnamel=meshes[t.event.newMeshId].name.toLowerCase()),updateDevices(),refreshDevice(t.event.nodeid)}else{m=t.event.node;if(!meshes[m.meshid])break;m.namel=m.name.toLowerCase(),m.rname?m.rnamel=m.rname.toLowerCase():m.rnamel=m.namel,m.meshnamel=meshes[m.meshid].name.toLowerCase(),m.state=0,m.icon||(m.icon=1),m.ident=++nodeShortIdent,nodes.push(m),updateDevices()}break;case"nodeconnect":h=-1;for(var l in nodes)if(nodes[l]._id==t.event.nodeid){h=l;break}if(-1!=h)(m=nodes[h]).conn=t.event.conn,m.pwr=t.event.pwr,updateDevices();break;case"login":null!=users&&users["user/"+domain+"/"+t.event.username.toLowerCase()]&&(users["user/"+domain+"/"+t.event.username.toLowerCase()].login=t.event.time)}}}function topMenu(e){null!=xxdialogMode&&0!=xxdialogMode&&999!=xxdialogMode||(void 0===e?1==("none"==QS("topMenu").display)?0!=xxdialogMode&&null!=xxdialogMode||(QV("topMenu",!0),xxdialogMode=999):(QV("topMenu",!1),xxdialogMode=0):(QV("topMenu",!1),xxdialogMode=0,1==e&&3!=xxcurrentView&&goForward("account"),2==e&&5!=xxcurrentView&&goForward("files")))}var filetreelinkpath,backStack=[];function goBack(){xxdialogMode||(0<backStack.length&&backStack.pop(),goStack())}function goForward(e){xxdialogMode||(backStack.push(e),goStack())}function goStack(){if(0!=backStack.length){var e=backStack[backStack.length-1],t=e.split("/")[0];"node"==t&&(setupDeviceMenu(0),gotoDevice(e)),"mesh"==t&&gotoMesh(e),"account"==t&&go(3),"devices"==t&&go(2),"files"==t&&go(5)}else go(2)}function updateFooterMenu(e){for(;null!=e&&e.length<3;)e.push({n:""});var t="",o="";if(null!=e)for(var n in e)t+='<td style="cursor:pointer'+(""==o?"":";border-left:solid 1px white")+'" onclick="'+e[n].f+'">'+e[n].n,o=e[n].n;QH("footerMenu","<tr>"+t)}function account_manageAuthApp(){xxdialogMode||0==(4096&features)||(1==userinfo.otpsecret?account_removeOtp():account_addOtp())}function account_addOtp(){xxdialogMode||1==userinfo.otpsecret||0==(4096&features)||(setDialogMode(2,"Authenticator App",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(e){var t=6==Q("d2otpauthinput").value.length;QE("idx_dlgOkButton",t),e&&13==e.keyCode&&t&&dialogclose(1)}function account_removeOtp(){xxdialogMode||1!=userinfo.otpsecret||0==(4096&features)||setDialogMode(2,"Authenticator App",3,function(){meshserver.send({action:"otpauth-clear"})},"Confirm removal of authenticator application 2-step login?")}function account_manageOtp(e){2==xxdialogMode&&"otpauth-manage"==xxdialogTag&&dialogclose(0),xxdialogMode||1!=userinfo.otpsecret||0==(4096&features)||meshserver.send({action:"otpauth-getpasswords",subaction:e})}function account_showVerifyEmail(){xxdialogMode||1==userinfo.emailVerified||1!=serverinfo.emailcheck||setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,"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.")}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){xxdialogMode||(setDialogMode(2,"Změna emailové adresy",3,account_changeEmail,addHtmlValue("Email","<input id=dp3email style=width:170px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />")),null!=userinfo.email&&(Q("dp3email").value=userinfo.email),account_validateEmail(),Q("dp3email").focus())}function account_validateEmail(e,t){QE("idx_dlgOkButton",validateEmail(Q("dp3email").value)&&Q("dp3email").value!=userinfo.email),null!=e&&13==e.keyCode&&dialogclose(1)}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp3email").value})}function account_showDeleteAccount(){if(!xxdialogMode){var e="<form method=post><table style=margin-left:10px><input type=hidden name=action value=deleteaccount /><input type=hidden name=authcookie value="+authCookie+" /><tr>";e+="<td align=right>Heslo:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>",e+="</tr><tr><td align=right>Heslo:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>",e+="</tr></table><div style=padding:10px;margin-bottom:4px>",e+='<input id=account_dlgCancelButton type=button value="Zrušit" style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>',e+='<input id=account_dlgOkButton type=submit value="OK" style="float:right;width:80px" onclick=dialogclose(1)>',setDialogMode(2,"Smazat účet",0,null,e+="</div><br /></form>"),account_validateDeleteAccount(),Q("apassword1").focus()}}function account_showChangePassword(){if(xxdialogMode)return!1;var e="<table style=margin-left:10px>";if(e+="<tr><td align=right>"+nobreak("Staré heslo:")+"</td><td><input id=apassword0 type=password name=apassword0 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b></b></td></tr>",e+="<tr><td align=right>"+nobreak("Nové heslo:")+"</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></tr>",e+="<tr><td align=right>"+nobreak("Nové heslo:")+"</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>",65536&features&&(e+="<tr><td align=right>Nápovšda k heslu:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>"),e+="</table>",passRequirements){var t=[],o=0;for(var n in passRequirements)"reset"!=n&&"hint"!=n&&(t.push(n+":"+passRequirements[n]),o++);0<o&&(e+="<br /><span style=font-size:x-small>"+format("Requirements: {0}.",t.join(", "))+"</span>")}return setDialogMode(2,"Změnit heslo",3,account_showChangePasswordEx,e+="<br />"),Q("apassword0").focus(),account_validateNewPassword(),!1}function account_showChangePasswordEx(){if(Q("apassword1").value==Q("apassword2").value){var e={action:"changepassword",oldpass:Q("apassword0").value,newpass:Q("apassword1").value};65536&features&&(e.hint=Q("apasswordhint").value),meshserver.send(e)}}function account_createMesh(){if(!xxdialogMode)if(4294967295==userinfo.siteadmin||0==(64&userinfo.siteadmin))if(!0===userinfo.emailVerified||1!=serverinfo.emailcheck||4294967295==userinfo.siteadmin)if(!(262144&features)||1==userinfo.otpsecret||0<userinfo.otphkeys||0<userinfo.otpkeys){var e=addHtmlValue("Jméno","<input id=dp3meshname style=width:170px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />");e+=addHtmlValue("Typ","<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>"),setDialogMode(2,"Vytvořit skupinu zařízení",3,account_createMeshEx,e+=addHtmlValue("Popis","<div style=width:170px;margin:0;padding:0><textarea id=dp3meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>")),account_validateMeshCreate(),Q("dp3meshname").focus()}else setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');else setDialogMode(2,"Account Security",1,null,'Unable to access a device until a email address is verified. This is required for password recovery. Go to the "My Account" to change and verify an email address.');else setDialogMode(2,"Nová skupina zařízení",1,null,"This account does not have the rights to create a new device group.")}function account_validateMeshCreate(){QE("idx_dlgOkButton",0<Q("dp3meshname").value.length)}function account_createMeshEx(e,t){meshserver.send({action:"createmesh",meshname:Q("dp3meshname").value,meshtype:Q("dp3meshtype").value,desc:Q("dp3meshdesc").value})}function account_validateDeleteAccount(){QE("account_dlgOkButton",0<Q("apassword1").value.length&&Q("apassword1").value==Q("apassword2").value)}function account_validateNewPassword(){var e="",t=0<Q("apassword0").value.length&&0<Q("apassword1").value.length&&Q("apassword1").value==Q("apassword2").value&&Q("apassword0").value!=Q("apassword1").value;if(65536&features&&Q("apasswordhint").value==Q("apassword1").value&&(t=!1),""!=Q("apassword1").value)if(null==passRequirements||""==passRequirements){var o=checkPasswordStrength(Q("apassword1").value);e=80<=o?"<span style=color:green>Strong<span>":60<=o?"<span style=color:blue>●<span>":"<span style=color:red>●<span>"}else{0==checkPasswordRequirements(Q("apassword1").value,passRequirements)&&(t=!1,e="<span style=color:red>Policy<span>")}QH("dxPassWarn",e),QE("idx_dlgOkButton",t)}function checkPasswordStrength(e){var t=0,o={},n=0,i={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e)return 0;for(var a=0;a<e.length;a++)o[e[a]]=(o[e[a]]||0)+1,t+=5/o[e[a]];for(var s in i)n+=1==i[s]?1:0;return parseInt(t+10*(n-1))}function checkPasswordRequirements(e,t){if(null==t||""==t||"object"!=typeof t)return!0;if(t.min&&e.length<t.min)return!1;if(t.max&&e.length>t.max)return!1;for(var o=0,n=0,i=0,a=0,s=0;s<e.length;s++)/\d/.test(e[s])&&o++,/[a-z]/.test(e[s])&&n++,/[A-Z]/.test(e[s])&&i++,/\W/.test(e[s])&&a++;return!(t.num&&o<t.num)&&(!(t.lower&&n<t.lower)&&(!(t.upper&&i<t.upper)&&!(t.nonalpha&&a<t.nonalpha)))}function updateMeshes(){var e="",t=0;for(i in meshes){t++;var o=meshes[i].links[userinfo._id].rights,n="Partial Rights";4294967295==o?n="Full Administrator":0==o&&(n="No Rights"),e+="<div style=cursor:pointer onclick=goForward('"+i+"')>",e+='<div style="float:left;margin-left:4px"><img src="/images/meshicon50.png" width=50 height=50 /></div>',e+='<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">',e+="<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>"+n+"</div></div>",e+="</div></div>"}QH("p3meshes",e),QV("p3noMeshFound",0==t)}function gotoMesh(e){null==(currentMesh=meshes[e])&&goBack(),p20updateMesh(),go(20)}var sortorder,filetreelocation=[];function p5refreshFiles(){meshserver.send({action:"files"})}function updateFiles(){if(QV("MainMenuMyFiles",0==(8&features)),0==(8&features)){for(var e,t="",o="",n="<a style=cursor:pointer onclick=p5folderup(0)>Root</a>",i="Root",a=filetree,s=1,l=[],r=filetreelinkpath,d=[],p=document.getElementsByName("fc"),c=0;c<p.length;c++)p[c].checked&&d.push(p[c].value);for(var c in filetreelinkpath="",filetreelocation){if(null==a.f||null==a.f[filetreelocation[c]])break;if(l.push(filetreelocation[c]),i+=" / "+filetreelocation[c],1==s){var u=filetreelocation[c].split("/");e=window.location+u[0]+"files/"+u[2],filetreelinkpath+=filetreelocation[c]}else""!=filetreelinkpath&&(filetreelinkpath+="/"+filetreelocation[c],2<s&&(e+="/"+filetreelocation[c]));n+=" / <a style=cursor:pointer onclick=p5folderup("+s+")>"+(null!=(a=a.f[filetreelocation[c]]).n?a.n:filetreelocation[c])+"</a>",s++}filetreelocation=l;var m=i.toLowerCase().startsWith("root / "+userinfo._id+" / public"),h=p5sort_files(a.f);for(var c in h){var f,g=h[c],v=g.n;f=40<(f=v).length?EscapeHtml(v.substring(0,40))+"...":EscapeHtml(v),v=EscapeHtml(v);var k="";null!=g.s&&(k=getFileSizeStr(g.s));var y="";if(g.t<3||4==g.t){y="<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+v+"'> <span style=float:right;padding-right:4px>"+(1==g.t||4==g.t?p5getQuotabar(g):"")+"</span><span><div class=fileIcon"+g.t+'></div><a style=cursor:pointer onclick=p5folderset("'+encodeURIComponent(g.nx)+'")>'+f+"</a></span></div>"}else{var b=f,x="";m&&(x=" (<a style=cursor:pointer onclick='p5showPublicLink(\""+e+"/"+g.nx+"\")'>Link</a>)"),0<g.s&&(b='<a rel="noreferrer noopener" target="_blank" href="downloadfile.ashx?link='+encodeURIComponent(filetreelinkpath+"/"+g.nx)+'">'+f+"</a>"+x),y="<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='"+g.nx+"'> <span style=float:right;padding-right:4px>"+k+"</span><span><div class=fileIcon"+g.t+"></div>"+b+"</span></div>"}g.t<3?t+=y:o+=y}if(QH("p5rightOfButtons",p5getQuotabar(a)),QH("p5files",t+o),QH("p5currentpath",n),QE("p5FolderUp",0!=filetreelocation.length),QV("p5PublicShare",m),r==filetreelinkpath){p=document.getElementsByName("fc");for(c=0;c<p.length;c++)p[c].checked=0<=d.indexOf(p[c].value)}p5setActions()}}function getNiceSize(e){return e<=0?"Uložiště plné":e<2048?format("{0}b left",e):e<2097152?format("{0}k zbývá",Math.round(e/1024)):e<2147483648?format("{0}m left",Math.round(e/1024/1024)):format("{0}g left",Math.round(e/1024/1024/1024))}function p5getQuotabar(e){for(;1<e.t&&4!=e.t;)e=e.parent;return 1!=e.t&&4!=e.t||null==e.maxbytes?"":getNiceSize(e.maxbytes-e.s)+" <progress style=height:10px;width:100px value="+e.s+" max="+e.maxbytes+" />"}function p5showPublicLink(e){setDialogMode(2,"Veřejný odkaz",1,null,'<input type=text style=width:100% value="'+e+'" readonly />')}function p5sort_filename(e,t){return e.ln>t.ln?1*sortorder:e.ln<t.ln?-1*sortorder:0}function p5sort_timestamp(e,t){return e.d>t.d?1*sortorder:e.d<t.d?-1*sortorder:0}function p5sort_bysize(e,t){return e.s==t.s?p5sort_filename(e,t):(e.s-t.s)*sortorder}function p5sort_files(e){var t=[],o=Q("p5sortdropdown").value;for(var n in e)e[n].nx=n,null==e[n].n&&(e[n].n=n),e[n].ln=e[n].n.toLowerCase(),t.push(e[n]);return sortorder=1,3<o&&(sortorder=-1,o-=3),1==o?t.sort(p5sort_filename):2==o?t.sort(p5sort_bysize):3==o&&t.sort(p5sort_timestamp),t}function p5setActions(){var e=getFileSelCount(),t=getFileCount(),o=getFileSelCount(!1);QE("p5DeleteFileButton",0<e&&0<filetreelocation.length),QE("p5NewFolderButton",0<filetreelocation.length),QE("p5UploadButton",0<filetreelocation.length),QE("p5RenameFileButton",1==e&&0<filetreelocation.length),QE("p5SelectAllButton",0<t),Q("p5SelectAllButton").value=0<e?"Nic":"Vše",QE("p5CutButton",0<o&&e==o),QE("p5CopyButton",0<o&&e==o),QE("p5PasteButton",null!=p5clipboard&&0<p5clipboard.length&&0<filetreelocation.length)}function getFileSelCount(e){for(var t=0,o=document.getElementsByName("fc"),n=0;n<o.length;n++)!o[n].checked||0==e&&"3"!=o[n].attributes.file.value||t++;return t}function getFileSelDirCount(){for(var e=0,t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked&&"999"==t[o].attributes.file.value&&e++;return e}function getFileCount(){return document.getElementsByName("fc").length}function p5selectallfile(){for(var e=0==getFileSelCount(),t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked=e;p5setActions()}function setupBackPointers(e){if(null!=e.f){var t=0,o=0;for(var n in e.f)setupBackPointers(e.f[n]),(e.f[n].parent=e).f[n].s&&(t+=e.f[n].s),e.f[n].c&&(o+=e.f[n].c),3==e.f[n].t&&o++;e.s=t,e.c=o}return e}function getFileSizeStr(e){return 1==e?"1 byte":format("{0} bytů",e)}function p5folderup(e){if(null==e)filetreelocation.pop();else for(;filetreelocation.length>e;)filetreelocation.pop();return updateFiles(),!1}function p5folderset(e){return filetreelocation.push(decodeURIComponent(e)),updateFiles(),!1}function p5createfolder(){setDialogMode(2,"Nový adresář",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 e=getFileSelCount(),t=0<getFileSelDirCount()?"<br /><br /><label><input type=checkbox id=p5recdeleteinput>Recursive delete</label><br>":"<input type=checkbox id=p5recdeleteinput style='display:none'>";setDialogMode(2,"Smazat",3,p5deletefileEx,1<e?format("Smazat {0} vybrané prvky?",e)+t:"Smazat vybraný prvek?"+t)}function p5deletefileEx(){for(var e=[],t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked&&e.push(t[o].value);meshserver.send({action:"fileoperation",fileop:"delete",path:filetreelocation,delfiles:e,rec:Q("p5recdeleteinput").checked})}function p5renamefile(){for(var e,t=document.getElementsByName("fc"),o=0;o<t.length;o++)t[o].checked&&(e=t[o].value);setDialogMode(2,"Přejmenovat",3,p5renamefileEx,'<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="'+e+'" />',{action:"fileoperation",fileop:"rename",path:filetreelocation,oldname:e}),focusTextBox("p5renameinput"),p5fileNameCheck()}function p5renamefileEx(e,t){t.newname=Q("p5renameinput").value,meshserver.send(t)}function p5fileNameCheck(e){var t=isFilenameValid(Q("p5renameinput").value);QE("idx_dlgOkButton",t),1==t&&e&&13==e.keyCode&&dialogclose(1)}var isFilenameValid=function(){var t=/^[^\\/:\*\?"<>\|]+$/,o=/^\./,n=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function(e){return t.test(e)&&!o.test(e)&&!n.test(e)&&"."!=e[0]}}();function p5uploadFile(){setDialogMode(2,"Nahrát soubor",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=hidden name=authCookie value='+authCookie+" /><input type=submit id=p5loginSubmit style=display:none /></form>"),updateUploadDialogOk("p5uploadinput")}function p5uploadFileEx(){Q("p5loginSubmit").click()}function updateUploadDialogOk(e){QE("idx_dlgOkButton",""!=Q(e).value)}var p5clipboard=null,p5clipboardFolder=null,p5clipboardCut=0;function p5copyFile(e){var t=document.getElementsByName("fc");p5clipboard=[],p5clipboardCut=e,p5clipboardFolder=Clone(filetreelocation);for(var o=0;o<t.length;o++)t[o].checked&&"3"==t[o].attributes.file.value&&p5clipboard.push(t[o].value);p5updateClipview()}function p5pasteFile(){var e="";null!=p5clipboard&&0<p5clipboard.length&&(e=format("Confim {0} of {1} entrie{2} to this location?",0==p5clipboardCut?"copy":"move",p5clipboard.length,1<p5clipboard.length?"s":"")),setDialogMode(2,"Vložit",3,p5pasteFileEx,e)}function p5pasteFileEx(){meshserver.send({action:"fileoperation",fileop:0==p5clipboardCut?"copy":"move",scpath:p5clipboardFolder,path:filetreelocation,names:p5clipboard}),p5folderup(999),1==p5clipboardCut&&(p5clipboardFolder=p5clipboard=null,p5clipboardCut=0,p5updateClipview())}function p5updateClipview(){var e="";null!=p5clipboard&&0<p5clipboard.length&&(e=format("Holding {0} entrie{1} for {2}",p5clipboard.length,1<p5clipboard.length?"s":"",0==p5clipboardCut?"copy":"move")+', <a href=# onclick="return p5clearClip()" style=cursor:pointer>Clear</a>.'),QH("p5bottomstatus",e),p5setActions()}function p5clearClip(){return p5clipboardFolder=p5clipboard=null,p5clipboardCut=0,p5updateClipview(),!1}function p5fileDragDrop(e){if(haltEvent(e),QV("bigfail",!1),QV("bigok",!1),null!=e.dataTransfer&&0!=e.dataTransfer.files.length&&0!=filetreelocation.length)for(var t=[],o=[],n=[],i=[],a=e.dataTransfer.files.length,s=0;s<e.dataTransfer.files.length;s++){var l=new FileReader,r=e.dataTransfer.files[s];t.push(r.name),o.push(r.size),n.push(r.type),l.onload=function(e){i.push(e.target.result),0==--a&&(Q("p5fileDragName").value=t.join("*"),Q("p5fileDragSize").value=o.join("*"),Q("p5fileDragType").value=n.join("*"),Q("p5fileDragData").value=i.join("*"),Q("p5fileDragLink").value=encodeURIComponent(filetreelinkpath),Q("p5loginSubmit2").click())},l.readAsDataURL(r)}}var p5dragtimer=null;function p5fileDragOver(e){haltEvent(e),null!=p5dragtimer&&(clearTimeout(p5dragtimer),p5dragtimer=null);var t=!0;0==filetreelocation.length&&(t=!1),QV("bigok",t),QV("bigfail",!t)}function p5fileDragLeave(e){haltEvent(e),"p5filetable"!=e.target.id?(QV("bigfail",!1),QV("bigok",!1)):p5dragtimer=setTimeout("QV('bigfail',false);QV('bigok',false);p5dragtimer=null;",200)}function ondeskkeypress(e){if(toggleSoftKeys(0),Q("DeskSoftInput").value="",setSessionActivity(),desktop&&!xxdialogMode&&10==xxcurrentView){if(null!=currentNode){var t=meshes[currentNode.meshid].links[userinfo._id].rights;if(0==(4294967295==t||0!=(8&t)&&0==(256&t)))return!1;if(1==(4294967295!=t&&0!=(8&t)&&0==(256&t)&&0!=(4096&t))&&(1==e.altKey||1==e.ctrlKey||e.keyCode<32&&8!=e.keyCode&&13!=e.keyCode||90<e.keyCode))return!1}return desktop.m.handleKeys(e)}}function ondeskkeydown(e){if(toggleSoftKeys(0),Q("DeskSoftInput").value="",setSessionActivity(),desktop&&!xxdialogMode&&10==xxcurrentView){if(null!=currentNode){var t=meshes[currentNode.meshid].links[userinfo._id].rights;if(0==(4294967295==t||0!=(8&t)&&0==(256&t)))return!1;if(1==(4294967295!=t&&0!=(8&t)&&0==(256&t)&&0!=(4096&t))&&(1==e.altKey||1==e.ctrlKey||e.keyCode<32&&8!=e.keyCode&&13!=e.keyCode||90<e.keyCode))return!1}return desktop.m.handleKeyDown(e)}}function ondeskkeyup(e){if(toggleSoftKeys(0),Q("DeskSoftInput").value="",setSessionActivity(),desktop&&!xxdialogMode&&10==xxcurrentView){if(null!=currentNode){var t=meshes[currentNode.meshid].links[userinfo._id].rights;if(0==(4294967295==t||0!=(8&t)&&0==(256&t)))return!1;if(1==(4294967295!=t&&0!=(8&t)&&0==(256&t)&&0!=(4096&t))&&(1==e.altKey||1==e.ctrlKey||e.keyCode<32&&8!=e.keyCode&&13!=e.keyCode||90<e.keyCode))return!1}return desktop.m.handleKeyUp(e)}}var updateDevicesTimer=null;function updateDevices(){null==updateDevicesTimer&&(updateDevicesTimer=setTimeout(updateDevicesEx,200))}var deviceHeaderCount,sort=0,deviceHeaderId=0,deviceHeaders={},showRealNames=!1,deviceHeaderTotal=0,deviceHeadersTitles=(deviceHeaders={},{});function updateDevicesEx(){null!=updateDevicesTimer&&(clearTimeout(updateDevicesTimer),updateDevicesTimer=null);var e="",t=0,o=null,n=0,i={};for(var a in deviceHeaderCount={},deviceHeaders={},deviceHeadersTitles={},(deviceHeaderTotal=deviceHeaderId=0)==sort?nodes.sort(meshSort):1==sort?nodes.sort(powerSort):2==sort&&(1==showRealNames?nodes.sort(deviceHostSort):nodes.sort(deviceSort)),nodes)if(0!=nodes[a].v){var s=meshes[nodes[a].meshid].links[userinfo._id];if(null!=s){s.rights;if(0==sort){if(nodes.sort(meshSort),nodes[a].meshid!=o){deviceHeaderSet();var l="";1==meshes[nodes[a].meshid].mtype&&(l="<span style=color:lightgray>, Intel® AMT only</span>"),null!=o&&(2==t&&(e+="<td><div style=width:301px></div></td>"),""!=e&&(e+="</tr></table>")),e+="<div class=DevSt style=padding-top:4px><span style=float:right>",e+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+nodes[a].meshid+'")>'+EscapeHtml(meshes[nodes[a].meshid].name)+"</span>"+l+"<span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>",i[o=nodes[a].meshid]=1,t=0}}else 1==sort?nodes[a].pwr!==o&&(deviceHeaderSet(),null!==o&&(2==t&&(e+="<td><div style=width:301px></div></td>"),""!=e&&(e+="</tr></table>")),e+="<div class=DevSt style=width:100%;padding-top:4px><span>"+PowerStateStr2(nodes[a].pwr)+"</span><span id=DevxHeader"+deviceHeaderId+" style=color:lightgray></span></div>",o=nodes[a].pwr,t=0):2==sort&&null==o&&(o="1");n++;var r=EscapeHtml(nodes[a].name);0==r.length&&(r="<i>Nic</i>"),null!=nodes[a].rname&&0<nodes[a].rname.length&&(r+=" / "+EscapeHtml(nodes[a].rname));var d=EscapeHtml(nodes[a].name);1==showRealNames&&null!=nodes[a].rname&&(d=EscapeHtml(nodes[a].rname)),0==d.length&&(d="<i>Nic</i>");var p=nodes[a].icon,c=NodeStateStr(nodes[a]);nodes[a].conn&&0!=nodes[a].conn||(p+=" gray"),e+="<div style=cursor:pointer onclick=goForward('"+nodes[a]._id+"')>",e+='<div class="i'+p+'" style="float:left;margin-left:4px"></div>',e+='<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">',e+="<div><div style=padding-left:12px;padding-top:2px><b>"+d+"</b></div><div style=padding-left:12px;padding-top:3px;color:gray>"+c+"</div></div>",e+="</div></div>",deviceHeaderTotal++,void 0===deviceHeaderCount[nodes[a].state]?deviceHeaderCount[nodes[a].state]=1:deviceHeaderCount[nodes[a].state]++}}if(0==sort)for(var a in meshes){var u=meshes[a],m=u.links[userinfo._id];if(null!=m){m.rights;null==i[u._id]&&(""!=o&&""!=e&&(e+="</tr></table>"),e+="<div><div colspan=3 class=DevSt><span style=float:right>",e+='</span><span id=MxMESH style=cursor:pointer onclick=goForward("'+u._id+'")>'+EscapeHtml(u.name)+"</span></div>",1==u.mtype&&(e+="<div style=padding:10px><i>No Intel® AMT devices in this group"),2==u.mtype&&(e+="<div style=padding:10px><i>Žádné zařízení v této skupině"),e+=".</i></div></div>",o=u._id,n++)}}for(var a in 0==n?QH("xdevices",'<div style="margin-top:50px;text-align:center"><span style="font-size:30px">Žádné zařízení</span><br /><br />Use the desktop version of this website to add devices.</div>'):QH("xdevices",e),deviceHeaderSet(),deviceHeaders)QH(a,deviceHeaders[a]);for(var a in deviceHeadersTitles)Q(a).title=deviceHeadersTitles[a]}var powerStatetable=["","Zapnuto","Spánek","Spánek","Spánek","Hibernating","Vypnout","Present"],powerStateStrings=["","Zapnuto","Sleeping","Sleeping","Deep Sleep","Hibernating","Soft-Off","Present"],powerStateStrings2=["","Zařízení je zapnuto","Zařízení je ve stavu spánku (S1)","Device is in sleep state (S2)","Zařízení je v hlubokém spánku (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"],powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(e){var t=[];return 0<e.state&&e.state<powerStatetable.length&&state.push(powerStatetable[e.state]),e.conn&&(0!=(1&e.conn)&&t.push("<span>Agent</span>"),0!=(2&e.conn)?t.push("<span>CIRA</span>"):0!=(4&e.conn)&&t.push("<span>Intel® AMT</span>"),0!=(8&e.conn)&&t.push("<span>Relay</span>"),0!=(16&e.conn)&&t.push("<span>MQTT</span>")),null!=e.pwr&&0!=e.pwr&&t.push(powerStateStrings[e.pwr]),t.join(", ")}function PowerStateStr(e){return e<powerStatetable.length?powerStatetable[e]:""}function PowerStateStr2(e){return 0!=e&&e<powerStatetable.length?powerStatetable[e]:"Unknown"}function onSortSelectChange(e){sort=document.getElementById("sortselect").selectedIndex,e||putstore("sort",sort),updateDevicesEx()}function deviceHeaderSet(){if(0!=deviceHeaderId){deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+(1==deviceHeaderTotal?" zařízení":" nodes");var e="";for(var t in deviceHeaderCount)0<e.length&&(e+=", "),e+=deviceHeaderCount[t]+" "+PowerStateStr2(t);deviceHeadersTitles["DevxHeader"+deviceHeaderId]=e,deviceHeaderId++,deviceHeaderCount={},deviceHeaderTotal=0}else deviceHeaderId=1}function meshSort(e,t){return e.meshnamel>t.meshnamel?1:e.meshnamel<t.meshnamel?-1:e.meshid==t.meshid?1==showRealNames?e.rnamel>t.rnamel?1:e.rnamel<t.rnamel?-1:0:e.namel>t.namel?1:e.namel<t.namel?-1:0:0}function powerSort(e,t){var o=e.pwr?e.pwr:0,n=t.pwr?t.pwr:0;return o==n?1==showRealNames?e.rnamel>t.rnamel?1:e.rnamel<t.rnamel?-1:0:e.namel>t.namel?1:e.namel<t.namel?-1:0:n<o?1:o<n?-1:0}function deviceSort(e,t){return e.namel>t.namel?1:e.namel<t.namel?-1:0}function deviceHostSort(e,t){return e.rnamel>t.rnamel?1:e.rnamel<t.rnamel?-1:0}function refreshDevice(e){currentNode&¤tNode._id==e&&gotoDevice(e,xxcurrentView,!0)}function getNodeRights(e){var t=getNodeFromId(e);return meshes[t.meshid].links[userinfo._id].rights}var currentNode,currentDevicePanel=0,powerTimelineNode=null,powerTimelineReq=null,powerTimelineUpdate=null,powerTimeline=null;function getCurrentNode(){return currentNode}function gotoDevice(e,t,o){if(!0===userinfo.emailVerified||1!=serverinfo.emailcheck||4294967295==userinfo.siteadmin)if(!(262144&features)||1==userinfo.otpsecret||0<userinfo.otphkeys||0<userinfo.otpkeys){var n=getNodeFromId(e);if(null!=n){var i=meshes[n.meshid];if(null!=i){var a=i.links[userinfo._id].rights;if(!currentNode||currentNode._id!=n._id||1==o){currentNode=n;var s=EscapeHtml(n.name);0==s.length&&(s="<i>Nic</i>"),0!=(4&a)&&(s="<span onclick=showEditNodeValueDialog(0) style=cursor:pointer>"+s+"</span>"),QH("p10deviceName",s);var l="<table style=width:100%>";l+=addDeviceAttribute("<span>Skupina</span>",'<a onclick=goForward("'+n.meshid+'") style=cursor:pointer>'+EscapeHtml(meshes[n.meshid].name)+"</a>"),null!=n.rname&&(l+=addDeviceAttribute("<span>Jméno</span>","<span>"+EscapeHtml(n.rname)+"</span>")),1!=i.mtype&&n.name==n.host||(0!=(4&a)?n.host?l+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>"+EscapeHtml(n.host)+"</span>"):l+=addDeviceAttribute("Hostname","<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>Nic</i></span>"):l+=addDeviceAttribute("Hostname",EscapeHtml(n.host)));var r=n.desc?EscapeHtml(n.desc):"<i>Nic</i>";l+=addDeviceAttribute("Popis",0!=(4&a)?"<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>"+r+"</span>":r);var d=["Unknown","Windows 32bit console","Windows 64bit console","Windows 32bit service","Windows 64bit service","Linux 32bit","Linux 64bit","MIPS","XENx86","Android ARM","Linux ARM","MacOS 32bit","Android x86","PogoPlug ARM","Android APK","Linux Poky x86-32bit","MacOS 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","ARMv8 64bit","ARMv6l / ARMv7l / NoKVM","Unknown","Unknown","FreeBSD x86-64"];if(null!=n.agent&&null!=n.agent.id&&null!=n.agent.ver){var p="";p=n.agent.id<=d.length?d[n.agent.id]:d[0],0!=n.agent.ver&&(p+=" v"+n.agent.ver),l+=addDeviceAttribute("Agent",p)}if(null!=n.intelamt){p="";var c={0:nobreak("Not Activated (Pre)"),1:nobreak("Not Activated (In)"),2:nobreak("Activated")};null!=n.intelamt.ver&&null==n.intelamt.state?p+="<i>"+nobreak("Unknown State")+"</i>, v"+n.intelamt.ver:null==n.intelamt.ver&&2==n.intelamt.state?p+="<i>Activated</i>":null==n.intelamt.ver||null==n.intelamt.state?p+="<i>Unknown Version & State</i>":(p+=c[n.intelamt.state],n.intelamt.flags&&(2&n.intelamt.flags?p=" <span>CCM</span>":4&n.intelamt.flags&&(p=" <span>ACM</span>")),p+=", v"+n.intelamt.ver),1==n.intelamt.tls&&(p+=", <span>TLS</span>"),2==n.intelamt.state&&(null!=n.intelamt.user&&""!=n.intelamt.user||(p+=0!=(4&a)?', <i style=color:#FF0000;cursor:pointer onclick=editDeviceAmtSettings("'+n._id+'")>'+nobreak("Žádné přihlašovací údaje")+"</i>":", <i style=color:#FF0000>Žádné přihlašovací údaje</i>"),p+=" ",0!=(4&a)&&(p+='<img src=images/link4.png height=10 width=10 style=cursor:pointer onclick=editDeviceAmtSettings("'+n._id+'")>'));var u="Intel® ME";"number"==typeof n.intelamt.sku&&(0!=(8&n.intelamt.sku)?u="Intel® AMT":0!=(16&n.intelamt.sku)&&(u="Intel® SM")),l+=addDeviceAttribute(u,p)}if(null!=n.agent&&null!=n.agent.tag&&"mailto:"!=n.agent.tag){var m=EscapeHtml(n.agent.tag);m.startsWith("mailto:")&&(m='<a href="'+m+'">'+m.substring(7)+"</a>"),l+=addDeviceAttribute("Agent Tag",m)}var h=n.conn;if(h&&1<h){var f=[];0!=(1&n.conn)&&f.push("<span>Agent</span>"),0!=(2&n.conn)?f.push("<span>Intel® AMT CIRA</span>"):0!=(4&n.conn)&&f.push("<span>Intel® AMT</span>"),0!=(8&n.conn)&&f.push("<span>Agent Relay</span>"),0!=(16&n.conn)&&f.push("<span>MQTT</span>"),l+=addDeviceAttribute("Connectivity",f.join(", "))}var g="<i>Nic</i>";if(null!=n.tags)for(var v in g="",n.tags)g+='<span style="background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px">'+n.tags[v]+"</span>";l+=addDeviceAttribute("Tagy",0!=(4&a)?"<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>"+g+"</span>":g),l+="</table><br />",0!=(76&a)&&(l+="<input type=button value=Actions onclick=deviceActionFunction() />"),QH("p10html",l),setupFiles(),l="<div style=float:right;font-size:x-small;margin-right:10px>",0!=(4&a)&&(l+='<a style=cursor:pointer onclick=p10showDeleteNodeDialog("'+n._id+'")>Smazat zařízení</a>'),l+="</div><div style=font-size:x-small>",l+="</div><br>",QH("p10html3",l);var k=PowerStateStr(n.state);0!=(1&h)&&(0<k.length&&(k+=", "),k+="<span style=font-size:10px>Mesh Agent</span>"),0!=(2&h)?(0<k.length&&(k+=", "),k+="<span style=font-size:10px>Intel® AMT connected</span>"):0!=(4&h)&&(0<k.length&&(k+=", "),k+="<span style=font-size:10px>Intel® AMT detected</span>"),0!=(16&h)&&(0<k.length&&(k+="<br/>"),k+="<span style=font-size:12px>MQTT channel connected</span>"),QH("MainComputerState",k),QH("MainComputerImage",'<div class="i'+n.icon+'"></div>'),powerTimelineNode!=currentNode._id&&powerTimelineReq!=currentNode._id&&(QH("p10html2",""),powerTimelineReq=currentNode._id,meshserver.send({action:"powertimeline",nodeid:currentNode._id}))}setupDesktop(),go(t=t||10),setupDeviceMenu()}else goBack()}else goBack()}else setDialogMode(2,"Account Security",1,null,'Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the "My Account" and look at the "Account Security" section.');else setDialogMode(2,"Account Security",1,null,'Unable to access a device until a email address is verified. This is required for password recovery. Go to the "My Account" to change and verify an email address.')}function deviceToastFunction(){xxdialogMode||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(e,t){var o=0;currentNode&&(o=meshes[currentNode.meshid].links[userinfo._id].rights),null!=e&&(currentDevicePanel=e),QV("p10general",0==currentDevicePanel),QV("p10desktop",1==currentDevicePanel),QV("p10files",2==currentDevicePanel);var n=[];0!=currentDevicePanel&&n.push({n:"General",f:"setupDeviceMenu(0)"}),1!=currentDevicePanel&&null!=currentNode&&(8&o||256&o)&&(1==meshes[currentNode.meshid].mtype&&("number"!=typeof currentNode.intelamt.sku||0!=(8¤tNode.intelamt.sku))||currentNode.agent&&1¤tNode.agent.caps)&&n.push({n:"Desktop",f:"setupDeviceMenu(1)"}),2!=currentDevicePanel&&null!=currentNode&&8&o&&(4294967295==o||0==(1024&o))&&2==currentNode.mtype&&4¤tNode.agent.caps&&n.push({n:"Files",f:"setupDeviceMenu(2)"}),updateFooterMenu(n)}function deviceActionFunction(){if(!xxdialogMode){var e=meshes[currentNode.meshid].links[userinfo._id].rights,t="Vyber operaci na tomto zařízení.<br /><br />",o="<select id=d2deviceop style=float:right;width:170px>";0!=(64&e)&&(o+="<option value=100>Probudit</option>"),0!=(8&e)&&(o+="<option value=4>Spánek</option><option value=3>Reset</option><option value=2>Vypnout</option>"),setDialogMode(2,"Akce zařízení",3,deviceActionFunctionEx,t+=addHtmlValue("Operace",o+="</select>"))}}function deviceActionFunctionEx(){var e=Q("d2deviceop").value;100==e?meshserver.send({action:"wakedevices",nodeids:[currentNode._id]}):meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:e})}function updateDeviceTimeline(){2==meshserver.State&&null!=powerTimelineNode&&null!=powerTimelineUpdate&&null!=currentNode&&powerTimelineNode==powerTimelineReq&¤tNode._id==powerTimelineNode&&powerTimelineUpdate<Date.now()&&(powerTimelineUpdate=null,meshserver.send({action:"powertimeline",nodeid:currentNode._id}))}function drawDeviceTimeline(){var e=null,t=Date.now();currentNode._id==powerTimelineNode&&(e=powerTimeline);var o=new Date;o.setHours(0,0,0,0);(o=new Date(o.getTime()-5184e5)).getTime();var n=[];if(null!=e&&1<e.length){n.push([0,e[1],e[0]]);for(var i=e[1],a=2;a<e.length;a+=2){var s=e[a],l=t;e.length>a+1&&(l=e[a+1]),n.push([i,i+l,s]),i+=l}}var r="",d=1,p=new Date,c=Q("masthead").offsetWidth-122;p.setHours(0,0,0,0);for(a=0;a<7;a++){var u="",m=p.getTime(),h=m+864e5;for(var f in n){var g=n[f];if(1==isTimeBlockInside(m,h,g[0],g[1])){var v=Math.max(m,g[0]),k=Math.min(Math.min(h,g[1]),t),y=Math.round((k-v)*c/864e5);0<y&&(u+="<div style=display:table-cell;width:"+y+"px;background-color:"+powerColor(g[2])+";height:16px></div>")}}r+="<tr style="+(d%2==0?"background-color:#DDD":"")+"><td><div> "+printDate(p)+"<div></div></div></td><td><div>"+u+"</div></td></tr>",++d,p=new Date(p.getTime()-864e5)}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>'+r+"</tbody></table>")}function powerColor(e){return e<powerColorTable.length?powerColorTable[e]:"yellow"}function isTimeBlockInside(e,t,o,n){return o<e&&t<n||(e<o&&o<t||e<n&&n<t)}function addDeviceAttribute(e,t){return"<tr><td style=width:100px;color:gray>"+e+"</td><td style=overflow:hidden>"+t+"</td></tr>"}function editDeviceAmtSettings(e,t){if(!xxdialogMode){var o="",n=getNodeFromId(e),i=3;0!=(4&getNodeRights(e))&&(o+=addHtmlValue("Uživatel",'<input id=dp10username style=width:170px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />'),o+=addHtmlValue("Heslo","<input id=dp10password type=password style=width:170px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />"),o+=addHtmlValue("Bezpečnost","<select id=dp10tls style=width:176px><option value=0>Žádné TLS</option><option value=1>TLS vyžadováno</option></select>"),null!=n.intelamt.user&&""!=n.intelamt.user&&(i=7),setDialogMode(2,"Edit Intel® AMT credentials",i,editDeviceAmtSettingsEx,o,{node:n,func:t}),null!=n.intelamt.user&&""!=n.intelamt.user?Q("dp10username").value=n.intelamt.user:Q("dp10username").value="admin",Q("dp10tls").value=n.intelamt.tls,validateDeviceAmtSettings())}}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(e,t){if(2==e)meshserver.send({action:"changedevice",nodeid:t.node._id,intelamt:{user:"",pass:""}});else{var o=Q("dp10username").value;""==o&&(o="admin");var n=Q("dp10password").value;""==n&&(o=""),meshserver.send({action:"changedevice",nodeid:t.node._id,intelamt:{user:o,pass:n,tls:Q("dp10tls").value}}),t.node.intelamt.user=o,t.node.intelamt.tls=Q("dp10tls").value,t.func&&setTimeout(t.func,300)}}function p10showDeleteNodeDialog(e){xxdialogMode||(setDialogMode(2,"Delete Node",3,p10showDeleteNodeDialogEx,format("Delete {0}?",EscapeHtml(currentNode.name))+"<br /><br /><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm",e),p10validateDeleteNodeDialog())}function p10validateDeleteNodeDialog(){QE("idx_dlgOkButton",Q("p10check").checked)}function p10showDeleteNodeDialogEx(e,t){meshserver.send({action:"removedevices",nodeids:[t]})}function p10showiconselector(){if(!xxdialogMode&&0!=(4&meshes[currentNode.meshid].links[userinfo._id].rights)){"<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>","<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>","<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br>","<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>","<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>","<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>",setDialogMode(2,"Icon Selection",0,null,"<table align=center><td><div style=display:inline-block class=i1 onclick=p10setIcon(1)></div><div style=display:inline-block class=i2 onclick=p10setIcon(2)></div><div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br><div style=display:inline-block class=i4 onclick=p10setIcon(4)></div><div style=display:inline-block class=i5 onclick=p10setIcon(5)></div><div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>"),QV("id_dialogclose",!0)}}function p10setIcon(e){setDialogMode(0),meshserver.send({action:"changedevice",nodeid:currentNode._id,icon:e})}var desktop,desktopNode,showEditNodeValueDialog_modes=["Device Name","Hostname","Popis","Tagy"],showEditNodeValueDialog_modes2=["name","host","desc","tags"],showEditNodeValueDialog_modes3=["","","","Skupina1, Skupina2, Skupina3"];function showEditNodeValueDialog(e){if(!xxdialogMode){setDialogMode(2,"Edit Device",3,showEditNodeValueDialogEx,addHtmlValue(showEditNodeValueDialog_modes[e],'<input id=dp10devicevalue style=width:170px maxlength=64 placeholder="'+showEditNodeValueDialog_modes3[e]+'" onchange=p10editdevicevalueValidate('+e+",event) onkeyup=p10editdevicevalueValidate("+e+",event) />"),e);var t=currentNode[showEditNodeValueDialog_modes2[e]];null==t&&(t=""),Array.isArray(t)&&(t=t.join(", ")),Q("dp10devicevalue").value=t,p10editdevicevalueValidate(),Q("dp10devicevalue").focus()}}function showEditNodeValueDialogEx(e,t){var o={action:"changedevice",nodeid:currentNode._id};o[showEditNodeValueDialog_modes2[t]]=Q("dp10devicevalue").value,meshserver.send(o)}function p10editdevicevalueValidate(e,t){var o=1<e||0<Q("dp10devicevalue").value.length;QE("idx_dlgOkButton",o),null!=t&&1==o&&13==t.keyCode&&dialogclose(1)}var desktopsettings={encoding:2,showfocus:!1,showmouse:!0,showcad:!0,quality:40,scaling:1024,framerate:50};function setupDesktop(){desktopNode!=currentNode&&null!=desktop&&(desktop.Stop(),desktop=desktopNode=null),desktopNode==currentNode&&null!=desktop||(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(e){return dmousewheel(e)}),Q("Desk").addEventListener("mousewheel",function(e){return dmousewheel(e)})),desktopNode=currentNode,updateDesktopButtons(),Q("Desk").toBlob||QV("deskSaveBtn",!1)}function updateDesktopButtons(){var e=meshes[currentNode.meshid],t=0;null!=desktop&&(t=desktop.State);var o=e.links[userinfo._id].rights;QV("disconnectbutton1",0!=t),QV("connectbutton1",0==t&&2==e.mtype&&(8&o||256&o)),QV("connectbutton1h",0==t&&8&o&&(1==e.mtype||null!=currentNode.intelamt&&2==currentNode.intelamt.state&&null!=currentNode.intelamt.ver&&"number"==typeof currentNode.intelamt.sku&&0!=(8¤tNode.intelamt.sku))),QV("d7amtkvm",!(null==currentNode.intelamt||null==currentNode.intelamt.ver&&1!=e.mtype||0!=t&&2!=desktop.contype)),QV("d7meshkvm",2==e.mtype&&(0==t||1==desktop.contype));var n=0!=(1¤tNode.conn);QE("connectbutton1",n);var i=0!=(6¤tNode.conn);QE("connectbutton1h",i),QV("DeskToastButton",0!=(16384&o)&¤tNode.agent&¤tNode.agent.id<5&&8&o),QV("deskActionsBtn",8&o),Q("DeskControl").checked=0!=(8&o),0==n&&QV("DeskTools",!1)}function connectDesktop(e,t){if(setSessionActivity(),null==desktop)if(desktopNode=currentNode,2==t){if(null==desktopNode.intelamt.user||""==desktopNode.intelamt.user)return void editDeviceAmtSettings(desktopNode._id,connectDesktop);(desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk"),authCookie)).debugmode=debugmode,desktop.onStateChanged=onDesktopStateChange,desktop.m.bpp=1==desktopsettings.encoding||3==desktopsettings.encoding?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,authCookie,authRelayCookie,domainUrl)).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(e,t){var o=t;3==o&&2==e.contype&&o++;var n=StatusStrs[o];switch(null!=desktop&&1==desktop.webRtcActive&&(n+=", WebRTC"),QH("deskstatus",n),t){case 0:desktop.Stop(),desktopNode=desktop=null,QV("termdisplays",!1),1==fullscreen&&deskToggleFull()}updateDesktopButtons(),deskAdjust(),setTimeout(deskAdjust,50)}function showDesktopSettings(){xxdialogMode||(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(),desktop&&(1==desktop.contype&&0!=desktop.State&&desktop.m.SendCompressionLevel(1,desktopsettings.quality,desktopsettings.scaling,desktopsettings.framerate),2==desktop.contype&&0!=desktop.State&&(desktop.Stop(),setTimeout(function(){connectDesktop(null,2)},50)))}function applyDesktopSettings(){var e="",t=512&features?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1];for(var o in t)e+="<option value="+t[o]+">"+t[o]+"%</option>";QH("d7bitmapquality",e),d7desktopmode.value=desktopsettings.encoding,d7showfocus.checked=desktopsettings.showfocus,d7showcursor.checked=desktopsettings.showmouse,d7bitmapquality.value=40,0<=t.indexOf(parseInt(desktopsettings.quality))&&(d7bitmapquality.value=desktopsettings.quality),d7bitmapscaling.value=desktopsettings.scaling,desktopsettings.framerate&&(d7framelimiter.value=desktopsettings.framerate)}var fullscreen=!1;function deskAdjust(){var e=(Q("DeskParent").clientHeight-Q("Desk").clientHeight)/2;if(e<0){var t=Q("DeskParent").clientHeight,o=9999;desktop&&(o=desktop.m.width/desktop.m.height*t),QS("Desk")["max-height"]=t+"px",QS("Desk")["max-width"]=o+"px",e=0}else QS("Desk")["max-height"]=null,QS("Desk")["max-width"]=null;QS("Desk")["margin-top"]=e+"px",QS("Desk")["margin-bottom"]=e+"px"}function deskSendKeys(){if(!xxdialogMode&&null!=desktop&&3==desktop.State){var e=Q("deskkeys").value;0==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[65364,1],[65364,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,91]]):1==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[65362,1],[65362,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,91]]):2==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[108,1],[108,0],[65511,0]]):desktop.sendCtrlMsg('{"action":"lock"}'):3==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[109,1],[109,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,91]]):4==e?2==desktop.contype?desktop.m.sendkey([[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]]):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]]):5==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.EXUP,91]]):6==e?2==desktop.contype?desktop.m.sendkey([[65511,1],[114,1],[114,0],[65511,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,91],[desktop.m.KeyAction.DOWN,82],[desktop.m.KeyAction.UP,82],[desktop.m.KeyAction.EXUP,91]]):7==e?2==desktop.contype?desktop.m.sendkey([[65513,1],[65473,1],[65473,0],[65513,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,115],[desktop.m.KeyAction.UP,115],[desktop.m.KeyAction.EXUP,18]]):8==e?2==desktop.contype?desktop.m.sendkey([[65507,1],[119,1],[119,0],[65507,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,17],[desktop.m.KeyAction.DOWN,87],[desktop.m.KeyAction.UP,87],[desktop.m.KeyAction.EXUP,17]]):9==e?2==desktop.contype?desktop.m.sendkey([[65513,1],[65289,1],[65289,0],[65513,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,18],[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9],[desktop.m.KeyAction.EXUP,18]]):10==e?desktop.m.sendcad():11==e&&(2==desktop.contype?desktop.m.sendkey([[65289,1],[65289,0]]):desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,9],[desktop.m.KeyAction.UP,9]]))}}function sendSpecialKeys(){xxdialogMode||null==desktop||3!=desktop.State||setDialogMode(3,"Special Keys",3,deskSendKeys)}function toggleSoftKeys(e){QV("DeskSoftInput",1==e),1==e&&Q("DeskSoftInput").focus()}function toggleDeskTools(){setSessionActivity(),xxdialogMode||("none"==QS("DeskTools").display?(QV("DeskTools",!0),Q("DeskTools").nodeid=currentNode._id,refreshDeskTools()):QV("DeskTools",!1))}function refreshDeskTools(){setSessionActivity(),QV("DeskToolsRefreshButton",!1),setTimeout(refreshDeskToolsEx,500),meshserver.send({action:"msg",type:"ps",nodeid:currentNode._id})}function refreshDeskToolsEx(){QV("DeskToolsRefreshButton",!0)}var filesNode,deskTools={sort:1,msg:null};function sortProcess(e){deskTools.sort=e,showDeskToolsProcesses(deskTools.msg)}function sortProcessPid(e,t){return e.p>t.p?1:e.p<t.p?-1:0}function sortProcessName(e,t){return e.d>t.d?1:e.d<t.d?-1:0}function showDeskToolsProcesses(e){if(null!=(deskTools.msg=e)){if(Q("DeskTools").nodeid==e.nodeid){var t=[],o=null;try{o=JSON.parse(e.value)}catch(e){}if(console.log(o),null!=o){for(var n in o)t.push({p:parseInt(n),c:o[n].cmd,d:o[n].cmd.toLowerCase(),u:o[n].user});0==deskTools.sort?t.sort(sortProcessPid):1==deskTools.sort&&t.sort(sortProcessName);var i="";for(var a in t)0!=t[a].p&&(i+="<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>"+t[a].p+"</div><a style=float:right;padding-right:5px;cursor:pointer onclick=stopProcess("+t[a].p+',"'+t[a].c+'")><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>'+(t[a].u?t[a].u:"")+"</div><div>"+t[a].c+"</div></div>");QH("DeskToolsProcesses",i)}}}else QH("DeskToolsProcesses","")}function deskSaveImage(){if(setSessionActivity(),!xxdialogMode&&null!=desktop&&3==desktop.State){var e=new Date,t="Desktop-"+currentNode.name+"-"+e.getFullYear()+"-"+("0"+(e.getMonth()+1)).slice(-2)+"-"+("0"+e.getDate()).slice(-2)+"-"+("0"+e.getHours()).slice(-2)+"-"+("0"+e.getMinutes()).slice(-2);Q("Desk").toBlob(function(e){saveAs(e,t+".jpg")})}}function deskDisplayInfo(e,t,o,n){var i=Q("termdisplays").value;if(0<t.length){var a="";for(var s in t)a+="<option"+(i==t[s]?" selected":"")+">"+t[s]+"</option>";QH("termdisplays",a)}QV("termdisplays",0<t.length)}function deskGetDisplayNumbers(e){desktop.m.GetDisplayNumbers()}function deskSetDisplay(e){setSessionActivity();var t=0,o=Q("termdisplays").value;t="All Displays"==o?65535:parseInt(o.substring(8)),desktop.m.SetDisplay(t)}function dmousedown(e){setSessionActivity(),xxdialogMode||null==desktop||desktop.m.mousedown(e)}function dmouseup(e){setSessionActivity(),xxdialogMode||null==desktop||desktop.m.mouseup(e)}function dmousemove(e){setSessionActivity(),xxdialogMode||null==desktop||desktop.m.mousemove(e)}function dmousewheel(e){return setSessionActivity(),!(xxdialogMode||null==desktop||!desktop.m.mousewheel)&&(desktop.m.mousewheel(e),haltEvent(e),!0)}function drotate(e){xxdialogMode||null==desktop||(desktop.m.setRotation(desktop.m.rotation+e),deskAdjust(),deskAdjust())}function stopProcess(e,t){return setDialogMode(2,"Process Control",3,stopProcessEx,format('Stop process #{0} "{1}"?',e,t),e),!1}function stopProcessEx(e,t){meshserver.send({action:"msg",type:"pskill",nodeid:currentNode._id,value:t}),setTimeout(refreshDeskTools,300)}function setupFiles(){var e=filesNode==currentNode,t=0!=(1&(filesNode=currentNode).conn);QE("p13Connect",t),0!=e&&0!=t||!files||(files.Stop(),files=null)}function onFilesStateChange(e,t){setSessionActivity(),p13Connect.value=0==t?"Připojit":"Disconnect";var o=StatusStrs[t];switch(1==files.webRtcActive&&(o+=", WebRTC"),Q("p13Status").textContent=o,t){case 0:QH("p13files",""),p13filetree=null,p13filetreelocation=[],QH("p13currentpath",""),QE("p13FolderUp",!1),p13setActions(),null!=files&&(files.Stop(),files=null);break;case 3:p13targetpath="",files.sendText({action:"ls",reqid:1,path:""})}}function CreateRemoteFiles(e){var t={protocol:5};return t.onFileUpdate=e,t.xxStateChange=function(e){},t.ProcessData=function(e){t.onFileUpdate(e)},t}var autoConnectFilesTimer=null;function autoConnectFiles(e){autoConnectFilesTimer=null==autoConnectFilesTimer?setInterval(connectFiles,100):(clearInterval(autoConnectFilesTimer),null)}function connectFiles(e){files?(files.Stop(),files=null):((files=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotFiles),serverPublicNamePort,authCookie,authRelayCookie,domainUrl)).attemptWebRTC=attemptWebRTC,files.onStateChanged=onFilesStateChange,files.Start(filesNode._id)),p13clipboard=p13clipboardFolder=null,p13clipboardCut=0,p13updateClipview()}var p13sortorder,p13filetree=null,p13targetpath=null,p13filetreelocation=[];function p13gotFiles(e){if(setSessionActivity(),0<e.length&&123!=e.charCodeAt(0))p13gotDownloadBinaryData(e);else if("download"!=(e=JSON.parse(decode_utf8(e))).action)if(e.path=e.path.replace(/\//g,"\\"),null!=p13filetree&&e.path==p13filetree.path){var t=p13getCheckedNames();p13filetree=e,p13updateFiles(t)}else{for(var o=e.path.replace(/\//g,"\\"),n=p13targetpath.replace(/\//g,"\\");0<o.length&&"\\"==o[0];)o=o.substring(1);for(;0<n.length&&"\\"==n[0];)n=n.substring(1);(o==n||"\\"==e.path&&""==p13targetpath)&&(p13filetree=e,p13updateFiles())}else p13gotDownloadCommand(e)}function p13getCheckedNames(){for(var e=[],t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&e.push(p13filetree.dir[t[o].value].n);return e}function p13updateFiles(e){var t="",o="",n="<a style=cursor:pointer onclick=p13folderup(0)>Root</a>",i=p13filetree.path.split("\\");for(var a in p13filetreelocation=[],i)""!=i[a]&&p13filetreelocation.push(i[a]);for(var a in p13filetreelocation)n+=" / <a style=cursor:pointer onclick=p13folderup("+(parseInt(a)+1)+")>"+p13filetreelocation[a]+"</a>";var s=p13filetreelocation.join("/"),l=p13sort_files(p13filetree.dir);for(var a in l){var r,d=l[a],p=d.n;r=70<(r=p).length?EscapeHtml(p.substring(0,70))+"...":EscapeHtml(p),p=EscapeHtml(p);var c="";null!=d.s&&(c=getFileSizeStr(d.s));var u="";if(d.t<3){u="<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></span><span><div class=fileIcon"+d.t+'></div><a style=cursor:pointer onclick=p13folderset("'+encodeURIComponent(d.nx)+'")>'+r+"</a></span></div>"}else{var m=r;0<d.s&&(m='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p13downloadfile(\''+encodeURIComponent(s+"/"+p)+"','"+encodeURIComponent(p)+"',"+d.s+')">'+r+"</a>"),u="<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>"+c+"</span><span><div class=fileIcon"+d.t+"></div>"+m+"</span></div>"}d.t<3?t+=u:o+=u}if(QH("p13files",t+o),QH("p13currentpath",n),QE("p13FolderUp",0!=p13filetreelocation.length),null!=e){var h=document.getElementsByName("fd");for(a=0;a<h.length;a++)0<=e.indexOf(p13filetree.dir[h[a].value].n)&&(h[a].checked=!0)}p13setActions()}function p13folderset(e){p13targetpath=joinPaths(p13filetree.path,p13filetree.dir[e].n).split("\\").join("/"),files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13folderup(e){if(null==e)p13filetreelocation.pop();else for(;p13filetreelocation.length>e;)p13filetreelocation.pop();p13targetpath=p13filetreelocation.join("/"),files.sendText({action:"ls",reqid:1,path:p13targetpath})}function p13sort_filename(e,t){return e.ln>t.ln?1*p13sortorder:e.ln<t.ln?-1*p13sortorder:0}function p13sort_timestamp(e,t){return e.d>t.d?1*p13sortorder:e.d<t.d?-1*p13sortorder:0}function p13sort_bysize(e,t){return e.s==t.s?p13sort_filename(e,t):(e.s-t.s)*p13sortorder}function p13sort_files(e){var t=[],o=Q("p13sortdropdown").value;for(var n in e)e[n].nx=n,null==e[n].s&&(e[n].s=0),null==e[n].n&&(e[n].n=n),e[n].ln=e[n].n.toLowerCase(),t.push(e[n]);return p13sortorder=1,3<o&&(p13sortorder=-1,o-=3),1==o?t.sort(p13sort_filename):2==o?t.sort(p13sort_bysize):3==o&&t.sort(p13sort_timestamp),t}function p13setActions(){if(null==p13filetree)QE("p13DeleteFileButton",!1),QE("p13NewFolderButton",!1),QE("p13UploadButton",!1),QE("p13RenameFileButton",!1),QE("p13SelectAllButton",!1),Q("p13SelectAllButton").value="Vše",QE("p13RefreshButton",!1),QE("p13CutButton",!1),QE("p13CopyButton",!1),QE("p13PasteButton",!1);else{var e=p13getFileSelCount(),t=p13getFileCount(),o=p13getFileSelCount(!1),n=0<currentNode.agent.id&¤tNode.agent.id<5;QE("p13DeleteFileButton",0<e&&(0<p13filetreelocation.length||0==n)),QE("p13NewFolderButton",0<p13filetreelocation.length||0==n),QE("p13UploadButton",0<p13filetreelocation.length||0==n),QE("p13RenameFileButton",1==e&&(0<p13filetreelocation.length||0==n)),QE("p13SelectAllButton",0<t),Q("p13SelectAllButton").value=0<e?"Nic":"Vše",QE("p13RefreshButton",!0),QE("p13CutButton",0<e&&e==o&&(0<p13filetreelocation.length||0==n)),QE("p13CopyButton",0<e&&e==o&&(0<p13filetreelocation.length||0==n)),QE("p13PasteButton",(0<p13filetreelocation.length||0==n)&&null!=p13clipboard&&0<p13clipboard.length)}}function p13getFileSelCount(e){for(var t=0,o=document.getElementsByName("fd"),n=0;n<o.length;n++)!o[n].checked||0==e&&"3"!=o[n].attributes.file.value||t++;return t}function p13getFileSelDirCount(){for(var e=0,t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&"999"==t[o].attributes.file.value&&e++;return e}function p13getFileCount(){return document.getElementsByName("fd").length}function p13selectallfile(){for(var e=0==p13getFileSelCount(),t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked=e;p13setActions()}function p13createfolder(){setDialogMode(2,"Nový adresář",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 e=p13getFileSelCount(),t=0<p13getFileSelDirCount()?"<br /><br /><label><input type=checkbox id=p13recdeleteinput>Recursive delete</label><br>":"<input type=checkbox id=p13recdeleteinput style='display:none'>";setDialogMode(2,"Smazat",3,p13deletefileEx,1<e?format("Smazat {0} vybrané prvky?",e)+t:"Smazat vybraný prvek?"+t)}function p13deletefileEx(){for(var e=[],t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&e.push(p13filetree.dir[t[o].value].n);files.sendText({action:"rm",reqid:1,path:p13filetreelocation.join("/"),delfiles:e,rec:Q("p13recdeleteinput").checked}),p13folderup(999)}function p13renamefile(){for(var e,t=document.getElementsByName("fd"),o=0;o<t.length;o++)t[o].checked&&(e=p13filetree.dir[t[o].value].n);setDialogMode(2,"Přejmenovat",3,p13renamefileEx,'<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% value="'+e+'" />',{action:"rename",path:p13filetreelocation.join("/"),oldname:e}),focusTextBox("p13renameinput"),p13fileNameCheck()}function p13renamefileEx(e,t){t.newname=Q("p13renameinput").value,files.sendText(t),p13folderup(999)}function p13fileNameCheck(e){var t=isFilenameValid(Q("p13renameinput").value);QE("idx_dlgOkButton",t),1==t&&null!=e&&13==e.keyCode&&dialogclose(1)}function p13uploadFile(){setDialogMode(2,"Nahrát soubor",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)}function p13viewfile(){for(var e=document.getElementsByName("fd"),t=0;t<e.length;t++)if(e[t].checked){p13filetree.dir[e[t].value].s<=204800?p13downloadfile(encodeURIComponent(p13filetreelocation.join("/")+"/"+p13filetree.dir[e[t].value].n),encodeURIComponent(p13filetree.dir[e[t].value].n),p13filetree.dir[e[t].value].s,"viewer"):messagebox("File Editor","Jen soubory menší než 200k mohou být editovány.");break}}var downloadFile,uploadFile,currentMesh,p13clipboard=null,p13clipboardFolder=null,p13clipboardCut=0;function p13copyFile(e){var t=document.getElementsByName("fd");p13clipboard=[],p13clipboardCut=e,p13clipboardFolder=p13targetpath;for(var o=0;o<t.length;o++)t[o].checked&&"3"==t[o].attributes.file.value&&p13clipboard.push(p13filetree.dir[t[o].value].n);p13updateClipview()}function p13pasteFile(){var e="";null!=p13clipboard&&0<p13clipboard.length&&(e=0==p13clipboardCut?1<p13clipboard.length?format("Confirm copy of {0} entries's to this location?",p13clipboard.length):format("Confirm copy of 1 entrie to this location?"):1<p13clipboard.length?format("Confirm move of {0} entries's to this location?",p13clipboard.length):format("Confirm move of 1 entrie to this location?")),setDialogMode(2,"Vložit",3,p13pasteFileEx,e)}function p13pasteFileEx(){files.sendText({action:0==p13clipboardCut?"copy":"move",reqid:1,scpath:p13clipboardFolder,dspath:p13targetpath,names:p13clipboard}),p13folderup(999),1==p13clipboardCut&&(p13clipboardFolder=p13clipboard=null,p13clipboardCut=0,p13updateClipview())}function p13updateClipview(){var e="";null!=p13clipboard&&0<p13clipboard.length&&(e=0==p13clipboardCut?1<p13clipboard.length?format('Holding {0} entries for copy, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.',p13clipboard.length):format('Holding 1 entrie for copy, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.'):1<p13clipboard.length?format('Holding {0} entries for move, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.',p13clipboard.length):format('Holding 1 entrie for move, <a href=# onclick="return p13clearClip()" style=cursor:pointer>Clear</a>.')),QH("p13bottomstatus",e),p13setActions()}function p13clearClip(){return p13clipboardFolder=p13clipboard=null,p13clipboardCut=0,p13updateClipview(),!1}function updateUploadDialogOk(e){QE("idx_dlgOkButton",""!=Q(e).value)}function getFileSelCount(e){for(var t=0,o=document.getElementsByName("fc"),n=0;n<o.length;n++)!o[n].checked||0==e&&"3"!=o[n].attributes.file.value||t++;return t}function getFileCount(){return document.getElementsByName("fc").length}function p13downloadfile(e,t,o){xxdialogMode||downloadFile||!files||(downloadFile={path:decodeURIComponent(e),file:decodeURIComponent(t),size:o,tsize:0,data:"",state:0,id:Math.random()},files.sendText({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path}),setDialogMode(2,"Stáhnout soubor",10,p13downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+o+" />"))}function p13downloadFileCancel(){setDialogMode(0),files.sendText({action:"download",sub:"cancel",id:downloadFile.id}),downloadFile=null}function p13gotDownloadCommand(e){null!=downloadFile&&e.id==downloadFile.id&&("start"==e.sub?(downloadFile.state=1,files.sendText({action:"download",sub:"startack",id:downloadFile.id})):"cancel"==e.sub&&(downloadFile=null,setDialogMode(0)))}function p13gotDownloadBinaryData(e){downloadFile&&0!=downloadFile.state&&(4<e.length&&(downloadFile.tsize+=e.length-4,downloadFile.data+=e.substring(4),Q("d2progressBar").value=downloadFile.tsize),0!=(1&ReadInt(e,0))?(saveAs(data2blob(downloadFile.data),downloadFile.file),downloadFile=null,setDialogMode(0)):files.sendText({action:"download",sub:"ack",id:downloadFile.id}))}function p13doUploadFiles(e){xxdialogMode||((uploadFile={}).xpath=p13filetreelocation.join("/"),uploadFile.xfiles=e,uploadFile.xfilePtr=-1,setDialogMode(2,"Nahrát soubor",10,p13uploadFileCancel,"<div id=p13dfileName>Connecting...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />"),p13uploadReconnect())}function onFileUploadStateChange(e,t){switch(t){case 0:p13folderup(9999);break;case 3:p13uploadNextFile();break;default:console.log("Unknown onFileUploadStateChange state",t)}}function p13uploadReconnect(){uploadFile.ws=CreateAgentRedirect(meshserver,CreateRemoteFiles(p13gotUploadData),serverPublicNamePort,authCookie,authRelayCookie,domainUrl),uploadFile.ws.attemptWebRTC=!1,uploadFile.ws.ctrlMsgAllowed=!1,uploadFile.ws.onStateChanged=onFileUploadStateChange,uploadFile.ws.Start(filesNode._id)}function p13uploadNextFile(){if(uploadFile.xfilePtr++,uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var e=uploadFile.xfiles[uploadFile.xfilePtr];QH("p13dfileName",e.name),Q("d2progressBar").max=e.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:e.name,size:uploadFile.xdata.byteLength})},uploadFile.xreader.readAsArrayBuffer(e)}else p13uploadFileCancel()}function p13uploadFileCancel(e,t){null!=uploadFile&&(null!=uploadFile.ws&&(uploadFile.ws.Stop(),uploadFile.ws=null),uploadFile=null),setDialogMode(0)}function p13gotUploadData(e){var t=JSON.parse(e);if(null!=uploadFile&&parseInt(uploadFile.xfilePtr)==parseInt(t.reqid))if("uploadstart"==t.action){p13uploadNextPart(!1);for(var o=0;o<8;o++)p13uploadNextPart(!0)}else"uploadack"==t.action?p13uploadNextPart(!1):"uploaderror"==t.action&&p13uploadFileCancel()}function p13uploadNextPart(e){var t=uploadFile.xdata,o=uploadFile.xptr,n=uploadFile.xptr+4096;if(n>t.byteLength){if(1==e)return;n=t.byteLength}if(o==t.byteLength)null!=uploadFile.ws&&(uploadFile.ws.Stop(),uploadFile.ws=null),uploadFile.xfiles.length>uploadFile.xfilePtr+1?p13uploadReconnect():p13uploadFileCancel();else{var i=t.slice(o,n);uploadFile.ws.send(i),uploadFile.xptr=n,Q("d2progressBar").value=n}}function p20updateMesh(){if(null!=currentMesh){QH("p20meshName",EscapeHtml(currentMesh.name));var e=format("Unknown #{0}",currentMesh.mtype),t=currentMesh.links[userinfo._id].rights;1==currentMesh.mtype&&(e="Intel® AMT only, no agent"),2==currentMesh.mtype&&(e="Managed using a software agent");var o="";o+=addHtmlValue("Jméno",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",0!=(1&t))),o+=addHtmlValue("Popis",addLinkConditional(currentMesh.desc&&""!=currentMesh.desc?EscapeHtml(currentMesh.desc):"<i>Nic</i>","p20editmesh(2)",0!=(1&t))),o+=addHtmlValue("Typ",e),o+="<br style=clear:both><br>";var n=currentMesh.links[userinfo._id];n&&0!=(2&n.rights)&&(o+="<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>"),o+='<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 i=1,a=[];for(var s in currentMesh.links)a.push({id:s,name:s.split("/")[2],rights:currentMesh.links[s].rights});for(var s in a.sort(function(e,t){return e.name>t.name?1:e.name<t.name?-1:0}),a){var l="",r="Partial Rights",d=a[s].rights;4294967295==d?r="Full Administrator":0==d&&(r="No Rights"),s==userinfo._id||4294967295!=t&&0==(2&t)||(l='<a onclick=p20deleteUser(event,"'+encodeURIComponent(a[s].id)+'") style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'),o+='<tr onclick=p20viewuser("'+encodeURIComponent(a[s].id)+'") style=height:32px;cursor:pointer'+(i%2==0?";background-color:#DDD":"")+"><td>",o+="<div style=float:right>"+l+"</div><div style=float:right;padding-right:4px>"+r+"</div><div class=m2></div><div> "+EscapeHtml(decodeURIComponent(a[s].name))+"<div></div></div>",o+="</td></tr>",++i}o+="</tbody></table>",4294967295==t&&(o+="<div style=font-size:small;text-align:right;margin-top:6px><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Group</a></span></div>"),QH("p20info",o)}}function p20showDeleteMeshDialog(){if(xxdialogMode)return!1;var e=format("Are you sure you want to delete group {0}? Deleting the device group will also delete all information about devices within this group.",EscapeHtml(currentMesh.name))+"<br /><br />";return setDialogMode(2,"Delete Group",3,p20showDeleteMeshDialogEx,e+="<label><input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm</label>"),p20validateDeleteMeshDialog(),!1}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(e,t){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(e){if(!xxdialogMode){var t=addHtmlValue("Jméno","<input id=dp20meshname style=width:170px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />");setDialogMode(2,"Editovat skupinu zařízení",3,p20editmeshEx,t+=addHtmlValue("Popis","<input id=dp20meshdesc style=width:170px maxlength=1024 onkeyup=p20editmeshValidate() />")),Q("dp20meshname").value=currentMesh.name,currentMesh.desc&&(Q("dp20meshdesc").value=currentMesh.desc),p20editmeshValidate(),2==e?Q("dp20meshdesc").focus():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",0<Q("dp20meshname").value.length)}function p20showAddMeshUserDialog(){if(!xxdialogMode){var e=addHtmlValue("User","<input id=dp20username style=width:170px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />");e+='<div style="border:2px groove gray;background-color:white;max-height:120px;overflow-y:scroll">',e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Editovat skupinu zařízení</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Device Group Users</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Správa skupin zařízení</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remoteview style=margin-left:12px>Remote View Only</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotelimitedinput style=margin-left:12px>Limited Input Only</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noterminal style=margin-left:12px>No Terminal Access</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20nofiles style=margin-left:12px>No File Access</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noamt style=margin-left:12px>No Intel® AMT</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Konzole agenta</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Upravit popis zařízení</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20limitevents>Show Only Own Events</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20chatnotify>Chat & Notify</label><br>",e+="<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20uninstall>Uninstall Agent</label><br>",setDialogMode(2,"Add User to Mesh",3,p20showAddMeshUserDialogEx,e+="</div>"),p20validateAddMeshUserDialog(),Q("dp20username").focus()}}function p20validateAddMeshUserDialog(){var e=currentMesh.links[userinfo._id].rights,t=!Q("p20fulladmin").checked;QE("p20fulladmin",4294967295==e),QE("p20editmesh",t&&4294967295==e),QE("p20manageusers",t),QE("p20managecomputers",t),QE("p20remotecontrol",t),QE("p20meshagentconsole",t),QE("p20meshserverfiles",t),QE("p20wakedevices",t),QE("p20editnotes",t),QE("p20limitevents",t),QE("p20remoteview",t&&Q("p20remotecontrol").checked),QE("p20remotelimitedinput",t&&Q("p20remotecontrol").checked&&!Q("p20remoteview").checked),QE("p20noterminal",t&&Q("p20remotecontrol").checked),QE("p20nofiles",t&&Q("p20remotecontrol").checked),QE("p20noamt",t&&Q("p20remotecontrol").checked),QE("p20chatnotify",t),QE("p20uninstall",t)}function p20showAddMeshUserDialogEx(){var e=0;1==Q("p20fulladmin").checked?e=4294967295:(1==Q("p20editmesh").checked&&(e+=1),1==Q("p20manageusers").checked&&(e+=2),1==Q("p20managecomputers").checked&&(e+=4),1==Q("p20remotecontrol").checked&&(e+=8),1==Q("p20meshagentconsole").checked&&(e+=16),1==Q("p20meshserverfiles").checked&&(e+=32),1==Q("p20wakedevices").checked&&(e+=64),1==Q("p20editnotes").checked&&(e+=128),1==Q("p20remoteview").checked&&(e+=256),1==Q("p20noterminal").checked&&(e+=512),1==Q("p20nofiles").checked&&(e+=1024),1==Q("p20noamt").checked&&(e+=2048),1==Q("p20remotelimitedinput").checked&&(e+=4096),1==Q("p20limitevents").checked&&(e+=8192),1==Q("p20chatnotify").checked&&(e+=16384),1==Q("p20uninstall").checked&&(e+=32768));var t=Q("dp20username").value.split(","),o=[];for(var n in t)o.push(t[n].trim());meshserver.send({action:"addmeshuser",meshid:currentMesh._id,meshname:currentMesh.name,usernames:o,meshadmin:e})}function p20viewuser(e){if(!xxdialogMode){e=decodeURIComponent(e);var t=[],o=currentMesh.links[userinfo._id].rights,n=currentMesh.links[e].rights;4294967295==n?t.push("Full Administrator"):(0!=(1&n)&&t.push("Editovat skupinu zařízení"),0!=(2&n)&&t.push("Manage Device Group Users"),0!=(4&n)&&t.push("Správa skupin zařízení"),0!=(8&n)&&t.push("Remote Control"),0!=(16&n)&&t.push("Agent Console"),0!=(32&n)&&t.push("Server Files"),0!=(64&n)&&t.push("Wake Devices"),0!=(128&n)&&t.push("Edit Notes"),0!=(256&n)&&t.push("Remote View Only"),0!=(512&n)&&t.push("Žádný terminál"),0!=(1024&n)&&t.push("No Files"),0!=(2048&n)&&t.push("No Intel® AMT"),0!=(8&n)&&0!=(4096&n)&&0==(256&n)&&t.push("Limited Input"),0!=(8192&n)&&t.push("Self Events Only"),0!=(16384&n)&&t.push("Chat & Notify"),0!=(32768&n)&&t.push("Uninstall")),0==t.length&&t.push("No Rights");var i=1,a=addHtmlValue("User",EscapeHtml(decodeURIComponent(e.split("/")[2])));a+=addHtmlValue("Práva",t.join(", ")),userinfo._id!=e&&(4294967295==o||0!=(2&o)&&4294967295!=n)&&(i+=4),setDialogMode(2,"Device Group User",i,p20viewuserEx,a,e)}}function p20viewuserEx(e,t){2==e&&setDialogMode(2,"Remote Mesh User",3,p20viewuserEx2,format("Confirm removal of user {0}?",t.split("/")[2]),t)}function p20deleteUser(e,t){haltEvent(e),p20viewuserEx(2,decodeURIComponent(t))}function p20viewuserEx2(e,t){meshserver.send({action:"removemeshuser",meshid:currentMesh._id,meshname:currentMesh.name,userid:t})}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,xxcurrentView=-1;function go(e){if(setSessionActivity(),!xxdialogMode&&xxcurrentView!=e){updateFooterMenu(),setDialogMode(0);for(var t=0;t<32;t++)QV("p"+t,t==e);xxcurrentView=e}}function setDialogMode(e,t,o,n,i,a){setSessionActivity(),xxdialogMode=e,xxdialogFunc=n,xxdialogButtons=o,xxdialogTag=a,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&o),QV("idx_dlgCancelButton",2&o),QV("id_dialogclose",2&o||8&o),QV("idx_dlgButtonBar",7&o),t&&QH("id_dialogtitle",t);for(var s=1;s<24;s++)QV("dialog"+s,s==e);QV("dialog",e),i&&(2==e?QH("id_dialogOptions",i):QH("id_dialogMessage",i))}function dialogclose(e){setSessionActivity();var t=xxdialogFunc,o=xxdialogButtons,n=xxdialogTag;setDialogMode(),(8&o||e)&&t&&t(e,n)}function putstore(e,t){try{if("undefined"==typeof localStorage||localStorage.getItem(e)==t)return;null==t?localStorage.removeItem(e):localStorage.setItem(e,t)}catch(e){}if("_"!=e[0]){for(var o={},n=0,i=localStorage.length;n<i;++n){var a=localStorage.key(n);"_"!=a[0]&&(o[a]=localStorage.getItem(a))}meshserver.send({action:"userWebState",state:JSON.stringify(o)})}}function getstore(e,t){try{if("undefined"==typeof localStorage)return t;var o=localStorage.getItem(e);return null==o||null==o?t:o}catch(e){return t}}function center(){QS("dialog").left=(getDocWidth()-300)/2+"px",deskAdjust(),deskAdjust()}function messagebox(e,t){QH("id_dialogMessage",t),setDialogMode(1,e,1)}function statusbox(e,t){QH("id_dialogMessage",t),setDialogMode(1,e)}function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function haltReturn(e){13==e.keyCode&&haltEvent(e)}function validateEmail(e){return/^(([^<>()\[\]\\.,;:\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,}))$/.test(e)}function reload(){window.location.href=window.location.href}function getNodeFromId(e){for(var t in nodes)if(nodes[t]._id==e)return nodes[t];return null}function addHtmlValue(e,t){return"<table><td style=width:120px>"+e+"<td><b>"+t+"</b></table>"}function addHtmlValue2(e,t){return"<div><div style=display:inline-block;float:right>"+t+"</div><div style=display:inline-block>"+e+"</div></div>"}function addLink(e,t){return"<a style=cursor:pointer;color:darkblue;text-decoration:none onclick='"+t+"'>♦ "+e+"</a>"}function addLinkConditional(e,t,o){return o?addLink(e,t):e}function passwordcheck(e){return/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/.test(e)}function getFileSizeStr(e){return 1==e?"1 byte":format("{0} bytes",e)}function joinPaths(){var e=[];for(var t in arguments){var o=arguments[t];if(null!=o&&""!=o){for(;o.endsWith("/")||o.endsWith("\\");)o=o.substring(0,o.length-1);for(;o.startsWith("/")||o.startsWith("\\");)o=o.substring(1);e.push(o)}}return e.join("/")}function focusTextBox(e){setTimeout(function(){Q(e).selectionStart=Q(e).selectionEnd=65535,Q(e).focus()},0)}isFilenameValid=function(){var t=/^[^\\/:\*\?"<>\|]+$/,o=/^\./,n=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function(e){return t.test(e)&&!o.test(e)&&!n.test(e)&&"."!=e[0]}}();function parseUriArgs(){var e,t={},o=window.document.location.href.split(/[\?&|\=]/);for(n in o.splice(0,1),o)switch(n%2){case 0:e=decodeURIComponent(o[n]);break;case 1:t[e]=decodeURIComponent(o[n]);var n=parseInt(t[e]);n==t[e]&&(t[e]=n)}return t}function printDate(e){return e.toLocaleDateString(args.locale)}function printTime(e){return e.toLocaleTimeString(args.locale)}function printDateTime(e){return e.toLocaleString(args.locale)}function format(e){var o=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,t){return void 0!==o[t]?o[t]:e})}function nobreak(e){return e.split(" ").join(" ")}</script>
\ No newline at end of file
views/translations/default-mobile_cs.handlebars
new
+3391
@@ -0,0 +1,3391 @@
1
+<!DOCTYPE html><html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head>
2
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
4
+ <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
5
+ <meta name="apple-mobile-web-app-capable" content="yes">
6
+ <meta name="format-detection" content="telephone=no">
7
+ <link rel="shortcut icon" type="image/x-icon" href="{{{domainurl}}}favicon.ico">
8
+ <script type="text/javascript" src="scripts/common-0.0.1.js"></script>
9
+ <script type="text/javascript" src="scripts/meshcentral.js"></script>
10
+ <script type="text/javascript" src="scripts/agent-redir-ws-0.1.1.js"></script>
11
+ <script type="text/javascript" src="scripts/agent-desktop-0.0.2.js"></script>
12
+ <script type="text/javascript" src="scripts/amt-0.2.0.js"></script>
13
+ <script type="text/javascript" src="scripts/amt-redir-ws-0.1.0.js"></script>
14
+ <script type="text/javascript" src="scripts/amt-desktop-0.0.2.js"></script>
15
+ <script type="text/javascript" src="scripts/zlib.js"></script>
16
+ <script type="text/javascript" src="scripts/zlib-inflate.js"></script>
17
+ <script type="text/javascript" src="scripts/zlib-adler32.js"></script>
18
+ <script type="text/javascript" src="scripts/zlib-crc32.js"></script>
19
+ <script keeplink="1" type="text/javascript" src="scripts/filesaver.js"></script>
20
+ <title>{{{title}}}</title>
21
+ <style>
22
+ a {
23
+ color: #036;
24
+ text-decoration: underline;
25
+ }
26
+
27
+ #footer a {
28
+ color: #fff;
29
+ text-decoration: underline;
30
+ }
31
+
32
+ #footer a:hover {
33
+ color: #fff;
34
+ text-decoration: none;
35
+ }
36
+
37
+ .i1 {
38
+ background: url(../images/icons50.png) 0px 0px;
39
+ height: 50px;
40
+ width: 50px;
41
+ border: none;
42
+ }
43
+
44
+ .i2 {
45
+ background: url(../images/icons50.png) -50px 0px;
46
+ height: 50px;
47
+ width: 50px;
48
+ border: none;
49
+ }
50
+
51
+ .i3 {
52
+ background: url(../images/icons50.png) -100px 0px;
53
+ height: 50px;
54
+ width: 50px;
55
+ border: none;
56
+ }
57
+
58
+ .i4 {
59
+ background: url(../images/icons50.png) -150px 0px;
60
+ height: 50px;
61
+ width: 50px;
62
+ border: none;
63
+ }
64
+
65
+ .i5 {
66
+ background: url(../images/icons50.png) -200px 0px;
67
+ height: 50px;
68
+ width: 50px;
69
+ border: none;
70
+ }
71
+
72
+ .i6 {
73
+ background: url(../images/icons50.png) -250px 0px;
74
+ height: 50px;
75
+ width: 50px;
76
+ border: none;
77
+ }
78
+
79
+ .m0 {
80
+ background: url(../images/images16.png) -32px 0px;
81
+ height: 16px;
82
+ width: 16px;
83
+ border: none;
84
+ float: left;
85
+ }
86
+
87
+ .m1 {
88
+ background: url(../images/images16.png) -16px 0px;
89
+ height: 16px;
90
+ width: 16px;
91
+ border: none;
92
+ float: left;
93
+ }
94
+
95
+ .m2 {
96
+ background: url(../images/images16.png) -96px 0px;
97
+ height: 16px;
98
+ width: 16px;
99
+ border: none;
100
+ float: left;
101
+ }
102
+
103
+ .m3 {
104
+ background: url(../images/images16.png) -112px 0px;
105
+ height: 16px;
106
+ width: 16px;
107
+ border: none;
108
+ float: left;
109
+ }
110
+
111
+ .gray {
112
+ /*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 */
113
+ filter: gray; /* IE6-9 */
114
+ -webkit-filter: grayscale(100%) opacity(60%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */
115
+ }
116
+
117
+ .DevSt {
118
+ padding-left: 5px;
119
+ border-bottom-style: solid;
120
+ border-bottom-width: 1px;
121
+ border-bottom-color: #DDDDDD;
122
+ }
123
+
124
+ .noselect {
125
+ -webkit-touch-callout: none;
126
+ -webkit-user-select: none;
127
+ -khtml-user-select: none;
128
+ -moz-user-select: none;
129
+ -ms-user-select: none;
130
+ user-select: none;
131
+ }
132
+
133
+ .fileIcon1 {
134
+ background: url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);
135
+ height: 16px;
136
+ width: 16px;
137
+ cursor: pointer;
138
+ border: none;
139
+ float: left;
140
+ margin-top: 1px;
141
+ }
142
+
143
+ .fileIcon2 {
144
+ background: url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);
145
+ height: 16px;
146
+ width: 16px;
147
+ cursor: pointer;
148
+ border: none;
149
+ float: left;
150
+ margin-top: 1px;
151
+ }
152
+
153
+ .fileIcon3 {
154
+ background: url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);
155
+ height: 16px;
156
+ width: 16px;
157
+ cursor: pointer;
158
+ border: none;
159
+ float: left;
160
+ margin-top: 1px;
161
+ }
162
+
163
+ .fileIcon4 {
164
+ background: url(../images/meshicon16.png);
165
+ height: 16px;
166
+ width: 16px;
167
+ cursor: pointer;
168
+ border: none;
169
+ float: left;
170
+ margin-top: 1px;
171
+ }
172
+
173
+ .filelist {
174
+ -moz-user-select: none;
175
+ -khtml-user-select: none;
176
+ -webkit-user-select: none;
177
+ -o-user-select: none;
178
+ cursor: default;
179
+ -khtml-user-drag: element;
180
+ background-color: white;
181
+ clear: both;
182
+ }
183
+ </style>
184
+</head>
185
+<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">
186
+ <div id="container">
187
+ <div id="mastheadx"></div>
188
+ <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">
189
+ <div style="width:calc(100% - 50px);overflow:hidden">
190
+ <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px">
191
+ <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong>
192
+ </div>
193
+ <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px">
194
+ <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong>
195
+ </div>
196
+ </div>
197
+ <img id="topMenuIcon" class="noselect" style="position:absolute;right:0;top:10px;bottom:50px;color:#c8c8c8;font-size:44px;margin-right:8px;cursor:pointer;display:none" onclick="topMenu()" src="/images/3bars-30.png" width="30" height="30">
198
+ </div>
199
+ <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%">
200
+ <div id="column_l" style="width:100%;padding:0;position:absolute;bottom:0px;top:0px">
201
+ <div id="p0" style="display:none;width:100%;height:100%">
202
+ <div style="display:flex;align-items:center;width:100%;height:100%">
203
+ <div id="p0message" style="text-align:center;width:100%"><span id="p0span">Server disconnected</span>, <href onclick="reload()" style="cursor:pointer"><u>klikni pro opětovné připojení</u></href>.</div>
204
+ </div>
205
+ </div>
206
+ <div id="p1" style="display:none;width:100%;height:100%">
207
+ <div style="display:flex;align-items:center;width:100%;height:100%">
208
+ <div id="p1message" style="text-align:center;width:100%"></div>
209
+ </div>
210
+ </div>
211
+ <div id="p2" style="display:none">
212
+ <div id="xdevices"></div>
213
+ </div>
214
+ <div id="p3" style="display:none;position:absolute;bottom:0;top:0;width:100%">
215
+ <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;">
216
+ <tbody><tr style="padding:0">
217
+ <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()">
218
+ <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0">
219
+ <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>
220
+ </div>
221
+ <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div>
222
+ </td>
223
+ <td>
224
+ <img src="/images/user-50.png" width="50" height="50">
225
+ </td>
226
+ <td>
227
+ <div style="margin-left:5px">
228
+ <strong style="font-size:large"><span id="p3userName"></span></strong><br>
229
+ </div>
230
+ </td>
231
+ </tr>
232
+ </tbody></table>
233
+ <div id="p3info" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%">
234
+ <div style="margin-left:8px">
235
+ <div id="p3AccountActions">
236
+ <p><strong>Account Security</strong></p>
237
+ <div style="margin-left:9px;margin-bottom:8px">
238
+ <div id="manageAuthApp" style="margin-top:5px;display:none"><a onclick="account_manageAuthApp()" style="cursor:pointer">Manage authenticator app</a></div>
239
+ <div id="manageOtp" style="margin-top:5px;display:none"><a onclick="account_manageOtp(0)" style="cursor:pointer">Manage backup codes</a></div>
240
+ </div>
241
+ <p><strong>Account Actions</strong></p>
242
+ <div style="margin-left:9px;margin-bottom:8px">
243
+ <div style="margin-top:5px"><span id="verifyEmailId" style="display:none"><a onclick="account_showVerifyEmail()" style="cursor:pointer">Verify email</a></span></div>
244
+ <div style="margin-top:5px"><span id="changeEmailId" style="display:none"><a onclick="account_showChangeEmail()" style="cursor:pointer">Change email address</a></span></div>
245
+ <div style="margin-top:5px"><a onclick="account_showChangePassword()" style="cursor:pointer">Změnit heslo</a><span id="p2nextPasswordUpdateTime"></span></div>
246
+ <div style="margin-top:5px"><a onclick="account_showDeleteAccount()" style="cursor:pointer">Smazat účet</a></div>
247
+ </div>
248
+ <br style="clear:both">
249
+ </div>
250
+ <strong>Device Groups</strong>
251
+ <span id="p3createMeshLink1">( <a onclick="account_createMesh()" style="cursor:pointer"><img src="images/icon-addnew.png" width="12" height="12" border="0"> New</a> )</span>
252
+ <br><br>
253
+ <div id="p3meshes"></div>
254
+ <div id="p3noMeshFound" style="margin-left:9px;display:none">No device groups.<span id="p3createMeshLink2"> <a onclick="account_createMesh()" style="cursor:pointer"><strong>Get started here!</strong></a></span></div>
255
+ <br style="clear:both">
256
+ </div>
257
+ </div>
258
+ </div>
259
+ <div id="p5" style="display:none">
260
+ <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;">
261
+ <tbody><tr style="padding:0">
262
+ <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()">
263
+ <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0">
264
+ <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>
265
+ </div>
266
+ <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div>
267
+ </td>
268
+ <td>
269
+ <img src="/images/user-50.png" width="50" height="50">
270
+ </td>
271
+ <td>
272
+ <div style="margin-left:5px">
273
+ <strong style="font-size:large">Moje soubory</strong><br>
274
+ </div>
275
+ </td>
276
+ </tr>
277
+ </tbody></table>
278
+ <div id="p5myfiles" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%">
279
+ <table id="p5toolbar" style="width:100%;height:78px" cellpadding="0" cellspacing="0">
280
+ <tbody><tr>
281
+ <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom">
282
+ <div style="width:100%;text-align:center">
283
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p5FolderUp" disabled="disabled" onclick="p5folderup()" value="Nahoru">
284
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile()" value="Vybrat vše" onkeypress="return false" onkeydown="return false">
285
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p5RenameFileButton" disabled="disabled" value="Přejmenovat" onclick="p5renamefile()" onkeypress="return false" onkeydown="return false">
286
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p5DeleteFileButton" disabled="disabled" value="Smazat" onclick="p5deletefile()" onkeypress="return false" onkeydown="return false">
287
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p5NewFolderButton" disabled="disabled" value="Adresář" onclick="p5createfolder()" onkeypress="return false" onkeydown="return false">
288
+ </div>
289
+ <div style="width:100%;text-align:center">
290
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p5UploadButton" disabled="disabled" value="Nahrát" onclick="p5uploadFile()" onkeypress="return false" onkeydown="return false">
291
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p5CutButton" disabled="disabled" value="Vyjmout" onclick="p5copyFile(1)" onkeypress="return false" onkeydown="return false">
292
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p5CopyButton" disabled="disabled" value="Kopírovat" onclick="p5copyFile(0)" onkeypress="return false" onkeydown="return false">
293
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p5PasteButton" disabled="disabled" value="Vložit" onclick="p5pasteFile()" onkeypress="return false" onkeydown="return false">
294
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p5RefreshButton" value="Obnovit" onclick="p5refreshFiles()" onkeypress="return false" onkeydown="return false">
295
+ </div>
296
+ </td>
297
+ </tr>
298
+ <tr>
299
+ <td style="background-color:#E4E9E7;height:28px">
300
+ <table style="width:100%">
301
+ <tbody><tr>
302
+ <td id="p5currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td>
303
+ <td style="text-align:right;padding-right:4px">
304
+ <select id="p5sortdropdown" onchange="updateFiles()">
305
+ <option value="1" selected="selected">Třídit podle jména</option>
306
+ <option value="2">Třídit podle velikosti</option>
307
+ <option value="3">Sort by date</option>
308
+ <option value="4">Descend by name</option>
309
+ <option value="5">Descend by size</option>
310
+ <option value="6">Descend by date</option>
311
+ </select>
312
+ </td>
313
+ </tr>
314
+ </tbody></table>
315
+ </td>
316
+ </tr>
317
+ </tbody></table>
318
+ <div id="p5filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none">
319
+ <!--
320
+ <div id="p5bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✓</b></div>
321
+ <div id="p5bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✗</b></div>
322
+ -->
323
+ <span id="p5files"></span>
324
+ </div>
325
+ <table id="p5toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px;background-color:#D3D9D6" cellpadding="0" cellspacing="0">
326
+ <tbody><tr>
327
+ <td style="text-align:left;padding:3px"> <span id="p5bottomstatus"></span></td>
328
+ <td id="p5rightOfButtons" style="text-align:right;padding:3px"></td>
329
+ </tr>
330
+ </tbody></table>
331
+ </div>
332
+ </div>
333
+ <div id="p10" style="display:none;position:absolute;bottom:0;top:0;width:100%;overflow:hidden">
334
+ <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;position:absolute;top:0">
335
+ <tbody><tr style="padding:0">
336
+ <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()">
337
+ <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0">
338
+ <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>
339
+ </div>
340
+ <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div>
341
+ </td>
342
+ <td>
343
+ <a id="MainComputerImage" style="cursor:pointer" onclick="p10showiconselector()"></a>
344
+ </td>
345
+ <td>
346
+ <div style="margin-left:5px">
347
+ <strong><span id="p10deviceName"></span></strong><br>
348
+ <span id="MainComputerState"></span>
349
+ </div>
350
+ </td>
351
+ </tr>
352
+ </tbody></table>
353
+ <div id="p10general" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%">
354
+ <div id="p10html" style="margin-left:8px;margin-right:8px"></div>
355
+ <div id="p10html2"></div>
356
+ <div id="p10html3"></div>
357
+ </div>
358
+ <div id="p10desktop" style="overflow:hidden;position:absolute;top:55px;bottom:0px;width:100%;display:none">
359
+ <div id="deskarea1" style="position:absolute;top:0px;width:100%;height:25px">
360
+ <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
361
+ <div style="float:right;text-align:right">
362
+ <span id="p14power"></span>
363
+ <input id="DeskSoftInput" type="text" style="width:25px;display:none;opacity:.2" onblur="toggleSoftKeys(0)" onkeypress="return ondeskkeypress(event)" onkeydown="return ondeskkeydown(event)" onkeyup="return ondeskkeyup(event)">
364
+ </div>
365
+ <div style="margin-left:3px">
366
+ <input type="button" id="connectbutton1" value="Připojit" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled">
367
+ <input type="button" id="connectbutton1h" value="HW Connect" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled">
368
+ <input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false">
369
+ <span id="deskstatus">Odpojeno</span>
370
+ </div>
371
+ </div>
372
+ </div>
373
+ <div id="deskarea3" style="position:absolute;top:25px;width:100%;height:calc(100% - 50px)">
374
+ <div id="deskarea3x" style="background:black;text-align:center;height:100%;position:relative">
375
+ <div id="DeskParent" style="height:100%">
376
+ <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>
377
+ </div>
378
+ <div id="DeskTools" style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none">
379
+ <a id="DeskToolsRefreshButton" style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Obnovit</a>
380
+ <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">Procesy</div>
381
+ <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left">
382
+ <div style="border-bottom:1px solid darkgray;padding:3px"><a style="width:50px;padding-right:5px;float:left;cursor:pointer" onclick="sortProcess(0)">PID</a><a style="cursor:pointer" onclick="sortProcess(1)">Jméno</a></div>
383
+ <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div>
384
+ </div>
385
+ </div>
386
+ </div>
387
+ </div>
388
+ <div id="deskarea4" style="position:absolute;bottom:0px;width:100%;height:25px">
389
+ <div style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
390
+ <div style="float:right;text-align:right">
391
+ <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onclick="deskGetDisplayNumbers(event)"></select>
392
+ <span id="DeskToastButton"><img src="images/icon-notify.png" onclick="deviceToastFunction()" height="16" width="16" style="padding-top:2px"></span>
393
+ <!--<input id=DeskToolsButton type=button value=Tools onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()"> -->
394
+ </div>
395
+ <div>
396
+ <input id="deskActionsBtn" type="button" style="margin-left:3px" onkeypress="return false" onkeydown="return false" value="Akce" onclick="deviceActionFunction()">
397
+ <input type="button" value="Nastavení" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()">
398
+ <input type="button" onkeypress="return false" onkeydown="return false" value="Akce napájení" onclick="showPowerActionDlg()" style="display:none">
399
+ <input id="DeskSpecialKeys" type="button" value="Special Keys" onkeypress="return false" onkeydown="return false" onclick="sendSpecialKeys()">
400
+ <input id="DeskSoftKeys" type="button" value="Klávesnice" onkeypress="return false" onkeydown="return false" onclick="toggleSoftKeys(1)">
401
+ <label><span id="DeskControlSpan" style="display:none"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false">Vstup</span></label>
402
+ </div>
403
+ </div>
404
+ </div>
405
+ </div>
406
+ <div id="p10files" style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%;display:none">
407
+ <table id="p13toolbar" style="width:100%;height:111px" cellpadding="0" cellspacing="0">
408
+ <tbody><tr>
409
+ <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px">
410
+ <div style="float:right;text-align:right">
411
+ <input id="filesActionsBtn" type="button" onkeypress="return false" onkeydown="return false" value="Akce" onclick="deviceActionFunction()" style="margin-right:2px">
412
+ </div>
413
+ <div style="margin-left:2px">
414
+ <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" onkeypress="return false" onkeydown="return false" type="button" style="display:none">
415
+ <input id="p13Connect" value="Připojit" onclick="connectFiles(event)" onkeypress="return false" onkeydown="return false" type="button">
416
+ <span id="p13Status">Odpojeno</span>
417
+ </div>
418
+ </td>
419
+ </tr>
420
+ <tr>
421
+ <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign="bottom">
422
+ <div style="width:100%;text-align:center">
423
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Nahoru">
424
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="Vybrat vše" onkeypress="return false" onkeydown="return false">
425
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p13RenameFileButton" disabled="disabled" value="Přejmenovat" onclick="p13renamefile()" onkeypress="return false" onkeydown="return false">
426
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p13DeleteFileButton" disabled="disabled" value="Smazat" onclick="p13deletefile()" onkeypress="return false" onkeydown="return false">
427
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p13NewFolderButton" disabled="disabled" value="Adresář" onclick="p13createfolder()" onkeypress="return false" onkeydown="return false">
428
+ </div>
429
+ <div style="width:100%;text-align:center">
430
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p13UploadButton" disabled="disabled" value="Nahrát" onclick="p13uploadFile()" onkeypress="return false" onkeydown="return false">
431
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p13CutButton" disabled="disabled" value="Vyjmout" onclick="p13copyFile(1)" onkeypress="return false" onkeydown="return false">
432
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p13CopyButton" disabled="disabled" value="Kopírovat" onclick="p13copyFile(0)" onkeypress="return false" onkeydown="return false">
433
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p13PasteButton" disabled="disabled" value="Vložit" onclick="p13pasteFile()" onkeypress="return false" onkeydown="return false">
434
+ <input type="button" style="width:calc(100%/5 - 5px)" id="p13RefreshButton" disabled="disabled" value="Obnovit" onclick="p13folderup(9999)" onkeypress="return false" onkeydown="return false">
435
+ </div>
436
+ </td>
437
+ </tr>
438
+ <tr>
439
+ <td style="background-color:#E4E9E7;height:28px">
440
+ <table style="width:100%">
441
+ <tbody><tr>
442
+ <td id="p13currentpath" style="overflow:hidden;padding-left:4px;padding-top:2px"></td>
443
+ <td style="text-align:right;padding-right:4px">
444
+ <select id="p13sortdropdown" onchange="p13updateFiles()">
445
+ <option value="1" selected="selected">Třídit podle jména</option>
446
+ <option value="2">Třídit podle velikosti</option>
447
+ <option value="3">Sort by date</option>
448
+ <option value="4">Descend by name</option>
449
+ <option value="5">Descend by size</option>
450
+ <option value="6">Descend by date</option>
451
+ </select>
452
+ </td>
453
+ </tr>
454
+ </tbody></table>
455
+ </td>
456
+ </tr>
457
+ </tbody></table>
458
+ <div id="p13filetable" style="width:100%;height:calc(100% - 133px);overflow:auto;-webkit-user-select:none">
459
+ <!--
460
+ <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>
461
+ <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>
462
+ -->
463
+ <span id="p13files"></span>
464
+ </div>
465
+ <table id="p13toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px" cellpadding="0" cellspacing="0">
466
+ <tbody><tr><td style="text-align:left;padding:3px;text-align:center;background-color:#D3D9D6"> <span id="p13bottomstatus"></span></td></tr>
467
+ </tbody></table>
468
+ </div>
469
+ </div>
470
+ <div id="p20" style="display:none;position:absolute;bottom:0;top:0;width:100%">
471
+ <table cellspacing="0" style="margin:0;padding:0;border-spacing:0;border:0;">
472
+ <tbody><tr style="padding:0">
473
+ <td style="padding:0;color:#c8c8c8;text-align:center;cursor:pointer" width="60px" valign="top" onclick="goBack()">
474
+ <div style="padding:0;background-color:#036;width:10px;height:10px;float:right;border:0">
475
+ <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>
476
+ </div>
477
+ <div style="padding:0;font-size:25px;background-color:#036;width:50px;border-radius:0 0 10px 0;height:36px">◀</div>
478
+ </td>
479
+ <td onclick="p20editmesh(1)">
480
+ <img src="/images/meshicon50.png" width="50" height="50">
481
+ </td>
482
+ <td onclick="p20editmesh(1)">
483
+ <div style="margin-left:5px">
484
+ <strong style="font-size:large"><span id="p20meshName"></span></strong><br>
485
+ </div>
486
+ </td>
487
+ </tr>
488
+ </tbody></table>
489
+ <div id="p20info" style="margin-left:8px;margin-right:8px"></div>
490
+ </div>
491
+ </div>
492
+ </div>
493
+ <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px">
494
+ <table id="footerMenu" cellpadding="0" cellspacing="0" style="height:32px;width:100%;color:white;cursor:pointer;table-layout:fixed"></table>
495
+ </div>
496
+ </div>
497
+ <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">
498
+ <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0">
499
+ <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div>
500
+ <div id="id_dialogtitle" style="padding:5px"></div>
501
+ <div style="width:100%;margin:6px"></div>
502
+ </div>
503
+ <div style="margin-right:16px;margin-left:8px">
504
+ <div id="dialog1" style="margin:auto;text-align:center;margin:3px">
505
+ <div id="id_dialogMessage" style="padding:10px"></div>
506
+ </div>
507
+ <div id="dialog2" style="margin:auto;margin:3px">
508
+ <div id="id_dialogOptions"></div>
509
+ </div>
510
+ <div id="dialog3" style="margin:auto;margin:3px">
511
+ <select id="deskkeys" style="width:100%">
512
+ <option value="10">Ctrl+Alt+Del</option>
513
+ <option value="11">Tab</option>
514
+ <option value="5">Win</option>
515
+ <option value="0">Win+Down</option>
516
+ <option value="1">Win+Up</option>
517
+ <option value="2">Win+L</option>
518
+ <option value="3">Win+M</option>
519
+ <option value="4">Shift+Win+M</option>
520
+ <option value="6">Win+R</option>
521
+ <option value="7">Alt-F4</option>
522
+ <option value="8">Ctrl-W</option>
523
+ <option value="9">Alt-Tab</option>
524
+ </select>
525
+ </div>
526
+ <div id="dialog7" style="margin:auto;margin:3px">
527
+ <div id="d7meshkvm">
528
+ <h4 style="width:100%;border-bottom:1px solid gray">Agent Remote Desktop</h4>
529
+ <div style="margin:3px 0 3px 0">
530
+ <select id="d7bitmapquality" style="float:right;width:200px;height:20px" dir="rtl"></select>
531
+ <div style="height:20px">Kvalita</div>
532
+ </div>
533
+ <div style="margin:3px 0 3px 0">
534
+ <select id="d7bitmapscaling" style="float:right;width:200px;height:20px" dir="rtl">
535
+ <option selected="selected" value="1024">100%</option>
536
+ <option value="896">87.5%</option>
537
+ <option value="768">75%</option>
538
+ <option value="640">62.5%</option>
539
+ <option value="512">50%</option>
540
+ <option value="384">37.5%</option>
541
+ <option value="256">25%</option>
542
+ <option value="128">12.5%</option>
543
+ </select>
544
+ <div style="height:20px">Škálování</div>
545
+ </div>
546
+ <div style="margin:3px 0 3px 0">
547
+ <select id="d7framelimiter" style="float:right;width:200px;height:20px" dir="rtl">
548
+ <option selected="selected" value="50">Rychle</option>
549
+ <option value="100">Středně</option>
550
+ <option value="400">Pomalu</option>
551
+ <option value="1000">Velmi pomalu</option>
552
+ </select>
553
+ <div style="height:20px">Rate</div>
554
+ </div>
555
+ </div>
556
+ <div id="d7amtkvm">
557
+ <h4 style="width:100%;border-bottom:1px solid gray">Intel® AMT Hardware KVM</h4>
558
+ <div style="height:26px">
559
+ <select id="d7desktopmode" style="float:right;width:200px">
560
+ <option value="1">RLE8, Fastest</option>
561
+ <option value="2">RLE16, Recommended</option>
562
+ <option value="3">RAW8, Slow</option>
563
+ <option value="4">RAW16, Very Slow</option>
564
+ </select>
565
+ <div>Encoding</div>
566
+ </div>
567
+ <div style="height:60px">
568
+ <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white">
569
+ <label><input type="checkbox" id="d7showfocus">Show Focus Tool</label><br>
570
+ <label><input type="checkbox" id="d7showcursor">Show Local Mouse Cursor</label><br>
571
+ </div>
572
+ <div>Other</div>
573
+ </div>
574
+ </div>
575
+ </div>
576
+ </div>
577
+ <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px">
578
+ <input id="idx_dlgCancelButton" type="button" value="Zrušit" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)">
579
+ <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)">
580
+ </div>
581
+ </div>
582
+ <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">
583
+ <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(2)">Moje soubory</div>
584
+ <div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer" onclick="topMenu(1)">Můj účet</div>
585
+ <div id="logoutMenuOption"><a href="/logout"><div style="padding:12px;border-top:1px solid gray;color:black;cursor:pointer">Odhlásit</div></a></div>
586
+ </div>
587
+ <iframe name="fileUploadFrame" style="display:none"></iframe>
588
+ <script>
589
+ 'use strict';
590
+
591
+ // Process server-side web state
592
+ var webState = '{{{webstate}}}';
593
+ if (webState != '') { webState = JSON.parse(decodeURIComponent(webState)); }
594
+ for (var i in webState) { localStorage.setItem(i, webState[i]); }
595
+ if (!webState.loctag) { delete localStorage.removeItem('loctag'); }
596
+
597
+ var args = parseUriArgs();
598
+ var debugLevel = parseInt('{{{debuglevel}}}');
599
+ var features = parseInt('{{{features}}}');
600
+ var sessionTime = parseInt('{{{sessiontime}}}');
601
+ var domain = '{{{domain}}}';
602
+ var domainUrl = '{{{domainurl}}}';
603
+ var authCookie = '{{{authCookie}}}';
604
+ var authRelayCookie = '{{{authRelayCookie}}}';
605
+ var authCookieRenewTimer = null;
606
+ var meshserver = null;
607
+ var xdr = null;
608
+ var serverinfo = null;
609
+ var nodes = [];
610
+ var meshes = {};
611
+ var filetree = {};
612
+ var userinfo = null;
613
+ var serverinfo = null;
614
+ var users = null;
615
+ var nodeShortIdent = 0;
616
+ var serverPublicNamePort = '{{{serverDnsName}}}:{{{serverPublicPort}}}';
617
+ var debugmode = false;
618
+ var attemptWebRTC = ((features & 128) != 0);
619
+ var StatusStrs = ["Odpojeno", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"];
620
+ var files;
621
+ var passRequirements = '{{{passRequirements}}}';
622
+ if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); }
623
+ var sessionActivity = Date.now();
624
+
625
+ function startup() {
626
+ if ((features & 32) == 0) {
627
+ // Guard against other site's top frames (web bugs).
628
+ var loc = null;
629
+ try { loc = top.location.toString().toLowerCase(); } catch (e) { }
630
+ if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; }
631
+ }
632
+
633
+ if (!args.locale) { var x = getstore('loctag', 0); if ((x != null) && (x != '*')) { args.locale = x; } }
634
+
635
+ window.onresize = center;
636
+ center();
637
+ QV('changeEmailId', (features & 0x200000) == 0);
638
+ QH('p1message', "Connecting...");
639
+ go(1);
640
+
641
+ // Connect to the mesh server
642
+ meshserver = MeshServerCreateControl(domainUrl, authCookie);
643
+ meshserver.onStateChanged = onStateChanged;
644
+ meshserver.onMessage = onMessage;
645
+ meshserver.Start();
646
+
647
+ // Load desktop settings
648
+ var t = localStorage.getItem('desktopsettings');
649
+ if (t != null) { desktopsettings = JSON.parse(t); }
650
+ applyDesktopSettings();
651
+ }
652
+
653
+ function onStateChanged(server, state, prevState, errorCode) {
654
+ if (state == 0) {
655
+ // Control web socket disconnected
656
+ setDialogMode(0); // Close any dialog boxes if present
657
+ go(0); // Go to disconnection panel
658
+ if (errorCode == 'noauth') { QH('p0span', "Unable to perform authentication"); return; }
659
+ if (prevState == 2) { setTimeout(serverPoll, 5000); } else { QH('p0span', "Unable to connect web socket"); }
660
+ // Clean up here
661
+ if (authCookieRenewTimer != null) { clearInterval(authCookieRenewTimer); authCookieRenewTimer = null; }
662
+ } else if (state == 2) {
663
+ // Fetch list of meshes, nodes, files
664
+ meshserver.send({ action: 'meshes' });
665
+ meshserver.send({ action: 'nodes' });
666
+ meshserver.send({ action: 'files' });
667
+ if (xxcurrentView < 2) { go(2); }
668
+ authCookieRenewTimer = setInterval(function () { meshserver.send({ action: 'authcookie' }); }, 1800000); // Request a cookie refresh every 30 minutes.
669
+ }
670
+ QV('topMenuIcon', state == 2);
671
+ }
672
+
673
+ // Poll the server, if it responds, refresh the page.
674
+ function serverPoll() {
675
+ xdr = null;
676
+ try { xdr = new XDomainRequest(); } catch (e) { }
677
+ if (!xdr) xdr = new XMLHttpRequest();
678
+ xdr.open('HEAD', window.location.href);
679
+ xdr.timeout = 15000;
680
+ xdr.onload = function () { reload(); };
681
+ xdr.onerror = xdr.ontimeout = function () { setTimeout(serverPoll, 10000); };
682
+ xdr.send();
683
+ }
684
+
685
+ function updateSelf() {
686
+ QV('verifyEmailId', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
687
+ QV('manageAuthApp', features & 4096);
688
+ QV('manageOtp', ((features & 4096) != 0) && ((userinfo.otpsecret == 1) || (userinfo.otphkeys > 0)));
689
+
690
+ // On the mobile app, don't allow group creation (for now).
691
+ QV('p3createMeshLink1', false);
692
+ QV('p3createMeshLink2', false);
693
+
694
+ if (typeof userinfo.passchange == 'number') {
695
+ if (userinfo.passchange == -1) { QH('p2nextPasswordUpdateTime', " - Reset on next login."); }
696
+ else if ((passRequirements != null) && (typeof passRequirements.reset == 'number')) {
697
+ var seconds = (userinfo.passchange) + (passRequirements.reset * 86400) - Math.floor(Date.now() / 1000);
698
+ if (seconds < 0) { QH('p2nextPasswordUpdateTime', " - Reset on next login."); }
699
+ else if (seconds < 3600) { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} minute{1}.", Math.floor(seconds / 60), addLetterS(Math.floor(seconds / 60)))); }
700
+ else if (seconds < 86400) { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} hour{1}.", Math.floor(seconds / 3600), addLetterS(Math.floor(seconds / 3600)))); }
701
+ else { QH('p2nextPasswordUpdateTime', format(" - Reset v {0} den{1}."), Math.floor(seconds / 86400), addLetterS(Math.floor(seconds / 86400))); }
702
+ }
703
+ }
704
+ }
705
+
706
+ function addLetterS(x) { return (x > 1) ? 's' : ''; }
707
+ function setSessionActivity() { sessionActivity = Date.now(); }
708
+ function checkIdleSessionTimeout() { var delta = (Date.now() - sessionActivity); if (delta > serverinfo.timeout) { window.location.href = 'logout'; } }
709
+
710
+ function onMessage(server, message) {
711
+ switch (message.action) {
712
+ case 'serverinfo': {
713
+ serverinfo = message.serverinfo;
714
+ if (serverinfo.timeout) { setInterval(checkIdleSessionTimeout, 10000); checkIdleSessionTimeout(); }
715
+ QV('p3AccountActions', ((features & 4) == 0) && (serverinfo.domainauth == false)); // Hide Account Actions if in single user mode or domain authentication
716
+ QV('logoutMenuOption', ((features & 4) == 0) && (serverinfo.domainauth == false)); // Hide logout if in single user mode or domain authentication
717
+ break;
718
+ }
719
+ case 'authcookie': {
720
+ // Got an authentication cookie refresh
721
+ authCookie = message.cookie;
722
+ authRelayCookie = message.rcookie;
723
+ break;
724
+ }
725
+ case 'userinfo': {
726
+ userinfo = message.userinfo;
727
+ QH('p3userName', userinfo.name);
728
+ //updateSiteAdmin();
729
+ updateSelf();
730
+ break;
731
+ }
732
+ case 'users': {
733
+ users = {};
734
+ for (var m in message.users) { users[message.users[m]._id] = message.users[m]; }
735
+ updateUsers();
736
+ break;
737
+ }
738
+ case 'wssessioncount': {
739
+ wssessions = message.wssessions;
740
+ updateUsers();
741
+ break;
742
+ }
743
+ case 'meshes': {
744
+ meshes = {};
745
+ for (var m in message.meshes) { meshes[message.meshes[m]._id] = message.meshes[m]; }
746
+ updateMeshes();
747
+ updateDevices();
748
+ break;
749
+ }
750
+ case 'files': {
751
+ filetree = setupBackPointers(message.filetree);
752
+ updateFiles();
753
+ //d3updatefiles();
754
+ break;
755
+ }
756
+ case 'nodes': {
757
+ nodes = [];
758
+ for (var m in message.nodes) {
759
+ for (var n in message.nodes[m]) {
760
+ if (!meshes[m]) { console.log('Invalid mesh (1): ' + m); continue; }
761
+ message.nodes[m][n].namel = message.nodes[m][n].name.toLowerCase();
762
+ 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; }
763
+ message.nodes[m][n].meshnamel = meshes[m].name.toLowerCase();
764
+ message.nodes[m][n].meshid = m;
765
+ message.nodes[m][n].state = (message.nodes[m][n].state) ? (message.nodes[m][n].state) : 0;
766
+ message.nodes[m][n].desc = message.nodes[m][n].desc;
767
+ if (!message.nodes[m][n].icon) message.nodes[m][n].icon = 1;
768
+ message.nodes[m][n].ident = ++nodeShortIdent;
769
+ nodes.push(message.nodes[m][n]);
770
+ }
771
+ }
772
+ //onSortSelectChange();
773
+ //onSearchInputChanged();
774
+ updateDevices();
775
+ //refreshMap(false, true);
776
+ if (xxcurrentView == 0) { if ('{{viewmode}}' != '') { go(parseInt('{{viewmode}}')); } else { setDialogMode(0); go(2); } }
777
+ if ('{{currentNode}}' != '') { gotoDevice('{{currentNode}}', parseInt('{{viewmode}}')); }
778
+ break;
779
+ }
780
+ case 'powertimeline': {
781
+ if (message.nodeid != powerTimelineReq) break;
782
+ powerTimelineNode = message.nodeid;
783
+ powerTimeline = message.timeline;
784
+ powerTimelineUpdate = Date.now() + 300000; // Update every 5 minutes
785
+ if (currentNode._id == message.nodeid) { drawDeviceTimeline(); }
786
+ break;
787
+ }
788
+ case 'otpauth-request': {
789
+ if ((xxdialogMode == 2) && (xxdialogTag == 'otpauth-request')) {
790
+ var secret = message.secret;
791
+ if (secret.length == 52) { secret = secret.split(/(.............)/).filter(Boolean).join(' '); }
792
+ else if (secret.length == 32) { secret = secret.split(/(....)/).filter(Boolean).join(' '); secret = secret.substring(0, 20) + '<br/>' + secret.substring(20) }
793
+ 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=\"' + message.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=\"' + message.secret + '\" style=font-size:15px>' + secret + '</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>');
794
+ QV('idx_dlgOkButton', true);
795
+ QE('idx_dlgOkButton', false);
796
+ Q('d2otpauthinput').focus();
797
+ }
798
+ break;
799
+ }
800
+ case 'otpauth-setup': {
801
+ if (xxdialogMode) return;
802
+ setDialogMode(2, "Authenticator App", 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.");
803
+ break;
804
+ }
805
+ case 'otpauth-clear': {
806
+ if (xxdialogMode) return;
807
+ setDialogMode(2, "Authenticator App", 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.");
808
+ break;
809
+ }
810
+ case 'otpauth-getpasswords': {
811
+ if (xxdialogMode) return;
812
+ var x = "One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";
813
+ x += '<div style=\'border-radius:6px;border: 2px dashed #888;width:100%;margin-top:8px\'><div style=\'padding:8px;font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold\'><table style=width:100%;text-align:center>';
814
+ if (message.passwords) {
815
+ var j = 0;
816
+ for (var i in message.passwords) {
817
+ if (++j % 2) { x += '<tr>'; }
818
+ var p = '' + message.passwords[i].p;
819
+ while (p.length < 8) { p = '0' + p; }
820
+ if (message.passwords[i].u === true) { x += '<td>' + p.substring(0, 4) + ' ' + p.substring(4); } else { x += '<td><strike style=color:#BBB>' + p.substring(0, 4) + ' ' + p.substring(4); + '</strike>'; }
821
+ }
822
+ } else {
823
+ x += '<tr><td>' + "No Active Tokens";
824
+ }
825
+ x += '</table></div></div><br />';
826
+ x += '<div><input type=button value=\'' + "Close" + '\' onclick=setDialogMode(0) style=float:right></input>';
827
+ x += '<input type=button value=\'' + "New Tokens" + '\' onclick=\'account_manageOtp(1);\'></input>';
828
+ if (message.passwords != null) { x += '<input type=button value=\'' + "Clear" + '\' onclick=\'account_manageOtp(2);\'></input>'; }
829
+ x += '</div><br />';
830
+ setDialogMode(2, "Manage Backup Codes", 8, null, x, 'otpauth-manage');
831
+ break;
832
+ }
833
+ case 'event': {
834
+ /*
835
+ if (!message.event.nolog) {
836
+ events.unshift(message.event);
837
+ var eventLimit = parseInt(p3limitdropdown.value);
838
+ while (events.length > eventLimit) { events.pop(); } // Remove element(s) at the end
839
+ events_update();
840
+ }
841
+ */
842
+ if (message.event.noact) break; // Take no action on this event
843
+ switch (message.event.action) {
844
+ case 'userWebState': {
845
+ // New user web state, update the web page as needed
846
+ if (localStorage != null) {
847
+ var webstate = JSON.parse(message.event.state);
848
+ for (var i in webstate) { localStorage.setItem(i, webstate[i]); }
849
+
850
+ // Update the web page
851
+ if ((webstate.loctag != null) && (webstate.loctag != oldLoctag)) {
852
+ if (webstate.loctag != null) { args.locale = webstate.loctag; } else { delete args.locale; }
853
+ updateDevices();
854
+ updateMeshes();
855
+ }
856
+ }
857
+ break;
858
+ }
859
+ case 'accountchange': {
860
+ // An account was created or changed
861
+ if (userinfo.name == message.event.account.name) {
862
+ var newsiteadmin = message.event.account.siteadmin ? message.event.account.siteadmin : 0;
863
+ var oldsiteadmin = userinfo.siteadmin ? userinfo.siteadmin : 0;
864
+ if ((message.event.account.quota != userinfo.quota) || (((userinfo.siteadmin & 8) == 0) && ((message.event.account.siteadmin & 8) != 0))) { meshserver.send({ action: 'files' }); }
865
+ userinfo = message.event.account;
866
+ if (oldsiteadmin != newsiteadmin) updateSiteAdmin();
867
+ updateSelf();
868
+ }
869
+ break;
870
+ }
871
+ case 'createmesh': {
872
+ // A new mesh was created
873
+ if (message.event.links[userinfo._id] != 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.
874
+ meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
875
+ updateMeshes();
876
+ updateDevices();
877
+ meshserver.send({ action: 'files' });
878
+ }
879
+ break;
880
+ }
881
+ case 'meshchange': {
882
+ // Update mesh information
883
+ if (meshes[message.event.meshid] == null) {
884
+ // This is a new mesh for us
885
+ meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
886
+ meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
887
+ } else {
888
+ // This is an existing mesh
889
+ if (meshes[message.event.meshid].name != message.event.name) {
890
+ meshes[message.event.meshid].name = message.event.name;
891
+ for (var i in nodes) { if (nodes[i].meshid == message.event.meshid) { nodes[i].meshnamel = message.event.name.toLowerCase(); } }
892
+ }
893
+ meshes[message.event.meshid].desc = message.event.desc;
894
+ meshes[message.event.meshid].links = message.event.links;
895
+
896
+ // Check if we lost rights to this mesh in this change.
897
+ if (meshes[message.event.meshid].links[userinfo._id] == null) {
898
+ if ((xxcurrentView == 20) && (currentMesh == meshes[message.event.meshid])) go(2);
899
+ delete meshes[message.event.meshid];
900
+
901
+ // Delete all nodes in that mesh
902
+ var newnodes = [];
903
+ for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } }
904
+ nodes = newnodes;
905
+
906
+ // If we are looking at a node in the deleted mesh, move back to "My Devices"
907
+ if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) { setDialogMode(0); go(2); }
908
+ }
909
+ }
910
+ updateMeshes();
911
+ updateDevices();
912
+ meshserver.send({ action: 'files' });
913
+
914
+ // If we are looking at a mesh that is now deleted, move back to "My Account"
915
+ if (xxcurrentView == 20 && currentMesh._id == message.event.meshid) { p20updateMesh(); }
916
+ break;
917
+ }
918
+ case 'deletemesh': {
919
+ // Delete the mesh
920
+ if (meshes[message.event.meshid]) {
921
+ delete meshes[message.event.meshid];
922
+ updateMeshes();
923
+ meshserver.send({ action: 'files' });
924
+ }
925
+
926
+ // Delete all nodes in that mesh
927
+ var newnodes = [];
928
+ for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } }
929
+ nodes = newnodes;
930
+ updateDevices();
931
+
932
+ // If we are looking at a mesh that is now deleted, move back to "My Account"
933
+ if (xxcurrentView >= 20 && xxcurrentView < 30 && currentMesh._id == message.event.meshid) { setDialogMode(0); go(2); }
934
+ // If we are looking at a node in the deleted mesh, move back to "My Devices"
935
+ if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) { setDialogMode(0); go(2); }
936
+
937
+ break;
938
+ }
939
+ case 'addnode': {
940
+ var node = message.event.node;
941
+ 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.
942
+ if (getNodeFromId(node._id) != null) break; // This node is already known.
943
+ node.namel = node.name.toLowerCase();
944
+ if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
945
+ node.meshnamel = meshes[node.meshid].name.toLowerCase();
946
+ node.state = 0;
947
+ if (!node.icon) node.icon = 1;
948
+ node.ident = ++nodeShortIdent;
949
+ nodes.push(node);
950
+ //onSortSelectChange();
951
+ //onSearchInputChanged();
952
+ updateDevices();
953
+ //updateMapMarkers();
954
+ break;
955
+ }
956
+ case 'removenode': {
957
+ var index = -1;
958
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
959
+ if (index != -1) {
960
+ var node = nodes[index];
961
+ if (currentNode == node) {
962
+ if (xxcurrentView >= 10 && xxcurrentView < 20) { setDialogMode(0); go(2); }
963
+ currentNode = null;
964
+ // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
965
+ }
966
+ nodes.splice(index, 1);
967
+ updateDevices();
968
+ //updateMapMarkers();
969
+ }
970
+ break;
971
+ }
972
+ case 'changenode': {
973
+ var index = -1;
974
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
975
+ if (index != -1) {
976
+ var node = nodes[index];
977
+
978
+ // Change the node
979
+ node.name = message.event.node.name;
980
+ node.rname = message.event.node.rname;
981
+ node.host = message.event.node.host;
982
+ node.desc = message.event.node.desc;
983
+ node.publicip = message.event.node.publicip;
984
+ node.iploc = message.event.node.iploc;
985
+ node.wifiloc = message.event.node.wifiloc;
986
+ node.gpsloc = message.event.node.gpsloc;
987
+ node.tags = message.event.node.tags;
988
+ node.userloc = message.event.node.userloc;
989
+ if (message.event.node.agent != null) {
990
+ if (node.agent == null) node.agent = {};
991
+ if (message.event.node.agent.ver != null) { node.agent.ver = message.event.node.agent.ver; }
992
+ if (message.event.node.agent.id != null) { node.agent.id = message.event.node.agent.id; }
993
+ if (message.event.node.agent.caps != null) { node.agent.caps = message.event.node.agent.caps; }
994
+ if (message.event.node.agent.core != null) { node.agent.core = message.event.node.agent.core; } else { if (node.agent.core) { delete node.agent.core; } }
995
+ node.agent.tag = message.event.node.agent.tag;
996
+ }
997
+ if (message.event.node.intelamt != null) {
998
+ if (node.intelamt == null) node.intelamt = {};
999
+ if (message.event.node.intelamt.state != null) { node.intelamt.state = message.event.node.intelamt.state; }
1000
+ if (message.event.node.intelamt.host != null) { node.intelamt.user = message.event.node.intelamt.host; }
1001
+ if (message.event.node.intelamt.user != null) { node.intelamt.user = message.event.node.intelamt.user; }
1002
+ if (message.event.node.intelamt.tls != null) { node.intelamt.tls = message.event.node.intelamt.tls; }
1003
+ if (message.event.node.intelamt.ver != null) { node.intelamt.ver = message.event.node.intelamt.ver; }
1004
+ if (message.event.node.intelamt.tag != null) { node.intelamt.tag = message.event.node.intelamt.tag; }
1005
+ if (message.event.node.intelamt.uuid != null) { node.intelamt.uuid = message.event.node.intelamt.uuid; }
1006
+ if (message.event.node.intelamt.realm != null) { node.intelamt.realm = message.event.node.intelamt.realm; }
1007
+ }
1008
+ node.namel = node.name.toLowerCase();
1009
+ if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1010
+ if (message.event.node.icon) { node.icon = message.event.node.icon; }
1011
+
1012
+ //onSortSelectChange(true);
1013
+ //drawNotifications();
1014
+ refreshDevice(node._id);
1015
+ //updateMapMarkers();
1016
+ updateDevices();
1017
+
1018
+ //if ((currentNode == node) && (xxdialogMode != null) && (xxdialogTag == '@xxmap')) { p10showNodeLocationDialog(); }
1019
+ }
1020
+ break;
1021
+ }
1022
+ case 'nodemeshchange': {
1023
+ var index = -1;
1024
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1025
+ if (index != -1) {
1026
+ var node = nodes[index];
1027
+ if (meshes[message.event.newMeshId] == null) {
1028
+ // We don't see the new mesh, remove this device
1029
+
1030
+ // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
1031
+ if (currentNode == node) { if (xxcurrentView >= 10 && xxcurrentView < 20) { setDialogMode(0); go(2); } currentNode = null; }
1032
+ nodes.splice(index, 1);
1033
+ } else {
1034
+ // We see the new mesh, move this device
1035
+ node.meshid = message.event.newMeshId;
1036
+ node.meshnamel = meshes[message.event.newMeshId].name.toLowerCase();
1037
+ }
1038
+ updateDevices();
1039
+ refreshDevice(message.event.nodeid);
1040
+ } else {
1041
+ // This is a new device, add it.
1042
+ var node = message.event.node;
1043
+ 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.
1044
+ node.namel = node.name.toLowerCase();
1045
+ if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1046
+ node.meshnamel = meshes[node.meshid].name.toLowerCase();
1047
+ node.state = 0;
1048
+ if (!node.icon) node.icon = 1;
1049
+ node.ident = ++nodeShortIdent;
1050
+ if (nodes == null) { }
1051
+ nodes.push(node);
1052
+
1053
+ // Web page update
1054
+ //masterUpdate(1 | 2 | 4 | 16);
1055
+ updateDevices();
1056
+ }
1057
+ break;
1058
+ }
1059
+ case 'nodeconnect': {
1060
+ // Indicated a node has changed connectivity state
1061
+ var index = -1;
1062
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
1063
+ if (index != -1) {
1064
+ var node = nodes[index];
1065
+
1066
+ // Change the node connection state
1067
+ node.conn = message.event.conn;
1068
+ node.pwr = message.event.pwr;
1069
+ updateDevices();
1070
+ //updateMapMarkers();
1071
+ //refreshDevice(node._id);
1072
+ }
1073
+ break;
1074
+ }
1075
+ case 'login': {
1076
+ // Update the last login time
1077
+ if (users != null && users['user/' + domain + '/' + message.event.username.toLowerCase()]) { users['user/' + domain + '/' + message.event.username.toLowerCase()].login = message.event.time; }
1078
+ break;
1079
+ }
1080
+ case 'notify': {
1081
+ //var n = { text: message.event.value };
1082
+ //if (message.event.tag != null) { n.tag = message.event.tag; }
1083
+ //addNotification(n);
1084
+ break;
1085
+ }
1086
+ case 'stopped': { // Server is stopping.
1087
+ // TODO: Disconnect
1088
+ break;
1089
+ }
1090
+ default:
1091
+ //console.log('Unknown message.event.action', message.event.action);
1092
+ break;
1093
+ }
1094
+ break;
1095
+ }
1096
+ default:
1097
+ //console.log('Unknown message.action', message.action);
1098
+ break;
1099
+ }
1100
+ }
1101
+
1102
+ //
1103
+ // Menu System
1104
+ //
1105
+
1106
+ function topMenu(select) {
1107
+ if ((xxdialogMode != null) && (xxdialogMode != 0) && (xxdialogMode != 999)) return;
1108
+ if (select === undefined) {
1109
+ var x = (QS('topMenu').display == 'none');
1110
+ if (x == true) { if ((xxdialogMode == 0) || (xxdialogMode == null)) { QV('topMenu', true); xxdialogMode = 999; } } else { QV('topMenu', false); xxdialogMode = 0; }
1111
+ } else {
1112
+ QV('topMenu', false);
1113
+ xxdialogMode = 0;
1114
+ if ((select == 1) && (xxcurrentView != 3)) { goForward('account'); } // My Account
1115
+ if ((select == 2) && (xxcurrentView != 5)) { goForward('files'); } // My Files
1116
+ }
1117
+ }
1118
+
1119
+ var backStack = [];
1120
+ function goBack() { if (xxdialogMode) return; if (backStack.length > 0) { backStack.pop(); } goStack(); }
1121
+ function goForward(id) { if (xxdialogMode) return; backStack.push(id); goStack(); }
1122
+ function goStack() {
1123
+ if (backStack.length == 0) { go(2); return; }
1124
+ var id = backStack[backStack.length - 1], idtype = id.split('/')[0];
1125
+ if (idtype == 'node') { setupDeviceMenu(0); gotoDevice(id); }
1126
+ if (idtype == 'mesh') { gotoMesh(id); }
1127
+ if (idtype == 'account') { go(3); }
1128
+ if (idtype == 'devices') { go(2); }
1129
+ if (idtype == 'files') { go(5); }
1130
+ }
1131
+
1132
+ function updateFooterMenu(options) {
1133
+ while (options != null && options.length < 3) { options.push({ n: '' }); }
1134
+ var x = '', prev = '';
1135
+ if (options != null) { for (var i in options) { x += '<td style="cursor:pointer' + ((prev == '') ? '' : ';border-left:solid 1px white') + '" onclick="' + options[i].f + '">' + options[i].n; prev = options[i].n; } }
1136
+ QH('footerMenu', '<tr>' + x);
1137
+ }
1138
+
1139
+ //
1140
+ // MY ACCOUNT
1141
+ //
1142
+
1143
+ function account_manageAuthApp() {
1144
+ if (xxdialogMode || ((features & 4096) == 0)) return;
1145
+ if (userinfo.otpsecret == 1) { account_removeOtp(); } else { account_addOtp(); }
1146
+ }
1147
+
1148
+ function account_addOtp() {
1149
+ if (xxdialogMode || (userinfo.otpsecret == 1) || ((features & 4096) == 0)) return;
1150
+ setDialogMode(2, "Authenticator App", 2, function () { meshserver.send({ action: 'otpauth-setup', secret: Q('d2optsecret').attributes.secret.value, token: Q('d2otpauthinput').value }); }, '<div id=d2optinfo>' + "Loading..." + '</div>', 'otpauth-request');
1151
+ meshserver.send({ action: 'otpauth-request' });
1152
+ }
1153
+
1154
+ function account_addOtpCheck(e) {
1155
+ var tokenIsValid = (Q('d2otpauthinput').value.length == 6);
1156
+ QE('idx_dlgOkButton', tokenIsValid);
1157
+ if (e && (e.keyCode == 13) && tokenIsValid) { dialogclose(1); }
1158
+ }
1159
+
1160
+ function account_removeOtp() {
1161
+ if (xxdialogMode || (userinfo.otpsecret != 1) || ((features & 4096) == 0)) return;
1162
+ setDialogMode(2, "Authenticator App", 3, function () { meshserver.send({ action: 'otpauth-clear' }); }, "Confirm removal of authenticator application 2-step login?");
1163
+ }
1164
+
1165
+ function account_manageOtp(action) {
1166
+ if ((xxdialogMode == 2) && (xxdialogTag == 'otpauth-manage')) { dialogclose(0); }
1167
+ if (xxdialogMode || (userinfo.otpsecret != 1) || ((features & 4096) == 0)) return;
1168
+ meshserver.send({ action: 'otpauth-getpasswords', subaction: action });
1169
+ }
1170
+
1171
+ function account_showVerifyEmail() {
1172
+ if (xxdialogMode || (userinfo.emailVerified == true) || (serverinfo.emailcheck != true)) return;
1173
+ var x = "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.";
1174
+ setDialogMode(2, "Email Verification", 3, account_showVerifyEmailEx, x);
1175
+ }
1176
+
1177
+ function account_showVerifyEmailEx() {
1178
+ meshserver.send({ action: 'verifyemail', email: userinfo.email });
1179
+ }
1180
+
1181
+ function account_showChangeEmail() {
1182
+ if (xxdialogMode) return;
1183
+ var x = addHtmlValue("Email", '<input id=dp3email style=width:170px maxlength=256 onchange=account_validateEmail() onkeyup=account_validateEmail(event) />');
1184
+ setDialogMode(2, "Změna emailové adresy", 3, account_changeEmail, x);
1185
+ if (userinfo.email != null) { Q('dp3email').value = userinfo.email; }
1186
+ account_validateEmail();
1187
+ Q('dp3email').focus();
1188
+ }
1189
+
1190
+ function account_validateEmail(e, email) {
1191
+ QE('idx_dlgOkButton', validateEmail(Q('dp3email').value) && (Q('dp3email').value != userinfo.email));
1192
+ if ((e != null) && (e.keyCode == 13)) { dialogclose(1); }
1193
+ }
1194
+
1195
+ function account_changeEmail() {
1196
+ meshserver.send({ action: 'changeemail', email: Q('dp3email').value });
1197
+ }
1198
+
1199
+ function account_showDeleteAccount() {
1200
+ if (xxdialogMode) return;
1201
+ var x = '<form method=post><table style=margin-left:10px><input type=hidden name=action value=deleteaccount /><input type=hidden name=authcookie value=' + authCookie + ' /><tr>';
1202
+ x += '<td align=right>' + "Heslo:" + '</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>';
1203
+ x += '</tr><tr><td align=right>' + "Heslo:" + '</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>';
1204
+ x += '</tr></table><div style=padding:10px;margin-bottom:4px>';
1205
+ x += '<input id=account_dlgCancelButton type=button value=\"' + "Zrušit" + '\" style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>';
1206
+ x += '<input id=account_dlgOkButton type=submit value=\"' + "OK" + '\" style="float:right;width:80px" onclick=dialogclose(1)>';
1207
+ x += '</div><br /></form>';
1208
+ setDialogMode(2, "Smazat účet", 0, null, x);
1209
+ account_validateDeleteAccount();
1210
+ Q('apassword1').focus();
1211
+ }
1212
+
1213
+
1214
+ function account_showChangePassword() {
1215
+ if (xxdialogMode) return false;
1216
+ var x = '<table style=margin-left:10px>';
1217
+ x += '<tr><td align=right>' + nobreak("Staré heslo:") + '</td><td><input id=apassword0 type=password name=apassword0 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b></b></td></tr>';
1218
+ x += '<tr><td align=right>' + nobreak("Nové heslo:") + '</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></tr>';
1219
+ x += '<tr><td align=right>' + nobreak("Nové heslo:") + '</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>';
1220
+ if (features & 0x00010000) { x += '<tr><td align=right>' + "Nápovšda k heslu:" + '</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>'; }
1221
+ x += '</table>'
1222
+ if (passRequirements) {
1223
+ var r = [], rc = 0;
1224
+ for (var i in passRequirements) { if ((i != 'reset') && (i != 'hint')) { r.push(i + ':' + passRequirements[i]); rc++; } }
1225
+ if (rc > 0) { x += '<br /><span style=font-size:x-small>' + format("Requirements: {0}.", r.join(', ')) + '</span>'; }
1226
+ }
1227
+ x += '<br />';
1228
+ setDialogMode(2, "Změnit heslo", 3, account_showChangePasswordEx, x);
1229
+ Q('apassword0').focus();
1230
+ account_validateNewPassword();
1231
+ return false;
1232
+ }
1233
+
1234
+ function account_showChangePasswordEx() {
1235
+ if (Q('apassword1').value == Q('apassword2').value) {
1236
+ var r = { action: 'changepassword', oldpass: Q('apassword0').value, newpass: Q('apassword1').value };
1237
+ if (features & 0x00010000) { r.hint = Q('apasswordhint').value; }
1238
+ meshserver.send(r);
1239
+ }
1240
+ }
1241
+
1242
+ function account_createMesh() {
1243
+ if (xxdialogMode) return;
1244
+
1245
+ // Check if we are disallowed from creating a device group
1246
+ if ((userinfo.siteadmin != 0xFFFFFFFF) && ((userinfo.siteadmin & 64) != 0)) { setDialogMode(2, "Nová skupina zařízení", 1, null, "This account does not have the rights to create a new device group."); return; }
1247
+
1248
+ // Remind the user to verify the email address
1249
+ if ((userinfo.emailVerified !== true) && (serverinfo.emailcheck == true) && (userinfo.siteadmin != 0xFFFFFFFF)) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until a email address is verified. This is required for password recovery. Go to the \"My Account\" to change and verify an email address."); return; }
1250
+
1251
+ // Remind the user to add two factor authentication
1252
+ if ((features & 0x00040000) && !((userinfo.otpsecret == 1) || (userinfo.otphkeys > 0) || (userinfo.otpkeys > 0))) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the \"My Account\" and look at the \"Account Security\" section."); return; }
1253
+
1254
+ // We are allowed, let's prompt to information
1255
+ var x = addHtmlValue("Jméno", '<input id=dp3meshname style=width:170px maxlength=64 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />');
1256
+ x += addHtmlValue("Typ", '<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>');
1257
+ x += addHtmlValue("Popis", '<div style=width:170px;margin:0;padding:0><textarea id=dp3meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>');
1258
+ setDialogMode(2, "Vytvořit skupinu zařízení", 3, account_createMeshEx, x);
1259
+ account_validateMeshCreate();
1260
+ Q('dp3meshname').focus();
1261
+ }
1262
+
1263
+ function account_validateMeshCreate() {
1264
+ QE('idx_dlgOkButton', Q('dp3meshname').value.length > 0);
1265
+ }
1266
+
1267
+ function account_createMeshEx(button, tag) {
1268
+ meshserver.send({ action: 'createmesh', meshname: Q('dp3meshname').value, meshtype: Q('dp3meshtype').value, desc: Q('dp3meshdesc').value });
1269
+ }
1270
+
1271
+ function account_validateDeleteAccount() {
1272
+ QE('account_dlgOkButton', (Q('apassword1').value.length > 0) && (Q('apassword1').value == Q('apassword2').value));
1273
+ }
1274
+
1275
+ function account_validateNewPassword() {
1276
+ var r = '', ok = (Q('apassword0').value.length > 0) && (Q('apassword1').value.length > 0) && (Q('apassword1').value == Q('apassword2').value) && (Q('apassword0').value != Q('apassword1').value);
1277
+ if ((features & 0x00010000) && (Q('apasswordhint').value == Q('apassword1').value)) { ok = false; }
1278
+ if (Q('apassword1').value != '') {
1279
+ if (passRequirements == null || passRequirements == '') {
1280
+ // No password requirements, display password strength
1281
+ var passStrength = checkPasswordStrength(Q('apassword1').value);
1282
+ if (passStrength >= 80) { r = '<span style=color:green>Strong<span>'; } else if (passStrength >= 60) { r = '<span style=color:blue>●<span>'; } else { r = '<span style=color:red>●<span>'; }
1283
+ } else {
1284
+ // Password requirements provided, use that
1285
+ var passReq = checkPasswordRequirements(Q('apassword1').value, passRequirements);
1286
+ if (passReq == false) { ok = false; r = '<span style=color:red>' + "Policy" + '<span>' }
1287
+ }
1288
+ }
1289
+ QH('dxPassWarn', r);
1290
+ //QE('account_dlgOkButton', ok);
1291
+ QE('idx_dlgOkButton', ok);
1292
+ }
1293
+
1294
+ // Return a password strength score
1295
+ function checkPasswordStrength(password) {
1296
+ var r = 0, letters = {}, varCount = 0, variations = { digits: /\d/.test(password), lower: /[a-z]/.test(password), upper: /[A-Z]/.test(password), nonWords: /\W/.test(password) }
1297
+ if (!password) return 0;
1298
+ for (var i = 0; i < password.length; i++) { letters[password[i]] = (letters[password[i]] || 0) + 1; r += 5.0 / letters[password[i]]; }
1299
+ for (var c in variations) { varCount += (variations[c] == true) ? 1 : 0; }
1300
+ return parseInt(r + (varCount - 1) * 10);
1301
+ }
1302
+
1303
+ // Check password requirements
1304
+ function checkPasswordRequirements(password, requirements) {
1305
+ if ((requirements == null) || (requirements == '') || (typeof requirements != 'object')) return true;
1306
+ if (requirements.min) { if (password.length < requirements.min) return false; }
1307
+ if (requirements.max) { if (password.length > requirements.max) return false; }
1308
+ var num = 0, lower = 0, upper = 0, nonalpha = 0;
1309
+ for (var i = 0; i < password.length; i++) {
1310
+ if (/\d/.test(password[i])) { num++; }
1311
+ if (/[a-z]/.test(password[i])) { lower++; }
1312
+ if (/[A-Z]/.test(password[i])) { upper++; }
1313
+ if (/\W/.test(password[i])) { nonalpha++; }
1314
+ }
1315
+ if (requirements.num && (num < requirements.num)) return false;
1316
+ if (requirements.lower && (lower < requirements.lower)) return false;
1317
+ if (requirements.upper && (upper < requirements.upper)) return false;
1318
+ if (requirements.nonalpha && (nonalpha < requirements.nonalpha)) return false;
1319
+ return true;
1320
+ }
1321
+
1322
+ function updateMeshes() {
1323
+ var r = '', count = 0;
1324
+ for (i in meshes) {
1325
+ count++;
1326
+
1327
+ // Mesh rights
1328
+ var meshrights = meshes[i].links[userinfo._id].rights;
1329
+ var rights = "Partial Rights";
1330
+ if (meshrights == 0xFFFFFFFF) rights = "Full Administrator"; else if (meshrights == 0) rights = "No Rights";
1331
+
1332
+ // Print the mesh information
1333
+ r += '<div style=cursor:pointer onclick=goForward(\'' + i + '\')>';
1334
+ r += '<div style="float:left;margin-left:4px"><img src="/images/meshicon50.png" width=50 height=50 /></div>';
1335
+ r += '<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">';
1336
+ r += '<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>' + rights + '</div></div>';
1337
+ r += '</div></div>';
1338
+ }
1339
+
1340
+ QH('p3meshes', r);
1341
+ QV('p3noMeshFound', count == 0);
1342
+ }
1343
+
1344
+ function gotoMesh(meshid) {
1345
+ currentMesh = meshes[meshid];
1346
+ if (currentMesh == null) { goBack(); }
1347
+ p20updateMesh();
1348
+ go(20);
1349
+ }
1350
+
1351
+ //
1352
+ // MY FILES
1353
+ //
1354
+
1355
+ var filetreelinkpath;
1356
+ var filetreelocation = [];
1357
+
1358
+ function p5refreshFiles() { meshserver.send({ action: 'files' }); }
1359
+
1360
+ function updateFiles() {
1361
+ QV('MainMenuMyFiles', ((features & 8) == 0));
1362
+ if ((features & 8) != 0) return; // If running on a server without files, exit now.
1363
+ var html1 = '', html2 = '', displayPath = '<a style=cursor:pointer onclick=p5folderup(0)>' + "Root" + '</a>', fullPath = 'Root', publicPath, filetreex = filetree, folderdepth = 1;
1364
+
1365
+ // Navigate to path location, build the paths at the same time
1366
+ var filetreelocation2 = [], oldlinkpath = filetreelinkpath, checkedBoxes = [], checkboxes = document.getElementsByName('fc');
1367
+ for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { checkedBoxes.push(checkboxes[i].value) }; } // Save all existing checked boxes
1368
+
1369
+ filetreelinkpath = '';
1370
+ for (var i in filetreelocation) {
1371
+ if ((filetreex.f != null) && (filetreex.f[filetreelocation[i]] != null)) {
1372
+ filetreelocation2.push(filetreelocation[i]);
1373
+ fullPath += ' / ' + filetreelocation[i];
1374
+ if ((folderdepth == 1)) {
1375
+ var sp = filetreelocation[i].split('/');
1376
+ publicPath = window.location + sp[0] + 'files/' + sp[2];
1377
+ //if (filetreelocation[i] === userinfo._id) { filetreelinkpath += 'self'; } else { filetreelinkpath += (sp[0] + '/' + sp[2]); }
1378
+ filetreelinkpath += filetreelocation[i];
1379
+ } else {
1380
+ if (filetreelinkpath != '') { filetreelinkpath += '/' + filetreelocation[i]; if (folderdepth > 2) { publicPath += '/' + filetreelocation[i]; } }
1381
+ }
1382
+ filetreex = filetreex.f[filetreelocation[i]];
1383
+ displayPath += ' / <a style=cursor:pointer onclick=p5folderup(' + folderdepth + ')>' + (filetreex.n != null ? filetreex.n : filetreelocation[i]) + '</a>';
1384
+ folderdepth++;
1385
+ } else {
1386
+ break;
1387
+ }
1388
+ }
1389
+ filetreelocation = filetreelocation2; // In case we could not go down the full path, we set the new path location here.
1390
+ var publicfolder = fullPath.toLowerCase().startsWith('root / ' + userinfo._id + ' / public');
1391
+
1392
+ // Sort the files
1393
+ var filetreexx = p5sort_files(filetreex.f);
1394
+
1395
+ // Display all files and folders at this location
1396
+ for (var i in filetreexx) {
1397
+ // Figure out the name and shortname
1398
+ var f = filetreexx[i], name = f.n, shortname;
1399
+ shortname = name;
1400
+ if (name.length > 40) { shortname = EscapeHtml(name.substring(0, 40)) + "..."; } else { shortname = EscapeHtml(name); }
1401
+ name = EscapeHtml(name);
1402
+
1403
+ // Figure out the date
1404
+ //var fdatestr = '';
1405
+ //if (f.d != null) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + '/' + (fdate.getDate()) + '/' + fdate.getFullYear() + ' ' + printTime(fdate) + ' '; }
1406
+
1407
+ // Figure out the size
1408
+ var fsize = '';
1409
+ if (f.s != null) { fsize = getFileSizeStr(f.s); }
1410
+
1411
+ var h = '';
1412
+ if (f.t < 3 || f.t == 4) {
1413
+ var right = (f.t == 1 || f.t == 4) ? p5getQuotabar(f) : '';
1414
+ h = '<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value=\'' + name + '\'> <span style=float:right;padding-right:4px>' + right + '</span><span><div class=fileIcon' + f.t + '></div><a style=cursor:pointer onclick=p5folderset(\"' + encodeURIComponent(f.nx) + '\")>' + shortname + '</a></span></div>';
1415
+ } else {
1416
+ var link = shortname;
1417
+ var publiclink = '';
1418
+ if (publicfolder) { publiclink = ' (<a style=cursor:pointer onclick=\'p5showPublicLink(\"' + publicPath + '/' + f.nx + '\")\'>' + "Link" + '</a>)'; }
1419
+ if (f.s > 0) { link = '<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"downloadfile.ashx?link=' + encodeURIComponent(filetreelinkpath + '/' + f.nx) + '\">' + shortname + '</a>' + publiclink; }
1420
+ h = '<div class=filelist file=3><input file=3 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value=\'' + f.nx + '\'> <span style=float:right;padding-right:4px>' + fsize + '</span><span><div class=fileIcon' + f.t + '></div>' + link + '</span></div>';
1421
+ }
1422
+
1423
+ if (f.t < 3) { html1 += h; } else { html2 += h; }
1424
+ }
1425
+
1426
+ //if (f.parent == null) { }
1427
+ QH('p5rightOfButtons', p5getQuotabar(filetreex));
1428
+
1429
+ QH('p5files', html1 + html2);
1430
+ QH('p5currentpath', displayPath);
1431
+ QE('p5FolderUp', filetreelocation.length != 0);
1432
+ QV('p5PublicShare', publicfolder);
1433
+
1434
+ // Re-check all boxes if needed
1435
+ if (oldlinkpath == filetreelinkpath) {
1436
+ checkboxes = document.getElementsByName('fc');
1437
+ for (var i = 0; i < checkboxes.length; i++) {
1438
+ checkboxes[i].checked = (checkedBoxes.indexOf(checkboxes[i].value) >= 0);
1439
+ }
1440
+ }
1441
+
1442
+ p5setActions();
1443
+ }
1444
+
1445
+ function getNiceSize(bytes) {
1446
+ if (bytes <= 0) return "Uložiště plné";
1447
+ if (bytes < 2048) return format("{0}b left", bytes);
1448
+ if (bytes < 2097152) return format("{0}k zbývá", Math.round(bytes / 1024));
1449
+ if (bytes < 2147483648) return format("{0}m left", Math.round(bytes / 1024 / 1024));
1450
+ return format("{0}g left", Math.round(bytes / 1024 / 1024 / 1024));
1451
+ }
1452
+
1453
+ function p5getQuotabar(f) {
1454
+ while (f.t > 1 && f.t != 4) { f = f.parent; }
1455
+ if ((f.t != 1 && f.t != 4) || (f.maxbytes == null)) return '';
1456
+ return getNiceSize(f.maxbytes - f.s) + ' <progress style=height:10px;width:100px value=' + f.s + ' max=' + f.maxbytes + ' />';
1457
+ }
1458
+
1459
+ function p5showPublicLink(u) { setDialogMode(2, "Veřejný odkaz", 1, null, '<input type=text style=width:100% value="' + u + '" readonly />'); }
1460
+
1461
+ var sortorder;
1462
+ function p5sort_filename(a, b) { if (a.ln > b.ln) return (1 * sortorder); if (a.ln < b.ln) return (-1 * sortorder); return 0; }
1463
+ function p5sort_timestamp(a, b) { if (a.d > b.d) return (1 * sortorder); if (a.d < b.d) return (-1 * sortorder); return 0; }
1464
+ function p5sort_bysize(a, b) { if (a.s == b.s) return p5sort_filename(a, b); return (((a.s - b.s)) * sortorder); }
1465
+
1466
+ function p5sort_files(files) {
1467
+ var r = [], sortselection = Q('p5sortdropdown').value;
1468
+ for (var i in files) { files[i].nx = i; if (files[i].n == null) { files[i].n = i; } files[i].ln = files[i].n.toLowerCase(); r.push(files[i]); }
1469
+ sortorder = 1;
1470
+ if (sortselection > 3) { sortorder = -1; sortselection -= 3; }
1471
+ if (sortselection == 1) { r.sort(p5sort_filename); }
1472
+ else if (sortselection == 2) { r.sort(p5sort_bysize); }
1473
+ else if (sortselection == 3) { r.sort(p5sort_timestamp); }
1474
+ return r;
1475
+ }
1476
+
1477
+ function p5setActions() {
1478
+ var cc = getFileSelCount(), tc = getFileCount(), sfc = getFileSelCount(false); // In order: number of entires selected, number of total entries, number of selected entires that are files (not folders)
1479
+ QE('p5DeleteFileButton', (cc > 0) && (filetreelocation.length > 0));
1480
+ QE('p5NewFolderButton', filetreelocation.length > 0);
1481
+ QE('p5UploadButton', filetreelocation.length > 0);
1482
+ QE('p5RenameFileButton', (cc == 1) && (filetreelocation.length > 0));
1483
+ QE('p5SelectAllButton', tc > 0);
1484
+ Q('p5SelectAllButton').value = (cc > 0 ? "Nic" : "Vše");
1485
+ QE('p5CutButton', (sfc > 0) && (cc == sfc));
1486
+ QE('p5CopyButton', (sfc > 0) && (cc == sfc));
1487
+ QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0) && (filetreelocation.length > 0));
1488
+ }
1489
+
1490
+ function getFileSelCount(includeDirs) { var cc = 0, checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == '3'))) cc++; } return cc; }
1491
+ function getFileSelDirCount() { var cc = 0, checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == '999')) cc++; } return cc; }
1492
+ function getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fc'); return checkboxes.length; }
1493
+ function p5selectallfile() { var nv = (getFileSelCount() == 0), checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = nv; } p5setActions(); }
1494
+ function setupBackPointers(x) { if (x.f != null) { var fs = 0, fc = 0; for (var i in x.f) { setupBackPointers(x.f[i]); x.f[i].parent = x; if (x.f[i].s) { fs += x.f[i].s; } if (x.f[i].c) { fc += x.f[i].c; } if (x.f[i].t == 3) { fc++; } } x.s = fs; x.c = fc; } return x; }
1495
+ function getFileSizeStr(size) { if (size == 1) return "1 byte"; return format("{0} bytů", size); }
1496
+ function p5folderup(x) { if (x == null) { filetreelocation.pop(); } else { while (filetreelocation.length > x) { filetreelocation.pop(); } } updateFiles(); return false; }
1497
+ function p5folderset(x) { filetreelocation.push(decodeURIComponent(x)); updateFiles(); return false; }
1498
+ function p5createfolder() { setDialogMode(2, "Nový adresář", 3, p5createfolderEx, '<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% />'); focusTextBox('p5renameinput'); p5fileNameCheck(); }
1499
+ function p5createfolderEx() { meshserver.send({ action: 'fileoperation', fileop: 'createfolder', path: filetreelocation, newfolder: Q('p5renameinput').value }); }
1500
+ function p5deletefile() { var cc = getFileSelCount(), rec = (getFileSelDirCount() > 0) ? '<br /><br /><label><input type=checkbox id=p5recdeleteinput>' + "Recursive delete" + '</label><br>' : '<input type=checkbox id=p5recdeleteinput style=\'display:none\'>'; setDialogMode(2, "Smazat", 3, p5deletefileEx, (cc > 1) ? (format("Smazat {0} vybrané prvky?", cc) + rec) : ("Smazat vybraný prvek?" + rec)); }
1501
+ function p5deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(checkboxes[i].value); } } meshserver.send({ action: 'fileoperation', fileop: 'delete', path: filetreelocation, delfiles: delfiles, rec: Q('p5recdeleteinput').checked }); }
1502
+ function p5renamefile() { var renamefile, checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { renamefile = checkboxes[i].value; } } setDialogMode(2, "Přejmenovat", 3, p5renamefileEx, '<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck(event) style=width:100% value="' + renamefile + '" />', { action: 'fileoperation', fileop: 'rename', path: filetreelocation, oldname: renamefile }); focusTextBox('p5renameinput'); p5fileNameCheck(); }
1503
+ function p5renamefileEx(b, t) { t.newname = Q('p5renameinput').value; meshserver.send(t); }
1504
+ function p5fileNameCheck(e) { var x = isFilenameValid(Q('p5renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e && e.keyCode == 13)) { dialogclose(1); } }
1505
+ var isFilenameValid = (function () { var x1 = /^[^\\/:\*\?"<>\|]+$/, x2 = /^\./, x3 = /^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname) { return x1.test(fname) && !x2.test(fname) && !x3.test(fname) && (fname[0] != '.'); } })();
1506
+ function p5uploadFile() { setDialogMode(2, "Nahrát soubor", 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=hidden name=authCookie value=' + authCookie + ' /><input type=submit id=p5loginSubmit style=display:none /></form>'); updateUploadDialogOk('p5uploadinput'); }
1507
+ function p5uploadFileEx() { Q('p5loginSubmit').click(); }
1508
+ function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); }
1509
+
1510
+ var p5clipboard = null, p5clipboardFolder = null, p5clipboardCut = 0;
1511
+ function p5copyFile(cut) { var checkboxes = document.getElementsByName('fc'); p5clipboard = []; p5clipboardCut = cut, p5clipboardFolder = Clone(filetreelocation); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == '3')) { p5clipboard.push(checkboxes[i].value); } } p5updateClipview(); }
1512
+ function p5pasteFile() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Confim {0} of {1} entrie{2} to this location?", (p5clipboardCut == 0 ? 'copy' : 'move'), p5clipboard.length, ((p5clipboard.length > 1) ? 's' : '')) } setDialogMode(2, "Vložit", 3, p5pasteFileEx, x); }
1513
+ 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(); } }
1514
+ function p5updateClipview() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Holding {0} entrie{1} for {2}", p5clipboard.length, ((p5clipboard.length > 1) ? 's' : ''), (p5clipboardCut == 0 ? "copy" : "move")) + ', <a href=# onclick="return p5clearClip()" style=cursor:pointer>' + "Clear" + '</a>.' } QH('p5bottomstatus', x); p5setActions(); }
1515
+ function p5clearClip() { p5clipboard = null; p5clipboardFolder = null; p5clipboardCut = 0; p5updateClipview(); return false; }
1516
+
1517
+ function p5fileDragDrop(e) {
1518
+ haltEvent(e);
1519
+ QV('bigfail', false);
1520
+ QV('bigok', false);
1521
+ //QV('p5fileCatchAllInput', false);
1522
+ if (e.dataTransfer == null || e.dataTransfer.files.length == 0 || filetreelocation.length == 0) return;
1523
+ var names = [], sizes = [], types = [], datas = [], readercount = e.dataTransfer.files.length;
1524
+ for (var i = 0; i < e.dataTransfer.files.length; i++) {
1525
+ var reader = new FileReader(), file = e.dataTransfer.files[i];
1526
+ names.push(file.name);
1527
+ sizes.push(file.size);
1528
+ types.push(file.type);
1529
+ reader.onload = function (event) {
1530
+ datas.push(event.target.result);
1531
+ if (--readercount == 0) {
1532
+ Q('p5fileDragName').value = names.join('*');
1533
+ Q('p5fileDragSize').value = sizes.join('*');
1534
+ Q('p5fileDragType').value = types.join('*');
1535
+ Q('p5fileDragData').value = datas.join('*');
1536
+ Q('p5fileDragLink').value = encodeURIComponent(filetreelinkpath);
1537
+ Q('p5loginSubmit2').click();
1538
+ }
1539
+ }
1540
+ reader.readAsDataURL(file);
1541
+ }
1542
+ }
1543
+
1544
+ var p5dragtimer = null;
1545
+ function p5fileDragOver(e) {
1546
+ haltEvent(e);
1547
+ if (p5dragtimer != null) { clearTimeout(p5dragtimer); p5dragtimer = null; }
1548
+ var ac = true; // TODO: Set to true if we can accept the file
1549
+ if (filetreelocation.length == 0) { ac = false; }
1550
+ QV('bigok', ac);
1551
+ QV('bigfail', !ac);
1552
+ //QV('p5fileCatchAllInput', ac);
1553
+ }
1554
+
1555
+ function p5fileDragLeave(e) {
1556
+ haltEvent(e);
1557
+ if (e.target.id != 'p5filetable') {
1558
+ QV('bigfail', false);
1559
+ QV('bigok', false);
1560
+ //QV('p5fileCatchAllInput', false);
1561
+ } else {
1562
+ p5dragtimer = setTimeout('QV(\'bigfail\',false);QV(\'bigok\',false);p5dragtimer=null;', 200);
1563
+ }
1564
+ }
1565
+
1566
+ //
1567
+ // MY DEVICES
1568
+ //
1569
+
1570
+ function ondeskkeypress(e) {
1571
+ toggleSoftKeys(0);
1572
+ Q('DeskSoftInput').value = '';
1573
+ setSessionActivity();
1574
+ if (desktop && !xxdialogMode && xxcurrentView == 10) {
1575
+ // Check what keys we are allows to send
1576
+ if (currentNode != null) {
1577
+ var mesh = meshes[currentNode.meshid];
1578
+ var meshrights = mesh.links[userinfo._id].rights;
1579
+ var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
1580
+ if (inputAllowed == false) return false;
1581
+ var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
1582
+ if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
1583
+ }
1584
+ return desktop.m.handleKeys(e);
1585
+ }
1586
+ }
1587
+
1588
+ function ondeskkeydown(e) {
1589
+ toggleSoftKeys(0);
1590
+ Q('DeskSoftInput').value = '';
1591
+ setSessionActivity();
1592
+ if (desktop && !xxdialogMode && xxcurrentView == 10) {
1593
+ // Check what keys we are allows to send
1594
+ if (currentNode != null) {
1595
+ var mesh = meshes[currentNode.meshid];
1596
+ var meshrights = mesh.links[userinfo._id].rights;
1597
+ var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
1598
+ if (inputAllowed == false) return false;
1599
+ var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
1600
+ if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
1601
+ }
1602
+ return desktop.m.handleKeyDown(e);
1603
+ }
1604
+ }
1605
+
1606
+ function ondeskkeyup(e) {
1607
+ toggleSoftKeys(0);
1608
+ Q('DeskSoftInput').value = '';
1609
+ setSessionActivity();
1610
+ if (desktop && !xxdialogMode && xxcurrentView == 10) {
1611
+ // Check what keys we are allows to send
1612
+ if (currentNode != null) {
1613
+ var mesh = meshes[currentNode.meshid];
1614
+ var meshrights = mesh.links[userinfo._id].rights;
1615
+ var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
1616
+ if (inputAllowed == false) return false;
1617
+ var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
1618
+ if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
1619
+ }
1620
+ return desktop.m.handleKeyUp(e);
1621
+ }
1622
+ }
1623
+
1624
+ // Since the update device call can be quite frequent, we can moderate it and only call it at most 5 times a second.
1625
+ var updateDevicesTimer = null;
1626
+ function updateDevices() { if (updateDevicesTimer != null) return; updateDevicesTimer = setTimeout(updateDevicesEx, 200); }
1627
+
1628
+ var sort = 0;
1629
+ var deviceHeaderId = 0;
1630
+ var deviceHeaderCount;
1631
+ var deviceHeaders = {};
1632
+ var showRealNames = false;
1633
+ var deviceHeaderTotal = 0;
1634
+ var deviceHeaders = {};
1635
+ var deviceHeadersTitles = {};
1636
+ function updateDevicesEx() {
1637
+ if (updateDevicesTimer != null) { clearTimeout(updateDevicesTimer); updateDevicesTimer = null; }
1638
+ var r = '', c = 0, current = null, count = 0, displayedMeshes = {}, groups = {}, groupCount = {};
1639
+
1640
+ // 3 wide, list view or desktop view
1641
+ deviceHeaderId = 0;
1642
+ deviceHeaderCount = {};
1643
+ deviceHeaderTotal = 0;
1644
+ deviceHeaders = {};
1645
+ deviceHeadersTitles = {};
1646
+ var current;
1647
+
1648
+ // Perform node sort
1649
+ if (sort == 0) { nodes.sort(meshSort); }
1650
+ else if (sort == 1) { nodes.sort(powerSort); }
1651
+ else if (sort == 2) { if (showRealNames == true) { nodes.sort(deviceHostSort); } else { nodes.sort(deviceSort); } }
1652
+
1653
+ // Go thru the list of nodes and display them
1654
+ for (var i in nodes) {
1655
+ if (nodes[i].v == false) continue;
1656
+ var mesh2 = meshes[nodes[i].meshid], meshlinks = mesh2.links[userinfo._id];
1657
+ if (meshlinks == null) continue;
1658
+ var meshrights = meshlinks.rights;
1659
+
1660
+ if (sort == 0) {
1661
+ // Mesh header
1662
+ nodes.sort(meshSort);
1663
+ if (nodes[i].meshid != current) {
1664
+ deviceHeaderSet();
1665
+ var extra = '';
1666
+ if (meshes[nodes[i].meshid].mtype == 1) { extra = '<span style=color:lightgray>' + ", Intel® AMT only" + '</span>'; }
1667
+ if (current != null) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } }
1668
+ r += '<div class=DevSt style=padding-top:4px><span style=float:right>';
1669
+ //r += getMeshActions(mesh2, meshrights);
1670
+ r += '</span><span id=MxMESH style=cursor:pointer onclick=goForward("' + nodes[i].meshid + '")>' + EscapeHtml(meshes[nodes[i].meshid].name) + '</span>' + extra + '<span id=DevxHeader' + deviceHeaderId + ' style=color:lightgray></span></div>';
1671
+ current = nodes[i].meshid;
1672
+ displayedMeshes[current] = 1;
1673
+ c = 0;
1674
+ }
1675
+ } else if (sort == 1) {
1676
+ // Power header
1677
+ if (nodes[i].pwr !== current) {
1678
+ deviceHeaderSet();
1679
+ if (current !== null) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } }
1680
+ r += '<div class=DevSt style=width:100%;padding-top:4px><span>' + PowerStateStr2(nodes[i].pwr) + '</span><span id=DevxHeader' + deviceHeaderId + ' style=color:lightgray></span></div>';
1681
+ current = nodes[i].pwr;
1682
+ c = 0;
1683
+ }
1684
+ } else if (sort == 2) {
1685
+ // Device header
1686
+ if (current == null) { current = '1'; }
1687
+ }
1688
+
1689
+ count++;
1690
+ var title = EscapeHtml(nodes[i].name);
1691
+ if (title.length == 0) { title = '<i>' + "Nic" + '</i>'; }
1692
+ if ((nodes[i].rname != null) && (nodes[i].rname.length > 0)) { title += " / " + EscapeHtml(nodes[i].rname); }
1693
+ var name = EscapeHtml(nodes[i].name);
1694
+ if (showRealNames == true && nodes[i].rname != null) name = EscapeHtml(nodes[i].rname);
1695
+ if (name.length == 0) { name = '<i>' + "Nic" + '</i>'; }
1696
+
1697
+ // Node
1698
+ var icon = nodes[i].icon, nodestate = NodeStateStr(nodes[i]);
1699
+ if ((!nodes[i].conn) || (nodes[i].conn == 0)) { icon += ' gray'; }
1700
+ r += '<div style=cursor:pointer onclick=goForward(\'' + nodes[i]._id + '\')>';
1701
+ r += '<div class="i' + icon + '" style="float:left;margin-left:4px"></div>';
1702
+ r += '<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">';
1703
+ r += '<div><div style=padding-left:12px;padding-top:2px><b>' + name + '</b></div><div style=padding-left:12px;padding-top:3px;color:gray>' + nodestate + '</div></div>';
1704
+ r += '</div></div>';
1705
+
1706
+ // If we are displaying devices by group, put the device in the right group.
1707
+ /*
1708
+ if ((sort == 3) && (r != '')) {
1709
+ if (nodes[i].tags) {
1710
+ for (var j in nodes[i].tags) {
1711
+ var tag = nodes[i].tags[j];
1712
+ if (groups[tag] == null) { groups[tag] = r; groupCount[tag] = 1; } else { groups[tag] += r; groupCount[tag] += 1; }
1713
+ if (view == 3) break;
1714
+ }
1715
+ }
1716
+ r = '';
1717
+ }
1718
+ */
1719
+
1720
+ deviceHeaderTotal++;
1721
+ if (typeof deviceHeaderCount[nodes[i].state] == 'undefined') { deviceHeaderCount[nodes[i].state] = 1; } else { deviceHeaderCount[nodes[i].state]++; }
1722
+ }
1723
+
1724
+ // Display all empty meshes, we need to do this because users can add devices to these at any time.
1725
+ if (sort == 0) {
1726
+ for (var i in meshes) {
1727
+ var mesh = meshes[i], meshlink = mesh.links[userinfo._id];
1728
+ if (meshlink != null) {
1729
+ var meshrights = meshlink.rights;
1730
+ if (displayedMeshes[mesh._id] == null) {
1731
+ if ((current != '') && (r != '')) { r += '</tr></table>'; }
1732
+ r += '<div><div colspan=3 class=DevSt><span style=float:right>';
1733
+ //r += getMeshActions(mesh, meshrights);
1734
+ r += '</span><span id=MxMESH style=cursor:pointer onclick=goForward("' + mesh._id + '")>' + EscapeHtml(mesh.name) + '</span></div>';
1735
+ if (mesh.mtype == 1) { r += '<div style=padding:10px><i>' + "No Intel® AMT devices in this group"; }
1736
+ if (mesh.mtype == 2) { r += '<div style=padding:10px><i>' + "Žádné zařízení v této skupině"; }
1737
+ r += '.</i></div></div>';
1738
+ current = mesh._id;
1739
+ count++;
1740
+ }
1741
+ }
1742
+ }
1743
+ }
1744
+
1745
+ if (count == 0) {
1746
+ QH('xdevices', '<div style="margin-top:50px;text-align:center"><span style="font-size:30px">' + "Žádné zařízení" + '</span><br /><br />' + "Use the desktop version of this website to add devices." + '</div>');
1747
+ } else {
1748
+ QH('xdevices', r);
1749
+ }
1750
+ deviceHeaderSet();
1751
+ for (var i in deviceHeaders) { QH(i, deviceHeaders[i]); }
1752
+ for (var i in deviceHeadersTitles) { Q(i).title = deviceHeadersTitles[i]; }
1753
+ }
1754
+
1755
+ var powerStatetable = ['', "Zapnuto", "Spánek", "Spánek", "Spánek", "Hibernating", "Vypnout", "Present"];
1756
+ var powerStateStrings = ['', "Zapnuto", "Sleeping", "Sleeping", "Deep Sleep", "Hibernating", "Soft-Off", "Present"];
1757
+ var powerStateStrings2 = ['', "Zařízení je zapnuto", "Zařízení je ve stavu spánku (S1)", "Device is in sleep state (S2)", "Zařízení je v hlubokém spánku (S3)", "Device is hibernating (S4)", "Device is in soft-off state (S5)", "Device is present, but power state cannot be determined"];
1758
+ var powerColorTable = ['#00000000', 'black', 'blue', 'blue', 'lightblue', 'blueviolet', 'darkgreen', 'lightseagreen', 'lightseagreen'];
1759
+ function NodeStateStr(node) {
1760
+ var states = [];
1761
+ if (node.state > 0 && node.state < powerStatetable.length) state.push(powerStatetable[node.state]);
1762
+ if (node.conn) {
1763
+ if ((node.conn & 1) != 0) { states.push('<span>' + "Agent" + '</span>'); }
1764
+ if ((node.conn & 2) != 0) { states.push('<span>' + "CIRA" + '</span>'); }
1765
+ else if ((node.conn & 4) != 0) { states.push('<span>' + "Intel® AMT" + '</span>'); }
1766
+ if ((node.conn & 8) != 0) { states.push('<span>' + "Relay" + '</span>'); }
1767
+ if ((node.conn & 16) != 0) { states.push('<span>' + "MQTT" + '</span>'); }
1768
+ }
1769
+ if ((node.pwr != null) && (node.pwr != 0)) { states.push(powerStateStrings[node.pwr]); }
1770
+ return states.join(', ');
1771
+ }
1772
+
1773
+ function PowerStateStr(x) {
1774
+ if (x < powerStatetable.length) return powerStatetable[x];
1775
+ return '';
1776
+ }
1777
+
1778
+ function PowerStateStr2(x) {
1779
+ if ((x != 0) && (x < powerStatetable.length)) return powerStatetable[x];
1780
+ return "Unknown";
1781
+ }
1782
+
1783
+ function onSortSelectChange(skipsave) {
1784
+ sort = document.getElementById('sortselect').selectedIndex;
1785
+ if (!skipsave) { putstore('sort', sort); }
1786
+ updateDevicesEx();
1787
+ }
1788
+
1789
+ function deviceHeaderSet() {
1790
+ if (deviceHeaderId == 0) { deviceHeaderId = 1; return; }
1791
+ deviceHeaders['DevxHeader' + deviceHeaderId] = ', ' + deviceHeaderTotal + ((deviceHeaderTotal == 1) ? " zařízení" : " nodes");
1792
+ var title = '';
1793
+ for (var x in deviceHeaderCount) { if (title.length > 0) title += ', '; title += deviceHeaderCount[x] + ' ' + PowerStateStr2(x); }
1794
+ deviceHeadersTitles['DevxHeader' + deviceHeaderId] = title;
1795
+ deviceHeaderId++;
1796
+ deviceHeaderCount = {};
1797
+ deviceHeaderTotal = 0;
1798
+ }
1799
+
1800
+ 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; }
1801
+ function powerSort(a, b) { var ap = a.pwr ? a.pwr : 0; var bp = b.pwr ? b.pwr : 0; 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; } } if (ap > bp) return 1; if (ap < bp) return -1; return 0; }
1802
+ function deviceSort(a, b) { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; }
1803
+ function deviceHostSort(a, b) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; }
1804
+
1805
+ //
1806
+ // MY DEVICE
1807
+ //
1808
+
1809
+ function refreshDevice(nodeid) {
1810
+ if (!currentNode || currentNode._id != nodeid) return;
1811
+ gotoDevice(nodeid, xxcurrentView, true);
1812
+ }
1813
+
1814
+ function getNodeRights(nodeid) {
1815
+ var node = getNodeFromId(nodeid), mesh = meshes[node.meshid];
1816
+ return mesh.links[userinfo._id].rights;
1817
+ }
1818
+
1819
+ var currentDevicePanel = 0;
1820
+ var currentNode;
1821
+ var powerTimelineNode = null;
1822
+ var powerTimelineReq = null;
1823
+ var powerTimelineUpdate = null;
1824
+ var powerTimeline = null;
1825
+ function getCurrentNode() { return currentNode; };
1826
+ function gotoDevice(nodeid, panel, refresh) {
1827
+
1828
+ // Remind the user to verify the email address
1829
+ if ((userinfo.emailVerified !== true) && (serverinfo.emailcheck == true) && (userinfo.siteadmin != 0xFFFFFFFF)) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until a email address is verified. This is required for password recovery. Go to the \"My Account\" to change and verify an email address."); return; }
1830
+
1831
+ // Remind the user to add two factor authentication
1832
+ if ((features & 0x00040000) && !((userinfo.otpsecret == 1) || (userinfo.otphkeys > 0) || (userinfo.otpkeys > 0))) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the \"My Account\" and look at the \"Account Security\" section."); return; }
1833
+
1834
+ var node = getNodeFromId(nodeid);
1835
+ if (node == null) { goBack(); return; }
1836
+ var mesh = meshes[node.meshid];
1837
+ if (mesh == null) { goBack(); return; }
1838
+ var meshrights = mesh.links[userinfo._id].rights;
1839
+ if (!currentNode || currentNode._id != node._id || refresh == true) {
1840
+ currentNode = node;
1841
+
1842
+ // Add node name
1843
+ var nname = EscapeHtml(node.name);
1844
+ if (nname.length == 0) { nname = '<i>' + "Nic" + '</i>'; }
1845
+ if ((meshrights & 4) != 0) { nname = '<span onclick=showEditNodeValueDialog(0) style=cursor:pointer>' + nname + '</span>'; }
1846
+ QH('p10deviceName', nname);
1847
+
1848
+ // Node attributes
1849
+ var x = '<table style=width:100%>';
1850
+
1851
+ // Attribute: Mesh
1852
+ x += addDeviceAttribute('<span>' + "Skupina" + '</span>', '<a onclick=goForward("' + node.meshid + '") style=cursor:pointer>' + EscapeHtml(meshes[node.meshid].name) + '</a>');
1853
+
1854
+ // Attribute: Name
1855
+ if (node.rname != null) { x += addDeviceAttribute('<span>' + "Jméno" + '</span>', '<span>' + EscapeHtml(node.rname) + '</span>'); }
1856
+
1857
+ // Attribute: Host
1858
+ if ((mesh.mtype == 1) || (node.name != node.host)) {
1859
+ if ((meshrights & 4) != 0) {
1860
+ if (node.host) {
1861
+ x += addDeviceAttribute("Hostname", '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>' + EscapeHtml(node.host) + '</span>');
1862
+ } else {
1863
+ x += addDeviceAttribute("Hostname", '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>' + "Nic" + '</i></span>');
1864
+ }
1865
+ } else {
1866
+ x += addDeviceAttribute("Hostname", EscapeHtml(node.host));
1867
+ }
1868
+ }
1869
+
1870
+ // Attribute: Description
1871
+ var description = node.desc ? EscapeHtml(node.desc) : '<i>' + "Nic" + '</i>';
1872
+ if ((meshrights & 4) != 0) {
1873
+ x += addDeviceAttribute("Popis", '<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>' + description + '</span>');
1874
+ } else {
1875
+ x += addDeviceAttribute("Popis", description);
1876
+ }
1877
+
1878
+ // Attribute: Mesh Agent
1879
+ 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", "MacOS 32bit", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32bit", "MacOS 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", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "Unknown", "Unknown", "FreeBSD x86-64"];
1880
+ if ((node.agent != null) && (node.agent.id != null) && (node.agent.ver != null)) {
1881
+ var str = '';
1882
+ if (node.agent.id <= agentsStr.length) { str = agentsStr[node.agent.id]; } else { str = agentsStr[0]; }
1883
+ if (node.agent.ver != 0) { str += ' v' + node.agent.ver; }
1884
+ x += addDeviceAttribute("Agent", str);
1885
+ }
1886
+
1887
+ // Attribute: Intel AMT
1888
+ if (node.intelamt != null) {
1889
+ var str = '';
1890
+ var provisioningStates = { 0: nobreak("Not Activated (Pre)"), 1: nobreak("Not Activated (In)"), 2: nobreak("Activated") };
1891
+ if (node.intelamt.ver != null && node.intelamt.state == null) { str += '<i>' + nobreak("Unknown State") + '</i>, v' + node.intelamt.ver; } else
1892
+
1893
+ if ((node.intelamt.ver == null) && (node.intelamt.state == 2)) { str += '<i>' + "Activated" + '</i>'; }
1894
+ else if ((node.intelamt.ver == null) || (node.intelamt.state == null)) { str += '<i>' + "Unknown Version & State" + '</i>'; }
1895
+ else {
1896
+ str += provisioningStates[node.intelamt.state];
1897
+ if (node.intelamt.flags) { if (node.intelamt.flags & 2) { str = ' <span>' + "CCM" + '</span>'; } else if (node.intelamt.flags & 4) { str = ' <span>' + "ACM" + '</span>'; } }
1898
+ str += (', v' + node.intelamt.ver);
1899
+ }
1900
+
1901
+ if (node.intelamt.tls == 1) { str += ', <span>' + "TLS" + '</span>'; }
1902
+ if (node.intelamt.state == 2) {
1903
+ if (node.intelamt.user == null || node.intelamt.user == '') {
1904
+ if ((meshrights & 4) != 0) {
1905
+ str += ', <i style=color:#FF0000;cursor:pointer onclick=editDeviceAmtSettings("' + node._id + '")>' + nobreak("Žádné přihlašovací údaje") + '</i>';
1906
+ } else {
1907
+ str += ', <i style=color:#FF0000>' + "Žádné přihlašovací údaje" + '</i>';
1908
+ }
1909
+ }
1910
+ str += ' ';
1911
+ if ((meshrights & 4) != 0) {
1912
+ str += '<img src=images/link4.png height=10 width=10 style=cursor:pointer onclick=editDeviceAmtSettings("' + node._id + '")>';
1913
+ }
1914
+ }
1915
+
1916
+ var meName = "Intel® ME";
1917
+ if (typeof node.intelamt.sku == 'number') {
1918
+ if ((node.intelamt.sku & 8) != 0) { meName = "Intel® AMT"; }
1919
+ else if ((node.intelamt.sku & 16) != 0) { meName = "Intel® SM"; }
1920
+ }
1921
+ x += addDeviceAttribute(meName, str);
1922
+ }
1923
+
1924
+ // Attribute: Mesh Agent Tag
1925
+ if ((node.agent != null) && (node.agent.tag != null) && (node.agent.tag != 'mailto:')) {
1926
+ var tag = EscapeHtml(node.agent.tag);
1927
+ if (tag.startsWith('mailto:')) { tag = '<a href="' + tag + '">' + tag.substring(7) + '</a>'; }
1928
+ x += addDeviceAttribute("Agent Tag", tag);
1929
+ }
1930
+
1931
+ // Attribute: Intel AMT
1932
+ //if (node.intelamt && node.intelamt.user) { x += addDeviceAttribute('Intel® AMT', node.intelamt.user); }
1933
+
1934
+ // Attribute: Connectivity (Only show this if more than just the agent is connected).
1935
+ var connectivity = node.conn;
1936
+ if (connectivity && connectivity > 1) {
1937
+ var cstate = [];
1938
+ if ((node.conn & 1) != 0) cstate.push('<span>' + "Agent" + '</span>');
1939
+ if ((node.conn & 2) != 0) cstate.push('<span>' + "Intel® AMT CIRA" + '</span>');
1940
+ else if ((node.conn & 4) != 0) cstate.push('<span>' + "Intel® AMT" + '</span>');
1941
+ if ((node.conn & 8) != 0) cstate.push('<span>' + "Agent Relay" + '</span>');
1942
+ if ((node.conn & 16) != 0) cstate.push('<span>' + "MQTT" + '</span>');
1943
+ x += addDeviceAttribute("Connectivity", cstate.join(', '));
1944
+ }
1945
+
1946
+ // Node tags
1947
+ var groupingTags = '<i>' + "Nic" + '</i>';
1948
+ 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>'; } }
1949
+ if ((meshrights & 4) != 0) {
1950
+ x += addDeviceAttribute("Tagy", '<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>' + groupingTags + '</span>');
1951
+ } else {
1952
+ x += addDeviceAttribute("Tagy", groupingTags);
1953
+ }
1954
+
1955
+ x += '</table><br />';
1956
+ // Show action button, only show if we have permissions 4, 8, 64
1957
+ if ((meshrights & 76) != 0) { x += '<input type=button value=Actions onclick=deviceActionFunction() />'; }
1958
+ //x += '<input type=button value=Notes onclick=showNotes(' + ((meshrights & 128) == 0) + ',"' + encodeURIComponent(node._id) + '") />';
1959
+ //if ((connectivity & 1) && (meshrights & 8) && (node.agent.id < 5)) { x += '<input type=button value=Toast onclick=deviceToastFunction() />'; }
1960
+ QH('p10html', x);
1961
+
1962
+ // Show node last 7 days timeline
1963
+ //drawDeviceTimeline();
1964
+ setupFiles();
1965
+
1966
+ // Show bottom buttons
1967
+ x = '<div style=float:right;font-size:x-small;margin-right:10px>';
1968
+ if ((meshrights & 4) != 0) x += '<a style=cursor:pointer onclick=p10showDeleteNodeDialog("' + node._id + '")>' + "Smazat zařízení" + '</a>';
1969
+ x += '</div><div style=font-size:x-small>';
1970
+ //if (mesh.mtype == 2) x += '<a style=cursor:pointer onclick=p10showNodeNetInfoDialog("' + node._id + '")>Interfaces</a> ';
1971
+ //if (xxmap != null) x += '<a style=cursor:pointer onclick=p10showNodeLocationDialog("' + node._id + '")>Location</a> ';
1972
+ x += '</div><br>'
1973
+
1974
+ QH('p10html3', x);
1975
+
1976
+ // Set the node power state
1977
+ var powerstate = PowerStateStr(node.state);
1978
+ //if (node.state == 0) { powerstate = 'Unknown State'; }
1979
+ if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += ', '; } powerstate += '<span style=font-size:10px>' + "Mesh Agent" + '</span>'; }
1980
+ if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += ', '; } powerstate += '<span style=font-size:10px>' + "Intel® AMT connected" + '</span>'; }
1981
+ else if ((connectivity & 4) != 0) { if (powerstate.length > 0) { powerstate += ', '; } powerstate += '<span style=font-size:10px>' + "Intel® AMT detected" + '</span>'; }
1982
+ if ((connectivity & 16) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px>' + "MQTT channel connected" + '</span>'; }
1983
+ QH('MainComputerState', powerstate);
1984
+
1985
+ // Set the node icon
1986
+ QH('MainComputerImage', '<div class="i' + node.icon + '"></div>');
1987
+
1988
+ // Request the power timeline
1989
+ if ((powerTimelineNode != currentNode._id) && (powerTimelineReq != currentNode._id)) { QH('p10html2', ''); powerTimelineReq = currentNode._id; meshserver.send({ action: 'powertimeline', nodeid: currentNode._id }); }
1990
+ }
1991
+ setupDesktop(); // Always refresh the desktop, even if we are on the same device, we need to do some canvas switching.
1992
+ if (!panel) panel = 10;
1993
+ go(panel);
1994
+
1995
+ // Update the footer menu
1996
+ setupDeviceMenu();
1997
+ }
1998
+
1999
+ function deviceToastFunction() {
2000
+ if (xxdialogMode) return;
2001
+ setDialogMode(2, "Device Toast", 3, deviceToastFunctionEx, '<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>');
2002
+ }
2003
+
2004
+ function deviceToastFunctionEx() {
2005
+ meshserver.send({ action: 'toast', nodeids: [currentNode._id], title: 'MeshCentral', msg: Q('d2devToast').value });
2006
+ }
2007
+
2008
+ function setupDeviceMenu(op, obj) {
2009
+ var meshrights = 0;
2010
+ if (currentNode) { meshrights = meshes[currentNode.meshid].links[userinfo._id].rights; }
2011
+ if (op != null) { currentDevicePanel = op; }
2012
+ QV('p10general', currentDevicePanel == 0);
2013
+ QV('p10desktop', currentDevicePanel == 1); // Show if we have remote control rights or desktop view only rights
2014
+ QV('p10files', currentDevicePanel == 2);
2015
+ var menus = [];
2016
+ if (currentDevicePanel != 0) { menus.push({ n: 'General', f: 'setupDeviceMenu(0)' }); }
2017
+ if ((currentDevicePanel != 1) &&
2018
+ (currentNode != null) &&
2019
+ ((meshrights & 8) || (meshrights & 256)) &&
2020
+ (((meshes[currentNode.meshid].mtype == 1) && ((typeof currentNode.intelamt.sku !== 'number') || ((currentNode.intelamt.sku & 8) != 0))) || (currentNode.agent && (currentNode.agent.caps & 1)))
2021
+ ) { menus.push({ n: 'Desktop', f: 'setupDeviceMenu(1)' }); }
2022
+ if ((currentDevicePanel != 2) && (currentNode != null) && (meshrights & 8) && ((meshrights == 0xFFFFFFFF) || ((meshrights & 1024) == 0)) && ((currentNode.mtype == 2) && (currentNode.agent.caps & 4))) { menus.push({ n: 'Files', f: 'setupDeviceMenu(2)' }); }
2023
+ updateFooterMenu(menus);
2024
+ }
2025
+
2026
+ function deviceActionFunction() {
2027
+ if (xxdialogMode) return;
2028
+ var meshrights = meshes[currentNode.meshid].links[userinfo._id].rights;
2029
+ var x = "Vyber operaci na tomto zařízení." + '<br /><br />';
2030
+ var y = '<select id=d2deviceop style=float:right;width:170px>';
2031
+ if ((meshrights & 64) != 0) { y += '<option value=100>' + "Probudit" + '</option>'; } // Wake-up permission
2032
+ if ((meshrights & 8) != 0) { y += '<option value=4>' + "Spánek" + '</option><option value=3>' + "Reset" + '</option><option value=2>' + "Vypnout" + '</option>'; } // Remote control permission
2033
+ y += '</select>';
2034
+ x += addHtmlValue("Operace", y);
2035
+ setDialogMode(2, "Akce zařízení", 3, deviceActionFunctionEx, x);
2036
+ }
2037
+
2038
+ function deviceActionFunctionEx() {
2039
+ var op = Q('d2deviceop').value;
2040
+ if (op == 100) {
2041
+ // Device wake
2042
+ meshserver.send({ action: 'wakedevices', nodeids: [currentNode._id] });
2043
+ } else {
2044
+ // Power operation
2045
+ meshserver.send({ action: 'poweraction', nodeids: [currentNode._id], actiontype: op });
2046
+ }
2047
+ }
2048
+
2049
+ // Look to see if we need to update the device timeline
2050
+ function updateDeviceTimeline() {
2051
+ if ((meshserver.State != 2) || (powerTimelineNode == null) || (powerTimelineUpdate == null) || (currentNode == null)) return;
2052
+ if ((powerTimelineNode == powerTimelineReq) && (currentNode._id == powerTimelineNode) && (powerTimelineUpdate < Date.now())) { powerTimelineUpdate = null; meshserver.send({ action: 'powertimeline', nodeid: currentNode._id }); }
2053
+ }
2054
+
2055
+ // Draw device power bars. The bars are 766px wide.
2056
+ function drawDeviceTimeline() {
2057
+ var timeline = null, now = Date.now();
2058
+ if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; }
2059
+
2060
+ // Calculate when the timeline starts
2061
+ var d = new Date();
2062
+ d.setHours(0, 0, 0, 0);
2063
+ d = new Date(d.getTime() - (1000 * 60 * 60 * 24 * 6));
2064
+ var timelineStart = d.getTime();
2065
+
2066
+ // De-compact the timeline
2067
+ var timeline2 = [];
2068
+ if (timeline != null && timeline.length > 1) {
2069
+ timeline2.push([0, timeline[1], timeline[0]]); // Start, End, Power
2070
+ var ct = timeline[1];
2071
+ for (var i = 2; i < timeline.length; i += 2) {
2072
+ var power = timeline[i], dt = now;
2073
+ if (timeline.length > (i + 1)) { dt = timeline[i + 1]; }
2074
+ timeline2.push([ct, ct + dt, power]); // Start, End, Power
2075
+ ct = ct + dt;
2076
+ }
2077
+ }
2078
+
2079
+ // Draw the timeline
2080
+ var x = '', count = 1, date = new Date();
2081
+ var totalWidth = Q('masthead').offsetWidth - (90 + 9 + 9 + 14); // Compute the total width of the power bar
2082
+ date.setHours(0, 0, 0, 0);
2083
+ for (var i = 0; i < 7; i++) {
2084
+ var datavalue = '', start = date.getTime(), end = start + (1000 * 60 * 60 * 24);
2085
+ for (var j in timeline2) {
2086
+ var block = timeline2[j];
2087
+ if (isTimeBlockInside(start, end, block[0], block[1]) == true) {
2088
+ var ts = Math.max(start, block[0]);
2089
+ var te = Math.min(Math.min(end, block[1]), now);
2090
+ var width = Math.round(((te - ts) * totalWidth) / 86400000);
2091
+ if (width > 0) { datavalue += '<div style=display:table-cell;width:' + width + 'px;background-color:' + powerColor(block[2]) + ';height:16px></div>'; }
2092
+ }
2093
+ }
2094
+ x += '<tr style=' + (((count % 2) == 0) ? 'background-color:#DDD' : '') + '><td><div> ' + printDate(date) + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
2095
+ ++count;
2096
+ date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
2097
+ }
2098
+ 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>' + x + '</tbody></table>');
2099
+ }
2100
+
2101
+ // Return a color for the given power state
2102
+ function powerColor(x) { if (x < powerColorTable.length) { return powerColorTable[x]; } return 'yellow'; }
2103
+
2104
+ // Return true if the time block is visible within the start/end period
2105
+ function isTimeBlockInside(start, end, blockStart, blockEnd) {
2106
+ if ((blockStart < start) && (blockEnd > end)) return true; // Block is wider than timespan
2107
+ if ((blockStart > start) && (blockStart < end)) return true;
2108
+ if ((blockEnd > start) && (blockEnd < end)) return true;
2109
+ return false;
2110
+ }
2111
+
2112
+ function addDeviceAttribute(name, value) {
2113
+ return '<tr><td style=width:100px;color:gray>' + name + '</td><td style=overflow:hidden>' + value + '</td></tr>';
2114
+ }
2115
+
2116
+ function editDeviceAmtSettings(nodeid, func) {
2117
+ if (xxdialogMode) return;
2118
+ var x = '', node = getNodeFromId(nodeid), buttons = 3, meshrights = getNodeRights(nodeid);
2119
+ if ((meshrights & 4) == 0) return;
2120
+ x += addHtmlValue("Uživatel", '<input id=dp10username style=width:170px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
2121
+ x += addHtmlValue("Heslo", '<input id=dp10password type=password style=width:170px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
2122
+ x += addHtmlValue("Bezpečnost", '<select id=dp10tls style=width:176px><option value=0>' + "Žádné TLS" + '</option><option value=1>' + "TLS vyžadováno" + '</option></select>');
2123
+ if ((node.intelamt.user != null) && (node.intelamt.user != '')) { buttons = 7; }
2124
+ setDialogMode(2, "Edit Intel® AMT credentials", buttons, editDeviceAmtSettingsEx, x, { node: node, func: func });
2125
+ if ((node.intelamt.user != null) && (node.intelamt.user != '')) { Q('dp10username').value = node.intelamt.user; } else { Q('dp10username').value = 'admin'; }
2126
+ Q('dp10tls').value = node.intelamt.tls;
2127
+ validateDeviceAmtSettings();
2128
+ }
2129
+
2130
+ function validateDeviceAmtSettings() {
2131
+ QE('idx_dlgOkButton', passwordcheck(Q('dp10password').value));
2132
+ }
2133
+
2134
+ function editDeviceAmtSettingsEx(button, tag) {
2135
+ if (button == 2) {
2136
+ // Delete button pressed, remove credentials
2137
+ meshserver.send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: '', pass: '' } });
2138
+ } else {
2139
+ // Change Intel AMT credentials
2140
+ var amtuser = Q('dp10username').value;
2141
+ if (amtuser == '') amtuser = 'admin';
2142
+ var amtpass = Q('dp10password').value;
2143
+ if (amtpass == '') amtuser = '';
2144
+ meshserver.send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: amtuser, pass: amtpass, tls: Q('dp10tls').value } });
2145
+ tag.node.intelamt.user = amtuser;
2146
+ tag.node.intelamt.tls = Q('dp10tls').value;
2147
+ if (tag.func) { setTimeout(tag.func, 300); }
2148
+ }
2149
+ }
2150
+
2151
+ function p10showDeleteNodeDialog(nodeid) {
2152
+ if (xxdialogMode) return;
2153
+ setDialogMode(2, "Delete Node", 3, p10showDeleteNodeDialogEx, format("Delete {0}?", EscapeHtml(currentNode.name)) + '<br /><br /><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />' + "Confirm", nodeid);
2154
+ p10validateDeleteNodeDialog();
2155
+ }
2156
+
2157
+ function p10validateDeleteNodeDialog() {
2158
+ QE('idx_dlgOkButton', Q('p10check').checked);
2159
+ }
2160
+
2161
+ function p10showDeleteNodeDialogEx(buttons, nodeid) {
2162
+ meshserver.send({ action: 'removedevices', nodeids: [nodeid] });
2163
+ }
2164
+
2165
+ function p10showiconselector() {
2166
+ if (xxdialogMode) return;
2167
+ var mesh = meshes[currentNode.meshid];
2168
+ var meshrights = mesh.links[userinfo._id].rights;
2169
+ if ((meshrights & 4) == 0) return;
2170
+
2171
+ var x = '<table align=center><td>';
2172
+ x += '<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>';
2173
+ x += '<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>';
2174
+ x += '<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div><br>';
2175
+ x += '<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>';
2176
+ x += '<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>';
2177
+ x += '<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div></table>';
2178
+ setDialogMode(2, "Icon Selection", 0, null, x);
2179
+ QV('id_dialogclose', true);
2180
+ }
2181
+
2182
+ function p10setIcon(icon) {
2183
+ setDialogMode(0);
2184
+ meshserver.send({ action: 'changedevice', nodeid: currentNode._id, icon: icon });
2185
+ }
2186
+
2187
+ var showEditNodeValueDialog_modes = ["Device Name", "Hostname", "Popis", "Tagy"];
2188
+ var showEditNodeValueDialog_modes2 = ['name', 'host', 'desc', 'tags'];
2189
+ var showEditNodeValueDialog_modes3 = ['', '', '', "Skupina1, Skupina2, Skupina3"];
2190
+ function showEditNodeValueDialog(mode) {
2191
+ if (xxdialogMode) return;
2192
+ var x = addHtmlValue(showEditNodeValueDialog_modes[mode], '<input id=dp10devicevalue style=width:170px maxlength=64 placeholder="' + showEditNodeValueDialog_modes3[mode] + '" onchange=p10editdevicevalueValidate(' + mode + ',event) onkeyup=p10editdevicevalueValidate(' + mode + ',event) />');
2193
+ setDialogMode(2, "Edit Device", 3, showEditNodeValueDialogEx, x, mode);
2194
+ var v = currentNode[showEditNodeValueDialog_modes2[mode]];
2195
+ if (v == null) v = '';
2196
+ if (Array.isArray(v)) { v = v.join(', '); }
2197
+ Q('dp10devicevalue').value = v;
2198
+ p10editdevicevalueValidate();
2199
+ Q('dp10devicevalue').focus();
2200
+ }
2201
+
2202
+ function showEditNodeValueDialogEx(button, mode) {
2203
+ var x = { action: 'changedevice', nodeid: currentNode._id };
2204
+ x[showEditNodeValueDialog_modes2[mode]] = Q('dp10devicevalue').value;
2205
+ meshserver.send(x);
2206
+ }
2207
+
2208
+ function p10editdevicevalueValidate(mode, e) {
2209
+ var x = ((mode > 1) || (Q('dp10devicevalue').value.length > 0));
2210
+ QE('idx_dlgOkButton', x);
2211
+ if ((e != null) && (x == true) && (e.keyCode == 13)) { dialogclose(1); }
2212
+ }
2213
+
2214
+ //
2215
+ // DESKTOP
2216
+ //
2217
+
2218
+ var desktop;
2219
+ var desktopNode;
2220
+ var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50 };
2221
+ function setupDesktop() {
2222
+ // Setup the remote desktop
2223
+ if ((desktopNode != currentNode) && (desktop != null)) { desktop.Stop(); desktopNode = null; desktop = null; }
2224
+
2225
+ // If the device desktop is already connected in multi-desktop, use that.
2226
+ if ((desktopNode != currentNode) || (desktop == null)) {
2227
+ // Device is not already connected, just setup a blank canvas
2228
+ 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>');
2229
+ desktopNode = currentNode;
2230
+ // Setup the mouse wheel
2231
+ Q('Desk').addEventListener('DOMMouseScroll', function (e) { return dmousewheel(e); });
2232
+ Q('Desk').addEventListener('mousewheel', function (e) { return dmousewheel(e); });
2233
+ }
2234
+ desktopNode = currentNode;
2235
+ updateDesktopButtons();
2236
+
2237
+ // On some browsers like IE, we can't save screen shots. Hide the scheenshot/capture buttons.
2238
+ if (!Q('Desk')['toBlob']) { QV('deskSaveBtn', false); }
2239
+ }
2240
+
2241
+ // Show and enable the right buttons
2242
+ function updateDesktopButtons() {
2243
+ var mesh = meshes[currentNode.meshid];
2244
+ var deskState = 0;
2245
+ if (desktop != null) { deskState = desktop.State; }
2246
+ var meshrights = mesh.links[userinfo._id].rights;
2247
+
2248
+ // Show the right buttons
2249
+ QV('disconnectbutton1', (deskState != 0));
2250
+ QV('connectbutton1', (deskState == 0) && (mesh.mtype == 2) && ((meshrights & 8) || (meshrights & 256)));
2251
+ QV('connectbutton1h',
2252
+ (deskState == 0) &&
2253
+ (meshrights & 8) &&
2254
+ ((mesh.mtype == 1) ||
2255
+ (currentNode.intelamt != null) &&
2256
+ ((currentNode.intelamt.state == 2) &&
2257
+ (currentNode.intelamt.ver != null) &&
2258
+ (typeof currentNode.intelamt.sku == 'number') &&
2259
+ ((currentNode.intelamt.sku & 8) != 0))
2260
+ )
2261
+ );
2262
+
2263
+ // Show the right settings
2264
+ QV('d7amtkvm', (currentNode.intelamt != null && ((currentNode.intelamt.ver != null) || (mesh.mtype == 1))) && ((deskState == 0) || (desktop.contype == 2)));
2265
+ QV('d7meshkvm', (mesh.mtype == 2) && ((deskState == false) || (desktop.contype == 1)));
2266
+
2267
+ // Enable buttons
2268
+ var online = ((currentNode.conn & 1) != 0); // If Agent (1) connected, enable remote desktop
2269
+ QE('connectbutton1', online);
2270
+ var hwonline = ((currentNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal
2271
+ QE('connectbutton1h', hwonline);
2272
+ //QE('deskSaveBtn', deskState == 3);
2273
+ //QV('DeskCAD', meshrights & 8);
2274
+ //QE('DeskCAD', deskState == 3);
2275
+ //QV('DeskWD', (currentNode.agent) && (currentNode.agent.id < 5));
2276
+ //QE('DeskWD', deskState == 3);
2277
+ //QV('deskkeys', (currentNode.agent) && (currentNode.agent.id < 5));
2278
+ //QE('deskkeys', deskState == 3);
2279
+ //QE('DeskToolsButton', online);
2280
+ QV('DeskToastButton', ((meshrights & 16384) != 0) && (currentNode.agent) && (currentNode.agent.id < 5) && (meshrights & 8));
2281
+ //QE('DeskToastButton', online);
2282
+ QV('deskActionsBtn', meshrights & 8);
2283
+ Q('DeskControl').checked = ((meshrights & 8) != 0);
2284
+ if (online == false) QV('DeskTools', false);
2285
+ }
2286
+
2287
+ function connectDesktop(e, contype) {
2288
+ setSessionActivity();
2289
+ if (desktop == null) {
2290
+ desktopNode = currentNode;
2291
+ if (contype == 2) {
2292
+ // Setup the Intel AMT remote desktop
2293
+ if ((desktopNode.intelamt.user == null) || (desktopNode.intelamt.user == '')) { editDeviceAmtSettings(desktopNode._id, connectDesktop); return; }
2294
+ desktop = CreateAmtRedirect(CreateAmtRemoteDesktop('Desk'), authCookie);
2295
+ desktop.debugmode = debugmode;
2296
+ desktop.onStateChanged = onDesktopStateChange;
2297
+ desktop.m.bpp = (desktopsettings.encoding == 1 || desktopsettings.encoding == 3) ? 1 : 2;
2298
+ desktop.m.useZRLE = (desktopsettings.encoding < 3);
2299
+ desktop.m.showmouse = desktopsettings.showmouse;
2300
+ desktop.m.onScreenSizeChange = deskAdjust;
2301
+ desktop.Start(desktopNode._id, 16994, '*', '*', 0);
2302
+ desktop.contype = 2;
2303
+ } else {
2304
+ // Setup the Mesh Agent remote desktop
2305
+ desktop = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
2306
+ desktop.debugmode = debugmode;
2307
+ desktop.m.debugmode = debugmode;
2308
+ desktop.attemptWebRTC = attemptWebRTC;
2309
+ desktop.onStateChanged = onDesktopStateChange;
2310
+ desktop.m.CompressionLevel = desktopsettings.quality; // Number from 1 to 100. 50 or less is best.
2311
+ desktop.m.ScalingLevel = desktopsettings.scaling;
2312
+ desktop.m.FrameRateTimer = desktopsettings.framerate;
2313
+ desktop.m.onDisplayinfo = deskDisplayInfo;
2314
+ desktop.m.onScreenSizeChange = deskAdjust;
2315
+ desktop.Start(desktopNode._id);
2316
+ desktop.contype = 1;
2317
+ }
2318
+ } else {
2319
+ // Disconnect and clean up the remote desktop
2320
+ desktop.Stop();
2321
+ desktopNode = desktop = null;
2322
+ }
2323
+ }
2324
+
2325
+ function onDesktopStateChange(xdesktop, state) {
2326
+ var xstate = state;
2327
+ if ((xstate == 3) && (xdesktop.contype == 2)) { xstate++; }
2328
+ var str = StatusStrs[xstate];
2329
+ if ((desktop != null) && (desktop.webRtcActive == true)) { str += ", WebRTC"; }
2330
+ //if (desktop.m.stopInput == true) { str += ', Loopback'; }
2331
+ QH('deskstatus', str);
2332
+ switch (state) {
2333
+ case 0:
2334
+ // Disconnect and clean up the remote desktop
2335
+ desktop.Stop();
2336
+ desktopNode = desktop = null;
2337
+ QV('termdisplays', false);
2338
+ if (fullscreen == true) { deskToggleFull(); }
2339
+ break;
2340
+ case 2:
2341
+ break;
2342
+ default:
2343
+ //console.log('Unknown onDesktopStateChange state', state);
2344
+ break;
2345
+ }
2346
+ updateDesktopButtons();
2347
+ deskAdjust();
2348
+ setTimeout(deskAdjust, 50);
2349
+ }
2350
+
2351
+ function showDesktopSettings() {
2352
+ if (xxdialogMode) return;
2353
+ applyDesktopSettings();
2354
+ updateDesktopButtons();
2355
+ setDialogMode(7, "Remote Desktop Settings", 3, showDesktopSettingsChanged);
2356
+ }
2357
+
2358
+ function showDesktopSettingsChanged() {
2359
+ desktopsettings.encoding = d7desktopmode.value;
2360
+ desktopsettings.showfocus = d7showfocus.checked;
2361
+ desktopsettings.showmouse = d7showcursor.checked;
2362
+ desktopsettings.quality = d7bitmapquality.value;
2363
+ desktopsettings.scaling = d7bitmapscaling.value;
2364
+ desktopsettings.framerate = d7framelimiter.value;
2365
+ localStorage.setItem('desktopsettings', JSON.stringify(desktopsettings));
2366
+ applyDesktopSettings();
2367
+ if (desktop) {
2368
+ if (desktop.contype == 1) {
2369
+ if (desktop.State != 0) { desktop.m.SendCompressionLevel(1, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate); }
2370
+ }
2371
+ if (desktop.contype == 2) {
2372
+ if (desktop.State != 0) { desktop.Stop(); setTimeout(function () { connectDesktop(null, 2); }, 50); }
2373
+ }
2374
+ }
2375
+ }
2376
+
2377
+ function applyDesktopSettings() {
2378
+ var r = '', ops = (features & 512) ? [90, 70, 50, 40, 30, 20, 10, 5, 1] : [50, 40, 30, 20, 10, 5, 1];
2379
+ for (var i in ops) { r += '<option value=' + ops[i] + '>' + ops[i] + '%</option>'; }
2380
+ QH('d7bitmapquality', r);
2381
+ d7desktopmode.value = desktopsettings.encoding;
2382
+ d7showfocus.checked = desktopsettings.showfocus;
2383
+ d7showcursor.checked = desktopsettings.showmouse;
2384
+ d7bitmapquality.value = 40; // Default value
2385
+ if (ops.indexOf(parseInt(desktopsettings.quality)) >= 0) { d7bitmapquality.value = desktopsettings.quality; }
2386
+ d7bitmapscaling.value = desktopsettings.scaling;
2387
+ if (desktopsettings.framerate) { d7framelimiter.value = desktopsettings.framerate; }
2388
+ }
2389
+
2390
+ var fullscreen = false;
2391
+ /*
2392
+ function deskToggleFull() {
2393
+ fullscreen = !fullscreen;
2394
+ QV('mastheadx', !fullscreen);
2395
+ QV('masthead', !fullscreen);
2396
+ QV('topbar', !fullscreen);
2397
+ QV('p11deviceNameHeader', !fullscreen);
2398
+ QV('footer', !fullscreen);
2399
+ QV('column_l_bottomgap', !fullscreen);
2400
+ QV('idx_deskFullBtn2', fullscreen);
2401
+ QV('deskFullBtn', !fullscreen);
2402
+ if (fullscreen) {
2403
+ QS('container').width = '100%';
2404
+ QS('container')['border-right'] = '0';
2405
+ QS('container')['border-left'] = '0';
2406
+ QS('column_l').padding = '0';
2407
+ QS('column_l').width = '100%';
2408
+ } else {
2409
+ QS('container').width = '960px';
2410
+ QS('container')['border-right'] = '1px solid #b7b7b7';
2411
+ QS('container')['border-left'] = '1px solid #b7b7b7';
2412
+ QS('column_l').padding = '0 15px';
2413
+ QS('column_l').width = '930px';
2414
+ toggleFullScreen();
2415
+ }
2416
+ deskAdjust();
2417
+ }
2418
+ */
2419
+
2420
+ function deskAdjust() {
2421
+ var x = (Q('DeskParent').clientHeight - Q('Desk').clientHeight) / 2;
2422
+ if (x < 0) {
2423
+ var mh = Q('DeskParent').clientHeight, mw = 9999;
2424
+ if (desktop) { mw = (desktop.m.width / desktop.m.height) * mh; }
2425
+ QS('Desk')['max-height'] = mh + 'px';
2426
+ QS('Desk')['max-width'] = mw + 'px';
2427
+ x = 0;
2428
+ } else {
2429
+ QS('Desk')['max-height'] = null;
2430
+ QS('Desk')['max-width'] = null;
2431
+ }
2432
+ QS('Desk')['margin-top'] = x + 'px';
2433
+ QS('Desk')['margin-bottom'] = x + 'px';
2434
+ }
2435
+
2436
+ // Remote desktop special key combos for Windows
2437
+ function deskSendKeys() {
2438
+ if (xxdialogMode || desktop == null || desktop.State != 3) return;
2439
+ var ks = Q('deskkeys').value;
2440
+ if (ks == 0) { // WIN+Down arrow
2441
+ if (desktop.contype == 2) {
2442
+ 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
2443
+ } else {
2444
+ 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
2445
+ }
2446
+ } else if (ks == 1) { // WIN+Up arrow
2447
+ if (desktop.contype == 2) {
2448
+ 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
2449
+ } else {
2450
+ 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
2451
+ }
2452
+ } else if (ks == 2) { // WIN+L arrow
2453
+ if (desktop.contype == 2) {
2454
+ desktop.m.sendkey([[0xffe7, 1], [0x6c, 1], [0x6c, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, 'l' press, 'l' release, Meta-left release
2455
+ } else {
2456
+ desktop.sendCtrlMsg('{"action":"lock"}');
2457
+ //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
2458
+ //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.EXDOWN, 0x5B);
2459
+ //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.DOWN, 76);
2460
+ //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.UP, 76);
2461
+ //desktop.m.SendKeyMsgKC(desktop.m.KeyAction.EXUP, 0x5B);
2462
+ }
2463
+ } else if (ks == 3) { // WIN+M arrow
2464
+ if (desktop.contype == 2) {
2465
+ desktop.m.sendkey([[0xffe7, 1], [0x6d, 1], [0x6d, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, 'm' press, 'm' release, Meta-left release
2466
+ } else {
2467
+ 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
2468
+ }
2469
+ } else if (ks == 4) { // Shift+WIN+M arrow
2470
+ if (desktop.contype == 2) {
2471
+ 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
2472
+ } else {
2473
+ 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
2474
+ }
2475
+ } else if (ks == 5) { // WIN
2476
+ if (desktop.contype == 2) {
2477
+ desktop.m.sendkey([[0xffe7, 1], [0xffe7, 0]]); // Intel AMT: Meta-left down, Meta-left release
2478
+ } else {
2479
+ desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.EXUP, 0x5B]]); // MeshAgent: L-Winkey press, L-Winkey release
2480
+ }
2481
+ } else if (ks == 6) { // WIN+R
2482
+ if (desktop.contype == 2) {
2483
+ desktop.m.sendkey([[0xffe7, 1], [0x72, 1], [0x72, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, 'r' press, 'r' release, Meta-left release
2484
+ } else {
2485
+ 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
2486
+ }
2487
+ } else if (ks == 7) { // ALT-F4
2488
+ if (desktop.contype == 2) {
2489
+ desktop.m.sendkey([[0xffe9, 1], [0xffc1, 1], [0xffc1, 0], [0xffe9, 0]]); // Intel AMT: Alt down, 'F4' press, 'F4' release, Alt release
2490
+ } else {
2491
+ desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 18], [desktop.m.KeyAction.DOWN, 115], [desktop.m.KeyAction.UP, 115], [desktop.m.KeyAction.EXUP, 18]]); // MeshAgent: Alt press, 'F4' press, 'F4' release, Alt release
2492
+ }
2493
+ } else if (ks == 8) { // CTRL-W
2494
+ if (desktop.contype == 2) {
2495
+ desktop.m.sendkey([[0xffe3, 1], [0x77, 1], [0x77, 0], [0xffe3, 0]]); // Intel AMT: Ctrl down, 'w' press, 'w' release, Ctrl release
2496
+ } else {
2497
+ desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 17], [desktop.m.KeyAction.DOWN, 87], [desktop.m.KeyAction.UP, 87], [desktop.m.KeyAction.EXUP, 17]]); // MeshAgent: Ctrl press, 'W' press, 'W' release, Ctrl release
2498
+ }
2499
+ } else if (ks == 9) { // ALT-TAB
2500
+ if (desktop.contype == 2) {
2501
+ desktop.m.sendkey([[0xffe9, 1], [0xff09, 1], [0xff09, 0], [0xffe9, 0]]); // Intel AMT: Alt down, 'TAB' press, 'TAB' release, Alt release
2502
+ } else {
2503
+ desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 18], [desktop.m.KeyAction.DOWN, 9], [desktop.m.KeyAction.UP, 9], [desktop.m.KeyAction.EXUP, 18]]); // MeshAgent: Alt press, 'TAB' press, 'TAB' release, Alt release
2504
+ }
2505
+ } else if (ks == 10) { // CTRL-ALT-DEL
2506
+ desktop.m.sendcad();
2507
+ } else if (ks == 11) { // TAB
2508
+ if (desktop.contype == 2) {
2509
+ desktop.m.sendkey([[0xff09, 1], [0xff09, 0]]); // Intel AMT: 'TAB' press, 'TAB' release
2510
+ } else {
2511
+ desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN, 9], [desktop.m.KeyAction.UP, 9]]); // MeshAgent: 'TAB' press, 'TAB' release
2512
+ }
2513
+ }
2514
+ }
2515
+
2516
+ function sendSpecialKeys() {
2517
+ if (xxdialogMode || desktop == null || desktop.State != 3) return;
2518
+ setDialogMode(3, "Special Keys", 3, deskSendKeys);
2519
+ }
2520
+
2521
+ // Send CTRL-ALT-DEL
2522
+ /*
2523
+ function sendCAD() {
2524
+ if (xxdialogMode || desktop == null || desktop.State != 3) return;
2525
+ desktop.m.sendcad();
2526
+ }
2527
+ */
2528
+
2529
+ // Toggle soft keyboard
2530
+ function toggleSoftKeys(x) {
2531
+ QV('DeskSoftInput', x == 1);
2532
+ if (x == 1) { Q('DeskSoftInput').focus(); }
2533
+ }
2534
+
2535
+ // Show process dialogs
2536
+ function toggleDeskTools() {
2537
+ setSessionActivity();
2538
+ if (xxdialogMode) return;
2539
+ if (QS('DeskTools').display == 'none') {
2540
+ QV('DeskTools', true);
2541
+ Q('DeskTools').nodeid = currentNode._id;
2542
+ refreshDeskTools();
2543
+ } else {
2544
+ QV('DeskTools', false);
2545
+ }
2546
+ }
2547
+
2548
+ // Refresh all of the desktop tool panels
2549
+ function refreshDeskTools() {
2550
+ setSessionActivity();
2551
+ QV('DeskToolsRefreshButton', false);
2552
+ setTimeout(refreshDeskToolsEx, 500);
2553
+ meshserver.send({ action: 'msg', type: 'ps', nodeid: currentNode._id });
2554
+ }
2555
+ function refreshDeskToolsEx() { QV('DeskToolsRefreshButton', true); }
2556
+ var deskTools = { sort: 1, msg: null };
2557
+ function sortProcess(sort) { deskTools.sort = sort; showDeskToolsProcesses(deskTools.msg); }
2558
+ function sortProcessPid(a, b) { if (a.p > b.p) return 1; if (a.p < b.p) return (-1); return 0; }
2559
+ function sortProcessName(a, b) { if (a.d > b.d) return 1; if (a.d < b.d) return (-1); return 0; }
2560
+ function showDeskToolsProcesses(message) {
2561
+ deskTools.msg = message;
2562
+ if (message == null) { QH('DeskToolsProcesses', ''); return; }
2563
+ if (Q('DeskTools').nodeid != message.nodeid) return;
2564
+ var p = [], processes = null;
2565
+ try { processes = JSON.parse(message.value); } catch (e) { }
2566
+ console.log(processes);
2567
+ if (processes != null) {
2568
+ for (var pid in processes) { p.push({ p: parseInt(pid), c: processes[pid].cmd, d: processes[pid].cmd.toLowerCase(), u: processes[pid].user }); }
2569
+ if (deskTools.sort == 0) { p.sort(sortProcessPid); } else if (deskTools.sort == 1) { p.sort(sortProcessName); }
2570
+ var x = '';
2571
+ 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 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>'; } }
2572
+ QH('DeskToolsProcesses', x);
2573
+ }
2574
+ }
2575
+
2576
+ // Save the desktop image to file
2577
+ function deskSaveImage() {
2578
+ setSessionActivity();
2579
+ if (xxdialogMode || desktop == null || desktop.State != 3) return;
2580
+ 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);
2581
+ Q('Desk')['toBlob'](function (blob) { saveAs(blob, n + '.jpg'); });
2582
+ }
2583
+
2584
+ function deskDisplayInfo(sender, info, selDisplay, selItem) {
2585
+ var txt = Q('termdisplays').value;
2586
+ if (info.length > 0) { var options = ''; for (var x in info) { options += '<option' + ((txt == info[x]) ? ' selected' : '') + '>' + info[x] + '</option>'; } QH('termdisplays', options); }
2587
+ QV('termdisplays', info.length > 0);
2588
+ }
2589
+
2590
+ function deskGetDisplayNumbers(e) { desktop.m.GetDisplayNumbers(); }
2591
+
2592
+ function deskSetDisplay(e) {
2593
+ setSessionActivity();
2594
+ var display = 0, txt = Q('termdisplays').value;
2595
+ if (txt == "All Displays") display = 65535; else display = parseInt(txt.substring(8));
2596
+ desktop.m.SetDisplay(display);
2597
+ }
2598
+
2599
+ function dmousedown(e) { setSessionActivity(); if ((!xxdialogMode && desktop != null)) desktop.m.mousedown(e) }
2600
+ function dmouseup(e) { setSessionActivity(); if ((!xxdialogMode && desktop != null)) desktop.m.mouseup(e) }
2601
+ function dmousemove(e) { setSessionActivity(); if ((!xxdialogMode && desktop != null)) desktop.m.mousemove(e) }
2602
+ function dmousewheel(e) { setSessionActivity(); if ((!xxdialogMode && desktop != null) && desktop.m.mousewheel) { desktop.m.mousewheel(e); haltEvent(e); return true; } return false; }
2603
+ function drotate(x) { if (!xxdialogMode && desktop != null) { desktop.m.setRotation(desktop.m.rotation + x); deskAdjust(); deskAdjust(); } }
2604
+ function stopProcess(id, name) { setDialogMode(2, "Process Control", 3, stopProcessEx, format("Stop process #{0} \"{1}\"?", id, name), id); return false; }
2605
+ function stopProcessEx(buttons, tag) { meshserver.send({ action: 'msg', type: 'pskill', nodeid: currentNode._id, value: tag }); setTimeout(refreshDeskTools, 300); }
2606
+
2607
+ //
2608
+ // FILES
2609
+ //
2610
+
2611
+ var filesNode;
2612
+ function setupFiles() {
2613
+ // Setup the files tab
2614
+ var samenode = (filesNode == currentNode);
2615
+ filesNode = currentNode;
2616
+ var online = ((filesNode.conn & 1) != 0) ? true : false; // If Agent (1) connected, enable Terminal
2617
+ QE('p13Connect', online);
2618
+ if (((samenode == false) || (online == false)) && files) { files.Stop(); files = null; }
2619
+ }
2620
+
2621
+ function onFilesStateChange(xfiles, state) {
2622
+ setSessionActivity();
2623
+ p13Connect.value = (state == 0) ? "Připojit" : "Disconnect";
2624
+ var str = StatusStrs[state];
2625
+ if (files.webRtcActive == true) { str += ", WebRTC"; }
2626
+ Q('p13Status').textContent = str;
2627
+ switch (state) {
2628
+ case 0:
2629
+ // Disconnected, clear the files
2630
+ QH('p13files', '');
2631
+ p13filetree = null;
2632
+ p13filetreelocation = [];
2633
+ QH('p13currentpath', '');
2634
+ QE('p13FolderUp', false);
2635
+ p13setActions();
2636
+ if (files != null) { files.Stop(); files = null; }
2637
+ break;
2638
+ case 3:
2639
+ p13targetpath = '';
2640
+ files.sendText({ action: 'ls', reqid: 1, path: '' });
2641
+ break;
2642
+ default:
2643
+ //console.log('Unknown onFilesStateChange state', state);
2644
+ break;
2645
+ }
2646
+ }
2647
+
2648
+ function CreateRemoteFiles(onFileUpdate) {
2649
+ var obj = { protocol: 5 };
2650
+ obj.onFileUpdate = onFileUpdate;
2651
+ obj.xxStateChange = function (state) { }
2652
+ obj.ProcessData = function (data) { obj.onFileUpdate(data); }
2653
+ return obj;
2654
+ }
2655
+
2656
+ // Debug Only
2657
+ var autoConnectFilesTimer = null;
2658
+ function autoConnectFiles(e) { if (autoConnectFilesTimer == null) { autoConnectFilesTimer = setInterval(connectFiles, 100); } else { clearInterval(autoConnectFilesTimer); autoConnectFilesTimer = null; } }
2659
+
2660
+ function connectFiles(e) {
2661
+ if (!files) {
2662
+ // Setup a mesh agent files
2663
+ files = CreateAgentRedirect(meshserver, CreateRemoteFiles(p13gotFiles), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
2664
+ files.attemptWebRTC = attemptWebRTC;
2665
+ files.onStateChanged = onFilesStateChange;
2666
+ files.Start(filesNode._id);
2667
+ } else {
2668
+ //QH('Term', '');
2669
+ files.Stop();
2670
+ files = null;
2671
+ }
2672
+ p13clipboard = p13clipboardFolder = null;
2673
+ p13clipboardCut = 0;
2674
+ p13updateClipview();
2675
+ }
2676
+
2677
+ var p13filetree = null;
2678
+ var p13targetpath = null;
2679
+ var p13filetreelocation = [];
2680
+
2681
+ function p13gotFiles(data) {
2682
+ setSessionActivity();
2683
+ //console.log('p13gotFiles', data);
2684
+ if ((data.length > 0) && (data.charCodeAt(0) != 123)) { p13gotDownloadBinaryData(data); return; }
2685
+ //console.log('p13gotFiles', data);
2686
+ data = JSON.parse(decode_utf8(data));
2687
+ if (data.action == 'download') { p13gotDownloadCommand(data); return; }
2688
+ data.path = data.path.replace(/\//g, "\\");
2689
+ if ((p13filetree != null) && (data.path == p13filetree.path)) {
2690
+ // This is an update to the same folder
2691
+ var checkedNames = p13getCheckedNames();
2692
+ p13filetree = data;
2693
+ p13updateFiles(checkedNames);
2694
+ } else {
2695
+ // Make both paths use the same seperator not start with /
2696
+ var x1 = data.path.replace(/\//g, "\\"), x2 = p13targetpath.replace(/\//g, "\\");
2697
+ while ((x1.length > 0) && (x1[0] == '\\')) { x1 = x1.substring(1); }
2698
+ while ((x2.length > 0) && (x2[0] == '\\')) { x2 = x2.substring(1); }
2699
+ if ((x1 == x2) || ((data.path == '\\') && (p13targetpath == ''))) {
2700
+ // This is a different folder
2701
+ p13filetree = data;
2702
+ p13updateFiles();
2703
+ }
2704
+ }
2705
+ }
2706
+
2707
+ function p13getCheckedNames() {
2708
+ // Save all existing checked boxes
2709
+ var checkedNames = [], checkboxes = document.getElementsByName('fd');
2710
+ for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { checkedNames.push(p13filetree.dir[checkboxes[i].value].n) }; }
2711
+ return checkedNames;
2712
+ }
2713
+
2714
+ function p13updateFiles(checkedNames) {
2715
+ var html1 = '', html2 = '', displayPath = '<a style=cursor:pointer onclick=p13folderup(0)>' + "Root" + '</a>', fullPath = 'Root';
2716
+
2717
+ // Work on parsing the file path
2718
+ var x = p13filetree.path.split('\\');
2719
+ p13filetreelocation = [];
2720
+ for (var i in x) { if (x[i] != '') { p13filetreelocation.push(x[i]); } } // Remove empty spaces
2721
+ for (var i in p13filetreelocation) { displayPath += ' / <a style=cursor:pointer onclick=p13folderup(' + (parseInt(i) + 1) + ')>' + p13filetreelocation[i] + '</a>' } // Setup the path we display
2722
+ var newlinkpath = p13filetreelocation.join('/');
2723
+
2724
+ // Sort the files
2725
+ var filetreexx = p13sort_files(p13filetree.dir);
2726
+
2727
+ // Display all files and folders at this location
2728
+ for (var i in filetreexx) {
2729
+ // Figure out the name and shortname
2730
+ var f = filetreexx[i], name = f.n, shortname;
2731
+ shortname = name;
2732
+ if (name.length > 70) { shortname = EscapeHtml(name.substring(0, 70)) + "..."; } else { shortname = EscapeHtml(name); }
2733
+ name = EscapeHtml(name);
2734
+
2735
+ // Figure out the size
2736
+ var fsize = '';
2737
+ if (f.s != null) { fsize = getFileSizeStr(f.s); }
2738
+
2739
+ var h = '';
2740
+ if (f.t < 3) {
2741
+ var right = '';
2742
+ 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>' + right + '</span><span><div class=fileIcon' + f.t + '></div><a style=cursor:pointer onclick=p13folderset(\"' + encodeURIComponent(f.nx) + '\")>' + shortname + '</a></span></div>';
2743
+ } else {
2744
+ var link = shortname;
2745
+ 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>'; }
2746
+ h = '<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value=\'' + f.nx + '\'> <span style=float:right;padding-right:4px>' + fsize + '</span><span><div class=fileIcon' + f.t + '></div>' + link + '</span></div>';
2747
+ }
2748
+
2749
+ if (f.t < 3) { html1 += h; } else { html2 += h; }
2750
+ }
2751
+
2752
+ // Display the files and path
2753
+ QH('p13files', html1 + html2);
2754
+ QH('p13currentpath', displayPath);
2755
+ QE('p13FolderUp', p13filetreelocation.length != 0);
2756
+
2757
+ // Re-check all boxes if needed using names
2758
+ 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; } } }
2759
+
2760
+ // Update the actions buttons
2761
+ p13setActions();
2762
+ }
2763
+
2764
+ function p13folderset(x) {
2765
+ p13targetpath = joinPaths(p13filetree.path, p13filetree.dir[x].n).split('\\').join('/');
2766
+ files.sendText({ action: 'ls', reqid: 1, path: p13targetpath });
2767
+ }
2768
+
2769
+ function p13folderup(x) {
2770
+ if (x == null) { p13filetreelocation.pop(); } else { while (p13filetreelocation.length > x) { p13filetreelocation.pop(); } }
2771
+ p13targetpath = p13filetreelocation.join('/');
2772
+ files.sendText({ action: 'ls', reqid: 1, path: p13targetpath });
2773
+ }
2774
+
2775
+ var p13sortorder;
2776
+ function p13sort_filename(a, b) { if (a.ln > b.ln) return (1 * p13sortorder); if (a.ln < b.ln) return (-1 * p13sortorder); return 0; }
2777
+ function p13sort_timestamp(a, b) { if (a.d > b.d) return (1 * p13sortorder); if (a.d < b.d) return (-1 * p13sortorder); return 0; }
2778
+ function p13sort_bysize(a, b) { if (a.s == b.s) return p13sort_filename(a, b); return (((a.s - b.s)) * p13sortorder); }
2779
+
2780
+ function p13sort_files(files) {
2781
+ var r = [], sortselection = Q('p13sortdropdown').value;
2782
+ 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]); }
2783
+ p13sortorder = 1;
2784
+ if (sortselection > 3) { p13sortorder = -1; sortselection -= 3; }
2785
+ if (sortselection == 1) { r.sort(p13sort_filename); }
2786
+ else if (sortselection == 2) { r.sort(p13sort_bysize); }
2787
+ else if (sortselection == 3) { r.sort(p13sort_timestamp); }
2788
+ return r;
2789
+ }
2790
+
2791
+ function p13setActions() {
2792
+ if (p13filetree == null) {
2793
+ QE('p13DeleteFileButton', false);
2794
+ QE('p13NewFolderButton', false);
2795
+ QE('p13UploadButton', false);
2796
+ QE('p13RenameFileButton', false);
2797
+ QE('p13SelectAllButton', false);
2798
+ Q('p13SelectAllButton').value = "Vše";
2799
+ QE('p13RefreshButton', false);
2800
+ QE('p13CutButton', false);
2801
+ QE('p13CopyButton', false);
2802
+ QE('p13PasteButton', false);
2803
+ } else {
2804
+ 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)
2805
+ var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5));
2806
+ QE('p13DeleteFileButton', (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
2807
+ QE('p13NewFolderButton', ((p13filetreelocation.length > 0) || (winAgent == false)));
2808
+ QE('p13UploadButton', ((p13filetreelocation.length > 0) || (winAgent == false)));
2809
+ QE('p13RenameFileButton', (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false)));
2810
+ QE('p13SelectAllButton', tc > 0);
2811
+ Q('p13SelectAllButton').value = (cc > 0 ? "Nic" : "Vše");
2812
+ QE('p13RefreshButton', true);
2813
+ QE('p13CutButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
2814
+ QE('p13CopyButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
2815
+ QE('p13PasteButton', ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0)));
2816
+ }
2817
+ }
2818
+
2819
+ 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; }
2820
+ 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; }
2821
+ function p13getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fd'); return checkboxes.length; }
2822
+ function p13selectallfile() { var nv = (p13getFileSelCount() == 0), checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = nv; } p13setActions(); }
2823
+ function p13createfolder() { setDialogMode(2, "Nový adresář", 3, p13createfolderEx, '<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck(event) style=width:100% />'); focusTextBox('p13renameinput'); p13fileNameCheck(); }
2824
+ function p13createfolderEx() { files.sendText({ action: 'mkdir', reqid: 1, path: p13filetreelocation.join('/') + '/' + Q('p13renameinput').value }); p13folderup(999); }
2825
+ function p13deletefile() { var cc = p13getFileSelCount(), rec = (p13getFileSelDirCount() > 0) ? '<br /><br /><label><input type=checkbox id=p13recdeleteinput>' + "Recursive delete" + '</label><br>' : "<input type=checkbox id=p13recdeleteinput style='display:none'>"; setDialogMode(2, "Smazat", 3, p13deletefileEx, (cc > 1) ? (format("Smazat {0} vybrané prvky?", cc) + rec) : ("Smazat vybraný prvek?" + rec)); }
2826
+ 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); }
2827
+ 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, "Přejmenovat", 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(); }
2828
+ function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; files.sendText(t); p13folderup(999); }
2829
+ function p13fileNameCheck(e) { var x = isFilenameValid(Q('p13renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e != null) && (e.keyCode == 13)) { dialogclose(1); } }
2830
+ function p13uploadFile() { setDialogMode(2, "Nahrát soubor", 3, p13uploadFileEx, '<input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p13uploadinput\')" />'); updateUploadDialogOk('p13uploadinput'); }
2831
+ function p13uploadFileEx() { p13doUploadFiles(Q('p13uploadinput').files); }
2832
+ function p13viewfile() {
2833
+ var checkboxes = document.getElementsByName('fd');
2834
+ for (var i = 0; i < checkboxes.length; i++) {
2835
+ if (checkboxes[i].checked) {
2836
+ if (p13filetree.dir[checkboxes[i].value].s <= 204800) {
2837
+ p13downloadfile(encodeURIComponent(p13filetreelocation.join('/') + '/' + p13filetree.dir[checkboxes[i].value].n), encodeURIComponent(p13filetree.dir[checkboxes[i].value].n), p13filetree.dir[checkboxes[i].value].s, 'viewer');
2838
+ } else { messagebox("File Editor", "Jen soubory menší než 200k mohou být editovány."); }
2839
+ break;
2840
+ }
2841
+ }
2842
+ }
2843
+
2844
+ var p13clipboard = null, p13clipboardFolder = null, p13clipboardCut = 0;
2845
+ 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(); }
2846
+ function p13pasteFile() {
2847
+ var x = '';
2848
+ if ((p13clipboard != null) && (p13clipboard.length > 0)) {
2849
+ if (p13clipboardCut == 0) {
2850
+ if (p13clipboard.length > 1) { x = format("Confirm copy of {0} entries's to this location?", p13clipboard.length); } else { x = format("Confirm copy of 1 entrie to this location?"); }
2851
+ } else {
2852
+ if (p13clipboard.length > 1) { x = format("Confirm move of {0} entries's to this location?", p13clipboard.length); } else { x = format("Confirm move of 1 entrie to this location?"); }
2853
+ }
2854
+ }
2855
+ setDialogMode(2, "Vložit", 3, p13pasteFileEx, x);
2856
+ }
2857
+ 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(); } }
2858
+ function p13updateClipview() {
2859
+ var x = '';
2860
+ if ((p13clipboard != null) && (p13clipboard.length > 0)) {
2861
+ if (p13clipboardCut == 0) {
2862
+ if (p13clipboard.length > 1) {
2863
+ x = format("Holding {0} entries for copy" + ', <a href=# onclick="return p13clearClip()" style=cursor:pointer>' + "Clear" + '</a>.', p13clipboard.length);
2864
+ } else {
2865
+ x = format("Holding 1 entrie for copy" + ', <a href=# onclick="return p13clearClip()" style=cursor:pointer>' + "Clear" + '</a>.');
2866
+ }
2867
+ } else {
2868
+ if (p13clipboard.length > 1) {
2869
+ x = format("Holding {0} entries for move" + ', <a href=# onclick="return p13clearClip()" style=cursor:pointer>' + "Clear" + '</a>.', p13clipboard.length);
2870
+ } else {
2871
+ x = format("Holding 1 entrie for move" + ', <a href=# onclick="return p13clearClip()" style=cursor:pointer>' + "Clear" + '</a>.');
2872
+ }
2873
+ }
2874
+ }
2875
+ QH('p13bottomstatus', x);
2876
+ p13setActions();
2877
+ }
2878
+ function p13clearClip() { p13clipboard = null; p13clipboardFolder = null; p13clipboardCut = 0; p13updateClipview(); return false; } function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); }
2879
+ function getFileSelCount(includeDirs) { var cc = 0; var checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == "3"))) cc++; } return cc; }
2880
+ function getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fc'); return checkboxes.length; }
2881
+
2882
+ //
2883
+ // FILES DOWNLOAD
2884
+ //
2885
+
2886
+ var downloadFile; // Global state for file download
2887
+
2888
+ // Called by the html page to start a download, arguments are: path, file name and file size.
2889
+ function p13downloadfile(x, y, z) {
2890
+ if (xxdialogMode || downloadFile || !files) return;
2891
+ downloadFile = { path: decodeURIComponent(x), file: decodeURIComponent(y), size: z, tsize: 0, data: '', state: 0, id: Math.random() }
2892
+ //console.log('p13downloadFileCancel', downloadFile);
2893
+ files.sendText({ action: 'download', sub: 'start', id: downloadFile.id, path: downloadFile.path });
2894
+ setDialogMode(2, "Stáhnout soubor", 10, p13downloadFileCancel, '<div>' + downloadFile.file + '</div><br /><progress id=d2progressBar style=width:100% value=0 max=' + z + ' />');
2895
+ }
2896
+
2897
+ // Called by the html page to cancel the download
2898
+ function p13downloadFileCancel() { setDialogMode(0); files.sendText({ action: 'download', sub: 'cancel', id: downloadFile.id }); downloadFile = null; }
2899
+
2900
+ // Called by the transport when download control command is received
2901
+ function p13gotDownloadCommand(cmd) {
2902
+ //console.log('p13gotDownloadCommand', cmd);
2903
+ if ((downloadFile == null) || (cmd.id != downloadFile.id)) return;
2904
+ if (cmd.sub == 'start') { downloadFile.state = 1; files.sendText({ action: 'download', sub: 'startack', id: downloadFile.id }); }
2905
+ else if (cmd.sub == 'cancel') { downloadFile = null; setDialogMode(0); }
2906
+ }
2907
+
2908
+ // Called by the transport when binary data is received
2909
+ function p13gotDownloadBinaryData(data) {
2910
+ if (!downloadFile || downloadFile.state == 0) return;
2911
+ if (data.length > 4) {
2912
+ downloadFile.tsize += (data.length - 4); // Add to the total bytes received
2913
+ downloadFile.data += data.substring(4); // Append the data
2914
+ Q('d2progressBar').value = downloadFile.tsize; // Change the progress bar
2915
+ }
2916
+ if ((ReadInt(data, 0) & 1) != 0) { // Check end flag
2917
+ saveAs(data2blob(downloadFile.data), downloadFile.file); downloadFile = null; setDialogMode(0); // Save the file
2918
+ } else {
2919
+ files.sendText({ action: 'download', sub: 'ack', id: downloadFile.id }); // Send the ACK
2920
+ }
2921
+ }
2922
+
2923
+ /*
2924
+ var downloadFile; // Global state for file download
2925
+
2926
+ // Called by the html page to start a download, arguments are: path, file name and file size.
2927
+ function p13downloadfile(x, y, z) {
2928
+ if (xxdialogMode) return;
2929
+ downloadFile = CreateAgentRedirect(meshserver, CreateRemoteFiles(p13gotDownloadData), serverPublicNamePort, authCookie, authRelayCookie, domainUrl); // Create our websocket file transport
2930
+ downloadFile.ctrlMsgAllowed = false;
2931
+ downloadFile.onStateChanged = onFileDownloadStateChange;
2932
+ downloadFile.xpath = decodeURIComponent(x);
2933
+ downloadFile.xfile = decodeURIComponent(y);
2934
+ downloadFile.xsize = z;
2935
+ downloadFile.xtsize = 0;
2936
+ downloadFile.xstate = 0;
2937
+ downloadFile.Start(filesNode._id);
2938
+ setDialogMode(2, "Download File", 10, p13downloadFileCancel, '<div>' + downloadFile.xfile + '</div><br /><progress id=d2progressBar style=width:100% value=0 max=' + z + ' />');
2939
+ }
2940
+
2941
+ // Called by the html page to cancel the download
2942
+ function p13downloadFileCancel(button, tag) {
2943
+ //console.log('p13downloadFileCancel');
2944
+ downloadFile.Stop();
2945
+ delete downloadFile;
2946
+ downloadFile = null;
2947
+ }
2948
+
2949
+ // Called by the file transport to indicate when the transport connection state has changed
2950
+ function onFileDownloadStateChange(xdownloadFile, state) {
2951
+ switch (state) {
2952
+ case 0: // Transport as disconnected. If this is not part of an abort, we need to save the file
2953
+ setDialogMode(0); // Close any dialog boxes if present
2954
+ if ((downloadFile != null) && (downloadFile.xstate == 1)) { saveAs(data2blob(downloadFile.xdata), downloadFile.xfile); } // Save the file
2955
+ break;
2956
+ case 3: // Transport as connected, send a command to indicate we want to start a file download
2957
+ downloadFile.send(JSON.stringify({ action: 'download', reqid: 1, path: downloadFile.xpath }));
2958
+ break;
2959
+ default:
2960
+ console.log('Unknown onFileDownloadStateChange state', state);
2961
+ break;
2962
+ }
2963
+ }
2964
+
2965
+ // Called by the transport when data is received
2966
+ function p13gotDownloadData(data) {
2967
+ if (downloadFile.xstate == 0) { // If state is 0, this is a command confirming if the file will be transfered.
2968
+ var cmd = JSON.parse(data);
2969
+ if (cmd.action == 'downloadstart') { // Yes, the file is about to start
2970
+ downloadFile.xstate = 1; // Switch to state 1, we will start receiving the file data
2971
+ downloadFile.xdata = ''; // Start with empty data
2972
+ downloadFile.send('a'); // Send the first ACK
2973
+ } else if (cmd.action == 'downloaderror') { // Problem opening this file, cancel
2974
+ p13downloadFileCancel();
2975
+ }
2976
+ } else { // We are in the process of receiving the file
2977
+ downloadFile.xtsize += (data.length); // Add to the total bytes received
2978
+ downloadFile.xdata += data; // Append the data
2979
+ Q('d2progressBar').value = downloadFile.xtsize; // Change the progress bar
2980
+ downloadFile.send('a'); // Send the ACK
2981
+ }
2982
+ }
2983
+ */
2984
+
2985
+ //
2986
+ // FILES UPLOAD
2987
+ //
2988
+
2989
+ var uploadFile;
2990
+ function p13doUploadFiles(files) {
2991
+ if (xxdialogMode) return;
2992
+ uploadFile = {};
2993
+ uploadFile.xpath = p13filetreelocation.join('/');
2994
+ uploadFile.xfiles = files;
2995
+ uploadFile.xfilePtr = -1;
2996
+ setDialogMode(2, "Nahrát soubor", 10, p13uploadFileCancel, '<div id=p13dfileName>' + "Connecting..." + '</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />');
2997
+ p13uploadReconnect();
2998
+ }
2999
+
3000
+ function onFileUploadStateChange(xdownloadFile, state) {
3001
+ switch (state) {
3002
+ case 0:
3003
+ p13folderup(9999);
3004
+ break;
3005
+ case 3:
3006
+ p13uploadNextFile();
3007
+ break;
3008
+ default:
3009
+ console.log('Unknown onFileUploadStateChange state', state);
3010
+ break;
3011
+ }
3012
+ }
3013
+
3014
+ // Connect again
3015
+ function p13uploadReconnect() {
3016
+ uploadFile.ws = CreateAgentRedirect(meshserver, CreateRemoteFiles(p13gotUploadData), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
3017
+ uploadFile.ws.attemptWebRTC = false;
3018
+ uploadFile.ws.ctrlMsgAllowed = false;
3019
+ uploadFile.ws.onStateChanged = onFileUploadStateChange;
3020
+ uploadFile.ws.Start(filesNode._id);
3021
+ }
3022
+
3023
+ // Push the next file
3024
+ function p13uploadNextFile() {
3025
+ uploadFile.xfilePtr++;
3026
+ if (uploadFile.xfiles.length > uploadFile.xfilePtr) {
3027
+ uploadFile.xptr = 0;
3028
+ var file = uploadFile.xfiles[uploadFile.xfilePtr];
3029
+ QH('p13dfileName', file.name);
3030
+ Q('d2progressBar').max = file.size;
3031
+ Q('d2progressBar').value = 0;
3032
+
3033
+ uploadFile.xreader = new FileReader();
3034
+ uploadFile.xreader.onload = function () {
3035
+ uploadFile.xdata = uploadFile.xreader.result;
3036
+ uploadFile.ws.sendText({ action: 'upload', reqid: uploadFile.xfilePtr, path: uploadFile.xpath, name: file.name, size: uploadFile.xdata.byteLength });
3037
+ };
3038
+ uploadFile.xreader.readAsArrayBuffer(file);
3039
+ } else {
3040
+ p13uploadFileCancel();
3041
+ }
3042
+ }
3043
+
3044
+ // Used to cancel the entire transfer.
3045
+ function p13uploadFileCancel(button, tag) {
3046
+ if (uploadFile != null) {
3047
+ if (uploadFile.ws != null) {
3048
+ uploadFile.ws.Stop();
3049
+ uploadFile.ws = null;
3050
+ }
3051
+ uploadFile = null;
3052
+ }
3053
+ setDialogMode(0); // Close any dialog boxes if present
3054
+ }
3055
+
3056
+ // Receive upload ack from the mesh agent, use this to keep sending more data
3057
+ function p13gotUploadData(data) {
3058
+ var cmd = JSON.parse(data);
3059
+ if ((uploadFile == null) || (parseInt(uploadFile.xfilePtr) != parseInt(cmd.reqid))) { return; }
3060
+
3061
+ if (cmd.action == 'uploadstart') {
3062
+ p13uploadNextPart(false);
3063
+ for (var i = 0; i < 8; i++) { p13uploadNextPart(true); } // Send 8 more blocks of 4 k to full the websocket.
3064
+ } else if (cmd.action == 'uploadack') {
3065
+ p13uploadNextPart(false);
3066
+ } else if (cmd.action == 'uploaderror') {
3067
+ p13uploadFileCancel();
3068
+ }
3069
+ }
3070
+
3071
+ // 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.
3072
+ function p13uploadNextPart(dataPriming) {
3073
+ var data = uploadFile.xdata;
3074
+ var start = uploadFile.xptr;
3075
+ var end = uploadFile.xptr + 4096;
3076
+ if (end > data.byteLength) { if (dataPriming == true) { return; } end = data.byteLength; }
3077
+ if (start == data.byteLength) {
3078
+ if (uploadFile.ws != null) { uploadFile.ws.Stop(); uploadFile.ws = null; }
3079
+ if (uploadFile.xfiles.length > uploadFile.xfilePtr + 1) { p13uploadReconnect(); } else { p13uploadFileCancel(); }
3080
+ } else {
3081
+ var datapart = data.slice(start, end);
3082
+ uploadFile.ws.send(datapart);
3083
+ uploadFile.xptr = end;
3084
+ Q('d2progressBar').value = end;
3085
+ }
3086
+ }
3087
+
3088
+ //
3089
+ // MY MESHS
3090
+ //
3091
+
3092
+ var currentMesh;
3093
+ function p20updateMesh() {
3094
+ if (currentMesh == null) return;
3095
+ QH('p20meshName', EscapeHtml(currentMesh.name));
3096
+ var meshtype = format("Unknown #{0}", currentMesh.mtype);
3097
+ var meshrights = currentMesh.links[userinfo._id].rights;
3098
+ if (currentMesh.mtype == 1) meshtype = "Intel® AMT only, no agent";
3099
+ if (currentMesh.mtype == 2) meshtype = "Managed using a software agent";
3100
+
3101
+ var x = '';
3102
+ x += addHtmlValue("Jméno", addLinkConditional(EscapeHtml(currentMesh.name), 'p20editmesh(1)', (meshrights & 1) != 0));
3103
+ x += addHtmlValue("Popis", addLinkConditional(((currentMesh.desc && currentMesh.desc != '') ? EscapeHtml(currentMesh.desc) : ('<i>' + "Nic" + '</i>')), 'p20editmesh(2)', (meshrights & 1) != 0));
3104
+ x += addHtmlValue("Typ", meshtype);
3105
+ //x += addHtmlValue('Identifier', currentMesh._id.split('/')[2]);
3106
+
3107
+ //x += '<br><input type=button value=Notes onclick=showNotes(false,"' + encodeURIComponent(currentMesh._id) + '") />';
3108
+
3109
+ x += '<br style=clear:both><br>';
3110
+ var currentMeshLinks = currentMesh.links[userinfo._id];
3111
+ if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += '<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>'; }
3112
+
3113
+ /*
3114
+ if ((meshrights & 4) != 0) {
3115
+ if (currentMesh.mtype == 1) {
3116
+ x += '<a onclick=addCiraDeviceToMesh(\"' + currentMesh._id + '\") style=cursor:pointer;margin-right:10px><img src=images/icon-installmesh.png border=0 height=12 width=12> Install CIRA</a>';
3117
+ x += '<a onclick=addDeviceToMesh(\"' + currentMesh._id + '\") style=cursor:pointer;margin-right:10px><img src=images/icon-installmesh.png border=0 height=12 width=12> Install local</a>';
3118
+ }
3119
+ if (currentMesh.mtype == 2) {
3120
+ x += '<a onclick=addAgentToMesh(\"' + currentMesh._id + '\") style=cursor:pointer;margin-right:10px><img src=images/icon-addnew.png border=0 height=12 width=12> Install</a>';
3121
+ }
3122
+ }
3123
+ */
3124
+
3125
+ /*
3126
+ function getMeshActions(mesh, meshrights) {
3127
+ if ((meshrights & 4) == 0) return '';
3128
+ var r = '';
3129
+ if (mesh.mtype == 1) {
3130
+ r += ' <a style=cursor:pointer;font-size:10px onclick=addCiraDeviceToMesh(\"' + mesh._id + '\")>Add CIRA</a>';
3131
+ r += ' <a style=cursor:pointer;font-size:10px onclick=addDeviceToMesh(\"' + mesh._id + '\")>Add Local</a>';
3132
+ }
3133
+ if (mesh.mtype == 2) {
3134
+ r += ' <a style=cursor:pointer;font-size:10px onclick=addAgentToMesh(\"' + mesh._id + '\")>Add Agent</a>';
3135
+ }
3136
+ return r;
3137
+ }
3138
+ */
3139
+
3140
+ x += '<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>';
3141
+
3142
+ // Sort the users for this mesh
3143
+ var count = 1, sortedusers = [];
3144
+ for (var i in currentMesh.links) { sortedusers.push({ id: i, name: i.split('/')[2], rights: currentMesh.links[i].rights }); }
3145
+ sortedusers.sort(function (a, b) { if (a.name > b.name) return 1; if (a.name < b.name) return -1; return 0; });
3146
+
3147
+ // Display all users for this mesh
3148
+ for (var i in sortedusers) {
3149
+ var trash = '', rights = "Partial Rights", r = sortedusers[i].rights;
3150
+ if (r == 0xFFFFFFFF) rights = "Full Administrator"; else if (r == 0) rights = "No Rights";
3151
+ if ((i != userinfo._id) && (meshrights == 0xFFFFFFFF || (((meshrights & 2) != 0)))) { trash = '<a onclick=p20deleteUser(event,"' + encodeURIComponent(sortedusers[i].id) + '") style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'; }
3152
+ x += '<tr onclick=p20viewuser("' + encodeURIComponent(sortedusers[i].id) + '") style=height:32px;cursor:pointer' + (((count % 2) == 0) ? ';background-color:#DDD' : '') + '><td>';
3153
+ x += '<div style=float:right>' + trash + '</div><div style=float:right;padding-right:4px>' + rights + '</div><div class=m2></div><div> ' + EscapeHtml(decodeURIComponent(sortedusers[i].name)) + '<div></div></div>';
3154
+ x += '</td></tr>';
3155
+ ++count;
3156
+ }
3157
+
3158
+ x += '</tbody></table>';
3159
+
3160
+ // If we are full administrator on this mesh, allow deletion of the mesh
3161
+ if (meshrights == 0xFFFFFFFF) { x += '<div style=font-size:small;text-align:right;margin-top:6px><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>' + "Delete Group" + '</a></span></div>'; }
3162
+
3163
+ QH('p20info', x);
3164
+ }
3165
+
3166
+ function p20showDeleteMeshDialog() {
3167
+ if (xxdialogMode) return false;
3168
+ var x = format("Are you sure you want to delete group {0}? Deleting the device group will also delete all information about devices within this group.", EscapeHtml(currentMesh.name)) + '<br /><br />';
3169
+ x += '<label><input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />' + "Confirm" + '</label>';
3170
+ setDialogMode(2, "Delete Group", 3, p20showDeleteMeshDialogEx, x);
3171
+ p20validateDeleteMeshDialog();
3172
+ return false;
3173
+ }
3174
+
3175
+ function p20validateDeleteMeshDialog() {
3176
+ QE('idx_dlgOkButton', Q('p20check').checked);
3177
+ }
3178
+
3179
+ function p20showDeleteMeshDialogEx(buttons, tag) {
3180
+ meshserver.send({ action: 'deletemesh', meshid: currentMesh._id, meshname: currentMesh.name });
3181
+ }
3182
+
3183
+ function p20editmesh(focus) {
3184
+ if (xxdialogMode) return;
3185
+ var x = addHtmlValue("Jméno", '<input id=dp20meshname style=width:170px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />');
3186
+ x += addHtmlValue("Popis", '<input id=dp20meshdesc style=width:170px maxlength=1024 onkeyup=p20editmeshValidate() />');
3187
+ setDialogMode(2, "Editovat skupinu zařízení", 3, p20editmeshEx, x);
3188
+ Q('dp20meshname').value = currentMesh.name;
3189
+ if (currentMesh.desc) Q('dp20meshdesc').value = currentMesh.desc;
3190
+ p20editmeshValidate();
3191
+ if (focus == 2) { Q('dp20meshdesc').focus(); } else { Q('dp20meshname').focus(); }
3192
+ }
3193
+
3194
+ function p20editmeshEx() {
3195
+ meshserver.send({ action: 'editmesh', meshid: currentMesh._id, meshname: Q('dp20meshname').value, desc: Q('dp20meshdesc').value });
3196
+ }
3197
+
3198
+ function p20editmeshValidate() {
3199
+ QE('idx_dlgOkButton', Q('dp20meshname').value.length > 0);
3200
+ }
3201
+
3202
+ function p20showAddMeshUserDialog() {
3203
+ if (xxdialogMode) return;
3204
+ var x = addHtmlValue('User', '<input id=dp20username style=width:170px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />');
3205
+ x += '<div style="border:2px groove gray;background-color:white;max-height:120px;overflow-y:scroll">';
3206
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>' + "Full Administrator" + '</label><br>';
3207
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>' + "Editovat skupinu zařízení" + '</label><br>';
3208
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>' + "Manage Device Group Users" + '</label><br>';
3209
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>' + "Správa skupin zařízení" + '</label><br>';
3210
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>' + "Remote Control" + '</label><br>';
3211
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remoteview style=margin-left:12px>' + "Remote View Only" + '</label><br>';
3212
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotelimitedinput style=margin-left:12px>' + "Limited Input Only" + '</label><br>';
3213
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noterminal style=margin-left:12px>' + "No Terminal Access" + '</label><br>';
3214
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20nofiles style=margin-left:12px>' + "No File Access" + '</label><br>';
3215
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20noamt style=margin-left:12px>' + "No Intel® AMT" + '</label><br>';
3216
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>' + "Konzole agenta" + '</label><br>';
3217
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>' + "Server Files" + '</label><br>';
3218
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>' + "Wake Devices" + '</label><br>';
3219
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>' + "Upravit popis zařízení" + '</label><br>';
3220
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20limitevents>' + "Show Only Own Events" + '</label><br>';
3221
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20chatnotify>' + "Chat & Notify" + '</label><br>';
3222
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20uninstall>' + "Uninstall Agent" + '</label><br>';
3223
+ x += '</div>';
3224
+ setDialogMode(2, "Add User to Mesh", 3, p20showAddMeshUserDialogEx, x);
3225
+ p20validateAddMeshUserDialog();
3226
+ Q('dp20username').focus();
3227
+ }
3228
+
3229
+ function p20validateAddMeshUserDialog() {
3230
+ var meshrights = currentMesh.links[userinfo._id].rights;
3231
+ var nc = !Q('p20fulladmin').checked;
3232
+ QE('p20fulladmin', meshrights == 0xFFFFFFFF);
3233
+ QE('p20editmesh', nc && (meshrights == 0xFFFFFFFF));
3234
+ QE('p20manageusers', nc);
3235
+ QE('p20managecomputers', nc);
3236
+ QE('p20remotecontrol', nc);
3237
+ QE('p20meshagentconsole', nc);
3238
+ QE('p20meshserverfiles', nc);
3239
+ QE('p20wakedevices', nc);
3240
+ QE('p20editnotes', nc);
3241
+ QE('p20limitevents', nc);
3242
+ QE('p20remoteview', nc && Q('p20remotecontrol').checked);
3243
+ QE('p20remotelimitedinput', nc && Q('p20remotecontrol').checked && !Q('p20remoteview').checked);
3244
+ QE('p20noterminal', nc && Q('p20remotecontrol').checked);
3245
+ QE('p20nofiles', nc && Q('p20remotecontrol').checked);
3246
+ QE('p20noamt', nc && Q('p20remotecontrol').checked);
3247
+ QE('p20chatnotify', nc);
3248
+ QE('p20uninstall', nc);
3249
+ }
3250
+
3251
+ function p20showAddMeshUserDialogEx() {
3252
+ var meshadmin = 0;
3253
+ if (Q('p20fulladmin').checked == true) { meshadmin = 0xFFFFFFFF; } else {
3254
+ if (Q('p20editmesh').checked == true) meshadmin += 1;
3255
+ if (Q('p20manageusers').checked == true) meshadmin += 2;
3256
+ if (Q('p20managecomputers').checked == true) meshadmin += 4;
3257
+ if (Q('p20remotecontrol').checked == true) meshadmin += 8;
3258
+ if (Q('p20meshagentconsole').checked == true) meshadmin += 16;
3259
+ if (Q('p20meshserverfiles').checked == true) meshadmin += 32;
3260
+ if (Q('p20wakedevices').checked == true) meshadmin += 64;
3261
+ if (Q('p20editnotes').checked == true) meshadmin += 128;
3262
+ if (Q('p20remoteview').checked == true) meshadmin += 256;
3263
+ if (Q('p20noterminal').checked == true) meshadmin += 512;
3264
+ if (Q('p20nofiles').checked == true) meshadmin += 1024;
3265
+ if (Q('p20noamt').checked == true) meshadmin += 2048;
3266
+ if (Q('p20remotelimitedinput').checked == true) meshadmin += 4096;
3267
+ if (Q('p20limitevents').checked == true) meshadmin += 8192;
3268
+ if (Q('p20chatnotify').checked == true) meshadmin += 16384;
3269
+ if (Q('p20uninstall').checked == true) meshadmin += 32768;
3270
+ }
3271
+ var users = Q('dp20username').value.split(','), users2 = [];
3272
+ for (var i in users) { users2.push(users[i].trim()); }
3273
+ meshserver.send({ action: 'addmeshuser', meshid: currentMesh._id, meshname: currentMesh.name, usernames: users2, meshadmin: meshadmin });
3274
+ }
3275
+
3276
+ function p20viewuser(userid) {
3277
+ if (xxdialogMode) return;
3278
+ userid = decodeURIComponent(userid);
3279
+ var r = [], cmeshrights = currentMesh.links[userinfo._id].rights, meshrights = currentMesh.links[userid].rights;
3280
+ if (meshrights == 0xFFFFFFFF) r.push("Full Administrator"); else {
3281
+ if ((meshrights & 1) != 0) r.push("Editovat skupinu zařízení");
3282
+ if ((meshrights & 2) != 0) r.push("Manage Device Group Users");
3283
+ if ((meshrights & 4) != 0) r.push("Správa skupin zařízení");
3284
+ if ((meshrights & 8) != 0) r.push("Remote Control");
3285
+ if ((meshrights & 16) != 0) r.push("Agent Console");
3286
+ if ((meshrights & 32) != 0) r.push("Server Files");
3287
+ if ((meshrights & 64) != 0) r.push("Wake Devices");
3288
+ if ((meshrights & 128) != 0) r.push("Edit Notes");
3289
+ if ((meshrights & 256) != 0) r.push("Remote View Only");
3290
+ if ((meshrights & 512) != 0) r.push("Žádný terminál");
3291
+ if ((meshrights & 1024) != 0) r.push("No Files");
3292
+ if ((meshrights & 2048) != 0) r.push("No Intel® AMT");
3293
+ if (((meshrights & 8) != 0) && ((meshrights & 4096) != 0) && ((meshrights & 256) == 0)) r.push("Limited Input");
3294
+ if ((meshrights & 8192) != 0) r.push("Self Events Only");
3295
+ if ((meshrights & 16384) != 0) r.push("Chat & Notify");
3296
+ if ((meshrights & 32768) != 0) r.push("Uninstall");
3297
+ }
3298
+ if (r.length == 0) { r.push("No Rights"); }
3299
+ var buttons = 1, x = addHtmlValue("User", EscapeHtml(decodeURIComponent(userid.split('/')[2])));
3300
+ x += addHtmlValue("Práva", r.join(", "));
3301
+ if (((userinfo._id) != userid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) buttons += 4;
3302
+ setDialogMode(2, "Device Group User", buttons, p20viewuserEx, x, userid);
3303
+ }
3304
+
3305
+ function p20viewuserEx(button, userid) { if (button != 2) return; setDialogMode(2, "Remote Mesh User", 3, p20viewuserEx2, format("Confirm removal of user {0}?", userid.split('/')[2]), userid); }
3306
+ function p20deleteUser(e, userid) { haltEvent(e); p20viewuserEx(2, decodeURIComponent(userid)); }
3307
+ function p20viewuserEx2(button, userid) { meshserver.send({ action: 'removemeshuser', meshid: currentMesh._id, meshname: currentMesh.name, userid: userid }); }
3308
+
3309
+ //
3310
+ // PANELS
3311
+ //
3312
+
3313
+ var xxcurrentView = -1;
3314
+ function go(x) {
3315
+ setSessionActivity();
3316
+ if (xxdialogMode || xxcurrentView == x) return;
3317
+ updateFooterMenu();
3318
+ setDialogMode(0);
3319
+ // Edit this line when adding a new screen
3320
+ for (var i = 0; i < 32; i++) { QV('p' + i, i == x); }
3321
+ xxcurrentView = x;
3322
+ }
3323
+
3324
+ //
3325
+ // POPUP DIALOG
3326
+ //
3327
+
3328
+ // undefined = Hidden, 1 = Generic Message
3329
+ var xxdialogMode;
3330
+ var xxdialogFunc;
3331
+ var xxdialogButtons;
3332
+ var xxdialogTag;
3333
+
3334
+ // Display a dialog box
3335
+ // Parameters: Dialog Mode (0 = none), Dialog Title, Buttons (1 = OK, 2 = Cancel, 3 = OK & Cancel), Call back function(0 = Cancel, 1 = OK), Dialog Content (Mode 2 only)
3336
+ function setDialogMode(x, y, b, f, c, tag) {
3337
+ setSessionActivity();
3338
+ xxdialogMode = x;
3339
+ xxdialogFunc = f;
3340
+ xxdialogButtons = b;
3341
+ xxdialogTag = tag;
3342
+ QE('idx_dlgOkButton', true);
3343
+ QV('idx_dlgOkButton', b & 1);
3344
+ QV('idx_dlgCancelButton', b & 2);
3345
+ QV('id_dialogclose', (b & 2) || (b & 8));
3346
+ QV('idx_dlgButtonBar', b & 7);
3347
+ if (y) QH('id_dialogtitle', y);
3348
+ for (var i = 1; i < 24; i++) { QV('dialog' + i, i == x); } // Edit this line when more dialogs are added
3349
+ QV('dialog', x);
3350
+ if (c) { if (x == 2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage', c); } }
3351
+ }
3352
+
3353
+ function dialogclose(x) {
3354
+ setSessionActivity();
3355
+ var f = xxdialogFunc;
3356
+ var b = xxdialogButtons;
3357
+ var t = xxdialogTag;
3358
+ setDialogMode();
3359
+ if (((b & 8) || x) && f) f(x, t);
3360
+ }
3361
+
3362
+ function putstore(name, val) { try { if ((typeof (localStorage) === 'undefined') || (localStorage.getItem(name) == val)) return; if (val == null) { localStorage.removeItem(name); } else { localStorage.setItem(name, val); } } catch (e) { } if (name[0] != '_') { var s = {}; for (var i = 0, len = localStorage.length; i < len; ++i) { var k = localStorage.key(i); if (k[0] != '_') { s[k] = localStorage.getItem(k); } } meshserver.send({ action: 'userWebState', state: JSON.stringify(s) }); } }
3363
+ function getstore(name, val) { try { if (typeof (localStorage) === 'undefined') return val; var v = localStorage.getItem(name); if ((v == null) || (v == null)) return val; return v; } catch (e) { return val; } }
3364
+ function center() { QS('dialog').left = ((((getDocWidth() - 300) / 2)) + 'px'); deskAdjust(); deskAdjust(); /*drawDeviceTimeline();*/ }
3365
+ function messagebox(t, m) { QH('id_dialogMessage', m); setDialogMode(1, t, 1); }
3366
+ function statusbox(t, m) { QH('id_dialogMessage', m); setDialogMode(1, t); }
3367
+ 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; }
3368
+ function haltEvent(e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
3369
+ function haltReturn(e) { if (e.keyCode == 13) { haltEvent(e); } }
3370
+ function validateEmail(v) { var emailReg = /^(([^<>()\[\]\\.,;:\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 emailReg.test(v); }
3371
+ function reload() { window.location.href = window.location.href; }
3372
+ function getNodeFromId(id) { for (var i in nodes) { if (nodes[i]._id == id) return nodes[i]; } return null; }
3373
+ function addHtmlValue(t, v) { return '<table><td style=width:120px>' + t + '<td><b>' + v + '</b></table>'; }
3374
+ function addHtmlValue2(t, v) { return '<div><div style=display:inline-block;float:right>' + v + '</div><div style=display:inline-block>' + t + '</div></div>'; }
3375
+ function addLink(x, f) { return '<a style=cursor:pointer;color:darkblue;text-decoration:none onclick=\'' + f + '\'>♦ ' + x + '</a>'; }
3376
+ function addLinkConditional(x, f, c) { if (c) return addLink(x, f); return x; }
3377
+ function passwordcheck(p) { var re = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/; return re.test(p); }
3378
+ function getFileSizeStr(size) { if (size == 1) return "1 byte"; return format('{0} bytes', size); }
3379
+ function joinPaths() { var x = []; for (var i in arguments) { var w = arguments[i]; if ((w != null) && (w != '')) { while (w.endsWith('/') || w.endsWith('\\')) { w = w.substring(0, w.length - 1); } while (w.startsWith('/') || w.startsWith('\\')) { w = w.substring(1); } x.push(w); } } return x.join('/'); }
3380
+ function focusTextBox(x) { setTimeout(function () { Q(x).selectionStart = Q(x).selectionEnd = 65535; Q(x).focus(); }, 0); }
3381
+ var isFilenameValid = (function () { var x1 = /^[^\\/:\*\?"<>\|]+$/, x2 = /^\./, x3 = /^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname) { return x1.test(fname) && !x2.test(fname) && !x3.test(fname) && (fname[0] != '.'); } })();
3382
+ 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; }
3383
+ function printDate(d) { return d.toLocaleDateString(args.locale); }
3384
+ function printTime(d) { return d.toLocaleTimeString(args.locale); }
3385
+ function printDateTime(d) { return d.toLocaleString(args.locale); }
3386
+ function format(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); };
3387
+ function nobreak(x) { return x.split(' ').join(' '); }
3388
+
3389
+ </script>
3390
+
3391
+</body></html>
\ No newline at end of file
views/translations/default_cs.handlebars
new
+9721
@@ -0,0 +1,9721 @@
1
+<!DOCTYPE html><html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head>
2
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3
+ <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
4
+ <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
5
+ <meta name="apple-mobile-web-app-capable" content="yes">
6
+ <meta name="format-detection" content="telephone=no">
7
+ <link rel="shortcut icon" type="image/x-icon" href="{{{domainurl}}}favicon.ico">
8
+ <link keeplink="1" type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS">
9
+ <link type="text/css" href="styles/ol.css" media="screen" rel="stylesheet" title="CSS">
10
+ <link type="text/css" href="styles/ol3-contextmenu.min.css" media="screen" rel="stylesheet" title="CSS">
11
+ <script type="text/javascript" src="scripts/common-0.0.1.js"></script>
12
+ <script type="text/javascript" src="scripts/meshcentral.js"></script>
13
+ <script type="text/javascript" src="scripts/amt-0.2.0.js"></script>
14
+ <script type="text/javascript" src="scripts/amt-wsman-0.2.0.js"></script>
15
+ <script type="text/javascript" src="scripts/amt-desktop-0.0.2.js"></script>
16
+ <script type="text/javascript" src="scripts/amt-terminal-0.0.2.js"></script>
17
+ <script type="text/javascript" src="scripts/zlib.js"></script>
18
+ <script type="text/javascript" src="scripts/zlib-inflate.js"></script>
19
+ <script type="text/javascript" src="scripts/zlib-adler32.js"></script>
20
+ <script type="text/javascript" src="scripts/zlib-crc32.js"></script>
21
+ <script type="text/javascript" src="scripts/amt-redir-ws-0.1.0.js"></script>
22
+ <script type="text/javascript" src="scripts/amt-wsman-ws-0.2.0.js"></script>
23
+ <script type="text/javascript" src="scripts/agent-redir-ws-0.1.1.js"></script>
24
+ <script type="text/javascript" src="scripts/agent-redir-rtc-0.1.0.js"></script>
25
+ <script type="text/javascript" src="scripts/agent-desktop-0.0.2.js"></script>
26
+ <script type="text/javascript" src="scripts/qrcode.min.js"></script>
27
+ <script keeplink="1" type="text/javascript" src="scripts/u2f-api.js"></script>
28
+ <script keeplink="1" type="text/javascript" src="scripts/charts.js"></script>
29
+ <script keeplink="1" type="text/javascript" src="scripts/filesaver.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>{{{title}}}</title>
33
+</head>
34
+<body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none;min-width:495px">
35
+ <!-- right click menu -->
36
+ <div id="contextMenu" class="contextMenu noselect" style="display:none">
37
+ <div id="cxinfo" class="cmtext" onclick="cmaction(1,event)"><b>Information</b></div>
38
+ <div id="cxdesktop" class="cmtext" onclick="cmaction(3,event)">Plocha</div>
39
+ <div id="cxterminal" class="cmtext" onclick="cmaction(2,event)">Terminál</div>
40
+ <div id="cxfiles" class="cmtext" onclick="cmaction(4,event)">Soubory</div>
41
+ <div id="cxevents" class="cmtext" onclick="cmaction(5,event)">Události</div>
42
+ <div id="cxconsole" class="cmtext" onclick="cmaction(6,event)">Konzole</div>
43
+ <hr id="cxmgroupsplit">
44
+ <div id="cxmdesktop" class="cmtext" onclick="cmaction(7,event)" style="display:none">Multi-Desktop</div>
45
+ </div>
46
+ <div id="meshContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
47
+ <div id="cxselectall" class="cmtext" onclick="cmmeshaction(1,event)">Vybrat vše</div>
48
+ <div id="cxselectnone" class="cmtext" onclick="cmmeshaction(2,event)">Vybrat nic</div>
49
+ <!--
50
+ <hr id="cxmgroupsplit2" style="display:none" />
51
+ <div id="cxmmdesktop" class="cmtext" style="display:none" onclick="cmmeshaction(3,event)">Multi-Desktop</div>
52
+ -->
53
+ </div>
54
+ <div id="termShellContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
55
+ <div id="cxtermnorm" class="cmtext" onclick="cmtermaction(1,event)"><b>Normal Connect</b></div>
56
+ <div id="cxtermps" class="cmtext" onclick="cmtermaction(6,event)">PowerShell připojen</div>
57
+ </div>
58
+ <div id="termShellContextMenuLinux" class="contextMenu noselect" style="display:none;min-width:0px">
59
+ <div id="cxtermnorm" class="cmtext" onclick="cmtermaction(1,event)"><b>Root Shell</b></div>
60
+ <div id="cxtermps" class="cmtext" onclick="cmtermaction(8,event)">User Shell</div>
61
+ </div>
62
+ <!--
63
+ <div id="pluginTabContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
64
+ <div id="cxclose" class="cmtext" onclick="pluginTabClose(event)">Close Tab</div>
65
+ </div>
66
+ -->
67
+ <!-- main page -->
68
+ <div id="container">
69
+ <div id="notifiyBox" class="notifiyBox" style="display:none"></div>
70
+ <div id="masthead" class="noselect">
71
+ <div class="title">{{{title}}}</div>
72
+ <div class="title2">{{{title2}}}</div>
73
+ <div style="float:right">
74
+ <div id="notificationCount" onclick="clickNotificationIcon()" class="unselectable" style="display: none;" title="Click to view current notifications">0</div>
75
+ </div>
76
+ <p id="logoutControl">{{{logoutControl}}}<span id="idleTimeoutNotify" style="color:yellow"></span></p>
77
+ </div>
78
+ <div id="page_leftbar">
79
+ <div style="height:16px"></div>
80
+ <div id="LeftMenuMyDevices" tabindex="0" class="lbbutton lbbuttonsel" title="Moje zařízení" onclick="go(1,event)" onkeypress="if (event.key=='Enter') { go(1); }">
81
+ <div class="lb2"></div>
82
+ </div>
83
+ <div id="LeftMenuMyAccount" tabindex="0" class="lbbutton" title="Můj účet" onclick="go(2,event)" onkeypress="if (event.key=='Enter') { go(2); }">
84
+ <div class="lb1"></div>
85
+ </div>
86
+ <div id="LeftMenuMyEvents" tabindex="0" class="lbbutton" title="Moje události" onclick="go(3,event)" onkeypress="if (event.key=='Enter') { go(3); }">
87
+ <div class="lb3"></div>
88
+ </div>
89
+ <div id="LeftMenuMyFiles" tabindex="0" class="lbbutton" style="display:none" title="Moje soubory" onclick="go(5,event)" onkeypress="if (event.key=='Enter') { go(5); }">
90
+ <div class="lb4"></div>
91
+ </div>
92
+ <div id="LeftMenuMyUsers" tabindex="0" class="lbbutton" style="display:none" title="Uživatelé" onclick="go(4,event)" onkeypress="if (event.key=='Enter') { go(4); }">
93
+ <div class="lb5"></div>
94
+ </div>
95
+ <div id="LeftMenuMyServer" tabindex="0" class="lbbutton" style="display:none" title="Můj server" onclick="go(6,event)" onkeypress="if (event.key=='Enter') { go(6); }">
96
+ <div class="lb6"></div>
97
+ </div>
98
+ </div>
99
+ <div id="topbar" class="noselect">
100
+ <div>
101
+ <div style="position:relative">
102
+ <div tabindex="0" id="uiMenuButton" title="User interface selection" onclick="showUserInterfaceSelectMenu()" onkeypress="if (event.key == 'Enter') showUserInterfaceSelectMenu()">
103
+ ♦
104
+ <div id="uiMenu" style="display:none">
105
+ <div tabindex="0" id="uiViewButton1" class="uiSelector" onclick="userInterfaceSelectMenu(1)" title="Left bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(1)"><div class="uiSelector1"></div></div>
106
+ <div tabindex="0" id="uiViewButton2" class="uiSelector" onclick="userInterfaceSelectMenu(2)" title="Top bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(2)"><div class="uiSelector2"></div></div>
107
+ <div tabindex="0" id="uiViewButton3" class="uiSelector" onclick="userInterfaceSelectMenu(3)" title="Fixed width interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(3)"><div class="uiSelector3"></div></div>
108
+ <div tabindex="0" id="uiViewButton4" class="uiSelector" onclick="toggleNightMode()" title="Toggle night mode" onkeypress="if (event.key == 'Enter') toggleNightMode()"><div class="uiSelector4"></div></div>
109
+ </div>
110
+ </div>
111
+ <table id="MainMenuSpan" cellpadding="0" cellspacing="0" class="style1">
112
+ <tbody><tr>
113
+ <td tabindex="0" id="MainMenuMyDevices" class="topbar_td style3x" onclick="go(1,event)" onkeypress="if (event.key == 'Enter') go(1)">Moje zařízení</td>
114
+ <td tabindex="0" id="MainMenuMyAccount" class="topbar_td style3x" onclick="go(2,event)" onkeypress="if (event.key == 'Enter') go(2)">Můj účet</td>
115
+ <td tabindex="0" id="MainMenuMyEvents" class="topbar_td style3x" onclick="go(3,event)" onkeypress="if (event.key == 'Enter') go(3)">Moje události</td>
116
+ <td tabindex="0" id="MainMenuMyFiles" class="topbar_td style3x" onclick="go(5,event)" onkeypress="if (event.key == 'Enter') go(5)">Moje soubory</td>
117
+ <td tabindex="0" id="MainMenuMyUsers" class="topbar_td style3x" onclick="go(4,event)" onkeypress="if (event.key == 'Enter') go(4)">Uživatelé</td>
118
+ <td tabindex="0" id="MainMenuMyServer" class="topbar_td style3x" onclick="go(6,event)" onkeypress="if (event.key == 'Enter') go(6)">Můj server</td>
119
+ <td class="topbar_td_end style3"> </td>
120
+ </tr>
121
+ </tbody></table>
122
+ <div id="MainSubMenuSpan" style="display:none">
123
+ <table id="MainSubMenu" cellpadding="0" cellspacing="0" class="style1">
124
+ <tbody><tr>
125
+ <td tabindex="0" id="MainDev" class="topbar_td style3x" onclick="go(10,event)" onkeypress="if (event.key == 'Enter') go(10)">Obecné</td>
126
+ <td tabindex="0" id="MainDevDesktop" class="topbar_td style3x" onclick="go(11,event)" onkeypress="if (event.key == 'Enter') go(11)">Plocha</td>
127
+ <td tabindex="0" id="MainDevTerminal" class="topbar_td style3x" onclick="go(12,event)" onkeypress="if (event.key == 'Enter') go(12)">Terminál</td>
128
+ <td tabindex="0" id="MainDevFiles" class="topbar_td style3x" onclick="go(13,event)" onkeypress="if (event.key == 'Enter') go(13)">Soubory</td>
129
+ <td tabindex="0" id="MainDevEvents" class="topbar_td style3x" onclick="go(16,event)" onkeypress="if (event.key == 'Enter') go(16)">Události</td>
130
+ <td tabindex="0" id="MainDevInfo" class="topbar_td style3x" onclick="go(17,event)" onkeypress="if (event.key == 'Enter') go(17)">Detaily</td>
131
+ <td tabindex="0" id="MainDevAmt" class="topbar_td style3x" onclick="go(14,event)" onkeypress="if (event.key == 'Enter') go(14)">Intel® AMT</td>
132
+ <td tabindex="0" id="MainDevConsole" class="topbar_td style3x" onclick="go(15,event)" onkeypress="if (event.key == 'Enter') go(15)">Konzole</td>
133
+ <td tabindex="0" id="MainDevPlugins" class="topbar_td style3x" onclick="go(19,event)" onkeypress="if (event.key == 'Enter') go(19)">Pluginy</td>
134
+ <td class="topbar_td_end style3"> </td>
135
+ </tr>
136
+ </tbody></table>
137
+ </div>
138
+ <div id="MeshSubMenuSpan" style="display:none">
139
+ <table id="MeshSubMenu" cellpadding="0" cellspacing="0" class="style1">
140
+ <tbody><tr>
141
+ <td tabindex="0" id="MeshGeneral" class="topbar_td style3x" onclick="go(20,event)" onkeypress="if (event.key == 'Enter') go(20)">Obecné</td>
142
+ <td class="topbar_td_end style3"> </td>
143
+ </tr>
144
+ </tbody></table>
145
+ </div>
146
+ <div id="UserSubMenuSpan" style="display:none">
147
+ <table id="UserSubMenu" cellpadding="0" cellspacing="0" class="style1">
148
+ <tbody><tr>
149
+ <td tabindex="0" id="UserGeneral" class="topbar_td style3x" onclick="go(30,event)" onkeypress="if (event.key == 'Enter') go(30)">Obecné</td>
150
+ <td tabindex="0" id="UserEvents" class="topbar_td style3x" onclick="go(31,event)" onkeypress="if (event.key == 'Enter') go(31)">Události</td>
151
+ <td class="topbar_td_end style3"> </td>
152
+ </tr>
153
+ </tbody></table>
154
+ </div>
155
+ <div id="ServerSubMenuSpan" style="display:none">
156
+ <table id="ServerSubMenu" cellpadding="0" cellspacing="0" class="style1">
157
+ <tbody><tr>
158
+ <td tabindex="0" id="ServerGeneral" class="topbar_td style3x" onclick="go(6,event)" onkeypress="if (event.key == 'Enter') go(6)">Obecné</td>
159
+ <td tabindex="0" id="ServerStats" class="topbar_td style3x" onclick="go(40,event)" onkeypress="if (event.key == 'Enter') go(40)">Statistiky</td>
160
+ <td tabindex="0" id="ServerConsole" class="topbar_td style3x" onclick="go(115,event)" onkeypress="if (event.key == 'Enter') go(115)">Konzole</td>
161
+ <td tabindex="0" id="ServerTrace" class="topbar_td style3x" onclick="go(41,event)" onkeypress="if (event.key == 'Enter') go(41)">Trace</td>
162
+ <td tabindex="0" id="ServerPlugins" class="topbar_td style3x" onclick="go(42,event)" onkeypress="if (event.key == 'Enter') go(42)">Pluginy</td>
163
+ <td class="topbar_td_end style3"> </td>
164
+ </tr>
165
+ </tbody></table>
166
+ </div>
167
+ <div id="UserDummyMenuSpan">
168
+ <table id="UserDummyMenu" cellpadding="0" cellspacing="0" class="style1">
169
+ <tbody><tr><td class="style3" style=""> </td></tr>
170
+ </tbody></table>
171
+ </div>
172
+ </div>
173
+ </div>
174
+ </div>
175
+ <div id="column_l">
176
+ <div id="p0" style="display:none">
177
+ <div id="p0message"><span id="p0span">Server disconnected</span>, <href onclick="reload()" style="cursor:pointer"><u>klikni pro opětovné připojení</u></href>.</div>
178
+ </div>
179
+ <div id="p1" style="display:none">
180
+ <div style="display:none" id="devListToolbarViewIcons">
181
+ <div tabindex="0" id="devViewButton1" class="viewSelector" onclick="onDeviceViewChange(1)" onkeypress="if (event.key == 'Enter') { onDeviceViewChange(1); }" title="Buňky"><div class="viewSelector2"></div></div>
182
+ <div tabindex="0" id="devViewButton2" class="viewSelector" onclick="onDeviceViewChange(2)" onkeypress="if (event.key == 'Enter') { onDeviceViewChange(2); }" title="List"><div class="viewSelector1"></div></div>
183
+ <div tabindex="0" id="devViewButton3" class="viewSelector" onclick="onDeviceViewChange(3)" onkeypress="if (event.key == 'Enter') { onDeviceViewChange(3); }" title="Desktopy"><div class="viewSelector3"></div></div>
184
+ <div tabindex="0" id="devViewButton4" class="viewSelector" onclick="onDeviceViewChange(4)" onkeypress="if (event.key == 'Enter') { onDeviceViewChange(4); }" title="Mapa"><div class="viewSelector4"></div></div>
185
+ </div><div><h1>Moje zařízení</h1></div>
186
+ <table id="devListToolbarSpan" class="noselect">
187
+ <tbody><tr>
188
+ <td class="h1"></td>
189
+ <td id="devListToolbar" class="style14" style="display:none">
190
+ <input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Vybrat vše">
191
+ <input type="button" id="GroupActionButton" disabled="disabled" value="Akce skupiny" onclick="groupActionFunction()">
192
+ <input id="SearchInput" type="text" placeholder="Filtr" onchange="masterUpdate(5)" onkeyup="masterUpdate(5)" autocomplete="off" onfocus="onSearchFocus(1)" onblur="onSearchFocus(0)">
193
+ <label><input type="checkbox" id="RealNameCheckBox" onclick="onRealNameCheckBox()"><span title="Show devices operating system name">Jméno operačního systému</span></label>
194
+ </td>
195
+ <td id="kvmListToolbar" class="style14" style="display:none">
196
+ <input type="button" onclick="connectAllKvmFunction()" value="Connect All">
197
+ <input type="button" onclick="disconnectAllKvmFunction()" value="Disconnect All">
198
+ <label><input type="checkbox" id="autoConnectDesktopCheckbox" onclick="autoConnectDesktops(event)" title="Automatic connect">Auto </label>
199
+ <input type="button" onclick="showMultiDesktopSettings()" value="Nastavení">
200
+ </td>
201
+ <td id="devMapToolbar" class="style14" style="display:none">
202
+ <input type="text" id="mapSearchLocation" placeholder="Search Location" onfocus="onMapSearchFocus(1)" onblur="onMapSearchFocus(0)">
203
+ <input type="button" value="Search" title="Search for location" onclick="getSearchLocation()">
204
+ <input type="button" id="refreshmap" title="Reset map view" value="Reset" onclick="refreshMap(false,true)">
205
+ </td>
206
+ <td class="auto-style1" style="height:100%">
207
+ <div style="display:none" id="devListToolbarView">
208
+ View
209
+ <select id="viewselect" onchange="onDeviceViewChange()">
210
+ <option value="1">Buňky</option>
211
+ <option value="2">List</option>
212
+ <option value="3">Desktopy</option>
213
+ <option id="viewselectmapoption" value="4">Mapa</option>
214
+ </select>
215
+ </div>
216
+ <div style="display:none" id="devListToolbarSort">
217
+ Třídit
218
+ <select id="sortselect" onchange="masterUpdate(6)">
219
+ <option>Skupina</option>
220
+ <option>Napájení</option>
221
+ <option>Zařízení</option>
222
+ <option>Tagy</option>
223
+ </select>
224
+
225
+ </div>
226
+ <div style="display:none" id="devListToolbarSize">
227
+ Velikost
228
+ <select id="sizeselect" onchange="onDeviceViewChange()">
229
+ <option value="0">Malé</option>
230
+ <option value="1">Středně</option>
231
+ <option value="2">Velký</option>
232
+ </select>
233
+
234
+ </div>
235
+ </td>
236
+ <td class="h2"></td>
237
+ </tr>
238
+ </tbody></table>
239
+ <div id="NoMeshesPanel" style="display:none">
240
+ <table>
241
+ <tbody><tr>
242
+ <td valign="top" style="width: 50px">
243
+ <img src="images/info.png">
244
+ </td>
245
+ <td>
246
+ <div id="getStarted1">To get started, <a href="#" onclick="return account_createMesh()"><strong>click here to create a device group</strong></a>.</div>
247
+ <div id="getStarted2">No device groups.</div>
248
+ </td>
249
+ </tr>
250
+ </tbody></table>
251
+ </div>
252
+ <div id="xdevices" class="noselect" style="display:none"></div>
253
+ <div id="xdevicesmap" style="display:none">
254
+ <div id="xmapSearchResultsDlg" style="display:none">
255
+ <div id="xmapSearchResultsBck">
256
+ <div id="xmapSearchClose" onclick="mapCloseSearchWindow()"><b>X</b></div>
257
+ <div style="padding:5px">Location Results</div>
258
+ <div style="width:100%;margin:6px"></div>
259
+ </div>
260
+ <div id="xmapSearchResults" style="margin:6px"></div>
261
+ </div>
262
+ </div>
263
+ <div id="xmap-info-window"></div>
264
+ </div>
265
+ <div id="p2" style="display:none">
266
+ <h1>Můj účet</h1>
267
+ <img id="p2AccountImage" alt="" src="images/clipboard-128.png">
268
+ <div id="p2AccountSecurity" style="display:none">
269
+ <p><strong>Nastavení bezpečnosti</strong></p>
270
+ <div style="margin-left:25px">
271
+ <div id="manageAuthApp"><div class="p2AccountActions"><span id="authAppSetupCheck"><strong>✓</strong></span></div><span><a href="#" onclick="return account_manageAuthApp()">Manage authenticator app</a><br></span></div>
272
+ <div id="manageHardwareOtp"><div class="p2AccountActions"><span id="authKeySetupCheck"><strong>✓</strong></span></div><span><a href="#" onclick="return account_manageHardwareOtp(0)">Manage security keys</a><br></span></div>
273
+ <div id="manageOtp"><div class="p2AccountActions"><span id="authCodesSetupCheck"><strong>✓</strong></span></div><span><a href="#" onclick="return account_manageOtp(0)">Manage backup codes</a><br></span></div>
274
+ </div>
275
+ </div>
276
+ <div id="p2AccountActions">
277
+ <p><strong>Account actions</strong></p>
278
+ <p class="mL">
279
+ <span id="verifyEmailId" style="display:none"><a href="#" onclick="return account_showVerifyEmail()">Verify email</a><br></span>
280
+ <span id="accountEnableNotificationsSpan" style="display:none"><a href="#" onclick="return account_enableNotifications()">Zapnout notifikace prohlížeče</a><br></span>
281
+ <a href="#" onclick="return account_showLocalizationSettings()">Localization Settings</a><br>
282
+ <a href="#" onclick="return account_showAccountNotifySettings()">Notification Settings</a><br>
283
+ <span id="accountChangeEmailAddressSpan" style="display:none"><a href="#" onclick="return account_showChangeEmail()">Change email address</a><br></span>
284
+ <a href="#" onclick="return account_showChangePassword()">Změnit heslo</a><span id="p2nextPasswordUpdateTime"></span><br>
285
+ <a href="#" onclick="return account_showDeleteAccount()">Smazat účet</a><br>
286
+ </p>
287
+ <br style="clear:both">
288
+ </div>
289
+ <strong>Device Groups</strong>
290
+ <span id="p2createMeshLink1">( <a href="#" onclick="return account_createMesh()" class="newMeshBtn"> New</a> )</span>
291
+ <br><br>
292
+ <div id="p2meshes"></div>
293
+ <div id="p2noMeshFound" style="display:none">No device groups.<span id="p2createMeshLink2"> <a href="#" onclick="return account_createMesh()"><strong>Get started here!</strong></a></span></div>
294
+ <br style="clear:both">
295
+ </div>
296
+ <div id="p3" style="display:none">
297
+ <h1>Moje události</h1>
298
+ <table class="pTable">
299
+ <tbody><tr>
300
+ <td class="h1"></td>
301
+ <td class="auto-style1">
302
+ Zobrazit
303
+ <select id="p3limitdropdown" onchange="refreshEvents()">
304
+ <option value="60">Posledních 60</option>
305
+ <option value="120">Posledních 120</option>
306
+ <option value="250">Posledních 250</option>
307
+ <option value="500">Posledních 500</option>
308
+ <option value="1000">Posledních 1000</option>
309
+ </select>
310
+ <a href="#" onclick="p3showDownloadEventsDialog(2)"><img src="images/link4.png" height="10" width="10" title="Download Events" style="cursor:pointer"></a>
311
+ </td>
312
+ <td class="h2"></td>
313
+ </tr>
314
+ </tbody></table>
315
+ <div id="p3events" style=""></div>
316
+ </div>
317
+ <div id="p4" style="display:none">
318
+ <h1>Uživatelé</h1>
319
+ <table class="pTable">
320
+ <tbody><tr>
321
+ <td class="h1"></td>
322
+ <td class="style14">
323
+ <div style="float:right">
324
+ <input type="button" onclick="showUserBroadcastDialog()" style="margin-right:6px" value="Broadcast">
325
+ <a href="#" onclick="p4downloadUserInfo()"><img style="cursor:pointer" title="Download user information" src="images/link4.png"></a>
326
+ <a href="#" onclick="p4batchAccountCreate()"><img id="p4UserBatchCreate" style="cursor:pointer;display:none" title="Batch create many user accounts" src="images/link6.png"></a>
327
+ </div>
328
+ <div>
329
+ <input id="UserNewAccountButton" type="button" style="margin-left:6px" onclick="showCreateNewAccountDialog()" value="Nový účet...">
330
+ <input id="UserSearchInput" type="text" style="width:120px;margin-left:6px" placeholder="Filtr" onchange="onUserSearchInputChanged()" onkeyup="onUserSearchInputChanged()" autocomplete="off" onfocus="onUserSearchFocus(1)" onblur="onUserSearchFocus(0)">
331
+ </div>
332
+ </td>
333
+ <td class="h2"></td>
334
+ </tr>
335
+ </tbody></table>
336
+ <div id="p3users"></div>
337
+ </div>
338
+ <div id="p5" style="display:none">
339
+ <h1>Moje soubory</h1>
340
+ <table id="p5toolbar" cellpadding="0" cellspacing="0">
341
+ <tbody><tr>
342
+ <td id="p5filehead" valign="bottom">
343
+ <div id="p5rightOfButtons"></div>
344
+ <div>
345
+ <input type="button" id="p5FolderUp" disabled="disabled" onclick="return p5folderup();" value="Nahoru">
346
+ <input type="button" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile();" value="Vybrat vše">
347
+ <input type="button" id="p5RenameFileButton" disabled="disabled" value="Přejmenovat" onclick="p5renamefile();">
348
+ <input type="button" id="p5DeleteFileButton" disabled="disabled" value="Smazat" onclick="p5deletefile();">
349
+ <!--<input type=button id=p5ViewFileButton disabled="disabled" value="View" onclick="p5viewfile()" /> -->
350
+ <input type="button" id="p5NewFolderButton" disabled="disabled" value="Nový adresář" onclick="p5createfolder();">
351
+ <input type="button" id="p5UploadButton" disabled="disabled" value="Nahrát" onclick="p5uploadFile()">
352
+ <input type="button" id="p5CutButton" disabled="disabled" value="Vyjmout" onclick="p5copyFile(1)">
353
+ <input type="button" id="p5CopyButton" disabled="disabled" value="Kopírovat" onclick="p5copyFile(0)">
354
+ <input type="button" id="p5PasteButton" disabled="disabled" value="Vložit" onclick="p5pasteFile()">
355
+ </div>
356
+ </td>
357
+ </tr>
358
+ <tr>
359
+ <td id="p5filesubhead">
360
+ <div style="float:right">
361
+ <select id="p5sortdropdown" onchange="updateFiles()">
362
+ <option value="1" selected="selected">Třídit podle jména</option>
363
+ <option value="2">Třídit podle velikosti</option>
364
+ <option value="3">Sort by date</option>
365
+ <option value="4">Descend by name</option>
366
+ <option value="5">Descend by size</option>
367
+ <option value="6">Descend by date</option>
368
+ </select>
369
+ </div>
370
+ <div> <span id="p5currentpath"></span></div>
371
+ </td>
372
+ </tr>
373
+ </tbody></table>
374
+ <div id="p5filetable">
375
+ <!--
376
+ <form id=p5fileCatchAll method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame>
377
+ <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)" />
378
+ <input id=p5fileDragLink2 name="link" style="display:none" />
379
+ <input type=submit id=p5fileCatchAllSubmit style="display:none" />
380
+ </form>
381
+ -->
382
+ <div id="p5PublicShare" style=""><div>These files are shared publicly, click "link" to get public url.</div></div>
383
+ <div id="bigok" style="display:none"><b>✓</b></div>
384
+ <div id="bigfail" style="display:none"><b>✗</b></div>
385
+ <span id="p5files"></span>
386
+ </div>
387
+ <table id="p5toolbarBottom" style="width:100%" cellpadding="0" cellspacing="0">
388
+ <tbody><tr><td class="style6"> <span id="p5bottomstatus"></span></td></tr>
389
+ </tbody></table>
390
+ </div>
391
+ <div id="p6" style="display:none">
392
+ <img id="MainMeshImage" src="serverpic.ashx">
393
+ <h1>Můj server</h1>
394
+ <div id="p2ServerActions">
395
+ <p><strong>Server actions</strong></p>
396
+ <div class="mL">
397
+ <div id="p2ServerActionsBackup"><a href="{{{domainurl}}}backup.zip" rel="noreferrer noopener" target="_blank">Download server backup</a></div>
398
+ <div id="p2ServerActionsRestore"><a href="#" onclick="return server_showRestoreDlg()">Restore server with backup</a></div>
399
+ <div id="p2ServerActionsVersion"><a href="#" onclick="return server_showVersionDlg()">Zkontrolovat verzi serveru</a></div>
400
+ <div id="p2ServerActionsErrors"><a href="#" onclick="return server_showErrorsDlg()">Zobrazit chyby serveru</a></div>
401
+ </div>
402
+ </div>
403
+ <br><strong>Statistiky serveru</strong><br><br>
404
+ <div id="serverStats">
405
+ <div id="serverCpuChartView" style="display:none">
406
+ <div class="chartViewCanvas"><canvas id="serverCpuChart"></canvas></div>
407
+ <div class="chartViewText" id="serverCpuChartText"></div>
408
+ </div>
409
+ <div id="serverMemoryChartView" style="display:none">
410
+ <div class="chartViewCanvas"><canvas id="serverMemoryChart"></canvas></div>
411
+ <div class="chartViewText" id="serverMemoryChartText"></div>
412
+ </div><br><br>
413
+ <div id="serverStatsTable"></div>
414
+ </div>
415
+ <div id="serverWarningsDiv" style="display:none">
416
+ <br><strong>Server Warnings</strong><br><br>
417
+ <div id="serverWarnings"></div>
418
+ </div>
419
+ </div>
420
+ <div id="p10" style="display:none">
421
+ <table style="width:100%" cellpadding="0" cellspacing="0">
422
+ <tbody><tr>
423
+ <td style="width:auto" valign="top">
424
+ <div id="p10title">
425
+ <div id="p10BackButton"><div class="backButton" tabindex="0" onclick="goBack()" title="Zpět" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
426
+ <h1>Obecné - <span id="p10deviceName"></span></h1>
427
+ </div>
428
+ <div id="p10html"></div>
429
+ </td>
430
+ <td style="width:20px"></td>
431
+ <td style="width:200px">
432
+ <a href="#" onclick="p10showiconselector()"><img id="MainComputerImage"></a>
433
+ <div id="MainComputerState"></div>
434
+ </td>
435
+ </tr>
436
+ </tbody></table><br>
437
+ <div id="p10html2"></div>
438
+ <div id="p10html3"></div>
439
+ </div>
440
+ <div id="p11" class="noselect" style="display:none">
441
+ <div id="p11title">
442
+ <div id="p11deviceNameHeader">
443
+ <div id="p11BackButton"><div class="backButton" tabindex="0" onclick="goBack()" title="Zpět" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
444
+ <div id="devListToolbarViewIcons"><div class="viewSelector" onclick="deskToggleFull(event)" title="Full Screen. Hold shift to browser full screen."><div class="viewSelector5"></div></div></div>
445
+ <h1>Desktop - <span id="p11deviceName"></span></h1>
446
+ </div>
447
+ </div>
448
+ <div id="p11warning" onclick="showFeaturesDlg()">
449
+ <div class="icon2"></div>
450
+ <div class="warningbox">Intel® AMT Redirection port or KVM feature is disabled<span id="p11warninga">, zde kliknout pro aktivaci.</span></div>
451
+ </div>
452
+ <div id="p11warning2" onclick="showPowerActionDlg()">
453
+ <div class="icon2"></div>
454
+ <div class="warningbox">Vzdálený počítač není zapnutý, klikněte zde pro zapnutí.</div>
455
+ </div>
456
+ <div id="deskarea0" cellpadding="0" cellspacing="0">
457
+ <div id="deskarea1" class="areaHead">
458
+ <div class="toright2">
459
+ <span id="p11power"></span>
460
+ <div class="deskareaicon" title="Toggle View Mode" onclick="toggleAspectRatio(1)">⇲</div>
461
+ <div class="deskareaicon" title="Rotate Left" onclick="drotate(-1)">↺</div>
462
+ <div class="deskareaicon" title="Rotate Right" onclick="drotate(1)">↻</div>
463
+ <div id="deskRecordIcon" class="deskareaicon" title="Server is recording this session" style="display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px"></div>
464
+ <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">
465
+ <input id="deskSaveBtn" type="button" title="Uložit screenshot vzdáleného počítače" onkeypress="return false" onkeydown="return false" value="Save..." onclick="deskSaveImage()" class="mR">
466
+ <input id="deskActionsBtn" type="button" title="Akce napájení" onkeypress="return false" onkeydown="return false" value="Akce" onclick="deviceActionFunction()" class="mR">
467
+ <input id="deskActionsSettings" type="button" value="Nastavení..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()" class="mR">
468
+ <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Akce napájení" onclick="showPowerActionDlg()" style="display:none">
469
+ </div>
470
+ <div>
471
+ <div id="idx_deskFullBtn2" onclick="deskToggleFull(event)"> ✖</div>
472
+ <input type="button" id="autoconnectbutton1" value="AutoConnect" onclick="autoConnectDesktop(event)" onkeypress="return false" onkeydown="return false" style="display:none">
473
+ <span id="connectbutton1span"><input type="button" id="connectbutton1" value="Připojit" onclick="connectDesktop(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
474
+ <span id="connectbutton1hspan"> <input type="button" id="connectbutton1h" value="HW Connect" title="Connect using Intel AMT hardware KVM" onclick="connectDesktop(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
475
+ <span id="disconnectbutton1span"> <input type="button" id="disconnectbutton1" value="Disconnect" onclick="connectDesktop(event,0)" onkeypress="return false" onkeydown="return false"></span>
476
+ <span id="deskstatus">Odpojeno</span>
477
+ </div>
478
+ </div>
479
+ <div id="deskarea2" style="">
480
+ <div class="areaProgress"><div id="progressbar" style=""></div></div>
481
+ </div>
482
+ <div id="deskarea3x">
483
+ <div id="DeskFocus" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)"></div>
484
+ <div id="DeskParent">
485
+ <canvas id="Desk" width="640" height="480" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)" onmousewheel="dmousewheel(event)"></canvas>
486
+ </div>
487
+ <div id="DeskTools">
488
+ <div id="deskToolsAreaTop">
489
+ <a id="DeskToolsRefreshButton" style="right:2px" onclick="refreshDeskTools()">Obnovit</a>
490
+ <div id="deskToolsTopTabProcess" class="deskToolsTopTab" onclick="changeDeskToolTab(0)" style="left:0px;bottom:0px">Procesy</div>
491
+ <div id="deskToolsTopTabService" class="deskToolsTopTab" onclick="changeDeskToolTab(1)" style="display:none;left:90px;color:gray">Služby</div>
492
+ </div>
493
+ <div id="deskToolsArea">
494
+ <div id="DeskToolsProcessTab">
495
+ <div id="deskToolsHeader">
496
+ <a class="colmn1" title="Sort by process id" onclick="sortProcess(0)">PID</a>
497
+ <a class="colmn2" title="Třídit podle jména" onclick="sortProcess(1)">Jméno</a>
498
+ </div>
499
+ <div id="DeskToolsProcesses" style=""></div>
500
+ </div>
501
+ <div id="DeskToolsServiceTab" style="display:none">
502
+ <div id="deskToolsServiceHeader">
503
+ <a class="colmn1" style="width:70px" title="Třídit podle stavu" onclick="sortService(0)">Stav</a>
504
+ <a class="colmn2" title="Třídit podle jména" onclick="sortService(1)">Jméno</a>
505
+ </div>
506
+ <div id="DeskToolsServices" style=""></div>
507
+ </div>
508
+ </div>
509
+ </div>
510
+ <div id="p11DeskConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p11clearConsoleMsg()"></div>
511
+ </div>
512
+ <div id="deskarea4" class="areaFoot">
513
+ <div class="toright2">
514
+ <span id="DeskTimer" title="Session time"></span>
515
+ <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onkeypress="return false" onkeydown="return false"></select>
516
+ <input id="DeskToolsButton" type="button" value="Nástroje" title="Přepnout zobrazení nástrojů" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()">
517
+ <span id="DeskChatButton" class="deskarea" title="Open chat window to this computer"><img src="images/icon-chat.png" onclick="deviceChat(event)" height="16" width="16" style="padding-top:2px"></span>
518
+ <span id="DeskNotifyButton" 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>
519
+ <span id="DeskOpenWebButton" title="Open a web address on the remote computer"><img src="images/icon-url2.png" onclick="deviceUrlFunction()" height="16" width="16" style="padding-top:2px"></span>
520
+ <span id="DeskBackgroundButton" title="Toggle remote desktop background"><img src="images/icon-background.png" onclick="deviceToggleBackground(event)" height="16" width="16" style="padding-top:2px"></span>
521
+ </div>
522
+ <div>
523
+ <select id="deskkeys">
524
+ <option value="10">Ctrl+Alt+Del</option>
525
+ <option value="5">Win</option>
526
+ <option value="0">Win+Down</option>
527
+ <option value="1">Win+Up</option>
528
+ <option value="2">Win+L</option>
529
+ <option value="3">Win+M</option>
530
+ <option value="4">Shift+Win+M</option>
531
+ <option value="6">Win+R</option>
532
+ <option value="7">Alt-F4</option>
533
+ <option value="8">Ctrl-W</option>
534
+ <option value="9">Alt-Tab</option>
535
+ <option value="11">Win+Left</option>
536
+ <option value="12">Win+Right</option>
537
+ </select>
538
+ <input id="DeskWD" type="button" value="Odeslat" onkeypress="return false" onkeydown="return false" onclick="deskSendKeys()">
539
+ <input id="DeskClip" style="" type="button" value="Clipboard" onkeypress="return false" onkeydown="return false" onclick="showDeskClip()">
540
+ <input id="DeskType" style="" type="button" value="Typ" onkeypress="return false" onkeydown="return false" onclick="showDeskType()">
541
+ <label><span id="DeskControlSpan" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false" onclick="toggleKvmControl()">Vstup</span></label>
542
+ </div>
543
+ </div>
544
+ </div>
545
+ </div>
546
+ <div id="p12" style="display:none">
547
+ <div id="p12title">
548
+ <div id="p12BackButton"><div class="backButton" tabindex="0" onclick="goBack()" title="Zpět" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
549
+ <h1>Terminal - <span id="p12deviceName"></span></h1>
550
+ </div>
551
+ <div id="p12warning" onclick="showFeaturesDlg()">
552
+ <div class="icon2"></div>
553
+ <div class="warningbox">Intel® AMT Redirection port or KVM feature is disabled<span id="p12warninga">, zde kliknout pro aktivaci.</span></div>
554
+ </div>
555
+ <div id="p12warning2" onclick="showPowerActionDlg()">
556
+ <div class="icon2"></div>
557
+ <div class="warningbox">Vzdálený počítač není zapnutý, klikněte zde pro zapnutí.</div>
558
+ </div>
559
+ <div id="termTable" style="position:relative">
560
+ <table style="width:100%" cellpadding="0" cellspacing="0">
561
+ <tbody><tr>
562
+ <td class="areaHead">
563
+ <div class="toright2">
564
+ <div id="termRecordIcon" class="deskareaicon" title="Server is recording this session" style="display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-left:5px"></div>
565
+ <input id="termActionsBtn" type="button" title="Akce napájení" onkeypress="return false" onkeydown="return false" value="Akce" onclick="deviceActionFunction()">
566
+ </div>
567
+ <div>
568
+ <input type="button" id="autoconnectbutton2" value="AutoConnect" onclick="autoConnectTerminal(event)" onkeypress="return false" onkeydown="return false" style="display:none">
569
+ <span id="connectbutton2span"><input type="button" id="connectbutton2" value="Připojit" onclick="connectTerminal(event,1)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
570
+ <span id="connectbutton2hspan"> <input type="button" id="connectbutton2h" value="HW Connect" title="Connect using Intel AMT hardware KVM" onclick="connectTerminal(event,2)" onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
571
+ <span id="disconnectbutton2span"> <input type="button" id="disconnectbutton2" value="Disconnect" onclick="connectTerminal(event,0)" onkeypress="return false" onkeydown="return false"></span>
572
+ <span id="termstatus">Odpojeno</span><span id="termtitle"></span>
573
+ </div>
574
+ </td>
575
+ </tr>
576
+ <tr>
577
+ <td>
578
+ <div class="areaProgress"><div id="termprogressbar" style=""></div></div>
579
+ </td>
580
+ </tr>
581
+ <tr>
582
+ <td id="termarea3x">
583
+ <pre id="Term"></pre>
584
+ </td>
585
+ </tr>
586
+ <tr>
587
+ <td class="areaFoot">
588
+ <div class="toright2">
589
+ <span id="TermTimer" title="Session time"></span>
590
+ <span id="terminalSettingsButtons" style="display:none">
591
+ <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()">
592
+ <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()">
593
+ <input id="id_ttypebutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Extended Ascii" title="Toggle terminal emulation type" onclick="termToggleType()">
594
+ </span>
595
+ <span id="terminalSizeDropDown">
596
+ <select id="termSizeList" onkeypress="return false"><option value="1">80x25</option><option value="2">100x30</option><option value="3" selected="">Auto</option></select>
597
+ </span>
598
+ <select id="specialkeylist" onkeypress="return false"></select>
599
+ <input id="specialkeylistinput" type="button" onkeypress="return false" class="bottombutton" value="Odeslat" title="Send the selected special key" onclick="sendSpecialKey()">
600
+ </div>
601
+ <div>
602
+
603
+ <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlcbutton" value="Ctl-C" onclick="termSendKey(3,'ctrlcbutton')">
604
+ <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="ctrlxbutton" value="Ctl-X" onclick="termSendKey(24,'ctrlxbutton')">
605
+ <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="escbutton" value="ESC" onclick="termSendKey(27,'escbutton')">
606
+ <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="bsbutton" value="Backspace" onclick="termSendKey(8,'bsbutton')">
607
+ <input type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" id="pastebutton" value="Vložit" title="Paste text into the terminal" onclick="showTermPasteDialog()">
608
+ </div>
609
+ </td>
610
+ </tr>
611
+ </tbody></table>
612
+ <div id="p12TermConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:45px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p12clearConsoleMsg()"></div>
613
+ </div>
614
+ </div>
615
+ <div id="p13" style="display:none">
616
+ <div id="p13title">
617
+ <div id="p13BackButton" style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Zpět" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
618
+ <h1>Soubory - <span id="p13deviceName"></span></h1>
619
+ </div>
620
+ <table id="p13toolbar" cellpadding="0" cellspacing="0">
621
+ <tbody><tr>
622
+ <td class="areaHead">
623
+ <div class="toright2">
624
+ <input id="filesActionsBtn" type="button" title="Akce napájení" value="Akce" onclick="deviceActionFunction()">
625
+ <div id="filesRecordIcon" class="deskareaicon" title="Server is recording this session" style="display:none;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-left:5px"></div>
626
+ </div>
627
+ <div>
628
+ <input id="p13AutoConnect" value="AutoConnect" onclick="autoConnectFiles(event)" type="button" style="display:none">
629
+ <input id="p13Connect" value="Připojit" onclick="connectFiles(event)" type="button">
630
+ <span id="p13Status">Odpojeno</span>
631
+ </div>
632
+ </td>
633
+ </tr>
634
+ <tr>
635
+ <td class="areaHead2" valign="bottom">
636
+ <div id="p13rightOfButtons" class="toright2"></div>
637
+ <div>
638
+ <input type="button" id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Nahoru">
639
+ <input type="button" id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="Vybrat vše">
640
+ <input type="button" id="p13RenameFileButton" disabled="disabled" value="Přejmenovat" onclick="p13renamefile()">
641
+ <input type="button" id="p13DeleteFileButton" disabled="disabled" value="Smazat" onclick="p13deletefile()">
642
+ <input type="button" id="p13ViewFileButton" disabled="disabled" value="Edit" onclick="p13viewfile()">
643
+ <input type="button" id="p13NewFolderButton" disabled="disabled" value="Nový adresář" onclick="p13createfolder()">
644
+ <input type="button" id="p13UploadButton" disabled="disabled" value="Nahrát" onclick="p13uploadFile()">
645
+ <input type="button" id="p13CutButton" disabled="disabled" value="Vyjmout" onclick="p13copyFile(1)">
646
+ <input type="button" id="p13CopyButton" disabled="disabled" value="Kopírovat" onclick="p13copyFile(0)">
647
+ <input type="button" id="p13PasteButton" disabled="disabled" value="Vložit" onclick="p13pasteFile()">
648
+ <input type="button" id="p13RefreshButton" disabled="disabled" value="Obnovit" onclick="p13folderup(9999)">
649
+ </div>
650
+ </td>
651
+ </tr>
652
+ <tr>
653
+ <td class="areaHead3">
654
+ <div class="toright2">
655
+ <select id="p13sortdropdown" onchange="p13updateFiles()">
656
+ <option value="1" selected="selected">Třídit podle jména</option>
657
+ <option value="2">Třídit podle velikosti</option>
658
+ <option value="3">Sort by date</option>
659
+ <option value="4">Descend by name</option>
660
+ <option value="5">Descend by size</option>
661
+ <option value="6">Descend by date</option>
662
+ </select>
663
+ </div>
664
+ <div> <span id="p13currentpath"></span></div>
665
+ </td>
666
+ </tr>
667
+ </tbody></table>
668
+ <div id="p13FilesConsoleMsg" style="display:none;cursor:pointer;position:absolute;left:30px;top:165px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick="p13clearConsoleMsg()"></div>
669
+ <div id="p13filetable" style="">
670
+ <div id="p13bigok" style="display:none"><b>✓</b></div>
671
+ <div id="p13bigfail" style="display:none"><b>✗</b></div>
672
+ <span id="p13files"></span>
673
+ </div>
674
+ <table id="p13toolbarBottom" cellpadding="0" cellspacing="0">
675
+ <tbody><tr><td class="style6"> <span id="p13bottomstatus"></span></td></tr>
676
+ </tbody></table>
677
+ </div>
678
+ <div id="p14" style="display:none">
679
+ <div id="p14title">
680
+ <div id="p14BackButton" style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Zpět" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
681
+ <div id="devListToolbarViewIcons"><div class="viewSelector" onclick="deskToggleFull(event)" title="Full Screen. Hold shift to browser full screen."><div class="viewSelector5"></div></div></div>
682
+ <h1>Intel® AMT - <span id="p14deviceName"></span></h1>
683
+ </div>
684
+ <iframe id="p14iframe" src="{{{domainurl}}}commander.htm"></iframe>
685
+ </div>
686
+ <div id="p15" style="display:none">
687
+ <div id="p15title">
688
+ <div id="p15BackButton" style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Zpět" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
689
+ <h1><span id="p15deviceName"></span></h1>
690
+ </div>
691
+ <table id="consoleTable" cellpadding="0" cellspacing="0">
692
+ <tbody><tr>
693
+ <td class="areaHead">
694
+ <div class="toright2">
695
+ <div id="p15coreName" title="Information about current core running on this agent"></div>
696
+ <input type="button" id="p15uploadCore" value="Agent Action" onclick="p15uploadCore(event)" title="Change the agent Java Script code module">
697
+ <img onclick="p15downloadConsoleText()" style="cursor:pointer;margin-top:6px" title="Download console text" src="images/link4.png">
698
+ </div>
699
+ <div id="p15statetext"></div>
700
+ </td>
701
+ </tr>
702
+ <tr>
703
+ <td>
704
+ <div class="areaProgress"><div id="consoleprogressbar" style=""></div></div>
705
+ </td>
706
+ </tr>
707
+ <tr>
708
+ <td id="p15agentConsole">
709
+ <pre id="p15agentConsoleText"></pre>
710
+ </td>
711
+ </tr>
712
+ <tr>
713
+ <td class="areaFoot">
714
+ <table style="width:100%">
715
+ <tbody><tr>
716
+ <td style="width:99%">
717
+ <input id="p15consoleText" style="width:100%" onkeyup="p15consoleSend(event)" onfocus="onConsoleFocus(1)" onblur="onConsoleFocus(0)">
718
+ </td>
719
+ <td> </td>
720
+ <td id="p15outputselecttd">
721
+ <select id="p15outputselect">
722
+ <option value="1">Agent</option>
723
+ <option value="2">MQTT</option>
724
+ </select>
725
+ </td>
726
+ <td style="width:1%"><input id="id_p15consoleClear" type="button" class="bottombutton" value="Clear" onclick="p15consoleClear()"></td>
727
+ </tr>
728
+ </tbody></table>
729
+ </td>
730
+ </tr>
731
+ </tbody></table>
732
+ </div>
733
+ <div id="p16" style="display:none">
734
+ <div id="p16title">
735
+ <div id="p16BackButton" style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Zpět" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
736
+ <h1>Events - <span id="p16deviceName"></span></h1>
737
+ </div>
738
+ <table class="pTable">
739
+ <tbody><tr>
740
+ <td class="h1"></td>
741
+ <!--<td> <input type=button onclick=refreshDeviceEvents() value="Refresh" /></td>-->
742
+ <td class="auto-style1">
743
+ Zobrazit
744
+ <select id="p16limitdropdown" onchange="refreshDeviceEvents()">
745
+ <option value="60">Posledních 60</option>
746
+ <option value="120">Posledních 120</option>
747
+ <option value="250">Posledních 250</option>
748
+ <option value="500">Posledních 500</option>
749
+ <option value="1000">Posledních 1000</option>
750
+ </select>
751
+ <a href="#" onclick="p3showDownloadEventsDialog(1)"><img src="images/link4.png" height="10" width="10" title="Download Events" style="cursor:pointer"></a>
752
+ </td>
753
+ <td class="h2"></td>
754
+ </tr>
755
+ </tbody></table>
756
+ <div id="p16events"></div>
757
+ </div>
758
+ <div id="p17" style="display:none">
759
+ <div id="p17title">
760
+ <div id="p17BackButton" style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Zpět" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
761
+ <h1>Detaily - <span id="p17deviceName"></span></h1>
762
+ </div>
763
+ <div id="p17info"></div>
764
+ </div>
765
+ <div id="p20" style="display:none">
766
+ <picture id="MainMeshImage" style="border-width:0px;height:200px;width:200px;float:right">
767
+ <source type="image/webp" width="200" height="200" srcset="images/webp/mesh-256.webp">
768
+ <img alt="" width="200" height="200" src="images/mesh-256.png">
769
+ </picture>
770
+ <div style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Zpět" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
771
+ <h1>Obecné - <span id="p20meshName"></span></h1>
772
+ <p id="p20info"></p>
773
+ </div>
774
+ <div id="p30" style="display:none">
775
+ <table style="width:100%" cellpadding="0" cellspacing="0">
776
+ <tbody><tr>
777
+ <td style="width:auto" valign="top">
778
+ <div id="p30title">
779
+ <div style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Zpět" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
780
+ <h1>Obecné - <span id="p30userName"></span></h1>
781
+ </div>
782
+ <div id="p30html"></div>
783
+ </td>
784
+ <td style="width:20px"></td>
785
+ <td style="width:200px">
786
+ <picture id="MainUserImage" style="border-width:0px;height:200px;width:200px;float:right">
787
+ <source type="image/webp" width="200" height="200" srcset="images/webp/user-256.webp">
788
+ <img alt="" width="200" height="200" src="images/user-256.png">
789
+ </picture>
790
+ <div style="width:100%;text-align:center"><strong><span id="MainUserState"></span></strong></div>
791
+ </td>
792
+ </tr>
793
+ </tbody></table><br>
794
+ <div id="p30html2"></div>
795
+ <div id="p30html3"></div>
796
+ </div>
797
+ <div id="p31" style="display:none">
798
+ <div style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Zpět" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
799
+ <h1>Events - <span id="p31userName"></span></h1>
800
+ <table class="pTable">
801
+ <tbody><tr>
802
+ <td class="h1"></td>
803
+ <!--<td> <input type=button onclick=refreshUsersEvents() value="Refresh" /></td>-->
804
+ <td class="auto-style1">
805
+ Zobrazit
806
+ <select id="p31limitdropdown" onchange="refreshUsersEvents()">
807
+ <option value="60">Posledních 60</option>
808
+ <option value="120">Posledních 120</option>
809
+ <option value="250">Posledních 250</option>
810
+ <option value="500">Posledních 500</option>
811
+ <option value="1000">Posledních 1000</option>
812
+ </select>
813
+ <a href="#" onclick="p3showDownloadEventsDialog(3)"><img src="images/link4.png" height="10" width="10" title="Download Events" style="cursor:pointer"></a>
814
+ </td>
815
+ <td class="h2"></td>
816
+ </tr>
817
+ </tbody></table>
818
+ <div id="p31events" style=""></div>
819
+ </div>
820
+ <div id="p40" style="display:none">
821
+ <h1>Statistika serveru</h1>
822
+ <div class="areaHead">
823
+ <div class="toright2">
824
+ <select id="p40type" onchange="updateServerTimelineStats()">
825
+ <option value="0">Connections</option>
826
+ <option value="1">Paměť</option>
827
+ </select>
828
+ <select id="p40time" onchange="updateServerTimelineHours()">
829
+ <option value="3">Last 3 hours</option>
830
+ <option value="8">Posledních 8 hodin</option>
831
+ <option value="24">Poslední den</option>
832
+ <option value="168">Poslední týden</option>
833
+ <option value="720">Last 30 days</option>
834
+ </select>
835
+ <img src="images/link4.png" height="10" width="10" title="Download data points (.csv)" style="cursor:pointer" onclick="p40downloadEvents()">
836
+ </div>
837
+ <div>
838
+ <input value="Obnovit" type="button" onclick="refreshServerTimelineStats()">
839
+ <label><input id="p40log" type="checkbox" onclick="updateServerTimelineHours()">Log-X</label>
840
+ </div>
841
+ </div>
842
+ <canvas id="serverMainStats" style=""></canvas>
843
+ </div>
844
+ <div id="p41" style="display:none">
845
+ <h1>My Server Tracing</h1>
846
+ <div class="areaHead">
847
+ <div class="toright2">
848
+ Zobrazit
849
+ <select id="p41limitdropdown" onchange="displayServerTrace()">
850
+ <option value="100">Posledních 100</option>
851
+ <option value="250">Posledních 250</option>
852
+ <option value="500">Posledních 500</option>
853
+ <option value="1000">Posledních 1000</option>
854
+ </select>
855
+ <input value="Clear" type="button" onclick="clearServerTracing()">
856
+ <img src="images/link4.png" height="10" width="10" title="Download trace (.csv)" style="cursor:pointer" onclick="p41downloadServerTrace()">
857
+ </div>
858
+ <div>
859
+ <input value="Tracing" type="button" onclick="setServerTracing()">
860
+ <span id="p41traceStatus">Nic</span>
861
+ </div>
862
+ </div>
863
+ <div id="p41events" style=""></div>
864
+ </div>
865
+ <div id="p42" style="display:none">
866
+ <h1>My Server Plugins</h1>
867
+ <div class="areaHead">
868
+ <div class="toright2">
869
+ </div>
870
+ <div>
871
+ <input value="Download Plugin" type="button" onclick="return pluginHandler.addPluginDlg();">
872
+ </div>
873
+ </div>
874
+ <div id="pluginRestartNotice" class="areaHead" style="background-color:gold;display:none">
875
+ <div class="toright2">
876
+ <input value="Refresh Agent Cores" type="button" onclick="distributeCore();return false">
877
+ </div>
878
+ <div style="padding:2px">
879
+ <div style="padding:2px"><b>Notice:</b> Plugins have been altered, this may require agent core update.</div>
880
+ </div>
881
+ </div>
882
+ <table id="p42tbl">
883
+ <tbody><tr class="DevSt"><th style="width:26px"></th><th style="width:10px"></th><th class="chName">Jméno</th><th class="chDescription">Popis</th><th class="chSite" style="text-align:center">Link</th><th class="chVersion" style="text-align:center">Version</th><th class="chUpgradeAvail" style="text-align:center">Latest</th><th class="chStatus" style="text-align:center">Status</th><th class="chAction" style="text-align:center">Action</th><th style="width:10px"></th></tr>
884
+ </tbody></table>
885
+ <div id="pluginNoneNotice" style="width:100%;text-align:center;padding-top:10px;display:none"><i>No plugins on server.</i></div>
886
+ </div>
887
+ <div id="p43" style="display:none">
888
+ <div id="p43BackButton"><div class="backButton" tabindex="0" onclick="go(42)" title="Zpět" onkeypress="if (event.key == 'Enter') go(42)"><div class="backButtonEx"></div></div></div>
889
+ <h1>My Server Plugins - <span id="p43title"></span></h1>
890
+ <iframe id="p43iframe" frameborder="0" style="width:100%;height:calc(100vh - 245px);max-height:calc(100vh - 245px)"></iframe>
891
+ </div>
892
+ <div id="p19" style="display:none">
893
+ <h1>Pluginy - <span id="p19deviceName"></span></h1>
894
+ <style>
895
+ #p19headers {
896
+ padding-right: 7px;
897
+ padding-bottom: 10px;
898
+ font-weight: bold;
899
+ border-bottom: 1px dotted blue;
900
+ }
901
+
902
+ #p19headers > span:nth-child(n+2) {
903
+ border-left: 1px solid black;
904
+ }
905
+
906
+ #p19headers > span {
907
+ padding-left: 4px;
908
+ padding-right: 4px;
909
+ }
910
+ </style>
911
+ <div id="p19headers"></div>
912
+ <div id="p19pages"></div>
913
+ </div>
914
+ <br id="column_l_bottomgap">
915
+ </div>
916
+ <div id="footer">
917
+ <div class="footer1">{{{footer}}}</div>
918
+ <div class="footer2">
919
+ <a id="verifyEmailId2" style="display:none" href="#" onclick="account_showVerifyEmail()">Ověřit Email</a>
920
+ <a href="terms">Terms & Privacy</a>
921
+ </div>
922
+ </div>
923
+ <div id="dialog" class="noselect" style="display:none">
924
+ <div id="dialogHeader">
925
+ <div tabindex="0" id="id_dialogclose" onclick="setDialogMode()" onkeypress="if (event.key == 'Enter') setDialogMode()">✖</div>
926
+ <div id="id_dialogtitle"></div>
927
+ </div>
928
+ <div id="dialogBody">
929
+ <div id="dialog1">
930
+ <div id="id_dialogMessage" style=""></div>
931
+ </div>
932
+ <div id="dialog2" style="">
933
+ <div id="id_dialogOptions"></div>
934
+ </div>
935
+ <div id="dialog3" style="">
936
+ <div id="d3upload">
937
+ <div>File Selection</div>
938
+ <select id="d3uploadMode" onchange="d3modechange()">
939
+ <option value="1">Local file upload</option>
940
+ <option value="2">Server file selection</option>
941
+ </select>
942
+ </div>
943
+ <div id="d3localmode" style="display:none">
944
+ <div>Nahrát soubor</div>
945
+ <form id="d3localmodeform" method="post" enctype="multipart/form-data" action="uploadfile.ashx" target="fileUploadFrame">
946
+ <input type="text" id="d3auth" name="auth" style="display:none">
947
+ <input type="text" id="d3attrib" name="attrib" style="display:none">
948
+ <input type="file" id="d3localFile" name="files" onchange="d3setActions()">
949
+ <input type="submit" id="d3submit" style="display:none">
950
+ </form>
951
+ </div>
952
+ <div id="d3servermode">
953
+ <div id="d3serveraction" valign="bottom">
954
+ <input type="button" id="p3FolderUp" disabled="disabled" onclick="d3folderup()" value="Nahoru">
955
+ </div>
956
+ <div id="d3serverfiles"></div>
957
+ </div>
958
+ </div>
959
+ <div id="dialog7" style="">
960
+ <div id="d7meshkvm">
961
+ <h4>Agent Remote Desktop</h4>
962
+ <div>
963
+ <div>Kvalita</div>
964
+ <select id="d7bitmapquality" dir="rtl"></select>
965
+ </div>
966
+ <div>
967
+ <div>Škálování</div>
968
+ <select id="d7bitmapscaling" style="" dir="rtl">
969
+ <option selected="selected" value="1024">100%</option>
970
+ <option value="896">87.5%</option>
971
+ <option value="768">75%</option>
972
+ <option value="640">62.5%</option>
973
+ <option value="512">50%</option>
974
+ <option value="384">37.5%</option>
975
+ <option value="256">25%</option>
976
+ <option value="128">12.5%</option>
977
+ </select>
978
+ </div>
979
+ <div>
980
+ <div>Obnovování</div>
981
+ <select id="d7framelimiter" dir="rtl">
982
+ <option selected="selected" value="50">Rychle</option>
983
+ <option value="100">Středně</option>
984
+ <option value="400">Pomalu</option>
985
+ <option value="1000">Velmi pomalu</option>
986
+ </select>
987
+ </div>
988
+ </div>
989
+ <div id="d7amtkvm">
990
+ <h4>Intel® AMT Hardware KVM</h4>
991
+ <div>
992
+ <div>Kódovaní obrazu</div>
993
+ <select id="d7desktopmode">
994
+ <option value="1">RLE8, Fastest</option>
995
+ <option value="2">RLE16, Recommended</option>
996
+ <option value="3">RAW8, Slow</option>
997
+ <option value="4">RAW16, Very Slow</option>
998
+ </select>
999
+ </div>
1000
+ <div>
1001
+ <div>Other Settings</div>
1002
+ <div id="d7otherset" style="display:block">
1003
+ <label style="display:block"><input type="checkbox" id="d7showfocus">Show Focus Tool</label>
1004
+ <label style="display:block"><input type="checkbox" id="d7showcursor">Show Local Mouse Cursor</label>
1005
+ <label style="display:block"><input type="checkbox" id="d7localKeyMap">Local Keyboard Map</label>
1006
+ </div>
1007
+ </div>
1008
+ </div>
1009
+ </div>
1010
+ </div>
1011
+ <div id="idx_dlgButtonBar">
1012
+ <input id="idx_dlgCancelButton" type="button" value="Zrušit" style="" onclick="dialogclose(0)">
1013
+ <input id="idx_dlgOkButton" type="button" value="OK" style="" onclick="dialogclose(1)">
1014
+ <div><input id="idx_dlgDeleteButton" type="button" value="Smazat" style="display:none" onclick="dialogclose(2)"></div>
1015
+ </div>
1016
+ </div>
1017
+ <iframe name="fileUploadFrame" style="display:none"></iframe>
1018
+ <form style="display:none" method="post" action="uploadfile.ashx" enctype="multipart/form-data" target="fileUploadFrame"><input id="p5fileDragName" name="name"><input id="p5fileDragAuthCookie" name="auth"><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>
1019
+ <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>
1020
+ <audio id="chimes"><source src="sounds/chimes.mp3" type="audio/mp3"></audio>
1021
+ </div>
1022
+ <script type="text/javascript">
1023
+ 'use strict';
1024
+
1025
+ // Process server-side web state
1026
+ var webState = '{{{webstate}}}';
1027
+ if (webState != '') { webState = JSON.parse(decodeURIComponent(webState)); }
1028
+ for (var i in webState) { localStorage.setItem(i, webState[i]); }
1029
+ if (!webState.loctag) { delete localStorage.removeItem('loctag'); }
1030
+
1031
+ var args;
1032
+ var autoReconnect = true;
1033
+ var powerStatetable = ['', "Zapnuto", "Spánek", "Spánek", "Spánek", "Hibernating", "Vypnout", "Present"];
1034
+ var StatusStrs = ["Odpojeno", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"];
1035
+ var sort = 0;
1036
+ var searchFocus = 0;
1037
+ var mapSearchFocus = 0;
1038
+ var userSearchFocus = 0;
1039
+ var consoleFocus = 0;
1040
+ var showRealNames = false;
1041
+ var meshserver = null;
1042
+ var meshes = {};
1043
+ var meshcount = 0;
1044
+ var nodes = null;
1045
+ var filetree = {};
1046
+ var userinfo = null;
1047
+ var serverinfo = null;
1048
+ var events = [];
1049
+ var users = null;
1050
+ var wssessions = null;
1051
+ var nodeShortIdent = 0;
1052
+ var desktop;
1053
+ var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50, localkeymap: false };
1054
+ var multidesktopsettings = { quality: 20, scaling: 128, framerate: 1000 };
1055
+ var terminal;
1056
+ var files;
1057
+ var debugLevel = parseInt('{{{debuglevel}}}');
1058
+ var features = parseInt('{{{features}}}');
1059
+ var sessionTime = parseInt('{{{sessiontime}}}');
1060
+ var domain = '{{{domain}}}';
1061
+ var domainUrl = '{{{domainurl}}}';
1062
+ var authCookie = '{{{authCookie}}}';
1063
+ var authRelayCookie = '{{{authRelayCookie}}}';
1064
+ var authCookieRenewTimer = null;
1065
+ var multiDesktop = {};
1066
+ var multiDesktopFilter = null;
1067
+ var serverPublicNamePort = '{{{serverDnsName}}}:{{{serverPublicPort}}}';
1068
+ var amtScanResults = null;
1069
+ var debugmode = 0;
1070
+ var clickOnce = (((features & 256) != 0) && detectClickOnce());
1071
+ var attemptWebRTC = ((features & 128) != 0);
1072
+ var passRequirements = '{{{passRequirements}}}';
1073
+ if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); }
1074
+ var deskAspectRatio = 0;
1075
+ try { deskAspectRatio = parseInt(getstore('deskAspectRatio', '0')); } catch (ex) { }
1076
+ var uiMode = parseInt(getstore('uiMode', 1));
1077
+ var webPageStackMenu = false;
1078
+ var webPageFullScreen = true;
1079
+ var nightMode = (getstore('_nightMode', '0') == '1');
1080
+ var sessionActivity = Date.now();
1081
+ var updateSessionTimer = null;
1082
+ var pluginHandlerBuilder = {{{pluginHandler}}};
1083
+ var pluginHandler = null;
1084
+ if (pluginHandlerBuilder != null) { pluginHandler = new pluginHandlerBuilder(); }
1085
+ var installedPluginList = null;
1086
+
1087
+ // Console Message Display Timers
1088
+ var p11DeskConsoleMsgTimer = null;
1089
+ var p12TermConsoleMsgTimer = null;
1090
+ var p13FilesConsoleMsgTimer = null;
1091
+
1092
+ function startup() {
1093
+ if ((features & 32) == 0) {
1094
+ // Guard against other site's top frames (web bugs).
1095
+ var loc = null;
1096
+ try { loc = top.location.toString().toLowerCase(); } catch (e) { }
1097
+ if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; }
1098
+ }
1099
+
1100
+ // Check if we are in debug mode
1101
+ args = parseUriArgs();
1102
+ if (!args.locale) { var x = getstore('loctag', 0); if ((x != null) && (x != '*')) { args.locale = x; } }
1103
+ debugmode = args.debug;
1104
+ if (args.webrtc != null) { attemptWebRTC = (args.webrtc == 1); }
1105
+ QV('p13AutoConnect', debugmode); // Files
1106
+ QV('autoconnectbutton2', debugmode); // Terminal
1107
+ QV('autoconnectbutton1', debugmode); // Desktop
1108
+ //QV('DeskClip', debugmode); // Clipboard feature, not completed so show in in debug mode only.
1109
+
1110
+ if (nightMode) { QC('body').add('night'); }
1111
+ toggleFullScreen();
1112
+
1113
+ // Setup page visuals
1114
+ if (args.hide) {
1115
+ var hide = parseInt(args.hide);
1116
+ QV('masthead', !(hide & 1));
1117
+ QV('topbar', !(hide & 2));
1118
+ QV('footer', !(hide & 4));
1119
+ QV('p10title', !(hide & 8));
1120
+ QV('p11title', !(hide & 8));
1121
+ QV('p12title', !(hide & 8));
1122
+ QV('p13title', !(hide & 8));
1123
+ QV('p14title', !(hide & 8));
1124
+ QV('p15title', !(hide & 8));
1125
+ QV('p16title', !(hide & 8));
1126
+ //if (hide & 16) {
1127
+ // QV('page_leftbar', false);
1128
+ // QS('page_content').left = '0px';
1129
+ //}
1130
+
1131
+ // Fix the main grid to zero-height elements we want to hide.
1132
+ QS('container')['grid-template-rows'] = ((hide & 1) ? '0' : '66') + 'px ' + ((hide & 2) ? '0' : '24') + 'px auto ' + ((hide & 4) ? '0' : '45') + 'px';
1133
+ QS('container')['-ms-grid-rows'] = ((hide & 1) ? '0' : '66') + 'px ' + ((hide & 2) ? '0' : '24') + 'px auto ' + ((hide & 4) ? '0' : '45') + 'px';
1134
+
1135
+ // Adjust height of remote desktop, files and Intel AMT
1136
+ var xh = (((hide & 1) ? 0 : 66) + ((hide & 2) ? 0 : 24) + ((hide & 4) ? 0 : 45) + ((hide & 8) ? 0 : 60)); // 0 to 195
1137
+ QS('p3users')['max-height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
1138
+ QS('p3events')['height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
1139
+ QS('deskarea3x')['height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
1140
+ QS('deskarea3x')['max-height'] = 'calc(100vh - ' + (75 + xh) + 'px)';
1141
+ QS('p5filetable')['height'] = 'calc(100vh - ' + (160 + xh) + 'px)';
1142
+ QS('p13filetable')['height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
1143
+ QS('serverMainStats')['height'] = 'calc(100vh - ' + (110 + xh) + 'px)';
1144
+ QS('serverMainStats')['max-height'] = 'calc(100vh - ' + (110 + xh) + 'px)';
1145
+ QS('xdevices')['max-height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
1146
+ QS('xdevicesmap')['max-height'] = 'calc(100vh - ' + (124 + xh) + 'px)';
1147
+ QS('p15agentConsole')['height'] = 'calc(100vh - ' + (84 + xh) + 'px)';
1148
+ QS('p15agentConsole')['max-height'] = 'calc(100vh - ' + (84 + xh) + 'px)';
1149
+ QS('p15agentConsoleText')['height'] = 'calc(100vh - ' + (81 + xh) + 'px)';
1150
+ QS('p15agentConsoleText')['max-height'] = 'calc(100vh - ' + (81 + xh) + 'px)';
1151
+ QS('p43iframe')['height'] = 'calc(100vh - ' + (84 + xh) + 'px)';
1152
+ QS('p43iframe')['max-height'] = 'calc(100vh - ' + (84 + xh) + 'px)';
1153
+ }
1154
+
1155
+ // We are looking at a single device, remove all the back buttons
1156
+ if ('{{currentNode}}' != '') {
1157
+ QV('p10BackButton', false);
1158
+ QV('p11BackButton', false);
1159
+ QV('p12BackButton', false);
1160
+ QV('p13BackButton', false);
1161
+ QV('p14BackButton', false);
1162
+ QV('p15BackButton', false);
1163
+ QV('p16BackButton', false);
1164
+ }
1165
+ p1updateInfo();
1166
+
1167
+ // Setup the context menu
1168
+ document.onclick = function (e) { hideContextMenu(); }
1169
+ document.onkeypress = ondockeypress;
1170
+ document.onkeydown = ondockeydown;
1171
+ document.onkeyup = ondockeyup;
1172
+ //window.addEventListener('focus', ondocfocus, false);
1173
+ window.addEventListener('blur', ondocblur, false);
1174
+ window.onresize = function () { masterUpdate(512); }
1175
+ setTimeout(function() { masterUpdate(512); }, 200);
1176
+
1177
+ // Connect to the mesh server
1178
+ meshserver = MeshServerCreateControl(domainUrl, authCookie);
1179
+ meshserver.onStateChanged = onStateChanged;
1180
+ meshserver.onMessage = onMessage;
1181
+ meshserver.trace = (args.trace == 1);
1182
+ meshserver.Start();
1183
+
1184
+ // Setup page controls
1185
+ Q('sortselect').selectedIndex = sort = getstore('sort', 0);
1186
+ Q('sizeselect').selectedIndex = getstore('_viewsize', 1);
1187
+ Q('SearchInput').value = getstore('_search', '');
1188
+ showRealNames = (getstore('showRealNames', 0) == 1);
1189
+ Q('RealNameCheckBox').checked = showRealNames;
1190
+ Q('viewselect').value = getstore('_deviceView', 1);
1191
+ Q('DeskControl').checked = (getstore('DeskControl', 1) == 1);
1192
+ QV('accountChangeEmailAddressSpan', (features & 0x200000) == 0);
1193
+
1194
+ // Display the page devices
1195
+ masterUpdate(3)
1196
+ for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); }
1197
+ Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel');
1198
+
1199
+ // Setup upload drag & drop
1200
+ Q('p5filetable').addEventListener('drop', p5fileDragDrop, false);
1201
+ Q('p5filetable').addEventListener('dragover', p5fileDragOver, false);
1202
+ Q('p5filetable').addEventListener('dragleave', p5fileDragLeave, false);
1203
+ //Q('p5fileCatchAllInput').addEventListener('drop', p5fileDragDrop, false);
1204
+ //Q('p5fileCatchAllInput').addEventListener('dragover', p5fileDragOver, false);
1205
+ //Q('p5fileCatchAllInput').addEventListener('dragleave', p5fileDragLeave, false);
1206
+
1207
+ // Setup upload drag & drop
1208
+ Q('p13filetable').addEventListener('drop', p13fileDragDrop, false);
1209
+ Q('p13filetable').addEventListener('dragover', p13fileDragOver, false);
1210
+ Q('p13filetable').addEventListener('dragleave', p13fileDragLeave, false);
1211
+
1212
+ // Timeline update interval
1213
+ setInterval(updateDeviceTimeline, 120000); // Check every 2 minutes
1214
+
1215
+ // Load desktop settings
1216
+ var t = localStorage.getItem('desktopsettings');
1217
+ if (t != null) { desktopsettings = JSON.parse(t); }
1218
+ t = localStorage.getItem('multidesktopsettings');
1219
+ if (t != null) { multidesktopsettings = JSON.parse(t); }
1220
+ applyDesktopSettings();
1221
+
1222
+ // Terminal special keys
1223
+ var x = '';
1224
+ for (var c = 1; c < 27; c++) x += '<option value=\'' + c + '\'>' + "Ctrl" + '-' + String.fromCharCode(64 + c) + ' (' + c + ')</option>';
1225
+ QH('specialkeylist', x);
1226
+
1227
+ // Setup server stats panels
1228
+ setupGeneralServerStats();
1229
+ setupServerTimelineStats();
1230
+
1231
+ // Setup the user interface in the right mode
1232
+ userInterfaceSelectMenu();
1233
+
1234
+ // If SSPI or LDAP authentication not used, allow batch account creation.
1235
+ QV('p4UserBatchCreate', (features & 0x00080000) == 0);
1236
+ }
1237
+
1238
+ // Toggle the web page to full screen
1239
+ function toggleAspectRatio(toggle) {
1240
+ if (toggle === 1) { deskAspectRatio = ((deskAspectRatio + 1) % 3); putstore('deskAspectRatio', deskAspectRatio); }
1241
+ deskAdjust();
1242
+ }
1243
+
1244
+ // If FullScreen, toggle menu to be horisontal or vertical
1245
+ function toggleStackMenu(toggle) {
1246
+ if (webPageFullScreen == true) {
1247
+ if (toggle === 1) {
1248
+ webPageStackMenu = !webPageStackMenu;
1249
+ putstore('webPageStackMenu', webPageStackMenu);
1250
+ }
1251
+ if (webPageStackMenu == false) {
1252
+ QC('body').remove('menu_stack');
1253
+ } else {
1254
+ QC('body').add('menu_stack');
1255
+ if (xxcurrentView >= 10) QC('column_l').remove('room4submenu');
1256
+ }
1257
+ deskAdjust();
1258
+ }
1259
+ }
1260
+
1261
+ // Toggle user interface menu
1262
+ function showUserInterfaceSelectMenu() {
1263
+ Q('uiViewButton1').classList.remove('uiSelectorSel');
1264
+ Q('uiViewButton2').classList.remove('uiSelectorSel');
1265
+ Q('uiViewButton3').classList.remove('uiSelectorSel');
1266
+ Q('uiViewButton4').classList.remove('uiSelectorSel');
1267
+ try { Q('uiViewButton' + uiMode).classList.add('uiSelectorSel'); } catch (ex) { }
1268
+ QV('uiMenu', (QS('uiMenu').display == 'none'));
1269
+ //Q('uiViewButton1').focus();
1270
+ if (nightMode) { Q('uiViewButton4').classList.add('uiSelectorSel'); }
1271
+ }
1272
+
1273
+ function userInterfaceSelectMenu(s) {
1274
+ if (s) { uiMode = s; putstore('uiMode', uiMode); }
1275
+ webPageFullScreen = (uiMode < 3);
1276
+ webPageStackMenu = (uiMode > 1);
1277
+ toggleFullScreen(0);
1278
+ toggleStackMenu(0);
1279
+ if (webPageStackMenu && (xxcurrentView >= 10)) { QC('column_l').add('room4submenu'); } else { QC('column_l').remove('room4submenu'); }
1280
+ }
1281
+
1282
+ function toggleNightMode() {
1283
+ nightMode = !nightMode;
1284
+ if (nightMode) { QC('body').add('night'); } else { QC('body').remove('night'); }
1285
+ putstore('_nightMode', nightMode?'1':'0');
1286
+ }
1287
+
1288
+ // Toggle the web page to full screen
1289
+ function toggleFullScreen(toggle) {
1290
+ if (toggle === 1) { webPageFullScreen = !webPageFullScreen; putstore('webPageFullScreen', webPageFullScreen); }
1291
+ var hide = 0;
1292
+ if (args.hide) { hide = parseInt(args.hide); }
1293
+ if (webPageFullScreen == false) {
1294
+ QC('body').remove('menu_stack');
1295
+ QC('body').remove('fullscreen');
1296
+ QC('body').remove('arg_hide');
1297
+ if (xxcurrentView >= 10) QC('column_l').add('room4submenu');
1298
+ QV('UserDummyMenuSpan', false);
1299
+ //QV('page_leftbar', false);
1300
+ } else {
1301
+ QC('body').add('fullscreen');
1302
+ if (hide & 16) QC('body').add('arg_hide'); // This is replacement for QV('page_leftbar', !(hide & 16));
1303
+ QV('page_leftbar', !(hide & 16));
1304
+ QV('MainMenuSpan', !(hide & 16));
1305
+ if (xxcurrentView >= 10) QC('column_l').remove('room4submenu');
1306
+ QV('UserDummyMenuSpan', (xxcurrentView < 10) && webPageFullScreen);
1307
+ }
1308
+ masterUpdate(512);
1309
+ QV('body', true);
1310
+ }
1311
+
1312
+ function getNodeFromId(id) { if (nodes != null) { for (var i in nodes) { if (nodes[i]._id == id) return nodes[i]; } } return null; }
1313
+ function reload() {
1314
+ var x = window.location.href;
1315
+ if (x.endsWith('/#')) { x = x.substring(0, x.length - 2); }
1316
+ window.location.href = x;
1317
+ }
1318
+
1319
+ function onStateChanged(server, state, prevState, errorCode) {
1320
+ if (state == 0) {
1321
+ // Control web socket disconnected
1322
+ setDialogMode(0); // Close any dialog boxes if present
1323
+ go(0); // Go to disconnection panel
1324
+
1325
+ // Clean up
1326
+ powerTimeline = null;
1327
+ powerTimelineReq = null;
1328
+ powerTimelineNode = null;
1329
+ powerTimelineUpdate = null;
1330
+ deleteAllNotifications(); // Close and clear notifications if present
1331
+ hideContextMenu(); // Hide the context menu if present
1332
+ QV('verifyEmailId2', false);
1333
+ QV('logoutControl', false);
1334
+ if (errorCode == 'noauth') { QH('p0span', "Unable to perform authentication"); return; }
1335
+ if (prevState == 2) { if (autoReconnect) { setTimeout(serverPoll, 5000); } } else { QH('p0span', "Unable to connect web socket"); }
1336
+ if (authCookieRenewTimer != null) { clearInterval(authCookieRenewTimer); authCookieRenewTimer = null; }
1337
+ } else if (state == 2) {
1338
+ // Fetch list of meshes, nodes, files
1339
+ meshserver.send({ action: 'meshes' });
1340
+ meshserver.send({ action: 'nodes', id: '{{currentNode}}' });
1341
+ if (pluginHandler != null) { meshserver.send({ action: 'plugins' }); }
1342
+ if ('{{currentNode}}' == '') { meshserver.send({ action: 'files' }); }
1343
+ if ('{{viewmode}}' == '') { go(1); }
1344
+ authCookieRenewTimer = setInterval(function () { meshserver.send({ action: 'authcookie' }); }, 1800000); // Request a cookie refresh every 30 minutes.
1345
+ }
1346
+ }
1347
+
1348
+ // Poll the server, if it responds, refresh the page.
1349
+ function serverPoll() {
1350
+ var xdr = null;
1351
+ try { xdr = new XDomainRequest(); } catch (e) { }
1352
+ if (!xdr) xdr = new XMLHttpRequest();
1353
+ xdr.open('HEAD', window.location.href);
1354
+ xdr.timeout = 15000;
1355
+ xdr.onload = function () { reload(); };
1356
+ xdr.onerror = xdr.ontimeout = function () { setTimeout(serverPoll, 10000); };
1357
+ xdr.send();
1358
+ }
1359
+
1360
+ // Return true if this browser supports clickonce
1361
+ function detectClickOnce() {
1362
+ for (var i in window.navigator.mimeTypes) { if (window.navigator.mimeTypes[i].type == 'application/x-ms-application') { return true; } }
1363
+ var userAgent = window.navigator.userAgent.toUpperCase();
1364
+ return (userAgent.indexOf('.NET CLR 3.5') >= 0) || (userAgent.indexOf('(WINDOWS NT ') >= 0);
1365
+ }
1366
+
1367
+ function updateSiteAdmin() {
1368
+ var noServerBackup = '{{{noServerBackup}}}';
1369
+ var siteRights = userinfo.siteadmin;
1370
+ if (noServerBackup == 1) { siteRights &= 0xFFFFFFFA; } // If not server backups allowed, remove server backup and restore permissions
1371
+
1372
+ // Update account actions
1373
+ QV('p2AccountSecurity', ((features & 4) == 0) && (serverinfo.domainauth == false) && ((features & 4096) != 0)); // Hide Account Security if in single user mode, domain authentication to 2 factor auth not supported.
1374
+ QV('p2AccountActions', ((features & 4) == 0) && (serverinfo.domainauth == false)); // Hide Account Actions if in single user mode or domain authentication
1375
+ QV('p2AccountImage', ((features & 4) == 0) && (serverinfo.domainauth == false)); // If account actions are not visible, also remove the image on that panel
1376
+ QV('p2ServerActions', siteRights & 21);
1377
+ QV('LeftMenuMyServer', siteRights & 21); // 16 + 4 + 1
1378
+ QV('MainMenuMyServer', siteRights & 21);
1379
+ QV('p2ServerActionsBackup', siteRights & 1);
1380
+ QV('p2ServerActionsRestore', siteRights & 4);
1381
+ QV('p2ServerActionsVersion', siteRights & 16);
1382
+ QV('MainMenuMyFiles', siteRights & 8);
1383
+ QV('LeftMenuMyFiles', siteRights & 8);
1384
+ if (((siteRights & 8) == 0) && (xxcurrentView == 5)) { setDialogMode(0); go(1); }
1385
+ if (currentNode != null) { gotoDevice(currentNode._id, xxcurrentView, true); }
1386
+
1387
+ // Update user management state
1388
+ if ((userinfo.siteadmin & 2) != 0)
1389
+ {
1390
+ // We are user administrator
1391
+ if (users == null) { meshserver.send({ action: 'users' }); }
1392
+ if (wssessions == null) { meshserver.send({ action: 'wssessioncount' }); }
1393
+ } else {
1394
+ // We are not user administrator
1395
+ users = null;
1396
+ wssessions = null;
1397
+ updateUsers();
1398
+ if (xxcurrentView == 4 || ((xxcurrentView >= 30) && (xxcurrentView < 40))) { setDialogMode(0); go(1); currentUser = null; }
1399
+ }
1400
+ meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value) });
1401
+ QV('ServerConsole', userinfo.siteadmin === 0xFFFFFFFF);
1402
+ QV('ServerTrace', userinfo.siteadmin === 0xFFFFFFFF);
1403
+ if ((xxcurrentView == 115) && (userinfo.siteadmin != 0xFFFFFFFF)) { go(6); }
1404
+ if ((xxcurrentView == 6) && ((userinfo.siteadmin & 21) == 0)) { go(1); }
1405
+
1406
+ // If we are site administrator, register to get server statistics
1407
+ if ((siteRights & 21) != 0) { meshserver.send({ action: 'serverstats', interval: 10000 }); }
1408
+ }
1409
+
1410
+ // To boost the speed of the web page when even floods occur, this method perform a delayed update on the web page.
1411
+ var updateNaggleTimer = null;
1412
+ var updateNaggleFlags = 0;
1413
+ function masterUpdate(flags) {
1414
+ updateNaggleFlags |= flags;
1415
+ if (updateNaggleTimer == null) {
1416
+ updateNaggleTimer = setTimeout(function () {
1417
+ if (updateNaggleFlags & 512) { center(); }
1418
+ if (updateNaggleFlags & 1) { onSearchInputChanged(); }
1419
+ if (updateNaggleFlags & 2) { onSortSelectChange(false); }
1420
+ if (updateNaggleFlags & 128) { updateMeshes(); }
1421
+ if (updateNaggleFlags & 4) { updateDevices(); }
1422
+ if (updateNaggleFlags & 8) { drawNotifications(); }
1423
+ if (updateNaggleFlags & 16) { updateMapMarkers(); }
1424
+ if (updateNaggleFlags & 32) { eventsUpdate(); }
1425
+ if (updateNaggleFlags & 64) { refreshMap(false, true); }
1426
+ if (updateNaggleFlags & 256) { drawDeviceTimeline(); }
1427
+ if (updateNaggleFlags & 1024) { deviceEventsUpdate(); }
1428
+ if (updateNaggleFlags & 2048) { userEventsUpdate(); }
1429
+ if (updateNaggleFlags & 4096) { p20updateMesh(); }
1430
+ updateNaggleTimer = null;
1431
+ updateNaggleFlags = 0;
1432
+ }, 150);
1433
+ }
1434
+ }
1435
+
1436
+ var backupCodesWarningDone = false;
1437
+ function updateSelf() {
1438
+ QV('verifyEmailId', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
1439
+ QV('verifyEmailId2', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
1440
+ QV('manageOtp', (userinfo.otpsecret == 1) || (userinfo.otphkeys > 0));
1441
+ QV('authAppSetupCheck', userinfo.otpsecret == 1);
1442
+ QV('authKeySetupCheck', userinfo.otphkeys > 0);
1443
+ QV('authCodesSetupCheck', userinfo.otpkeys > 0);
1444
+ masterUpdate(4 + 128 + 4096);
1445
+
1446
+ // Check if backup codes should really be enabled
1447
+ if ((backupCodesWarningDone == false) && !(userinfo.otpkeys > 0) && (((userinfo.otpsecret == 1) && !(userinfo.otphkeys > 0)) || ((userinfo.otpsecret != 1) && (userinfo.otphkeys == 1)))) {
1448
+ var n = { text: "Please add two-factor backup codes. If the current factor is lost, there is not way to recover this account.", title: "Two factor authentication" };
1449
+ addNotification(n);
1450
+ backupCodesWarningDone = true;
1451
+ }
1452
+
1453
+ // If we can't create new groups, hide all links that can do that.
1454
+ var newGroupsAllowed = ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 64) == 0));
1455
+ QV('p2createMeshLink1', newGroupsAllowed);
1456
+ QV('p2createMeshLink2', newGroupsAllowed);
1457
+ QV('getStarted1', newGroupsAllowed);
1458
+ QV('getStarted2', !newGroupsAllowed);
1459
+
1460
+ if (typeof userinfo.passchange == 'number') {
1461
+ if (userinfo.passchange == -1) { QH('p2nextPasswordUpdateTime', " - Reset on next login."); }
1462
+ else if ((passRequirements != null) && (typeof passRequirements.reset == 'number')) {
1463
+ var seconds = (userinfo.passchange) + (passRequirements.reset * 86400) - Math.floor(Date.now() / 1000);
1464
+ if (seconds < 0) { QH('p2nextPasswordUpdateTime', " - Reset on next login."); }
1465
+ else if (seconds < 3600) { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} minute{1}.", Math.floor(seconds / 60), addLetterS(Math.floor(seconds / 60)))); }
1466
+ else if (seconds < 86400) { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} hour{1}.", Math.floor(seconds / 3600), addLetterS(Math.floor(seconds / 3600)))); }
1467
+ else { QH('p2nextPasswordUpdateTime', format(" - Reset v {0} den{1}."), Math.floor(seconds / 86400), addLetterS(Math.floor(seconds / 86400))); }
1468
+ }
1469
+ }
1470
+ }
1471
+
1472
+ function addLetterS(x) { return (x > 1) ? 's' : ''; }
1473
+ function setSessionActivity() { sessionActivity = Date.now(); QH('idleTimeoutNotify', ''); }
1474
+ function checkIdleSessionTimeout() {
1475
+ var delta = (Date.now() - sessionActivity);
1476
+ if (delta > serverinfo.timeout) { window.location.href = 'logout'; } else {
1477
+ var ds = Math.round((serverinfo.timeout - delta) / 1000);
1478
+ if (ds <= 60) {
1479
+ QH('idleTimeoutNotify', '<br />' + format("{0} sekund{1} do odpojení", ds, addLetterS(ds)));
1480
+ } else {
1481
+ ds = Math.round(ds / 60);
1482
+ if (ds <= 5) { QH('idleTimeoutNotify', '<br />' + format("{0} minute{1} until disconnect", ds, addLetterS(ds))); }
1483
+ }
1484
+ }
1485
+ }
1486
+
1487
+ function onMessage(server, message) {
1488
+ switch (message.action) {
1489
+ case 'trace': {
1490
+ serverTrace.unshift(message);
1491
+ displayServerTrace();
1492
+ break;
1493
+ }
1494
+ case 'traceinfo': {
1495
+ if (typeof message.traceSources == 'object') {
1496
+ if ((message.traceSources != null) && (message.traceSources.length > 0)) {
1497
+ serverTraceSources = message.traceSources;
1498
+ QH('p41traceStatus', EscapeHtml(message.traceSources.join(', ')));
1499
+ } else {
1500
+ serverTraceSources = [];
1501
+ QH('p41traceStatus', "Nic");
1502
+ }
1503
+ }
1504
+ break;
1505
+ }
1506
+ case 'serverstats': {
1507
+ updateGeneralServerStats(message);
1508
+ break;
1509
+ }
1510
+ case 'serverwarnings': {
1511
+ if ((message.warnings != null) && (message.warnings.length > 0)) {
1512
+ var x = '';
1513
+ for (var i in message.warnings) { x += '<div style=color:red;padding-bottom:6px><b>' + "WARNING: " + message.warnings[i] + '</b></div>'; }
1514
+ QH('serverWarnings', x);
1515
+ QV('serverWarningsDiv', true);
1516
+ }
1517
+ break;
1518
+ }
1519
+ case 'servertimelinestats': {
1520
+ setServerTimelineStats(message.events);
1521
+ break;
1522
+ }
1523
+ case 'authcookie': {
1524
+ // Got an authentication cookie refresh
1525
+ authCookie = message.cookie;
1526
+ authRelayCookie = message.rcookie;
1527
+ break;
1528
+ }
1529
+ case 'serverinfo': {
1530
+ serverinfo = message.serverinfo;
1531
+ if (serverinfo.timeout) { setInterval(checkIdleSessionTimeout, 10000); checkIdleSessionTimeout(); }
1532
+ if (debugmode == 1) { console.log('Server time: ', printDateTime(new Date(serverinfo.serverTime))); }
1533
+ break;
1534
+ }
1535
+ case 'userinfo': {
1536
+ userinfo = message.userinfo;
1537
+ updateSiteAdmin();
1538
+ updateSelf();
1539
+ break;
1540
+ }
1541
+ case 'users': {
1542
+ users = {};
1543
+ for (var m in message.users) { users[message.users[m]._id] = message.users[m]; }
1544
+ updateUsers();
1545
+ break;
1546
+ }
1547
+ case 'wssessioncount': {
1548
+ wssessions = message.wssessions;
1549
+ updateUsers();
1550
+ break;
1551
+ }
1552
+ case 'meshes': {
1553
+ meshes = {};
1554
+ for (var m in message.meshes) { meshes[message.meshes[m]._id] = message.meshes[m]; }
1555
+ masterUpdate(4 + 128);
1556
+ break;
1557
+ }
1558
+ case 'files': {
1559
+ filetree = setupBackPointers(message.filetree);
1560
+ updateFiles();
1561
+ d3updatefiles();
1562
+ break;
1563
+ }
1564
+ case 'nodes': {
1565
+ nodes = [];
1566
+ for (var m in message.nodes) {
1567
+ if (!meshes[m]) { console.log('Invalid mesh (1): ' + m); continue; }
1568
+ for (var n in message.nodes[m]) {
1569
+ if (message.nodes[m][n]._id == null) { console.log('Invalid node (' + n + '): ' + JSON.stringify(message.nodes)); continue; }
1570
+ message.nodes[m][n].namel = message.nodes[m][n].name.toLowerCase();
1571
+ 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; }
1572
+ message.nodes[m][n].meshnamel = meshes[m].name.toLowerCase();
1573
+ message.nodes[m][n].meshid = m;
1574
+ message.nodes[m][n].state = (message.nodes[m][n].state)?(message.nodes[m][n].state):0;
1575
+ message.nodes[m][n].desc = message.nodes[m][n].desc;
1576
+ message.nodes[m][n].ip = message.nodes[m][n].ip;
1577
+ if (!message.nodes[m][n].icon) message.nodes[m][n].icon = 1;
1578
+ message.nodes[m][n].ident = ++nodeShortIdent;
1579
+ nodes.push(message.nodes[m][n]);
1580
+ }
1581
+ }
1582
+ masterUpdate(1 | 2 | 4 | 64);
1583
+
1584
+ if (xxcurrentView == -1) { if ('{{viewmode}}' != '') { go(parseInt('{{viewmode}}')); } else { setDialogMode(0); go(1); } }
1585
+ if ('{{currentNode}}' != '') { gotoDevice('{{currentNode}}',parseInt('{{viewmode}}'));}
1586
+ break;
1587
+ }
1588
+ case 'powertimeline': {
1589
+ if (message.nodeid != powerTimelineReq) break;
1590
+ powerTimelineNode = message.nodeid;
1591
+ powerTimeline = message.timeline;
1592
+ powerTimelineUpdate = Date.now() + 300000; // Update every 5 minutes
1593
+ for (var i in powerTimeline) { if (i % 2 == 1) { powerTimeline[i] = powerTimeline[i] * 1000; } } // Decompress time
1594
+ if (currentNode._id == message.nodeid) { masterUpdate(256); }
1595
+ break;
1596
+ }
1597
+ case 'getsysinfo': {
1598
+ if (message.nodeid != powerTimelineReq) break;
1599
+ //console.log('getsysinfo', message); // ***********************
1600
+ if (message.noinfo === true) {
1601
+ QH('p17info', "No information for this device.");
1602
+ } else {
1603
+ var x = '', s = {};
1604
+ if (message.hardware) {
1605
+ if (message.hardware.identifiers) {
1606
+ var ident = message.hardware.identifiers;
1607
+ // BIOS
1608
+ x += '<div class=DevSt style=margin-bottom:3px><b>' + "BIOS" + '</b></div>';
1609
+ if (ident.bios_vendor) { x += addDetailItem("Vendor", ident.bios_vendor, s); }
1610
+ if (ident.bios_version) { x += addDetailItem("Version", ident.bios_version, s); }
1611
+ x += '<br />';
1612
+
1613
+ // Motherboard
1614
+ x += '<div class=DevSt style=margin-bottom:3px><b>' + "Motherboard" + '</b></div>';
1615
+ if (ident.board_vendor) { x += addDetailItem("Vendor", ident.board_vendor, s); }
1616
+ if (ident.board_name) { x += addDetailItem("Jméno", ident.board_name, s); }
1617
+ if (ident.board_serial && (ident.board_serial != '')) { x += addDetailItem("Serial", ident.board_serial, s); }
1618
+ if (ident.board_version) { x += addDetailItem("Version", ident.board_version, s); }
1619
+ if (ident.product_uuid) { x += addDetailItem("Identifier", ident.product_uuid, s); }
1620
+ x += '<br />';
1621
+ }
1622
+
1623
+ if (message.hardware.windows) {
1624
+ if (message.hardware.windows.memory) {
1625
+ // Memory
1626
+ x += '<div class=DevSt style=margin-bottom:3px><b>' + "Paměť" + '</b></div>';
1627
+
1628
+ // Sort Memory
1629
+ function memorySort(a, b) { if (a.BankLabel > b.BankLabel) return 1; if (a.BankLabel < b.BankLabel) return -1; return 0; }
1630
+ message.hardware.windows.memory.sort(memorySort);
1631
+
1632
+ x += '<table style=width:100%>';
1633
+ for (var i in message.hardware.windows.memory) {
1634
+ var m = message.hardware.windows.memory[i];
1635
+ x += '<tr><td VALIGN=Top style=width:38px><img src="images/ram2.png" />'
1636
+ x += '<td><div style=background-color:lightgray;border-radius:5px;padding:8px>';
1637
+ x += '<div><b>' + m.BankLabel + '</b></div>';
1638
+ if (m.Capacity) { x += addDetailItem("Capacity / Speed", format("{0} Mb, {1} Mhz", (m.Capacity / 1024 / 1024), m.Speed), s); }
1639
+ if (m.PartNumber) { x += addDetailItem("Part Number", ((m.Manufacturer && m.Manufacturer != 'Undefined')?(m.Manufacturer + ', '):'') + m.PartNumber, s); }
1640
+ x += '</div>';
1641
+ }
1642
+ x += '</table><br />';
1643
+ }
1644
+
1645
+ if (message.hardware.windows.osinfo) {
1646
+ // Operating System
1647
+ var m = message.hardware.windows.osinfo;
1648
+ x += '<div class=DevSt style=margin-bottom:3px><b>' + "Operační systém" + '</b></div>';
1649
+ if (m.Caption) { x += addDetailItem("Jméno", m.Caption, s); }
1650
+ if (m.Version) { x += addDetailItem("Version", m.Version, s); }
1651
+ if (m.OSArchitecture) { x += addDetailItem("Architektura", m.OSArchitecture, s); }
1652
+ x += '<br />';
1653
+ }
1654
+
1655
+ // Disks
1656
+ //x += '<div class=DevSt style=margin-bottom:3px><b>Disks</b></div>';
1657
+ //x += '<br />';
1658
+ }
1659
+ }
1660
+
1661
+ QH('p17info', x);
1662
+ }
1663
+ break;
1664
+ }
1665
+ case 'lastconnect': {
1666
+ var node = getNodeFromId(message.nodeid);
1667
+ if (node != null) {
1668
+ node.lastconnect = message.time;
1669
+ node.lastaddr = message.addr;
1670
+ if ((currentNode._id == node._id) && (Q('MainComputerState').innerHTML == '')) {
1671
+ QH('MainComputerState', '<span>' + "Naposledy spatřen:" + '<br />' + printDateTime(new Date(node.lastconnect)) + '</span>');
1672
+ }
1673
+ }
1674
+ break;
1675
+ }
1676
+ case 'msg': {
1677
+ // Check if this is a message from a node
1678
+ if (message.nodeid != null) {
1679
+ var index = -1;
1680
+ if (nodes != null) { for (var i in nodes) { if (nodes[i]._id == message.nodeid) { index = i; break; } } }
1681
+ if (index != -1) {
1682
+ // Node was found, dispatch the message
1683
+ if (message.type == 'console') { p15consoleReceive(nodes[index], message.value, message.source); } // This is a console message.
1684
+ else if (message.type == 'notify') { // This is a notification message.
1685
+ var n = getstore('notifications', 0);
1686
+ if (((n & 8) == 0) && (message.amtMessage != null)) { break; } // Intel AMT desktop & terminal messages should be ignored.
1687
+ var n = { text: message.value, title: message.title, icon: message.icon };
1688
+ if (message.nodeid != null) { n.nodeid = message.nodeid; }
1689
+ if (message.tag != null) { n.tag = message.tag; }
1690
+ if (message.username != null) { n.username = message.username; }
1691
+ addNotification(n);
1692
+ } else if (message.type == 'ps') {
1693
+ showDeskToolsProcesses(message);
1694
+ } else if (message.type == 'services') {
1695
+ showDeskToolsServices(message);
1696
+ } else if ((message.type == 'getclip') && (xxdialogTag == 'clipboard') && (currentNode != null) && (currentNode._id == message.nodeid)) {
1697
+ Q('d2clipText').value = message.data;
1698
+ } else if ((message.type == 'setclip') && (xxdialogTag == 'clipboard') && (currentNode != null) && (currentNode._id == message.nodeid)) {
1699
+ // Display success/fail on the clipboard dialog box.
1700
+ QH('dlgClipStatus', message.success ? '<span style=color:green>' + "Úspěch" + '</span>' : '<span style=color:red>' + "Selhalo" + '</span>')
1701
+ setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000);
1702
+ }
1703
+ }
1704
+ } else {
1705
+ if (message.type == 'notify') { // This is a notification message.
1706
+ var n = { text: message.value, title: message.title, icon: message.icon };
1707
+ if (message.tag != null) { n.tag = message.tag; }
1708
+ if (message.username != null) { n.username = message.username; }
1709
+ addNotification(n);
1710
+ }
1711
+ }
1712
+ break;
1713
+ }
1714
+ case 'getnetworkinfo': {
1715
+ if ((currentNode._id == message.nodeid) && (xxdialogMode == 2) && (xxdialogTag == 'if' + message.nodeid)) {
1716
+ if (message.netif == null) {
1717
+ QH('d2netinfo', "No network interface information available for this device.");
1718
+ } else {
1719
+ var x = '<div class=dialogText>';
1720
+
1721
+ if (currentNode.lastconnect) { x += addHtmlValue2("Last agent connection", printDateTime(new Date(currentNode.lastconnect))); }
1722
+ if (currentNode.lastaddr) {
1723
+ var splitip = currentNode.lastaddr.split(':');
1724
+ if (splitip.length > 2) {
1725
+ // IPv6
1726
+ x += addHtmlValue2("Poslední adresa agenta", currentNode.lastaddr + ' <img src="images/link4.png" title="Copy address to clipboard" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(currentNode.lastaddr) + '\") width=10 height=10>');
1727
+ } else {
1728
+ // IPv4
1729
+ if (isPrivateIP(currentNode.lastaddr)) {
1730
+ x += addHtmlValue2("Poslední adresa agenta", splitip[0] + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(splitip[0]) + '\") width=10 height=10>');
1731
+ } else {
1732
+ x += addHtmlValue2("Poslední adresa agenta", '<a href="https://iplocation.com/?ip=' + splitip[0] + '" rel="noreferrer noopener" target="MeshIPLoopup">' + splitip[0] + '</a> <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(splitip[0]) + '\") width=10 height=10>');
1733
+ }
1734
+ }
1735
+ }
1736
+
1737
+ x += addHtmlValue2("Poslední změna rozhraní", printDateTime(new Date(message.updateTime)));
1738
+ for (var i in message.netif) {
1739
+ var net = message.netif[i];
1740
+ x += '<hr />'
1741
+ if (net.name) { x += addHtmlValue2("Jméno", '<b>' + EscapeHtml(net.name) + '</b>'); }
1742
+ if (net.desc) { x += addHtmlValue2("Popis", EscapeHtml(net.desc).replace('(R)', '®').replace('(r)', '®')); }
1743
+ if (net.dnssuffix) { x += addHtmlValue2("DNS suffix", EscapeHtml(net.dnssuffix) + ' <img src="images/link4.png" title="' + "Zkopírovat jméno do schránky" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.dnssuffix) + '\") width=10 height=10>'); }
1744
+ if (net.mac) { x += addHtmlValue2("MAC adresa", '<a href="https://dnslytics.com/mac-address-lookup/' + net.mac.substring(0, 6) + '" rel="noreferrer noopener" target="MeshMACLoopup">' + EscapeHtml(net.mac.toLowerCase()) + '</a> <img src="images/link4.png" title="' + "Kopírovat MAC adresu do schránky" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.mac.toLowerCase()) + '\") width=10 height=10>'); }
1745
+ if (net.v4addr) { x += addHtmlValue2("IPv4 address", EscapeHtml(net.v4addr) + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4addr) + '\") width=10 height=10>'); }
1746
+ if (net.v4mask) { x += addHtmlValue2("IPv4 mask", EscapeHtml(net.v4mask) + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4mask) + '\") width=10 height=10>'); }
1747
+ if (net.v4gateway) { x += addHtmlValue2("IPv4 gateway", EscapeHtml(net.v4gateway) + ' <img src="images/link4.png" title="' + "Copy address to clipboard" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4gateway) + '\") width=10 height=10>'); }
1748
+ if (net.gatewaymac) { x += addHtmlValue2("MAC brány", '<a href="https://dnslytics.com/mac-address-lookup/' + net.gatewaymac.substring(0, 6) + '" rel="noreferrer noopener" target="MeshMACLoopup">' + EscapeHtml(net.gatewaymac.toLowerCase()) + '</a> <img src="images/link4.png" title="' + "Kopírovat MAC adresu do schránky" + '" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.gatewaymac.toLowerCase()) + '\") width=10 height=10>'); }
1749
+ }
1750
+ x += '</div>';
1751
+ QH('d2netinfo', x);
1752
+ }
1753
+ }
1754
+ break;
1755
+ }
1756
+ case 'serverversion': {
1757
+ if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerUpdate')) {
1758
+ var x = '<div class=dialogText>';
1759
+ if (!message.current) { message.current = "Unknown"; }
1760
+ if (!message.latest) { message.latest = "Unknown"; }
1761
+ x += addHtmlValue2("Current Version", '<b>' + EscapeHtml(message.current) + '</b>');
1762
+ x += addHtmlValue2("Latest Version", '<b>' + EscapeHtml(message.latest) + '</b>');
1763
+ x += '</div>';
1764
+ if ((message.latest.indexOf('.') == -1) || (message.current == message.latest) || ((features & 2048) == 0)) {
1765
+ setDialogMode(2, "MeshCentral Version", 1, null, x);
1766
+ } else {
1767
+ setDialogMode(2, "MeshCentral Version", 3, server_showVersionDlgEx, x + '<br /><label><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> ' + "Check and click OK to start server self-update." + '</label>');
1768
+ server_showVersionDlgUpdate();
1769
+ }
1770
+ }
1771
+ break;
1772
+ }
1773
+ case 'servererrors': {
1774
+ if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerErrors')) {
1775
+ if (message.data == null) {
1776
+ setDialogMode(2, "MeshCentral Server Errors", 1, null, "Server has no error log.");
1777
+ } else {
1778
+ var x = '<div class="dialogText dialogTextLog"><pre id=d2ServerErrorsLogPre>' + message.data + '<pre></div>';
1779
+ setDialogMode(2, "MeshCentral Server Errors", 3, server_showErrorsDlgEx, x + '<br /><div style=float:right><img src=images/link4.png height=10 width=10 title="' + "Download error log" + '" style=cursor:pointer onclick=d2CopyServerErrorsToClip()></div><div><label><input id=d2updateCheck type=checkbox onclick=server_showVersionDlgUpdate() /> ' + "Check and click OK to clear error log." + '</label></div>');
1780
+ server_showVersionDlgUpdate();
1781
+ }
1782
+ }
1783
+ break;
1784
+ }
1785
+ case 'serverconsole': {
1786
+ p15consoleReceive('serverconsole', message.value);
1787
+ break;
1788
+ }
1789
+ case 'events': {
1790
+ if ((message.nodeid != null) && (message.nodeid == currentNode._id)) {
1791
+ currentDeviceEvents = message.events;
1792
+ masterUpdate(1024);
1793
+ } else if ((message.user != null) && (message.user == currentUser.name)) {
1794
+ currentUserEvents = message.events;
1795
+ masterUpdate(2048);
1796
+ } else {
1797
+ events = message.events;
1798
+ masterUpdate(32);
1799
+ }
1800
+ break;
1801
+ }
1802
+ case 'getcookie': {
1803
+ if (message.tag == 'clickonce') {
1804
+ var basicPort = '{{{serverRedirPort}}}' == '' ? '{{{serverPublicPort}}}' : '{{{serverRedirPort}}}';
1805
+ 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');
1806
+ var newWindow = window.open(rdpurl, '_blank');
1807
+ newWindow.opener = null;
1808
+ }
1809
+ break;
1810
+ }
1811
+ case 'getNotes': {
1812
+ var n = Q('d2devNotes');
1813
+ if (n && (message.id == decodeURIComponent(n.attributes['noteid'].value))) {
1814
+ if (message.notes) { QH('d2devNotes', decodeURIComponent(message.notes)); } else { QH('d2devNotes', ''); }
1815
+ var ro = (n.attributes['ro'].value == 'true');
1816
+ if (ro == false) { // If we have permissions, set read/write on this note.
1817
+ n.removeAttribute('readonly');
1818
+ QE('idx_dlgOkButton', true);
1819
+ QV('idx_dlgOkButton', true);
1820
+ focusTextBox('d2devNotes');
1821
+ }
1822
+ }
1823
+ break;
1824
+ }
1825
+ case 'otpauth-request': {
1826
+ if ((xxdialogMode == 2) && (xxdialogTag == 'otpauth-request')) {
1827
+ var secret = message.secret;
1828
+ if (secret.length == 52) { secret = secret.split(/(.............)/).filter(Boolean).join(' '); }
1829
+ else if (secret.length == 32) { secret = secret.split(/(....)/).filter(Boolean).join(' '); secret = secret.substring(0, 20) + '<br/>' + secret.substring(20) }
1830
+ 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>');
1831
+ new QRCode(Q('qrcode'), { text: message.url, width: 128, height: 128, colorDark: '#000000', colorLight: '#EEE', correctLevel: QRCode.CorrectLevel.H });
1832
+ QV('idx_dlgOkButton', true);
1833
+ QE('idx_dlgOkButton', false);
1834
+ Q('d2otpauthinput').focus();
1835
+ }
1836
+ break;
1837
+ }
1838
+ case 'otpauth-setup': {
1839
+ if (xxdialogMode) return;
1840
+ setDialogMode(2, "Authenticator App", 1, null, message.success ? ('<b style=color:green>' + "Authenticator app 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."));
1841
+ break;
1842
+ }
1843
+ case 'otpauth-clear': {
1844
+ if (xxdialogMode) return;
1845
+ setDialogMode(2, "Authenticator App", 1, null, message.success ? ('<b>' + "Authenticator application removed." + '</b> ' + "You can reactivate this feature at any time.") : ('<b style=color:red>' + "2-step login activation removal failed." + '</b> ' + "Zkusit znovu."));
1846
+ break;
1847
+ }
1848
+ case 'otpauth-getpasswords': {
1849
+ if (xxdialogMode) return;
1850
+ var x = "One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";
1851
+ x += '<div style="border-radius:6px;border: 2px dashed #888;width:100%;margin-top:8px"><div style="padding:8px;font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold"><table class=selecttext style=width:100%;text-align:center>';
1852
+ if (message.passwords) {
1853
+ var j = 0, clipb = '';
1854
+ for (var i in message.passwords) {
1855
+ if (++j % 2) { x += '<tr>'; }
1856
+ var p = '' + message.passwords[i].p;
1857
+ while (p.length < 8) { p = '0' + p; }
1858
+ if (message.passwords[i].u === true) {
1859
+ x += '<td>' + p.substring(0, 4) + ' ' + p.substring(4);
1860
+ if (clipb != '') { clipb += ' '; }
1861
+ clipb += p;
1862
+ } else {
1863
+ x += '<td><strike style=color:#BBB>' + p.substring(0, 4) + ' ' + p.substring(4); + '</strike>';
1864
+ }
1865
+ }
1866
+ } else {
1867
+ x += '<tr><td>' + "No Active Tokens";
1868
+ }
1869
+ x += '</table></div></div><br />';
1870
+ x += '<div><input type=button value=' + "Close" + ' onclick=setDialogMode(0) style=float:right></input>';
1871
+ x += '<input type=button value="' + "Generovat nové tokeny" + '" onclick="account_manageOtp(1);"></input>';
1872
+ if (message.passwords != null) {
1873
+ x += '<input type=button value="' + "Clear Tokens" + '" onclick="account_manageOtp(2);"></input>';
1874
+ x += ' <img src=images/link4.png height=10 width=10 title="' + "Copy valid codes to clipboard" + '" style=cursor:pointer onclick=copyTextToClip2("' + encodeURIComponent(clipb) + '")>';
1875
+ }
1876
+ x += '</div><br />';
1877
+ setDialogMode(2, "Manage Backup Codes", 8, null, x, 'otpauth-manage');
1878
+ break;
1879
+ }
1880
+ case 'otp-hkey-get': {
1881
+ if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return;
1882
+ var start = '<div style="border-radius:6px;border:2px solid #CCC;background-color:#BBB;width:100%;box-sizing:border-box;margin-bottom:6px"><div style="margin:3px;font-family:Arial, Helvetica, sans-serif;font-size:16px;font-weight:bold"><table style=width:100%;text-align:left>';
1883
+ var end = '</table></div></div>';
1884
+ var x = "<a href=\"https://www.yubico.com/\" rel=\"noreferrer noopener\" target=\"_blank\">Hardware keys</a> are used as secondary login authentication.";
1885
+ x += '<div style="max-height:150px;overflow-y:auto;overflow-x:hidden;margin-top:6px;margin-bottom:6px">';
1886
+ if (message.keys && message.keys.length > 0) {
1887
+ for (var i in message.keys) {
1888
+ var key = message.keys[i], type = (key.type == 2)?'OTP':'WebAuthn';
1889
+ x += start + '<tr style=margin:5px><td style=width:30px><img width=24 height=18 src="images/hardware-key-' + type + '-24.png" style=margin-top:4px><td style=width:250px>' + key.name + '<td><input type=button value="' + "Odstranit" + '" onclick=account_removehkey(' + key.i + ')></input>' + end;
1890
+ }
1891
+ } else {
1892
+ x += start + '<tr style=text-align:center><td>' + "Žádný klíč není zkonfigurován" + end;
1893
+ }
1894
+ x += '</div>';
1895
+ x += '<div><input type=button value="' + "Close" + '" onclick=setDialogMode(0) style=float:right></input>';
1896
+ if ((features & 0x00020000) != 0) { x += '<input id=d2addkey3 type=button value="' + "Add Key" + '" onclick="account_addhkey(3);"></input>'; }
1897
+ if ((features & 0x00004000) != 0) { x += '<input id=d2addkey2 type=button value="' + "Add YubiKey® OTP" + '" onclick="account_addhkey(2);"></input>'; }
1898
+ x += '</div><br />';
1899
+ setDialogMode(2, "Manage Security Keys", 8, null, x, 'otpauth-hardware-manage');
1900
+ if (u2fSupported() == false) { QE('d2addkey1', false); }
1901
+ break;
1902
+ }
1903
+ case 'otp-hkey-yubikey-add': {
1904
+ if (message.result) {
1905
+ meshserver.send({ action: 'otp-hkey-get' }); // Success, ask for the full list of keys.
1906
+ } else {
1907
+ setDialogMode(2, "Add Security Key", 1, null, '<br />' + "Error, Unable to add key." + '<br /><br />');
1908
+ }
1909
+ break;
1910
+ }
1911
+ case 'otp-hkey-setup-response': {
1912
+ if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return;
1913
+ if (message.result == true) {
1914
+ meshserver.send({ action: 'otp-hkey-get' }); // Success, ask for the full list of keys.
1915
+ } else {
1916
+ setDialogMode(2, "Add Security Key", 1, null, '<br />' + "ERROR: Unable to add key." + '<br /><br />', 'otpauth-hardware-manage');
1917
+ }
1918
+ break;
1919
+ }
1920
+ case 'webauthn-startregister': {
1921
+ if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return;
1922
+ var x = "Press the key button now." + '<br /><br /><div style=width:100%;text-align:center><img width=120 height=117 src="images/hardware-keypress-120.png" /></div><input id=dp1keyname style=display:none value=' + message.name + ' />';
1923
+ setDialogMode(2, "Add Security Key", 2, null, x);
1924
+
1925
+ var publicKey = message.request;
1926
+ message.request.challenge = Uint8Array.from(atob(message.request.challenge), function (c) { return c.charCodeAt(0) })
1927
+ message.request.user.id = Uint8Array.from(atob(message.request.user.id), function (c) { return c.charCodeAt(0) })
1928
+ navigator.credentials.create({ publicKey: publicKey })
1929
+ .then(function(newCredentialInfo) {
1930
+ // Public key credential
1931
+ var r = { rawId: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.rawId))), response: { attestationObject: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.response.attestationObject))), clientDataJSON: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.response.clientDataJSON))) }, type: newCredentialInfo.type };
1932
+ meshserver.send({ action: 'webauthn-endregister', response: r });
1933
+ setDialogMode(0);
1934
+ }, function(error) {
1935
+ // Error
1936
+ setDialogMode(2, "Add Security Key", 1, null, "ERROR: " + error);
1937
+ });
1938
+ break;
1939
+ }
1940
+ case 'event': {
1941
+ if (!message.event.nolog) {
1942
+ if (currentNode && (message.event.nodeid == currentNode._id)) {
1943
+ // If this event has a nodeid and we are looking at this node, update the log in real time.
1944
+ currentDeviceEvents.unshift(message.event);
1945
+ var eventLimit = parseInt(p16limitdropdown.value);
1946
+ while (currentDeviceEvents.length > eventLimit) { currentDeviceEvents.pop(); } // Remove element(s) at the end
1947
+ masterUpdate(1024);
1948
+ }
1949
+
1950
+ if (currentUser && (message.event.userid == currentUser._id)) {
1951
+ // If this event has a userid and we are looking at this user, update the log in real time.
1952
+ currentUserEvents.unshift(message.event);
1953
+ var eventLimit = parseInt(p31limitdropdown.value);
1954
+ while (currentUserEvents.length > eventLimit) { currentUserEvents.pop(); } // Remove element(s) at the end
1955
+ masterUpdate(2048);
1956
+ }
1957
+
1958
+ // Add this event to the master events log.
1959
+ events.unshift(message.event);
1960
+ var eventLimit = parseInt(p3limitdropdown.value);
1961
+ while (events.length > eventLimit) { events.pop(); } // Remove element(s) at the end
1962
+ masterUpdate(32);
1963
+ }
1964
+ if (message.event.noact) break; // Take no action on this event
1965
+ switch (message.event.action) {
1966
+ case 'userWebState': {
1967
+ // New user web state, update the web page as needed
1968
+ if (localStorage != null) {
1969
+ var oldShowRealNames = localStorage.getItem('showRealNames');
1970
+ var oldUiMode = localStorage.getItem('uiMode');
1971
+ var oldSort = localStorage.getItem('sort');
1972
+ var oldLoctag = localStorage.getItem('loctag');
1973
+
1974
+ var webstate = JSON.parse(message.event.state);
1975
+ for (var i in webstate) { localStorage.setItem(i, webstate[i]); }
1976
+
1977
+ // Update the web page
1978
+ if ((webstate.deskAspectRatio != null) && (webstate.deskAspectRatio != deskAspectRatio)) { deskAspectRatio = webstate.deskAspectRatio; deskAdjust(); }
1979
+ if ((webstate.showRealNames != null) && (webstate.showRealNames != oldShowRealNames)) { showRealNames = Q('RealNameCheckBox').checked = (webstate.showRealNames == '1'); masterUpdate(6); }
1980
+ if ((webstate.uiMode != null) && (webstate.uiMode != oldUiMode)) { userInterfaceSelectMenu(parseInt(webstate.uiMode)); }
1981
+ if ((webstate.sort != null) && (webstate.sort != oldSort)) { document.getElementById('sortselect').selectedIndex = sort = parseInt(webstate.sort); masterUpdate(6); }
1982
+ if ((webstate.loctag != null) && (webstate.loctag != oldLoctag)) { if (webstate.loctag != null) { args.locale = webstate.loctag; } else { delete args.locale; } masterUpdate(0xFFFFFFFF); }
1983
+ }
1984
+ break;
1985
+ }
1986
+ case 'servertimelinestats': { addServerTimelineStats(message.event.data); break; }
1987
+ case 'accountcreate':
1988
+ case 'accountchange': {
1989
+ // An account was created or changed
1990
+ if (userinfo.name == message.event.account.name) {
1991
+ var newsiteadmin = message.event.account.siteadmin?message.event.account.siteadmin:0;
1992
+ var oldsiteadmin = userinfo.siteadmin?userinfo.siteadmin:0;
1993
+ if ((message.event.account.quota != userinfo.quota) || (((userinfo.siteadmin & 8) == 0) && ((message.event.account.siteadmin & 8) != 0))) { meshserver.send({ action: 'files' }); }
1994
+ var oldgroups = userinfo.groups;
1995
+ userinfo = message.event.account;
1996
+ if (oldsiteadmin != newsiteadmin) updateSiteAdmin();
1997
+ updateSelf();
1998
+
1999
+ if ((userinfo.siteadmin & 2) != 0) {
2000
+ // Compare our groups
2001
+ var og = oldgroups ? oldgroups : [];
2002
+ var ng = userinfo.groups ? userinfo.groups : [];
2003
+ if (og.join(',') != ng.join(',')) {
2004
+ // Our groups have changed, re-ask for a list of users.
2005
+ users = wssessions = null;
2006
+ meshserver.send({ action: 'users' });
2007
+ meshserver.send({ action: 'wssessioncount' });
2008
+ }
2009
+ }
2010
+ }
2011
+ if (users == null) break;
2012
+
2013
+ // Check if the account is part of our user group
2014
+ if ((userinfo.groups == null) || (userinfo.groups.length == 0) || (findOne(message.event.account.groups, userinfo.groups) == true)) {
2015
+ users[message.event.account._id] = message.event.account; // Part of our groups, update this user.
2016
+ } else {
2017
+ delete users[message.event.account._id]; // No longer part of our groups, remove this user.
2018
+ }
2019
+
2020
+ updateUsers();
2021
+ break;
2022
+ }
2023
+ case 'accountremove': {
2024
+ // An account was removed
2025
+ if (users == null) break;
2026
+ delete users['user/' + domain + '/' + message.event.username.toLowerCase()];
2027
+ updateUsers();
2028
+ break;
2029
+ }
2030
+ case 'createmesh': {
2031
+ // A new mesh was created
2032
+ if ((meshes[message.event.meshid] == null) && (message.event.links[userinfo._id] != 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.
2033
+ meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
2034
+ masterUpdate(4 + 128);
2035
+ meshserver.send({ action: 'files' });
2036
+ }
2037
+ break;
2038
+ }
2039
+ case 'meshchange': {
2040
+ // Update mesh information
2041
+ if (meshes[message.event.meshid] == null) {
2042
+ // This is a new mesh for us
2043
+ meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
2044
+ meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
2045
+ } else {
2046
+ // This is an existing mesh
2047
+ if (message.event.name != null) {
2048
+ meshes[message.event.meshid].name = message.event.name;
2049
+ for (var i in nodes) { if (nodes[i].meshid == message.event.meshid) { nodes[i].meshnamel = message.event.name.toLowerCase(); } }
2050
+ }
2051
+ if (message.event.desc != null) { meshes[message.event.meshid].desc = message.event.desc; }
2052
+ if (message.event.flags != null) { meshes[message.event.meshid].flags = message.event.flags; }
2053
+ if (message.event.consent != null) { meshes[message.event.meshid].consent = message.event.consent; }
2054
+ if (message.event.links) { meshes[message.event.meshid].links = message.event.links; }
2055
+ if (message.event.amt) { meshes[message.event.meshid].amt = message.event.amt; }
2056
+
2057
+ // Check if we lost rights to this mesh in this change.
2058
+ if (meshes[message.event.meshid].links[userinfo._id] == null) {
2059
+ if ((xxcurrentView == 20) && (currentMesh == meshes[message.event.meshid])) go(2);
2060
+ delete meshes[message.event.meshid];
2061
+
2062
+ // Delete all nodes in that mesh
2063
+ var newnodes = [];
2064
+ for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } }
2065
+ nodes = newnodes;
2066
+
2067
+ // If we are looking at a node in the deleted mesh, move back to "My Devices"
2068
+ if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) { setDialogMode(0); go(1); }
2069
+ }
2070
+ }
2071
+ masterUpdate(4 + 128);
2072
+ if (currentNode && (currentNode.meshid == message.event.meshid)) { currentNode = null; if ((xxcurrentView >= 10) && (xxcurrentView < 20)) { go(1); } }
2073
+ //meshserver.send({ action: 'files' }); // TODO: Why do we need to do this??
2074
+
2075
+ // If we are looking at a mesh that is now deleted, move back to "My Account"
2076
+ if (xxcurrentView == 20 && currentMesh._id == message.event.meshid) { masterUpdate(4096); }
2077
+ break;
2078
+ }
2079
+ case 'deletemesh': {
2080
+ // Delete the mesh
2081
+ if (meshes[message.event.meshid]) {
2082
+ delete meshes[message.event.meshid];
2083
+ masterUpdate(128);
2084
+ meshserver.send({ action: 'files' });
2085
+ }
2086
+
2087
+ // Delete all nodes in that mesh
2088
+ var newnodes = [];
2089
+ if (nodes != null) { for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } } }
2090
+ nodes = newnodes;
2091
+ masterUpdate(4);
2092
+
2093
+ // If we are looking at a mesh that is now deleted, move back to "My Account"
2094
+ if (xxcurrentView >= 20 && xxcurrentView < 30 && currentMesh._id == message.event.meshid) { setDialogMode(0); go(2); }
2095
+ // If we are looking at a node in the deleted mesh, move back to "My Devices"
2096
+ if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) { setDialogMode(0); go(1); }
2097
+
2098
+ break;
2099
+ }
2100
+ case 'addnode': {
2101
+ var node = message.event.node;
2102
+ 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.
2103
+ if (getNodeFromId(node._id) != null) break; // This node is already known.
2104
+ node.namel = node.name.toLowerCase();
2105
+ if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
2106
+ node.meshnamel = meshes[node.meshid].name.toLowerCase();
2107
+ node.state = 0;
2108
+ if (!node.icon) node.icon = 1;
2109
+ node.ident = ++nodeShortIdent;
2110
+ if (nodes == null) { }
2111
+ nodes.push(node);
2112
+
2113
+ // Web page update
2114
+ masterUpdate(1 | 2 | 4 | 16);
2115
+
2116
+ break;
2117
+ }
2118
+ case 'removenode': {
2119
+ var index = -1;
2120
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
2121
+ if (index != -1) {
2122
+ var node = nodes[index];
2123
+ if (currentNode == node) {
2124
+ if (xxcurrentView >= 10 && xxcurrentView < 20) { setDialogMode(0); go(1); }
2125
+ currentNode = null;
2126
+ // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
2127
+ }
2128
+ nodes.splice(index, 1);
2129
+
2130
+ // Web page update
2131
+ masterUpdate(4 | 16);
2132
+ }
2133
+ break;
2134
+ }
2135
+ case 'changenode': {
2136
+ var index = -1;
2137
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
2138
+ if (index != -1) {
2139
+ var node = nodes[index];
2140
+
2141
+ // Change the node
2142
+ node.name = message.event.node.name;
2143
+ node.rname = message.event.node.rname;
2144
+ node.users = message.event.node.users;
2145
+ node.host = message.event.node.host;
2146
+ node.desc = message.event.node.desc;
2147
+ node.ip = message.event.node.ip;
2148
+ node.osdesc = message.event.node.osdesc;
2149
+ node.publicip = message.event.node.publicip;
2150
+ node.iploc = message.event.node.iploc;
2151
+ node.wifiloc = message.event.node.wifiloc;
2152
+ node.gpsloc = message.event.node.gpsloc;
2153
+ node.tags = message.event.node.tags;
2154
+ node.userloc = message.event.node.userloc;
2155
+ if (message.event.node.agent != null) {
2156
+ if (node.agent == null) node.agent = {};
2157
+ if (message.event.node.agent.ver != null) { node.agent.ver = message.event.node.agent.ver; }
2158
+ if (message.event.node.agent.id != null) { node.agent.id = message.event.node.agent.id; }
2159
+ if (message.event.node.agent.caps != null) { node.agent.caps = message.event.node.agent.caps; }
2160
+ if (message.event.node.agent.core != null) { node.agent.core = message.event.node.agent.core; } else { if (node.agent.core) { delete node.agent.core; } }
2161
+ node.agent.tag = message.event.node.agent.tag;
2162
+ }
2163
+ if (message.event.node.intelamt != null) {
2164
+ if (node.intelamt == null) node.intelamt = {};
2165
+ if (message.event.node.intelamt.state != null) { node.intelamt.state = message.event.node.intelamt.state; }
2166
+ if (message.event.node.intelamt.host != null) { node.intelamt.user = message.event.node.intelamt.host; }
2167
+ if (message.event.node.intelamt.user != null) { node.intelamt.user = message.event.node.intelamt.user; }
2168
+ if (message.event.node.intelamt.tls != null) { node.intelamt.tls = message.event.node.intelamt.tls; }
2169
+ if (message.event.node.intelamt.ver != null) { node.intelamt.ver = message.event.node.intelamt.ver; }
2170
+ if (message.event.node.intelamt.tag != null) { node.intelamt.tag = message.event.node.intelamt.tag; }
2171
+ if (message.event.node.intelamt.uuid != null) { node.intelamt.uuid = message.event.node.intelamt.uuid; }
2172
+ if (message.event.node.intelamt.realm != null) { node.intelamt.realm = message.event.node.intelamt.realm; }
2173
+ }
2174
+ if (message.event.node.av != null) { node.av = message.event.node.av; }
2175
+ node.namel = node.name.toLowerCase();
2176
+ if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
2177
+ if (message.event.node.icon) { node.icon = message.event.node.icon; }
2178
+
2179
+ // Web page update
2180
+ masterUpdate(2 | 4 | 8 | 16);
2181
+ refreshDevice(node._id);
2182
+
2183
+ if ((currentNode == node) && (xxdialogMode != null) && (xxdialogTag == '@xxmap')) { p10showNodeLocationDialog(); }
2184
+ }
2185
+ break;
2186
+ }
2187
+ case 'nodemeshchange': {
2188
+ var index = -1;
2189
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
2190
+ if (index != -1) {
2191
+ var node = nodes[index];
2192
+ if (meshes[message.event.newMeshId] == null) {
2193
+ // We don't see the new mesh, remove this device
2194
+
2195
+ // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
2196
+ if (currentNode == node) { if (xxcurrentView >= 10 && xxcurrentView < 20) { setDialogMode(0); go(1); } currentNode = null; }
2197
+ nodes.splice(index, 1);
2198
+ masterUpdate(4 | 16);
2199
+ } else {
2200
+ // We see the new mesh, move this device
2201
+ node.meshid = message.event.newMeshId;
2202
+ node.meshnamel = meshes[message.event.newMeshId].name.toLowerCase();
2203
+ masterUpdate(1 | 2 | 4);
2204
+ }
2205
+ refreshDevice(message.event.nodeid);
2206
+ } else {
2207
+ // This is a new device, add it.
2208
+ var node = message.event.node;
2209
+ 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.
2210
+ node.namel = node.name.toLowerCase();
2211
+ if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
2212
+ node.meshnamel = meshes[node.meshid].name.toLowerCase();
2213
+ node.state = 0;
2214
+ if (!node.icon) node.icon = 1;
2215
+ node.ident = ++nodeShortIdent;
2216
+ if (nodes == null) { }
2217
+ nodes.push(node);
2218
+
2219
+ // Web page update
2220
+ masterUpdate(1 | 2 | 4 | 16);
2221
+ }
2222
+ break;
2223
+ }
2224
+ case 'nodeconnect': {
2225
+ // Indicated a node has changed connectivity state
2226
+ var index = -1;
2227
+ for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
2228
+ if (index != -1) {
2229
+ var node = nodes[index];
2230
+
2231
+ // Event the connection change if needed
2232
+ var n = getstore('notifications', 0); // Account notification settings
2233
+
2234
+ // Per-group notification settings
2235
+ if (message.event.meshid && userinfo.links && userinfo.links[message.event.meshid] && userinfo.links[message.event.meshid].notify) {
2236
+ n &= userinfo.links[message.event.meshid].notify;
2237
+ } else {
2238
+ n = 0;
2239
+ }
2240
+
2241
+ // Show the notification
2242
+ if (n & 2) {
2243
+ if (((node.conn & 1) == 0) && ((message.event.conn & 1) != 0)) { addNotification({ text: "Agent připojen", title: node.name, icon: node.icon, nodeid: node._id }); }
2244
+ if (((node.conn & 2) == 0) && ((message.event.conn & 2) != 0)) { addNotification({ text: "Intel AMT detected", title: node.name, icon: node.icon, nodeid: node._id }); }
2245
+ if (((node.conn & 4) == 0) && ((message.event.conn & 4) != 0)) { addNotification({ text: "Intel AMT CIRA connected", title: node.name, icon: node.icon, nodeid: node._id }); }
2246
+ if (((node.conn & 16) == 0) && ((message.event.conn & 16) != 0)) { addNotification({ text: "MQTT připojeno", title: node.name, icon: node.icon, nodeid: node._id }); }
2247
+ }
2248
+ if (n & 4) {
2249
+ if (((node.conn & 1) != 0) && ((message.event.conn & 1) == 0)) { addNotification({ text: "Agent disconnected", title: node.name, icon: node.icon, nodeid: node._id }); }
2250
+ if (((node.conn & 2) != 0) && ((message.event.conn & 2) == 0)) { addNotification({ text: "Intel AMT not detected", title: node.name, icon: node.icon, nodeid: node._id }); }
2251
+ if (((node.conn & 4) != 0) && ((message.event.conn & 4) == 0)) { addNotification({ text: "Intel AMT CIRA disconnected", title: node.name, icon: node.icon, nodeid: node._id }); }
2252
+ if (((node.conn & 16) != 0) && ((message.event.conn & 16) == 0)) { addNotification({ text: "MQTT disconnected", title: node.name, icon: node.icon, nodeid: node._id }); }
2253
+ }
2254
+
2255
+ // Change the node connection state
2256
+ node.conn = message.event.conn;
2257
+ node.pwr = message.event.pwr;
2258
+
2259
+ // Web page update
2260
+ masterUpdate(4 | 16);
2261
+ refreshDevice(node._id);
2262
+ }
2263
+ break;
2264
+ }
2265
+ case 'wssessioncount': {
2266
+ // Update the active web socket session count for a user
2267
+ if (wssessions != null) {
2268
+ if (message.event.count == 0 && wssessions['user/' + domain + '/' + message.event.username.toLowerCase()]) {
2269
+ delete wssessions['user/' + domain + '/' + message.event.username.toLowerCase()];
2270
+ } else {
2271
+ wssessions['user/' + domain + '/' + message.event.username.toLowerCase()] = message.event.count;
2272
+ }
2273
+ updateUsers();
2274
+ }
2275
+ break;
2276
+ }
2277
+ case 'login': {
2278
+ // Update the last login time
2279
+ if (users != null && users['user/' + domain + '/' + message.event.username.toLowerCase()]) {
2280
+ users['user/' + domain + '/' + message.event.username.toLowerCase()].login = Math.floor(new Date(message.event.time).getTime() / 1000);
2281
+ }
2282
+ break;
2283
+ }
2284
+ case 'scanamtdevice': {
2285
+ // Populate the Intel AMT scan dialog box with the result of the RMCP scan
2286
+ if ((xxdialogMode == null) || (!Q('dp1range')) || (Q('dp1range').value != message.event.range)) return;
2287
+ var x = '';
2288
+ if (message.event.results == null) {
2289
+ // The scan could not occur because of an error. Likely the user range was invalid.
2290
+ x = '<div style=width:100%;text-align:center;margin-top:12px>' + "Nelze skenovat tento rozsah." + '</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>';
2291
+ } else {
2292
+ // Go thru all the results and populate the dialog box
2293
+ amtScanResults = message.event.results;
2294
+ for (var i in message.event.results) {
2295
+ var r = message.event.results[i], shortname = r.hostname;
2296
+ if (shortname.length > 20) { shortname = shortname.substring(0, 20) + '...'; }
2297
+ var str = '<b title="' + EscapeHtml(r.hostname) + '">' + EscapeHtml(shortname) + '</b> - v' + r.ver;
2298
+ if (r.state == 2) { if (r.tls == 1) { str += " with TLS."; } else { str += " bez TLS."; } } else { str += ' not activated.'; }
2299
+ 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>';
2300
+ }
2301
+ // If no results where found, display a nice message
2302
+ 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>'; }
2303
+ }
2304
+ // Set the html in the dialog box and re-enable the scan button
2305
+ QH('dp1results', x);
2306
+ QE('dp1range', true);
2307
+ QE('dp1rangebutton', true);
2308
+ break;
2309
+ }
2310
+ case 'notify': {
2311
+ var n = { text: message.event.value, title: message.event.title, icon: message.event.icon };
2312
+ if (message.event.tag != null) { n.tag = message.event.tag; }
2313
+ addNotification(n);
2314
+ break;
2315
+ }
2316
+ case 'traceinfo': {
2317
+ if (typeof message.event.traceSources == 'object') {
2318
+ if ((message.event.traceSources != null) && (message.event.traceSources.length > 0)) {
2319
+ serverTraceSources = message.event.traceSources;
2320
+ QH('p41traceStatus', EscapeHtml(message.event.traceSources.join(', ')));
2321
+ } else {
2322
+ serverTraceSources = [];
2323
+ QH('p41traceStatus', "Nic");
2324
+ }
2325
+ }
2326
+ break;
2327
+ }
2328
+ case 'sysinfohash': {
2329
+ // If the sysinfo document has changed and we are looking at it, request an update.
2330
+ if ((currentNode != null) && (message.event.nodeid == powerTimelineReq)) {
2331
+ meshserver.send({ action: 'getsysinfo', nodeid: message.event.nodeid });
2332
+ }
2333
+ break;
2334
+ }
2335
+ case 'stopped': { // Server is stopping.
2336
+ // Disconnect
2337
+ //console.log(message.msg);
2338
+ break;
2339
+ }
2340
+ case 'updatePluginList': {
2341
+ installedPluginList = message.event.list;
2342
+ updatePluginList();
2343
+ break;
2344
+ }
2345
+ case 'pluginStateChange': {
2346
+ if (pluginHandler == null) break;
2347
+ pluginHandler.refreshPluginHandler();
2348
+ break;
2349
+ }
2350
+ default:
2351
+ //console.log('Unknown message.event.action', message.event.action);
2352
+ break;
2353
+ }
2354
+ break;
2355
+ }
2356
+ case 'createInviteLink': { // Agent installation invitation link
2357
+ if (xxdialogTag != message.meshid) break;
2358
+ var servername = serverinfo.name;
2359
+ if ((servername.indexOf('.') == -1) || ((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.
2360
+ var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
2361
+ var url;
2362
+ if (serverinfo.https == true) {
2363
+ var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
2364
+ url = 'https://' + servername + portStr + domainUrl + 'agentinvite?c=' + message.cookie;
2365
+ } else {
2366
+ var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
2367
+ url = 'http://' + servername + portStr + domainUrl + 'agentinvite?c=' + message.cookie;
2368
+ }
2369
+ Q('agentInvitationLink').href = url;
2370
+ var t = format("{0} hodina{1}", message.expire, addLetterS(message.expire));
2371
+ if (message.expire == 24) { t = "1 den"; }
2372
+ if (message.expire == 168) { t = "1 týden"; }
2373
+ if (message.expire == 5040) { t = "1 měsíc"; }
2374
+ if (message.expire == 0) { t = "Bez limitu"; }
2375
+ QH('agentInvitationLink', format("Link pro pozvání ({0})", t));
2376
+ QV('agentInvitationLinkDiv', true);
2377
+ break;
2378
+ }
2379
+ case 'getmqttlogin': {
2380
+ if ((currentNode == null) || (currentNode._id != message.nodeid) || (xxdialogMode != null)) return;
2381
+ var x = "These settings can be used to connect MQTT for this device." + '<br /><br />';
2382
+ delete message.action;
2383
+ delete message.nodeid;
2384
+ x += '<textarea readonly=readonly style=width:100%;resize:none;height:100px;overflow:auto;font-size:12px readonly>' + JSON.stringify(message) + '</textarea>';
2385
+ /*
2386
+ x += addHtmlValue('Username', '<input style=width:230px readonly value="' + message.user + '" />');
2387
+ x += addHtmlValue('Password', '<input style=width:230px readonly value="' + message.pass + '" />');
2388
+ x += addHtmlValue('WS URL', '<input style=width:230px readonly value="' + message.wsUrl + '" />');
2389
+ if (message.mpsUrl && message.mpsCertHash) {
2390
+ x += addHtmlValue('MPS URL', '<input style=width:230px readonly value="' + message.mpsUrl + '" />');
2391
+ x += addHtmlValue('MPS Cert Hash', '<input style=width:230px readonly value="' + message.mpsCertHash + '" />');
2392
+ }
2393
+ */
2394
+ setDialogMode(2, "MQTT Credentials", 1, null, x);
2395
+ break;
2396
+ }
2397
+ case 'stopped': { // Server is stopping.
2398
+ // Disconnect
2399
+ autoReconnect = false;
2400
+ QH('p0span', message.msg);
2401
+ break;
2402
+ }
2403
+ case 'updatePluginList': {
2404
+ installedPluginList = message.list;
2405
+ updatePluginList();
2406
+ break;
2407
+ }
2408
+ case 'pluginVersionsAvailable': {
2409
+ if (pluginHandler == null) break;
2410
+ updatePluginList(message.list);
2411
+ break;
2412
+ }
2413
+ case 'downgradePluginVersions': {
2414
+ var vSelect = '<select id="lastPluginVersion">';
2415
+ message.info.versionList.forEach(function(v) { vSelect += '<option value="' + v.zipball_url + '">' + v.name + '</option>'; });
2416
+ vSelect += '</select>';
2417
+ setDialogMode(2, "Plugin Action", 3, pluginActionEx, format('Select the version to downgrade the plugin: {0}', message.info.name) + '<hr />' + vSelect + '<hr />' + "Please be aware that downgrading is not recommended. Please only do so in the event that a recent upgrade has broken something." + + '<input id="lastPluginAct" type="hidden" value="downgrade" /><input id="lastPluginId" type="hidden" value="' + message.info.id + '" />');
2418
+ break;
2419
+ }
2420
+ case 'pluginError': {
2421
+ setDialogMode(2, "Plugin Error", 1, null, message.msg);
2422
+ break;
2423
+ }
2424
+ case 'plugin': {
2425
+ if ((pluginHandler == null) || (typeof message.plugin != 'string')) break;
2426
+ try { pluginHandler[message.plugin][message.method](server, message); } catch (e) { console.log('Error loading plugin handler ('+ e + ')'); }
2427
+ break;
2428
+ }
2429
+ default:
2430
+ //console.log('Unknown message.action', message.action);
2431
+ break;
2432
+ }
2433
+ }
2434
+
2435
+ //
2436
+ // MY DEVICES
2437
+ //
2438
+
2439
+ function onRealNameCheckBox() {
2440
+ showRealNames = Q('RealNameCheckBox').checked;
2441
+ putstore('showRealNames', showRealNames ? 1 : 0);
2442
+ masterUpdate(6);
2443
+ return;
2444
+ }
2445
+
2446
+ function onDeviceViewChange(i) {
2447
+ if (i != null) { Q('viewselect').value = i; }
2448
+ for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); }
2449
+ Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel');
2450
+ putstore('_deviceView', Q('viewselect').value);
2451
+ putstore('_viewsize', Q('sizeselect').value);
2452
+ masterUpdate(4);
2453
+ setTimeout(function () { masterUpdate(512); }, 200);
2454
+ }
2455
+
2456
+ function ondockeypress(e) {
2457
+ setSessionActivity();
2458
+ if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) {
2459
+ // Check what keys we are allows to send
2460
+ if (currentNode != null) {
2461
+ var mesh = meshes[currentNode.meshid];
2462
+ var meshrights = mesh.links[userinfo._id].rights;
2463
+ var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
2464
+ if (inputAllowed == false) return false;
2465
+ var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
2466
+ if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
2467
+ }
2468
+ return desktop.m.handleKeys(e);
2469
+ }
2470
+ if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) { return terminal.m.TermHandleKeys(e); }
2471
+ if (!xxdialogMode && ((xxcurrentView == 15) || (xxcurrentView == 115))) return agentConsoleHandleKeys(e);
2472
+ if (!xxdialogMode && xxcurrentView == 4) {
2473
+ if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
2474
+ var processed = 0;
2475
+ if (e.key) {
2476
+ if (e.key.length === 1 && userSearchFocus == 0) { Q('UserSearchInput').value = ((Q('UserSearchInput').value + e.key)); processed = 1; }
2477
+ if (e.keyCode == 8 && userSearchFocus == 0) { var x = Q('UserSearchInput').value; Q('UserSearchInput').value = x.substring(0, x.length - 1); processed = 1; }
2478
+ if (e.keyCode == 27) { Q('UserSearchInput').value = ''; processed = 1; }
2479
+ } else {
2480
+ if (e.charCode != 0 && userSearchFocus == 0) { Q('UserSearchInput').value = ((Q('UserSearchInput').value + String.fromCharCode(e.charCode))); processed = 1; }
2481
+ }
2482
+ if (processed > 0) { if (processed == 1) { onUserSearchInputChanged(); } return haltEvent(e); }
2483
+ }
2484
+ if (xxdialogMode || xxcurrentView != 1) return;
2485
+ if (e.ctrlKey == true && e.charCode == 96) {
2486
+ showRealNames = !showRealNames;
2487
+ Q('RealNameCheckBox').value = showRealNames;
2488
+ putstore('showRealNames', showRealNames ? 1 : 0);
2489
+ masterUpdate(6)
2490
+ return;
2491
+ }
2492
+ if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
2493
+ if (Q('viewselect').value < 3) {
2494
+ var processed = 0;
2495
+ if (e.key) {
2496
+ if (e.key.length === 1 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + e.key)); processed = 1; }
2497
+ if (e.keyCode == 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = x.substring(0, x.length - 1); processed = 1; }
2498
+ if (e.keyCode == 27) { Q('SearchInput').value = ''; processed = 1; }
2499
+ } else {
2500
+ if (e.charCode != 0 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + String.fromCharCode(e.charCode))); processed = 1; }
2501
+ }
2502
+ if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
2503
+ }
2504
+ if (Q('viewselect').value == 3) {
2505
+ if (e.key) {
2506
+ if (e.key.length === 1 && mapSearchFocus == 0) { Q('mapSearchLocation').value = ((Q('mapSearchLocation').value + e.key)); processed = 1; }
2507
+ //if (e.keyCode == 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = x.substring(0, x.length - 1); processed = 1; }
2508
+ if (e.keyCode == 27) { Q('mapSearchLocation').value = ''; mapCloseSearchWindow(); processed = 1; }
2509
+ if (e.keyCode == 13) { getSearchLocation(); }
2510
+ } else {
2511
+ if (e.charCode != 0 && mapSearchFocus == 0) { Q('mapSearchLocation').value = ((Q('mapSearchLocation').value + String.fromCharCode(e.charCode))); processed = 1; }
2512
+ }
2513
+ }
2514
+ }
2515
+
2516
+ function ondockeydown(e) {
2517
+ setSessionActivity();
2518
+ if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) {
2519
+ // Check what keys we are allows to send
2520
+ if (currentNode != null) {
2521
+ var mesh = meshes[currentNode.meshid];
2522
+ var meshrights = mesh.links[userinfo._id].rights;
2523
+ var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
2524
+ if (inputAllowed == false) return false;
2525
+ var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
2526
+ if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
2527
+ }
2528
+ return desktop.m.handleKeyDown(e);
2529
+ }
2530
+ if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) { terminal.m.TermHandleKeyDown(e); if ((e.keyCode >= 37) && (e.keyCode <= 40)) { haltEvent(e); } }
2531
+ if (!xxdialogMode && xxcurrentView == 13 && e.keyCode == 116 && p13filetree != null) { haltEvent(e); return false; } // F5 Refresh on files
2532
+ if (!xxdialogMode && ((xxcurrentView == 15) || (xxcurrentView == 115))) { return agentConsoleHandleKeys(e); }
2533
+ if (!xxdialogMode && xxcurrentView == 4) {
2534
+ if (e.keyCode === 8 && userSearchFocus == 0) { var x = Q('UserSearchInput').value; Q('UserSearchInput').value = (x.substring(0, x.length - 1)); processed = 1; }
2535
+ if (e.keyCode === 27) { Q('UserSearchInput').value = ''; processed = 1; }
2536
+ if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
2537
+ }
2538
+ if (xxdialogMode || xxcurrentView != 1 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
2539
+ var processed = 0;
2540
+ if (Q('viewselect').value < 3) {
2541
+ if (e.keyCode === 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = (x.substring(0, x.length - 1)); processed = 1; }
2542
+ if (e.keyCode === 27) { Q('SearchInput').value = ''; processed = 1; }
2543
+ if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); }
2544
+ }
2545
+ if (Q('viewselect').value == 3) {
2546
+ if (e.keyCode === 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = (x.substring(0, x.length - 1)); processed = 1; }
2547
+ if (e.keyCode === 27) { Q('mapSearchLocation').value = ''; mapCloseSearchWindow(); processed = 1; }
2548
+ }
2549
+ }
2550
+
2551
+ function ondockeyup(e) {
2552
+ setSessionActivity();
2553
+ if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) {
2554
+ // Check what keys we are allows to send
2555
+ if (currentNode != null) {
2556
+ var mesh = meshes[currentNode.meshid];
2557
+ var meshrights = mesh.links[userinfo._id].rights;
2558
+ var inputAllowed = ((meshrights == 0xFFFFFFFF) || (((meshrights & 8) != 0) && ((meshrights & 256) == 0)));
2559
+ if (inputAllowed == false) return false;
2560
+ var limitedInputAllowed = ((meshrights != 0xFFFFFFFF) && (((meshrights & 8) != 0) && ((meshrights & 256) == 0) && ((meshrights & 4096) != 0)));
2561
+ if (limitedInputAllowed == true) { if ((e.altKey == true) || (e.ctrlKey == true) || ((e.keyCode < 32) && (e.keyCode != 8) && (e.keyCode != 13)) || (e.keyCode > 90)) return false; }
2562
+ }
2563
+ return desktop.m.handleKeyUp(e);
2564
+ }
2565
+ if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) { return terminal.m.TermHandleKeyUp(e); }
2566
+ if (!xxdialogMode && xxcurrentView == 13 && e.keyCode == 116 && p13filetree != null) { p13folderup(9999); haltEvent(e); return false; } // F5 Refresh on files
2567
+ if (!xxdialogMode && xxcurrentView == 4) { if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
2568
+ if (xxdialogMode && e.keyCode == 27) { dialogclose(0); }
2569
+ if (xxdialogMode || xxcurrentView != 0 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
2570
+ if (Q('viewselect').value < 3) { if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
2571
+ if (Q('viewselect').value == 3) { if ((e.keyCode === 8 && mapSearchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
2572
+ }
2573
+
2574
+ //function ondocfocus() { }
2575
+ // TODO: Add handleReleaseKeys() for Intel AMT.
2576
+ function ondocblur() { if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked && desktop.m.handleReleaseKeys) { return desktop.m.handleReleaseKeys(); } }
2577
+
2578
+ // Highlights the device being hovered
2579
+ function devMouseHover(element, over) {
2580
+ setSessionActivity();
2581
+ var view = Q('viewselect').value;
2582
+ if (view == 1) {
2583
+ var e = element.children[1].children[1];
2584
+ e.children[0].classList.remove('g1s');
2585
+ e.children[1].classList.remove('e2s');
2586
+ e.children[2].classList.remove('g2s');
2587
+ if (over == 1) {
2588
+ e.children[0].classList.add('g1s');
2589
+ e.children[1].classList.add('e2s');
2590
+ e.children[2].classList.add('g2s');
2591
+ }
2592
+ } else if (view == 2) {
2593
+ var e = element;
2594
+ e.children[2].classList.remove('g1s');
2595
+ e.children[4].classList.remove('e2s');
2596
+ e.children[3].classList.remove('g2s');
2597
+ if (over == 1) {
2598
+ e.children[2].classList.add('g1s');
2599
+ e.children[4].classList.add('e2s');
2600
+ e.children[3].classList.add('g2s');
2601
+ }
2602
+ }
2603
+ }
2604
+
2605
+ var deviceHeaderId = 0;
2606
+ var deviceHeaderTotal = 0;
2607
+ var deviceHeadersTitles = {};
2608
+ var deviceHeaderCount;
2609
+ var deviceHeaders = {};
2610
+ var oldviewmode = 0;
2611
+ function updateDevices() {
2612
+ if (nodes == null) { return; }
2613
+ var r = '', c = 0, current = null, count = 0, displayedMeshes = {}, view = Q('viewselect').value, groups = {}, groupCount = {};
2614
+ QV('xdevices', view < 4);
2615
+ QV('xdevicesmap', view == 4);
2616
+ QV('devListToolbar', view < 3);
2617
+ QV('kvmListToolbar', view == 3);
2618
+ QV('devMapToolbar', view == 4);
2619
+ QV('devListToolbarSize', view == 3);
2620
+ QV('NoMeshesPanel', meshcount == 0);
2621
+ //QV('devListToolbarView', (meshcount != 0) && (nodes.length > 0));
2622
+ QV('devListToolbarViewIcons', (meshcount != 0) && (nodes.length > 0));
2623
+ QV('devListToolbarSort', (meshcount != 0) && (nodes.length > 0) && (view < 4));
2624
+ if ((meshcount == 0) || (nodes.length == 0)) { view = 1; sort = 0; }
2625
+ if (view == 4) {
2626
+ setTimeout( function() { if (xxmap.map != null) { xxmap.map.updateSize(); } }, 200);
2627
+ // TODO
2628
+ } else {
2629
+ // 3 wide, list view or desktop view
2630
+ deviceHeaderId = 0;
2631
+ deviceHeaderCount = {};
2632
+ deviceHeaderTotal = 0;
2633
+ deviceHeaders = {};
2634
+ deviceHeadersTitles = {};
2635
+ var kvmDivs = [];
2636
+
2637
+ // Perform node sort
2638
+ if (sort == 0) { nodes.sort(meshSort); }
2639
+ else if (sort == 1) { nodes.sort(powerSort); }
2640
+ else if (sort == 2) { if (showRealNames == true) { nodes.sort(deviceHostSort); } else { nodes.sort(deviceSort); } }
2641
+
2642
+ // Save the list of currently checked nodeid's
2643
+ var checkedNodeids = [], elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
2644
+ for (var i=0;i<elements.length;i++) { if (elements[i].checked) { checkedNodeids.push(elements[i].value); } }
2645
+ if ((oldviewmode < 3) && (view == 3)) { multiDesktopFilter = checkedNodeids; }
2646
+ else if ((oldviewmode == 3) && (view < 3)) { checkedNodeids = multiDesktopFilter; }
2647
+
2648
+ // Compute the width of the device view.
2649
+ var totalDeviceViewWidth = Q('column_l').clientWidth - 60;
2650
+ var deviceBoxWidth = Math.floor(totalDeviceViewWidth / 301);
2651
+ deviceBoxWidth = 301 + Math.floor((totalDeviceViewWidth - (deviceBoxWidth * 301)) / deviceBoxWidth);
2652
+
2653
+ if ((view == 2) && (sort != 3)) {
2654
+ r += '<table style=width:100%;margin-top:4px cellpadding=0 cellspacing=0><th style=color:gray><th style=color:gray;width:120px>' + "User" + '<th style=color:gray;width:120px>' + "Adresa" + '<th style=color:gray;width:100px>' + "Connectivity"; //<th style=color:gray;width:100px>State';
2655
+ }
2656
+
2657
+ // Go thru the list of nodes and display them
2658
+ for (var i in nodes) {
2659
+ var node = nodes[i];
2660
+ if (node.v == false) continue;
2661
+ var mesh2 = meshes[node.meshid], meshlinks = mesh2.links[userinfo._id];
2662
+ if (meshlinks == null) continue;
2663
+ var meshrights = meshlinks.rights;
2664
+ if ((view == 3) && (mesh2.mtype == 1)) continue;
2665
+ if (sort == 0) {
2666
+ // Mesh header
2667
+ if (node.meshid != current) {
2668
+ deviceHeaderSet();
2669
+ var extra = '';
2670
+ if (view == 2) { r += '<tr><td colspan=5>'; }
2671
+ if (meshes[node.meshid].mtype == 1) { extra = '<span class=devHeaderx>' + ", Intel® AMT only" + '</span>'; }
2672
+ if ((view == 1) && (current != null)) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } }
2673
+ if (view == 2) { r += '<div>'; }
2674
+ r += '<div class=DevSt style=width:100%;padding-top:4px><span style=float:right>';
2675
+ r += '<span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx></span>' + extra;
2676
+ r += '</span><span id=MxMESH tabindex=0 style=cursor:pointer onclick=gotoMesh("' + node.meshid + '") onkeypress="if (event.key==\'Enter\') gotoMesh(\'' + node.meshid + '\')">' + EscapeHtml(meshes[node.meshid].name) + '</span>' + getMeshActions(mesh2, meshrights) + '</div>';
2677
+ if (view == 2) { r += '</div>'; }
2678
+ current = node.meshid;
2679
+ displayedMeshes[current] = 1;
2680
+ c = 0;
2681
+ }
2682
+ } else if (sort == 1) {
2683
+ // Power header
2684
+ var pwr = node.pwr?node.pwr:0;
2685
+ if (pwr !== current) {
2686
+ deviceHeaderSet();
2687
+ if ((view == 1) && (current !== null)) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } if (r != '') { r += '</tr></table>'; } }
2688
+
2689
+ if (view == 2) { r += '<tr><td>'; }
2690
+ r += '<div class=DevSt style=width:100%;padding-top:4px><span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx style=float:right></span><span>' + PowerStateStr2(node.pwr) + '</span></div>';
2691
+
2692
+ current = pwr;
2693
+ c = 0;
2694
+ }
2695
+ } else if (sort == 2) {
2696
+ // Device header
2697
+ if (current == null) { current = '1'; }
2698
+ }
2699
+
2700
+ count++;
2701
+ var title = EscapeHtml(node.name);
2702
+ if (title.length == 0) { title = '<i>' + "Nic" + '</i>'; }
2703
+ if ((node.rname != null) && (node.rname.length > 0)) { title += ' / ' + EscapeHtml(node.rname); }
2704
+ var name = EscapeHtml(node.name);
2705
+ if (showRealNames == true && node.rname != null) name = EscapeHtml(node.rname);
2706
+ if (name.length == 0) { name = '<i>' + "Nic" + '</i>'; }
2707
+
2708
+ // Node
2709
+ var icon = node.icon;
2710
+ if ((!node.conn) || (node.conn == 0)) { icon += ' gray'; }
2711
+ if (view == 1) {
2712
+ r += '<div id=devs onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=display:inline-block;width:' + deviceBoxWidth + 'px;height:50px;padding-top:1px;padding-bottom:1px><div style=width:22px;height:50%;float:left;padding-top:12px><input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox></div><div style=height:100%;cursor:pointer tabindex=0 onclick=gotoDevice(\'' + node._id + '\',null,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',null,null,event)"><div class="i' + icon + '" style=width:50px;float:left></div><div style=height:100%><div class=g1></div><div class=e2><div class=e1 style=width:' + (deviceBoxWidth - 100) + 'px title="' + title + '">' + name + '</div><div>' + NodeStateStr(node) + '</div></div><div class=g2></div></div></div></div>';
2713
+ } else if (view == 2) {
2714
+ var states = [];
2715
+ if (node.conn) {
2716
+ if ((node.conn & 1) != 0) { states.push('<span title=\"' + "Agent je připojen a připraven." + '\">' + "Agent" + '</span>'); }
2717
+ if ((node.conn & 2) != 0) { states.push('<span title=\"' + "Intel® AMT CIRA is connected and ready for use." + '\">' + "CIRA" + '</span>'); }
2718
+ else if ((node.conn & 4) != 0) { states.push('<span title=\"' + "Intel® AMT is routable." + '\">' + "AMT" + '</span>'); }
2719
+ if ((node.conn & 8) != 0) { states.push('<span title=\"' + "Mesh agent is reachable using another agent as relay." + '\">' + "Relay" + '</span>'); }
2720
+ if ((node.conn & 16) != 0) { states.push('<span title=\"' + "MQTT connection to the device is active." + '\">' + "MQTT" + '</span>'); }
2721
+ }
2722
+ r += '<tr><td><div id=devs class=bar18 tabindex=0 onmouseover=devMouseHover(this,1) onmouseout=devMouseHover(this,0) style=height:18px;width:100%;font-size:medium onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',null,null,event)">';
2723
+ r += '<div class=deviceBarCheckbox><input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox></div>';
2724
+ r += '<div class=deviceBarIcon onclick=gotoDevice(\'' + node._id + '\',null,null,event)><div class=\"j' + icon + '\" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
2725
+ r += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
2726
+ r += '<div style=cursor:pointer;font-size:14px title="' + title + '" onclick=gotoDevice(\'' + node._id + '\',null,null,event)><span style=width:300px>' + name + '</span></div></div></td>';
2727
+ r += '<td style=text-align:center>' + getUserShortStr(node);
2728
+ r += '<td style=text-align:center>' + (node.ip != null ? node.ip : '');
2729
+ r += '<td style=text-align:center>' + states.join(' + ');
2730
+ //r += '<td style=text-align:center>' + (node.pwr != null ? powerStateStrings[node.pwr] : '');
2731
+ r += '</tr>';
2732
+ } else if ((view == 3) && (node.conn & 1) && (((meshrights & 8) || (meshrights & 256)) != 0) && ((node.agent.caps & 1) != 0)) { // Check if we have rights and agent is capable of KVM.
2733
+ if ((multiDesktopFilter) && ((multiDesktopFilter.length == 0) || (multiDesktopFilter.indexOf('devid_' + node._id) >= 0))) {
2734
+ r += '<div id=devs style=display:inline-block;margin:1px;background-color:lightgray;border-radius:5px;position:relative><div tabindex=0 style=padding:3px;cursor:pointer onclick=gotoDevice(\'' + node._id + '\',11,null,event) onkeypress="if (event.key==\'Enter\') gotoDevice(\'' + node._id + '\',11,null,event)">';
2735
+ //r += '<input class="' + node.meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + node._id + ' type=checkbox style=float:left>';
2736
+ r += '<div class="j' + icon + '" style=width:16px;float:left></div> ' + name + '</div>';
2737
+ r += '<span onclick=gotoDevice(\'' + node._id + '\',null,null,event)></span><div id=xkvmid_' + node._id.split('/')[2] + '><div id=skvmid_' + node._id.split('/')[2] + ' tabindex=0 style="position:absolute;color:white;left:5px;top:27px;text-shadow:0px 0px 5px #000;z-index:1000;cursor:default" onclick=toggleKvmDevice(\'' + node._id + '\') onkeypress="if (event.key==\'Enter\') toggleKvmDevice(\'' + node._id + '\')">' + "Odpojeno" + '</div></div>';
2738
+ r += '</div>';
2739
+ kvmDivs.push(node._id);
2740
+ }
2741
+ }
2742
+
2743
+ // If we are displaying devices by group, put the device in the right group.
2744
+ if ((sort == 3) && (r != '')) {
2745
+ if (node.tags) {
2746
+ for (var j in node.tags) {
2747
+ var tag = node.tags[j];
2748
+ if (groups[tag] == null) { groups[tag] = r; groupCount[tag] = 1; } else { groups[tag] += r; groupCount[tag] += 1; }
2749
+ if (view == 3) break;
2750
+ }
2751
+ }
2752
+ r = '';
2753
+ }
2754
+
2755
+ deviceHeaderTotal++;
2756
+ if (typeof deviceHeaderCount[node.state] == 'undefined') { deviceHeaderCount[node.state] = 1; } else { deviceHeaderCount[node.state]++; }
2757
+ }
2758
+
2759
+ // Above 32 devices, gray out the auto connect feature.
2760
+ if (kvmDivs.length >= 32) { Q('autoConnectDesktopCheckbox').checked = false; }
2761
+ QE('autoConnectDesktopCheckbox', kvmDivs.length < 32);
2762
+
2763
+ // If displaying devices by groups, sort the group names and display the devices.
2764
+ if (sort == 3) {
2765
+ if (view == 2) { r = '<table style=width:100%;margin-top:4px cellpadding=0 cellspacing=0><th style=color:gray><th style=color:gray;width:120px>' + "User" + '<th style=color:gray;width:120px>' + "Adresa" + '<th style=color:gray;width:100px>' + "Connectivity"; }
2766
+
2767
+ var groupNames = [];
2768
+ for (var i in groups) { groupNames.push(i); }
2769
+ groupNames.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); });
2770
+ for (var j in groupNames) {
2771
+ var i = groupNames[j];
2772
+ if (view == 2) {
2773
+ r += '<tr><td colspan=4><div class=DevSt style=width:100%;padding-top:4px><span class=devHeaderx style=float:right>' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + '</span><span>' + i + '</span></div>' + groups[i];
2774
+ } else {
2775
+ r += '<div class=DevSt style=width:100%;padding-top:4px><span class=devHeaderx style=float:right>' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + '</span><span>' + i + '</span></div>' + groups[i];
2776
+ }
2777
+ }
2778
+ }
2779
+
2780
+ // If there is nothing to display, explain the problem
2781
+ if ((r == '') && (meshcount > 0) && (Q('SearchInput').value != '')) {
2782
+ if (sort == 3) {
2783
+ r = '<div style="margin:30px">' + "No devices are included in any groups, click on a device\'s \"Groups\" to add to a group." + '</div>';
2784
+ } else {
2785
+ r = '<div style="margin:30px">' + "No devices matching this search." + '</div>';
2786
+ }
2787
+ }
2788
+
2789
+ if ((view == 1) && (c == 2)) r += '<td><div style=width:301px></div></td>'; // Adds device padding
2790
+
2791
+ // Display all empty device groups, we need to do this because users can add devices to these at any time.
2792
+ if ((sort == 0) && (Q('SearchInput').value == '') && (view < 3)) {
2793
+ for (var i in meshes) {
2794
+ var mesh = meshes[i], meshlink = mesh.links[userinfo._id];
2795
+ if (meshlink != null) {
2796
+ var meshrights = meshlink.rights;
2797
+ if (displayedMeshes[mesh._id] == null) {
2798
+ if ((current != '') && (r != '')) { r += '</tr></table>'; }
2799
+ r += '<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr><td colspan=3 class=DevSt><span id=MxMESH style=cursor:pointer onclick=gotoMesh("' + mesh._id + '")>' + EscapeHtml(mesh.name) + '</span><span>';
2800
+ r += getMeshActions(mesh, meshrights);
2801
+ r += '</span></td></tr><tr>';
2802
+ if (mesh.mtype == 1) {
2803
+ r += '<td><div style=padding:10px><i>' + "No Intel® AMT devices in this mesh";
2804
+ if ((meshrights & 4) != 0) { r += ', <a href=# style=cursor:pointer onclick=\'return addDeviceToMesh(\"' + mesh._id + '\")\'>' + "přidat" + '</a>'; }
2805
+ }
2806
+ if (mesh.mtype == 2) {
2807
+ r += '<td><div style=padding:10px><i>' + "Žádné zařízení v této skupině";
2808
+ if ((meshrights & 4) != 0) { r += ', <a href=# style=cursor:pointer onclick=\'return addAgentToMesh(\"' + mesh._id + '\")\'>' + "přidat" + '</a>'; }
2809
+ }
2810
+ r += '.</i></div></td>';
2811
+ current = mesh._id;
2812
+ count++;
2813
+ }
2814
+ }
2815
+ }
2816
+ }
2817
+ r += '</tr></table><div style=height:1px></div>'; // This height of 1 div fixes a problem in Linux firefox browsers
2818
+
2819
+ // Add a "Add Device Group" option
2820
+ r += '<div style=border-top-style:solid;border-top-width:1px;border-top-color:#DDDDDD;cursor:pointer;font-size:10px>';
2821
+ if ((view < 3) && (sort == 0) && (meshcount > 0) && ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 64) == 0))) {
2822
+ r += '<a href=# onclick="return account_createMesh()" title=\"' + "Vytvořit novou skupinu zařízení." + '\" style=cursor:pointer>' + "Přidat skupinu zařízení" + '</a> ';
2823
+ }
2824
+ if ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 128) == 0)) {
2825
+ r += '<a href=# onclick=\'return p10showMeshCmdDialog(0)\' style=cursor:pointer title=\"' + "Download MeshCmd, a command line tool that performs many functions." + '\">' + "MeshCmd" + '</a> ';
2826
+ if (navigator.platform.toLowerCase() == 'win32') { r += '<a href=# onclick=\'return p10showMeshRouterDialog()\' style=cursor:pointer title=\"' + "Download MeshCentral Router, a TCP port mapping tool." + '\">' + "Router" + '</a> '; }
2827
+ }
2828
+ r += '</div><br/>';
2829
+
2830
+ QH('xdevices', r);
2831
+ deviceHeaderSet();
2832
+
2833
+ // Re-check nodeid's
2834
+ var elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
2835
+ if (checkedNodeids) { for (var i=0;i<elements.length;i++) { elements[i].checked = (checkedNodeids.indexOf(elements[i].value) >= 0); } }
2836
+
2837
+ for (var i in deviceHeaders) { QH(i, deviceHeaders[i]); }
2838
+ for (var i in deviceHeadersTitles) { Q(i).title = deviceHeadersTitles[i]; }
2839
+ p1updateInfo();
2840
+
2841
+ // Take care of KVM surfaces in desktop view mode
2842
+ if (view == 3) {
2843
+ // Figure out and adjust the size to fill the width of the div
2844
+ var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex];
2845
+ //var realw = vsize.x + 2, tw = Q('xdevices').clientWidth - 30, xw = Math.floor(tw / realw);
2846
+ var realw = vsize.x + 2, tw = totalDeviceViewWidth - 5, xw = Math.floor(tw / realw);
2847
+ xw = realw + Math.floor((tw - (xw * realw)) / xw);
2848
+ vsize.y = vsize.y * (xw / vsize.x);
2849
+ vsize.x = xw;
2850
+
2851
+ for (var i in multiDesktop) { multiDesktop[i].xxdelete = true; }
2852
+ for (var i in kvmDivs) {
2853
+ var id = kvmDivs[i], shortid = id.split('/')[2], desk = multiDesktop[id];
2854
+ if (desk != null) {
2855
+ // This device already has a canvas, use it.
2856
+ desk.m.CanvasId.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
2857
+ Q('xkvmid_' + shortid).appendChild(desk.m.CanvasId);
2858
+ delete desk.xxdelete;
2859
+ QH('skvmid_' + shortid, ["Odpojeno", "Connecting...", "Setup...", '', ''][((desk.m.State == null)?desk.m.state:desk.m.State)]);
2860
+ } else {
2861
+ var node = getNodeFromId(id);
2862
+ if ((desktopNode == node) && (desktop != null)) { // Check if the main desktop is this device, if it is, use that.
2863
+ // This device already has a canvas, use it.
2864
+ var c = desktop.m.CanvasId;
2865
+ c.setAttribute('id', 'kvmid_' + shortid);
2866
+ c.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
2867
+ c.setAttribute('onclick', 'toggleKvmDevice(\'' + id + '\')');
2868
+ c.removeAttribute('onmousedown');
2869
+ c.removeAttribute('onmouseup');
2870
+ c.removeAttribute('onmousemove');
2871
+ Q('xkvmid_' + shortid).appendChild(c);
2872
+ QH('skvmid_' + shortid, ["Odpojeno", "Connecting...", "Setup...", '', ''][((desktop.m.State == null)?desktop.m.state:desktop.m.State)]);
2873
+ if (desktop.m.SendCompressionLevel) { desktop.m.SendCompressionLevel(1, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); }
2874
+ desktop.shortid = shortid;
2875
+ desktop.onStateChanged = onMultiDesktopStateChange;
2876
+ multiDesktop[id] = desktop;
2877
+ desktop = desktopNode = currentNode = null;
2878
+ // Setup a replacement desktop
2879
+ QH('DeskParent', '<canvas id="Desk" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');
2880
+ } else {
2881
+ // This is a new device, create a canvas for it.
2882
+ var c = document.createElement('canvas');
2883
+ c.setAttribute('id', 'kvmid_' + shortid);
2884
+ c.setAttribute('width', 640);
2885
+ c.setAttribute('height', 480);
2886
+ c.setAttribute('oncontextmenu', 'return false');
2887
+ c.setAttribute('style', 'background-color:black;width:' + vsize.x + 'px;height:' + vsize.y + 'px');
2888
+ c.setAttribute('onclick', 'toggleKvmDevice(\'' + id + '\')');
2889
+ try { Q('xkvmid_' + shortid).appendChild(c); } catch (ex) {}
2890
+ // Check if we need to auto-connect
2891
+ if (Q('autoConnectDesktopCheckbox').checked == true) { setTimeout(function() { connectMultiDesktop(node, 1); }, 100); }
2892
+ }
2893
+ }
2894
+ }
2895
+ for (var i in multiDesktop) {
2896
+ // If a device is no longer viewed, disconnect it.
2897
+ if (multiDesktop[i].xxdelete == true) { multiDesktop[i].Stop(); delete multiDesktop[i]; }
2898
+ else if (debugmode && multiDesktop[i].m && multiDesktop[i].m.onScreenSizeChange) {
2899
+ mdeskAdjust(multiDesktop[i].m, multiDesktop[i].m.ScreenWidth, multiDesktop[i].m.ScreenHeight, multiDesktop[i].m.CanvasId); // Adjust screen size change
2900
+ }
2901
+ }
2902
+ deskAdjust();
2903
+ } else {
2904
+ disconnectAllKvmFunction();
2905
+ Q('autoConnectDesktopCheckbox').checked = false;
2906
+ }
2907
+ }
2908
+ oldviewmode = view;
2909
+ }
2910
+
2911
+ function toggleKvmDevice(node) {
2912
+ if (typeof node == 'string') { node = getNodeFromId(node); } // Convert nodeid to node if needed
2913
+ var mesh = meshes[node.meshid], meshrights = mesh.links[userinfo._id].rights;
2914
+ if ((meshrights & 8) || (meshrights & 256)) { // Requires remote control rights or desktop view only rights
2915
+ //var conn = 0;
2916
+ //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)
2917
+ if (node.conn & 1) { connectMultiDesktop(node, 1); }
2918
+ }
2919
+ }
2920
+
2921
+ function getUserShortStr(node) {
2922
+ if (node == null || node.users == null || node.users.length == 0) return '';
2923
+ if (node.users.length > 1) { return '<span title="' + EscapeHtml(node.users.join(', ')) + '">' + nobreak(format("{0} users", node.users.length)) + '</span>'; }
2924
+ var u = node.users[0], su = u, i = u.indexOf('\\');
2925
+ if (i > 0) { su = u.substring(i + 1); }
2926
+ su = EscapeHtml(su);
2927
+ if (su.length > 15) { su = su.substring(0, 14) + '…'; }
2928
+ return '<span title="' + EscapeHtml(u) + '">' + su + '</span>';
2929
+ }
2930
+
2931
+ function autoConnectDesktops() { if (Q('autoConnectDesktopCheckbox').checked == true) { connectAllKvmFunction(); } }
2932
+ function connectAllKvmFunction(force) {
2933
+ if (xxdialogMode) return false;
2934
+ if (force !== true) { // We need to count how many devices will need to be connected, if it's a lot, prompt first.
2935
+ var count = 0;
2936
+ for (var i in nodes) {
2937
+ var node = nodes[i], nodeid = nodes[i]._id;
2938
+ if (multiDesktop[nodeid] == null) {
2939
+ var mesh = meshes[node.meshid], meshrights = mesh.links[userinfo._id].rights;
2940
+ if ((meshrights & 8) || (meshrights & 256)) { // Requires remote control rights or desktop view only rights
2941
+ //var conn = 0;
2942
+ //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)
2943
+ if (node.conn & 1) { count++; }
2944
+ }
2945
+ }
2946
+ }
2947
+ if (count > 8) { setDialogMode(2, "Connect All", 3, function() { connectAllKvmFunction(true); }, format("Are you sure you want to connect to {0} devices?", count)); return; }
2948
+ }
2949
+
2950
+ // Perform connect all
2951
+ for (var i in nodes) { if (multiDesktop[nodes[i]._id] == null) { toggleKvmDevice(nodes[i]._id); } }
2952
+ }
2953
+ function disconnectAllKvmFunction() { if (xxdialogMode) return false; for (var nodeid in multiDesktop) { multiDesktop[nodeid].Stop(); } multiDesktop = {}; }
2954
+ function onMultiDesktopStateChange(desk, state) { try { QH('skvmid_' + desk.shortid, ["Odpojeno", "Connecting...", "Setup...", '', ''][state]); } catch (ex) {} }
2955
+
2956
+ function showMultiDesktopSettings() {
2957
+ QV('d7amtkvm', false);
2958
+ QV('d7meshkvm', true);
2959
+ d7bitmapquality.value = multidesktopsettings.quality;
2960
+ d7bitmapscaling.value = multidesktopsettings.scaling;
2961
+ if (multidesktopsettings.framerate) { d7framelimiter.value = multidesktopsettings.framerate; } else { d7framelimiter.value = 1000; }
2962
+ setDialogMode(7, "Remote Desktop Settings", 3, showMultiDesktopSettingsChanged);
2963
+ }
2964
+
2965
+ function showMultiDesktopSettingsChanged() {
2966
+ multidesktopsettings.quality = d7bitmapquality.value;
2967
+ multidesktopsettings.scaling = d7bitmapscaling.value;
2968
+ multidesktopsettings.framerate = d7framelimiter.value;
2969
+ localStorage.setItem('multidesktopsettings', JSON.stringify(multidesktopsettings));
2970
+ // Make changes to all current connections
2971
+ for (var i in multiDesktop) { multiDesktop[i].m.SendCompressionLevel(1, multidesktopsettings.quality, multidesktopsettings.scaling, multidesktopsettings.framerate); }
2972
+ }
2973
+
2974
+ function connectMultiDesktop(node, contype) {
2975
+ var nodeid = node._id, shortid = nodeid.split('/')[2];
2976
+ var desk = multiDesktop[nodeid];
2977
+ if (desk == null) {
2978
+ if (Q('kvmid_' + shortid) == null) return; // Check if this device is being displayed, if not, exit now.
2979
+ if (contype == 2) {
2980
+ // Setup the Intel AMT remote desktop
2981
+ if ((node.intelamt.user == null) || (node.intelamt.user == '')) { return; }
2982
+ desk = CreateAmtRedirect(CreateAmtRemoteDesktop('kvmid_' + shortid), authCookie);
2983
+ desk.shortid = shortid;
2984
+ //desk.debugmode = debugmode;
2985
+ desk.onStateChanged = onMultiDesktopStateChange;
2986
+ desk.m.bpp = 1;
2987
+ desk.m.useZRLE = true;
2988
+ desk.m.showmouse = true;
2989
+ 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.
2990
+ //desk.m.onScreenSizeChange = deskAdjust;
2991
+ if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust
2992
+ desk.Start(nodeid, 16994, '*', '*', 0);
2993
+ desk.contype = 2;
2994
+ multiDesktop[nodeid] = desk;
2995
+ } else if (contype == 1) {
2996
+ // Setup the Mesh Agent remote desktop
2997
+ desk = CreateAgentRedirect(meshserver, CreateAgentRemoteDesktop('kvmid_' + shortid), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
2998
+ desk.shortid = shortid;
2999
+ desk.attemptWebRTC = attemptWebRTC;
3000
+ desk.onStateChanged = onMultiDesktopStateChange;
3001
+ //desk.onConsoleMessageChange = function () { console.log('CONSOLEMSG:', desk.consoleMessage); }
3002
+ desk.m.CompressionLevel = multidesktopsettings.quality;
3003
+ desk.m.ScalingLevel = multidesktopsettings.scaling;
3004
+ desk.m.FrameRateTimer = multidesktopsettings.framerate;
3005
+ //desk.m.onDisplayinfo = deskDisplayInfo;
3006
+ //desk.m.onScreenSizeChange = deskAdjust;
3007
+ if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust
3008
+ desk.Start(nodeid);
3009
+ desk.contype = 1;
3010
+ multiDesktop[nodeid] = desk;
3011
+ }
3012
+ } else {
3013
+ // Disconnect and clean up the remote desktop
3014
+ desk.Stop();
3015
+ delete multiDesktop[nodeid];
3016
+ }
3017
+ }
3018
+
3019
+ function getMeshActions(mesh, meshrights) {
3020
+ if ((meshrights & 4) == 0) return '';
3021
+ var r = '';
3022
+ if ((features & 1024) == 0) { // If CIRA is allowed
3023
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new Intel® AMT computer that is located on the internet." + '\" onclick=\'return addCiraDeviceToMesh(\"' + mesh._id + '\")\'>' + "Přidat CIRA" + '</a>';
3024
+ }
3025
+ if (mesh.mtype == 1) {
3026
+ if ((features & 1) == 0) { // If not WAN-Only
3027
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new Intel® AMT computer that is located on the local network." + '\" onclick=\'return addDeviceToMesh(\"' + mesh._id + '\")\'>' + "Add Local" + '</a>';
3028
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new Intel® AMT computer by scanning the local network." + '\" onclick=\'return addAmtScanToMesh(\"' + mesh._id + '\")\'>' + "Scan Network" + '</a>';
3029
+ }
3030
+ if (mesh.amt && (mesh.amt.type == 2)) { // CCM activation
3031
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Perform Intel AMT client control mode (CCM) activation." + '\" onclick=\'return showCcmActivation(\"' + mesh._id + '\")\'>' + "Aktivace" + '</a>';
3032
+ } else if (mesh.amt && (mesh.amt.type == 3) && ((features & 0x00100000) != 0)) { // ACM activation
3033
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Perform Intel AMT admin control mode (ACM) activation." + '\" onclick=\'return showAcmActivation(\"' + mesh._id + '\")\'>' + "Aktivace" + '</a>';
3034
+ }
3035
+ }
3036
+ if (mesh.mtype == 2) {
3037
+ r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Add a new computer to this mesh by installing the mesh agent." + '\" onclick=\'return addAgentToMesh(\"' + mesh._id + '\")\'>' + "Přidat agenta" + '</a>';
3038
+ if ((features & 2) == 0) { r += ' <a href=# style=cursor:pointer;font-size:10px title=\"' + "Pozvat kohokoliv k instalaci agenta pro vzdálené ovládání." + '\" onclick=\'return inviteAgentToMesh(\"' + mesh._id + '\")\'>' + "Pozvat" + '</a>'; }
3039
+ }
3040
+ return r;
3041
+ }
3042
+
3043
+ function addDeviceToMesh(meshid) {
3044
+ if (xxdialogMode) return false;
3045
+ var mesh = meshes[meshid];
3046
+ var x = format("Add a new Intel® AMT device to device group \"{0}\".", EscapeHtml(mesh.name)) + '<br /><br />';
3047
+ x += addHtmlValue("Device Name", '<input id=dp1devicename style=width:230px maxlength=32 autocomplete=off onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
3048
+ x += addHtmlValue("Hostname", '<input id=dp1hostname style=width:230px maxlength=32 autocomplete=off placeholder=\"' + "Same as device name" + '\" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
3049
+ x += addHtmlValue("Uživatel", '<input id=dp1username style=width:230px maxlength=32 autocomplete=off placeholder=\"' + "admin" + '\" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
3050
+ x += addHtmlValue("Heslo", '<input id=dp1password type=password style=width:230px autocomplete=off maxlength=32 onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
3051
+ x += addHtmlValue("Bezpečnost", '<select id=dp1tls style=width:236px><option value=0>' + "Žádné TLS" + '</option><option value=1>' + "TLS vyžadováno" + '</option></select>');
3052
+ setDialogMode(2, "Add Intel® AMT device", 3, addDeviceToMeshEx, x, meshid);
3053
+ validateDeviceToMesh();
3054
+ Q('dp1devicename').focus();
3055
+ return false;
3056
+ }
3057
+
3058
+ // Intel AMT CCM Activation
3059
+ function showCcmActivation(meshid) {
3060
+ if (xxdialogMode) return false;
3061
+ var servername = serverinfo.name, mesh = meshes[meshid];
3062
+ if ((servername.indexOf('.') == -1) || ((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.
3063
+ var url, domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
3064
+ if (serverinfo.https == true) {
3065
+ var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
3066
+ url = 'wss://' + servername + portStr + domainUrl;
3067
+ } else {
3068
+ var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
3069
+ url = 'ws://' + servername + portStr + domainUrl;
3070
+ }
3071
+ var x = format("Perform Intel AMT client control mode (CCM) activation to group \"{0}\" by downloading the MeshCMD tool and running it like this:", EscapeHtml(mesh.name)) + '<br /><br />';
3072
+ x += '<textarea readonly=readonly style=width:100%;resize:none;height:100px;overflow:auto;font-size:12px readonly>meshcmd amtccm --url ' + url + 'amtactivate?id=' + meshid.split('/')[2] + ' --serverhttpshash ' + serverinfo.tlshash + '</textarea>';
3073
+ setDialogMode(2, "Intel® AMT activation", 9, null, x);
3074
+ Q('idx_dlgOkButton').focus();
3075
+ return false;
3076
+ }
3077
+
3078
+ // Intel AMT ACM Activation
3079
+ function showAcmActivation(meshid) {
3080
+ if (xxdialogMode) return false;
3081
+ var servername = serverinfo.name, mesh = meshes[meshid];
3082
+ if ((servername.indexOf('.') == -1) || ((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.
3083
+ var url, domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
3084
+ if (serverinfo.https == true) {
3085
+ var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
3086
+ url = 'wss://' + servername + portStr + domainUrl;
3087
+ } else {
3088
+ var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
3089
+ url = 'ws://' + servername + portStr + domainUrl;
3090
+ }
3091
+ var x = format("Perform Intel AMT admin control mode (ACM) activation to group \"{0}\" by downloading the MeshCMD tool and running it like this:", EscapeHtml(mesh.name)) + '<br /><br />';
3092
+ x += '<textarea readonly=readonly style=width:100%;resize:none;height:100px;overflow:auto;font-size:12px readonly>meshcmd amtacm --url ' + url + 'amtactivate?id=' + meshid.split('/')[2] + ' --serverhttpshash ' + serverinfo.tlshash + '</textarea>';
3093
+ if (serverinfo.amtAcmFqdn != null) {
3094
+ x += ('<div style=margin-top:8px>' + "Intel AMT will need to be set with a Trusted FQDN in MEBx or have a wired LAN on the network:" + ' <b>' + serverinfo.amtAcmFqdn.join(', ') + '</b></div>');
3095
+ }
3096
+ setDialogMode(2, "Intel® AMT activation", 9, null, x);
3097
+ Q('idx_dlgOkButton').focus();
3098
+ return false;
3099
+ }
3100
+
3101
+ // Display the Intel AMT scanning dialog box
3102
+ function addAmtScanToMesh(meshid) {
3103
+ if (xxdialogMode) return false;
3104
+ var x = "Enter a range of IP addresses to scan for Intel AMT devices." + '<br /><br />';
3105
+ 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=\"' + "Skenovat" + '\" onclick=addAmtScanToMeshButton()></input>');
3106
+ x += '<div id=dp1results style="width:100%;height:200px;background-color:white;border:1px gray solid;overflow-y:scroll"></div>';
3107
+ setDialogMode(2, "Scan for Intel® AMT devices", 3, addAmtScanToMeshEx, x, meshid);
3108
+ QE('idx_dlgOkButton', false);
3109
+ 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>');
3110
+ focusTextBox('dp1range');
3111
+ return false;
3112
+ }
3113
+
3114
+ function addAmtScanToMeshKeyUp(e) {
3115
+ if (e.keyCode == 13) { haltEvent(e); addAmtScanToMeshButton(); }
3116
+ }
3117
+
3118
+ // Called when OK is pressed on the Intel AMT scanning box
3119
+ function addAmtScanToMeshEx(button, meshid) {
3120
+ var elements = document.getElementsByClassName('DevScanCheckbox'), checkcount = 0;
3121
+ for (var i=0;i<elements.length;i++) {
3122
+ if (elements[i].checked) {
3123
+ var ipaddr = elements[i].getAttribute('tag');
3124
+ var amtinfo = amtScanResults[ipaddr];
3125
+ meshserver.send({ action: 'addamtdevice', meshid: meshid, devicename: ipaddr, hostname: amtinfo.hostname, amtusername: '', amtpassword: '', amttls: amtinfo.tls });
3126
+ }
3127
+ }
3128
+ }
3129
+
3130
+ // If the user presses the "Scan" button on the Intel AMT scanning dialog box, start a scan.
3131
+ function addAmtScanToMeshButton() {
3132
+ QE('dp1range', false);
3133
+ QE('dp1rangebutton', false);
3134
+ QH('dp1results', '<div style=width:100%;text-align:center;margin-top:12px>' + "Scanning..." + '</div>');
3135
+ meshserver.send({ action: 'scanamtdevice', range: Q('dp1range').value });
3136
+ }
3137
+
3138
+ // Called when a scanned computer is checked or unchecked.
3139
+ function addAmtScanToMeshCheckbox() {
3140
+ var elements = document.getElementsByClassName('DevScanCheckbox'), checkcount = 0;
3141
+ for (var i=0;i<elements.length;i++) { if (elements[i].checked) checkcount++; }
3142
+ QE('idx_dlgOkButton', checkcount > 0);
3143
+ }
3144
+
3145
+ function addCiraDeviceToMesh(meshid) {
3146
+ if (xxdialogMode) return false;
3147
+ var mesh = meshes[meshid];
3148
+
3149
+ // Replace non alphabetic characters (@ and $) with 'X' because MPS username cannot accept it.
3150
+ var meshidx = meshid.split('/')[2].replace(/\@/g, 'X').replace(/\$/g, 'X');
3151
+
3152
+ var y = '<select id=dlgAddCiraSel onclick=dlgAddCiraSelClick() style=width:230px><option value=0>' + "MeshCommander Script" + '</option><option value=1>' + "Manual Username/Password" + '</option>';
3153
+ 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.
3154
+
3155
+ var x = '';
3156
+ x += addHtmlValue("Setup", y);
3157
+ x += '<hr>';
3158
+
3159
+ // Setup CIRA using a MeshCommander script (Pretty Simple)
3160
+ x += '<div id=dlgAddCira0>' + format("To add a new Intel® AMT device to device group \"{0}\" 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.", EscapeHtml(mesh.name)) + '<br /><br />';
3161
+ //x += addHtmlValue('Setup CIRA', '<a href="mescript.ashx?type=1&meshid=' + meshidx.substring(0, 16) + '" download>cira_setup.mescript</a>');
3162
+ x += addHtmlValue("Setup CIRA", '<a href="mescript.ashx?type=1&meshid=' + meshid + '" download>cira_setup.mescript</a>');
3163
+ x += addHtmlValue("Cleanup CIRA", '<a href="mescript.ashx?type=2" download>cira_clean.mescript</a>');
3164
+ x += '</div>';
3165
+
3166
+ // Setup CIRA with user/pass authentication (Somewhat difficult)
3167
+ x += '<div id=dlgAddCira1 style=display:none>' + format("To add a new Intel® AMT device to device group \"{0}\" with CIRA, load the following certificate as trusted root within Intel AMT", EscapeHtml(mesh.name));
3168
+ 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 />'); }
3169
+ x += addHtmlValue("Root Certificate", '<a href=\"' + "MeshServerRootCert.cer" + '\" download>' + "Root Certificate File" + '</a>');
3170
+ x += addHtmlValue("Uživatel", '<input style=width:230px readonly value="' + meshidx.substring(0, 16) + '" />');
3171
+ if (serverinfo.mpspass) { x += addHtmlValue("Heslo", '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpspass) + '" />'); }
3172
+ if (serverinfo != null) { x += addHtmlValue("MPS Server", '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpsname) + ':' + serverinfo.mpsport + '" />'); }
3173
+ x += '</div>';
3174
+
3175
+ // Setup CIRA with certificate authentication (Really difficult, only if TLS offload is not used)
3176
+ if ((features & 16) == 0) {
3177
+ x += '<div id=dlgAddCira2 style=display:none>' + format("To add a new Intel® AMT device to device group \"{0}\" 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.", EscapeHtml(mesh.name)) + '<br /><br />';
3178
+ x += addHtmlValue("Root Certificate", '<a href="MeshServerRootCert.cer" download>' + "Root Certificate File" + '</a>');
3179
+ x += addHtmlValue("Organization", '<input style=width:230px readonly value="' + meshidx + '" />');
3180
+ if (serverinfo != null) { x += addHtmlValue("MPS Server", '<input style=width:230px readonly value="' + EscapeHtml(serverinfo.mpsname) + ':' + serverinfo.mpsport + '" />'); }
3181
+ x += '</div>';
3182
+ }
3183
+
3184
+ setDialogMode(2, "Add Intel® AMT CIRA device", 2, null, x, 'fileDownload');
3185
+ Q('dlgAddCiraSel').focus();
3186
+ return false;
3187
+ }
3188
+
3189
+ function dlgAddCiraSelClick() {
3190
+ var val = Q('dlgAddCiraSel').value;
3191
+ QV('dlgAddCira0', val == 0);
3192
+ QV('dlgAddCira1', val == 1);
3193
+ QV('dlgAddCira2', val == 2);
3194
+ }
3195
+
3196
+ // Return true is the input string looks like an email address
3197
+ function checkEmail(str) {
3198
+ var x = str.split('@');
3199
+ var ok = ((x.length == 2) && (x[0].length > 0) && (x[1].split('.').length > 1) && (x[1].length > 2));
3200
+ if (ok == true) { var y = x[1].split('.'); for (var i in y) { if (y[i].length == 0) { ok = false; } } }
3201
+ return ok;
3202
+ }
3203
+
3204
+ function inviteAgentToMesh(meshid) {
3205
+ if (xxdialogMode) return false;
3206
+ var x = '', mesh = meshes[meshid];
3207
+ if (features & 64) {
3208
+ x += addHtmlValue("Invitation Type", '<select id=d2InviteType onchange=d2ChangedInviteType() style=width:236px><option value=0>Link invitation</option><option value=1>Email invitation</option></select>') + '<hr />';
3209
+ x += '<div id=emailInviteDiv style=display:none>' + format("Pozvěte někoho k instalaci agenta. Emailem bude zaslán link s adresou agenta pro skupinu \"{0}\".", EscapeHtml(mesh.name)) + '<br /><br />';
3210
+ x += addHtmlValue("Jméno (volitelné)", '<input id=agentInviteName value="" style=width:230px maxlength=64 />');
3211
+ x += addHtmlValue("Email", '<input id=agentInviteEmail style=width:230px placeholder=\"' + "example@email.com" + '\" onkeyup=validateAgentInvite()></input>');
3212
+ x += addHtmlValue("Operační systém", '<select id=agentInviteNameOs onchange=d2ChangedInviteType() style=width:236px><option value=4>' + "Odeslat odkaz na instalaci" + '</option><option value=0 selected>' + "Any supported" + '</option><option value=1>' + "Windows only" + '</option><option value=3>' + "Apple MacOS only" + '</option><option value=2>' + "Linux only" + '</option></select>');
3213
+ x += '<div id=d2agentexpirediv>';
3214
+ x += addHtmlValue("Platnost linku", '<select id=agentInviteExpire style=width:236px><option value=1>' + "1 hodina" + '</option><option value=8>' + "8 hodin" + '</option><option value=24>' + "1 den" + '</option><option value=168>' + "1 týden" + '</option><option value=5040>' + "1 měsíc" + '</option><option value=0>' + "Bez limitu" + '</option></select>');
3215
+ x += '</div>';
3216
+ x += addHtmlValue("Typ instalace", '<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>');
3217
+ x += addHtmlValue("Message" + '<br />' + "(volitelné)", '<textarea id=agentInviteMessage value="" style=width:230px;height:100px;resize:none maxlength=1024 /></textarea>');
3218
+ x += '</div>';
3219
+ }
3220
+ x += '<div id=urlInviteDiv>' + format("Pozvěte někoho k instalaci agenta pomocí sdíleného odkazu. Tento link obsahuje instrukce pro instalaci do skupiny \"{0}\". Link je veřejný a protistrana nepotřebuje žádný účet na tomto serveru.", EscapeHtml(mesh.name)) + '<br /><br />';
3221
+ x += addHtmlValue("Platnost linku", '<select id=d2inviteExpire style=width:236px onchange=d2RequestInvitationLink()><option value=1>' + "1 hodina" + '</option><option value=8>' + "8 hodin" + '</option><option value=24>' + "1 den" + '</option><option value=168>' + "1 týden" + '</option><option value=5040>' + "1 měsíc" + '</option><option value=0>' + "Bez limitu" + '</option></select>');
3222
+ x += '<div id=agentInvitationLinkDiv style="text-align:center;font-size:large;margin:16px;display:none"><a href=# id=agentInvitationLink target="_blank" style=cursor:pointer></a> <img src=images/link4.png height=10 width=10 title=\"' + "Copy link to clipboard" + '\" style=cursor:pointer onclick=d2CopyInviteToClip()></div></div>';
3223
+ setDialogMode(2, "Pozvat", 3, performAgentInvite, x, meshid);
3224
+ if (features & 64) { Q('d2InviteType').focus(); d2ChangedInviteType(); } else { Q('d2inviteExpire').focus(); validateAgentInvite(); }
3225
+ d2RequestInvitationLink();
3226
+ return false;
3227
+ }
3228
+
3229
+ function d2RequestInvitationLink() {
3230
+ meshserver.send({ action: 'createInviteLink', meshid: xxdialogTag, expire: parseInt(Q('d2inviteExpire').value), flags: 0 });
3231
+ }
3232
+
3233
+ function d2ChangedInviteType() {
3234
+ QV('urlInviteDiv', Q('d2InviteType').value == 0);
3235
+ QV('d2agentexpirediv', Q('agentInviteNameOs').value == 4);
3236
+ QV('emailInviteDiv', Q('d2InviteType').value == 1);
3237
+ validateAgentInvite();
3238
+ }
3239
+
3240
+ function d2CopyInviteToClip() { copyTextToClip(Q('agentInvitationLink').href); }
3241
+
3242
+ function validateAgentInvite() {
3243
+ if ((features & 64) && (Q('d2InviteType').value == 1)) {
3244
+ QE('idx_dlgOkButton', checkEmail(Q('agentInviteEmail').value));
3245
+ QV('idx_dlgCancelButton', true);
3246
+ } else {
3247
+ QE('idx_dlgOkButton', true);
3248
+ QV('idx_dlgCancelButton', false);
3249
+ }
3250
+ }
3251
+
3252
+ function performAgentInvite(button, meshid) {
3253
+ if ((features & 64) && (Q('d2InviteType').value == 1)) {
3254
+ 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, expire: parseInt(Q('agentInviteExpire').value) });
3255
+ }
3256
+ }
3257
+
3258
+ function addAgentToMesh(meshid) {
3259
+ if (xxdialogMode) return false;
3260
+ var mesh = meshes[meshid], x = '', installType = 0;
3261
+ x += addHtmlValue("Operační systém", '<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>' + "Windows" + '</option><option value=1>' + "Linux / BSD" + '</option><option value=2>' + "Apple MacOS" + '</option><option value=3>' + "Windows (UnInstall)" + '</option><option value=4>' + "Linux / BSD (UnInstall)" + '</option></select>');
3262
+ x += '<div id=aginsTypeDiv>';
3263
+ x += addHtmlValue("Typ instalace", '<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>');
3264
+ x += '</div><hr>';
3265
+
3266
+ // \/:*?"<>|
3267
+ var meshfilename = mesh.name
3268
+ meshfilename = meshfilename.split('\\').join('').split('/').join('').split(':').join('').split('*').join('').split('?').join('').split('"').join('').split('<').join('').split('>').join('').split('|').join('').split(' ').join('').split('\'').join('');
3269
+
3270
+ // Windows agent install
3271
+ //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 />";
3272
+ x += '<div id=agins_windows>' + format("Pro přidání nového zařízení do skupiny \"{0}\", si stáhněte agenta a nainstalujte na zařízení, které chcete spravovat. Tento agent již obsahuje veškeré informace pro připojení na server.", EscapeHtml(mesh.name)) + '<br /><br />';
3273
+ x += addHtmlValue("Mesh Agent", '<a id=aginsw32lnk href="meshagents?id=3&meshid=' + meshid.split('/')[2] + '&installflags=0" download onclick="setDialogMode(0)" title=\"' + "32bit version of the MeshAgent" + '\">' + "Windows (.exe)" + '</a> <img src=images/link4.png height=10 width=10 title="Copy Windows 32bit agent URL to clipboard" style=cursor:pointer onclick=copyAgentUrl("meshagents?id=3&meshid=' + meshid.split('/')[2] + '&installflags=",1)>');
3274
+ x += addHtmlValue("Mesh Agent", '<a id=aginsw64lnk href="meshagents?id=4&meshid=' + meshid.split('/')[2] + '&installflags=0" download onclick="setDialogMode(0)" title=\"' + "64bit version of the MeshAgent" + '\">' + "Windows x64 (.exe)" + '</a> <img src=images/link4.png height=10 width=10 title="Copy Windows 64bit agent URL to clipboard" style=cursor:pointer onclick=copyAgentUrl("meshagents?id=4&meshid=' + meshid.split('/')[2] + '&installflags=",1)>');
3275
+ if (debugmode > 0) { x += addHtmlValue("Settings File", '<a id=aginswmshlnk href="meshsettings?id=' + meshid.split('/')[2] + '&installflags=0" rel="noreferrer noopener" target="_blank">' + format("{0} settings (.msh)", EscapeHtml(mesh.name)) + '</a>'); }
3276
+ x += '</div>';
3277
+
3278
+ // Linux agent install
3279
+ x += '<div id=agins_linux style=display:none>' + format("Pro přidání do {0} spusťte následující příkaz. Je třeba spouštět pod rootem.", EscapeHtml(mesh.name)) + '<br />';
3280
+ 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>';
3281
+ x += '<div style=\'font-size:x-small\'>' + "* For BSD, run \"pkg install wget sudo bash\" first." + '</div></div>';
3282
+
3283
+ // MacOS agent install
3284
+ x += '<div id=agins_osx style=display:none>' + format("Pro přidání do skupiny \"{0}\", si musíte stáhnout agenta a nainstalovat ho na počítači, který chcete spravovat. Tento agent má všechny potřebné informace pro připojení již v sobě.", EscapeHtml(mesh.name)) + '<br /><br />';
3285
+ x += addHtmlValue("Mesh Agent", '<a href="meshosxagent?id=16&meshid=' + meshid.split('/')[2] + '" rel="noreferrer noopener" target="_blank" title="64bit version of MacOS Mesh Agent">MacOS Agent (64bit)</a> <img src=images/link4.png height=10 width=10 title="' + "Kopírovat odkaz pro MacOS agenta do schránky" + '" style=cursor:pointer onclick=copyAgentUrl("meshosxagent?id=16&meshid=' + meshid.split('/')[2] + '",0)>');
3286
+ x += '</div>';
3287
+
3288
+ // Windows agent uninstall
3289
+ x += '<div id=agins_windows_un style=display:none>' + "Pro odstranění agenta si stáhněte soubor níže, spusťte tento soubor a zvolte \"uninstall\"." + '<br /><br />';
3290
+ x += addHtmlValue("Mesh Agent", '<a href="meshagents?id=3" download onclick="setDialogMode(0)" title="' + "32bit version of the MeshAgent" + '">' + "Windows (.exe)" + '</a>');
3291
+ x += addHtmlValue("Mesh Agent", '<a href="meshagents?id=4" download onclick="setDialogMode(0)" title="' + "64bit version of the MeshAgent" + '">' + "Windows x64 (.exe)" + '</a>');
3292
+ x += '</div>';
3293
+
3294
+ // Linux agent uninstall
3295
+ x += '<div id=agins_linux_un style=display:none>' + "To remove a mesh agent, run the following command. Root credentials will be needed." + '<br />';
3296
+ 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>';
3297
+ x += '</div>';
3298
+
3299
+ setDialogMode(2, "Přidat agenta", 2, null, x, 'fileDownload');
3300
+ var servername = serverinfo.name;
3301
+ if ((servername.indexOf('.') == -1) || ((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.
3302
+ var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
3303
+
3304
+ if (serverinfo.https == true)
3305
+ {
3306
+ var portStr = (serverinfo.port == 443)?'':(':' + serverinfo.port);
3307
+ if ((features & 0x2000) == 0)
3308
+ {
3309
+ Q('agins_linux_area').value = '(wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
3310
+ Q('agins_linux_area_un').value = '(wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
3311
+ }
3312
+ else
3313
+ {
3314
+ // Server asked that agent be installed to preferably not use a HTTP proxy.
3315
+ Q('agins_linux_area').value = 'wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
3316
+ Q('agins_linux_area_un').value = 'wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
3317
+ }
3318
+ }
3319
+ else
3320
+ {
3321
+ var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port);
3322
+ if ((features & 0x2000) == 0)
3323
+ {
3324
+ Q('agins_linux_area').value = '(wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 -O ./meshinstall.sh || wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
3325
+ Q('agins_linux_area_un').value = '(wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 -O ./meshinstall.sh || wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
3326
+ }
3327
+ else
3328
+ {
3329
+ // Server asked that agent be installed to preferably not use a HTTP proxy.
3330
+ Q('agins_linux_area').value = 'wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n';
3331
+ Q('agins_linux_area_un').value = 'wget http://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n';
3332
+ }
3333
+ }
3334
+ Q('aginsSelect').focus();
3335
+ addAgentToMeshClick();
3336
+ return false;
3337
+ }
3338
+
3339
+ function copyAgentUrl(url,addflag) {
3340
+ var servername = serverinfo.name;
3341
+ if ((servername.indexOf('.') == -1) || ((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.
3342
+ var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
3343
+ var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
3344
+ var c = 'https://' + servername + portStr + domainUrl + url;
3345
+ if (addflag == 1) c += Q('aginsType').value;
3346
+ copyTextToClip(c);
3347
+ }
3348
+
3349
+ function addAgentToMeshClick() {
3350
+ var v = Q('aginsSelect').value;
3351
+ QV('agins_windows', v == 0);
3352
+ QV('agins_linux', v == 1);
3353
+ QV('agins_osx', v == 2);
3354
+ QV('agins_windows_un', v == 3);
3355
+ QV('agins_linux_un', v == 4);
3356
+ QV('aginsTypeDiv', v == 0);
3357
+
3358
+ // Fix the links if needed
3359
+ Q('aginsw32lnk').href = (Q('aginsw32lnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value;
3360
+ Q('aginsw64lnk').href = (Q('aginsw64lnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value;
3361
+ if (debugmode > 0) { Q('aginswmshlnk').href = (Q('aginswmshlnk').href.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value; }
3362
+ }
3363
+
3364
+ function validateDeviceToMesh() {
3365
+ QE('idx_dlgOkButton', (Q('dp1devicename').value.length > 0) && (passwordcheck(Q('dp1password').value)));
3366
+ }
3367
+
3368
+ function addDeviceToMeshEx(button, meshid) {
3369
+ var amtuser = Q('dp1username').value;
3370
+ if (amtuser == '') amtuser = 'admin';
3371
+ var host = Q('dp1hostname').value;
3372
+ if (host == '') host = Q('dp1devicename').value;
3373
+ meshserver.send({ action: 'addamtdevice', meshid: meshid, devicename: Q('dp1devicename').value, hostname: host, amtusername: amtuser, amtpassword: Q('dp1password').value, amttls: Q('dp1tls').value });
3374
+ }
3375
+
3376
+ function deviceHeaderSet() {
3377
+ if (deviceHeaderId == 0) { deviceHeaderId = 1; return; }
3378
+ deviceHeaders['DevxHeader' + deviceHeaderId] = ((deviceHeaderTotal == 1) ? "1 node" : format("{0} zařízení", deviceHeaderTotal));
3379
+ //var title = '';
3380
+ //for (x in deviceHeaderCount) { if (title.length > 0) title += ', '; title += deviceHeaderCount[x] + ' ' + PowerStateStr2(x); }
3381
+ //deviceHeadersTitles["DevxHeader" + deviceHeaderId] = title;
3382
+ deviceHeaderId++;
3383
+ deviceHeaderCount = {};
3384
+ deviceHeaderTotal = 0;
3385
+ }
3386
+
3387
+ var powerStateStrings = ['', '<span title=\"' + "Device is powered on." + '\">' + "Zapnuto" + '</span>', '<span title=\"' + "Device is in sleep state (S1)." + '\">' + "Sleeping" + '</span>', '<span title=\"' + "Device is in sleep state (S2)." + '\">' + "Sleeping" + '</span>', '<span title=\"' + "Zařízení je v hlubokém spánku (S3)." + '\">' + "Deep Sleep" + '</span>', '<span title=\"' + "Device is in hibernating state (S4)." + '\">' + "Hibernating" + '</span>', '<span title=\"' + "Zařízení je vypnuto (S5)." + '\">' + "Soft-Off" + '</span>', '<span title=\"' + "Zařízení je detekováno, ale nelze zjistit stav." + '\">' + "Present" + '</span>'];
3388
+ var powerStateStrings2 = ['', "Zařízení je zapnuto", "Zařízení je ve stavu spánku (S1)", "Device is in sleep state (S2)", "Zařízení je v hlubokém spánku (S3)", "Device is hibernating (S4)", "Device is in soft-off state (S5)", "Device is present, but power state cannot be determined"];
3389
+ var powerColorTable = ['pwsTransparent', 'pwsBlack', 'pwsBlue', 'pwsBlue2', 'pwsLightblue', 'pwsBlueviolet', 'pwsDarkgreen', 'pwsLightseagreen', 'pwsLightseagreen2'];
3390
+ function NodeStateStr(node) {
3391
+ var states = [];
3392
+ if (node.state > 0 && node.state < powerStatetable.length) state.push(powerStatetable[node.state]);
3393
+ if (node.conn) {
3394
+ if ((node.conn & 1) != 0) { states.push('<span title=\"' + "Agent je připojen a připraven." + '\">' + "Agent" + '</span>'); }
3395
+ if ((node.conn & 2) != 0) { states.push('<span title=\"' + "Intel® AMT CIRA is connected and ready for use." + '\">' + "CIRA" + '</span>'); }
3396
+ else if ((node.conn & 4) != 0) { states.push('<span title=\"' + "Intel® AMT is routable." + '\">' + "AMT" + '</span>'); }
3397
+ if ((node.conn & 8) != 0) { states.push('<span title=\"' + "Mesh agent is reachable using another agent as relay." + '\">' + "Relay" + '</span>'); }
3398
+ if ((node.conn & 16) != 0) { states.push('<span title=\"' + "MQTT connection to the device is active." + '\">' + "MQTT" + '</span>'); }
3399
+ }
3400
+ if ((node.pwr != null) && (node.pwr != 0)) { states.push(powerStateStrings[node.pwr]); }
3401
+ return states.join(', ');
3402
+ }
3403
+
3404
+ function PowerStateStr(x) {
3405
+ if (x < powerStatetable.length) return powerStatetable[x];
3406
+ return '';
3407
+ }
3408
+
3409
+ function PowerStateStr2(x) {
3410
+ if ((x != 0) && (x < powerStatetable.length)) return powerStatetable[x];
3411
+ return "Unknown";
3412
+ }
3413
+
3414
+ function selectallButtonFunction() {
3415
+ var elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
3416
+ for (var i=0;i<elements.length;i++) { if (elements[i].checked === true) checkcount++; }
3417
+ for (var i=0;i<elements.length;i++) { elements[i].checked = (checkcount == 0); }
3418
+ p1updateInfo();
3419
+ }
3420
+
3421
+ function p1updateInfo() {
3422
+ var elements = document.getElementsByClassName('DeviceCheckbox'), checkcount = 0;
3423
+ for (var i=0;i<elements.length;i++) { if (elements[i].checked === true) { checkcount++; } }
3424
+ if (checkcount > 0) {
3425
+ QE('GroupActionButton', true);
3426
+ Q('SelectAllButton').value = "Vybrat nic";
3427
+ QV('cxmgroupsplit', true);
3428
+ QV('cxmdesktop', true);
3429
+ } else {
3430
+ QE('GroupActionButton', false);
3431
+ Q('SelectAllButton').value = "Vybrat vše";
3432
+ QV('cxmgroupsplit', false);
3433
+ QV('cxmdesktop', false);
3434
+ }
3435
+ }
3436
+
3437
+ function groupActionFunction() {
3438
+ var addedOptions = '', nodeids = getCheckedDevices();
3439
+
3440
+ // Check if any of the selected devices have a MQTT connection active
3441
+ if (features & 0x00400000) {
3442
+ for (var i in nodeids) { if ((getNodeFromId(nodeids[i]).conn & 16) != 0) { addedOptions += '<option value=103>' + "Send MQTT Message" + '</option>'; break; } }
3443
+ }
3444
+
3445
+ // Display the "Uninstall Agent" option if allowed and we selected connected devices.
3446
+ for (var i in nodeids) {
3447
+ var node = getNodeFromId(nodeids[i]);
3448
+ var mesh = meshes[node.meshid];
3449
+ var meshrights = mesh.links[userinfo._id].rights;
3450
+ if (((node.conn & 1) != 0) && ((meshrights & 32768) != 0)) { addedOptions += '<option value=104>' + "Uninstall Agent" + '</option>'; break; }
3451
+ }
3452
+
3453
+ var x = "Select an operation to perform on all selected devices. Actions will be performed only with proper rights." + '<br /><br />';
3454
+ x += addHtmlValue("Operace", '<select id=d2groupop><option value=100>' + "Probudit zařízení" + '</option><option value=4>' + "Sleep devices" + '</option><option value=3>' + "Reset zařízení" + '</option><option value=2>' + "Vypnout zařízení" + '</option><option value=102>' + "Přesunout do skupiny zařízení" + '</option>' + addedOptions + '<option value=101>' + "Delete devices" + '</option></select>');
3455
+ setDialogMode(2, "Akce skupiny", 3, groupActionFunctionEx, x);
3456
+ }
3457
+
3458
+ // Get the list of checked devices, removes any duplicates.
3459
+ function getCheckedDevices() {
3460
+ var nodeids = [], elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
3461
+ 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); } } } }
3462
+ return nodeids;
3463
+ }
3464
+
3465
+ function groupActionFunctionEx() {
3466
+ var op = Q('d2groupop').value;
3467
+ if (op == 100) {
3468
+ // Group wake
3469
+ meshserver.send({ action: 'wakedevices', nodeids: getCheckedDevices() });
3470
+ } else if (op == 101) {
3471
+ // Group delete, ask for confirmation
3472
+ var x = "Potvrdit smázání vybraných zařízení?" + '<br /><br />';
3473
+ x += '<label><input id=d2check type=checkbox onchange=d2groupActionFunctionDelEx() />' + "Confirm" + '</label>';
3474
+ setDialogMode(2, "Smazat nody", 3, groupActionFunctionDelEx, x);
3475
+ QE('idx_dlgOkButton', false);
3476
+ } else if (op == 102) {
3477
+ // Move computers to a different group
3478
+ p10showChangeGroupDialog(getCheckedDevices());
3479
+ } else if (op == 103) {
3480
+ // Send MQTT Message
3481
+ p10showSendMqttMsgDialog(getCheckedDevices());
3482
+ } else if (op == 104) {
3483
+ // Uninstall agent
3484
+ p10showSendUninstallAgentDialog(getCheckedDevices());
3485
+ } else {
3486
+ // Power operation
3487
+ meshserver.send({ action: 'poweraction', nodeids: getCheckedDevices(), actiontype: parseInt(op) });
3488
+ }
3489
+ }
3490
+
3491
+ function d2groupActionFunctionDelEx() { QE('idx_dlgOkButton', Q('d2check').checked); }
3492
+ function groupActionFunctionDelEx() { meshserver.send({ action: 'removedevices', nodeids: getCheckedDevices() }); }
3493
+
3494
+ function onSortSelectChange(skipsave) {
3495
+ sort = document.getElementById('sortselect').selectedIndex;
3496
+ if (!skipsave) { putstore('sort', sort); }
3497
+ }
3498
+
3499
+ 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; }
3500
+ 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; }
3501
+ function deviceSort(a, b) { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; }
3502
+ function deviceHostSort(a, b) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; }
3503
+ function onSearchFocus(x) { searchFocus = x; }
3504
+ function onMapSearchFocus(x) { mapSearchFocus = x; }
3505
+ function onUserSearchFocus(x) { userSearchFocus = x; }
3506
+ function onConsoleFocus(x) { consoleFocus = x; }
3507
+
3508
+ function onSearchInputChanged() {
3509
+ var x = Q('SearchInput').value.toLowerCase().trim(); putstore('_search', x);
3510
+ var userSearch = null, ipSearch = null, groupSearch = null;
3511
+ if (x.startsWith('user:')) { userSearch = x.substring(5); }
3512
+ else if (x.startsWith('u:')) { userSearch = x.substring(2); }
3513
+ else if (x.startsWith('ip:')) { ipSearch = x.substring(3); }
3514
+ else if (x.startsWith('group:')) { groupSearch = x.substring(6); }
3515
+ else if (x.startsWith('g:')) { groupSearch = x.substring(2); }
3516
+
3517
+ if (x == '') {
3518
+ // No search
3519
+ for (var d in nodes) { nodes[d].v = true; }
3520
+ } else if (ipSearch != null) {
3521
+ // IP address search
3522
+ for (var d in nodes) { nodes[d].v = ((nodes[d].ip != null) && (nodes[d].ip.indexOf(ipSearch) >= 0)); }
3523
+ } else if (groupSearch != null) {
3524
+ // Group filter
3525
+ for (var d in nodes) { nodes[d].v = (meshes[nodes[d].meshid].name.toLowerCase().indexOf(groupSearch) >= 0); }
3526
+ } else if (userSearch != null) {
3527
+ // User search
3528
+ for (var d in nodes) {
3529
+ nodes[d].v = false;
3530
+ if (nodes[d].users && nodes[d].users.length > 0) { for (var i in nodes[d].users) { if (nodes[d].users[i].toLowerCase().indexOf(userSearch) >= 0) { nodes[d].v = true; } } }
3531
+ }
3532
+ } else {
3533
+ // Device name search
3534
+ try {
3535
+ var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
3536
+ for (var d in nodes) {
3537
+ nodes[d].v = (rx.test(nodes[d].name.toLowerCase())) || (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase()));
3538
+ if ((nodes[d].v == false) && nodes[d].tags) {
3539
+ for (var s in nodes[d].tags) {
3540
+ if (rx.test(nodes[d].tags[s].toLowerCase())) {
3541
+ nodes[d].v = true;
3542
+ break;
3543
+ } else {
3544
+ nodes[d].v = false;
3545
+ }
3546
+ }
3547
+ }
3548
+ }
3549
+ } catch (ex) { for (var d in nodes) { nodes[d].v = true; } }
3550
+ }
3551
+ }
3552
+
3553
+ var contextelement = null;
3554
+ function handleContextMenu(event) {
3555
+ hideContextMenu();
3556
+ var scrollLeft = (window.pageXOffset !== null) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
3557
+ var scrollTop = (window.pageYOffset !== null) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
3558
+ var elem = document.elementFromPoint(event.pageX - scrollLeft, event.pageY - scrollTop);
3559
+ if (elem && elem != null && elem.id == 'connectbutton2' && currentNode && currentNode.agent && (currentNode.agent.id > 0) && (currentNode.agent.id < 5)) {
3560
+ contextelement = elem;
3561
+ var contextmenudiv = document.getElementById('termShellContextMenu');
3562
+ contextmenudiv.style.left = event.pageX + 'px';
3563
+ contextmenudiv.style.top = event.pageY + 'px';
3564
+ contextmenudiv.style.display = 'block';
3565
+ } else if (elem && elem != null && elem.id == 'connectbutton2' && currentNode && currentNode.agent && (currentNode.agent.id > 4)) {
3566
+ contextelement = elem;
3567
+ var contextmenudiv = document.getElementById('termShellContextMenuLinux');
3568
+ contextmenudiv.style.left = event.pageX + 'px';
3569
+ contextmenudiv.style.top = event.pageY + 'px';
3570
+ contextmenudiv.style.display = 'block';
3571
+ } else if (elem && elem != null && elem.id == 'MxMESH') {
3572
+ contextelement = elem;
3573
+ var contextmenudiv = document.getElementById('meshContextMenu');
3574
+ contextmenudiv.style.left = event.pageX + 'px';
3575
+ contextmenudiv.style.top = event.pageY + 'px';
3576
+ contextmenudiv.style.display = 'block';
3577
+ /*} else if (elem && elem != null && elem.classList.contains('pluginTab')) {
3578
+ contextelement = elem;
3579
+ var contextmenudiv = document.getElementById('pluginTabContextMenu');
3580
+ contextmenudiv.style.left = event.pageX + 'px';
3581
+ contextmenudiv.style.top = event.pageY + 'px';
3582
+ contextmenudiv.style.display = 'block';*/
3583
+ } else {
3584
+ while (elem && elem != null && elem.id != 'devs') { elem = elem.parentElement; }
3585
+ if (!elem || elem == null) return true;
3586
+ contextelement = elem;
3587
+ var contextmenudiv = document.getElementById('contextMenu');
3588
+ contextmenudiv.style.left = event.pageX + 'px';
3589
+ contextmenudiv.style.top = event.pageY + 'px';
3590
+ contextmenudiv.style.display = 'block';
3591
+
3592
+ // Get the node and set the menu options
3593
+ var nodeid = contextelement.children[1].attributes.onclick.value;
3594
+ var node = getNodeFromId(nodeid.substring(12, nodeid.length - 18));
3595
+ var mesh = meshes[node.meshid];
3596
+ var meshlinks = mesh.links[userinfo._id];
3597
+ var meshrights = meshlinks.rights;
3598
+ var consoleRights = ((meshrights & 16) != 0);
3599
+
3600
+ // Check if we have terminal and file access
3601
+ var terminalAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 512) == 0));
3602
+ var fileAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 1024) == 0));
3603
+
3604
+ 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)));
3605
+ 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) && terminalAccess);
3606
+ QV('cxfiles', ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 4) != 0))) && (meshrights & 8) && fileAccess);
3607
+ QV('cxevents', (node.intelamt != null) && ((node.intelamt.state == 2) || (node.conn & 2)) && (meshrights & 8));
3608
+ QV('cxconsole', (consoleRights && (mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 8) != 0))) && (meshrights & 8));
3609
+ }
3610
+
3611
+ return haltEvent(event);
3612
+ }
3613
+
3614
+ function cmaction(action,event) {
3615
+ var nodeid = contextelement.children[1].attributes.onclick.value;
3616
+ nodeid = nodeid.substring(12, nodeid.length - 18);
3617
+ if (action == 7) { Q('viewselect').value = 3; Q('viewselect').onchange(); Q('autoConnectDesktopCheckbox').checked = true; Q('autoConnectDesktopCheckbox').onclick(); } // Multi-Desktop
3618
+ if ((action > 0) && (action < 7)) {
3619
+ var panel = [0, 10, 12, 11, 13, 16, 15][action]; // (invalid), General, Desktop, Terminal, Files, Events, Console
3620
+ if (event && (event.shiftKey == true)) {
3621
+ // Open the device in a different tab
3622
+ window.open(window.location.origin + '?node=' + nodeid.split('/')[2] + '&viewmode=' + panel + '&hide=16', 'meshcentral:' + nodeid);
3623
+ } else {
3624
+ // Go to the right panel
3625
+ gotoDevice(nodeid, panel);
3626
+
3627
+ // If possible, connect...
3628
+ var mesh = meshes[currentNode.meshid];
3629
+ if ((currentNode.conn & 1) && (mesh.mtype == 2)) {
3630
+ if ((panel == 11) && (desktop == null) && (currentNode.agent.caps & 1)) { connectDesktop(null, 1); } // Desktop
3631
+ if ((panel == 12) && (terminal == null) && (currentNode.agent.caps & 2)) { connectTerminal(null, 1); } // Terminal
3632
+ if ((panel == 13) && (files == null)) { connectFiles(null); } // files
3633
+ }
3634
+ }
3635
+ }
3636
+ }
3637
+
3638
+ function cmmeshaction(action) {
3639
+ var meshid = contextelement.attributes.onclick.value.substring(10, contextelement.attributes.onclick.value.length - 2);
3640
+ var elements = document.getElementsByClassName('DeviceCheckbox');
3641
+ if ((action == 1) || (action == 2)) {
3642
+ for (var i = 0; i < elements.length; i++) {
3643
+ if ((elements[i].attributes) && (elements[i].attributes['class']['value'].split(' ')[0] == meshid)) { elements[i].checked = (action == 1); }
3644
+ }
3645
+ }
3646
+ //if (action == 3) { window.location = "multidesktop.aspx?mesh=" + meshid + "&auto=1"; }
3647
+ p1updateInfo();
3648
+ }
3649
+
3650
+ function cmtermaction(action) {
3651
+ connectTerminal(null, 1, { protocol: action });
3652
+ }
3653
+
3654
+ /*
3655
+ function pluginTabClose() {
3656
+ var pluginTab = contextelement;
3657
+ var pname = pluginTab.getAttribute('x-data-plugin-sname');
3658
+ var pdiv = Q('plugin-'+pname);
3659
+ pdiv.parentNode.removeChild(pdiv);
3660
+ pluginTab.parentNode.removeChild(pluginTab);
3661
+ QV('p42', true);
3662
+ goPlugin(-1);
3663
+ }
3664
+ */
3665
+
3666
+ function hideContextMenu() {
3667
+ QV('contextMenu', false);
3668
+ QV('meshContextMenu', false);
3669
+ QV('termShellContextMenu', false);
3670
+ QV('termShellContextMenuLinux', false);
3671
+ //QV('pluginTabContextMenu', false);
3672
+ contextelement = null;
3673
+ }
3674
+
3675
+ //
3676
+ // DEVICES MAP
3677
+ //
3678
+
3679
+ // Maps code starts from here. Initialize all the variables
3680
+ var xxmap = {
3681
+ map: null,
3682
+ contextmenu: null,
3683
+ activeInteractions: [], // Save Modified features in this list
3684
+ showindex: 0,
3685
+ markersSource: null, // Initialize a Source Vector
3686
+ markersLayer: null,
3687
+ mapLayer: null, // Create a tile and use OSM source
3688
+ mapView: null, // Sets the initial view
3689
+ }
3690
+
3691
+ // Add a feature for every Node and change style if connection status changes
3692
+ function updateMapMarkers(selectedMesh) {
3693
+ if ((xxmap != null) && (xxmap.map == null)) { try { loadmap(); } catch (ex) { console.error('loadmap() exception', ex); } }
3694
+ if (xxmap == null) return;
3695
+ var boundingBox = null;
3696
+ for (var i in nodes) {
3697
+ try {
3698
+ var loc = map_parseNodeLoc(nodes[i]), feature = xxmap.markersSource.getFeatureById(nodes[i]._id);
3699
+ if ((loc != null) && ((nodes[i].meshid == selectedMesh) || (selectedMesh == null))) { // Draw markers for devices with locations
3700
+ var lat = loc[0], lon = loc[1], type = loc[2];
3701
+ 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; } }
3702
+ if (feature == null) { addFeature(nodes[i]); boundingBox[4] = 1; } else { updateFeature(nodes[i], feature); feature.setStyle(markerStyle(nodes[i], loc[2])); } // Update Feature
3703
+ } else {
3704
+ if (feature) { xxmap.markersSource.removeFeature(feature); }
3705
+ }
3706
+ } catch (ex) { console.error('updateMapMarkers() exception', ex, JSON.stringify(nodes[i])); }
3707
+ }
3708
+ return boundingBox;
3709
+ }
3710
+
3711
+ // Show node details on hovering over a feature
3712
+ var map_cm_popup = new ol.Overlay({ element: Q('xmap-info-window'), positioning: 'bottom-center', stopEvent: false });
3713
+
3714
+ // Edit Marker item
3715
+ var map_cm_editMarker = { text: "Modify node location", callback: function (obj) { modifyMarkerloc(obj.data); } };
3716
+
3717
+ // Clear Marker item
3718
+ var map_cm_clearMarker = { text: "Remove node location", callback: function (obj) {
3719
+ meshserver.send({ action: 'changedevice', nodeid: obj.data.a, userloc: [] }); // Clear the user position marker
3720
+ }};
3721
+
3722
+ // Save Marker item
3723
+ var map_cm_saveMarker = { text: "Save node location", callback: function (obj) { saveMarkerloc(obj.data); } };
3724
+
3725
+ // Build a context menu for a feature
3726
+ var map_cm_nodemenu_items = [
3727
+ { text: "Obecné informace", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 10); } } },
3728
+ { text: "Plocha", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 11); } } },
3729
+ { text: "Terminál", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 12); } } },
3730
+ { text: "Intel® AMT", callback: function (obj) { if (obj.data !=null) { gotoDevice(obj.data, 14); } } },
3731
+ '-',
3732
+ { text: "Zoom-in to extent", callback: function(obj) { var coords = obj.data.getGeometry().getCoordinates(); zoomToLocation(coords, 19); } },
3733
+ { text: "Zoom-out to extent", callback: function(obj) { var coords = obj.data.getGeometry().getCoordinates(); zoomToLocation(coords, 2); } }
3734
+ ];
3735
+
3736
+ // Context menu for clicks other than on feature
3737
+ var contextmenu_items = [
3738
+ { text: "Obnovit", callback: function () { refreshMap(true, true); } },
3739
+ { text: "Zoom to fit extent", callback: function () { zoomToFitExtent(); } },
3740
+ { text: "Center map here", callback: function(obj) { xxmap.mapView.animate({ center: obj.coordinate } ); } },
3741
+ { text: "Place node here", callback: function(obj) { placeNode(obj.coordinate); } }
3742
+ ];
3743
+
3744
+ function stringToIntHash(str) {
3745
+ var hash = 0, i;
3746
+ for (i = 0; i < str.length; i++) { hash = ((hash << 5) - hash) + str.charCodeAt(i); hash |= 0; }
3747
+ return hash;
3748
+ };
3749
+
3750
+ // Get the lat/lon from a node
3751
+ function map_parseNodeLoc(node) {
3752
+ var loc = null, t = 0;
3753
+ if (node.iploc) { loc = node.iploc; t = 1; }
3754
+ if (node.wifiloc) { loc = node.wifiloc; t = 2; }
3755
+ if (node.gpsloc) { loc = node.gpsloc; t = 3; }
3756
+ if (node.userloc) { loc = node.userloc; t = 4; }
3757
+ if ((loc == null) || (typeof loc != 'string')) return null;
3758
+ loc = loc.split(',');
3759
+ if (t == 1) {
3760
+ // If this is IP location, randomize the position a little.
3761
+ return [ parseFloat(loc[0]) + (stringToIntHash(node._id.substring(0, 20)) / 100000000000), parseFloat(loc[1]) + (stringToIntHash(node._id.substring(20)) / 100000000000), t ];
3762
+ } else {
3763
+ // Return the real position
3764
+ return [ parseFloat(loc[0]), parseFloat(loc[1]), t ];
3765
+ }
3766
+ }
3767
+
3768
+ // Load the entire map
3769
+ function loadmap() {
3770
+ if (xxmap == null) return;
3771
+ if ((features & 0x8000) == 0) { QV('viewselectmapoption', false); QV('devViewButton4', false); xxmap = null; return; } // Geolocation not supported
3772
+ try {
3773
+ // Initialize a Source Vector
3774
+ xxmap.markersSource = new ol.source.Vector();
3775
+
3776
+ xxmap.markersLayer = new ol.layer.Vector({
3777
+ source: xxmap.markersSource
3778
+ });
3779
+
3780
+ // Create a tile and use OSM source
3781
+ xxmap.mapLayer = new ol.layer.Tile({ source: new ol.source.OSM() });
3782
+
3783
+ xxmap.mapView = new ol.View({ // Set the initial view
3784
+ center: ol.proj.transform([0, 0], 'EPSG:4326', 'EPSG:3857'),
3785
+ zoom: 2,
3786
+ minZoom: 2,
3787
+ maxZoom: 20,
3788
+ extent: ol.proj.transformExtent([-100000, -69.55, 100000, 69.55], 'EPSG:4326', 'EPSG:3857')
3789
+ });
3790
+
3791
+ xxmap.map = new ol.Map({
3792
+ target: 'xdevicesmap',
3793
+ layers: [xxmap.mapLayer, xxmap.markersLayer],
3794
+ view: xxmap.mapView
3795
+ });
3796
+
3797
+ xxmap.map.addOverlay(map_cm_popup);
3798
+
3799
+ // Goto information tab if a user clicks on a feature
3800
+ xxmap.map.on('click', function(evt) {
3801
+ var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(feat, layer) { return feat; });
3802
+ if (feature) {
3803
+ var nodeid = feature.getId();
3804
+ if (nodeid != null) { gotoDevice(nodeid, 10); } // Goto general info tab
3805
+ else { // For pointer
3806
+ var nodeFeatgoto = getCorrespondingFeature(feature); gotoDevice(nodeFeatgoto.getId(), 10);
3807
+ }
3808
+ }
3809
+ });
3810
+
3811
+ // On hover feature show the name of the node. Also add pointer style
3812
+ xxmap.map.on('pointermove', function(evt) {
3813
+ var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(feat, layer) { return feat; });
3814
+ if (feature) {
3815
+ xxmap.map.getTargetElement().style.cursor = 'pointer';
3816
+ var coord = feature.getGeometry().getCoordinates();
3817
+ // map_cm_popup.setPosition(evt.coordinate);
3818
+ map_cm_popup.setPosition(coord);
3819
+ var featid = feature.getId();
3820
+ if (featid) {
3821
+ QH('xmap-info-window', feature.get('name'));
3822
+ } else {
3823
+ var nodeFeat = getCorrespondingFeature(feature); // Return the node feature associated to pointer.
3824
+ QH('xmap-info-window', nodeFeat.get('name'));
3825
+ }
3826
+ } else {
3827
+ xxmap.map.getTargetElement().style.cursor = '';
3828
+ QH('xmap-info-window', '');
3829
+ }
3830
+ });
3831
+
3832
+ // Initialize context menu for openlayers
3833
+ var contextmenu = new ContextMenu({
3834
+ width: 160,
3835
+ defaultItems: false, // defaultItems are Zoom In/Zoom Out
3836
+ items: contextmenu_items
3837
+ });
3838
+
3839
+ // On right click open the context menu
3840
+ contextmenu.on("open", function (evt) {
3841
+ var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(ft, l){ return ft; });
3842
+ xxmap.contextmenu.clear(); //Clear the context menu
3843
+ if (feature) {
3844
+ var featId = feature.getId();
3845
+ if (featId) { addContextMenuItems(feature); } // Node feature will have an id
3846
+ else { // If the feature is a pointer, Get its corresponding Node feature
3847
+ var nodeFeature = getCorrespondingFeature(feature); //return the node feature associated to pointer.
3848
+ if (nodeFeature) { addContextMenuItems(nodeFeature); }
3849
+ else{ xxmap.contextmenu.extend(contextmenu_items); }
3850
+ }
3851
+ }
3852
+ else { xxmap.contextmenu.extend(contextmenu_items); }
3853
+ });
3854
+ if (xxmap.contextmenu == null) { xxmap.contextmenu = contextmenu; }
3855
+ xxmap.map.addControl(xxmap.contextmenu);
3856
+ //addMeshOptions(); // Adds Mesh names to mesh dropdown
3857
+ } catch (ex) {
3858
+ console.log(ex);
3859
+ QV('viewselectmapoption', false);
3860
+ QV('devViewButton4', false);
3861
+ xxmap = null;
3862
+ }
3863
+ }
3864
+
3865
+ // Add feature on to Map for a Node
3866
+ function addFeature(node, lat, lon) {
3867
+ var existingfeature = getModifiedFeature(node._id); // Check if Corresponding feature was Modified ( Modifed feature are in active interactions list)
3868
+ if (existingfeature) { xxmap.markersSource.addFeature(existingfeature); } // Add that existing feature
3869
+ else { // Add new feature for this node
3870
+ if (!lat && !lon) { var loc = map_parseNodeLoc(node); lat = loc[0]; lon = loc[1]; }
3871
+
3872
+ // 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.
3873
+ if (lon > 180) { lon = 180 - lon; meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: [ lat, lon ] }); }
3874
+
3875
+ if ((lat < 90) && (lat > -90) && (lon < 180) && (lon > -180)) { // Check valid lat/lon
3876
+ 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 });
3877
+ feature.setId(node._id); // Set id for the device as nodeid
3878
+ feature.setStyle(markerStyle(node));
3879
+ xxmap.markersSource.addFeature(feature); // Add the feature to Marker Source
3880
+ }
3881
+ }
3882
+ }
3883
+
3884
+ // Removing any feature from map
3885
+ function removeFeature(node) {
3886
+ var feature = xxmap.markersSource.getFeatureById(node._id);
3887
+ if (feature) { xxmap.markersSource.removeFeature(feature); }
3888
+ }
3889
+
3890
+ // Update feature
3891
+ function updateFeature(node, feature) {
3892
+ if (node.conn != feature.get('status') ) { // Update status if changed
3893
+ feature.set('status',node.conn)
3894
+ feature.setStyle(markerStyle(node));
3895
+ }
3896
+
3897
+ // Since this is IP address location, add some fixed randomness to the location. Avoid pin pile-up.
3898
+ var loc = map_parseNodeLoc(node);
3899
+ if (loc != null) {
3900
+ var lat = loc[0], lon = loc[1];
3901
+ if ((lat != feature.get('lat')) || (lon != feature.get('lon'))) { // Update lat and lon if changed
3902
+ feature.set('lat', lat); feature.set('lon', lon);
3903
+ var modifiedCoordinates = ol.proj.transform([parseFloat(lon), parseFloat(lat)], 'EPSG:4326', 'EPSG:3857');
3904
+ feature.getGeometry().setCoordinates(modifiedCoordinates);
3905
+ }
3906
+ }
3907
+
3908
+ if (node.name != feature.get('name') ) { feature.set('name', node.name); } // Update name
3909
+ }
3910
+
3911
+ // Enable dragging of a marker after edit option is clicked in context menu
3912
+ function modifyMarkerloc(ft){
3913
+ var featid = ft.getId();
3914
+ if (featid) {
3915
+ ft.setStyle(markerStyle(getNodeFromId(ft.a), 4)); // Switch to a user marker
3916
+ if ( !getActiveInteractions(ft)) {
3917
+ var dragInteration = new ol.interaction.Modify({
3918
+ features: new ol.Collection([ft]),
3919
+ pixelTolerance: 10
3920
+ });
3921
+ xxmap.activeInteractions.push({ featureid: featid, feature:ft, interaction: dragInteration }); // Also keep track of Interactions
3922
+ xxmap.map.addInteraction(dragInteration);
3923
+ }
3924
+ }
3925
+ }
3926
+
3927
+ // This will be called when save location option is clicked in context menu
3928
+ function saveMarkerloc(ft){
3929
+ var featid = ft.getId()
3930
+ if (featid) {
3931
+ var actInteraction = getActiveInteractions(ft);
3932
+ if (actInteraction) { // Check if the interaction exists
3933
+ xxmap.map.removeInteraction(actInteraction); //Clear Interaction for that node
3934
+ removeInteraction(featid);
3935
+ var coord = ft.getGeometry().getCoordinates();
3936
+ var v = ol.proj.transform(coord, 'EPSG:3857', 'EPSG:4326');
3937
+ if (v[0] > 180) { v[0] = 180 - v[0]; }
3938
+ var vx = [ v[1], v[0] ]; // Flip the coordinates around, lat/long
3939
+ meshserver.send({ action: 'changedevice', nodeid: featid, userloc: vx }); // Send them to server to save changes
3940
+ }
3941
+ }
3942
+ }
3943
+
3944
+ // Style the Markers
3945
+ function markerStyle(node, type) {
3946
+ if (type == null) {
3947
+ type = 0;
3948
+ if (node.iploc) { type = 1; }
3949
+ if (node.wifiloc) { type = 2; }
3950
+ if (node.gpsloc) { type = 3; }
3951
+ if (node.userloc) { type = 4; }
3952
+ }
3953
+ var types = ['', '-ip','-wifi','-gps','-user'];
3954
+ var color = connStateColor(node);
3955
+ var style = new ol.style.Style({
3956
+ image: new ol.style.Icon({ color: color, anchor: [0.5, 1], src: 'images/mapmarker' + types[type] + '.png' })
3957
+ //stroke: new ol.style.Stroke({ color: '#000', width: 20 })
3958
+ //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 }) })
3959
+ });
3960
+
3961
+ /*
3962
+ deviceMark.setStyle(new ol.style.Style({
3963
+ text: new ol.style.Text({
3964
+ //font: '12px helvetica,sans-serif',
3965
+ text: currentNode.name,
3966
+ textAlign: 'right',
3967
+ offsetX: -10,
3968
+ fill: new ol.style.Fill({ color: '#000' }),
3969
+ stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
3970
+ }),
3971
+ image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) }));
3972
+ */
3973
+
3974
+ return [ style ];
3975
+ }
3976
+
3977
+ // TODO: Add more connection status types. Currently we only change color if connection status changes
3978
+ function connStateColor(nodeConn){
3979
+ if (nodeConn.conn == 1 || nodeConn.conn == 3 || nodeConn.conn == 5) { return '#00ffdd'; } // Green for connected devices
3980
+ return '#C70039'; // Red if the Agent is not connected
3981
+ }
3982
+
3983
+ // Add save/edit option to context menu
3984
+ function addContextMenuItems(feature) {
3985
+ if (getActiveInteractions(feature)) { // If this feature is modified then display save option in contextmenu
3986
+ map_cm_saveMarker.data = feature;
3987
+ xxmap.contextmenu.push(map_cm_saveMarker);
3988
+ } else {
3989
+ map_cm_editMarker.data = feature;
3990
+ xxmap.contextmenu.push(map_cm_editMarker);
3991
+ var node = getNodeFromId(feature.a);
3992
+ if (node.userloc) {
3993
+ map_cm_clearMarker.data = feature;
3994
+ xxmap.contextmenu.push(map_cm_clearMarker);
3995
+ }
3996
+ }
3997
+ map_cm_nodemenu_items.forEach(function (item){
3998
+ if (item.text == "Zoom-in to extent" || item.text == "Zoom-out to extent") { item.data = feature; }
3999
+ else { if (item != '-') { item.data = feature.getId(); } }
4000
+ });
4001
+ xxmap.contextmenu.extend(map_cm_nodemenu_items);
4002
+ }
4003
+
4004
+ // Return a active Interaction if it exists in activeInteractions list
4005
+ function getActiveInteractions(feature) {
4006
+ var featid = feature.getId();
4007
+ for (var i = 0; i < xxmap.activeInteractions.length; i++) {
4008
+ if (xxmap.activeInteractions[i].featureid == featid) { return xxmap.activeInteractions[i].interaction; }
4009
+ }
4010
+ return false;
4011
+ }
4012
+
4013
+ // Return Modified feature based on Id
4014
+ function getModifiedFeature(featid) {
4015
+ if (featid) {
4016
+ for (var i = 0; i < xxmap.activeInteractions.length; i++) {
4017
+ if (xxmap.activeInteractions[i].featureid == featid) { return xxmap.activeInteractions[i].feature; }
4018
+ }
4019
+ }
4020
+ return null;
4021
+ }
4022
+
4023
+ // Remove Interaction
4024
+ function removeInteraction(ftid) {
4025
+ var index = -1;
4026
+ for (var i = 0; i < xxmap.activeInteractions.length; i++) {
4027
+ if (xxmap.activeInteractions[i].featureid === ftid) { index = i; break; }
4028
+ }
4029
+ if (index >= 0) { xxmap.activeInteractions.splice(index, 1); }
4030
+ }
4031
+
4032
+ // Check if pointer coordinates are equal to features and return node feature
4033
+ function getCorrespondingFeature(pointerFeat) {
4034
+ var pointerCoord = pointerFeat.getGeometry().getCoordinates();
4035
+ for (var i = 0; i < xxmap.activeInteractions.length ; i++) {
4036
+ var modifiedFeatures = xxmap.activeInteractions[i].feature;
4037
+ var fearCoord = modifiedFeatures.getGeometry().getCoordinates();
4038
+ if (fearCoord[0].toFixed(5) == pointerCoord[0].toFixed(5) && fearCoord[1].toFixed(5) == pointerCoord[1].toFixed(5) ) { return modifiedFeatures; }
4039
+ }
4040
+ return null;
4041
+ }
4042
+
4043
+ // Refresh the map and clear list
4044
+ function refreshMap(reset, rebound){
4045
+ if (reset) {
4046
+ xxmap.map.setTarget(null);
4047
+ xxmap.map = null;
4048
+ xxmap.markersSource = null;
4049
+ xxmap.mapView = null;
4050
+ xxmap.mapLayer = null;
4051
+ xxmap.activeInteractions = []; // Clear Active Interaction list
4052
+ }
4053
+ //clearMeshOptions();
4054
+ //onSelectMeshChange();
4055
+ var box = updateMapMarkers();
4056
+ if ((box != null) && (rebound || (box[4] == 1))) {
4057
+ var clat = (box[0] + box[2]) / 2;
4058
+ var clon = (box[1] + box[3]) / 2;
4059
+ var cscale = Math.max(Math.abs(box[0] - box[2]), Math.abs(box[1] - box[3]));
4060
+ var view = xxmap.map.getView();
4061
+ view.setCenter(ol.proj.transform([clon, clat], 'EPSG:4326', 'EPSG:3857'));
4062
+ var i = 360, j = -2;
4063
+ while (i > cscale) { j++; i = i / 2; }
4064
+ view.setZoom(j);
4065
+ }
4066
+ }
4067
+
4068
+ // Called When Place a node option is clicked from context menu
4069
+ function placeNode(coords) {
4070
+ if (xxdialogMode) return;
4071
+ var x = '<div style=margin-bottom:6px><label for=selectnode-search>' + "Search" + '</label>  <input type=text placeholder="' + "Název zařízení" + '" 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>' + "Žádné zařízení nalezeno." + '</div>';
4072
+ for (var i in nodes) {
4073
+ 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 />';
4074
+ 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>';
4075
+ }
4076
+ setDialogMode(2, "Select a node to place", 3, placeNodeEx, x + '</div>', coords);
4077
+ onPlaceNodeInputChange();
4078
+ }
4079
+
4080
+ function placeNodeEx(button, coords) {
4081
+ var elements = document.getElementsByName('PlaceMapDeviceCheckbox');
4082
+ for (var i in elements) {
4083
+ if (elements[i].checked) {
4084
+ var node = getNodeFromId(elements[i].id.substring(0, elements[i].id.length - 8));
4085
+ if (node) {
4086
+ var feature = xxmap.markersSource.getFeatureById(i);
4087
+ var v = ol.proj.transform(coords, 'EPSG:3857', 'EPSG:4326');
4088
+ var vx = [ v[1], v[0] ]; // Flip the coordinates around, lat/long
4089
+ if (feature) {
4090
+ feature.getGeometry().setCoordinates(coords);
4091
+ var activeInteraction = getActiveInteractions(feature);
4092
+ if (activeInteraction) {
4093
+ saveMarkerloc(feature);
4094
+ } else { // If this feature is not saved after its location is changed, then send updated coords to server.
4095
+ meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: vx }); // Send them to server to save changes
4096
+ }
4097
+ } else {
4098
+ meshserver.send({ action: 'changedevice', nodeid: node._id, userloc: vx }); // This Node is not yet added to maps.
4099
+ }
4100
+ }
4101
+ }
4102
+ }
4103
+ }
4104
+
4105
+ // Called when the user changes the search box
4106
+ function onPlaceNodeInputChange() {
4107
+ updatePlaceNodeTable(Q('selectnode-search').value.trim().toLowerCase());
4108
+ }
4109
+
4110
+ // Update the list of devices in the "place on map" table
4111
+ function updatePlaceNodeTable(inputSearch) {
4112
+ var elements = document.getElementsByName('PlaceMapDeviceCheckbox'), count = 0;
4113
+ for (var i in nodes) {
4114
+ var visible = ((nodes[i].namel.indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.indexOf(inputSearch) >= 0));
4115
+ if (visible) { count++; }
4116
+ QV(nodes[i]._id + '-rowid', visible);
4117
+ }
4118
+ QV('noNodesMapPlace', count == 0);
4119
+ /*
4120
+ console.log(selected);
4121
+ for (var i in nodes) {
4122
+ if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) {
4123
+ console.log(selected.indexOf(nodes[i]._id));
4124
+ 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':'') + ' />';
4125
+ 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>';
4126
+ }
4127
+ }
4128
+ if (x == '') { x = '<div style=text-align:center;width:100%>No devices found.</div>'; }
4129
+ QH('placenode', '');
4130
+ */
4131
+ }
4132
+
4133
+ // Called when a user clicks on a device to toggle selection for placement on map.
4134
+ function selectNodeToPlace(e, id) {
4135
+ // Toggle checkbox if needed
4136
+ if (e.target.name != 'PlaceMapDeviceCheckbox') { var inputElement = Q(id + '-checkid'); inputElement.checked = !inputElement.checked; }
4137
+
4138
+ // Check button state
4139
+ var elements = document.getElementsByName('PlaceMapDeviceCheckbox'), checkcount = 0;
4140
+ for (var i in elements) { if (elements[i].checked) checkcount++; }
4141
+ QE('idx_dlgOkButton', checkcount > 0);
4142
+ }
4143
+
4144
+ // Add option for available meshes in mesh Dropdown
4145
+ function addMeshOptions(addMeshid, meshName) {
4146
+ /*
4147
+ var meshOptions = Q('select-mesh');
4148
+ if (addMeshid && meshName) {
4149
+ var option = document.createElement('option');
4150
+ option.value =addMeshid;
4151
+ option.text = meshName;
4152
+ meshOptions.add(option); // Add specific option
4153
+ }
4154
+ else {
4155
+ for (var i in meshes) { // Add all options
4156
+ var option = document.createElement('option');
4157
+ option.value = i;
4158
+ option.text = meshes[i].name;
4159
+ meshOptions.add(option);
4160
+ }
4161
+ }
4162
+ */
4163
+ }
4164
+
4165
+ // Remove/Modify options in Mesh dropdown (if modMeshname is defined then Modify else Remove)
4166
+ function meshOptionRmvMod(delMeshid, modMeshname){
4167
+ /*
4168
+ var meshOptions = Q('select-mesh');
4169
+ if (delMeshid) {
4170
+ var index=-1;
4171
+ for (var i = 1; i < meshOptions.options.length; i++) {
4172
+ if (meshOptions[i].value === delMeshid) { index=i; }
4173
+ }
4174
+ if (index > 0) {
4175
+ if (modMeshname) {
4176
+ meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified
4177
+ }
4178
+ else { meshOptions.remove(index); }
4179
+ }
4180
+ }
4181
+ */
4182
+ }
4183
+
4184
+ //Check if there is any mesh created
4185
+ function meshExists() {
4186
+ for (var i in meshes) { if (meshes[i]) { return true; } }
4187
+ return false;
4188
+ }
4189
+
4190
+ // Reset Mesh dropdown option to 'All' when a current view mesh is deleted.
4191
+ function setMeshView(emeshid) {
4192
+ var selectMeshElement=Q('select-mesh');
4193
+ var selectedIndex = selectMeshElement.selectedIndex;
4194
+ if (selectMeshElement[selectedIndex].value == emeshid) { selectMeshElement[0].selected = true; onSelectMeshChange(); }
4195
+ }
4196
+
4197
+ // Clear all mesh options except 'All'
4198
+ function clearMeshOptions() {
4199
+ /*
4200
+ var meshOptions=Q('select-mesh');
4201
+ for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); }
4202
+ */
4203
+ }
4204
+
4205
+ // Make a http get call- Replace this with AJAX get if jquery is used
4206
+ function getSearchLocation() {
4207
+ try {
4208
+ var searchdata = Q('mapSearchLocation').value.trim();
4209
+ if (searchdata.length > 0) {
4210
+ var xmlhttp = new XMLHttpRequest(); // Compatible with Chrome, Opera, Safari, IE7+, Firefox.
4211
+ xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { formatSearchData(xmlhttp.responseText); } }
4212
+ xmlhttp.open('GET', 'https://nominatim.openstreetmap.org/search?q=' + searchdata + '&format=json', true); // Get request
4213
+ xmlhttp.send();
4214
+ }
4215
+ } catch (e) {}
4216
+ }
4217
+
4218
+ // Format data recieved from nominatim API and display it on content window
4219
+ function formatSearchData(data) {
4220
+ try {
4221
+ QH('xmapSearchResults','');
4222
+ var dataInfo = JSON.parse(data), count = 0, x = '<div class="xmapItem">';
4223
+ for (var i = 0; i < dataInfo.length; i++) {
4224
+ if (dataInfo[i].display_name && dataInfo[i].boundingbox[0] && dataInfo[i].boundingbox[1] && dataInfo[i].boundingbox[2] && dataInfo[i].boundingbox[3]) {
4225
+ count++;
4226
+ var itemclass = (i % 2 == 0)?'xmapItemSel1':'xmapItemSel1';
4227
+ x += '<div class="' + itemclass + '" 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>';
4228
+ }
4229
+ }
4230
+ x += '</div>';
4231
+ if (count == 1) {
4232
+ // If only one result is returned then zoom to that location
4233
+ var extent = [ parseFloat(dataInfo[0].boundingbox[2]), parseFloat(dataInfo[0].boundingbox[0]), parseFloat(dataInfo[0].boundingbox[3]), parseFloat(dataInfo[0].boundingbox[1]) ];
4234
+ zoomToExtent(extent);
4235
+ } else {
4236
+ if (count == 0) { x = '<div style=width:200px>' + "No location found." + '<div>'; }
4237
+ QV('xmapSearchResultsDlg', true);
4238
+ }
4239
+ QH('xmapSearchResults', x);
4240
+ }
4241
+ catch (e) {}
4242
+ }
4243
+
4244
+ // Zoom into the bounding box
4245
+ function mapGotoSelectedLocation(obj) {
4246
+ var objchildren = obj.children;
4247
+ var boundingBox = objchildren[1].innerHTML.split('!#!');
4248
+ var extent = [parseFloat(boundingBox[2]), parseFloat(boundingBox[0]), parseFloat(boundingBox[3]), parseFloat(boundingBox[1])];
4249
+ //Q('search-location').value = objchildren[0].innerHTML;
4250
+ zoomToExtent(extent);
4251
+ mapCloseSearchWindow();
4252
+ }
4253
+
4254
+ // Close the search window
4255
+ function mapCloseSearchWindow() {
4256
+ QH('xmapSearchResults', '');
4257
+ QV('xmapSearchResultsDlg', false);
4258
+ }
4259
+
4260
+ // Zoom to specific cordinates
4261
+ function zoomToLocation(coordinates, zoomVal) {
4262
+ var view = xxmap.map.getView();
4263
+ view.setCenter(coordinates);
4264
+ view.setZoom(zoomVal);
4265
+ }
4266
+
4267
+ function zoomToFitExtent() {
4268
+ var features = xxmap.markersSource.getFeatures();
4269
+ if (features.length > 0) {
4270
+ var extent = xxmap.markersSource.getExtent();
4271
+ xxmap.map.getView().fit(extent, xxmap.map.getSize());
4272
+ }
4273
+ }
4274
+
4275
+ function zoomToExtent(extent){
4276
+ var boundingExtent = ol.proj.transformExtent(extent, ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857'));
4277
+ xxmap.map.getView().fit(boundingExtent, xxmap.map.getSize());
4278
+ }
4279
+
4280
+
4281
+ //
4282
+ // MY DEVICE
4283
+ //
4284
+ function refreshDevice(nodeid) {
4285
+ if (!currentNode || currentNode._id != nodeid) return;
4286
+ gotoDevice(nodeid, xxcurrentView, true);
4287
+ }
4288
+
4289
+ function getNodeRights(nodeid) {
4290
+ var node = getNodeFromId(nodeid), mesh = meshes[node.meshid];
4291
+ return mesh.links[userinfo._id].rights;
4292
+ }
4293
+
4294
+ var currentNode;
4295
+ var powerTimelineNode = null;
4296
+ var powerTimelineReq = null;
4297
+ var powerTimelineUpdate = null;
4298
+ var powerTimeline = null;
4299
+ function getCurrentNode() { return currentNode; };
4300
+ function gotoDevice(nodeid, panel, refresh, event) {
4301
+ // Remind the user to verify the email address
4302
+ if ((userinfo.emailVerified !== true) && (serverinfo.emailcheck == true) && (userinfo.siteadmin != 0xFFFFFFFF)) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until a email address is verified. This is required for password recovery. Go to the \"My Account\" tab to change and verify an email address."); return; }
4303
+
4304
+ // Remind the user to add two factor authentication
4305
+ if ((features & 0x00040000) && !((userinfo.otpsecret == 1) || (userinfo.otphkeys > 0) || (userinfo.otpkeys > 0))) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the \"My Account\" tab and look at the \"Account Security\" section."); return; }
4306
+
4307
+ if (event && (event.shiftKey == true)) {
4308
+ // Open the device in a different tab
4309
+ window.open(window.location.origin + '?node=' + nodeid.split('/')[2] + '&viewmode=10&hide=16', 'meshcentral:' + nodeid);
4310
+ return;
4311
+ }
4312
+
4313
+ //disconnectAllKvmFunction();
4314
+ var node = getNodeFromId(nodeid);
4315
+ var mesh = meshes[node.meshid];
4316
+ var meshrights = mesh.links[userinfo._id].rights;
4317
+ if (!currentNode || currentNode._id != node._id || refresh == true) {
4318
+ currentNode = node;
4319
+
4320
+ // Add node name
4321
+ var nname = EscapeHtml(node.name);
4322
+ if (nname.length == 0) { nname = '<i>' + "Nic" + '</i>'; }
4323
+ if (((meshrights & 4) != 0) && ((!mesh.flags) || ((mesh.flags & 2) == 0))) { nname = '<span tabindex=0 title=\"' + "Click here to edit the server-side device name" + '\" onclick=showEditNodeValueDialog(0) onkeyup="if (event.key == \'Enter\') showEditNodeValueDialog(0)" style=cursor:pointer>' + nname + ' <img class=hoverButton src="images/link5.png" /></span>'; }
4324
+ nname += '<span style=color:#AAA;font-size:small> - ' + EscapeHtml(mesh.name) + '</span>';
4325
+ QH('p10deviceName', nname);
4326
+ QH('p11deviceName', nname);
4327
+ QH('p12deviceName', nname);
4328
+ QH('p13deviceName', nname);
4329
+ QH('p14deviceName', nname);
4330
+ QH('p15deviceName', "Konzole - " + nname);
4331
+ QH('p16deviceName', nname);
4332
+ QH('p17deviceName', nname);
4333
+ QH('p19deviceName', nname);
4334
+
4335
+ // Node attributes
4336
+ var x = '<table style=width:100%>';
4337
+
4338
+ // Attribute: Mesh
4339
+ x += addDeviceAttribute('<span title=\"' + "The name of the device group this computer belong to." + '\">' + "Skupina" + '</span>', '<a href=# title=\"' + "The name of the device group this computer belong to" + '\" onclick=gotoMesh("' + node.meshid + '") style=cursor:pointer>' + EscapeHtml(meshes[node.meshid].name) + '</a>');
4340
+
4341
+ // Attribute: Name
4342
+ 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>'); }
4343
+
4344
+ // Attribute: Host
4345
+ if ((features & 1) == 0) { // If not WAN-only, local hostname is in use
4346
+ if ((meshrights & 4) != 0) {
4347
+ if (node.host) {
4348
+ x += addDeviceAttribute("Hostname", '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>' + EscapeHtml(node.host) + '</span>');
4349
+ } else {
4350
+ x += addDeviceAttribute("Hostname", '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>' + "Nic" + '</i></span>');
4351
+ }
4352
+ } else {
4353
+ x += addDeviceAttribute("Hostname", EscapeHtml(node.host));
4354
+ }
4355
+ }
4356
+
4357
+ // Attribute: Description
4358
+ var description = node.desc?EscapeHtml(node.desc):('<i>' + "Nic" + '</i>');
4359
+ if ((meshrights & 4) != 0) {
4360
+ x += addDeviceAttribute("Popis", '<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>' + description + ' <img class=hoverButton src="images/link5.png" /></span>');
4361
+ } else {
4362
+ x += addDeviceAttribute("Popis", description);
4363
+ }
4364
+
4365
+ // Attribute: Mesh Agent
4366
+ 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", "MacOS 32bit", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32bit", "MacOS 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", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "Unknown", "Unknown", "FreeBSD x86-64"];
4367
+ if ((node.agent != null) && (node.agent.id != null) && (node.agent.ver != null)) {
4368
+ var str = '';
4369
+ if (node.agent.id <= agentsStr.length) { str = agentsStr[node.agent.id]; } else { str = agentsStr[0]; }
4370
+ if (node.agent.ver != 0) { str += ' v' + node.agent.ver; }
4371
+ x += addDeviceAttribute("Mesh Agent", str);
4372
+ }
4373
+
4374
+ // Attribute: Intel AMT
4375
+ if (node.intelamt != null) {
4376
+ var str = '';
4377
+ var provisioningStates = { 0: nobreak("Not Activated (Pre)"), 1: nobreak("Not Activated (In)"), 2: nobreak("Activated") };
4378
+ if (node.intelamt.ver != null && node.intelamt.state == null) { str += '<i>' + "Unknown State" + '</i>, v' + node.intelamt.ver; } else
4379
+
4380
+ if ((node.intelamt.ver == null) && (node.intelamt.state == 2)) { str += '<i>' + "Activated" + '</i>'; }
4381
+ else if ((node.intelamt.ver == null) || (node.intelamt.state == null)) { str += '<i>' + "Unknown Version & State" + '</i>'; }
4382
+ else {
4383
+ str += provisioningStates[node.intelamt.state];
4384
+ if ((node.intelamt.state == 2) && 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>'; } }
4385
+ str += (', v' + node.intelamt.ver);
4386
+ }
4387
+
4388
+ if (node.intelamt.tls == 1) { str += ', <span title=\"' + "Intel AMT is setup with TLS network security" + '\">' + "TLS" + '</span>'; }
4389
+ if (node.intelamt.state == 2) {
4390
+ if (node.intelamt.user == null || node.intelamt.user == '') {
4391
+ if ((meshrights & 4) != 0) {
4392
+ str += ', <i style=color:#FF0000;cursor:pointer title=\"' + "Edit Intel® AMT credentials" + '\" onclick=editDeviceAmtSettings("' + node._id + '")>' + "Žádné přihlašovací údaje" + '</i>';
4393
+ } else {
4394
+ str += ', <i style=color:#FF0000>' + "Žádné přihlašovací údaje" + '</i>';
4395
+ }
4396
+ }
4397
+ str += ' ';
4398
+ if ((meshrights & 4) != 0) {
4399
+ str += '<img src=images/link4.png height=10 width=10 title=\"' + "Edit Intel® AMT credentials" + '\" style=cursor:pointer onclick=editDeviceAmtSettings("' + node._id + '")>';
4400
+ }
4401
+ }
4402
+
4403
+ var meName = '<span title=\"Intel® Manageability Engine\">' + "Intel® ME" + '<span>';
4404
+ if (typeof node.intelamt.sku == 'number') {
4405
+ if ((node.intelamt.sku & 8) != 0) { meName = '<span title=\"' + "Intel® Active Management Technology" + '\">' + "Intel® AMT" + '<span>'; }
4406
+ else if ((node.intelamt.sku & 16) != 0) { meName = '<span title=\"' + "Intel® Standard Manageability" + '\">' + "Intel® SM" + '<span>'; }
4407
+ }
4408
+ x += addDeviceAttribute(meName, str);
4409
+ }
4410
+
4411
+ if (mesh.mtype == 2) {
4412
+ // Attribute: Mesh Agent Tag
4413
+ if ((node.agent != null) && (node.agent.tag != null)) {
4414
+ var tag = EscapeHtml(node.agent.tag);
4415
+ if (tag.startsWith('mailto:')) { tag = '<a href="' + tag + '">' + tag.substring(7) + '</a>'; }
4416
+ x += addDeviceAttribute("Agent Tag", tag);
4417
+ }
4418
+ } else {
4419
+ // Attribute: Intel AMT Tag
4420
+ if ((node.intelamt != null) && (node.intelamt.tag != null)) {
4421
+ var tag = EscapeHtml(node.intelamt.tag);
4422
+ if (tag.startsWith('mailto:')) { tag = '<a href="' + tag + '">' + tag.substring(7) + '</a>'; }
4423
+ x += addDeviceAttribute("Intel® AMT Tag", tag);
4424
+ }
4425
+ }
4426
+
4427
+ // Attribute: Intel AMT
4428
+ //if (node.intelamt && node.intelamt.user) { x += addDeviceAttribute('Intel® AMT', node.intelamt.user); }
4429
+
4430
+ // Operating system description
4431
+ if (node.osdesc) { x += addDeviceAttribute("Operační systém", node.osdesc); }
4432
+
4433
+ // Antivirus
4434
+ if (node.av && node.av.length > 0) {
4435
+ var y = [];
4436
+ for (var i in node.av) {
4437
+ if (node.av[i].product) {
4438
+ var avx = EscapeHtml(node.av[i].product);
4439
+ if (node.av[i].enabled !== true) { avx += ' - <span style=color:red>' + "Disabled" + '</span>'; }
4440
+ if (node.av[i].updated !== true) { avx += ' - <span style=color:red>' + "Out of date" + '</span>'; }
4441
+ if ((node.av[i].enabled == true) && (node.av[i].updated == true)) { avx += ' - <span style=color:green>' + "OK" + '</span>'; }
4442
+ y.push(avx);
4443
+ }
4444
+ }
4445
+ x += addDeviceAttribute("Antivirus", y.join('<br />'));
4446
+ }
4447
+
4448
+ // Active Users
4449
+ if (node.users && node.conn && (node.users.length > 0) && (node.conn & 1)) { x += addDeviceAttribute(format("Active User{0}", ((node.users.length > 1)?'s':'')), node.users.join(', ')); }
4450
+
4451
+ // Attribute: Connectivity (Only show this if more than just the agent is connected).
4452
+ var connectivity = node.conn;
4453
+ if (connectivity && connectivity > 1) {
4454
+ var cstate = [];
4455
+ if ((node.conn & 1) != 0) cstate.push('<span title=\"' + "Agent je připojen a připraven." + '\">' + "Mesh Agent" + '</span>');
4456
+ if ((node.conn & 2) != 0) cstate.push('<span title=\"' + "Intel® AMT CIRA is connected and ready for use." + '\">' + "Intel® AMT CIRA" + '</span>');
4457
+ else if ((node.conn & 4) != 0) cstate.push('<span title=\"' + "Intel® AMT is routable and ready for use." + '\">' + "Intel® AMT" + '</span>');
4458
+ if ((node.conn & 8) != 0) cstate.push('<span title=\"' + "Mesh agent is reachable using another agent as relay." + '\">' + "Mesh Relay" + '</span>');
4459
+ if ((node.conn & 16) != 0) { cstate.push('<span title=\"' + "MQTT connection to the device is active." + '\">' + "MQTT" + '</span>'); }
4460
+ x += addDeviceAttribute("Connectivity", cstate.join(', '));
4461
+ }
4462
+
4463
+ // Node grouping tags
4464
+ var groupingTags = '<i>' + "Nic" + '</i>';
4465
+ if (node.tags != null) { groupingTags = ''; for (var i in node.tags) { groupingTags += '<span class="tagSpan">' + node.tags[i] + '</span>'; } }
4466
+ if ((meshrights & 4) != 0) {
4467
+ x += addDeviceAttribute('Tags', '<span onclick=showEditNodeValueDialog(3) style=cursor:pointer>' + groupingTags + ' <img class=hoverButton src="images/link5.png" /></span>');
4468
+ } else {
4469
+ x += addDeviceAttribute('Tags', groupingTags);
4470
+ }
4471
+
4472
+ x += '</table><br />';
4473
+ // Show action button, only show if we have permissions 4, 8, 64
4474
+ if ((meshrights & 76) != 0) { x += '<input type=button value=\"' + "Akce" + '\" title=\"' + "Akce napájení" + '\" onclick=deviceActionFunction() />'; }
4475
+ x += '<input type=button value=\"' + "Poznámky" + '\" title=\"' + "View notes about this device" + '\" onclick=showNotes(' + ((meshrights & 128) == 0) + ',"' + encodeURIComponent(node._id) + '") />';
4476
+ x += '<input type=button value=\"' + "Log udalostí" + '\" title=\"' + "Write an event for this device" + '\" onclick=writeDeviceEvent("' + encodeURIComponent(node._id) + '") />';
4477
+ //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() />'; }
4478
+ QH('p10html', x);
4479
+
4480
+ // Show node last 7 days timeline
4481
+ masterUpdate(256);
4482
+
4483
+ // Show bottom buttons
4484
+ x = '<div class="p10html3right">';
4485
+ if ((meshrights & 4) != 0) {
4486
+ // TODO: Show change group only if there is another mesh of the same type.
4487
+ x += ' <a href=# onclick=p10showChangeGroupDialog(["' + node._id + '"]) title=\"' + "Move this device to a different device group" + '\">' + "Změnit skupinu" + '</a>';
4488
+ x += ' <a href=# onclick=p10showDeleteNodeDialog("' + node._id + '") title=\"' + "Remove this device" + '\">' + "Smazat zařízení" + '</a>';
4489
+ }
4490
+ x += '</div><div class="p10html3left">';
4491
+ if (mesh.mtype == 2) x += '<a href=# onclick=p10showNodeNetInfoDialog("' + node._id + '") title=\"' + "Show device network interface information" + '\">' + "Interfaces" + '</a> ';
4492
+ if (xxmap != null) x += '<a href=# onclick=p10showNodeLocationDialog("' + node._id + '") title=\"' + "Show device locations information" + '\">' + "Location" + '</a> ';
4493
+ if (((meshrights & 8) != 0) && (mesh.mtype == 2)) x += '<a href=# onclick=p10showMeshCmdDialog(1,"' + node._id + '") title=\"' + "Traffic router used to connect to a device thru this server" + '.\">' + "Router" + '</a> ';
4494
+
4495
+ // RDP link, show this link only of the remote machine is Windows.
4496
+ if (((connectivity & 1) != 0) && (clickOnce == true) && (mesh.mtype == 2) && ((meshrights & 8) != 0)) {
4497
+ if ((node.agent.id > 0) && (node.agent.id < 5)) { x += '<a href=# onclick=p10clickOnce("' + node._id + '","RDP2",3389) title=\"' + "Requires Microsoft ClickOnce support in your browser" + '.\">' + "RDP" + '</a> '; }
4498
+ if (node.agent.id > 4) {
4499
+ x += '<a href=# onclick=p10clickOnce("' + node._id + '","PSSH",22) title=\"' + "Requires Microsoft ClickOnce support in your browser." + '\">' + "Putty" + '</a> ';
4500
+ x += '<a href=# onclick=p10clickOnce("' + node._id + '","WSCP",22) title=\"' + "Requires Microsoft ClickOnce support in your browser." + '\">' + "WinSCP" + '</a> ';
4501
+ }
4502
+ }
4503
+
4504
+ // MQTT options
4505
+ if ((meshrights == 0xFFFFFFFF) && (features & 0x00400000)) { x += '<a href=# onclick=p10showMqttLoginDialog("' + node._id + '") title=\"' + "Get MQTT login credentials for this device." + '\">' + "MQTT Login" + '</a> '; }
4506
+ x += '</div><br>'
4507
+
4508
+ QH('p10html3', x);
4509
+
4510
+ // Set the node power state
4511
+ var powerstate = PowerStateStr(node.state);
4512
+ //if (node.state == 0) { powerstate = 'Unknown State'; }
4513
+ if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "Agent připojen" + '\">' + "Agent připojen" + '</span>'; }
4514
+ if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "Intel® AMT connected" + '\">' + "Intel® AMT connected" + '</span>'; }
4515
+ else if ((connectivity & 4) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "Intel® AMT detected" + '\">' + "Intel® AMT detected" + '</span>'; }
4516
+ if ((connectivity & 16) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title=\"' + "MQTT připojeno" + '\">' + "MQTT channel connected" + '</span>'; }
4517
+ if ((powerstate == '') && node.lastconnect) { powerstate = '<span style=font-size:12px>' + "Naposledy spatřen:" + '<br />' + printDateTime(new Date(node.lastconnect)) + '</span>'; }
4518
+ QH('MainComputerState', powerstate);
4519
+
4520
+ // Set the node icon
4521
+ Q('MainComputerImage').setAttribute('src', 'images/icons256-' + node.icon + '-1.png');
4522
+ Q('MainComputerImage').className = ((!node.conn) || (node.conn == 0)?'gray':'');
4523
+
4524
+ // Check if we have terminal and file access
4525
+ var terminalAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 512) == 0));
4526
+ var fileAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 1024) == 0));
4527
+ var amtAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 2048) == 0));
4528
+
4529
+ // Setup/Refresh the desktop tab
4530
+ if (terminalAccess) { setupTerminal(); }
4531
+ if (fileAccess) { setupFiles(); }
4532
+ var consoleRights = ((meshrights & 16) != 0);
4533
+ if (consoleRights) { setupConsole(); } else { if (panel == 15) { panel = 10; } }
4534
+
4535
+ // Show or hide the tabs
4536
+ // mesh.mtype: 1 = Intel AMT only, 2 = Mesh Agent
4537
+ // node.agent.caps (bitmask): 1 = Desktop, 2 = Terminal, 4 = Files, 8 = Console
4538
+ QV('MainDevDesktop', (((mesh.mtype == 1) && ((typeof node.intelamt.sku !== 'number') || ((node.intelamt.sku & 8) != 0)))
4539
+ || ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 1) != 0) || (node.intelamt && (node.intelamt.state == 2)))))
4540
+ && ((meshrights & 8) || (meshrights & 256))
4541
+ );
4542
+ 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) && terminalAccess);
4543
+ QV('MainDevFiles', ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 4) != 0))) && (meshrights & 8) && fileAccess);
4544
+ QV('MainDevAmt', (node.intelamt != null) && ((node.intelamt.state == 2) || (node.conn & 2)) && (meshrights & 8) && amtAccess);
4545
+ QV('MainDevConsole', (consoleRights && (mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 8) != 0))) && (meshrights & 8));
4546
+ QV('MainDevPlugins', pluginHandler != null);
4547
+ QV('p15uploadCore', (node.agent != null) && (node.agent.caps != null) && ((node.agent.caps & 16) != 0));
4548
+ QH('p15coreName', ((node.agent != null) && (node.agent.core != null))?node.agent.core:'');
4549
+
4550
+ // Setup/Refresh Intel AMT tab
4551
+ var amtFrameNode = Q('p14iframe').contentWindow.getCurrentMeshNode();
4552
+ if ((amtFrameNode != null) && (amtFrameNode._id != currentNode._id)) { Q('p14iframe').contentWindow.disconnect(); }
4553
+ var online = ((node.conn & 6) != 0)?true:false; // If CIRA (2) or AMT (4) connected, enable Commander
4554
+ Q('p14iframe').contentWindow.setConnectionState(online);
4555
+ Q('p14iframe').contentWindow.setFrameHeight('650px');
4556
+ Q('p14iframe').contentWindow.setAuthCallback(updateAmtCredentials);
4557
+
4558
+ // Display "action" button on desktop/terminal/files
4559
+ QV('deskActionsBtn', (meshrights & 72) != 0); // 72 = Wake-up + Remote Control permissions
4560
+ QV('termActionsBtn', (meshrights & 72) != 0);
4561
+ QV('filesActionsBtn', (meshrights & 72) != 0);
4562
+
4563
+ // Request the power timeline
4564
+ if ((powerTimelineNode != currentNode._id) && (powerTimelineReq != currentNode._id)) {
4565
+ QH('p10html2', '');
4566
+ powerTimelineReq = currentNode._id;
4567
+ meshserver.send({ action: 'powertimeline', nodeid: currentNode._id });
4568
+ meshserver.send({ action: 'lastconnect', nodeid: currentNode._id });
4569
+ meshserver.send({ action: 'getsysinfo', nodeid: currentNode._id });
4570
+ QH('p17info', '');
4571
+ }
4572
+
4573
+ // Reset the desktop tools
4574
+ QV('DeskTools', false);
4575
+ showDeskToolsProcesses();
4576
+
4577
+ // Ask for device events
4578
+ refreshDeviceEvents();
4579
+
4580
+ // Update the web page title
4581
+ if ((currentNode) && (xxcurrentView >= 10) && (xxcurrentView < 20)) {
4582
+ document.title = decodeURIComponent('{{{extitle}}}') + ' - ' + currentNode.name + ' - ' + mesh.name;
4583
+ } else {
4584
+ document.title = decodeURIComponent('{{{extitle}}}');
4585
+ }
4586
+
4587
+ // Clear user consent status if present
4588
+ p11clearConsoleMsg();
4589
+ p12clearConsoleMsg();
4590
+ p13clearConsoleMsg();
4591
+
4592
+ // Device refresh plugin handler
4593
+ if (pluginHandler != null) { pluginHandler.callHook('onDeviceRefreshEnd', nodeid, panel, refresh, event); }
4594
+ }
4595
+ setupDesktop(); // Always refresh the desktop, even if we are on the same device, we need to do some canvas switching.
4596
+ if (!panel) panel = 10;
4597
+ go(panel);
4598
+ }
4599
+
4600
+ function writeDeviceEvent(nodeid) {
4601
+ if (xxdialogMode) return;
4602
+ setDialogMode(2, "Add Device Event", 3, writeDeviceEventEx, '<textarea id=d2devEvent style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea><span style=font-size:10px>' + "This will add an entry to this device\'s event log." + '<span>', nodeid);
4603
+ }
4604
+
4605
+ function writeDeviceEventEx(buttons, tag) { meshserver.send({ action: 'setDeviceEvent', nodeid: decodeURIComponent(tag), msg: encodeURIComponent(Q('d2devEvent').value) }); }
4606
+
4607
+ function showNotes(readonly, noteid) {
4608
+ if (xxdialogMode) return;
4609
+ setDialogMode(2, "Poznámky", 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>' + "Device group notes can be viewed and changed by other device group administrators." + '<span>', noteid);
4610
+ meshserver.send({ action: 'getNotes', id: decodeURIComponent(noteid) });
4611
+ }
4612
+
4613
+ function showNotesEx(buttons, tag) { meshserver.send({ action: 'setNotes', id: decodeURIComponent(tag), notes: encodeURIComponent(Q('d2devNotes').value) }); }
4614
+
4615
+ function deviceChat(e) {
4616
+ if (xxdialogMode) return;
4617
+ var url = '/messenger?id=meshmessenger/' + encodeURIComponent(currentNode._id) + '/' + encodeURIComponent(userinfo._id) + '&title=' + currentNode.name;
4618
+ if ((authCookie != null) && (authCookie != '')) { url += '&auth=' + authCookie; }
4619
+ if (e && (e.shiftKey == true)) {
4620
+ window.open(url, 'meshmessenger:' + currentNode._id);
4621
+ } else {
4622
+ window.open(url, 'meshmessenger:' + currentNode._id, 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=560');
4623
+ }
4624
+ meshserver.send({ action: 'meshmessenger', nodeid: decodeURIComponent(currentNode._id) });
4625
+ }
4626
+
4627
+ function deviceToggleBackground() {
4628
+ if (xxdialogMode) return;
4629
+ meshserver.send({ action: 'msg', type: 'deskBackground', nodeid: currentNode._id, op: 1 }); // Toggle desktop background image
4630
+ }
4631
+
4632
+ function deviceUrlFunction() {
4633
+ if (xxdialogMode) return;
4634
+ setDialogMode(2, "Open Page on Device", 3, deviceUrlFunctionEx, '<input id=d2devurl placeholder="http://server.com" style=width:100%;overflow-y:scroll></input>');
4635
+ Q('d2devurl').focus();
4636
+ }
4637
+
4638
+ function deviceUrlFunctionEx() {
4639
+ meshserver.send({ action: 'msg', type: 'openUrl', nodeid: currentNode._id, url: Q('d2devurl').value });
4640
+ }
4641
+
4642
+ function deviceToastFunction() {
4643
+ if (xxdialogMode) return;
4644
+ setDialogMode(2, "Device Notification", 3, deviceToastFunctionEx, '<textarea id=d2devToast style=width:100%;height:80px;resize:none;overflow-y:scroll></textarea>');
4645
+ Q('d2devToast').focus();
4646
+ }
4647
+
4648
+ function deviceToastFunctionEx() {
4649
+ meshserver.send({ action: 'toast', nodeids: [ currentNode._id ], title: 'MeshCentral', msg: Q('d2devToast').value });
4650
+ }
4651
+
4652
+ function deviceActionFunction() {
4653
+ if (xxdialogMode) return;
4654
+ var meshrights = meshes[currentNode.meshid].links[userinfo._id].rights;
4655
+ var x = "Vyber operaci na tomto zařízení." + '<br /><br />';
4656
+ var y = '<select id=d2deviceop style=float:right;width:250px>';
4657
+ if ((meshrights & 64) != 0) { y += '<option value=100>' + "Probudit" + '</option>'; } // Wake-up permission
4658
+ if ((meshrights & 8) != 0) { y += '<option value=4>' + "Spánek" + '</option><option value=3>' + "Reset" + '</option><option value=2>' + "Vypnout" + '</option>'; } // Remote control permission
4659
+ if ((currentNode.conn & 16) != 0) { y += '<option value=103>' + "Send MQTT Message" + '</option>'; }
4660
+ if (((currentNode.conn & 1) != 0) && ((meshrights & 32768) != 0)) { y += '<option value=104>' + "Uninstall Agent" + '</option>'; }
4661
+ y += '</select>';
4662
+ x += addHtmlValue("Operace", y);
4663
+ setDialogMode(2, "Akce zařízení", 3, deviceActionFunctionEx, x);
4664
+ }
4665
+
4666
+ function deviceActionFunctionEx() {
4667
+ var op = Q('d2deviceop').value;
4668
+ if (op == 100) {
4669
+ // Device wake
4670
+ meshserver.send({ action: 'wakedevices', nodeids: [currentNode._id] });
4671
+ } else if (op == 103) {
4672
+ // Send MQTT Message
4673
+ p10showSendMqttMsgDialog([currentNode._id]);
4674
+ } else if (op == 104) {
4675
+ // Uninstall agent
4676
+ p10showSendUninstallAgentDialog([currentNode._id]);
4677
+ } else {
4678
+ // Power operation
4679
+ meshserver.send({ action: 'poweraction', nodeids: [ currentNode._id ], actiontype: parseInt(op) });
4680
+ }
4681
+ }
4682
+
4683
+ // Called when MeshCommander needs new credentials or updated credentials.
4684
+ function updateAmtCredentials(forceDialog) {
4685
+ var node = getNodeFromId(currentNode._id);
4686
+ if ((forceDialog == true) || (node.intelamt.user == null) || (node.intelamt.user == '')) {
4687
+ editDeviceAmtSettings(currentNode._id, updateAmtCredentialsEx);
4688
+ } else {
4689
+ Q('p14iframe').contentWindow.connectButtonfunctionEx();
4690
+ }
4691
+ }
4692
+
4693
+ function updateAmtCredentialsEx(button, tag) {
4694
+ Q('p14iframe').contentWindow.connectButtonfunctionEx();
4695
+ }
4696
+
4697
+ // Look to see if we need to update the device timeline
4698
+ function updateDeviceTimeline() {
4699
+ if ((meshserver.State != 2) || (powerTimelineNode == null) || (powerTimelineUpdate == null) || (currentNode == null)) return;
4700
+ if ((powerTimelineNode == powerTimelineReq) && (currentNode._id == powerTimelineNode) && (powerTimelineUpdate < Date.now())) {
4701
+ powerTimelineUpdate = null;
4702
+ meshserver.send({ action: 'powertimeline', nodeid: currentNode._id });
4703
+ meshserver.send({ action: 'lastconnect', nodeid: currentNode._id });
4704
+ }
4705
+ }
4706
+
4707
+ // Draw device power bars. The bars are 766px wide.
4708
+ function drawDeviceTimeline() {
4709
+ if ((currentNode == null) || (xxcurrentView < 10) || (xxcurrentView > 19)) return;
4710
+ var timeline = null, now = Date.now();
4711
+ if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; }
4712
+
4713
+ // Calculate when the timeline starts
4714
+ var d = new Date();
4715
+ d.setHours(0, 0, 0, 0);
4716
+ d = new Date(d.getTime() - (1000 * 60 * 60 * 24 * 6));
4717
+ var timelineStart = d.getTime();
4718
+
4719
+ // De-compact the timeline
4720
+ var timeline2 = [];
4721
+ if (timeline != null && timeline.length > 1) {
4722
+ timeline2.push([ 0, timeline[1], timeline[0] ]); // Start, End, Power
4723
+ var ct = timeline[1];
4724
+ for (var i = 2; i < timeline.length; i += 2) {
4725
+ var power = timeline[i], dt = now;
4726
+ if (timeline.length > (i + 1)) { dt = timeline[i + 1]; }
4727
+ timeline2.push([ ct, ct + dt, power ]); // Start, End, Power
4728
+ ct = ct + dt;
4729
+ }
4730
+ }
4731
+
4732
+ // Draw the timeline
4733
+ var x = '', count = 1, date = new Date();
4734
+ var totalWidth = Q('masthead').offsetWidth - (160 + 9 + 9 + 14); // Compute the total width of the power bar
4735
+ date.setHours(0, 0, 0, 0);
4736
+ for (var i = 0; i < 7; i++) {
4737
+ var datavalue = '', start = date.getTime(), end = start + (1000 * 60 * 60 * 24);
4738
+ for (var j in timeline2) {
4739
+ var block = timeline2[j];
4740
+ if (isTimeBlockInside(start, end, block[0], block[1]) == true) {
4741
+ var ts = Math.max(start, block[0]);
4742
+ var te = Math.min(Math.min(end, block[1]), now);
4743
+ var width = Math.round(((te - ts) * totalWidth) / 86400000);
4744
+ if (width > 0) {
4745
+ var title = format('{0} from {1} to {2}.', powerStateStrings2[block[2]], printTime(new Date(ts)), printTime(new Date(te)));
4746
+ datavalue += '<div class="pwState ' + powerColor(block[2]) + '" title="' + title + '" style="width:' + width + 'px;"></div>';
4747
+ }
4748
+ }
4749
+ }
4750
+ x += '<tr class=' + (((count % 2) == 0)?'altBack':'') + '><td><div> ' + printDate(date) + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
4751
+ ++count;
4752
+ date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
4753
+ }
4754
+ QH('p10html2', '<table cellpadding=2 cellspacing=0><thead><tr style=><th scope=col style=text-align:center;width:150px>' + "Den" + '</th><th scope=col style=text-align:center><a download href="devicepowerevents.ashx?id=' + currentNode._id + '" onclick="setDialogMode(0)"><img title=\"' + "Download power events" + '\" src="images/link4.png" /></a>' + "7 denní statistika provozu" + '</th></tr></thead><tbody>' + x + '</tbody></table>');
4755
+ }
4756
+
4757
+ // Return a color for the given power state
4758
+ function powerColor(x) { if (x < powerColorTable.length) { return powerColorTable[x]; } return 'pwsYellow'; }
4759
+
4760
+ // Return true if the time block is visible within the start/end period
4761
+ function isTimeBlockInside(start, end, blockStart, blockEnd) {
4762
+ if ((blockStart < start) && (blockEnd > end)) return true; // Block is wider than timespan
4763
+ if ((blockStart > start) && (blockStart < end)) return true;
4764
+ if ((blockEnd > start) && (blockEnd < end)) return true;
4765
+ return false;
4766
+ }
4767
+
4768
+ function addDeviceAttribute(name, value) { return '<tr><td class=style7>' + name + '</td><td class=style9>' + value + '</td></tr>'; }
4769
+
4770
+ function editDeviceAmtSettings(nodeid, func, arg) {
4771
+ if (xxdialogMode) return;
4772
+ var x = '', node = getNodeFromId(nodeid), buttons = 3, meshrights = getNodeRights(nodeid);
4773
+ if ((meshrights & 4) == 0) return;
4774
+ x += addHtmlValue("Uživatel", '<input id=dp10username style=width:230px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
4775
+ x += addHtmlValue("Heslo", '<input id=dp10password type=password style=width:230px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
4776
+ x += addHtmlValue("Bezpečnost", '<select id=dp10tls style=width:236px><option value=0>' + "Žádné TLS" + '</option><option value=1>' + "TLS vyžadováno" + '</option></select>');
4777
+ if ((node.intelamt.user != null) && (node.intelamt.user != '')) { buttons = 7; }
4778
+ setDialogMode(2, "Edit Intel® AMT credentials", buttons, editDeviceAmtSettingsEx, x, { node: node, func: func, arg: arg });
4779
+ if ((node.intelamt.user != null) && (node.intelamt.user != '')) { Q('dp10username').value = node.intelamt.user; } else { Q('dp10username').value = 'admin'; }
4780
+ Q('dp10tls').value = node.intelamt.tls;
4781
+ validateDeviceAmtSettings();
4782
+ }
4783
+
4784
+ function validateDeviceAmtSettings() {
4785
+ QE('idx_dlgOkButton', passwordcheck(Q('dp10password').value));
4786
+ }
4787
+
4788
+ function editDeviceAmtSettingsEx(button, tag) {
4789
+ if (button == 2) {
4790
+ // Delete button pressed, remove credentials
4791
+ meshserver.send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: '', pass: '' } });
4792
+ } else {
4793
+ // Change Intel AMT credentials
4794
+ var amtuser = Q('dp10username').value;
4795
+ if (amtuser == '') amtuser = 'admin';
4796
+ var amtpass = Q('dp10password').value;
4797
+ if (amtpass == '') amtuser = '';
4798
+ meshserver.send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: amtuser, pass: amtpass, tls: Q('dp10tls').value } });
4799
+ tag.node.intelamt.user = amtuser;
4800
+ tag.node.intelamt.tls = Q('dp10tls').value;
4801
+ if (tag.func) { setTimeout(function () { tag.func(null, tag.arg); }, 300); }
4802
+ }
4803
+ }
4804
+
4805
+ function p10showSendMqttMsgDialog(nodeids) {
4806
+ if (xxdialogMode) return false;
4807
+ var x = addHtmlValue("Topic", '<input id=dp2topic style=width:230px maxlength=64 onchange=p10validateSendMqttMsgDialog() onkeyup=p10validateSendMqttMsgDialog(event,1) />');
4808
+ x += addHtmlValue("Message", '<div style=width:230px;margin:0;padding:0><textarea id=dp2msg maxlength=4096 style=width:100%;height:150px;resize:none onchange=p10validateSendMqttMsgDialog() onkeyup=p10validateSendMqttMsgDialog(event,1)></textarea></div>');
4809
+ setDialogMode(2, "Send MQTT message", 3, p10showSendMqttMsgDialogEx, x, nodeids);
4810
+ p10validateSendMqttMsgDialog();
4811
+ Q('dp2topic').focus();
4812
+ return false;
4813
+ }
4814
+
4815
+ function p10validateSendMqttMsgDialog() {
4816
+ QE('idx_dlgOkButton', (Q('dp2topic').value.length > 0) && (Q('dp2msg').value.length > 0));
4817
+ }
4818
+
4819
+ function p10showSendMqttMsgDialogEx(b, nodeids) {
4820
+ meshserver.send({ action: 'sendmqttmsg', nodeids: nodeids, topic: Q('dp2topic').value, msg: Q('dp2msg').value });
4821
+ }
4822
+
4823
+ function p10showSendUninstallAgentDialog(nodeids) {
4824
+ if (xxdialogMode) return false;
4825
+ var x = '';
4826
+ if (nodeids.length > 1) { x = format("Are you sure you want to uninstall the selected {0} agents?", nodeids.length); } else { x = "Are you sure you want to uninstall selected agent?"; }
4827
+ x += '<br /><br />';
4828
+ if (nodeids.length > 1) { x += "This will not remove the devices from the server, but the devices will not longer be able to connect to the server. All remote access to the devices will be lost. The devices must be connected for this command to work."; } else { x += "This will not remove this device from the server, but the device will not longer be able to connect to the server. All remote access to the device will be lost. The device must be connect for this command to work."; }
4829
+ x += '<br /><br /><label style=color:red><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />' + "Confirm" + '</label>';
4830
+ setDialogMode(2, "Uninstall agent", 3, p10showSendUninstallAgentDialogEx, x, nodeids);
4831
+ p10validateSendUninstallAgentDialog();
4832
+ return false;
4833
+ }
4834
+
4835
+ function p10validateSendUninstallAgentDialog() { QE('idx_dlgOkButton', Q('p10check').checked); }
4836
+ function p10showSendUninstallAgentDialogEx(b, nodeids) { meshserver.send({ action: 'uninstallagent', nodeids: nodeids }); }
4837
+
4838
+ function p10showChangeGroupDialog(nodeids) {
4839
+ if (xxdialogMode) return false;
4840
+ var targetMeshId = null;
4841
+ if (nodeids.length == 1) { try { targetMeshId = meshes[getNodeFromId(nodeids[0])]._id; } catch (ex) { } }
4842
+
4843
+ // List all available alternative groups
4844
+ var y = '<select id=p10newGroup style=width:236px>', count = 0;
4845
+ for (var i in meshes) {
4846
+ var meshrights = meshes[i].links[userinfo._id].rights;
4847
+ if ((meshes[i]._id != targetMeshId) && (meshrights & 4)) { count++; y += '<option value=\'' + meshes[i]._id + '\'>' + meshes[i].name + '</option>'; }
4848
+ }
4849
+ y += '</select>';
4850
+
4851
+ if (count > 0) {
4852
+ var x = (nodeids.length == 1) ? ("Vyber novou skupinu pro toto zařízení" + '<br /><br />') : ("Select a new group for selected devices" + '<br /><br />');
4853
+ x += addHtmlValue("Nová skupina zařízení", y);
4854
+ setDialogMode(2, "Změnit skupinu", 3, p10showChangeGroupDialogEx, x, nodeids);
4855
+ } else {
4856
+ setDialogMode(2, "Změnit skupinu", 1, null, "No other device group of same type exists.");
4857
+ }
4858
+ return false;
4859
+ }
4860
+
4861
+ function p10showChangeGroupDialogEx(b, nodeids) {
4862
+ meshserver.send({ action: 'changeDeviceMesh', nodeids: nodeids, meshid: Q('p10newGroup').value });
4863
+ }
4864
+
4865
+ function p10showDeleteNodeDialog(nodeid) {
4866
+ if (xxdialogMode) return false;
4867
+ var x = format("Are you sure you want to delete node {0}?", EscapeHtml(currentNode.name)) + '<br /><br /><label><input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />' + "Confirm" + '</label>';
4868
+ setDialogMode(2, "Delete Node", 3, p10showDeleteNodeDialogEx, x, nodeid);
4869
+ p10validateDeleteNodeDialog();
4870
+ return false;
4871
+ }
4872
+
4873
+ function p10validateDeleteNodeDialog() {
4874
+ QE('idx_dlgOkButton', Q('p10check').checked);
4875
+ }
4876
+
4877
+ function p10showDeleteNodeDialogEx(buttons, nodeid) {
4878
+ meshserver.send({ action: 'removedevices', nodeids: [ nodeid ] });
4879
+ }
4880
+
4881
+ function p10clickOnce(nodeid, protocol, port) {
4882
+ meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'clickonce', protocol: protocol });
4883
+ return false;
4884
+ }
4885
+
4886
+ // Show current location
4887
+ var d2map = null;
4888
+ function p10showNodeLocationDialog() {
4889
+ if ((xxdialogMode != null) && (xxdialogTag == '@xxmap')) { setDialogMode(0); } else { if (xxdialogMode) return false; }
4890
+ var markers = [], types = ['iploc', 'wifiloc', 'gpsloc', 'userloc'], boundingBox = null;
4891
+
4892
+ for (var loctype in types) {
4893
+ if (currentNode[types[loctype]] != null) {
4894
+ var loc = currentNode[types[loctype]].split(','), lat = parseFloat(loc[0]), lon = parseFloat(loc[1]);
4895
+ if ((lat < 90) && (lat > -90) && (lon < 180) && (lon > -180)) { // Check valid lat/lon
4896
+ var deviceMark = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.fromLonLat([lon, lat])) });
4897
+ deviceMark.setStyle(markerStyle(currentNode, parseInt(loctype) + 1));
4898
+ markers.push(deviceMark);
4899
+
4900
+ 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; } }
4901
+ }
4902
+ }
4903
+ }
4904
+
4905
+ // Setup the device mark layer
4906
+ var vectorSource = new ol.source.Vector({ features: markers });
4907
+ var vectorLayer = new ol.layer.Vector({ source: vectorSource });
4908
+
4909
+ //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>';
4910
+ var x = '<div id=d2map style=width:100%;height:300px></div>';
4911
+ setDialogMode(2, "Device Location", 1, null, x, '@xxmap');
4912
+
4913
+ var clng = 0, clat = 0, zoom = 8;
4914
+ if (boundingBox != null) {
4915
+ var clat = (boundingBox[0] + boundingBox[2]) / 2;
4916
+ var clng = (boundingBox[1] + boundingBox[3]) / 2;
4917
+ var cscale = Math.max(Math.abs(boundingBox[0] - boundingBox[2]), Math.abs(boundingBox[1] - boundingBox[3]));
4918
+ var i = 360, zoom = -2;
4919
+ while (i > cscale) { zoom++; i = i / 2; }
4920
+ }
4921
+
4922
+ if (markers.length == 1) { zoom = 8; }
4923
+
4924
+ // Setup the map
4925
+ d2map = new ol.Map({
4926
+ target: 'd2map',
4927
+ interactions: ol.interaction.defaults({dragPan:false, mouseWheelZoom:false}),
4928
+ layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }), vectorLayer ],
4929
+ view: new ol.View({ center: ol.proj.fromLonLat([clng, clat]), zoom: zoom })
4930
+ });
4931
+ return false;
4932
+ }
4933
+
4934
+ // Show network interfaces
4935
+ function p10showNodeNetInfoDialog() {
4936
+ if (xxdialogMode) return false;
4937
+ setDialogMode(2, "Network Interfaces", 1, null, '<div id=d2netinfo>' + "Loading..." + '</div>', 'if' + currentNode._id );
4938
+ meshserver.send({ action: 'getnetworkinfo', nodeid: currentNode._id });
4939
+ return false;
4940
+ }
4941
+
4942
+ // Show MeshCentral Router dialog
4943
+ function p10showMeshRouterDialog() {
4944
+ if (xxdialogMode) return;
4945
+ var x = '<div>' + "MeshCentral Router is a Windows tool for TCP port mapping. You can, for example, RDP into a remote device thru this server." + '</div><br />';
4946
+ x += addHtmlValue('Win32 Executable', '<a style=cursor:pointer download href="meshagents?meshaction=winrouter" onclick="setDialogMode(0)">MeshCentralRouter.exe</a>');
4947
+ setDialogMode(2, "MeshCentral Router", 1, null, x, 'fileDownload');
4948
+ }
4949
+
4950
+ // Request MQTT login credentials
4951
+ function p10showMqttLoginDialog(nodeid) { meshserver.send({ action: 'getmqttlogin', nodeid: nodeid }); }
4952
+
4953
+ // Show MeshCmd dialog
4954
+ function p10showMeshCmdDialog(mode, nodeid) {
4955
+ if (xxdialogMode) return;
4956
+ var y = '<select id=aginsSelect onclick=meshCmdOsClick() style=width:236px>';
4957
+ y += '<option value=3>' + "Windows (32bit)" + '</option>';
4958
+ y += '<option value=4>' + "Windows (64bit)" + '</option>';
4959
+ y += '<option value=5>' + "Linux x86 (32bit)" + '</option>';
4960
+ y += '<option value=6>' + "Linux x86 (64bit)" + '</option>';
4961
+ y += '<option value=16>' + "MacOS (64bit)" + '</option>';
4962
+ y += '<option value=25>' + "Linux ARM, Raspberry Pi (32bit)" + '</option>';
4963
+ y += '</select>';
4964
+
4965
+ var x = '';
4966
+ 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 />'; }
4967
+ 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 />'; }
4968
+ x += addHtmlValue('Operating System', y);
4969
+ x += addHtmlValue('MeshCmd', '<a id=meshcmddownloadid href="meshagents?meshcmd=3" download></a>');
4970
+ if (mode == 0) { x += addHtmlValue('Action File', '<a href="meshagents?meshaction=generic" download>MeshAction (.txt)</a>'); }
4971
+ if (mode == 1) { x += addHtmlValue('Action File', '<a href="meshagents?meshaction=route&nodeid=' + nodeid + '" download>MeshAction (.txt)</a>'); }
4972
+ x += '</div>';
4973
+ setDialogMode(2, [ "Download MeshCmd", "Network Router" ][mode], 9, null, x, 'fileDownload');
4974
+ meshCmdOsClick();
4975
+ }
4976
+
4977
+ function meshCmdOsClick() {
4978
+ var os = Q('aginsSelect').value, osn = '', osurl = '';
4979
+ //Q('meshcmddownloadid').href = 'meshagents?meshcmd=' + os;
4980
+ if (os == 3) { osn = 'MeshCmd (Win32 executable)'; }
4981
+ if (os == 4) { osn = 'MeshCmd (Win64 executable)'; }
4982
+ if (os == 5) { osn = 'MeshCmd (Linux x86, 32bit)'; }
4983
+ if (os == 6) { osn = 'MeshCmd (Linux x86, 64bit)'; }
4984
+ if (os == 16) { osn = 'MeshCmd (MacOS, 64bit)'; }
4985
+ if (os == 25) { osn = 'MeshCmd (Linux ARM, 32bit)'; }
4986
+ QH('meshcmddownloadid', osn);
4987
+ Q('meshcmddownloadid').setAttribute('href', 'meshagents?meshcmd=' + os);
4988
+ }
4989
+
4990
+ function p10showiconselector() {
4991
+ if (xxdialogMode) return;
4992
+ var mesh = meshes[currentNode.meshid];
4993
+ var meshrights = mesh.links[userinfo._id].rights;
4994
+ if ((meshrights & 4) == 0) return;
4995
+
4996
+ var x = '<br><div style=display:inline-block;width:40px></div>';
4997
+ x += '<div tabindex=0 style=display:inline-block class=i1 onclick=p10setIcon(1) onkeypress="if (event.key==\'Enter\') p10setIcon(1)"></div>';
4998
+ x += '<div tabindex=0 style=display:inline-block class=i2 onclick=p10setIcon(2) onkeypress="if (event.key==\'Enter\') p10setIcon(2)"></div>';
4999
+ x += '<div tabindex=0 style=display:inline-block class=i3 onclick=p10setIcon(3) onkeypress="if (event.key==\'Enter\') p10setIcon(3)"></div>';
This file is too large to show in full.
views/translations/download-min_cs.handlebars
new
+1
@@ -0,0 +1 @@
1
+<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><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,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=/styles/style.css media=screen rel=stylesheet title=CSS><title>MeshCentral - Download</title><div id=container style=max-height:100vh><div id=mastheadx></div><div id=masthead style="background:url(logo.png) 0 0;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><div id=page_content style=max-height:calc(100vh-138px)><div id=column_l><h1>Stažení</h1><p style=margin-left:20px>{{{message}}}</p><br></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right>{{{rootCertLink}}} <a href=terms>Terms & Privacy</a></table></div></div></div>
\ No newline at end of file
views/translations/download_cs.handlebars
new
+41
@@ -0,0 +1,41 @@
1
+<!DOCTYPE html><html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head>
2
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3
+ <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
4
+ <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
5
+ <meta name="apple-mobile-web-app-capable" content="yes">
6
+ <meta name="format-detection" content="telephone=no">
7
+ <link type="text/css" href="/styles/style.css" media="screen" rel="stylesheet" title="CSS">
8
+ <title>MeshCentral - Download</title>
9
+</head>
10
+<body>
11
+ <div id="container" style="max-height:100vh">
12
+ <div id="mastheadx"></div>
13
+ <div id="masthead" style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden">
14
+ <div style="float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px">
15
+ <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong>
16
+ </div>
17
+ <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px">
18
+ <strong><font style="font-size:14px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong>
19
+ </div>
20
+ </div>
21
+ <div id="page_content" style="max-height:calc(100vh-138px)">
22
+ <div id="column_l">
23
+ <h1>Stažení</h1>
24
+ <p style="margin-left:20px">{{{message}}}</p>
25
+ <br>
26
+ </div>
27
+ <div id="footer">
28
+ <table cellpadding="0" cellspacing="10" style="width:100%">
29
+ <tbody><tr>
30
+ <td style="text-align:left"></td>
31
+ <td style="text-align:right">
32
+ {{{rootCertLink}}}
33
+ <a href="terms">Terms & Privacy</a>
34
+ </td>
35
+ </tr>
36
+ </tbody></table>
37
+ </div>
38
+ </div>
39
+ </div>
40
+
41
+</body></html>
\ No newline at end of file
views/translations/error404-min_cs.handlebars
new
+1
@@ -0,0 +1 @@
1
+<!doctypehtml><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,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><title>MeshCentral - Terms of use</title><body id=body onload='"undefined"!=typeof startup&&startup()'style=display:none;overflow:hidden><div id=container><div id=masthead class=noselect style="background:url(logo.png) 0 0;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><p id=logoutControl style="color:#fff;font-size:11px;margin:10px 10px 0">{{{logoutControl}}}</div><div id=page_leftbar><div style=height:16px></div></div><div id=topbar class="noselect style3"style=height:24px;position:relative><div id=uiMenuButton title="User interface selection"onclick=showUserInterfaceSelectMenu()>♦<div id=uiMenu style=display:none><div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class=uiSelector1></div></div><div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class=uiSelector2></div></div><div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class=uiSelector3></div></div><div id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode"><div class=uiSelector4></div></div></div></div></div><div id=column_l style="max-height:calc(100vh - 135px);overflow-y:auto"><div style=text-align:center;padding-top:30px;font-size:200px;font-family:Arial;color:#bbb><b>404</b></div><div style=text-align:center;font-size:20px;font-family:Arial;color:#999>Tato stránka neexistuje</div><div style=text-align:center;padding-top:20px;font-size:20px;font-family:Arial;color:#999><a href=/ style=text-decoration:none><b>Go to main site</b></a></div></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right><a href=/ >Zpět</a></table></div></div><script>"use strict";var uiMode=parseInt(getstore("uiMode",1)),webPageStackMenu=!1,webPageFullScreen=!0,nightMode="1"==getstore("_nightMode","0"),terms="{{{terms}}}";function showUserInterfaceSelectMenu(){Q("uiViewButton1").classList.remove("uiSelectorSel"),Q("uiViewButton2").classList.remove("uiSelectorSel"),Q("uiViewButton3").classList.remove("uiSelectorSel"),Q("uiViewButton4").classList.remove("uiSelectorSel");try{Q("uiViewButton"+uiMode).classList.add("uiSelectorSel")}catch(e){}QV("uiMenu","none"==QS("uiMenu").display),nightMode&&Q("uiViewButton4").classList.add("uiSelectorSel")}function userInterfaceSelectMenu(e){e&&putstore("uiMode",uiMode=e),webPageFullScreen=uiMode<3,webPageStackMenu=!0,toggleFullScreen(0),toggleStackMenu(0),QC("column_l").add("room4submenu")}function toggleNightMode(){(nightMode=!nightMode)?QC("body").add("night"):QC("body").remove("night"),putstore("_nightMode",nightMode?"1":"0")}function toggleFullScreen(e){1===e&&putstore("webPageFullScreen",webPageFullScreen=!webPageFullScreen);0==webPageFullScreen?(QC("body").remove("menu_stack"),QC("body").remove("fullscreen"),QC("body").remove("arg_hide")):QC("body").add("fullscreen"),QV("body",!0)}function toggleStackMenu(e){1==webPageFullScreen&&(1===e&&putstore("webPageStackMenu",webPageStackMenu=!webPageStackMenu),0==webPageStackMenu?QC("body").remove("menu_stack"):QC("body").add("menu_stack"))}function putstore(e,t){try{if("undefined"==typeof localStorage)return;localStorage.setItem(e,t)}catch(e){}}function getstore(e,t){try{if("undefined"==typeof localStorage)return t;var o=localStorage.getItem(e);return null==o||null==o?t:o}catch(e){return t}}""!=terms&&QH("column_l",decodeURIComponent(terms)),QV("column_l",!0),userInterfaceSelectMenu()</script>
\ No newline at end of file
views/translations/error404-mobile-min_cs.handlebars
new
+1
@@ -0,0 +1 @@
1
+<!doctypehtml><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,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><title>MeshCentral - Terms of use</title><style type=text/css>a{color:#036;text-decoration:underline}#footer a{color:#fff;text-decoration:underline}#footer a:hover{color:#fff;text-decoration:none}</style><body onload='"undefined"!=typeof startup&&startup()'style="overflow-y:hidden;max-width:100%;margin:0;padding:0;border:0;color:#000;font-size:13px;font-family:\'Trebuchet MS\',Arial,Helvetica,sans-serif"><div id=container><div id=masthead style="background:url(logo.png) 0 0;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"><div style=float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:4px><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:7px><strong><font style=font-size:12px;font-family:Arial,Helvetica,sans-serif>{{{title2}}}</font></strong></div><p>{{{logoutControl}}}</div><div id=page_content style=overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%><div id=column_l style=padding-left:10px;padding-right:10px><div style=text-align:center;padding-top:30px;font-size:100px;font-family:Arial;color:#bbb><b>404</b></div><div style=text-align:center;font-size:16px;font-family:Arial;color:#999>Tato stránka neexistuje</div><div style=text-align:center;padding-top:16px;font-size:20px;font-family:Arial;color:#999><a href=/ style=text-decoration:none><b>Go to main site</b></a></div></div></div><div id=footer style=height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0><table cellpadding=0 cellspacing=6 style=width:100%><tr><td style=text-align:left;color:#fff>{{{footer}}}<td style=text-align:right>{{{rootCertLink}}} <a href=/ >Zpět</a></table></div></div>
\ No newline at end of file
views/translations/error404-mobile_cs.handlebars
new
+55
@@ -0,0 +1,55 @@
1
+<!DOCTYPE html><html><head>
2
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
4
+ <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
5
+ <meta name="apple-mobile-web-app-capable" content="yes">
6
+ <meta name="format-detection" content="telephone=no">
7
+ <title>MeshCentral - Terms of use</title>
8
+ <style type="text/css">
9
+ a {
10
+ color: #036;
11
+ text-decoration: underline;
12
+ }
13
+
14
+ #footer a {
15
+ color: #fff;
16
+ text-decoration: underline;
17
+ }
18
+
19
+ #footer a:hover {
20
+ color: #fff;
21
+ text-decoration: none;
22
+ }
23
+ </style>
24
+</head>
25
+<body onload="if (typeof(startup) !== 'undefined') startup();" style="overflow-y:hidden;max-width:100%;margin:0;padding:0;border:0;color:black;font-size:13px;font-family:\'Trebuchet MS\', Arial, Helvetica, sans-serif">
26
+ <div id="container">
27
+ <!-- Begin Masthead -->
28
+ <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">
29
+ <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:4px">
30
+ <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong>
31
+ </div>
32
+ <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:7px">
33
+ <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong>
34
+ </div>
35
+ <p>{{{logoutControl}}}</p>
36
+ </div>
37
+ <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%">
38
+ <div id="column_l" style="padding-left:10px;padding-right:10px">
39
+ <div style="text-align:center;padding-top:30px;font-size:100px;font-family:Arial;color:#bbb"><b>404</b></div>
40
+ <div style="text-align:center;font-size:16px;font-family:Arial;color:#999">Tato stránka neexistuje</div>
41
+ <div style="text-align:center;padding-top:16px;font-size:20px;font-family:Arial;color:#999"><a href="/" style="text-decoration:none"><b>Go to main site</b></a></div>
42
+ </div>
43
+ </div>
44
+ <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px">
45
+ <table cellpadding="0" cellspacing="6" style="width:100%">
46
+ <tbody><tr>
47
+ <td style="text-align:left;color:white">{{{footer}}}</td>
48
+ <td style="text-align:right">{{{rootCertLink}}} <a href="/">Zpět</a></td>
49
+ </tr>
50
+ </tbody></table>
51
+ </div>
52
+ </div>
53
+
54
+
55
+</body></html>
\ No newline at end of file
views/translations/error404_cs.handlebars
new
+132
@@ -0,0 +1,132 @@
1
+<!DOCTYPE html><html><head>
2
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
4
+ <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
5
+ <meta name="apple-mobile-web-app-capable" content="yes">
6
+ <meta name="format-detection" content="telephone=no">
7
+ <link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS">
8
+ <script type="text/javascript" src="scripts/common-0.0.1.js"></script>
9
+ <title>MeshCentral - Terms of use</title>
10
+</head>
11
+<body id="body" onload="if (typeof(startup) !== 'undefined') startup();" style="display:none;overflow:hidden">
12
+ <div id="container">
13
+ <!-- Begin Masthead -->
14
+ <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;">
15
+ <div style="float:left; height: 66px; color:#c8c8c8; padding-left:20px; padding-top:8px">
16
+ <strong><font style="font-size:46px; font-family: Arial, Helvetica, sans-serif;">{{{title}}}</font></strong>
17
+ </div>
18
+ <div style="float:left; height: 66px; color:#c8c8c8; padding-left:5px; padding-top:14px">
19
+ <strong><font style="font-size:14px; font-family: Arial, Helvetica, sans-serif;">{{{title2}}}</font></strong>
20
+ </div>
21
+ <p id="logoutControl" style="color:white;font-size:11px;margin: 10px 10px 0;">{{{logoutControl}}}</p>
22
+ </div>
23
+ <div id="page_leftbar">
24
+ <div style="height:16px"></div>
25
+ </div>
26
+ <div id="topbar" class="noselect style3" style="height:24px;position:relative">
27
+ <div id="uiMenuButton" title="User interface selection" onclick="showUserInterfaceSelectMenu()">
28
+ ♦
29
+ <div id="uiMenu" style="display:none">
30
+ <div id="uiViewButton1" class="uiSelector" onclick="userInterfaceSelectMenu(1)" title="Left bar interface"><div class="uiSelector1"></div></div>
31
+ <div id="uiViewButton2" class="uiSelector" onclick="userInterfaceSelectMenu(2)" title="Top bar interface"><div class="uiSelector2"></div></div>
32
+ <div id="uiViewButton3" class="uiSelector" onclick="userInterfaceSelectMenu(3)" title="Fixed width interface"><div class="uiSelector3"></div></div>
33
+ <div id="uiViewButton4" class="uiSelector" onclick="toggleNightMode()" title="Toggle night mode"><div class="uiSelector4"></div></div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ <div id="column_l" style="max-height:calc(100vh - 135px);overflow-y:auto">
38
+ <div style="text-align:center;padding-top:30px;font-size:200px;font-family:Arial;color:#bbb"><b>404</b></div>
39
+ <div style="text-align:center;font-size:20px;font-family:Arial;color:#999">Tato stránka neexistuje</div>
40
+ <div style="text-align:center;padding-top:20px;font-size:20px;font-family:Arial;color:#999"><a href="/" style="text-decoration:none"><b>Go to main site</b></a></div>
41
+ </div>
42
+ <div id="footer">
43
+ <table cellpadding="0" cellspacing="10" style="width: 100%">
44
+ <tbody><tr>
45
+ <td style="text-align:left"></td>
46
+ <td style="text-align:right"><a href="/">Zpět</a></td>
47
+ </tr>
48
+ </tbody></table>
49
+ </div>
50
+ </div>
51
+ <script>
52
+ 'use strict';
53
+ var uiMode = parseInt(getstore('uiMode', 1));
54
+ var webPageStackMenu = false;
55
+ var webPageFullScreen = true;
56
+ var nightMode = (getstore('_nightMode', '0') == '1');
57
+
58
+ var terms = '{{{terms}}}';
59
+ if (terms != '') { QH('column_l', decodeURIComponent(terms)); }
60
+ QV('column_l', true);
61
+ userInterfaceSelectMenu();
62
+
63
+ // Toggle user interface menu
64
+ function showUserInterfaceSelectMenu() {
65
+ Q('uiViewButton1').classList.remove('uiSelectorSel');
66
+ Q('uiViewButton2').classList.remove('uiSelectorSel');
67
+ Q('uiViewButton3').classList.remove('uiSelectorSel');
68
+ Q('uiViewButton4').classList.remove('uiSelectorSel');
69
+ try { Q('uiViewButton' + uiMode).classList.add('uiSelectorSel'); } catch (ex) { }
70
+ QV('uiMenu', (QS('uiMenu').display == 'none'));
71
+ if (nightMode) { Q('uiViewButton4').classList.add('uiSelectorSel'); }
72
+ }
73
+
74
+ function userInterfaceSelectMenu(s) {
75
+ if (s) { uiMode = s; putstore('uiMode', uiMode); }
76
+ webPageFullScreen = (uiMode < 3);
77
+ webPageStackMenu = true;//(uiMode > 1);
78
+ toggleFullScreen(0);
79
+ toggleStackMenu(0);
80
+ QC('column_l').add('room4submenu');
81
+ }
82
+
83
+ function toggleNightMode() {
84
+ nightMode = !nightMode;
85
+ if (nightMode) { QC('body').add('night'); } else { QC('body').remove('night'); }
86
+ putstore('_nightMode', nightMode ? '1' : '0');
87
+ }
88
+
89
+ // Toggle the web page to full screen
90
+ function toggleFullScreen(toggle) {
91
+ if (toggle === 1) { webPageFullScreen = !webPageFullScreen; putstore('webPageFullScreen', webPageFullScreen); }
92
+ var hide = 0;
93
+ //if (args.hide) { hide = parseInt(args.hide); }
94
+ if (webPageFullScreen == false) {
95
+ QC('body').remove('menu_stack');
96
+ QC('body').remove('fullscreen');
97
+ QC('body').remove('arg_hide');
98
+ //if (xxcurrentView >= 10) QC('column_l').add('room4submenu');
99
+ //QV('UserDummyMenuSpan', false);
100
+ //QV('page_leftbar', false);
101
+ } else {
102
+ QC('body').add('fullscreen');
103
+ if (hide & 16) QC('body').add('arg_hide'); // This is replacement for QV('page_leftbar', !(hide & 16));
104
+ //QV('UserDummyMenuSpan', (xxcurrentView < 10) && webPageFullScreen);
105
+ //QV('page_leftbar', true);
106
+ }
107
+ QV('body', true);
108
+ }
109
+
110
+ // If FullScreen, toggle menu to be horisontal or vertical
111
+ function toggleStackMenu(toggle) {
112
+ if (webPageFullScreen == true) {
113
+ if (toggle === 1) {
114
+ webPageStackMenu = !webPageStackMenu;
115
+ putstore('webPageStackMenu', webPageStackMenu);
116
+ }
117
+ if (webPageStackMenu == false) {
118
+ QC('body').remove('menu_stack');
119
+ } else {
120
+ QC('body').add('menu_stack');
121
+ //if (xxcurrentView >= 10) QC('column_l').remove('room4submenu');
122
+ }
123
+ }
124
+ }
125
+
126
+ function putstore(name, val) { try { if (typeof (localStorage) === 'undefined') return; localStorage.setItem(name, val); } catch (e) { } }
127
+ function getstore(name, val) { try { if (typeof (localStorage) === 'undefined') return val; var v = localStorage.getItem(name); if ((v == null) || (v == null)) return val; return v; } catch (e) { return val; } }
128
+
129
+ </script>
130
+
131
+
132
+</body></html>
\ No newline at end of file
views/translations/login-min_cs.handlebars
new
+1
@@ -0,0 +1 @@
1
+<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><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,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link rel="shortcut icon"type=image/x-icon href={{{domainurl}}}favicon.ico><link keeplink=1 type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script keeplink=1 src=scripts/u2f-api.js></script><title>{{{title}}} - Login</title><body id=body onload='"undefined"!=typeof startup&&startup()'class="arg_hide login"><div id=container><div id=masthead><div class=title>{{{title}}}</div><div class=title2>{{{title2}}}</div></div><div id=topbar class="noselect style3"style=height:24px><div id=uiMenuButton title="User interface selection"onclick=showUserInterfaceSelectMenu()>♦<div id=uiMenu style=display:none><div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class=uiSelector1></div></div><div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class=uiSelector2></div></div><div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class=uiSelector3></div></div><div id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode"><div class=uiSelector4></div></div></div></div></div><div id=column_l><h1>Vítejte</h1><div id=welcomeText style=display:none>Přihlašte se na různá svá nebo firemní zařízení odkudkoliv z celého světa <a href=http://www.meshcommander.com/meshcentral2>MeshCentral</a>. Jednoduchá správa přes web. Jediné co potřebujete je agent na daném zařízení. Po instalaci uvidíte zařízení v sekci "Moje zařízení" a můžete toto zařízení ovládat.</div><table id=centralTable><tr><td id=welcomeimage><picture><img alt=""src=welcome.jpg style=border-radius:20px></picture><td id=logincell><div id=loginpanel style=display:none><form method=post><input type=hidden name=action value=login><div id=message1></div><div><b>Přihlásit</b></div><table><tr><td id=loginusername align=right width=100>Uživatel:<td><input id=username maxlength=64 name=username onchange=validateLogin(1) onkeyup=validateLogin(1,event)><tr><td align=right>Heslo:<td><input id=password type=password maxlength=256 name=password autocomplete=off onchange=validateLogin(2) onkeyup=validateLogin(2,event)><tr><td><div id=showPassHintLink style=display:none><a onclick="return showPassHint(event)"href=# style=cursor:pointer>Show Hint</a></div><td align=right><input id=loginButton type=submit value=Přihlásit disabled></table><div id=hrAccountDiv style=display:none><hr></div><div id=resetAccountDiv style=display:none;padding:2px><span id=resetAccountSpan>Forgot username/password?</span> <a onclick="return xgo(3,event)"href=# style=cursor:pointer>Reset účtu</a>.</div><div id=newAccountDiv style=display:none;padding:2px>Nemáte účet? <a onclick="return xgo(2,event)"href=# style=cursor:pointer>Vytvořit</a>.</div><input id=loginformargs name=urlargs type=hidden></form></div><div id=createpanel style=display:none;position:relative><form method=post><input type=hidden name=action value=createaccount><div id=message2></div><div><b>Account Creation</b></div><div id=passwordPolicyCallout style=display:none></div><table><tr id=nuUserRow><td id=nuUser align=right width=100>Uživatel:<td><input id=ausername name=username onchange=validateCreate(1) maxlength=64 onkeydown=haltReturn(event) onkeyup=validateCreate(1,event)><tr><td id=nuEmail align=right width=100>Email:<td><input id=aemail name=email onchange=validateCreate(2) maxlength=256 onkeydown=haltReturn(event) onkeyup=validateCreate(2,event)><tr><td id=nuPass1 align=right>Heslo:<td><input id=apassword1 type=password name=password1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(3,event) onkeyup=validateCreate(3,event)><tr><td id=nuPass2 align=right>Heslo:<td><input id=apassword2 type=password name=password2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(4,event) onkeyup=validateCreate(4,event)><tr id=createPanelHint style=display:none><td id=nuHint align=right>Password Hint:<td><input id=apasswordhint name=apasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(5,event) onkeyup=validateCreate(5,event)><tr id=newAccountPass title="Enter the account creation token"><td id=nuToken align=right>Creation Token:<td><input id=anewaccountpass type=password name=anewaccountpass autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(6,event) onkeyup=validateCreate(6,event)><tr><td colspan=2><div style=float:right><input id=createButton type=submit value="Create Account"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a> <input id=createformargs name=urlargs type=hidden></form></div><div id=resetpanel style=display:none><form method=post><input type=hidden name=action value=resetaccount><div id=message3></div><div><b>Reset hesla</b></div><table><tr><td align=right width=100>Email:<td><input id=remail name=email maxlength=256 onchange=validateReset() onkeyup=validateReset(event)><tr><td colspan=2><div style=float:right><input id=eresetButton type=submit value="Reset účtu"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a> <input id=resetformargs name=urlargs type=hidden></form></div><div id=tokenpanel style=display:none><form method=post autocomplete=off><input type=hidden name=action value=tokenlogin> <input type=hidden name=hwstate value={{{hwstate}}}><div id=message4></div><table><tr><td align=right width=100>Login token:<td><input id=tokenInput name=token maxlength=50 onchange=checkToken(event) onpaste=resetCheckToken(event) onkeyup=checkToken(event) onkeydown=checkToken(event)><br><input id=hwtokenInput name=hwtoken style=display:none><tr><td colspan=2 style=align-content:center><label><input id=tokenInputRemember name=remembertoken type=checkbox>Remember this device for 30 days.</label><tr><td colspan=2><div style=float:right><input id=tokenOkButton type=submit value=Login disabled></div><div style=float:right><input style=display:none;float:right id=securityKeyButton type=button value="Use Security Key"onclick=useSecurityKey()></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a> <input id=tokenformargs name=urlargs type=hidden></form></div><div id=resettokenpanel style=display:none><form method=post><input type=hidden name=action value=resetaccount><div id=message5></div><table><tr><td align=right width=100>Login token:<td><input id=resetTokenInput name=token maxlength=50 onchange=resetCheckToken(event) onkeyup=resetCheckToken(event) onkeydown=resetCheckToken(event)> <input id=resetHwtokenInput name=hwtoken style=display:none><tr><td colspan=2><div style=float:right><input id=resetTokenOkButton type=submit value=Login disabled></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a> <input id=resettokenformargs name=urlargs type=hidden></form></div><div id=resetpasswordpanel style=display:none;position:relative><form method=post><input type=hidden name=action value=resetpassword><div id=message6></div><div id=rpasswordPolicyCallout style=display:none></div><table><tr><td id=rnuPass1 width=100 align=right>Heslo:<td><input id=rapassword1 type=password name=rpassword1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(3,event) onkeyup=validatePassReset(3,event)><tr><td id=rnuPass2 align=right>Heslo:<td><input id=rapassword2 type=password name=rpassword2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(4,event) onkeyup=validatePassReset(4,event)><tr id=resetpasswordpanelHint style=display:none><td id=rnuHint align=right>Password Hint:<td><input id=rapasswordhint name=rpasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(5,event) onkeyup=validatePassReset(5,event)><tr><td colspan=2><div style=float:right><input id=resetPassButton type=submit value="Reset hesla"disabled></div><div id=rpassWarning style=padding-top:6px></div></table><hr><a onclick="return xgo(1,event)"href=# style=cursor:pointer>Back to login</a> <input id=resetpasswordformargs name=urlargs type=hidden></form></div></table><br></div><div id=footer><div class=footer1>{{{footer}}}</div><div class=footer2>{{{rootCertLink}}} <a href=terms>Terms & Privacy</a></div></div></div><div id=dialog style=display:none><div id=dialogHeader><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 id=dialogBody><div id=dialog1><div id=id_dialogMessage></div></div><div id=dialog2><div id=id_dialogOptions></div></div></div><div id=idx_dlgButtonBar><input id=idx_dlgCancelButton type=button value=Zrušit onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK onclick=dialogclose(1)></div></div><script>"use strict";var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,passhint="{{{passhint}}}",loginMode="{{{loginmode}}}",newAccount="{{{newAccount}}}",newAccountPass=parseInt("{{{newAccountPass}}}"),emailCheck=!1,passRequirements="{{{passRequirements}}}",hardwareKeyChallenge=decodeURIComponent("{{{hkey}}}"),passRequirementsEx=null!=(passRequirements=""!=passRequirements?JSON.parse(decodeURIComponent(passRequirements)):{}).min||null!=passRequirements.max||null!=passRequirements.upper||null!=passRequirements.lower||null!=passRequirements.numeric||null!=passRequirements.nonalpha,features=parseInt("{{{features}}}"),welcomeText=decodeURIComponent("{{{welcometext}}}"),currentpanel=0,uiMode=parseInt(getstore("uiMode","1")),webPageFullScreen=!0,nightMode="1"==getstore("_nightMode","0"),publicKeyCredentialRequestOptions=null,messageid=parseInt("{{{messageid}}}"),okmessages=["","Hold on, reset mail sent."],failmessages=["Unable to create account.","Account limit reached.","Existing account with this email address.","Invalid account creation token.","Username already exists.","Password rejected, use a different one.","Invalid email.","Account not found.","Invalid token, try again.","Unable to sent email.","Account locked.","Access denied.","Login failed, check username and password.","Password change requested.","IP address blocked, try again later."];if(0<messageid){var msg="";if(messageid<100&&messageid<okmessages.length?msg=okmessages[messageid]:100<=messageid&&messageid-100<failmessages.length&&(msg=failmessages[messageid-100]),""!=msg){msg=100<=messageid?'<span class="msg error"><b style=color:#8C001A>'+msg+"<b></span><br /><br />":'<span class="msg success"><b>'+msg+"</b></span><br /><br />";for(var i=1;i<7;i++)QH("message"+i,msg)}}if(0<window.location.href.indexOf("?")){var urlargs=window.location.href.substring(window.location.href.indexOf("?"));Q("loginformargs").value=urlargs,Q("createformargs").value=urlargs,Q("resetformargs").value=urlargs,Q("tokenformargs").value=urlargs,Q("resettokenformargs").value=urlargs,Q("resetpasswordformargs").value=urlargs}function startup(){if(0==(32&features)){var e=null;try{e=top.location.toString().toLowerCase()}catch(e){}if(top!=self&&(null==e||0==top.active))return void(top.location=self.location)}if(2097152&features&&(QH("loginusername","Email:"),QH("resetAccountSpan","Zapomenuté heslo?"),QV("nuUserRow",!1)),nightMode&&QC("body").add("night"),QV("createPanelHint",!0===passRequirements.hint),QV("resetpasswordpanelHint",!0===passRequirements.hint),welcomeText&&QH("welcomeText",welcomeText),QV("welcomeText",!0),(window.onresize=center)(),validateLogin(),validateCreate(),0!=loginMode.length?go(parseInt(loginMode)):go(1),QV("newAccountDiv","1"===newAccount||"true"===newAccount),null!=passhint&&0<passhint.length&&QV("showPassHintLink",!0),QV("newAccountPass",1==newAccountPass),QV("resetAccountDiv",1==emailCheck),QV("hrAccountDiv",1==emailCheck||1==newAccountPass),"4"==loginMode){try{hardwareKeyChallenge=0<hardwareKeyChallenge.length?JSON.parse(hardwareKeyChallenge):null}catch(e){hardwareKeyChallenge=null}QV("securityKeyButton",null!=hardwareKeyChallenge&&"webAuthn"==hardwareKeyChallenge.type)}if("5"==loginMode){try{hardwareKeyChallenge=0<hardwareKeyChallenge.length?JSON.parse(hardwareKeyChallenge):null}catch(e){hardwareKeyChallenge=null}if(null!=hardwareKeyChallenge&&"webAuthn"==hardwareKeyChallenge.type){"string"==typeof hardwareKeyChallenge.challenge&&(hardwareKeyChallenge.challenge=Uint8Array.from(atob(hardwareKeyChallenge.challenge),function(e){return e.charCodeAt(0)}).buffer),publicKeyCredentialRequestOptions={challenge:hardwareKeyChallenge.challenge,allowCredentials:[],timeout:hardwareKeyChallenge.timeout};for(var a=0;a<hardwareKeyChallenge.keyIds.length;a++)publicKeyCredentialRequestOptions.allowCredentials.push({id:Uint8Array.from(atob(hardwareKeyChallenge.keyIds[a]),function(e){return e.charCodeAt(0)}),type:"public-key",transports:["usb","ble","nfc"]});navigator.credentials.get({publicKey:publicKeyCredentialRequestOptions}).then(function(e){var a={id:btoa(String.fromCharCode.apply(null,new Uint8Array(e.rawId))),clientDataJSON:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.clientDataJSON))),userHandle:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.userHandle))),signature:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.signature))),authenticatorData:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.authenticatorData)))};Q("resetHwtokenInput").value=JSON.stringify(a),QE("resetTokenOkButton",!0),Q("resetTokenOkButton").click()},function(e){console.log("credentials-get error",e)})}}userInterfaceSelectMenu()}function useSecurityKey(){if(null!=hardwareKeyChallenge&&"webAuthn"==hardwareKeyChallenge.type){"string"==typeof hardwareKeyChallenge.challenge&&(hardwareKeyChallenge.challenge=Uint8Array.from(atob(hardwareKeyChallenge.challenge),function(e){return e.charCodeAt(0)}).buffer),publicKeyCredentialRequestOptions={challenge:hardwareKeyChallenge.challenge,allowCredentials:[],timeout:hardwareKeyChallenge.timeout};for(var e=0;e<hardwareKeyChallenge.keyIds.length;e++)publicKeyCredentialRequestOptions.allowCredentials.push({id:Uint8Array.from(atob(hardwareKeyChallenge.keyIds[e]),function(e){return e.charCodeAt(0)}),type:"public-key",transports:["usb","ble","nfc"]});navigator.credentials.get({publicKey:publicKeyCredentialRequestOptions}).then(function(e){var a={id:btoa(String.fromCharCode.apply(null,new Uint8Array(e.rawId))),clientDataJSON:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.clientDataJSON))),userHandle:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.userHandle))),signature:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.signature))),authenticatorData:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.authenticatorData)))};Q("hwtokenInput").value=JSON.stringify(a),QE("tokenOkButton",!0),Q("tokenOkButton").click()},function(e){console.log("credentials-get error",e)})}}function showPassHint(e){return messagebox("Password Hint",passhint),haltEvent(e),!1}function xgo(e,a){return QV("message1",!1),QV("message2",!1),QV("message3",!1),QV("message4",!1),QV("message5",!1),QV("message6",!1),go(e),haltEvent(a),!1}function go(e){currentpanel=e,setDialogMode(0),QV("showPassHintLink",!1),QV("loginpanel",1==e),QV("createpanel",2==e),QV("resetpanel",3==e),QV("tokenpanel",4==e),QV("resettokenpanel",5==e),QV("resetpasswordpanel",6==e),1==e&&Q("username").focus(),2==e&&(2097152&features?Q("aemail").focus():Q("ausername").focus()),3==e&&Q("remail").focus(),4==e&&Q("tokenInput").focus(),5==e&&Q("resetTokenInput").focus(),6==e&&Q("rapassword1").focus()}function validateLogin(e,a){var n=0<Q("username").value.length&&-1==Q("username").value.indexOf(" ")&&0<Q("password").value.length;QE("loginButton",n),setDialogMode(0),null!=a&&13==a.keyCode&&(1==e&&""!=Q("username").value?Q("password").focus():2==e&&""!=Q("password").value&&Q("loginButton").click()),null!=a&&haltEvent(a)}function validateCreate(e,a){setDialogMode(0);var n=!1;n=!!(2097152&features)||0<Q("ausername").value.length&&-1==Q("ausername").value.indexOf(" ")&&-1==Q("ausername").value.indexOf('"')&&-1==Q("ausername").value.indexOf(",");var t=1==validateEmail(Q("aemail").value),r=0<Q("apassword1").value.length,s=0<Q("apassword2").value.length&&Q("apassword2").value==Q("apassword1").value,o=0==newAccountPass||0<Q("anewaccountpass").value.length,l=n&&t&&r&&s&&o;if(QS("nuUser").color=n?"black":"#7b241c",QS("nuEmail").color=t?"black":"#7b241c",QS("nuPass1").color=r?"black":"#7b241c",QS("nuPass2").color=s?"black":"#7b241c",QS("nuToken").color=o?"black":"#7b241c",""==Q("apassword1").value)QH("passWarning",""),QV("passwordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("apassword1").value,passRequirements)?(l=!1,QS("nuPass1").color="#7b241c",QS("nuPass2").color="#7b241c",QH("passWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>"),QV("passwordPolicyCallout",!0),QH("passwordPolicyCallout",passwordPolicyText(Q("apassword1").value))):(QH("passWarning",""),QV("passwordPolicyCallout",!1))}else{var i=checkPasswordStrength(Q("apassword1").value);80<=i?QH("passWarning","<span style=color:green><b>Silné heslo</b><span>"):60<=i?QH("passWarning","<span style=color:blue><b>Dobré heslo</b><span>"):QH("passWarning","<span style=color:red><b>Slabé heslo</b><span>")}null!=a&&13==a.keyCode&&(1==e&&n&&Q("aemail").focus(),2==e&&t&&Q("apassword1").focus(),3==e&&r&&Q("apassword2").focus(),4==e&&s&&(!0===passRequirements.hint?Q("apasswordhint").focus():e=5),5==e&&(1==newAccountPass?Q("anewaccountpass").focus():e=6),6==e&&Q("createButton").click()),null!=a&&haltEvent(a),QE("createButton",l)}function validatePassReset(e,a){setDialogMode(0);var n=0<Q("rapassword1").value.length,t=0<Q("rapassword2").value.length&&Q("rapassword2").value==Q("rapassword1").value,r=n&&t;if(QS("rnuPass1").color=n?"black":"#7b241c",QS("rnuPass2").color=t?"black":"#7b241c",""==Q("rapassword1").value)QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("rapassword1").value,passRequirements)?(r=!1,QS("rnuPass1").color="#7b241c",QS("rnuPass2").color="#7b241c",QH("rpassWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>"),QV("rpasswordPolicyCallout",!0),QH("rpasswordPolicyCallout",passwordPolicyText(Q("rapassword1").value))):(QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1))}else{var s=checkPasswordStrength(Q("rapassword1").value);80<=s?QH("rpassWarning","<span style=color:green><b>Silné heslo</b><span>"):60<=s?QH("rpassWarning","<span style=color:blue><b>Dobré heslo</b><span>"):QH("rpassWarning","<span style=color:red><b>Slabé heslo</b><span>")}null!=a&&13==a.keyCode&&(2==e&&Q("rapassword1").focus(),3==e&&Q("rapassword2").focus(),4==e&&Q("rapasswordhint").focus(),6==e&&Q("resetPassButton").click()),null!=a&&haltEvent(a),QE("resetPassButton",r)}function passwordPolicyText(e){var a="<div style=text-align:left>",n=strCount(e);return passRequirements.min&&(null==e||e.length<passRequirements.min)&&(a+=format("Minimum length of {0}",passRequirements.min)+"<br />"),passRequirements.max&&(null==e||e.length>passRequirements.max)&&(a+=format("Maximum length of {0}",passRequirements.max)+"<br />"),passRequirements.upper&&(null==e||n.upper<passRequirements.upper)&&(a+=format("{0} upper case",passRequirements.upper)+"<br />"),passRequirements.lower&&(null==e||n.lower<passRequirements.lower)&&(a+=format("{0} lower case",passRequirements.lower)+"<br />"),passRequirements.numeric&&(null==e||n.numeric<passRequirements.numeric)&&(a+=format("{0} numeric",passRequirements.numeric)+"<br />"),passRequirements.nonalpha&&(null==e||n.nonalpha<passRequirements.nonalpha)&&(a+=format("{0} non-alphanumeric",passRequirements.nonalpha)+"<br />"),a+="</div>"}function showPasswordPolicy(){messagebox("Password Policy",passwordPolicyText())}function validateReset(e){setDialogMode(0);var a=validateEmail(Q("remail").value);QE("eresetButton",a),null!=e&&13==e.keyCode&&1==a&&Q("eresetButton").click(),null!=e&&haltEvent(e)}function checkPasswordStrength(e){var a=0,n={},t=0,r={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e)return 0;for(var s=0;s<e.length;s++)n[e[s]]=(n[e[s]]||0)+1,a+=5/n[e[s]];for(var o in r)t+=1==r[o]?1:0;return parseInt(a+10*(t-1))}function checkPasswordRequirements(e,a){if(null==a||""==a||"object"!=typeof a)return!0;if(a.min&&e.length<a.min)return!1;if(a.max&&e.length>a.max)return!1;var n=strCount(e);return!(a.numeric&&n.numeric<a.numeric)&&(!(a.lower&&n.lower<a.lower)&&(!(a.upper&&n.upper<a.upper)&&!(a.nonalpha&&n.nonalpha<a.nonalpha)))}function strCount(e){var a={numeric:0,lower:0,upper:0,nonalpha:0};if("string"!=typeof e)return a;for(var n=0;n<e.length;n++)/\d/.test(e[n])&&a.numeric++,/[a-z]/.test(e[n])&&a.lower++,/[A-Z]/.test(e[n])&&a.upper++,/\W/.test(e[n])&&a.nonalpha++;return a}function checkToken(){var e=Q("tokenInput").value,a=e.split(" ").join("");e!=a&&(Q("tokenInput").value=a),QE("tokenOkButton",6==Q("tokenInput").value.length||8==Q("tokenInput").value.length||44==Q("tokenInput").value.length)}function resetCheckToken(){var e=Q("resetTokenInput").value,a=e.split(" ").join("");e!=a&&(Q("resetTokenInput").value=a),QE("resetTokenOkButton",6==Q("resetTokenInput").value.length||8==Q("resetTokenInput").value.length||44==Q("resetTokenInput").value.length)}var xxcurrentView=0;function setDialogMode(e,a,n,t,r,s){xxdialogMode=e,xxdialogFunc=t,xxdialogButtons=n,xxdialogTag=s,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&n),QV("idx_dlgCancelButton",2&n),QV("id_dialogclose",2&n||8&n),QV("idx_dlgButtonBar",7&n),a&&QH("id_dialogtitle",a);for(var o=1;o<24;o++)QV("dialog"+o,o==e);QV("dialog",e),r&&(2==e?QH("id_dialogOptions",r):QH("id_dialogMessage",r))}function dialogclose(e){var a=xxdialogFunc,n=xxdialogButtons,t=xxdialogTag;setDialogMode(),(8&n||e)&&a&&a(e,t)}function toggleFullScreen(e){0==webPageFullScreen?QC("body").remove("fullscreen"):QC("body").add("fullscreen"),QV("body",!0),center()}function showUserInterfaceSelectMenu(){Q("uiViewButton1").classList.remove("uiSelectorSel"),Q("uiViewButton2").classList.remove("uiSelectorSel"),Q("uiViewButton3").classList.remove("uiSelectorSel");try{Q("uiViewButton"+uiMode).classList.add("uiSelectorSel")}catch(e){}QV("uiMenu","none"==QS("uiMenu").display),nightMode&&Q("uiViewButton4").classList.add("uiSelectorSel")}function userInterfaceSelectMenu(e){e&&putstore("uiMode",uiMode=e),webPageFullScreen=uiMode<3,toggleFullScreen(0)}function toggleNightMode(){(nightMode=!nightMode)?QC("body").add("night"):QC("body").remove("night"),putstore("_nightMode",nightMode?"1":"0")}function center(){if(0==webPageFullScreen)QS("centralTable")["margin-top"]="";else{var e=Q("column_l").clientHeight/2-220;e<0&&(e=0),QS("centralTable")["margin-top"]=e+"px"}}function messagebox(e,a){QH("id_dialogMessage",a),setDialogMode(1,e,1)}function statusbox(e,a){QH("id_dialogMessage",a),setDialogMode(1,e)}function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function haltReturn(e){13==e.keyCode&&haltEvent(e)}function validateEmail(e){return/^(([^<>()\[\]\\.,;:\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,}))$/.test(e)}function putstore(e,a){try{if("undefined"==typeof localStorage)return;localStorage.setItem(e,a)}catch(e){}}function getstore(e,a){try{if("undefined"==typeof localStorage)return a;var n=localStorage.getItem(e);return null==n||null==n?a:n}catch(e){return a}}function format(e){var n=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,a){return void 0!==n[a]?n[a]:e})}</script>
\ No newline at end of file
views/translations/login-mobile-min_cs.handlebars
new
+1
@@ -0,0 +1 @@
1
+<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><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,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link rel="shortcut icon"type=image/x-icon href={{{domainurl}}}favicon.ico><script src=scripts/common-0.0.1.js></script><script src=scripts/u2f-api.js></script><title>MeshCentral - Login</title><style>a{color:#036;text-decoration:underline}#footer a{color:#fff;text-decoration:underline}#footer a:hover{color:#fff;text-decoration:none}</style><body onload='"undefined"!=typeof startup&&startup()'style="overflow-y:hidden;margin:0;padding:0;border:0;color:#000;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) 0 0;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;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><div id=page_content style=overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%;display:flex;align-items:center><div id=column_l style=padding:10px;width:100%><table style=width:100%><tr><td align=center><div id=loginpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;display:none><form method=post><input type=hidden name=action value=login><div id=message1></div><div><b>Přihlásit</b></div><table><tr><td id=loginusername align=right width=100>Uživatel:<td><input id=username maxlength=64 name=username onchange=validateLogin(1) onkeyup=validateLogin(1,event)><tr><td align=right>Heslo:<td><input id=password type=password maxlength=256 name=password autocomplete=off onchange=validateLogin(2) onkeyup=validateLogin(2,event)><tr><td><div id=showPassHintLink style=display:none><a onclick=showPassHint() style=cursor:pointer>Show Hint</a></div><td align=right><input id=loginButton type=submit value=Přihlásit disabled></table><div id=hrAccountDiv style=display:none><hr></div><div id=resetAccountDiv style=display:none;padding:2px><span id=resetAccountSpan>Forgot user/password?</span> <a onclick=xgo(3) style=cursor:pointer>Reset účtu</a>.</div><div id=newAccountDiv style=display:none;padding:2px>Nemáte účet? <a onclick=xgo(2) style=cursor:pointer>Vytvořit</a>.</div><input id=loginformargs name=urlargs type=hidden></form></div><div id=createpanel style=display:none><div style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;position:relative><form method=post><input type=hidden name=action value=createaccount><div id=message2></div><div><b>Account Creation</b></div><div id=passwordPolicyCallout style="left:-5px;top:10px;width:100px;position:absolute;background-color:#ffc;border-radius:5px;padding:5px;box-shadow:0 0 15px #666;font-size:10px"></div><table><tr id=nuUserRow><td align=right width=100>Uživatel:<td><input id=ausername name=username onchange=validateCreate(1) maxlength=64 onkeydown=haltReturn(event) onkeyup=validateCreate(1,event)><tr><td align=right width=100>Email:<td><input id=aemail name=email onchange=validateCreate(2) maxlength=256 onkeydown=haltReturn(event) onkeyup=validateCreate(2,event)><tr><td align=right>Heslo:<td><input id=apassword1 type=password name=password1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(3) onkeyup=validateCreate(3,event)><tr><td align=right>Heslo:<td><input id=apassword2 type=password name=password2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(4) onkeyup=validateCreate(4,event)><tr id=createPanelHint style=display:none><td align=right>Nápověda k heslu:<td><input id=apasswordhint name=apasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(5) onkeyup=validateCreate(5,event)><tr id=newAccountPass title="Enter the account creation token"><td align=right>Creation Token:<td><input id=anewaccountpass type=password name=anewaccountpass autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validateCreate(6) onkeyup=validateCreate(6,event)><tr><td colspan=2><div style=float:right><input id=createButton type=submit value="Create Account"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a> <input id=createformargs name=urlargs type=hidden></form></div></div><div id=resetpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both><form method=post><input type=hidden name=action value=resetaccount><div id=message3></div><div><b>Reset hesla</b></div><table><tr><td align=right width=100>Email:<td><input id=remail name=email maxlength=256 onchange=validateReset() onkeyup=validateReset(event)><tr><td colspan=2><div style=float:right><input id=eresetButton type=submit value="Reset účtu"disabled></div><div id=passWarning style=padding-top:6px></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a> <input id=resetformargs name=urlargs type=hidden></form></div><div id=tokenpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both><form method=post autocomplete=off><input type=hidden name=action value=tokenlogin> <input type=hidden name=hwstate value={{{hwstate}}}><div id=message4></div><table><tr><td align=right width=100>Login token:<td><input id=tokenInput name=token maxlength=50 onchange=checkToken(event) onkeyup=checkToken(event) onkeydown=checkToken(event) onfocus=checkTokenTimer(1) onblur=checkTokenTimer(0)> <input id=hwtokenInput name=hwtoken style=display:none><tr><td colspan=2 style=align-content:center><label><input id=tokenInputRemember name=remembertoken type=checkbox>Remember this device for 30 days.</label><tr><td colspan=2><div style=float:right><input id=tokenOkButton type=submit value=Login disabled></div><div style=float:right><input style=display:none;float:right id=securityKeyButton type=button value="Use Security Key"onclick=useSecurityKey()></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a> <input id=tokenformargs name=urlargs type=hidden></form></div><div id=resettokenpanel style=background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both><form method=post autocomplete=off><input type=hidden name=action value=resetaccount><div id=message5></div><table><tr><td align=right width=100>Login token:<td><input id=resetTokenInput name=token maxlength=50 onchange=resetCheckToken(event) onpaste=resetCheckToken(event) onkeyup=resetCheckToken(event) onkeydown=resetCheckToken(event)> <input id=resetHwtokenInput name=hwtoken style=display:none><tr><td colspan=2><div style=float:right><input id=resetTokenOkButton type=submit value=Login disabled></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a> <input id=resettokenformargs name=urlargs type=hidden></form></div><div id=resetpasswordpanel style=position:relative;background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none><form method=post><input type=hidden name=action value=resetpassword><div id=message6></div><div id=rpasswordPolicyCallout style="left:-10px;width:100px;display:none;position:absolute;background-color:#ffc;border-radius:5px;padding:5px;box-shadow:0 0 15px #666;font-size:10px"></div><table><tr><td id=rnuPass1 width=100 align=right>Heslo:<td><input id=rapassword1 type=password name=rpassword1 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(3,event) onkeyup=validatePassReset(3,event)><tr><td id=rnuPass2 align=right>Heslo:<td><input id=rapassword2 type=password name=rpassword2 autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(4,event) onkeyup=validatePassReset(4,event)><tr id=resetpasswordpanelHint style=display:none><td id=rnuHint align=right>Password Hint:<td><input id=rapasswordhint name=rpasswordhint autocomplete=off maxlength=256 onkeydown=haltReturn(event) onchange=validatePassReset(5,event) onkeyup=validatePassReset(5,event)><tr><td colspan=2><div style=float:right><input id=resetPassButton type=submit value="Reset hesla"disabled></div><div id=rpassWarning style=padding-top:6px></div></table><hr><a onclick=xgo(1) style=cursor:pointer>Back to login</a> <input id=resetpasswordformargs name=urlargs type=hidden></form></div></table></div></div><div id=footer style=height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0><table cellpadding=0 cellspacing=6 style=width:100%><tr><td style=text-align:left;color:#fff>{{{footer}}}<td style=text-align:right>{{{rootCertLink}}} <a href=terms>Terms & Privacy</a></table></div></div><div id=dialog style="z-index:1000;background-color:#eee;box-shadow:0 0 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:180px;width:400px;display:none"><div style="width:100%;background-color:#036;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><div id=idx_dlgButtonBar style=padding:10px;margin-bottom:20px><input id=idx_dlgCancelButton type=button value=Zrušit 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><script>"use strict";var loginMode="{{{loginmode}}}",newAccount="{{{newAccount}}}",passhint="{{{passhint}}}",newAccountPass=parseInt("{{{newAccountPass}}}"),emailCheck=!1,features=parseInt("{{{features}}}"),passRequirements="{{{passRequirements}}}",passRequirementsEx=null!=(passRequirements=""!=passRequirements?JSON.parse(decodeURIComponent(passRequirements)):{}).min||null!=passRequirements.max||null!=passRequirements.upper||null!=passRequirements.lower||null!=passRequirements.numeric||null!=passRequirements.nonalpha,hardwareKeyChallenge=decodeURIComponent("{{{hkey}}}"),publicKeyCredentialRequestOptions=null,currentpanel=0,messageid=parseInt("{{{messageid}}}"),okmessages=["","Hold on, reset mail sent."],failmessages=["Unable to create account.","Account limit reached.","Existing account with this email address.","Invalid account creation token.","Username already exists.","Password rejected, use a different one.","Invalid email.","Account not found.","Invalid token, try again.","Unable to sent email.","Account locked.","Access denied.","Login failed, check username and password.","Password change requested.","IP address blocked, try again later."];if(0<messageid){var msg="";if(messageid<100&&messageid<okmessages.length?msg=okmessages[messageid]:100<=messageid&&messageid-100<failmessages.length&&(msg=failmessages[messageid-100]),""!=msg){msg=100<=messageid?'<span class="msg error"><b style=color:#8C001A>'+msg+"<b></span><br /><br />":'<span class="msg success"><b>'+msg+"</b></span><br /><br />";for(var i=1;i<7;i++)QH("message"+i,msg)}}if(0<window.location.href.indexOf("?")){var urlargs=window.location.href.substring(window.location.href.indexOf("?"));Q("loginformargs").value=urlargs,Q("createformargs").value=urlargs,Q("resetformargs").value=urlargs,Q("tokenformargs").value=urlargs,Q("resettokenformargs").value=urlargs,Q("resetpasswordformargs").value=urlargs}function startup(){if(0==(32&features)){var e=null;try{e=top.location.toString().toLowerCase()}catch(e){}if(top!=self&&(null==e||0==top.active))return void(top.location=self.location)}if(2097152&features&&(QH("loginusername","Email:"),QH("resetAccountSpan","Zapomenuté heslo?"),QV("nuUserRow",!1)),QV("createPanelHint",!0===passRequirements.hint),QV("resetpasswordpanelHint",!0===passRequirements.hint),(window.onresize=center)(),validateLogin(),validateCreate(),0!=loginMode.length?go(parseInt(loginMode)):go(1),QV("newAccountDiv","1"===newAccount||"true"===newAccount),!0===passRequirements.hint&&null!=passhint&&0<passhint.length&&QV("showPassHintLink",!0),QV("newAccountPass",1==newAccountPass),QV("resetAccountDiv",1==emailCheck),QV("hrAccountDiv",1==emailCheck||1==newAccountPass),"4"==loginMode){try{hardwareKeyChallenge=0<hardwareKeyChallenge.length?JSON.parse(hardwareKeyChallenge):null}catch(e){hardwareKeyChallenge=null}QV("securityKeyButton",null!=hardwareKeyChallenge&&"webAuthn"==hardwareKeyChallenge.type)}if("5"==loginMode){try{hardwareKeyChallenge=0<hardwareKeyChallenge.length?JSON.parse(hardwareKeyChallenge):null}catch(e){hardwareKeyChallenge=null}if(null!=hardwareKeyChallenge&&"webAuthn"==hardwareKeyChallenge.type){"string"==typeof hardwareKeyChallenge.challenge&&(hardwareKeyChallenge.challenge=Uint8Array.from(atob(hardwareKeyChallenge.challenge),function(e){return e.charCodeAt(0)}).buffer),publicKeyCredentialRequestOptions={challenge:hardwareKeyChallenge.challenge,allowCredentials:[],timeout:hardwareKeyChallenge.timeout};for(var a=0;a<hardwareKeyChallenge.keyIds.length;a++)publicKeyCredentialRequestOptions.allowCredentials.push({id:Uint8Array.from(atob(hardwareKeyChallenge.keyIds[a]),function(e){return e.charCodeAt(0)}),type:"public-key",transports:["usb","ble","nfc"]});navigator.credentials.get({publicKey:publicKeyCredentialRequestOptions}).then(function(e){var a={id:btoa(String.fromCharCode.apply(null,new Uint8Array(e.rawId))),clientDataJSON:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.clientDataJSON))),userHandle:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.userHandle))),signature:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.signature))),authenticatorData:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.authenticatorData)))};Q("resetHwtokenInput").value=JSON.stringify(a),QE("resetTokenOkButton",!0),Q("resetTokenOkButton").click()},function(e){console.log("credentials-get error",e)})}}}function useSecurityKey(){if(null!=hardwareKeyChallenge&&"webAuthn"==hardwareKeyChallenge.type){"string"==typeof hardwareKeyChallenge.challenge&&(hardwareKeyChallenge.challenge=Uint8Array.from(atob(hardwareKeyChallenge.challenge),function(e){return e.charCodeAt(0)}).buffer),publicKeyCredentialRequestOptions={challenge:hardwareKeyChallenge.challenge,allowCredentials:[],timeout:hardwareKeyChallenge.timeout};for(var e=0;e<hardwareKeyChallenge.keyIds.length;e++)publicKeyCredentialRequestOptions.allowCredentials.push({id:Uint8Array.from(atob(hardwareKeyChallenge.keyIds[e]),function(e){return e.charCodeAt(0)}),type:"public-key",transports:["usb","ble","nfc"]});navigator.credentials.get({publicKey:publicKeyCredentialRequestOptions}).then(function(e){var a={id:btoa(String.fromCharCode.apply(null,new Uint8Array(e.rawId))),clientDataJSON:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.clientDataJSON))),userHandle:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.userHandle))),signature:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.signature))),authenticatorData:btoa(String.fromCharCode.apply(null,new Uint8Array(e.response.authenticatorData)))};Q("hwtokenInput").value=JSON.stringify(a),QE("tokenOkButton",!0),Q("tokenOkButton").click()},function(e){console.log("credentials-get error",e)})}}function showPassHint(){!0===passRequirements.hint&&messagebox("Password Hint",passhint)}function xgo(e){QV("message1",!1),QV("message2",!1),QV("message3",!1),QV("message4",!1),QV("message5",!1),QV("message6",!1),go(e)}function go(e){currentpanel=e,setDialogMode(0),QV("showPassHintLink",!1),QV("loginpanel",1==e),QV("createpanel",2==e),QV("resetpanel",3==e),QV("tokenpanel",4==e),QV("resettokenpanel",5==e),QV("resetpasswordpanel",6==e),1==e&&Q("username").focus(),2==e&&(2097152&features?Q("aemail").focus():Q("ausername").focus()),3==e&&Q("remail").focus(),4==e&&Q("tokenInput").focus(),5==e&&Q("resetTokenInput").focus(),6==e&&Q("rapassword1").focus()}function validateLogin(e,a){var n=0<Q("username").value.length&&-1==Q("username").value.indexOf(" ")&&0<Q("password").value.length;QE("loginButton",n),setDialogMode(0),null!=a&&13==a.keyCode&&(1==e?Q("password").focus():2==e&&Q("loginButton").click()),null!=a&&haltEvent(a)}function validateCreate(e,a){setDialogMode(0);var n=!1;if(n=!!(2097152&features)||0<Q("ausername").value.length&&-1==Q("ausername").value.indexOf(" ")&&-1==Q("ausername").value.indexOf('"')&&-1==Q("ausername").value.indexOf(","),n&=1==validateEmail(Q("aemail").value)&&0<Q("apassword1").value.length&&Q("apassword2").value==Q("apassword1").value,1==newAccountPass&&0==Q("anewaccountpass").value.length&&(n=!1),""==Q("apassword1").value)QH("passWarning",""),QV("passwordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("apassword1").value,passRequirements)?(n=!1,QH("passWarning","<span style=color:red><b>Password Policy</b><span>"),QV("passwordPolicyCallout",!0),QH("passwordPolicyCallout",passwordPolicyText(Q("apassword1").value))):(QH("passWarning",""),QV("passwordPolicyCallout",!1))}else{var s=checkPasswordStrength(Q("apassword1").value);80<=s?QH("passWarning","<span style=color:green><b>Silné heslo</b><span>"):60<=s?QH("passWarning","<span style=color:blue><b>Dobré heslo</b><span>"):QH("passWarning","<span style=color:red><b>Slabé heslo</b><span>")}QE("createButton",n),null!=a&&13==a.keyCode&&(1==e&&Q("aemail").focus(),2==e&&Q("apassword1").focus(),3==e&&Q("apassword2").focus(),4==e&&Q("apasswordhint").focus(),5==e&&(1==newAccountPass?Q("anewaccountpass").focus():Q("createButton").click()),6==e&&Q("createButton").click()),null!=a&&haltEvent(a)}function validatePassReset(e,a){setDialogMode(0);var n=0<Q("rapassword1").value.length,s=0<Q("rapassword2").value.length&&Q("rapassword2").value==Q("rapassword1").value,t=n&&s;if(QS("rnuPass1").color=n?"black":"#7b241c",QS("rnuPass2").color=s?"black":"#7b241c",""==Q("rapassword1").value)QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1);else if(passRequirementsEx){0==checkPasswordRequirements(Q("rapassword1").value,passRequirements)?(t=!1,QS("rnuPass1").color="#7b241c",QS("rnuPass2").color="#7b241c",QH("rpassWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>"),QV("rpasswordPolicyCallout",!0),QH("rpasswordPolicyCallout",passwordPolicyText(Q("rapassword1").value))):(QH("rpassWarning",""),QV("rpasswordPolicyCallout",!1))}else{var r=checkPasswordStrength(Q("rapassword1").value);80<=r?QH("rpassWarning","<span style=color:green><b>Silné heslo</b><span>"):60<=r?QH("rpassWarning","<span style=color:blue><b>Dobré heslo</b><span>"):QH("rpassWarning","<span style=color:red><b>Slabé heslo</b><span>")}null!=a&&13==a.keyCode&&(2==e&&Q("rapassword1").focus(),3==e&&Q("rapassword2").focus(),4==e&&Q("rapasswordhint").focus(),6==e&&Q("resetPassButton").click()),null!=a&&haltEvent(a),QE("resetPassButton",t)}function validateReset(e){setDialogMode(0);var a=validateEmail(Q("remail").value);QE("eresetButton",a),null!=e&&13==e.keyCode&&1==a&&Q("eresetButton").click(),null!=e&&haltEvent(e)}function passwordPolicyText(e){var a="<div style=text-align:left>",n=strCount(e);return passRequirements.min&&(null==e||e.length<passRequirements.min)&&(a+=format("Minimum length of {0}",passRequirements.min)+"<br />"),passRequirements.max&&(null==e||e.length>passRequirements.max)&&(a+=format("Maximum length of {0}",passRequirements.max)+"<br />"),passRequirements.upper&&(null==e||n.upper<passRequirements.upper)&&(a+=format("{0} upper case",passRequirements.upper)+"<br />"),passRequirements.lower&&(null==e||n.lower<passRequirements.lower)&&(a+=format("{0} lower case",passRequirements.lower)+"<br />"),passRequirements.numeric&&(null==e||n.numeric<passRequirements.numeric)&&(a+=format("{0} numeric",passRequirements.numeric)+"<br />"),passRequirements.nonalpha&&(null==e||n.nonalpha<passRequirements.nonalpha)&&(a+=format("{0} non-alphanumeric",passRequirements.nonalpha)+"<br />"),a+="</div>"}function checkPasswordStrength(e){var a=0,n={},s=0,t={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e)return 0;for(var r=0;r<e.length;r++)n[e[r]]=(n[e[r]]||0)+1,a+=5/n[e[r]];for(var l in t)s+=1==t[l]?1:0;return parseInt(a+10*(s-1))}function checkPasswordRequirements(e,a){if(null==a||""==a||"object"!=typeof a)return!0;if(a.min&&e.length<a.min)return!1;if(a.max&&e.length>a.max)return!1;var n=strCount(e);return!(a.numeric&&n.numeric<a.numeric)&&(!(a.lower&&n.lower<a.lower)&&(!(a.upper&&n.upper<a.upper)&&!(a.nonalpha&&n.nonalpha<a.nonalpha)))}function strCount(e){var a={numeric:0,lower:0,upper:0,nonalpha:0};if("string"!=typeof e)return a;for(var n=0;n<e.length;n++)/\d/.test(e[n])&&a.numeric++,/[a-z]/.test(e[n])&&a.lower++,/[A-Z]/.test(e[n])&&a.upper++,/\W/.test(e[n])&&a.nonalpha++;return a}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,xcheckTokenTimer=null;function checkTokenTimer(e){0==e&&null!=xcheckTokenTimer&&(clearInterval(xcheckTokenTimer),xcheckTokenTimer=null),1==e&&null==xcheckTokenTimer&&(xcheckTokenTimer=setInterval(checkToken,200))}function checkToken(){var e=Q("tokenInput").value,a=e.split(" ").join("");e!=a&&(Q("tokenInput").value=a),QE("tokenOkButton",6==Q("tokenInput").value.length||8==Q("tokenInput").value.length||44==Q("tokenInput").value.length)}function resetCheckToken(){var e=Q("resetTokenInput").value,a=e.split(" ").join("");e!=a&&(Q("resetTokenInput").value=a),QE("resetTokenOkButton",6==Q("resetTokenInput").value.length||8==Q("resetTokenInput").value.length||44==Q("resetTokenInput").value.length)}var xxcurrentView=0;function setDialogMode(e,a,n,s,t,r){xxdialogMode=e,xxdialogFunc=s,xxdialogButtons=n,xxdialogTag=r,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&n),QV("idx_dlgCancelButton",2&n),QV("id_dialogclose",2&n||8&n),QV("idx_dlgButtonBar",7&n),a&&QH("id_dialogtitle",a);for(var l=1;l<24;l++)QV("dialog"+l,l==e);QV("dialog",e),t&&(2==e?QH("id_dialogOptions",t):QH("id_dialogMessage",t))}function dialogclose(e){var a=xxdialogFunc,n=xxdialogButtons,s=xxdialogTag;setDialogMode(),(8&n||e)&&a&&a(e,s)}function center(){QS("dialog").left=(getDocWidth()-400)/2+"px"}function messagebox(e,a){QH("id_dialogMessage",a),setDialogMode(1,e,1)}function statusbox(e,a){QH("id_dialogMessage",a),setDialogMode(1,e)}function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function haltReturn(e){13==e.keyCode&&haltEvent(e)}function validateEmail(e){return/^(([^<>()\[\]\\.,;:\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,}))$/.test(e)}function format(e){var n=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,a){return void 0!==n[a]?n[a]:e})}</script>
\ No newline at end of file
views/translations/login-mobile_cs.handlebars
new
+647
@@ -0,0 +1,647 @@
1
+<!DOCTYPE html><html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head>
2
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
4
+ <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
5
+ <meta name="apple-mobile-web-app-capable" content="yes">
6
+ <meta name="format-detection" content="telephone=no">
7
+ <link rel="shortcut icon" type="image/x-icon" href="{{{domainurl}}}favicon.ico">
8
+ <script type="text/javascript" src="scripts/common-0.0.1.js"></script>
9
+ <script type="text/javascript" src="scripts/u2f-api.js"></script>
10
+ <title>MeshCentral - Login</title>
11
+ <style>
12
+ a {
13
+ color: #036;
14
+ text-decoration: underline;
15
+ }
16
+
17
+ #footer a {
18
+ color: #fff;
19
+ text-decoration: underline;
20
+ }
21
+
22
+ #footer a:hover {
23
+ color: #fff;
24
+ text-decoration: none;
25
+ }
26
+ </style>
27
+</head>
28
+<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">
29
+ <div id="container">
30
+ <div id="mastheadx"></div>
31
+ <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">
32
+ <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px">
33
+ <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong>
34
+ </div>
35
+ <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px">
36
+ <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong>
37
+ </div>
38
+ </div>
39
+ <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%;display:flex;align-items:center">
40
+ <div id="column_l" style="padding:10px;width:100%">
41
+ <table style="width:100%">
42
+ <tbody><tr>
43
+ <td align="center">
44
+ <div id="loginpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;display:none">
45
+ <form method="post">
46
+ <input type="hidden" name="action" value="login">
47
+ <div id="message1"></div>
48
+ <div>
49
+ <b>Přihlásit</b>
50
+ </div>
51
+ <table>
52
+ <tbody><tr>
53
+ <td id="loginusername" align="right" width="100">Uživatel:</td>
54
+ <td><input id="username" type="text" maxlength="64" name="username" onchange="validateLogin(1)" onkeyup="validateLogin(1,event)"></td>
55
+ </tr>
56
+ <tr>
57
+ <td align="right">Heslo:</td>
58
+ <td><input id="password" type="password" maxlength="256" name="password" autocomplete="off" onchange="validateLogin(2)" onkeyup="validateLogin(2,event)"></td>
59
+ </tr>
60
+ <tr>
61
+ <td><div id="showPassHintLink" style="display:none"><a onclick="showPassHint()" style="cursor:pointer">Show Hint</a></div></td>
62
+ <td align="right"><input id="loginButton" type="submit" value="Přihlásit" disabled="disabled"></td>
63
+ </tr>
64
+ </tbody></table>
65
+ <div id="hrAccountDiv" style="display:none"><hr></div>
66
+ <div id="resetAccountDiv" style="display:none;padding:2px">
67
+ <span id="resetAccountSpan">Forgot user/password?</span> <a onclick="xgo(3)" style="cursor:pointer">Reset účtu</a>.
68
+ </div>
69
+ <div id="newAccountDiv" style="display:none;padding:2px">
70
+ Nemáte účet? <a onclick="xgo(2)" style="cursor:pointer">Vytvořit</a>.
71
+ </div>
72
+ <input id="loginformargs" name="urlargs" type="hidden" value="">
73
+ </form>
74
+ </div>
75
+ <div id="createpanel" style="display:none">
76
+ <div style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;position:relative">
77
+ <form method="post">
78
+ <input type="hidden" name="action" value="createaccount">
79
+ <div id="message2"></div>
80
+ <div>
81
+ <b>Account Creation</b>
82
+ </div>
83
+ <div id="passwordPolicyCallout" style="left:-5px;top:10px;width:100px;position:absolute;background-color:#FFC;border-radius:5px;padding:5px;box-shadow:0px 0px 15px #666;font-size:10px"></div>
84
+ <table>
85
+ <tbody><tr id="nuUserRow">
86
+ <td align="right" width="100">Uživatel:</td>
87
+ <td><input id="ausername" type="text" name="username" onchange="validateCreate(1)" maxlength="64" onkeydown="haltReturn(event)" onkeyup="validateCreate(1,event)"></td>
88
+ </tr>
89
+ <tr>
90
+ <td align="right" width="100">Email:</td>
91
+ <td><input id="aemail" type="text" name="email" onchange="validateCreate(2)" maxlength="256" onkeydown="haltReturn(event)" onkeyup="validateCreate(2,event)"></td>
92
+ </tr>
93
+ <tr>
94
+ <td align="right">Heslo:</td>
95
+ <td><input id="apassword1" type="password" name="password1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(3)" onkeyup="validateCreate(3,event)"></td>
96
+ </tr>
97
+ <tr>
98
+ <td align="right">Heslo:</td>
99
+ <td><input id="apassword2" type="password" name="password2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(4)" onkeyup="validateCreate(4,event)"></td>
100
+ </tr>
101
+ <tr id="createPanelHint" style="display:none">
102
+ <td align="right">Nápověda k heslu:</td>
103
+ <td><input id="apasswordhint" type="text" name="apasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(5)" onkeyup="validateCreate(5,event)"></td>
104
+ </tr>
105
+ <tr id="newAccountPass" title="Enter the account creation token">
106
+ <td align="right">Creation Token:</td>
107
+ <td><input id="anewaccountpass" type="password" name="anewaccountpass" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(6)" onkeyup="validateCreate(6,event)"></td>
108
+ </tr>
109
+ <tr>
110
+ <td colspan="2">
111
+ <div style="float:right"><input id="createButton" type="submit" value="Create Account" disabled="disabled"></div>
112
+ <div id="passWarning" style="padding-top:6px"></div>
113
+ </td>
114
+ </tr>
115
+ </tbody></table>
116
+ <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a>
117
+ <input id="createformargs" name="urlargs" type="hidden" value="">
118
+ </form>
119
+ </div>
120
+ </div>
121
+ <div id="resetpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both">
122
+ <form method="post">
123
+ <input type="hidden" name="action" value="resetaccount">
124
+ <div id="message3"></div>
125
+ <div>
126
+ <b>Reset hesla</b>
127
+ </div>
128
+ <table>
129
+ <tbody><tr>
130
+ <td align="right" width="100">Email:</td>
131
+ <td><input id="remail" type="text" name="email" maxlength="256" onchange="validateReset()" onkeyup="validateReset(event)"></td>
132
+ </tr>
133
+ <tr>
134
+ <td colspan="2">
135
+ <div style="float:right"><input id="eresetButton" type="submit" value="Reset účtu" disabled="disabled"></div>
136
+ <div id="passWarning" style="padding-top:6px"></div>
137
+ </td>
138
+ </tr>
139
+ </tbody></table>
140
+ <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a>
141
+ <input id="resetformargs" name="urlargs" type="hidden" value="">
142
+ </form>
143
+ </div>
144
+ <div id="tokenpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both">
145
+ <form method="post" autocomplete="off">
146
+ <input type="hidden" name="action" value="tokenlogin">
147
+ <input type="hidden" name="hwstate" value="{{{hwstate}}}">
148
+ <div id="message4"></div>
149
+ <table>
150
+ <tbody><tr>
151
+ <td align="right" width="100">Login token:</td>
152
+ <td>
153
+ <input id="tokenInput" type="text" name="token" maxlength="50" onchange="checkToken(event)" onkeyup="checkToken(event)" onkeydown="checkToken(event)" onfocus="checkTokenTimer(1)" onblur="checkTokenTimer(0)">
154
+ <input id="hwtokenInput" type="text" name="hwtoken" style="display:none">
155
+ </td>
156
+ </tr>
157
+ <tr>
158
+ <td colspan="2" style="align-content:center">
159
+ <label><input id="tokenInputRemember" name="remembertoken" type="checkbox">Remember this device for 30 days.</label>
160
+ </td>
161
+ </tr>
162
+ <tr>
163
+ <td colspan="2">
164
+ <div style="float:right"><input id="tokenOkButton" type="submit" value="Login" disabled="disabled"></div>
165
+ <div style="float:right"><input style="display:none;float:right" id="securityKeyButton" type="button" value="Use Security Key" onclick="useSecurityKey()"></div>
166
+ </td>
167
+ </tr>
168
+ </tbody></table>
169
+ <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a>
170
+ <input id="tokenformargs" name="urlargs" type="hidden" value="">
171
+ </form>
172
+ </div>
173
+
174
+ <div id="resettokenpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both">
175
+ <form method="post" autocomplete="off">
176
+ <input type="hidden" name="action" value="resetaccount">
177
+ <div id="message5"></div>
178
+ <table>
179
+ <tbody><tr>
180
+ <td align="right" width="100">Login token:</td>
181
+ <td>
182
+ <input id="resetTokenInput" type="text" name="token" maxlength="50" onchange="resetCheckToken(event)" onpaste="resetCheckToken(event)" onkeyup="resetCheckToken(event)" onkeydown="resetCheckToken(event)">
183
+ <input id="resetHwtokenInput" type="text" name="hwtoken" style="display:none">
184
+ </td>
185
+ </tr>
186
+ <tr>
187
+ <td colspan="2">
188
+ <div style="float:right"><input id="resetTokenOkButton" type="submit" value="Login" disabled="disabled"></div>
189
+ </td>
190
+ </tr>
191
+ </tbody></table>
192
+ <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a>
193
+ <input id="resettokenformargs" name="urlargs" type="hidden" value="">
194
+ </form>
195
+ </div>
196
+
197
+ <div id="resetpasswordpanel" style="position:relative;background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none">
198
+ <form method="post">
199
+ <input type="hidden" name="action" value="resetpassword">
200
+ <div id="message6"></div>
201
+ <div id="rpasswordPolicyCallout" style="left:-10px;width:100px;display:none;position:absolute;background-color:#FFC;border-radius:5px;padding:5px;box-shadow:0px 0px 15px #666;font-size:10px"></div>
202
+ <table>
203
+ <tbody><tr>
204
+ <td id="rnuPass1" width="100" align="right">Heslo:</td>
205
+ <td><input id="rapassword1" type="password" name="rpassword1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(3,event)" onkeyup="validatePassReset(3,event)"></td>
206
+ </tr>
207
+ <tr>
208
+ <td id="rnuPass2" align="right">Heslo:</td>
209
+ <td><input id="rapassword2" type="password" name="rpassword2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(4,event)" onkeyup="validatePassReset(4,event)"></td>
210
+ </tr>
211
+ <tr id="resetpasswordpanelHint" style="display:none">
212
+ <td id="rnuHint" align="right">Password Hint:</td>
213
+ <td><input id="rapasswordhint" type="text" name="rpasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(5,event)" onkeyup="validatePassReset(5,event)"></td>
214
+ </tr>
215
+ <tr>
216
+ <td colspan="2">
217
+ <div style="float:right"><input id="resetPassButton" type="submit" value="Reset hesla" disabled="disabled"></div>
218
+ <div id="rpassWarning" style="padding-top:6px"></div>
219
+ </td>
220
+ </tr>
221
+ </tbody></table>
222
+ <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a>
223
+ <input id="resetpasswordformargs" name="urlargs" type="hidden" value="">
224
+ </form>
225
+ </div>
226
+
227
+ </td>
228
+ </tr>
229
+ </tbody></table>
230
+ </div>
231
+ </div>
232
+ <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px">
233
+ <table cellpadding="0" cellspacing="6" style="width:100%">
234
+ <tbody><tr>
235
+ <td style="text-align:left;color:white">{{{footer}}}</td>
236
+ <td style="text-align:right">{{{rootCertLink}}} <a href="terms">Terms & Privacy</a></td>
237
+ </tr>
238
+ </tbody></table>
239
+ </div>
240
+ </div>
241
+ <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:180px;width:400px;display:none">
242
+ <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0">
243
+ <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div>
244
+ <div id="id_dialogtitle" style="padding:5px"></div>
245
+ <div style="width:100%;margin:6px"></div>
246
+ </div>
247
+ <div style="margin-right:16px;margin-left:8px">
248
+ <div id="dialog1" style="margin:auto;text-align:center;margin:3px">
249
+ <div id="id_dialogMessage" style="padding:10px"></div>
250
+ </div>
251
+ <div id="dialog2" style="margin:auto;margin:3px">
252
+ <div id="id_dialogOptions"></div>
253
+ </div>
254
+ </div>
255
+ <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px">
256
+ <input id="idx_dlgCancelButton" type="button" value="Zrušit" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)">
257
+ <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)">
258
+ </div>
259
+ </div>
260
+ <script>
261
+ 'use strict';
262
+ var loginMode = '{{{loginmode}}}';
263
+ var newAccount = '{{{newAccount}}}';
264
+ var passhint = '{{{passhint}}}';
265
+ var newAccountPass = parseInt('{{{newAccountPass}}}');
266
+ var emailCheck = ('{{{emailcheck}}}' == 'true');
267
+ var features = parseInt('{{{features}}}');
268
+ var passRequirements = '{{{passRequirements}}}';
269
+ if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); } else { passRequirements = {}; }
270
+ var passRequirementsEx = ((passRequirements.min != null) || (passRequirements.max != null) || (passRequirements.upper != null) || (passRequirements.lower != null) || (passRequirements.numeric != null) || (passRequirements.nonalpha != null));
271
+ var hardwareKeyChallenge = decodeURIComponent('{{{hkey}}}');
272
+ var publicKeyCredentialRequestOptions = null;
273
+ var currentpanel = 0;
274
+
275
+ // Display the right server message
276
+ var messageid = parseInt('{{{messageid}}}');
277
+ var okmessages = ['', "Hold on, reset mail sent."];
278
+ var failmessages = ["Unable to create account.", "Account limit reached.", "Existing account with this email address.", "Invalid account creation token.", "Username already exists.", "Password rejected, use a different one.", "Invalid email.", "Account not found.", "Invalid token, try again.", "Unable to sent email.", "Account locked.", "Access denied.", "Login failed, check username and password.", "Password change requested.", "IP address blocked, try again later."];
279
+ if (messageid > 0) {
280
+ var msg = '';
281
+ if ((messageid < 100) && (messageid < okmessages.length)) { msg = okmessages[messageid]; }
282
+ else if ((messageid >= 100) && ((messageid - 100) < failmessages.length)) { msg = failmessages[messageid - 100]; }
283
+ if (msg != '') {
284
+ if (messageid >= 100) { msg = ('<span class="msg error"><b style=color:#8C001A>' + msg + '<b></span><br /><br />'); } else { msg = ('<span class="msg success"><b>' + msg + '</b></span><br /><br />'); }
285
+ for (var i = 1; i < 7; i++) { QH('message' + i, msg); }
286
+ }
287
+ }
288
+
289
+ // If URL arguments are provided, add them to form posts
290
+ if (window.location.href.indexOf('?') > 0) {
291
+ var urlargs = window.location.href.substring(window.location.href.indexOf('?'));
292
+ Q('loginformargs').value = urlargs;
293
+ Q('createformargs').value = urlargs;
294
+ Q('resetformargs').value = urlargs;
295
+ Q('tokenformargs').value = urlargs;
296
+ Q('resettokenformargs').value = urlargs;
297
+ Q('resetpasswordformargs').value = urlargs;
298
+ }
299
+
300
+ function startup() {
301
+ if ((features & 32) == 0) {
302
+ // Guard against other site's top frames (web bugs).
303
+ var loc = null;
304
+ try { loc = top.location.toString().toLowerCase(); } catch (e) { }
305
+ if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; }
306
+ }
307
+
308
+ if (features & 0x200000) { // Email is username
309
+ QH('loginusername', "Email:");
310
+ QH('resetAccountSpan', "Zapomenuté heslo?");
311
+ QV('nuUserRow', false);
312
+ }
313
+
314
+ QV('createPanelHint', passRequirements.hint === true);
315
+ QV('resetpasswordpanelHint', passRequirements.hint === true);
316
+
317
+ window.onresize = center;
318
+ center();
319
+ validateLogin();
320
+ validateCreate();
321
+ if (loginMode.length != 0) { go(parseInt(loginMode)); } else { go(1); }
322
+ QV('newAccountDiv', (newAccount === '1') || (newAccount === 'true')); // If new accounts are not allowed, don't display the new account link.
323
+ if ((passRequirements.hint === true) && (passhint != null) && (passhint.length > 0)) { QV('showPassHintLink', true); }
324
+ QV('newAccountPass', (newAccountPass == 1));
325
+ QV('resetAccountDiv', (emailCheck == true));
326
+ QV('hrAccountDiv', (emailCheck == true) || (newAccountPass == 1));
327
+
328
+ if (loginMode == '4') {
329
+ try { if (hardwareKeyChallenge.length > 0) { hardwareKeyChallenge = JSON.parse(hardwareKeyChallenge); } else { hardwareKeyChallenge = null; } } catch (ex) { hardwareKeyChallenge = null }
330
+ QV('securityKeyButton', (hardwareKeyChallenge != null) && (hardwareKeyChallenge.type == 'webAuthn'));
331
+ }
332
+
333
+ if (loginMode == '5') {
334
+ try { if (hardwareKeyChallenge.length > 0) { hardwareKeyChallenge = JSON.parse(hardwareKeyChallenge); } else { hardwareKeyChallenge = null; } } catch (ex) { hardwareKeyChallenge = null }
335
+ if ((hardwareKeyChallenge != null) && (hardwareKeyChallenge.type == 'webAuthn')) {
336
+ if (typeof hardwareKeyChallenge.challenge == 'string') { hardwareKeyChallenge.challenge = Uint8Array.from(atob(hardwareKeyChallenge.challenge), function (c) { return c.charCodeAt(0) }).buffer; }
337
+
338
+ publicKeyCredentialRequestOptions = { challenge: hardwareKeyChallenge.challenge, allowCredentials: [], timeout: hardwareKeyChallenge.timeout }
339
+ for (var i = 0; i < hardwareKeyChallenge.keyIds.length; i++) {
340
+ publicKeyCredentialRequestOptions.allowCredentials.push(
341
+ { id: Uint8Array.from(atob(hardwareKeyChallenge.keyIds[i]), function (c) { return c.charCodeAt(0) }), type: 'public-key', transports: ['usb', 'ble', 'nfc'], }
342
+ );
343
+ }
344
+
345
+ // New WebAuthn hardware keys
346
+ navigator.credentials.get({ publicKey: publicKeyCredentialRequestOptions }).then(
347
+ function (rawAssertion) {
348
+ var assertion = {
349
+ id: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.rawId))),
350
+ clientDataJSON: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.clientDataJSON))),
351
+ userHandle: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.userHandle))),
352
+ signature: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.signature))),
353
+ authenticatorData: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.authenticatorData))),
354
+ };
355
+ Q('resetHwtokenInput').value = JSON.stringify(assertion);
356
+ QE('resetTokenOkButton', true);
357
+ Q('resetTokenOkButton').click();
358
+ },
359
+ function (error) { console.log('credentials-get error', error); }
360
+ );
361
+ }
362
+ }
363
+ }
364
+
365
+ // Use a hardware security key
366
+ function useSecurityKey() {
367
+ if ((hardwareKeyChallenge != null) && (hardwareKeyChallenge.type == 'webAuthn')) {
368
+ if (typeof hardwareKeyChallenge.challenge == 'string') { hardwareKeyChallenge.challenge = Uint8Array.from(atob(hardwareKeyChallenge.challenge), function (c) { return c.charCodeAt(0) }).buffer; }
369
+
370
+ publicKeyCredentialRequestOptions = { challenge: hardwareKeyChallenge.challenge, allowCredentials: [], timeout: hardwareKeyChallenge.timeout }
371
+ for (var i = 0; i < hardwareKeyChallenge.keyIds.length; i++) {
372
+ publicKeyCredentialRequestOptions.allowCredentials.push(
373
+ { id: Uint8Array.from(atob(hardwareKeyChallenge.keyIds[i]), function (c) { return c.charCodeAt(0) }), type: 'public-key', transports: ['usb', 'ble', 'nfc'], }
374
+ );
375
+ }
376
+
377
+ // New WebAuthn hardware keys
378
+ navigator.credentials.get({ publicKey: publicKeyCredentialRequestOptions }).then(
379
+ function (rawAssertion) {
380
+ var assertion = {
381
+ id: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.rawId))),
382
+ clientDataJSON: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.clientDataJSON))),
383
+ userHandle: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.userHandle))),
384
+ signature: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.signature))),
385
+ authenticatorData: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.authenticatorData))),
386
+ };
387
+ Q('hwtokenInput').value = JSON.stringify(assertion);
388
+ QE('tokenOkButton', true);
389
+ Q('tokenOkButton').click();
390
+ },
391
+ function (error) { console.log('credentials-get error', error); }
392
+ );
393
+ }
394
+ }
395
+
396
+ function showPassHint() {
397
+ if (passRequirements.hint === true) { messagebox("Password Hint", passhint); }
398
+ }
399
+
400
+ function xgo(x) {
401
+ QV('message1', false);
402
+ QV('message2', false);
403
+ QV('message3', false);
404
+ QV('message4', false);
405
+ QV('message5', false);
406
+ QV('message6', false);
407
+ go(x);
408
+ }
409
+
410
+ function go(x) {
411
+ currentpanel = x;
412
+ setDialogMode(0);
413
+ QV('showPassHintLink', false);
414
+ QV('loginpanel', x == 1);
415
+ QV('createpanel', x == 2);
416
+ QV('resetpanel', x == 3);
417
+ QV('tokenpanel', x == 4);
418
+ QV('resettokenpanel', x == 5);
419
+ QV('resetpasswordpanel', x == 6);
420
+ if (x == 1) { Q('username').focus(); }
421
+ if (x == 2) { if (features & 0x200000) { Q('aemail').focus(); } else { Q('ausername').focus(); } } // Email is username
422
+ if (x == 3) { Q('remail').focus(); }
423
+ if (x == 4) { Q('tokenInput').focus(); }
424
+ if (x == 5) { Q('resetTokenInput').focus(); }
425
+ if (x == 6) { Q('rapassword1').focus(); }
426
+ }
427
+
428
+ function validateLogin(box, e) {
429
+ var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0));
430
+ QE('loginButton', ok);
431
+ setDialogMode(0);
432
+ if ((e != null) && (e.keyCode == 13)) { if (box == 1) { Q('password').focus(); } else if (box == 2) { Q('loginButton').click(); } }
433
+ if (e != null) { haltEvent(e); }
434
+ }
435
+
436
+ function validateCreate(box,e) {
437
+ setDialogMode(0);
438
+ var ok = false;
439
+ if (features & 0x200000) { ok = true; } else { ok = (Q('ausername').value.length > 0) && (Q('ausername').value.indexOf(' ') == -1) && (Q('ausername').value.indexOf('"') == -1) && (Q('ausername').value.indexOf(',') == -1); }
440
+ ok &= ((validateEmail(Q('aemail').value) == true) && (Q('apassword1').value.length > 0) && (Q('apassword2').value == Q('apassword1').value));
441
+ if ((newAccountPass == 1) && (Q('anewaccountpass').value.length == 0)) { ok = false; }
442
+ if (Q('apassword1').value == '') {
443
+ QH('passWarning', '');
444
+ QV('passwordPolicyCallout', false);
445
+ } else {
446
+ if (!passRequirementsEx) {
447
+ // No password requirements, display password strength
448
+ var passStrength = checkPasswordStrength(Q('apassword1').value);
449
+ if (passStrength >= 80) { QH('passWarning', '<span style=color:green><b>' + "Silné heslo" + '</b><span>'); }
450
+ else if (passStrength >= 60) { QH('passWarning', '<span style=color:blue><b>' + "Dobré heslo" + '</b><span>'); }
451
+ else { QH('passWarning', '<span style=color:red><b>' + "Slabé heslo" + '</b><span>'); }
452
+ } else {
453
+ // Password requirements provided, use that
454
+ var passReq = checkPasswordRequirements(Q('apassword1').value, passRequirements);
455
+ if (passReq == false) {
456
+ ok = false;
457
+ //QS('nuPass1').color = '#7b241c';
458
+ //QS('nuPass2').color = '#7b241c';
459
+ QH('passWarning', '<span style=color:red><b>' + "Password Policy" + '</b><span>'); // TODO: Display problem hint
460
+ QV('passwordPolicyCallout', true);
461
+ QH('passwordPolicyCallout', passwordPolicyText(Q('apassword1').value));
462
+ } else {
463
+ QH('passWarning', '');
464
+ QV('passwordPolicyCallout', false);
465
+ }
466
+ }
467
+ }
468
+ QE('createButton', ok);
469
+ if ((e != null) && (e.keyCode == 13)) {
470
+ if (box == 1) { Q('aemail').focus(); }
471
+ if (box == 2) { Q('apassword1').focus(); }
472
+ if (box == 3) { Q('apassword2').focus(); }
473
+ if (box == 4) { Q('apasswordhint').focus(); }
474
+ if (box == 5) { if (newAccountPass == 1) { Q('anewaccountpass').focus(); } else { Q('createButton').click(); } }
475
+ if (box == 6) { Q('createButton').click(); }
476
+ }
477
+ if (e != null) { haltEvent(e); }
478
+ }
479
+
480
+ function validatePassReset(box, e) {
481
+ setDialogMode(0);
482
+ var pass1ok = (Q('rapassword1').value.length > 0);
483
+ var pass2ok = (Q('rapassword2').value.length > 0) && (Q('rapassword2').value == Q('rapassword1').value);
484
+ var ok = (pass1ok && pass2ok);
485
+
486
+ // Color the fields
487
+ QS('rnuPass1').color = pass1ok ? 'black' : '#7b241c';
488
+ QS('rnuPass2').color = pass2ok ? 'black' : '#7b241c';
489
+
490
+ if (Q('rapassword1').value == '') {
491
+ QH('rpassWarning', '');
492
+ QV('rpasswordPolicyCallout', false);
493
+ } else {
494
+ if (!passRequirementsEx) {
495
+ // No password requirements, display password strength
496
+ var passStrength = checkPasswordStrength(Q('rapassword1').value);
497
+ if (passStrength >= 80) { QH('rpassWarning', '<span style=color:green><b>' + "Silné heslo" + '</b><span>'); }
498
+ else if (passStrength >= 60) { QH('rpassWarning', '<span style=color:blue><b>' + "Dobré heslo" + '</b><span>'); }
499
+ else { QH('rpassWarning', '<span style=color:red><b>' + "Slabé heslo" + '</b><span>'); }
500
+ } else {
501
+ // Password requirements provided, use that
502
+ var passReq = checkPasswordRequirements(Q('rapassword1').value, passRequirements);
503
+ if (passReq == false) {
504
+ ok = false;
505
+ QS('rnuPass1').color = '#7b241c';
506
+ QS('rnuPass2').color = '#7b241c';
507
+ QH('rpassWarning', '<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>' + "Password Policy" + '</b><div>'); // This is also a link to the password policy
508
+ QV('rpasswordPolicyCallout', true);
509
+ QH('rpasswordPolicyCallout', passwordPolicyText(Q('rapassword1').value));
510
+ } else {
511
+ QH('rpassWarning', '');
512
+ QV('rpasswordPolicyCallout', false);
513
+ }
514
+ }
515
+ }
516
+ if ((e != null) && (e.keyCode == 13)) {
517
+ if (box == 2) { Q('rapassword1').focus(); }
518
+ if (box == 3) { Q('rapassword2').focus(); }
519
+ if (box == 4) { Q('rapasswordhint').focus(); }
520
+ if (box == 6) { Q('resetPassButton').click(); }
521
+ }
522
+ if (e != null) { haltEvent(e); }
523
+ QE('resetPassButton', ok);
524
+ }
525
+
526
+ function validateReset(e) {
527
+ setDialogMode(0);
528
+ var x = validateEmail(Q('remail').value);
529
+ QE('eresetButton', x);
530
+ if ((e != null) && (e.keyCode == 13) && (x == true)) { Q('eresetButton').click(); }
531
+ if (e != null) { haltEvent(e); }
532
+ }
533
+
534
+ function passwordPolicyText(pass) {
535
+ var policy = '<div style=text-align:left>';
536
+ var counts = strCount(pass);
537
+ if (passRequirements.min && ((pass == null) || (pass.length < passRequirements.min))) { policy += format("Minimum length of {0}", passRequirements.min) + '<br />'; }
538
+ if (passRequirements.max && ((pass == null) || (pass.length > passRequirements.max))) { policy += format("Maximum length of {0}", passRequirements.max) + '<br />'; }
539
+ if (passRequirements.upper && ((pass == null) || (counts.upper < passRequirements.upper))) { policy += format("{0} upper case", passRequirements.upper) + '<br />'; }
540
+ if (passRequirements.lower && ((pass == null) || (counts.lower < passRequirements.lower))) { policy += format("{0} lower case", passRequirements.lower) + '<br />'; }
541
+ if (passRequirements.numeric && ((pass == null) || (counts.numeric < passRequirements.numeric))) { policy += format("{0} numeric", passRequirements.numeric) + '<br />'; }
542
+ if (passRequirements.nonalpha && ((pass == null) || (counts.nonalpha < passRequirements.nonalpha))) { policy += format("{0} non-alphanumeric", passRequirements.nonalpha) + '<br />'; }
543
+ policy += '</div>';
544
+ return policy;
545
+ }
546
+
547
+ // Return a password strength score
548
+ function checkPasswordStrength(password) {
549
+ var r = 0, letters = {}, varCount = 0, variations = { digits: /\d/.test(password), lower: /[a-z]/.test(password), upper: /[A-Z]/.test(password), nonWords: /\W/.test(password) }
550
+ if (!password) return 0;
551
+ for (var i = 0; i< password.length; i++) { letters[password[i]] = (letters[password[i]] || 0) + 1; r += 5.0 / letters[password[i]]; }
552
+ for (var c in variations) { varCount += (variations[c] == true) ? 1 : 0; }
553
+ return parseInt(r + (varCount - 1) * 10);
554
+ }
555
+
556
+ // Check password requirements
557
+ function checkPasswordRequirements(password, requirements) {
558
+ if ((requirements == null) || (requirements == '') || (typeof requirements != 'object')) return true;
559
+ if (requirements.min) { if (password.length < requirements.min) return false; }
560
+ if (requirements.max) { if (password.length > requirements.max) return false; }
561
+ var counts = strCount(password);
562
+ if (requirements.numeric && (counts.numeric < requirements.numeric)) return false;
563
+ if (requirements.lower && (counts.lower < requirements.lower)) return false;
564
+ if (requirements.upper && (counts.upper < requirements.upper)) return false;
565
+ if (requirements.nonalpha && (counts.nonalpha < requirements.nonalpha)) return false;
566
+ return true;
567
+ }
568
+
569
+ function strCount(password) {
570
+ var counts = { numeric: 0, lower: 0, upper: 0, nonalpha: 0 };
571
+ if (typeof password != 'string') return counts;
572
+ for (var i = 0; i < password.length; i++) {
573
+ if (/\d/.test(password[i])) { counts.numeric++; }
574
+ if (/[a-z]/.test(password[i])) { counts.lower++; }
575
+ if (/[A-Z]/.test(password[i])) { counts.upper++; }
576
+ if (/\W/.test(password[i])) { counts.nonalpha++; }
577
+ }
578
+ return counts;
579
+ }
580
+
581
+ var xcheckTokenTimer = null;
582
+ function checkTokenTimer(enter) {
583
+ if ((enter == 0) && (xcheckTokenTimer != null)) { clearInterval(xcheckTokenTimer); xcheckTokenTimer = null; }
584
+ if ((enter == 1) && (xcheckTokenTimer == null)) { xcheckTokenTimer = setInterval(checkToken, 200); }
585
+ }
586
+
587
+ function checkToken() {
588
+ var t1 = Q('tokenInput').value, t2 = t1.split(' ').join('');
589
+ if (t1 != t2) { Q('tokenInput').value = t2; }
590
+ QE('tokenOkButton', (Q('tokenInput').value.length == 6) || (Q('tokenInput').value.length == 8) || (Q('tokenInput').value.length == 44));
591
+ }
592
+
593
+ function resetCheckToken() {
594
+ var t1 = Q('resetTokenInput').value, t2 = t1.split(' ').join('');
595
+ if (t1 != t2) { Q('resetTokenInput').value = t2; }
596
+ QE('resetTokenOkButton', (Q('resetTokenInput').value.length == 6) || (Q('resetTokenInput').value.length == 8) || (Q('resetTokenInput').value.length == 44));
597
+ }
598
+
599
+ //
600
+ // POPUP DIALOG
601
+ //
602
+
603
+ // undefined = Hidden, 1 = Generic Message
604
+ var xxdialogMode;
605
+ var xxdialogFunc;
606
+ var xxdialogButtons;
607
+ var xxdialogTag;
608
+ var xxcurrentView = 0;
609
+
610
+ // Display a dialog box
611
+ // Parameters: Dialog Mode (0 = none), Dialog Title, Buttons (1 = OK, 2 = Cancel, 3 = OK & Cancel), Call back function(0 = Cancel, 1 = OK), Dialog Content (Mode 2 only)
612
+ function setDialogMode(x, y, b, f, c, tag) {
613
+ xxdialogMode = x;
614
+ xxdialogFunc = f;
615
+ xxdialogButtons = b;
616
+ xxdialogTag = tag;
617
+ QE('idx_dlgOkButton', true);
618
+ QV('idx_dlgOkButton', b & 1);
619
+ QV('idx_dlgCancelButton', b & 2);
620
+ QV('id_dialogclose', (b & 2) || (b & 8));
621
+ QV('idx_dlgButtonBar', b & 7);
622
+ if (y) QH('id_dialogtitle', y);
623
+ for (var i = 1; i < 24; i++) { QV('dialog' + i, i == x); } // Edit this line when more dialogs are added
624
+ QV('dialog', x);
625
+ if (c) { if (x == 2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage', c); } }
626
+ }
627
+
628
+ function dialogclose(x) {
629
+ var f = xxdialogFunc;
630
+ var b = xxdialogButtons;
631
+ var t = xxdialogTag;
632
+ setDialogMode();
633
+ if (((b & 8) || x) && f) f(x, t);
634
+ }
635
+
636
+ function center() { QS('dialog').left = ((((getDocWidth() - 400) / 2)) + 'px'); }
637
+ function messagebox(t, m) { QH('id_dialogMessage', m); setDialogMode(1, t, 1); }
638
+ function statusbox(t, m) { QH('id_dialogMessage', m); setDialogMode(1, t); }
639
+ 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; }
640
+ function haltEvent(e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
641
+ function haltReturn(e) { if (e.keyCode == 13) { haltEvent(e); } }
642
+ function validateEmail(v) { var emailReg = /^(([^<>()\[\]\\.,;:\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 emailReg.test(v); } // New version
643
+ function format(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); };
644
+
645
+ </script>
646
+
647
+</body></html>
\ No newline at end of file
views/translations/login_cs.handlebars
new
+725
@@ -0,0 +1,725 @@
1
+<!DOCTYPE html><html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head>
2
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
4
+ <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
5
+ <meta name="apple-mobile-web-app-capable" content="yes">
6
+ <meta name="format-detection" content="telephone=no">
7
+ <link rel="shortcut icon" type="image/x-icon" href="{{{domainurl}}}favicon.ico">
8
+ <link keeplink="1" type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS">
9
+ <script type="text/javascript" src="scripts/common-0.0.1.js"></script>
10
+ <script keeplink="1" type="text/javascript" src="scripts/u2f-api.js"></script>
11
+ <title>{{{title}}} - Login</title>
12
+</head>
13
+<body id="body" onload="if (typeof(startup) !== 'undefined') startup();" class="arg_hide login">
14
+ <div id="container">
15
+ <div id="masthead">
16
+ <div class="title">{{{title}}}</div>
17
+ <div class="title2">{{{title2}}}</div>
18
+ </div>
19
+ <div id="topbar" class="noselect style3" style="height:24px">
20
+ <div id="uiMenuButton" title="User interface selection" onclick="showUserInterfaceSelectMenu()">
21
+ ♦
22
+ <div id="uiMenu" style="display:none">
23
+ <div id="uiViewButton1" class="uiSelector" onclick="userInterfaceSelectMenu(1)" title="Left bar interface"><div class="uiSelector1"></div></div>
24
+ <div id="uiViewButton2" class="uiSelector" onclick="userInterfaceSelectMenu(2)" title="Top bar interface"><div class="uiSelector2"></div></div>
25
+ <div id="uiViewButton3" class="uiSelector" onclick="userInterfaceSelectMenu(3)" title="Fixed width interface"><div class="uiSelector3"></div></div>
26
+ <div id="uiViewButton4" class="uiSelector" onclick="toggleNightMode()" title="Toggle night mode"><div class="uiSelector4"></div></div>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ <div id="column_l">
31
+ <h1>Vítejte</h1>
32
+ <div id="welcomeText" style="display:none">Přihlašte se na různá svá nebo firemní zařízení odkudkoliv z celého světa <a href="http://www.meshcommander.com/meshcentral2">MeshCentral</a>. Jednoduchá správa přes web. Jediné co potřebujete je agent na daném zařízení. Po instalaci uvidíte zařízení v sekci "Moje zařízení" a můžete toto zařízení ovládat.</div>
33
+ <table id="centralTable" style="">
34
+ <tbody><tr>
35
+ <td id="welcomeimage">
36
+ <picture>
37
+ <img alt="" src="welcome.jpg" style="border-radius:20px">
38
+ </picture>
39
+ </td>
40
+ <td id="logincell">
41
+ <div id="loginpanel" style="display:none">
42
+ <form method="post">
43
+ <input type="hidden" name="action" value="login">
44
+ <div id="message1"></div>
45
+ <div>
46
+ <b>Přihlásit</b>
47
+ </div>
48
+ <table>
49
+ <tbody><tr>
50
+ <td id="loginusername" align="right" width="100">Uživatel:</td>
51
+ <td><input id="username" type="text" maxlength="64" name="username" onchange="validateLogin(1)" onkeyup="validateLogin(1,event)"></td>
52
+ </tr>
53
+ <tr>
54
+ <td align="right">Heslo:</td>
55
+ <td><input id="password" type="password" maxlength="256" name="password" autocomplete="off" onchange="validateLogin(2)" onkeyup="validateLogin(2,event)"></td>
56
+ </tr>
57
+ <tr>
58
+ <td><div id="showPassHintLink" style="display:none"><a onclick="return showPassHint(event);" href="#" style="cursor:pointer">Show Hint</a></div></td>
59
+ <td align="right"><input id="loginButton" type="submit" value="Přihlásit" disabled="disabled"></td>
60
+ </tr>
61
+ </tbody></table>
62
+ <div id="hrAccountDiv" style="display:none"><hr></div>
63
+ <div id="resetAccountDiv" style="display:none;padding:2px">
64
+ <span id="resetAccountSpan">Forgot username/password?</span> <a onclick="return xgo(3,event);" href="#" style="cursor:pointer">Reset účtu</a>.
65
+ </div>
66
+ <div id="newAccountDiv" style="display:none;padding:2px">
67
+ Nemáte účet? <a onclick="return xgo(2,event);" href="#" style="cursor:pointer">Vytvořit</a>.
68
+ </div>
69
+ <input id="loginformargs" name="urlargs" type="hidden" value="">
70
+ </form>
71
+ </div>
72
+ <div id="createpanel" style="display:none;position:relative">
73
+ <form method="post">
74
+ <input type="hidden" name="action" value="createaccount">
75
+ <div id="message2"></div>
76
+ <div>
77
+ <b>Account Creation</b>
78
+ </div>
79
+ <div id="passwordPolicyCallout" style="display:none"></div>
80
+ <table>
81
+ <tbody><tr id="nuUserRow">
82
+ <td id="nuUser" align="right" width="100">Uživatel:</td>
83
+ <td><input id="ausername" type="text" name="username" onchange="validateCreate(1)" maxlength="64" onkeydown="haltReturn(event)" onkeyup="validateCreate(1,event)"></td>
84
+ </tr>
85
+ <tr>
86
+ <td id="nuEmail" align="right" width="100">Email:</td>
87
+ <td><input id="aemail" type="text" name="email" onchange="validateCreate(2)" maxlength="256" onkeydown="haltReturn(event)" onkeyup="validateCreate(2,event)"></td>
88
+ </tr>
89
+ <tr>
90
+ <td id="nuPass1" align="right">Heslo:</td>
91
+ <td><input id="apassword1" type="password" name="password1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(3,event)" onkeyup="validateCreate(3,event)"></td>
92
+ </tr>
93
+ <tr>
94
+ <td id="nuPass2" align="right">Heslo:</td>
95
+ <td><input id="apassword2" type="password" name="password2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(4,event)" onkeyup="validateCreate(4,event)"></td>
96
+ </tr>
97
+ <tr id="createPanelHint" style="display:none">
98
+ <td id="nuHint" align="right">Password Hint:</td>
99
+ <td><input id="apasswordhint" type="text" name="apasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(5,event)" onkeyup="validateCreate(5,event)"></td>
100
+ </tr>
101
+ <tr id="newAccountPass" title="Enter the account creation token">
102
+ <td id="nuToken" align="right">Creation Token:</td>
103
+ <td><input id="anewaccountpass" type="password" name="anewaccountpass" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(6,event)" onkeyup="validateCreate(6,event)"></td>
104
+ </tr>
105
+ <tr>
106
+ <td colspan="2">
107
+ <div style="float:right"><input id="createButton" type="submit" value="Create Account" disabled="disabled"></div>
108
+ <div id="passWarning" style="padding-top:6px"></div>
109
+ </td>
110
+ </tr>
111
+ </tbody></table>
112
+ <hr><a onclick="return xgo(1,event);" href="#" style="cursor:pointer">Back to login</a>
113
+ <input id="createformargs" name="urlargs" type="hidden" value="">
114
+ </form>
115
+ </div>
116
+ <div id="resetpanel" style="display:none">
117
+ <form method="post">
118
+ <input type="hidden" name="action" value="resetaccount">
119
+ <div id="message3"></div>
120
+ <div>
121
+ <b>Reset hesla</b>
122
+ </div>
123
+ <table>
124
+ <tbody><tr>
125
+ <td align="right" width="100">Email:</td>
126
+ <td><input id="remail" type="text" name="email" maxlength="256" onchange="validateReset()" onkeyup="validateReset(event)"></td>
127
+ </tr>
128
+ <tr>
129
+ <td colspan="2">
130
+ <div style="float:right"><input id="eresetButton" type="submit" value="Reset účtu" disabled="disabled"></div>
131
+ <div id="passWarning" style="padding-top:6px"></div>
132
+ </td>
133
+ </tr>
134
+ </tbody></table>
135
+ <hr><a onclick="return xgo(1,event);" href="#" style="cursor:pointer">Back to login</a>
136
+ <input id="resetformargs" name="urlargs" type="hidden" value="">
137
+ </form>
138
+ </div>
139
+ <div id="tokenpanel" style="display:none">
140
+ <form method="post" autocomplete="off">
141
+ <input type="hidden" name="action" value="tokenlogin">
142
+ <input type="hidden" name="hwstate" value="{{{hwstate}}}">
143
+ <div id="message4"></div>
144
+ <table>
145
+ <tbody><tr>
146
+ <td align="right" width="100">Login token:</td>
147
+ <td>
148
+ <input id="tokenInput" type="text" name="token" maxlength="50" onchange="checkToken(event)" onpaste="resetCheckToken(event)" onkeyup="checkToken(event)" onkeydown="checkToken(event)"><br>
149
+ <input id="hwtokenInput" type="text" name="hwtoken" style="display:none">
150
+ </td>
151
+ </tr>
152
+ <tr>
153
+ <td colspan="2" style="align-content:center">
154
+ <label><input id="tokenInputRemember" name="remembertoken" type="checkbox">Remember this device for 30 days.</label>
155
+ </td>
156
+ </tr>
157
+ <tr>
158
+ <td colspan="2">
159
+ <div style="float:right"><input id="tokenOkButton" type="submit" value="Login" disabled="disabled"></div>
160
+ <div style="float:right"><input style="display:none;float:right" id="securityKeyButton" type="button" value="Use Security Key" onclick="useSecurityKey()"></div>
161
+ </td>
162
+ </tr>
163
+ </tbody></table>
164
+ <hr><a onclick="return xgo(1,event);" href="#" style="cursor:pointer">Back to login</a>
165
+ <input id="tokenformargs" name="urlargs" type="hidden" value="">
166
+ </form>
167
+ </div>
168
+ <div id="resettokenpanel" style="display:none">
169
+ <form method="post">
170
+ <input type="hidden" name="action" value="resetaccount">
171
+ <div id="message5"></div>
172
+ <table>
173
+ <tbody><tr>
174
+ <td align="right" width="100">Login token:</td>
175
+ <td>
176
+ <input id="resetTokenInput" type="text" name="token" maxlength="50" onchange="resetCheckToken(event)" onkeyup="resetCheckToken(event)" onkeydown="resetCheckToken(event)">
177
+ <input id="resetHwtokenInput" type="text" name="hwtoken" style="display:none">
178
+ </td>
179
+ </tr>
180
+ <tr>
181
+ <td colspan="2">
182
+ <div style="float:right"><input id="resetTokenOkButton" type="submit" value="Login" disabled="disabled"></div>
183
+ </td>
184
+ </tr>
185
+ </tbody></table>
186
+ <hr><a onclick="return xgo(1,event);" href="#" style="cursor:pointer">Back to login</a>
187
+ <input id="resettokenformargs" name="urlargs" type="hidden" value="">
188
+ </form>
189
+ </div>
190
+ <div id="resetpasswordpanel" style="display:none;position:relative">
191
+ <form method="post">
192
+ <input type="hidden" name="action" value="resetpassword">
193
+ <div id="message6"></div>
194
+ <div id="rpasswordPolicyCallout" style="display:none"></div>
195
+ <table>
196
+ <tbody><tr>
197
+ <td id="rnuPass1" width="100" align="right">Heslo:</td>
198
+ <td><input id="rapassword1" type="password" name="rpassword1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(3,event)" onkeyup="validatePassReset(3,event)"></td>
199
+ </tr>
200
+ <tr>
201
+ <td id="rnuPass2" align="right">Heslo:</td>
202
+ <td><input id="rapassword2" type="password" name="rpassword2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(4,event)" onkeyup="validatePassReset(4,event)"></td>
203
+ </tr>
204
+ <tr id="resetpasswordpanelHint" style="display:none">
205
+ <td id="rnuHint" align="right">Password Hint:</td>
206
+ <td><input id="rapasswordhint" type="text" name="rpasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(5,event)" onkeyup="validatePassReset(5,event)"></td>
207
+ </tr>
208
+ <tr>
209
+ <td colspan="2">
210
+ <div style="float:right"><input id="resetPassButton" type="submit" value="Reset hesla" disabled="disabled"></div>
211
+ <div id="rpassWarning" style="padding-top:6px"></div>
212
+ </td>
213
+ </tr>
214
+ </tbody></table>
215
+ <hr><a onclick="return xgo(1,event);" href="#" style="cursor:pointer">Back to login</a>
216
+ <input id="resetpasswordformargs" name="urlargs" type="hidden" value="">
217
+ </form>
218
+ </div>
219
+ </td>
220
+ </tr>
221
+ </tbody></table>
222
+ <br>
223
+ </div>
224
+ <div id="footer">
225
+ <div class="footer1">{{{footer}}}</div>
226
+ <div class="footer2">
227
+ {{{rootCertLink}}}
228
+ <a href="terms">Terms & Privacy</a>
229
+ </div>
230
+ </div>
231
+
232
+ </div>
233
+ <div id="dialog" style="display:none">
234
+ <div id="dialogHeader">
235
+ <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div>
236
+ <div id="id_dialogtitle" style="padding:5px"></div>
237
+ <div style="width:100%;margin:6px"></div>
238
+ </div>
239
+ <div id="dialogBody">
240
+ <div id="dialog1">
241
+ <div id="id_dialogMessage" style=""></div>
242
+ </div>
243
+ <div id="dialog2" style="">
244
+ <div id="id_dialogOptions"></div>
245
+ </div>
246
+ </div>
247
+ <div id="idx_dlgButtonBar" style="">
248
+ <input id="idx_dlgCancelButton" type="button" value="Zrušit" style="" onclick="dialogclose(0)">
249
+ <input id="idx_dlgOkButton" type="button" value="OK" style="" onclick="dialogclose(1)">
250
+ </div>
251
+ </div>
252
+ <script>
253
+ 'use strict';
254
+ var passhint = '{{{passhint}}}';
255
+ var loginMode = '{{{loginmode}}}';
256
+ var newAccount = '{{{newAccount}}}';
257
+ var newAccountPass = parseInt('{{{newAccountPass}}}');
258
+ var emailCheck = ('{{{emailcheck}}}' == 'true');
259
+ var passRequirements = '{{{passRequirements}}}';
260
+ var hardwareKeyChallenge = decodeURIComponent('{{{hkey}}}');
261
+ if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); } else { passRequirements = {}; }
262
+ var passRequirementsEx = ((passRequirements.min != null) || (passRequirements.max != null) || (passRequirements.upper != null) || (passRequirements.lower != null) || (passRequirements.numeric != null) || (passRequirements.nonalpha != null));
263
+ var features = parseInt('{{{features}}}');
264
+ var welcomeText = decodeURIComponent('{{{welcometext}}}');
265
+ var currentpanel = 0;
266
+ var uiMode = parseInt(getstore('uiMode', '1'));
267
+ var webPageFullScreen = true;
268
+ var nightMode = (getstore('_nightMode', '0') == '1');
269
+ var publicKeyCredentialRequestOptions = null;
270
+
271
+ // Display the right server message
272
+ var messageid = parseInt('{{{messageid}}}');
273
+ var okmessages = ['', "Hold on, reset mail sent."];
274
+ var failmessages = ["Unable to create account.", "Account limit reached.", "Existing account with this email address.", "Invalid account creation token.", "Username already exists.", "Password rejected, use a different one.", "Invalid email.", "Account not found.", "Invalid token, try again.", "Unable to sent email.", "Account locked.", "Access denied.", "Login failed, check username and password.", "Password change requested.", "IP address blocked, try again later."];
275
+ if (messageid > 0) {
276
+ var msg = '';
277
+ if ((messageid < 100) && (messageid < okmessages.length)) { msg = okmessages[messageid]; }
278
+ else if ((messageid >= 100) && ((messageid - 100) < failmessages.length)) { msg = failmessages[messageid - 100]; }
279
+ if (msg != '') {
280
+ if (messageid >= 100) { msg = ('<span class="msg error"><b style=color:#8C001A>' + msg + '<b></span><br /><br />'); } else { msg = ('<span class="msg success"><b>' + msg + '</b></span><br /><br />'); }
281
+ for (var i = 1; i < 7; i++) { QH('message' + i, msg); }
282
+ }
283
+ }
284
+
285
+ // If URL arguments are provided, add them to form posts
286
+ if (window.location.href.indexOf('?') > 0) {
287
+ var urlargs = window.location.href.substring(window.location.href.indexOf('?'));
288
+ Q('loginformargs').value = urlargs;
289
+ Q('createformargs').value = urlargs;
290
+ Q('resetformargs').value = urlargs;
291
+ Q('tokenformargs').value = urlargs;
292
+ Q('resettokenformargs').value = urlargs;
293
+ Q('resetpasswordformargs').value = urlargs;
294
+ }
295
+
296
+ //var webPageFullScreen = getstore('webPageFullScreen', true);
297
+ //if (webPageFullScreen == 'false') { webPageFullScreen = false; }
298
+ //if (webPageFullScreen == 'true') { webPageFullScreen = true; }
299
+ //toggleFullScreen();
300
+
301
+ function startup() {
302
+ if ((features & 32) == 0) {
303
+ // Guard against other site's top frames (web bugs).
304
+ var loc = null;
305
+ try { loc = top.location.toString().toLowerCase(); } catch (e) { }
306
+ if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; }
307
+ }
308
+
309
+ if (features & 0x200000) { // Email is username
310
+ QH('loginusername', "Email:");
311
+ QH('resetAccountSpan', "Zapomenuté heslo?");
312
+ QV('nuUserRow', false);
313
+ }
314
+
315
+ if (nightMode) { QC('body').add('night'); }
316
+
317
+ QV('createPanelHint', passRequirements.hint === true);
318
+ QV('resetpasswordpanelHint', passRequirements.hint === true);
319
+
320
+ // Display the welcome text
321
+ if (welcomeText) { QH('welcomeText', welcomeText); }
322
+ QV('welcomeText', true);
323
+
324
+ window.onresize = center;
325
+ center();
326
+
327
+ validateLogin();
328
+ validateCreate();
329
+ if (loginMode.length != 0) { go(parseInt(loginMode)); } else { go(1); }
330
+ QV('newAccountDiv', (newAccount === '1') || (newAccount === 'true')); // If new accounts are not allowed, don't display the new account link.
331
+ if ((passhint != null) && (passhint.length > 0)) { QV('showPassHintLink', true); }
332
+ QV('newAccountPass', (newAccountPass == 1));
333
+ QV('resetAccountDiv', (emailCheck == true));
334
+ QV('hrAccountDiv', (emailCheck == true) || (newAccountPass == 1));
335
+
336
+ if (loginMode == '4') {
337
+ try { if (hardwareKeyChallenge.length > 0) { hardwareKeyChallenge = JSON.parse(hardwareKeyChallenge); } else { hardwareKeyChallenge = null; } } catch (ex) { hardwareKeyChallenge = null }
338
+ QV('securityKeyButton', (hardwareKeyChallenge != null) && (hardwareKeyChallenge.type == 'webAuthn'));
339
+ }
340
+
341
+ if (loginMode == '5') {
342
+ try { if (hardwareKeyChallenge.length > 0) { hardwareKeyChallenge = JSON.parse(hardwareKeyChallenge); } else { hardwareKeyChallenge = null; } } catch (ex) { hardwareKeyChallenge = null }
343
+ if ((hardwareKeyChallenge != null) && (hardwareKeyChallenge.type == 'webAuthn')) {
344
+ if (typeof hardwareKeyChallenge.challenge == 'string') { hardwareKeyChallenge.challenge = Uint8Array.from(atob(hardwareKeyChallenge.challenge), function (c) { return c.charCodeAt(0) }).buffer; }
345
+
346
+ publicKeyCredentialRequestOptions = { challenge: hardwareKeyChallenge.challenge, allowCredentials: [], timeout: hardwareKeyChallenge.timeout }
347
+ for (var i = 0; i < hardwareKeyChallenge.keyIds.length; i++) {
348
+ publicKeyCredentialRequestOptions.allowCredentials.push(
349
+ { id: Uint8Array.from(atob(hardwareKeyChallenge.keyIds[i]), function (c) { return c.charCodeAt(0) }), type: 'public-key', transports: ['usb', 'ble', 'nfc'], }
350
+ );
351
+ }
352
+
353
+ // New WebAuthn hardware keys
354
+ navigator.credentials.get({ publicKey: publicKeyCredentialRequestOptions }).then(
355
+ function (rawAssertion) {
356
+ var assertion = {
357
+ id: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.rawId))),
358
+ clientDataJSON: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.clientDataJSON))),
359
+ userHandle: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.userHandle))),
360
+ signature: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.signature))),
361
+ authenticatorData: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.authenticatorData))),
362
+ };
363
+ Q('resetHwtokenInput').value = JSON.stringify(assertion);
364
+ QE('resetTokenOkButton', true);
365
+ Q('resetTokenOkButton').click();
366
+ },
367
+ function (error) { console.log('credentials-get error', error); }
368
+ );
369
+ }
370
+ }
371
+
372
+ // Setup the user interface in the right mode
373
+ userInterfaceSelectMenu();
374
+ }
375
+
376
+ // Use a hardware security key
377
+ function useSecurityKey() {
378
+ if ((hardwareKeyChallenge != null) && (hardwareKeyChallenge.type == 'webAuthn')) {
379
+ if (typeof hardwareKeyChallenge.challenge == 'string') { hardwareKeyChallenge.challenge = Uint8Array.from(atob(hardwareKeyChallenge.challenge), function (c) { return c.charCodeAt(0) }).buffer; }
380
+
381
+ publicKeyCredentialRequestOptions = { challenge: hardwareKeyChallenge.challenge, allowCredentials: [], timeout: hardwareKeyChallenge.timeout }
382
+ for (var i = 0; i < hardwareKeyChallenge.keyIds.length; i++) {
383
+ publicKeyCredentialRequestOptions.allowCredentials.push(
384
+ { id: Uint8Array.from(atob(hardwareKeyChallenge.keyIds[i]), function (c) { return c.charCodeAt(0) }), type: 'public-key', transports: ['usb', 'ble', 'nfc'], }
385
+ );
386
+ }
387
+
388
+ // New WebAuthn hardware keys
389
+ navigator.credentials.get({ publicKey: publicKeyCredentialRequestOptions }).then(
390
+ function (rawAssertion) {
391
+ var assertion = {
392
+ id: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.rawId))),
393
+ clientDataJSON: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.clientDataJSON))),
394
+ userHandle: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.userHandle))),
395
+ signature: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.signature))),
396
+ authenticatorData: btoa(String.fromCharCode.apply(null, new Uint8Array(rawAssertion.response.authenticatorData))),
397
+ };
398
+ Q('hwtokenInput').value = JSON.stringify(assertion);
399
+ QE('tokenOkButton', true);
400
+ Q('tokenOkButton').click();
401
+ },
402
+ function (error) { console.log('credentials-get error', error); }
403
+ );
404
+ }
405
+ }
406
+
407
+ function showPassHint(e) {
408
+ messagebox("Password Hint", passhint);
409
+ haltEvent(e);
410
+ return false;
411
+ }
412
+
413
+ function xgo(x, e) {
414
+ QV('message1', false);
415
+ QV('message2', false);
416
+ QV('message3', false);
417
+ QV('message4', false);
418
+ QV('message5', false);
419
+ QV('message6', false);
420
+ go(x);
421
+ haltEvent(e);
422
+ return false;
423
+ }
424
+
425
+ function go(x) {
426
+ currentpanel = x;
427
+ setDialogMode(0);
428
+ QV('showPassHintLink', false);
429
+ QV('loginpanel', x == 1);
430
+ QV('createpanel', x == 2);
431
+ QV('resetpanel', x == 3);
432
+ QV('tokenpanel', x == 4);
433
+ QV('resettokenpanel', x == 5);
434
+ QV('resetpasswordpanel', x == 6);
435
+ if (x == 1) { Q('username').focus(); }
436
+ if (x == 2) { if (features & 0x200000) { Q('aemail').focus(); } else { Q('ausername').focus(); } } // Email is username
437
+ if (x == 3) { Q('remail').focus(); }
438
+ if (x == 4) { Q('tokenInput').focus(); }
439
+ if (x == 5) { Q('resetTokenInput').focus(); }
440
+ if (x == 6) { Q('rapassword1').focus(); }
441
+ }
442
+
443
+ function validateLogin(box, e) {
444
+ var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0));
445
+ QE('loginButton', ok);
446
+ setDialogMode(0);
447
+ if ((e != null) && (e.keyCode == 13)) { if ((box == 1) && (Q('username').value != '')) { Q('password').focus(); } else if ((box == 2) && (Q('password').value != '')) { Q('loginButton').click(); } }
448
+ if (e != null) { haltEvent(e); }
449
+ }
450
+
451
+ function validateCreate(box, e) {
452
+ setDialogMode(0);
453
+ var userok = false;
454
+ if (features & 0x200000) { userok = true; } else { userok = (Q('ausername').value.length > 0) && (Q('ausername').value.indexOf(' ') == -1) && (Q('ausername').value.indexOf('"') == -1) && (Q('ausername').value.indexOf(',') == -1); }
455
+ var emailok = (validateEmail(Q('aemail').value) == true);
456
+ var pass1ok = (Q('apassword1').value.length > 0);
457
+ var pass2ok = (Q('apassword2').value.length > 0) && (Q('apassword2').value == Q('apassword1').value);
458
+ var newAccOk = (newAccountPass == 0) || (Q('anewaccountpass').value.length > 0);
459
+ var ok = (userok && emailok && pass1ok && pass2ok && newAccOk);
460
+
461
+ // Color the fields
462
+ QS('nuUser').color = userok?'black':'#7b241c';
463
+ QS('nuEmail').color = emailok?'black':'#7b241c';
464
+ QS('nuPass1').color = pass1ok?'black':'#7b241c';
465
+ QS('nuPass2').color = pass2ok?'black':'#7b241c';
466
+ QS('nuToken').color = newAccOk?'black':'#7b241c';
467
+
468
+ if (Q('apassword1').value == '') {
469
+ QH('passWarning', '');
470
+ QV('passwordPolicyCallout', false);
471
+ } else {
472
+ if (!passRequirementsEx) {
473
+ // No password requirements, display password strength
474
+ var passStrength = checkPasswordStrength(Q('apassword1').value);
475
+ if (passStrength >= 80) { QH('passWarning', '<span style=color:green><b>' + "Silné heslo" + '</b><span>'); }
476
+ else if (passStrength >= 60) { QH('passWarning', '<span style=color:blue><b>' + "Dobré heslo" + '</b><span>'); }
477
+ else { QH('passWarning', '<span style=color:red><b>' + "Slabé heslo" + '</b><span>'); }
478
+ } else {
479
+ // Password requirements provided, use that
480
+ var passReq = checkPasswordRequirements(Q('apassword1').value, passRequirements);
481
+ if (passReq == false) {
482
+ ok = false;
483
+ QS('nuPass1').color = '#7b241c';
484
+ QS('nuPass2').color = '#7b241c';
485
+ QH('passWarning', '<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>' + "Password Policy" + '</b><div>'); // This is also a link to the password policy
486
+ QV('passwordPolicyCallout', true);
487
+ QH('passwordPolicyCallout', passwordPolicyText(Q('apassword1').value));
488
+ } else {
489
+ QH('passWarning', '');
490
+ QV('passwordPolicyCallout', false);
491
+ }
492
+ }
493
+ }
494
+ if ((e != null) && (e.keyCode == 13)) {
495
+
496
+ if ((box == 1) && userok) { Q('aemail').focus(); }
497
+ if ((box == 2) && emailok) { Q('apassword1').focus(); }
498
+ if ((box == 3) && pass1ok) { Q('apassword2').focus(); }
499
+ if ((box == 4) && pass2ok) { if (passRequirements.hint === true) { Q('apasswordhint').focus(); } else { box = 5; } }
500
+ if (box == 5) { if (newAccountPass == 1) { Q('anewaccountpass').focus(); } else { box = 6; } }
501
+ if (box == 6) { Q('createButton').click(); }
502
+ }
503
+ if (e != null) { haltEvent(e); }
504
+ QE('createButton', ok);
505
+ }
506
+
507
+ function validatePassReset(box, e) {
508
+ setDialogMode(0);
509
+ var pass1ok = (Q('rapassword1').value.length > 0);
510
+ var pass2ok = (Q('rapassword2').value.length > 0) && (Q('rapassword2').value == Q('rapassword1').value);
511
+ var ok = (pass1ok && pass2ok);
512
+
513
+ // Color the fields
514
+ QS('rnuPass1').color = pass1ok ? 'black' : '#7b241c';
515
+ QS('rnuPass2').color = pass2ok ? 'black' : '#7b241c';
516
+
517
+ if (Q('rapassword1').value == '') {
518
+ QH('rpassWarning', '');
519
+ QV('rpasswordPolicyCallout', false);
520
+ } else {
521
+ if (!passRequirementsEx) {
522
+ // No password requirements, display password strength
523
+ var passStrength = checkPasswordStrength(Q('rapassword1').value);
524
+ if (passStrength >= 80) { QH('rpassWarning', '<span style=color:green><b>' + "Silné heslo" + '</b><span>'); }
525
+ else if (passStrength >= 60) { QH('rpassWarning', '<span style=color:blue><b>' + "Dobré heslo" + '</b><span>'); }
526
+ else { QH('rpassWarning', '<span style=color:red><b>' + "Slabé heslo" + '</b><span>'); }
527
+ } else {
528
+ // Password requirements provided, use that
529
+ var passReq = checkPasswordRequirements(Q('rapassword1').value, passRequirements);
530
+ if (passReq == false) {
531
+ ok = false;
532
+ QS('rnuPass1').color = '#7b241c';
533
+ QS('rnuPass2').color = '#7b241c';
534
+ QH('rpassWarning', '<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>' + "Password Policy" + '</b><div>'); // This is also a link to the password policy
535
+ QV('rpasswordPolicyCallout', true);
536
+ QH('rpasswordPolicyCallout', passwordPolicyText(Q('rapassword1').value));
537
+ } else {
538
+ QH('rpassWarning', '');
539
+ QV('rpasswordPolicyCallout', false);
540
+ }
541
+ }
542
+ }
543
+ if ((e != null) && (e.keyCode == 13)) {
544
+ if (box == 2) { Q('rapassword1').focus(); }
545
+ if (box == 3) { Q('rapassword2').focus(); }
546
+ if (box == 4) { Q('rapasswordhint').focus(); }
547
+ if (box == 6) { Q('resetPassButton').click(); }
548
+ }
549
+ if (e != null) { haltEvent(e); }
550
+ QE('resetPassButton', ok);
551
+ }
552
+
553
+ function passwordPolicyText(pass) {
554
+ var policy = '<div style=text-align:left>';
555
+ var counts = strCount(pass);
556
+ if (passRequirements.min && ((pass == null) || (pass.length < passRequirements.min))) { policy += format("Minimum length of {0}", passRequirements.min) + '<br />'; }
557
+ if (passRequirements.max && ((pass == null) || (pass.length > passRequirements.max))) { policy += format("Maximum length of {0}", passRequirements.max) + '<br />'; }
558
+ if (passRequirements.upper && ((pass == null) || (counts.upper < passRequirements.upper))) { policy += format("{0} upper case", passRequirements.upper) + '<br />'; }
559
+ if (passRequirements.lower && ((pass == null) || (counts.lower < passRequirements.lower))) { policy += format("{0} lower case", passRequirements.lower) + '<br />'; }
560
+ if (passRequirements.numeric && ((pass == null) || (counts.numeric < passRequirements.numeric))) { policy += format("{0} numeric", passRequirements.numeric) + '<br />'; }
561
+ if (passRequirements.nonalpha && ((pass == null) || (counts.nonalpha < passRequirements.nonalpha))) { policy += format("{0} non-alphanumeric", passRequirements.nonalpha) + '<br />'; }
562
+ policy += '</div>';
563
+ return policy;
564
+ }
565
+
566
+ function showPasswordPolicy() {
567
+ messagebox("Password Policy", passwordPolicyText());
568
+ }
569
+
570
+ function validateReset(e) {
571
+ setDialogMode(0);
572
+ var x = validateEmail(Q('remail').value);
573
+ QE('eresetButton', x);
574
+ if ((e != null) && (e.keyCode == 13) && (x == true)) {
575
+ Q('eresetButton').click();
576
+ }
577
+ if (e != null) { haltEvent(e); }
578
+ }
579
+
580
+ // Return a password strength score
581
+ function checkPasswordStrength(password) {
582
+ var r = 0, letters = {}, varCount = 0, variations = { digits: /\d/.test(password), lower: /[a-z]/.test(password), upper: /[A-Z]/.test(password), nonWords: /\W/.test(password) }
583
+ if (!password) return 0;
584
+ for (var i = 0; i< password.length; i++) { letters[password[i]] = (letters[password[i]] || 0) + 1; r += 5.0 / letters[password[i]]; }
585
+ for (var c in variations) { varCount += (variations[c] == true) ? 1 : 0; }
586
+ return parseInt(r + (varCount - 1) * 10);
587
+ }
588
+
589
+ // Check password requirements
590
+ function checkPasswordRequirements(password, requirements) {
591
+ if ((requirements == null) || (requirements == '') || (typeof requirements != 'object')) return true;
592
+ if (requirements.min) { if (password.length < requirements.min) return false; }
593
+ if (requirements.max) { if (password.length > requirements.max) return false; }
594
+ var counts = strCount(password);
595
+ if (requirements.numeric && (counts.numeric < requirements.numeric)) return false;
596
+ if (requirements.lower && (counts.lower < requirements.lower)) return false;
597
+ if (requirements.upper && (counts.upper < requirements.upper)) return false;
598
+ if (requirements.nonalpha && (counts.nonalpha < requirements.nonalpha)) return false;
599
+ return true;
600
+ }
601
+
602
+ function strCount(password) {
603
+ var counts = { numeric: 0, lower: 0, upper: 0, nonalpha: 0 };
604
+ if (typeof password != 'string') return counts;
605
+ for (var i = 0; i < password.length; i++) {
606
+ if (/\d/.test(password[i])) { counts.numeric++; }
607
+ if (/[a-z]/.test(password[i])) { counts.lower++; }
608
+ if (/[A-Z]/.test(password[i])) { counts.upper++; }
609
+ if (/\W/.test(password[i])) { counts.nonalpha++; }
610
+ }
611
+ return counts;
612
+ }
613
+
614
+ function checkToken() {
615
+ var t1 = Q('tokenInput').value;
616
+ var t2 = t1.split(' ').join('');
617
+ if (t1 != t2) { Q('tokenInput').value = t2; }
618
+ QE('tokenOkButton', (Q('tokenInput').value.length == 6) || (Q('tokenInput').value.length == 8) || (Q('tokenInput').value.length == 44));
619
+ }
620
+
621
+ function resetCheckToken() {
622
+ var t1 = Q('resetTokenInput').value;
623
+ var t2 = t1.split(' ').join('');
624
+ if (t1 != t2) { Q('resetTokenInput').value = t2; }
625
+ QE('resetTokenOkButton', (Q('resetTokenInput').value.length == 6) || (Q('resetTokenInput').value.length == 8) || (Q('resetTokenInput').value.length == 44));
626
+ }
627
+
628
+ //
629
+ // POPUP DIALOG
630
+ //
631
+
632
+ // undefined = Hidden, 1 = Generic Message
633
+ var xxdialogMode;
634
+ var xxdialogFunc;
635
+ var xxdialogButtons;
636
+ var xxdialogTag;
637
+ var xxcurrentView = 0;
638
+
639
+ // Display a dialog box
640
+ // Parameters: Dialog Mode (0 = none), Dialog Title, Buttons (1 = OK, 2 = Cancel, 3 = OK & Cancel), Call back function(0 = Cancel, 1 = OK), Dialog Content (Mode 2 only)
641
+ function setDialogMode(x, y, b, f, c, tag) {
642
+ xxdialogMode = x;
643
+ xxdialogFunc = f;
644
+ xxdialogButtons = b;
645
+ xxdialogTag = tag;
646
+ QE('idx_dlgOkButton', true);
647
+ QV('idx_dlgOkButton', b & 1);
648
+ QV('idx_dlgCancelButton', b & 2);
649
+ QV('id_dialogclose', (b & 2) || (b & 8));
650
+ QV('idx_dlgButtonBar', b & 7);
651
+ if (y) QH('id_dialogtitle', y);
652
+ for (var i = 1; i < 24; i++) { QV('dialog' + i, i == x); } // Edit this line when more dialogs are added
653
+ QV('dialog', x);
654
+ if (c) { if (x == 2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage', c); } }
655
+ }
656
+
657
+ function dialogclose(x) {
658
+ var f = xxdialogFunc;
659
+ var b = xxdialogButtons;
660
+ var t = xxdialogTag;
661
+ setDialogMode();
662
+ if (((b & 8) || x) && f) f(x, t);
663
+ }
664
+
665
+ // Toggle the web page to full screen
666
+ function toggleFullScreen(toggle) {
667
+ //if (toggle === 1) { webPageFullScreen = !webPageFullScreen; putstore('webPageFullScreen', webPageFullScreen); }
668
+ if (webPageFullScreen == false) {
669
+ // By adding body class, it will change a style of all ellements using CSS selector
670
+ // No need for JS anymore and it will be consistent style for all the templates.
671
+ QC('body').remove('fullscreen');
672
+ } else {
673
+ QC('body').add('fullscreen');
674
+ }
675
+ QV('body', true);
676
+ center();
677
+ }
678
+
679
+ // Toggle user interface menu
680
+ function showUserInterfaceSelectMenu() {
681
+ Q('uiViewButton1').classList.remove('uiSelectorSel');
682
+ Q('uiViewButton2').classList.remove('uiSelectorSel');
683
+ Q('uiViewButton3').classList.remove('uiSelectorSel');
684
+ try { Q('uiViewButton' + uiMode).classList.add('uiSelectorSel'); } catch (ex) { }
685
+ QV('uiMenu', (QS('uiMenu').display == 'none'));
686
+ if (nightMode) { Q('uiViewButton4').classList.add('uiSelectorSel'); }
687
+ }
688
+
689
+ function userInterfaceSelectMenu(s) {
690
+ if (s) { uiMode = s; putstore('uiMode', uiMode); }
691
+ webPageFullScreen = (uiMode < 3);
692
+ //webPageStackMenu = (uiMode > 1);
693
+ toggleFullScreen(0);
694
+ //toggleStackMenu(0);
695
+ }
696
+
697
+ function toggleNightMode() {
698
+ nightMode = !nightMode;
699
+ if (nightMode) { QC('body').add('night'); } else { QC('body').remove('night'); }
700
+ putstore('_nightMode', (nightMode ? '1' : '0'));
701
+ }
702
+
703
+ function center() {
704
+ /* Now we use CSS media to achive the same effect as deleted JS */
705
+ if (webPageFullScreen == false) {
706
+ QS('centralTable')['margin-top'] = '';
707
+ } else {
708
+ var h = ((Q('column_l').clientHeight) / 2) - 220;
709
+ if (h < 0) h = 0;
710
+ QS('centralTable')['margin-top'] = h + 'px';
711
+ }
712
+ }
713
+ function messagebox(t, m) { QH('id_dialogMessage', m); setDialogMode(1, t, 1); }
714
+ function statusbox(t, m) { QH('id_dialogMessage', m); setDialogMode(1, t); }
715
+ 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; }
716
+ function haltEvent(e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
717
+ function haltReturn(e) { if (e.keyCode == 13) { haltEvent(e); } }
718
+ function validateEmail(v) { var emailReg = /^(([^<>()\[\]\\.,;:\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 emailReg.test(v); } // New version
719
+ function putstore(name, val) { try { if (typeof (localStorage) === 'undefined') return; localStorage.setItem(name, val); } catch (e) { } }
720
+ function getstore(name, val) { try { if (typeof (localStorage) === 'undefined') return val; var v = localStorage.getItem(name); if ((v == null) || (v == null)) return val; return v; } catch (e) { return val; } }
721
+ function format(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); };
722
+
723
+ </script>
724
+
725
+</body></html>
\ No newline at end of file
views/translations/message-min_cs.handlebars
new
+1
@@ -0,0 +1 @@
1
+<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><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,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=/styles/style.css media=screen rel=stylesheet title=CSS><title>MeshCentral - {{{title3}}}</title><div id=container style=max-height:100vh><div id=mastheadx></div><div id=masthead style="background:url(logo.png) 0 0;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><div id=page_content style=max-height:calc(100vh-138px)><div id=column_l><h1>{{{title3}}}</h1><p style=margin-left:20px>{{{message}}}</p><br></div><div id=footer><table cellpadding=0 cellspacing=10 style=width:100%><tr><td style=text-align:left><td style=text-align:right><a href=terms>Terms & Privacy</a></table></div></div></div>
\ No newline at end of file
views/translations/message_cs.handlebars
new
+40
@@ -0,0 +1,40 @@
1
+<!DOCTYPE html><html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head>
2
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3
+ <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
4
+ <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
5
+ <meta name="apple-mobile-web-app-capable" content="yes">
6
+ <meta name="format-detection" content="telephone=no">
7
+ <link type="text/css" href="/styles/style.css" media="screen" rel="stylesheet" title="CSS">
8
+ <title>MeshCentral - {{{title3}}}</title>
9
+</head>
10
+<body>
11
+ <div id="container" style="max-height:100vh">
12
+ <div id="mastheadx"></div>
13
+ <div id="masthead" style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden">
14
+ <div style="float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px">
15
+ <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong>
16
+ </div>
17
+ <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px">
18
+ <strong><font style="font-size:14px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong>
19
+ </div>
20
+ </div>
21
+ <div id="page_content" style="max-height:calc(100vh-138px)">
22
+ <div id="column_l">
23
+ <h1>{{{title3}}}</h1>
24
+ <p style="margin-left:20px">{{{message}}}</p>
25
+ <br>
26
+ </div>
27
+ <div id="footer">
28
+ <table cellpadding="0" cellspacing="10" style="width:100%">
29
+ <tbody><tr>
30
+ <td style="text-align:left"></td>
31
+ <td style="text-align:right">
32
+ <a href="terms">Terms & Privacy</a>
33
+ </td>
34
+ </tr>
35
+ </tbody></table>
36
+ </div>
37
+ </div>
38
+ </div>
39
+
40
+</body></html>
\ No newline at end of file
views/translations/messenger-min_cs.handlebars
new
+1
@@ -0,0 +1 @@
1
+<!doctypehtml><html style=height:100%><title>MeshMessenger</title><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><link type=text/css href=styles/messenger.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script src=scripts/filesaver.js></script><body style=font-family:Arial,Helvetica,sans-serif><div id=xtop style="position:absolute;left:0;right:0;top:0;height:38px;background-color:#036;color:#c8c8c8;box-shadow:3px 3px 10px gray"><div style=position:absolute;background-color:#036;right:0;height:38px><div id=notifyButton class="icon13 topButton"style=margin-right:4px;display:none title="Zapnout notifikace v prohlížeči"onclick=enableNotificationsButtonClick()></div><div id=fileButton class="icon4 topButton"title="Share a file"style=display:none onclick=fileButtonClick()></div><div id=camButton class="icon2 topButton"title="Activate camera & microphone"style=display:none onclick=camButtonClick()></div><div id=micButton class="icon6 topButton"title="Activate microphone"style=display:none onclick=micButtonClick()></div><div id=hangupButton class="icon11 topRedButton"title="Hang up"style=display:none onclick=hangUpButtonClick(1)></div></div><div style=padding-top:9px;padding-left:6px;font-size:20px;display:inline-block><b><span id=xtitle>MeshMessenger</span></b></div></div><div id=xmiddle style=position:absolute;left:0;right:0;top:38px;bottom:30px><div style=position:absolute;left:0;right:0;top:0;bottom:0;overflow-y:scroll><div id=xmsg style=position:absolute;left:0;right:0;bottom:0;padding:5px></div></div></div><div id=xbottom style=position:absolute;left:0;right:0;bottom:0;height:30px;background-color:#036><div style=position:absolute;left:5px;right:215px;bottom:4px;top:4px;background-color:#f0f8ff><input id=xouttext style="width:calc(100% - 5px)"onfocus=onUserInputFocus(1) onblur=onUserInputFocus(0)></div><input type=button id=sendButton value=Odeslat style=position:absolute;right:110px;width:100px;top:4px onclick=xsend(event)> <input type=button id=clearButton value=Clear style=position:absolute;right:5px;width:100px;top:4px onclick=displayClear()></div><div id=remoteVideo style="position:absolute;right:24px;top:45px;width:320px;height:calc(240px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"><div style=position:absolute;right:0;left:0;top:2.5px;text-align:center>Vzdálený</div><video id=remoteVideoCanvas autoplay style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:#000"></video></div><div id=localVideo style="position:absolute;right:24px;top:320px;width:160px;height:calc(120px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"><div style=position:absolute;right:0;left:0;top:2.5px;text-align:center>Lokální</div><video id=localVideoCanvas autoplay muted style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:#000"></video></div><input id=uploadFileInput type=file multiple style=display:none><script onunload=onUnLoad()>var userInputFocus=0,args=parseUriArgs(),socket=null,state=0,random=Math.random(),webrtcSessions={},webchannel=null,localStream=null,remoteStream=null,multiWebRtc=!0,userMediaSupport=0,notification=null;getUserMediaSupport(function(e){userMediaSupport=e});var webrtcconfiguration="{{{webrtconfig}}}";if(""==webrtcconfiguration)webrtcconfiguration=null;else try{webrtcconfiguration=JSON.parse(decodeURIComponent(webrtcconfiguration))}catch(e){console.log('Invalid WebRTC config: "'+webrtcconfiguration+'".'),webrtcconfiguration=null}var fileUploads=[],fileDownloads={},currentFileUpload=null,currentFileDownload=null;function onUserInputFocus(e){userInputFocus=e}function displayClear(){QH("xmsg",""),cancelAllFileTransfers(),fileUploads=[],fileDownloads={}}function getUserMediaSupport(i){try{navigator.mediaDevices.enumerateDevices().then(function(e){try{var t=0,n=0;e.forEach(function(e){"audioinput"===e.kind&&(t=1),"videoinput"===e.kind&&(n=1)}),0==t&&i(0),i(t+n)}catch(e){}})}catch(e){}}function displayControl(e){QA("xmsg",'<div style="clear:both"><div style="color:gray;float:left;margin-bottom:2px">'+e+"</div><div></div></div>"),Q("xmsg").scrollTop=Q("xmsg").scrollHeight}function displayLocalVideo(e){QV("localVideo",e),adjustVideoWindows()}function displayRemoteVideo(e){QV("remoteVideo",e),adjustVideoWindows()}function adjustVideoWindows(){var e="none"!=QS("remoteVideo").display;QS("localVideo").top=e?"320px":"45px"}function displayRemote(e){QA("xmsg",'<div style="clear:both"><div class="remoteBubble">'+e+"</div><div></div></div>"),Q("xmsg").scrollTop=Q("xmsg").scrollHeight,Notification&&QV("notifyButton","granted"!=Notification.permission),Notification&&"granted"==Notification.permission&&(null!=notification&&(notification.close(),notification=null),notification=args.title?new Notification("MeshMessenger - "+args.title,{body:e}):new Notification("MeshMessenger",{body:e}))}function xsend(e){null!=notification&&(notification.close(),notification=null),Notification&&QV("notifyButton","granted"!=Notification.permission);var t=Q("xouttext").value;0<t.length&&(Q("xouttext").value="",QA("xmsg",'<div style="clear:both"><div class="localBubble">'+t+"</div><div></div></div>"),Q("xmsg").scrollTop=Q("xmsg").scrollHeight,send({action:"chat",msg:t}))}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function parseUriArgs(){var e,t={},n=window.document.location.href.split(/[\?&|\=]/);for(i in n.splice(0,1),n)switch(i%2){case 0:e=decodeURIComponent(n[i]);break;case 1:t[e]=decodeURIComponent(n[i]);var i=parseInt(t[e]);i==t[e]&&(t[e]=i)}return t}function updateControls(){QE("sendButton",2==state),QE("clearButton",2==state),QE("xouttext",2==state),QV("fileButton",2==state),QV("camButton",webchannel&&webchannel.ok&&!localStream&&2==userMediaSupport),QV("micButton",webchannel&&webchannel.ok&&!localStream&&0<userMediaSupport),QV("hangupButton",webchannel&&webchannel.ok&&localStream)}function startWebRTC(t,e){if(null!=webrtcSessions[0]&&0==multiWebRtc)return webrtcSessions[0];var n=null;return"undefined"!=typeof RTCPeerConnection?n=new RTCPeerConnection(webrtcconfiguration):"undefined"!=typeof webkitRTCPeerConnection&&(n=new webkitRTCPeerConnection(webrtcconfiguration)),null==n?null:(n.id=t,n.onicecandidate=function(e){try{null!=e.candidate&&sendws({action:"webRtcIce",ice:e.candidate,id:this.id})}catch(e){}},n.oniceconnectionstatechange=function(){n&&"failed"==n.iceConnectionState&&(n.close(),webrtcSessions[n.id]&&delete webrtcSessions[n.id])},n.ondatachannel=function(e){(webchannel=e.channel).onmessage=function(e){processMessage(e.data,2)},webchannel.onopen=function(){webchannel.ok=!0,updateControls(),sendws({action:"rtcSwitch",v:0})},webchannel.onclose=function(e){webchannel&&webchannel.ok?disconnect():hangUpButtonClick(0)}},n.onnegotiationneeded=function(e){null==n.holdTimer&&(n.holdTimer=setTimeout(function(){n.holdTimer=null,n.createOffer(function(e){n.setLocalDescription(e,function(){sendws({action:"webRtcSdp",sdp:e,id:t})},function(){hangUpButtonClick(t)})},function(){hangUpButtonClick(t)})},20))},n.ontrack=function(e){var t=Q("remoteVideoCanvas");t.srcObject=remoteStream=e.streams[0],t.onloadedmetadata=function(e){t.play()},displayRemoteVideo(!0)},1==e&&((webchannel=n.createDataChannel("DataChannel",{})).onmessage=function(e){processMessage(e.data,2)},webchannel.onopen=function(){webchannel.ok=!0,updateControls(),sendws({action:"rtcSwitch",v:0})},webchannel.onclose=function(e){webchannel&&webchannel.ok?disconnect():hangUpButtonClick(0)}),webrtcSessions[t]=n)}function webRtcHandleOffer(i,e){var t=webrtcSessions[i];t&&t.setRemoteDescription(new RTCSessionDescription(e),function(){"offer"==e.type&&t.createAnswer(function(n){t.setLocalDescription(n,function(e,t){try{sendws({action:"webRtcSdp",sdp:n,id:i})}catch(e){}},function(){hangUpButtonClick(i)})},function(){hangUpButtonClick(i)})},function(){hangUpButtonClick(i)})}function performWebRtcSwitch(){webchannel&&webchannel.ok&&(sendws({action:"rtcSwitch",v:1}),webchannel.xoutBuffer=[])}function disconnect(){0<state&&displayControl("Connection closed."),1<state&&setTimeout(start,500),cancelAllFileTransfers(),hangUpButtonClick(0,!0),hangUpButtonClick(1,!0),hangUpButtonClick(2,!0),null!=socket&&(socket.close(),socket=null),updateControls(),state=0}function send(e){if(2==state)if("object"==typeof e&&(e=JSON.stringify(e)),webchannel&&webchannel.ok)null!=webchannel.xoutBuffer?webchannel.xoutBuffer.push(e):webchannel.send(e);else if(null!=socket)try{socket.send(e)}catch(e){}}function sendws(e){2==state&&("object"==typeof e&&(e=JSON.stringify(e)),null!=socket&&socket.send(e))}function webRtcIdSwitch(e){return 0==e?0:3-e}function processMessage(t,e){if("string"==typeof t){try{t=JSON.parse(t)}catch(e){return void console.log("Unable to parse",t)}switch(t.action){case"chat":displayRemote(t.msg);break;case"random":random>t.random&&startWebRTC(0,!0);break;case"webRtcSdp":webrtcSessions[webRtcIdSwitch(t.id)]||startWebRTC(webRtcIdSwitch(t.id),!1),webRtcHandleOffer(webRtcIdSwitch(t.id),t.sdp);break;case"webRtcIce":var n=webrtcSessions[webRtcIdSwitch(t.id)];if(n)try{n.addIceCandidate(new RTCIceCandidate(t.ice))}catch(e){}break;case"videoStop":hangUpButtonClick(webRtcIdSwitch(t.id),!0);break;case"rtcSwitch":switch(t.v){case 0:performWebRtcSwitch();break;case 1:sendws({action:"rtcSwitch",v:2});break;case 2:for(var i in webchannel.xoutBuffer)webchannel.send(webchannel.xoutBuffer[i]);delete webchannel.xoutBuffer;break;default:console.log("Unknown rtcSwitch value: "+t.action)}break;case"file":startFileDownload(t);break;case"fileUploadCancel":cancelFileTransfer(t.id);break;case"fileUploadStart":fileDownloads[t.id]&&((currentFileDownload=fileDownloads[t.id]).data="",changeFileInfo(t.id,2,0),continueFileDownload(t),send({action:"fileUploadAck",id:t.id}));break;case"fileUploadEnd":currentFileDownload&¤tFileDownload.id==t.id&&(changeFileInfo(t.id,3,200),currentFileDownload.done=1,currentFileDownload=null,send({action:"fileUploadAck",id:t.id})),currentFileDownload=null;break;case"fileUploadAck":continueFileUpload();break;case"fileData":currentFileDownload&¤tFileDownload.id==t.id&&(currentFileDownload.data+=t.data,changeFileInfo(t.id,2,200*currentFileDownload.data.length/currentFileDownload.size),send({action:"fileUploadAck",id:t.id}));break;default:console.log("Unhandled object data",t)}}else console.log("Unhandled data",typeof t,t)}function fileButtonClick(){var e=Q("uploadFileInput");1!=e.getAttribute("eventset")&&(e.setAttribute("eventset","1"),e.addEventListener("change",fileSelect,!1)),e.value=null,e.click()}function fileSelect(){if(2==state){var e=Q("uploadFileInput");if(10<e.files.length)displayControl("Max. 10 souběžně nahrávaných souborů.");else for(var t=0;t<e.files.length;t++)if(0<e.files[t].size){var n=new FileReader;n.onload=function(e){this.xfile.data=e.target.result,startFileUpload(this.xfile)},n.xfile=e.files[t],n.readAsBinaryString(e.files[t])}}}function fileDrop(e){if(haltEvent(e),2==state&&null!=e.dataTransfer)if(10<e.dataTransfer.files.length)displayControl("Max. 10 souběžně nahrávaných souborů.");else for(var t=0;t<e.dataTransfer.files.length;t++)if(0<e.dataTransfer.files[t].size){var n=new FileReader;n.onload=function(e){this.xfile.data=e.target.result,startFileUpload(this.xfile)},n.xfile=e.dataTransfer.files[t],n.readAsBinaryString(e.dataTransfer.files[t])}}function startFileUpload(e){2==state&&(e.id=Math.random(),fileUploads.push(e),QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+e.id+'" class="localBubble" style="width:240px;cursor:pointer" onclick="cancelFileTransfer(\''+e.id+'\')"><div id="FILEUP-ICON-'+e.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+e.id+'" style="height:16px;overflow:hidden;white-space:nowrap;" title="'+e.name+'">'+e.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+e.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px"> </div></div></div></div>'),Q("xmsg").scrollTop=Q("xmsg").scrollHeight,send({action:"file",size:e.size,id:e.id,type:e.type,name:e.name}),null==currentFileUpload&&continueFileUpload())}function startFileDownload(e){2==state&&(fileDownloads[e.id]=e,QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+e.id+'" class="remoteBubble" style="width:240px;cursor:pointer" onclick="saveFileTransfer(\''+e.id+'\')"><div id="FILEUP-ICON-'+e.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+e.id+'" style="height:16px;overflow:hidden;white-space:nowrap;" title="'+e.name+'">'+e.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+e.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px"> </div></div></div></div>'),Q("xmsg").scrollTop=Q("xmsg").scrollHeight)}function changeFileInfo(e,t,n,i){t&&(Q("FILEUP-ICON-"+e).classList.remove("fileicon"),Q("FILEUP-ICON-"+e).classList.remove("fileiconx"),Q("FILEUP-ICON-"+e).classList.remove("fileicontransfer"),Q("FILEUP-ICON-"+e).classList.remove("fileicondone"),Q("FILEUP-ICON-"+e).classList.add(["fileicon","fileiconx","fileicontransfer","fileicondone"][t])),n&&(QS("FILEUP-PROGRESS-"+e).width=n+"px"),i&&(QS("FILEUP-PROGRESS-"+e)["background-color"]=i)}function data2blob(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return new Blob([new Uint8Array(t)])}function saveFileTransfer(e){var t=fileDownloads[e];t&&1==t.done&&saveAs(data2blob(t.data),t.name)}function cancelFileTransfer(e){null!=currentFileUpload&¤tFileUpload.id==e&&(currentFileUpload=null),null!=currentFileDownload&¤tFileDownload.id==e&&(currentFileDownload=null);var t=!1;if(fileDownloads[e]&&1!=fileDownloads[e].done)delete fileDownloads[e],t=!0;else for(var n in fileUploads)if(fileUploads[n].id==e){send({action:"fileUploadCancel",id:e}),fileUploads.splice(n,1),t=!0;break}t&&changeFileInfo(e,1,200,"gray")}function cancelAllFileTransfers(){for(var e in fileDownloads)cancelFileTransfer(fileDownloads[e].id);for(var e in fileUploads)cancelFileTransfer(fileUploads[e].id)}function continueFileUpload(){if(null==currentFileUpload){if(0==fileUploads.length)return;(currentFileUpload=fileUploads[0]).ptr=0,send({action:"fileUploadStart",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name})}else if(currentFileUpload.size<=currentFileUpload.ptr)send({action:"fileUploadEnd",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name}),changeFileInfo(currentFileUpload.id,3,200),fileUploads.splice(0,1),currentFileUpload=null,continueFileUpload();else{var e=Math.min(4e3,currentFileUpload.data.length-currentFileUpload.ptr),t=currentFileUpload.data.substring(currentFileUpload.ptr,currentFileUpload.ptr+e);send({action:"fileData",id:currentFileUpload.id,data:t}),currentFileUpload.ptr+=e,changeFileInfo(currentFileUpload.id,0,200*currentFileUpload.ptr/currentFileUpload.size)}}function continueFileDownload(e){send({action:"fileUploadAck",id:e.id})}function enableNotificationsButtonClick(){return Notification&&Notification.requestPermission().then(function(e){QV("notifyButton","granted"!=e)}),!1}function camButtonClick(){null==localStream&&startLocalStream({video:!0,audio:!0})}function micButtonClick(){null==localStream&&startLocalStream({video:!1,audio:!0})}function hangUpButtonClick(e,t){var n=Q("localVideoCanvas"),i=Q("remoteVideoCanvas"),o=webrtcSessions[1==multiWebRtc?e:0];if(0==e&&null!=webchannel){try{webchannel.close()}catch(e){}webchannel=null}if(o){if(1!=multiWebRtc&&0!=e||(o.ontrack=null,o.onremovetrack=null,o.onremovestream=null,o.onnicecandidate=null,o.oniceconnectionstatechange=null,o.onsignalingstatechange=null,o.onicegatheringstatechange=null,o.onnotificationneeded=null),1==e&&localStream){var a=localStream.getTracks();for(var l in a)a[l].stop();localStream=null}if(2==e&&remoteStream){a=remoteStream.getTracks();for(var l in a)a[l].stop();remoteStream=null}1!=multiWebRtc&&0!=e||(o.close(),delete webrtcSessions[e])}1==e?(n.removeAttribute("src"),n.removeAttribute("srcObject"),null!=localStream&&(localStream=null),displayLocalVideo(!1)):2==e&&(i.removeAttribute("src"),i.removeAttribute("srcObject"),displayRemoteVideo(!1)),1!=t&&send({action:"videoStop",id:e}),updateControls()}function startLocalStream(a){var l=1==multiWebRtc?1:0;null==localStream&&(1==multiWebRtc&&null!=webrtcSessions[1]||navigator.mediaDevices.getUserMedia&&(localStream=1,updateControls(),navigator.mediaDevices.getUserMedia(a).then(function(e){var t=(localStream=e).getTracks(),n=startWebRTC(l);if(1==a.video){var i=Q("localVideoCanvas");i.srcObject=e,i.onloadedmetadata=function(e){i.play()},displayLocalVideo(!0)}for(var o in t)n.addTrack(t[o],localStream)},function(e){displayControl(e.message+"."),hangUpButtonClick(1)})))}function start(){if(updateControls(),"string"==typeof args.id&&0<args.id.length){var e=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+args.id;null!=args.auth&&""!=args.auth&&(e+="&auth="+args.auth),(socket=new WebSocket(e)).onopen=function(){state=1,displayControl("Čekání na ostatní uživatele...")},socket.onerror=function(e){},socket.onclose=function(){disconnect()},socket.onmessage=function(e){if(state<2&&"string"==typeof e.data&&("c"==e.data||"cr"==e.data))return hangUpButtonClick(0,!0),hangUpButtonClick(1,!0),hangUpButtonClick(2,!0),displayControl("Připojeno."),state=2,updateControls(),void sendws({action:"random",random:random});2==state&&processMessage(e.data,1)}}else displayControl("Error: No connection key specified.")}function onUnLoad(){for(var e=0;e<3;e++)webrtcSessions[e]&&(webrtcSessions[e].close(),delete webrtcSessions[e]);if(null!=webchannel){try{webchannel.close()}catch(e){}webchannel=null}if(null!=socket){try{socket.close()}catch(e){}socket=null}}args.title&&(QH("xtitle",args.title.split(" ").join(" ")),document.title=document.title+" - "+args.title),Notification&&QV("notifyButton","granted"!=Notification.permission),document.addEventListener("dragover",haltEvent,!1),document.addEventListener("dragleave",haltEvent,!1),document.addEventListener("drop",fileDrop,!1),document.onclick=function(e){Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification&&(notification.close(),notification=null)},document.onkeyup=function(e){if(Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification&&(notification.close(),notification=null),2==state&&8==e.keyCode&&0==userInputFocus){var t=Q("xouttext").value;0<t.length&&(Q("xouttext").value=t.substring(0,t.length-1))}if(0==userInputFocus)return haltEvent(e),!1},document.onkeypress=function(e){if(Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification&&(notification.close(),notification=null),2==state&&(13==e.keyCode?xsend(e):0==userInputFocus&&1==e.key.length&&(Q("xouttext").value=Q("xouttext").value+e.key)),0==userInputFocus)return haltEvent(e),!1},FileReader.prototype.readAsBinaryString||(FileReader.prototype.readAsBinaryString=function(e){var i="",o=this,a=new FileReader;a.onload=function(e){for(var t=new Uint8Array(a.result),n=0;n<t.byteLength;n++)i+=String.fromCharCode(t[n]);o.onload({target:{result:i}})},a.readAsArrayBuffer(e)}),start()</script>
\ No newline at end of file
views/translations/messenger_cs.handlebars
new
+642
@@ -0,0 +1,642 @@
1
+<!DOCTYPE html><html style="height:100%"><head>
2
+ <title>MeshMessenger</title>
3
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
4
+ <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
5
+ <meta name="format-detection" content="telephone=no">
6
+ <link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS">
7
+ <link type="text/css" href="styles/messenger.css" media="screen" rel="stylesheet" title="CSS">
8
+ <script type="text/javascript" src="scripts/common-0.0.1.js"></script>
9
+ <script type="text/javascript" src="scripts/filesaver.js"></script>
10
+ </head>
11
+ <body style="font-family:Arial,Helvetica,sans-serif">
12
+ <div id="xtop" style="position:absolute;left:0;right:0;top:0;height:38px;background-color:#036;color:#c8c8c8;box-shadow:3px 3px 10px gray">
13
+ <div style="position:absolute;background-color:#036;right:0;height:38px">
14
+ <div id="notifyButton" class="icon13 topButton" style="margin-right:4px;display:none" title="Zapnout notifikace v prohlížeči" onclick="enableNotificationsButtonClick()"></div>
15
+ <div id="fileButton" class="icon4 topButton" title="Share a file" style="display:none" onclick="fileButtonClick()"></div>
16
+ <div id="camButton" class="icon2 topButton" title="Activate camera & microphone" style="display:none" onclick="camButtonClick()"></div>
17
+ <div id="micButton" class="icon6 topButton" title="Activate microphone" style="display:none" onclick="micButtonClick()"></div>
18
+ <div id="hangupButton" class="icon11 topRedButton" title="Hang up" style="display:none" onclick="hangUpButtonClick(1)"></div>
19
+ </div>
20
+ <div style="padding-top:9px;padding-left:6px;font-size:20px;display:inline-block"><b><span id="xtitle">MeshMessenger</span></b></div>
21
+ </div>
22
+ <div id="xmiddle" style="position:absolute;left:0;right:0;top:38px;bottom:30px">
23
+ <div style="position:absolute;left:0;right:0;top:0;bottom:0;overflow-y:scroll">
24
+ <div id="xmsg" style="position:absolute;left:0;right:0;bottom:0;padding:5px"></div>
25
+ </div>
26
+ </div>
27
+ <div id="xbottom" style="position:absolute;left:0;right:0;bottom:0px;height:30px;background-color:#036">
28
+ <div style="position:absolute;left:5px;right:215px;bottom:4px;top:4px;background-color:aliceblue"><input id="xouttext" type="text" style="width:calc(100% - 5px)" onfocus="onUserInputFocus(1)" onblur="onUserInputFocus(0)"></div>
29
+ <input type="button" id="sendButton" value="Odeslat" style="position:absolute;right:110px;width:100px;top:4px;" onclick="xsend(event)">
30
+ <input type="button" id="clearButton" value="Clear" style="position:absolute;right:5px;width:100px;top:4px;" onclick="displayClear()">
31
+ </div>
32
+ <div id="remoteVideo" style="position:absolute;right:24px;top:45px;width:320px;height:calc(240px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none">
33
+ <div style="position:absolute;right:0;left:0;top:2.5px;text-align:center">Vzdálený</div>
34
+ <video id="remoteVideoCanvas" autoplay="" style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:black"></video>
35
+ </div>
36
+ <div id="localVideo" style="position:absolute;right:24px;top:320px;width:160px;height:calc(120px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none">
37
+ <div style="position:absolute;right:0;left:0;top:2.5px;text-align:center">Lokální</div>
38
+ <video id="localVideoCanvas" autoplay="" muted="" style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:black"></video>
39
+ </div>
40
+ <input id="uploadFileInput" type="file" multiple="" style="display:none">
41
+ <script type="text/javascript" onunload="onUnLoad()">
42
+ var userInputFocus = 0;
43
+ var args = parseUriArgs();
44
+ var socket = null; // Websocket object
45
+ var state = 0; // Connection state. 0 = Disconnected, 1 = Connecting, 2 = Connected.
46
+
47
+ // WebRTC sessions and data, audio and video channels
48
+ var random = Math.random(); // Selected random, larger value initiates WebRTC.
49
+ var webrtcSessions = { }; // WebRTC objects: 0 for data, 1 for outbound audio/video, 2 for inbound audio/video
50
+ var webchannel = null; // WebRTC data channel
51
+ var localStream = null;
52
+ var remoteStream = null;
53
+ var multiWebRtc = true; // if set to true, multiple WebRTC sessions will be setup. If false, everything uses one session.
54
+ var userMediaSupport = 0;
55
+ var notification = null;
56
+ getUserMediaSupport(function (x) { userMediaSupport = x; })
57
+ var webrtcconfiguration = '{{{webrtconfig}}}';
58
+ if (webrtcconfiguration == '') { webrtcconfiguration = null; } else { try { webrtcconfiguration = JSON.parse(decodeURIComponent(webrtcconfiguration)); } catch (ex) { console.log('Invalid WebRTC config: \"' + webrtcconfiguration + '\".'); webrtcconfiguration = null; } }
59
+
60
+ // File transfer state
61
+ var fileUploads = [];
62
+ var fileDownloads = {};
63
+ var currentFileUpload = null;
64
+ var currentFileDownload = null;
65
+
66
+ // Set the title
67
+ if (args.title) { QH('xtitle', args.title.split(' ').join(' ')); document.title = document.title + ' - ' + args.title; }
68
+
69
+ // Setup web notifications
70
+ if (Notification) { QV('notifyButton', Notification.permission != 'granted'); }
71
+
72
+ // Listen to drag & drop events
73
+ document.addEventListener('dragover', haltEvent, false);
74
+ document.addEventListener('dragleave', haltEvent, false);
75
+ document.addEventListener('drop', fileDrop, false);
76
+
77
+ document.onclick = function (e) {
78
+ if (Notification) { QV('notifyButton', Notification.permission != 'granted'); }
79
+ if (notification != null) { notification.close(); notification = null; }
80
+ }
81
+
82
+ // Trap document key up events
83
+ document.onkeyup = function ondockeypress(e) {
84
+ if (Notification) { QV('notifyButton', Notification.permission != 'granted'); }
85
+ if (notification != null) { notification.close(); notification = null; }
86
+ if (state == 2) {
87
+ if ((e.keyCode == 8) && (userInputFocus == 0)) {
88
+ // Backspace
89
+ var outtext = Q('xouttext').value;
90
+ if (outtext.length > 0) { Q('xouttext').value = outtext.substring(0, outtext.length - 1); }
91
+ }
92
+ }
93
+ if (userInputFocus == 0) { haltEvent(e); return false; }
94
+ }
95
+
96
+ // Trap document key presses
97
+ document.onkeypress = function ondockeypress(e) {
98
+ if (Notification) { QV('notifyButton', Notification.permission != 'granted'); }
99
+ if (notification != null) { notification.close(); notification = null; }
100
+ if (state == 2) {
101
+ if (e.keyCode == 13) {
102
+ // Return
103
+ xsend(e);
104
+ } else {
105
+ // Any other key
106
+ if ((userInputFocus == 0) && (e.key.length == 1)) { Q('xouttext').value = Q('xouttext').value + e.key; }
107
+ }
108
+ }
109
+ if (userInputFocus == 0) { haltEvent(e); return false; }
110
+ }
111
+
112
+ function onUserInputFocus(x) { userInputFocus = x; }
113
+ function displayClear() { QH('xmsg', ''); cancelAllFileTransfers(); fileUploads = [], fileDownloads = {}; }
114
+
115
+ // Polyfill FileReader if needed
116
+ if (!FileReader.prototype.readAsBinaryString) {
117
+ FileReader.prototype.readAsBinaryString = function (fileData) {
118
+ var binary = '', self = this, reader = new FileReader();
119
+ reader.onload = function (e) {
120
+ var bytes = new Uint8Array(reader.result);
121
+ for (var i = 0; i < bytes.byteLength; i++) { binary += String.fromCharCode(bytes[i]); }
122
+ self.onload({ target: { result: binary } });
123
+ }
124
+ reader.readAsArrayBuffer(fileData);
125
+ }
126
+ }
127
+
128
+ // Detect if microphone & camera are present
129
+ // 0 = nomedia, 1 = miconly, 2 = mic&cam
130
+ function getUserMediaSupport(func) {
131
+ try {
132
+ navigator.mediaDevices.enumerateDevices().then(function (devices) {
133
+ try {
134
+ var mic = 0, cam = 0;
135
+ devices.forEach(function (device) {
136
+ if (device.kind === 'audioinput') { mic = 1; }
137
+ if (device.kind === 'videoinput') { cam = 1; }
138
+ });
139
+ if (mic == 0) { func(0); }
140
+ func(mic + cam);
141
+ } catch (ex) { }
142
+ })
143
+ } catch (ex) { }
144
+ }
145
+
146
+ // Display a control message
147
+ function displayControl(msg) {
148
+ QA('xmsg', '<div style="clear:both"><div style="color:gray;float:left;margin-bottom:2px">' + msg + '</div><div></div></div>');
149
+ Q('xmsg').scrollTop = Q('xmsg').scrollHeight;
150
+ }
151
+
152
+ function displayLocalVideo(active) { QV('localVideo', active); adjustVideoWindows(); }
153
+ function displayRemoteVideo(active) { QV('remoteVideo', active); adjustVideoWindows(); }
154
+ function adjustVideoWindows() {
155
+ //var lv = (QS('localVideo')['display'] != 'none');
156
+ var rv = (QS('remoteVideo')['display'] != 'none');
157
+ QS('localVideo')['top'] = rv ? '320px' : '45px';
158
+ }
159
+
160
+ // Display a message from the remote user
161
+ function displayRemote(msg) {
162
+ QA('xmsg', '<div style="clear:both"><div class="remoteBubble">' + msg + '</div><div></div></div>');
163
+ Q('xmsg').scrollTop = Q('xmsg').scrollHeight;
164
+
165
+ // If web notifications are granted, use it.
166
+ if (Notification) { QV('notifyButton', Notification.permission != 'granted'); }
167
+ if (Notification && (Notification.permission == 'granted')) {
168
+ if (notification != null) { notification.close(); notification = null; }
169
+ if (args.title) {
170
+ notification = new Notification("MeshMessenger" + ' - ' + args.title, { body: msg });
171
+ } else {
172
+ notification = new Notification("MeshMessenger", { body: msg });
173
+ }
174
+ }
175
+ }
176
+
177
+ // Display and send a message from the local user
178
+ function xsend(event) {
179
+ if (notification != null) { notification.close(); notification = null; }
180
+ if (Notification) { QV('notifyButton', Notification.permission != 'granted'); }
181
+ var outtext = Q('xouttext').value;
182
+ if (outtext.length > 0) {
183
+ Q('xouttext').value = '';
184
+ QA('xmsg', '<div style="clear:both"><div class="localBubble">' + outtext + '</div><div></div></div>');
185
+ Q('xmsg').scrollTop = Q('xmsg').scrollHeight;
186
+ send({ action: 'chat', msg: outtext });
187
+ }
188
+ }
189
+
190
+ function haltEvent(e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
191
+ 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; }
192
+
193
+ // Update user controls
194
+ function updateControls() {
195
+ QE('sendButton', state == 2);
196
+ QE('clearButton', state == 2);
197
+ QE('xouttext', state == 2);
198
+ QV('fileButton', state == 2);
199
+ QV('camButton', webchannel && webchannel.ok && !localStream && (userMediaSupport == 2));
200
+ QV('micButton', webchannel && webchannel.ok && !localStream && (userMediaSupport > 0));
201
+ QV('hangupButton', webchannel && webchannel.ok && localStream);
202
+ }
203
+
204
+ // This is the WebRTC setup
205
+ function startWebRTC(id, startDataChannel) {
206
+ if ((webrtcSessions[0] != null) && (multiWebRtc == false)) { return webrtcSessions[0]; };
207
+
208
+ // Setup the WebRTC object
209
+ var webrtc = null;
210
+ if (typeof RTCPeerConnection !== 'undefined') { webrtc = new RTCPeerConnection(webrtcconfiguration); }
211
+ else if (typeof webkitRTCPeerConnection !== 'undefined') { webrtc = new webkitRTCPeerConnection(webrtcconfiguration); }
212
+ if (webrtc == null) return null; // No WebRTC support.
213
+
214
+ webrtc.id = id;
215
+ webrtc.onicecandidate = function (e) { try { if (e.candidate != null) { sendws({ action: 'webRtcIce', ice: e.candidate, id: this.id }); } } catch (ex) { } }
216
+ webrtc.oniceconnectionstatechange = function () { if (webrtc && webrtc.iceConnectionState == 'failed') { webrtc.close(); if (webrtcSessions[webrtc.id]) { delete webrtcSessions[webrtc.id]; } } }
217
+ webrtc.ondatachannel = function (ev) {
218
+ //console.log('ondatachannel');
219
+ webchannel = ev.channel;
220
+ webchannel.onmessage = function (event) { processMessage(event.data, 2); };
221
+ webchannel.onopen = function () { webchannel.ok = true; updateControls(); sendws({ action: 'rtcSwitch', v: 0 }); };
222
+ webchannel.onclose = function (event) { if (webchannel && webchannel.ok) { disconnect(); } else { hangUpButtonClick(0); } }
223
+ }
224
+ webrtc.onnegotiationneeded = function (event) {
225
+ if (webrtc.holdTimer != null) return;
226
+ webrtc.holdTimer = setTimeout(function () { // This time is needed to keep Chrome from being to excited. Wait until we add all tracks before kicking this off.
227
+ //console.log('onnegotiationneeded', id);
228
+ webrtc.holdTimer = null;
229
+ webrtc.createOffer(function (offer) { /*console.log('offer', offer.sdp.length);*/ webrtc.setLocalDescription(offer, function () { sendws({ action: 'webRtcSdp', sdp: offer, id: id }); }, function () { hangUpButtonClick(id); }); }, function () { hangUpButtonClick(id); });
230
+ }, 20);
231
+ }
232
+ webrtc.ontrack = function (event) {
233
+ //console.log('ontrack', id);
234
+ var video = Q('remoteVideoCanvas');
235
+ video.srcObject = remoteStream = event.streams[0];
236
+ video.onloadedmetadata = function (e) { video.play(); };
237
+ displayRemoteVideo(true);
238
+ }
239
+ //webrtc.onremovetrack = function (event) { console.log('onremovetrack'); }
240
+ //webrtc.onicegatheringstatechange = function (event) { console.log('onicegatheringstatechange', event); }
241
+ //webrtc.onsignalingstatechange = function (event) { console.log('onsignalingstatechange', event); }
242
+
243
+ // Initiate the WebRTC offer or handle the offer from the peer.
244
+ if (startDataChannel == true) {
245
+ webchannel = webrtc.createDataChannel('DataChannel', {}); // { ordered: false, maxRetransmits: 2 }
246
+ webchannel.onmessage = function (event) { processMessage(event.data, 2); };
247
+ webchannel.onopen = function () { webchannel.ok = true; updateControls(); sendws({ action: 'rtcSwitch', v: 0 }); };
248
+ webchannel.onclose = function (event) { if (webchannel && webchannel.ok) { disconnect(); } else { hangUpButtonClick(0); } }
249
+ }
250
+
251
+ webrtcSessions[id] = webrtc;
252
+ return webrtc;
253
+ }
254
+
255
+ function webRtcHandleOffer(id, description) {
256
+ //console.log('webRtcHandleOffer', description.sdp.length);
257
+ var webrtc = webrtcSessions[id];
258
+ if (webrtc) {
259
+ webrtc.setRemoteDescription(new RTCSessionDescription(description), function () {
260
+ if (description.type == 'offer') {
261
+ webrtc.createAnswer(function (answer) {
262
+ webrtc.setLocalDescription(answer, function (a, b) {
263
+ try { sendws({ action: 'webRtcSdp', sdp: answer, id: id }); } catch (ex) { }
264
+ }, function () { hangUpButtonClick(id); });
265
+ }, function () { hangUpButtonClick(id); });
266
+ }
267
+ }, function () { hangUpButtonClick(id); });
268
+ }
269
+ }
270
+
271
+ // Indicate to peer that data traffic will no longer be sent over websocket and start holding traffic.
272
+ function performWebRtcSwitch() {
273
+ if (webchannel && webchannel.ok) { sendws({ action: 'rtcSwitch', v: 1 }); webchannel.xoutBuffer = []; }
274
+ }
275
+
276
+ // Disconnect everything
277
+ function disconnect() {
278
+ if (state > 0) { displayControl("Connection closed."); }
279
+ if (state > 1) { setTimeout(start, 500); }
280
+ cancelAllFileTransfers();
281
+ hangUpButtonClick(0, true); // Data channel
282
+ hangUpButtonClick(1, true); // Local audio/video
283
+ hangUpButtonClick(2, true); // Remote audio/video
284
+ if (socket != null) { socket.close(); socket = null; }
285
+ updateControls();
286
+ state = 0;
287
+ }
288
+
289
+ // Send data over the current transport (WebRTC first)
290
+ function send(data) {
291
+ if (state != 2) return; // If not in connected state, ignore this.
292
+ if (typeof data == 'object') { data = JSON.stringify(data); } // If this is an object, convert it to a string.
293
+ if (webchannel && webchannel.ok) { if (webchannel.xoutBuffer != null) { webchannel.xoutBuffer.push(data); } else { webchannel.send(data); } } // If WebRTC channel is possible, use it or hold until we can use it.
294
+ else { if (socket != null) { try { socket.send(data); } catch (ex) { } } } // If a websocket channel is present, use that.
295
+ }
296
+
297
+ // Send data over the websocket transport (WebSocket only)
298
+ function sendws(data) {
299
+ if (state != 2) return;
300
+ //console.log('SEND', data);
301
+ if (typeof data == 'object') { data = JSON.stringify(data); }
302
+ if (socket != null) { socket.send(data); }
303
+ }
304
+
305
+ // WebRTC id switcher (0 -> 0, 1 -> 2, 2 -> 1)
306
+ function webRtcIdSwitch(id) { if (id == 0) { return 0; } return 3 - id; }
307
+
308
+ // Process incoming messages
309
+ function processMessage(data, transport) {
310
+ if (typeof data == 'string') {
311
+ try { data = JSON.parse(data); } catch (ex) { console.log('Unable to parse', data); return; }
312
+ //console.log('RECV', data);
313
+ switch (data.action) {
314
+ case 'chat': { displayRemote(data.msg); break; } // Incoming chat message.
315
+ case 'random': { if (random > data.random) { startWebRTC(0, true); } break; } // If we have a larger random value, we start WebRTC.
316
+ case 'webRtcSdp': { if (!webrtcSessions[webRtcIdSwitch(data.id)]) { startWebRTC(webRtcIdSwitch(data.id), false); } webRtcHandleOffer(webRtcIdSwitch(data.id), data.sdp); break; } // Remote WebRTC offer or answer.
317
+ case 'webRtcIce': { var webrtc = webrtcSessions[webRtcIdSwitch(data.id)]; if (webrtc) { try { webrtc.addIceCandidate(new RTCIceCandidate(data.ice)); } catch (ex) { } } break; } // Remote ICE candidate
318
+ case 'videoStop': { hangUpButtonClick(webRtcIdSwitch(data.id), true); break; }
319
+ case 'rtcSwitch': { // WebRTC switch over commands.
320
+ switch (data.v) {
321
+ case 0: { performWebRtcSwitch(); break; } // Other side is ready for switch over to WebRTC
322
+ case 1: { sendws({ action: 'rtcSwitch', v: 2 }); break; } // Other side no longer sending data on websocket, confirm we got the end marker
323
+ case 2: { for (var i in webchannel.xoutBuffer) { webchannel.send(webchannel.xoutBuffer[i]); } delete webchannel.xoutBuffer; break; } // Send any pending data over WebRTC and start using WebRTC with all traffic
324
+ default: { console.log('Unknown rtcSwitch value: ' + data.action); break; } //
325
+ }
326
+ break;
327
+ }
328
+ case 'file': { startFileDownload(data); break; }
329
+ case 'fileUploadCancel': { cancelFileTransfer(data.id); break; }
330
+ case 'fileUploadStart': {
331
+ if (fileDownloads[data.id]) {
332
+ currentFileDownload = fileDownloads[data.id];
333
+ currentFileDownload.data = '';
334
+ changeFileInfo(data.id, 2, 0);
335
+ continueFileDownload(data);
336
+ send({ action: 'fileUploadAck', id: data.id });
337
+ } break;
338
+ }
339
+ case 'fileUploadEnd': {
340
+ if (currentFileDownload && (currentFileDownload.id == data.id)) {
341
+ changeFileInfo(data.id, 3, 200);
342
+ currentFileDownload.done = 1;
343
+ currentFileDownload = null;
344
+ send({ action: 'fileUploadAck', id: data.id });
345
+ }
346
+ currentFileDownload = null;
347
+ break;
348
+ }
349
+ case 'fileUploadAck': {
350
+ continueFileUpload();
351
+ break;
352
+ }
353
+ case 'fileData': {
354
+ if (currentFileDownload && (currentFileDownload.id == data.id)) {
355
+ currentFileDownload.data += data.data;
356
+ changeFileInfo(data.id, 2, (currentFileDownload.data.length * 200 / currentFileDownload.size));
357
+ send({ action: 'fileUploadAck', id: data.id });
358
+ }
359
+ break;
360
+ }
361
+ default: { console.log('Unhandled object data', data); break; }
362
+ }
363
+ } else {
364
+ console.log('Unhandled data', typeof data, data);
365
+ }
366
+ }
367
+
368
+ // File sharing button
369
+ function fileButtonClick() {
370
+ var chooser = Q('uploadFileInput');
371
+ if (chooser.getAttribute('eventset') != 1) {
372
+ chooser.setAttribute('eventset', '1');
373
+ chooser.addEventListener('change', fileSelect, false);
374
+ }
375
+ chooser.value = null;
376
+ chooser.click();
377
+ }
378
+
379
+ // User selected one or more files to upload to remote user.
380
+ function fileSelect() {
381
+ if (state != 2) return;
382
+ var x = Q('uploadFileInput');
383
+ if (x.files.length > 10) {
384
+ displayControl("Max. 10 souběžně nahrávaných souborů.");
385
+ } else {
386
+ for (var i = 0; i < x.files.length; i++) {
387
+ if (x.files[i].size > 0) {
388
+ var reader = new FileReader();
389
+ reader.onload = function (e) { this.xfile.data = e.target.result; startFileUpload(this.xfile); };
390
+ reader.xfile = x.files[i];
391
+ reader.readAsBinaryString(x.files[i]);
392
+ }
393
+ }
394
+ }
395
+ }
396
+
397
+ // User drag & droped one or more files to upload to remote user.
398
+ function fileDrop(e) {
399
+ haltEvent(e);
400
+ if ((state != 2) || (e.dataTransfer == null)) return;
401
+ if (e.dataTransfer.files.length > 10) {
402
+ displayControl("Max. 10 souběžně nahrávaných souborů.");
403
+ } else {
404
+ for (var i = 0; i < e.dataTransfer.files.length; i++) {
405
+ if (e.dataTransfer.files[i].size > 0) {
406
+ var reader = new FileReader();
407
+ reader.onload = function (e) { this.xfile.data = e.target.result; startFileUpload(this.xfile); };
408
+ reader.xfile = e.dataTransfer.files[i];
409
+ reader.readAsBinaryString(e.dataTransfer.files[i]);
410
+ }
411
+ }
412
+ }
413
+ }
414
+
415
+ function startFileUpload(file) {
416
+ if (state != 2) return;
417
+ file.id = Math.random();
418
+ fileUploads.push(file);
419
+ QA('xmsg', '<div style="clear:both"></div><div id="FILEUP-' + file.id + '" class="localBubble" style="width:240px;cursor:pointer" onclick="cancelFileTransfer(\'' + file.id + '\')"><div id="FILEUP-ICON-' + file.id + '" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-' + file.id + '" style="height:16px;overflow:hidden;white-space:nowrap;" title="' + file.name + '">' + file.name + '</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-' + file.id + '" style="width:0px;background-color:green;border-radius:3px;height:11px"> </div></div></div></div>');
420
+ Q('xmsg').scrollTop = Q('xmsg').scrollHeight;
421
+ send({ action: 'file', size: file.size, id: file.id, type: file.type, name: file.name });
422
+ if (currentFileUpload == null) continueFileUpload();
423
+ }
424
+
425
+ function startFileDownload(file) {
426
+ if (state != 2) return;
427
+ fileDownloads[file.id] = file;
428
+ QA('xmsg', '<div style="clear:both"></div><div id="FILEUP-' + file.id + '" class="remoteBubble" style="width:240px;cursor:pointer" onclick="saveFileTransfer(\'' + file.id + '\')"><div id="FILEUP-ICON-' + file.id + '" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-' + file.id + '" style="height:16px;overflow:hidden;white-space:nowrap;" title="' + file.name + '">' + file.name + '</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-' + file.id + '" style="width:0px;background-color:green;border-radius:3px;height:11px"> </div></div></div></div>');
429
+ Q('xmsg').scrollTop = Q('xmsg').scrollHeight;
430
+ }
431
+
432
+ // Change the file icon and progress
433
+ function changeFileInfo(id, icon, progress, progressColor) {
434
+ if (icon) {
435
+ Q('FILEUP-ICON-' + id).classList.remove('fileicon');
436
+ Q('FILEUP-ICON-' + id).classList.remove('fileiconx');
437
+ Q('FILEUP-ICON-' + id).classList.remove('fileicontransfer');
438
+ Q('FILEUP-ICON-' + id).classList.remove('fileicondone');
439
+ Q('FILEUP-ICON-' + id).classList.add(['fileicon', 'fileiconx', 'fileicontransfer', 'fileicondone'][icon]);
440
+ }
441
+ if (progress) { QS('FILEUP-PROGRESS-' + id)['width'] = progress + 'px'; }
442
+ if (progressColor) { QS('FILEUP-PROGRESS-' + id)['background-color'] = progressColor; }
443
+ }
444
+
445
+ // Convert a string into a blob
446
+ function data2blob(data) {
447
+ var bytes = new Array(data.length);
448
+ for (var i = 0; i < data.length; i++) bytes[i] = data.charCodeAt(i);
449
+ return new Blob([new Uint8Array(bytes)]);
450
+ };
451
+
452
+ function saveFileTransfer(id) {
453
+ var f = fileDownloads[id];
454
+ if (f && f.done == 1) { saveAs(data2blob(f.data), f.name); }
455
+ }
456
+
457
+ function cancelFileTransfer(id) {
458
+ if ((currentFileUpload != null) && (currentFileUpload.id == id)) { currentFileUpload = null; }
459
+ if ((currentFileDownload != null) && (currentFileDownload.id == id)) { currentFileDownload = null; }
460
+
461
+ var found = false;
462
+ if (fileDownloads[id] && (fileDownloads[id].done != 1)) {
463
+ delete fileDownloads[id];
464
+ found = true;
465
+ } else {
466
+ for (var i in fileUploads) {
467
+ if (fileUploads[i].id == id) {
468
+ send({ action: 'fileUploadCancel', id: id });
469
+ fileUploads.splice(i, 1);
470
+ found = true;
471
+ break;
472
+ }
473
+ }
474
+ }
475
+ if (found) { changeFileInfo(id, 1, 200, 'gray'); } // Only cancel a file if it was in the file queue.
476
+ }
477
+
478
+ function cancelAllFileTransfers() {
479
+ for (var i in fileDownloads) { cancelFileTransfer(fileDownloads[i].id); }
480
+ for (var i in fileUploads) { cancelFileTransfer(fileUploads[i].id); }
481
+ }
482
+
483
+ function continueFileUpload() {
484
+ if (currentFileUpload == null) {
485
+ // Select the next file to upload
486
+ if (fileUploads.length == 0) { return; } // Nothing to do
487
+ currentFileUpload = fileUploads[0];
488
+ currentFileUpload.ptr = 0;
489
+
490
+ // Indicate that we are sending this file
491
+ send({ action: 'fileUploadStart', size: currentFileUpload.size, id: currentFileUpload.id, type: currentFileUpload.type, name: currentFileUpload.name });
492
+ } else {
493
+ if (currentFileUpload.size <= currentFileUpload.ptr) {
494
+ // If we are done, send the end marker
495
+ send({ action: 'fileUploadEnd', size: currentFileUpload.size, id: currentFileUpload.id, type: currentFileUpload.type, name: currentFileUpload.name });
496
+ changeFileInfo(currentFileUpload.id, 3, 200);
497
+ fileUploads.splice(0, 1);
498
+ currentFileUpload = null;
499
+ continueFileUpload(); // Send the next file
500
+ } else {
501
+ // Send the next block
502
+ var nextBlockLen = Math.min(4000, currentFileUpload.data.length - currentFileUpload.ptr);
503
+ var data = currentFileUpload.data.substring(currentFileUpload.ptr, currentFileUpload.ptr + nextBlockLen);
504
+ send({ action: 'fileData', id: currentFileUpload.id, data: data });
505
+ currentFileUpload.ptr += nextBlockLen;
506
+ changeFileInfo(currentFileUpload.id, 0, (currentFileUpload.ptr * 200 / currentFileUpload.size));
507
+ }
508
+ }
509
+ }
510
+
511
+ function continueFileDownload(msg) {
512
+ send({ action: 'fileUploadAck', id: msg.id });
513
+ }
514
+
515
+ // Toggle notification
516
+ function enableNotificationsButtonClick() {
517
+ if (Notification) { Notification.requestPermission().then(function (permission) { QV('notifyButton', permission != 'granted'); }); }
518
+ return false;
519
+ }
520
+
521
+ // Camera button
522
+ function camButtonClick() {
523
+ if (localStream == null) { startLocalStream({ video: true, audio: true }); }
524
+ }
525
+
526
+ // Microphone
527
+ function micButtonClick() {
528
+ if (localStream == null) { startLocalStream({ video: false, audio: true }); }
529
+ }
530
+
531
+ function hangUpButtonClick(id, fromRemote) {
532
+ //console.log('hangUpButtonClick', id);
533
+ var localVideo = Q('localVideoCanvas');
534
+ var remoteVideo = Q('remoteVideoCanvas');
535
+ var webrtc = webrtcSessions[(multiWebRtc == true)? id : 0];
536
+
537
+ if ((id == 0) && (webchannel != null)) { try { webchannel.close(); } catch (e) { } webchannel = null; }
538
+
539
+ if (webrtc) {
540
+ if ((multiWebRtc == true) || (id == 0)) {
541
+ webrtc.ontrack = null;
542
+ webrtc.onremovetrack = null;
543
+ webrtc.onremovestream = null;
544
+ webrtc.onnicecandidate = null;
545
+ webrtc.oniceconnectionstatechange = null;
546
+ webrtc.onsignalingstatechange = null;
547
+ webrtc.onicegatheringstatechange = null;
548
+ webrtc.onnotificationneeded = null;
549
+ }
550
+
551
+ if ((id == 1) && localStream) { var tracks = localStream.getTracks(); for (var i in tracks) { tracks[i].stop(); } localStream = null; }
552
+ if ((id == 2) && remoteStream) { var tracks = remoteStream.getTracks(); for (var i in tracks) { tracks[i].stop(); } remoteStream = null; }
553
+
554
+ if ((multiWebRtc == true) || (id == 0)) {
555
+ webrtc.close();
556
+ delete webrtcSessions[id];
557
+ }
558
+ }
559
+
560
+ if (id == 1) {
561
+ localVideo.removeAttribute('src');
562
+ localVideo.removeAttribute('srcObject');
563
+ if (localStream != null) { localStream = null; }
564
+ displayLocalVideo(false);
565
+ } else if (id == 2) {
566
+ remoteVideo.removeAttribute('src');
567
+ remoteVideo.removeAttribute('srcObject');
568
+ displayRemoteVideo(false);
569
+ }
570
+
571
+ if (fromRemote != true) { send({ action: 'videoStop', id: id }); }
572
+ updateControls();
573
+ }
574
+
575
+ // Setup local audio/video
576
+ function startLocalStream(constraints) {
577
+ var channel = (multiWebRtc == true) ? 1 : 0;
578
+ if (localStream != null) return;
579
+ if ((multiWebRtc == true) && (webrtcSessions[1] != null)) return;
580
+ if (navigator.mediaDevices.getUserMedia) {
581
+ localStream = 1;
582
+ updateControls();
583
+ navigator.mediaDevices.getUserMedia(constraints)
584
+ .then(function (stream) {
585
+ localStream = stream;
586
+ var tracks = localStream.getTracks();
587
+ var webrtc = startWebRTC(channel);
588
+ if (constraints.video == true) {
589
+ var video = Q('localVideoCanvas');
590
+ video.srcObject = stream;
591
+ video.onloadedmetadata = function (e) { video.play(); };
592
+ displayLocalVideo(true);
593
+ }
594
+ for (var i in tracks) { webrtc.addTrack(tracks[i], localStream); }
595
+ }, function (err) {
596
+ displayControl(err.message + '.');
597
+ hangUpButtonClick(1);
598
+ });
599
+ }
600
+ }
601
+
602
+ // This is the main start
603
+ function start() {
604
+ // Get started
605
+ updateControls();
606
+ if ((typeof args.id == 'string') && (args.id.length > 0)) {
607
+ var url = window.location.protocol.replace('http', 'ws') + '//' + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + '/meshrelay.ashx?id=' + args.id;
608
+ if ((args.auth != null) && (args.auth != '')) { url += '&auth=' + args.auth; }
609
+ socket = new WebSocket(url);
610
+ socket.onopen = function () { state = 1; displayControl("Čekání na ostatní uživatele..."); }
611
+ socket.onerror = function (e) { /*console.error(e);*/ }
612
+ socket.onclose = function () { disconnect(); }
613
+ socket.onmessage = function (msg) {
614
+ if ((state < 2) && (typeof msg.data == 'string') && ((msg.data == 'c') || (msg.data == 'cr'))) {
615
+ hangUpButtonClick(0, true);
616
+ hangUpButtonClick(1, true);
617
+ hangUpButtonClick(2, true);
618
+ displayControl("Připojeno.");
619
+ state = 2;
620
+ updateControls();
621
+ sendws({ action: 'random', random: random }); // Send a random number. Higher number starts the WebRTC session.
622
+ return;
623
+ }
624
+ if (state == 2) { processMessage(msg.data, 1); }
625
+ }
626
+ } else {
627
+ displayControl("Error: No connection key specified.");
628
+ }
629
+ }
630
+
631
+ start();
632
+
633
+ function onUnLoad() {
634
+ for (var i = 0; i < 3; i++) { if (webrtcSessions[i]) { webrtcSessions[i].close(); delete webrtcSessions[i]; } }
635
+ if (webchannel != null) { try { webchannel.close(); } catch (e) { } webchannel = null; }
636
+ if (socket != null) { try { socket.close(); } catch (e) { } socket = null; }
637
+ }
638
+
639
+ </script>
640
+
641
+
642
+</body></html>
\ No newline at end of file