" +
- '';
- var hdr = document.getElementById("terminal-input-header");
- hdr.style.display = "inline";
- //var lineWidth = document.getElementById("terminal-input-td").offsetWidth;
- //var width = lineWidth - hdr.offsetWidth - 10;
- //document.getElementById("terminal-input-text-box").style.width = width + "px";
- },
-
//Complete the hack/analyze command
finishHack: function(cancelled = false) {
if (cancelled == false) {
- var server = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer();
+ var server = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer();
//Calculate whether hack was successful
- var hackChance = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].calculateHackingChance();
+ var hackChance = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].calculateHackingChance();
var rand = Math.random();
console.log("Hack success chance: " + hackChance + ", rand: " + rand);
- var expGainedOnSuccess = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].calculateExpGain();
+ var expGainedOnSuccess = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].calculateExpGain();
var expGainedOnFailure = (expGainedOnSuccess / 4);
if (rand < hackChance) { //Success!
- if (__WEBPACK_IMPORTED_MODULE_16__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_16__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon] &&
- __WEBPACK_IMPORTED_MODULE_16__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_16__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon] == server.ip) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN == null) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN = 1;
+ if (__WEBPACK_IMPORTED_MODULE_17__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_17__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon] &&
+ __WEBPACK_IMPORTED_MODULE_17__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_17__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon] == server.ip) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN == null) {
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN = 1;
}
- Object(__WEBPACK_IMPORTED_MODULE_12__RedPill_js__["a" /* hackWorldDaemon */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN);
+ Object(__WEBPACK_IMPORTED_MODULE_13__RedPill_js__["a" /* hackWorldDaemon */])(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN);
return;
}
server.manuallyHacked = true;
- var moneyGained = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].calculatePercentMoneyHacked();
+ var moneyGained = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].calculatePercentMoneyHacked();
moneyGained = Math.floor(server.moneyAvailable * moneyGained);
if (moneyGained <= 0) {moneyGained = 0;} //Safety check
server.moneyAvailable -= moneyGained;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainMoney(moneyGained);
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainHackingExp(expGainedOnSuccess)
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainIntelligenceExp(expGainedOnSuccess / __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].IntelligenceTerminalHackBaseExpGain);
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainMoney(moneyGained);
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainHackingExp(expGainedOnSuccess)
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainIntelligenceExp(expGainedOnSuccess / __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].IntelligenceTerminalHackBaseExpGain);
server.fortify(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ServerFortifyAmount);
- post("Hack successful! Gained $" + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(moneyGained, 2) + " and " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnSuccess, 4) + " hacking EXP");
+ post("Hack successful! Gained $" + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(moneyGained, 2) + " and " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnSuccess, 4) + " hacking EXP");
} else { //Failure
//Player only gains 25% exp for failure? TODO Can change this later to balance
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainHackingExp(expGainedOnFailure)
- post("Failed to hack " + server.hostname + ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnFailure, 4) + " hacking EXP");
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainHackingExp(expGainedOnFailure)
+ post("Failed to hack " + server.hostname + ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnFailure, 4) + " hacking EXP");
}
}
@@ -22797,7 +22294,6 @@ let Terminal = {
$("#hack-progress-bar").attr('id', "old-hack-progress-bar");
$("#hack-progress").attr('id', "old-hack-progress");
Terminal.resetTerminalInput();
- //document.getElementById("terminal-input-td").innerHTML = '$ ';
$('input[class=terminal-input]').prop('disabled', false);
Terminal.hackFlag = false;
@@ -22805,43 +22301,43 @@ let Terminal = {
finishAnalyze: function(cancelled = false) {
if (cancelled == false) {
- post(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hostname + ": ");
- post("Organization name: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().organizationName);
+ post(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().hostname + ": ");
+ post("Organization name: " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().organizationName);
var rootAccess = "";
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights) {rootAccess = "YES";}
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights) {rootAccess = "YES";}
else {rootAccess = "NO";}
post("Root Access: " + rootAccess);
- post("Required hacking skill: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().requiredHackingSkill);
- post("Estimated server security level: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_19__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hackDifficulty, 5), 3));
- post("Estimated chance to hack: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_19__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].calculateHackingChance() * 100, 5), 2) + "%");
- post("Estimated time to hack: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_19__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].calculateHackingTime(), 5), 3) + " seconds");
- post("Estimated total money available on server: $" + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_19__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().moneyAvailable, 5), 2));
- post("Required number of open ports for NUKE: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().numOpenPortsRequired);
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().sshPortOpen) {
+ post("Required hacking skill: " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().requiredHackingSkill);
+ post("Estimated server security level: " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().hackDifficulty, 5), 3));
+ post("Estimated chance to hack: " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].calculateHackingChance() * 100, 5), 2) + "%");
+ post("Estimated time to hack: " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].calculateHackingTime(), 5), 3) + " seconds");
+ post("Estimated total money available on server: $" + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().moneyAvailable, 5), 2));
+ post("Required number of open ports for NUKE: " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().numOpenPortsRequired);
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().sshPortOpen) {
post("SSH port: Open")
} else {
post("SSH port: Closed")
}
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().ftpPortOpen) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().ftpPortOpen) {
post("FTP port: Open")
} else {
post("FTP port: Closed")
}
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().smtpPortOpen) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().smtpPortOpen) {
post("SMTP port: Open")
} else {
post("SMTP port: Closed")
}
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().httpPortOpen) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().httpPortOpen) {
post("HTTP port: Open")
} else {
post("HTTP port: Closed")
}
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().sqlPortOpen) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().sqlPortOpen) {
post("SQL port: Open")
} else {
post("SQL port: Closed")
@@ -22853,7 +22349,6 @@ let Terminal = {
$("#hack-progress-bar").attr('id', "old-hack-progress-bar");
$("#hack-progress").attr('id', "old-hack-progress");
Terminal.resetTerminalInput();
- //document.getElementById("terminal-input-td").innerHTML = '$ ';
$('input[class=terminal-input]').prop('disabled', false);
},
@@ -22888,56 +22383,56 @@ let Terminal = {
if (commandArray.length == 0) {return;}
/****************** Interactive Tutorial Terminal Commands ******************/
- if (__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["b" /* iTutorialIsRunning */]) {
- var foodnstuffServ = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["c" /* GetServerByHostname */])("foodnstuff");
+ if (__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["b" /* iTutorialIsRunning */]) {
+ var foodnstuffServ = Object(__WEBPACK_IMPORTED_MODULE_15__Server_js__["c" /* GetServerByHostname */])("foodnstuff");
if (foodnstuffServ == null) {throw new Error("Could not get foodnstuff server"); return;}
- switch(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["a" /* currITutorialStep */]) {
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalHelp:
+ switch(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["a" /* currITutorialStep */]) {
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalHelp:
if (commandArray[0] == "help") {
- post(__WEBPACK_IMPORTED_MODULE_5__HelpText_js__["b" /* TerminalHelpText */]);
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ post(__WEBPACK_IMPORTED_MODULE_6__HelpText_js__["b" /* TerminalHelpText */]);
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {post("Bad command. Please follow the tutorial");}
break;
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalLs:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalLs:
if (commandArray[0] == "ls") {
Terminal.executeListCommand(commandArray);
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {post("Bad command. Please follow the tutorial");}
break;
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalScan:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalScan:
if (commandArray[0] == "scan") {
Terminal.executeScanCommand(commandArray);
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {post("Bad command. Please follow the tutorial");}
break;
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalScanAnalyze1:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalScanAnalyze1:
if (commandArray.length == 1 && commandArray[0] == "scan-analyze") {
Terminal.executeScanAnalyzeCommand(1);
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {post("Bad command. Please follow the tutorial");}
break;
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalScanAnalyze2:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalScanAnalyze2:
if (commandArray.length == 2 && commandArray[0] == "scan-analyze" &&
commandArray[1] == "2") {
Terminal.executeScanAnalyzeCommand(2);
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {post("Bad command. Please follow the tutorial");}
break;
break;
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalConnect:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalConnect:
if (commandArray.length == 2) {
if ((commandArray[0] == "connect") &&
(commandArray[1] == "foodnstuff" || commandArray[1] == foodnstuffServ.ip)) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].currentServer = foodnstuffServ.ip;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true;
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false;
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].currentServer = foodnstuffServ.ip;
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true;
post("Connected to foodnstuff");
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {post("Wrong command! Try again!"); return;}
} else {post("Bad command. Please follow the tutorial");}
break;
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalAnalyze:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalAnalyze:
if (commandArray[0] == "analyze") {
if (commandArray.length != 1) {
post("Incorrect usage of analyze command. Usage: analyze"); return;
@@ -22947,69 +22442,69 @@ let Terminal = {
post("Analyzing system...");
hackProgressPost("Time left:");
hackProgressBarPost("[");
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].analyze();
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].analyze();
//Disable terminal
//Terminal.resetTerminalInput();
document.getElementById("terminal-input-td").innerHTML = '';
$('input[class=terminal-input]').prop('disabled', true);
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {
post("Bad command. Please follow the tutorial");
}
break;
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalNuke:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalNuke:
if (commandArray.length == 2 &&
commandArray[0] == "run" && commandArray[1] == "NUKE.exe") {
foodnstuffServ.hasAdminRights = true;
post("NUKE successful! Gained root access to foodnstuff");
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {post("Bad command. Please follow the tutorial");}
break;
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalManualHack:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalManualHack:
if (commandArray.length == 1 && commandArray[0] == "hack") {
Terminal.hackFlag = true;
hackProgressPost("Time left:");
hackProgressBarPost("[");
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hack();
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hack();
//Disable terminal
//Terminal.resetTerminalInput();
document.getElementById("terminal-input-td").innerHTML = '';
$('input[class=terminal-input]').prop('disabled', true);
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {post("Bad command. Please follow the tutorial");}
break;
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalCreateScript:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalCreateScript:
if (commandArray.length == 2 &&
commandArray[0] == "nano" && commandArray[1] == "foodnstuff.script") {
__WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadScriptEditorContent("foodnstuff", "");
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {post("Bad command. Please follow the tutorial");}
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalFree:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalFree:
if (commandArray.length == 1 && commandArray[0] == "free") {
Terminal.executeFreeCommand(commandArray);
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
}
break;
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalRunScript:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalRunScript:
if (commandArray.length == 2 &&
commandArray[0] == "run" && commandArray[1] == "foodnstuff.script") {
Terminal.runScript("foodnstuff.script");
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {post("Bad command. Please follow the tutorial");}
break;
- case __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["e" /* iTutorialSteps */].ActiveScriptsToTerminal:
+ case __WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["e" /* iTutorialSteps */].ActiveScriptsToTerminal:
if (commandArray.length == 2 &&
commandArray[0] == "tail" && commandArray[1] == "foodnstuff.script") {
//Check that the script exists on this machine
- var runningScript = Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])("foodnstuff.script", [], __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer());
+ var runningScript = Object(__WEBPACK_IMPORTED_MODULE_14__Script_js__["d" /* findRunningScript */])("foodnstuff.script", [], __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer());
if (runningScript == null) {
post("Error: No such script exists");
return;
}
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_LogBox_js__["a" /* logBoxCreate */])(runningScript);
- Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_LogBox_js__["a" /* logBoxCreate */])(runningScript);
+ Object(__WEBPACK_IMPORTED_MODULE_7__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
} else {post("Bad command. Please follow the tutorial");}
break;
default:
@@ -23022,7 +22517,7 @@ let Terminal = {
/****************** END INTERACTIVE TUTORIAL ******************/
/* Command parser */
- var s = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer();
+ var s = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer();
switch (commandArray[0].toLowerCase()) {
case "alias":
if (commandArray.length == 1) {
@@ -23052,7 +22547,7 @@ let Terminal = {
post("Analyzing system...");
hackProgressPost("Time left:");
hackProgressBarPost("[");
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].analyze();
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].analyze();
//Disable terminal
//Terminal.resetTerminalInput();
@@ -23060,7 +22555,7 @@ let Terminal = {
$('input[class=terminal-input]').prop('disabled', true);
break;
case "buy":
- if (__WEBPACK_IMPORTED_MODULE_16__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) {
+ if (__WEBPACK_IMPORTED_MODULE_17__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) {
Object(__WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__["c" /* executeDarkwebTerminalCommand */])(commandArray);
} else {
post("You need to be able to connect to the Dark Web to use the buy command. (Maybe there's a TOR router you can buy somewhere)");
@@ -23076,10 +22571,10 @@ let Terminal = {
}
for (var i = 0; i < s.messages.length; ++i) {
if (filename.endsWith(".lit") && s.messages[i] == filename) {
- Object(__WEBPACK_IMPORTED_MODULE_7__Literature_js__["b" /* showLiterature */])(s.messages[i]);
+ Object(__WEBPACK_IMPORTED_MODULE_8__Literature_js__["b" /* showLiterature */])(s.messages[i]);
return;
} else if (filename.endsWith(".msg") && s.messages[i].filename == filename) {
- Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["f" /* showMessage */])(s.messages[i]);
+ Object(__WEBPACK_IMPORTED_MODULE_9__Message_js__["f" /* showMessage */])(s.messages[i]);
return;
}
}
@@ -23108,7 +22603,7 @@ let Terminal = {
}
//Check that the script exists on this machine
- var runningScript = Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(scriptName, args, s);
+ var runningScript = Object(__WEBPACK_IMPORTED_MODULE_14__Script_js__["d" /* findRunningScript */])(scriptName, args, s);
if (runningScript == null) {
post("Error: No such script exists");
return;
@@ -23133,8 +22628,8 @@ let Terminal = {
var ip = commandArray[1];
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().serversOnNetwork.length; i++) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip == ip || __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).hostname == ip) {
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().serversOnNetwork.length; i++) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip == ip || __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).hostname == ip) {
Terminal.connectToServer(ip);
return;
}
@@ -23148,14 +22643,46 @@ let Terminal = {
return;
}
var fn = commandArray[1];
- if (fn.endsWith(".script")) {
+ if (fn === "*" || fn === "*.script" || fn === "*.txt") {
+ //Download all scripts as a zip
+ var zip = new __WEBPACK_IMPORTED_MODULE_23_jszip__();
+ if (fn === "*" || fn === "*.script") {
+ for (var i = 0; i < s.scripts.length; ++i) {
+ var file = new Blob([s.scripts[i].code], {type:"text/plain"});
+ zip.file(s.scripts[i].filename + ".js", file);
+ }
+ }
+ if (fn === "*" || fn === "*.txt") {
+ for (var i = 0; i < s.textFiles.length; ++i) {
+ var file = new Blob([s.textFiles[i].text], {type:"text/plain"});
+ zip.file(s.textFiles[i].fn, file);
+ }
+ }
+
+ var filename;
+ switch (fn) {
+ case "*.script":
+ filename = "bitburnerScripts.zip"; break;
+ case "*.txt":
+ filename = "bitburnerTexts.zip"; break;
+ default:
+ filename = "bitburnerFiles.zip"; break;
+ }
+
+ zip.generateAsync({type:"blob"}).then(function(content) {
+ __WEBPACK_IMPORTED_MODULE_24_file_saver__["saveAs"](content, filename);
+ });
+ return;
+ } else if (fn.endsWith(".script")) {
+ //Download a single script
for (var i = 0; i < s.scripts.length; ++i) {
if (s.scripts[i].filename === fn) {
return s.scripts[i].download();
}
}
} else if (fn.endsWith(".txt")) {
- var txtFile = Object(__WEBPACK_IMPORTED_MODULE_17__TextFile_js__["c" /* getTextFile */])(fn, s);
+ //Download a single text file
+ var txtFile = Object(__WEBPACK_IMPORTED_MODULE_18__TextFile_js__["c" /* getTextFile */])(fn, s);
if (txtFile !== null) {
return txtFile.download();
}
@@ -23171,17 +22698,17 @@ let Terminal = {
}
//Hack the current PC (usually for money)
//You can't hack your home pc or servers you purchased
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().purchasedByPlayer) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().purchasedByPlayer) {
post("Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers");
- } else if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights == false ) {
+ } else if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights == false ) {
post("You do not have admin rights for this machine! Cannot hack");
- } else if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().requiredHackingSkill > __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hacking_skill) {
+ } else if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().requiredHackingSkill > __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill) {
post("Your hacking skill is not high enough to attempt hacking this machine. Try analyzing the machine to determine the required hacking skill");
} else {
Terminal.hackFlag = true;
hackProgressPost("Time left:");
hackProgressBarPost("[");
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hack();
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hack();
//Disable terminal
//Terminal.resetTerminalInput();
@@ -23194,10 +22721,10 @@ let Terminal = {
post("Incorrect usage of help command. Usage: help"); return;
}
if (commandArray.length == 1) {
- post(__WEBPACK_IMPORTED_MODULE_5__HelpText_js__["b" /* TerminalHelpText */]);
+ post(__WEBPACK_IMPORTED_MODULE_6__HelpText_js__["b" /* TerminalHelpText */]);
} else {
var cmd = commandArray[1];
- var txt = __WEBPACK_IMPORTED_MODULE_5__HelpText_js__["a" /* HelpTexts */][cmd];
+ var txt = __WEBPACK_IMPORTED_MODULE_6__HelpText_js__["a" /* HelpTexts */][cmd];
if (txt == null) {
post("Error: No help topics match '" + cmd + "'");
return;
@@ -23209,9 +22736,9 @@ let Terminal = {
if (commandArray.length != 1) {
post("Incorrect usage of home command. Usage: home"); return;
}
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].currentServer = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer().ip;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true;
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false;
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].currentServer = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().ip;
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true;
post("Connected to home");
Terminal.resetTerminalInput();
break;
@@ -23220,14 +22747,14 @@ let Terminal = {
post("Incorrect usage of hostname command. Usage: hostname"); return;
}
//Print the hostname of current system
- post(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hostname);
+ post(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().hostname);
break;
case "ifconfig":
if (commandArray.length != 1) {
post("Incorrect usage of ifconfig command. Usage: ifconfig"); return;
}
//Print the IP address of the current system
- post(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().ip);
+ post(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().ip);
break;
case "kill":
if (commandArray.length < 2) {
@@ -23239,17 +22766,17 @@ let Terminal = {
for (var i = 1; i < results.length; ++i) {
args.push(results[i]);
}
- var runningScript = Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(scriptName, args, s);
+ var runningScript = Object(__WEBPACK_IMPORTED_MODULE_14__Script_js__["d" /* findRunningScript */])(scriptName, args, s);
if (runningScript == null) {
post("No such script is running. Nothing to kill");
return;
}
- Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScript, s.ip);
+ Object(__WEBPACK_IMPORTED_MODULE_11__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScript, s.ip);
post("Killing " + scriptName + ". May take up to a few minutes for the scripts to die...");
break;
case "killall":
for (var i = s.runningScripts.length-1; i >= 0; --i) {
- Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["d" /* killWorkerScript */])(s.runningScripts[i], s.ip);
+ Object(__WEBPACK_IMPORTED_MODULE_11__NetscriptWorker_js__["d" /* killWorkerScript */])(s.runningScripts[i], s.ip);
}
post("Killing all running scripts. May take up to a few minutes for the scripts to die...");
break;
@@ -23257,7 +22784,7 @@ let Terminal = {
Terminal.executeListCommand(commandArray);
break;
case "lscpu":
- post(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().cpuCores + " Core(s)");
+ post(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().cpuCores + " Core(s)");
break;
case "mem":
if (commandArray.length != 2) {
@@ -23279,13 +22806,13 @@ let Terminal = {
scriptName = results[0];
}
- var currServ = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer();
+ var currServ = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer();
for (var i = 0; i < currServ.scripts.length; ++i) {
if (scriptName == currServ.scripts[i].filename) {
var scriptBaseRamUsage = currServ.scripts[i].ramUsage;
var ramUsage = scriptBaseRamUsage * numThreads * Math.pow(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].MultithreadingRAMCost, numThreads-1);
- post("This script requires " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(ramUsage, 2) + "GB of RAM to run for " + numThreads + " thread(s)");
+ post("This script requires " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(ramUsage, 2) + "GB of RAM to run for " + numThreads + " thread(s)");
return;
}
}
@@ -23297,23 +22824,28 @@ let Terminal = {
}
var filename = commandArray[1];
-
- //Can only edit script files
- if (filename.endsWith(".script") == false) {
- post("Error: Only .script files are editable with nano (filename must end with .script)"); return;
- }
-
- //Script name is the filename without the .script at the end
- var scriptname = filename.substr(0, filename.indexOf(".script"));
-
- //Check if the script already exists
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().scripts.length; i++) {
- if (filename == __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().scripts[i].filename) {
- __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadScriptEditorContent(scriptname, __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().scripts[i].code);
- return;
- }
- }
- __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadScriptEditorContent(scriptname, "");
+ if (filename === ".fconf") {
+ var text = Object(__WEBPACK_IMPORTED_MODULE_5__Fconf_js__["b" /* createFconf */])();
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadScriptEditorContent(filename, text);
+ return;
+ } else if (filename.endsWith(".script")) {
+ for (var i = 0; i < s.scripts.length; i++) {
+ if (filename == s.scripts[i].filename) {
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadScriptEditorContent(filename, s.scripts[i].code);
+ return;
+ }
+ }
+ } else if (filename.endsWith(".txt")) {
+ for (var i = 0; i < s.textFiles.length; ++i) {
+ if (filename === s.textFiles[i].fn) {
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadScriptEditorContent(filename, s.textFiles[i].text);
+ return;
+ }
+ }
+ } else {
+ post("Error: Invalid file. Only scripts (.script), text files (.txt), or .fconf can be edited with nano"); return;
+ }
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadScriptEditorContent(filename);
break;
case "ps":
if (commandArray.length != 1) {
@@ -23360,7 +22892,7 @@ let Terminal = {
} else if (delTarget.endsWith(".lit")) {
for (var i = 0; i < s.messages.length; ++i) {
var f = s.messages[i];
- if (!(f instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) && Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["g" /* isString */])(f) && f === delTarget) {
+ if (!(f instanceof __WEBPACK_IMPORTED_MODULE_9__Message_js__["a" /* Message */]) && Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["g" /* isString */])(f) && f === delTarget) {
s.messages.splice(i, 1);
return;
}
@@ -23420,11 +22952,11 @@ let Terminal = {
post("Incorrect usage of scan-analyze command. depth argument must be positive numeric");
return;
}
- if (depth > 3 && !__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV1) &&
- !__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV2)) {
+ if (depth > 3 && !__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV1) &&
+ !__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV2)) {
post("You cannot scan-analyze with that high of a depth. Maximum depth is 3");
return;
- } else if (depth > 5 && !__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV2)) {
+ } else if (depth > 5 && !__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV2)) {
post("You cannot scan-analyze with that high of a depth. Maximum depth is 5");
return;
} else if (depth > 10) {
@@ -23452,19 +22984,19 @@ let Terminal = {
post("Error: scp only works for .script, .txt, and .lit files");
return;
}
- var destServer = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(args[1]);
+ var destServer = Object(__WEBPACK_IMPORTED_MODULE_15__Server_js__["e" /* getServer */])(args[1]);
if (destServer == null) {
post("Invalid destination. " + args[1] + " not found");
return;
}
var ip = destServer.ip;
- var currServ = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer();
+ var currServ = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer();
//Scp for lit files
if (scriptname.endsWith(".lit")) {
var found = false;
for (var i = 0; i < currServ.messages.length; ++i) {
- if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) && currServ.messages[i] == scriptname) {
+ if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_9__Message_js__["a" /* Message */]) && currServ.messages[i] == scriptname) {
found = true;
break;
}
@@ -23505,7 +23037,7 @@ let Terminal = {
return post(scriptname + " copied over to " + destServer.hostname);
}
}
- var newFile = new __WEBPACK_IMPORTED_MODULE_17__TextFile_js__["a" /* TextFile */](txtFile.fn, txtFile.text);
+ var newFile = new __WEBPACK_IMPORTED_MODULE_18__TextFile_js__["a" /* TextFile */](txtFile.fn, txtFile.text);
destServer.textFiles.push(newFile);
return post(scriptname + " copied over to " + destServer.hostname);
}
@@ -23535,7 +23067,7 @@ let Terminal = {
}
}
- var newScript = new __WEBPACK_IMPORTED_MODULE_13__Script_js__["c" /* Script */]();
+ var newScript = new __WEBPACK_IMPORTED_MODULE_14__Script_js__["c" /* Script */]();
newScript.filename = scriptname;
newScript.code = sourceScript.code;
newScript.ramUsage = sourceScript.ramUsage;
@@ -23548,7 +23080,7 @@ let Terminal = {
post("Incorrect number of arguments. Usage: sudov"); return;
}
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights) {
post("You have ROOT access to this machine");
} else {
post("You do NOT have root access to this machine");
@@ -23571,12 +23103,12 @@ let Terminal = {
}
//Check that the script exists on this machine
- var runningScript = Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(scriptName, args, s);
+ var runningScript = Object(__WEBPACK_IMPORTED_MODULE_14__Script_js__["d" /* findRunningScript */])(scriptName, args, s);
if (runningScript == null) {
post("Error: No such script exists");
return;
}
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_LogBox_js__["a" /* logBoxCreate */])(runningScript);
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_LogBox_js__["a" /* logBoxCreate */])(runningScript);
}
break;
case "theme":
@@ -23602,9 +23134,9 @@ let Terminal = {
} else {
return post("Theme not found");
}
- __WEBPACK_IMPORTED_MODULE_15__Settings_js__["a" /* Settings */].ThemeHighlightColor = document.body.style.getPropertyValue("--my-highlight-color");
- __WEBPACK_IMPORTED_MODULE_15__Settings_js__["a" /* Settings */].ThemeFontColor = document.body.style.getPropertyValue("--my-font-color");
- __WEBPACK_IMPORTED_MODULE_15__Settings_js__["a" /* Settings */].ThemeBackgroundColor = document.body.style.getPropertyValue("--my-background-color");
+ __WEBPACK_IMPORTED_MODULE_16__Settings_js__["a" /* Settings */].ThemeHighlightColor = document.body.style.getPropertyValue("--my-highlight-color");
+ __WEBPACK_IMPORTED_MODULE_16__Settings_js__["a" /* Settings */].ThemeFontColor = document.body.style.getPropertyValue("--my-font-color");
+ __WEBPACK_IMPORTED_MODULE_16__Settings_js__["a" /* Settings */].ThemeBackgroundColor = document.body.style.getPropertyValue("--my-background-color");
} else {
var inputBackgroundHex = args[0];
var inputTextHex = args[1];
@@ -23615,9 +23147,9 @@ let Terminal = {
document.body.style.setProperty('--my-highlight-color',inputHighlightHex);
document.body.style.setProperty('--my-font-color',inputTextHex);
document.body.style.setProperty('--my-background-color',inputBackgroundHex);
- __WEBPACK_IMPORTED_MODULE_15__Settings_js__["a" /* Settings */].ThemeHighlightColor = document.body.style.getPropertyValue("--my-highlight-color");
- __WEBPACK_IMPORTED_MODULE_15__Settings_js__["a" /* Settings */].ThemeFontColor = document.body.style.getPropertyValue("--my-font-color");
- __WEBPACK_IMPORTED_MODULE_15__Settings_js__["a" /* Settings */].ThemeBackgroundColor = document.body.style.getPropertyValue("--my-background-color");
+ __WEBPACK_IMPORTED_MODULE_16__Settings_js__["a" /* Settings */].ThemeHighlightColor = document.body.style.getPropertyValue("--my-highlight-color");
+ __WEBPACK_IMPORTED_MODULE_16__Settings_js__["a" /* Settings */].ThemeFontColor = document.body.style.getPropertyValue("--my-font-color");
+ __WEBPACK_IMPORTED_MODULE_16__Settings_js__["a" /* Settings */].ThemeBackgroundColor = document.body.style.getPropertyValue("--my-background-color");
} else {
return post("Invalid Hex Input for theme");
}
@@ -23630,7 +23162,7 @@ let Terminal = {
post("Script Threads RAM Usage");
- var currRunningScripts = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().runningScripts;
+ var currRunningScripts = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().runningScripts;
//Iterate through scripts on current server
for(var i = 0; i < currRunningScripts.length; i++) {
var script = currRunningScripts[i];
@@ -23645,7 +23177,7 @@ let Terminal = {
var spacesThread = Array(numSpacesThread+1).join(" ");
//Calculate and transform RAM usage
- ramUsage = Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(script.scriptRef.ramUsage * script.threads, 2).toString() + "GB";
+ ramUsage = Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(script.scriptRef.ramUsage * script.threads, 2).toString() + "GB";
var entry = [script.filename, spacesScript, script.threads, spacesThread, ramUsage];
post(entry.join(""));
@@ -23673,16 +23205,16 @@ let Terminal = {
connectToServer: function(ip) {
console.log("Connect to server called");
- var serv = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip);
+ var serv = Object(__WEBPACK_IMPORTED_MODULE_15__Server_js__["e" /* getServer */])(ip);
if (serv == null) {
post("Invalid server. Connection failed.");
return;
}
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].currentServer = serv.ip;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true;
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false;
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].currentServer = serv.ip;
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true;
post("Connected to " + serv.hostname);
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hostname == "darkweb") {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().hostname == "darkweb") {
Object(__WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__["b" /* checkIfConnectedToDarkweb */])(); //Posts a 'help' message if connecting to dark web
}
Terminal.resetTerminalInput();
@@ -23710,7 +23242,7 @@ let Terminal = {
var allFiles = [];
//Get all of the programs and scripts on the machine into one temporary array
- var s = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer();
+ var s = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer();
for (var i = 0; i < s.programs.length; i++) {
if (filter) {
if (s.programs[i].includes(filter)) {
@@ -23732,7 +23264,7 @@ let Terminal = {
}
for (var i = 0; i < s.messages.length; i++) {
if (filter) {
- if (s.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) {
+ if (s.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_9__Message_js__["a" /* Message */]) {
if (s.messages[i].filename.includes(filter)) {
allFiles.push(s.messages[i].filename);
}
@@ -23740,7 +23272,7 @@ let Terminal = {
allFiles.push(s.messages[i]);
}
} else {
- if (s.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) {
+ if (s.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_9__Message_js__["a" /* Message */]) {
allFiles.push(s.messages[i].filename);
} else {
allFiles.push(s.messages[i]);
@@ -23771,9 +23303,9 @@ let Terminal = {
}
//Displays available network connections using TCP
post("Hostname IP Root Access");
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().serversOnNetwork.length; i++) {
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().serversOnNetwork.length; i++) {
//Add hostname
- var entry = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i);
+ var entry = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i);
if (entry == null) {continue;}
entry = entry.hostname;
@@ -23781,16 +23313,16 @@ let Terminal = {
var numSpaces = 21 - entry.length;
var spaces = Array(numSpaces+1).join(" ");
entry += spaces;
- entry += __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip;
+ entry += __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip;
//Calculate padding and add root access info
var hasRoot;
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).hasAdminRights) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).hasAdminRights) {
hasRoot = 'Y';
} else {
hasRoot = 'N';
}
- numSpaces = 21 - __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip.length;
+ numSpaces = 21 - __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip.length;
spaces = Array(numSpaces+1).join(" ");
entry += spaces;
entry += hasRoot;
@@ -23803,11 +23335,11 @@ let Terminal = {
//TODO Using array as stack for now, can make more efficient
post("~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~");
post(" ");
- var visited = new __WEBPACK_IMPORTED_MODULE_13__Script_js__["a" /* AllServersMap */]();
+ var visited = new __WEBPACK_IMPORTED_MODULE_14__Script_js__["a" /* AllServersMap */]();
var stack = [];
var depthQueue = [0];
- var currServ = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer();
+ var currServ = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer();
stack.push(currServ);
while(stack.length != 0) {
var s = stack.pop();
@@ -23825,7 +23357,7 @@ let Terminal = {
}
if (d == 0) {continue;} //Don't print current server
var titleDashes = Array((d-1) * 4 + 1).join("-");
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].AutoLink)) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].AutoLink)) {
post("" + titleDashes + "> " + s.hostname + "", false);
} else {
post("" + titleDashes + ">" + s.hostname + "");
@@ -23858,9 +23390,9 @@ let Terminal = {
if (commandArray.length != 1) {
post("Incorrect usage of free command. Usage: free"); return;
}
- post("Total: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().maxRam, 2) + " GB");
- post("Used: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().ramUsed, 2) + " GB");
- post("Available: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().maxRam - __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().ramUsed, 2) + " GB");
+ post("Total: " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().maxRam, 2) + " GB");
+ post("Used: " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().ramUsed, 2) + " GB");
+ post("Available: " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().maxRam - __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().ramUsed, 2) + " GB");
},
//First called when the "run [program]" command is called. Checks to see if you
@@ -23875,7 +23407,7 @@ let Terminal = {
} else {
name = programName;
}
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(name)) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasProgram(name)) {
Terminal.executeProgram(programName);
return;
}
@@ -23884,7 +23416,7 @@ let Terminal = {
//Contains the implementations of all possible programs
executeProgram: function(programName) {
- var s = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer();
+ var s = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer();
var splitArgs = programName.split(" ");
if (splitArgs.length > 1) {
programName = splitArgs[0];
@@ -23894,9 +23426,9 @@ let Terminal = {
if (s.hasAdminRights) {
post("You already have root access to this computer. There is no reason to run NUKE.exe");
} else {
- if (s.openPortCount >= __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().numOpenPortsRequired) {
+ if (s.openPortCount >= __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().numOpenPortsRequired) {
s.hasAdminRights = true;
- post("NUKE successful! Gained root access to " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hostname);
+ post("NUKE successful! Gained root access to " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer().hostname);
//TODO Make this take time rather than be instant
} else {
post("NUKE unsuccessful. Not enough ports have been opened");
@@ -23953,7 +23485,7 @@ let Terminal = {
post("Must pass a server hostname or IP as an argument for ServerProfiler.exe");
return;
}
- var serv = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(splitArgs[1]);
+ var serv = Object(__WEBPACK_IMPORTED_MODULE_15__Server_js__["e" /* getServer */])(splitArgs[1]);
if (serv == null) {
post("Invalid server IP/hostname");
return;
@@ -23962,9 +23494,9 @@ let Terminal = {
post("Server base security level: " + serv.baseDifficulty);
post("Server current security level: " + serv.hackDifficulty);
post("Server growth rate: " + serv.serverGrowth);
- post("Netscript hack() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptEvaluator_js__["k" /* scriptCalculateHackingTime */])(serv), 1) + "s");
- post("Netscript grow() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptEvaluator_js__["i" /* scriptCalculateGrowTime */])(serv)/1000, 1) + "s");
- post("Netscript weaken() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptEvaluator_js__["m" /* scriptCalculateWeakenTime */])(serv)/1000, 1) + "s");
+ post("Netscript hack() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptEvaluator_js__["k" /* scriptCalculateHackingTime */])(serv), 1) + "s");
+ post("Netscript grow() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptEvaluator_js__["i" /* scriptCalculateGrowTime */])(serv)/1000, 1) + "s");
+ post("Netscript weaken() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptEvaluator_js__["m" /* scriptCalculateWeakenTime */])(serv)/1000, 1) + "s");
break;
case __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].AutoLink:
post("This executable cannot be run.");
@@ -23980,30 +23512,30 @@ let Terminal = {
post("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10.");
break;
case __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].Flight:
- post("Augmentations: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].augmentations.length + " / 30");
- post("Money: $" + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.toNumber(), 2) + " / $" + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(100000000000, 2));
+ post("Augmentations: " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].augmentations.length + " / 30");
+ post("Money: $" + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.toNumber(), 2) + " / $" + Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(100000000000, 2));
post("One path below must be fulfilled...");
post("----------HACKING PATH----------");
- post("Hacking skill: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hacking_skill + " / 2500");
+ post("Hacking skill: " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill + " / 2500");
post("----------COMBAT PATH----------");
- post("Strength: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].strength + " / 1500");
- post("Defense: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].defense + " / 1500");
- post("Dexterity: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].dexterity + " / 1500");
- post("Agility: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].agility + " / 1500");
+ post("Strength: " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].strength + " / 1500");
+ post("Defense: " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].defense + " / 1500");
+ post("Dexterity: " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].dexterity + " / 1500");
+ post("Agility: " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].agility + " / 1500");
break;
case __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].BitFlume:
- var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_21__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(),
- noBtn = Object(__WEBPACK_IMPORTED_MODULE_21__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_22__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(),
+ noBtn = Object(__WEBPACK_IMPORTED_MODULE_22__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
yesBtn.innerHTML = "Travel to BitNode Nexus";
noBtn.innerHTML = "Cancel";
yesBtn.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_12__RedPill_js__["a" /* hackWorldDaemon */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN, true);
- return Object(__WEBPACK_IMPORTED_MODULE_21__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ Object(__WEBPACK_IMPORTED_MODULE_13__RedPill_js__["a" /* hackWorldDaemon */])(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN, true);
+ return Object(__WEBPACK_IMPORTED_MODULE_22__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
});
noBtn.addEventListener("click", function() {
- return Object(__WEBPACK_IMPORTED_MODULE_21__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ return Object(__WEBPACK_IMPORTED_MODULE_22__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
});
- Object(__WEBPACK_IMPORTED_MODULE_21__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("WARNING: USING THIS PROGRAM WILL CAUSE YOU TO LOSE ALL OF YOUR PROGRESS ON THE CURRENT BITNODE.
" +
+ Object(__WEBPACK_IMPORTED_MODULE_22__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("WARNING: USING THIS PROGRAM WILL CAUSE YOU TO LOSE ALL OF YOUR PROGRESS ON THE CURRENT BITNODE.
" +
"Do you want to travel to the BitNode Nexus? This allows you to reset the current BitNode " +
"and select a new one.");
@@ -24015,7 +23547,7 @@ let Terminal = {
},
runScript: function(scriptName) {
- var server = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer();
+ var server = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getCurrentServer();
var numThreads = 1;
var args = [];
@@ -24073,7 +23605,7 @@ let Terminal = {
//Check if this script is already running
- if (Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(scriptName, args, server) != null) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_14__Script_js__["d" /* findRunningScript */])(scriptName, args, server) != null) {
post("ERROR: This script is already running. Cannot run multiple instances");
return;
}
@@ -24095,13 +23627,13 @@ let Terminal = {
return;
} else {
//Able to run script
- post("Running script with " + numThreads + " thread(s) and args: " + Object(__WEBPACK_IMPORTED_MODULE_19__utils_HelperFunctions_js__["j" /* printArray */])(args) + ".");
+ post("Running script with " + numThreads + " thread(s) and args: " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__["j" /* printArray */])(args) + ".");
post("May take a few seconds to start up the process...");
- var runningScriptObj = new __WEBPACK_IMPORTED_MODULE_13__Script_js__["b" /* RunningScript */](script, args);
+ var runningScriptObj = new __WEBPACK_IMPORTED_MODULE_14__Script_js__["b" /* RunningScript */](script, args);
runningScriptObj.threads = numThreads;
server.runningScripts.push(runningScriptObj);
- Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["c" /* addWorkerScript */])(runningScriptObj, server);
+ Object(__WEBPACK_IMPORTED_MODULE_11__NetscriptWorker_js__["c" /* addWorkerScript */])(runningScriptObj, server);
return;
}
}
@@ -24116,7 +23648,7 @@ let Terminal = {
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
/***/ }),
-/* 20 */
+/* 19 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -24170,7 +23702,7 @@ function isValidIPAddress(ipaddress) {
/***/ }),
-/* 21 */
+/* 20 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -24184,11 +23716,11 @@ function isValidIPAddress(ipaddress) {
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Augmentation; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptWorker_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptWorker_js__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Prestige_js__ = __webpack_require__(38);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Script_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Prestige_js__ = __webpack_require__(36);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Script_js__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Server_js__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_JSONReviver_js__ = __webpack_require__(8);
@@ -26281,7 +25813,7 @@ function giveAllAugmentations() {
/***/ }),
-/* 22 */
+/* 21 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -26295,7 +25827,7 @@ function giveAllAugmentations() {
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return CompanyPosition; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return companyExists; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Location_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Location_js__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_JSONReviver_js__ = __webpack_require__(8);
@@ -27447,6 +26979,749 @@ function getJobRequirementText(company, pos, tooltiptext=false) {
+/***/ }),
+/* 22 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return updateScriptEditorContent; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return loadAllRunningScripts; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return findRunningScript; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return RunningScript; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Script; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AllServersMap; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return scriptEditorInit; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Fconf_js__ = __webpack_require__(180);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__InteractiveTutorial_js__ = __webpack_require__(33);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(34);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__NetscriptFunctions_js__ = __webpack_require__(23);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__NetscriptWorker_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Settings_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Terminal_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__TextFile_js__ = __webpack_require__(68);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_acorn_js__ = __webpack_require__(39);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_12__utils_acorn_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+var ace = __webpack_require__(52);
+__webpack_require__(53);
+__webpack_require__(54);
+__webpack_require__(55);
+__webpack_require__(56);
+__webpack_require__(57);
+__webpack_require__(58);
+__webpack_require__(59);
+__webpack_require__(60);
+__webpack_require__(61);
+__webpack_require__(62);
+__webpack_require__(63);
+__webpack_require__(64);
+__webpack_require__(65);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var keybindings = {
+ ace: null,
+ vim: "ace/keyboard/vim",
+ emacs: "ace/keyboard/emacs",
+};
+
+var scriptEditorRamCheck = null, scriptEditorRamText = null;
+function scriptEditorInit() {
+ //Create buttons at the bottom of script editor
+ var wrapper = document.getElementById("script-editor-buttons-wrapper");
+ if (wrapper == null) {
+ console.log("Error finding 'script-editor-buttons-wrapper'");
+ return;
+ }
+ var closeButton = Object(__WEBPACK_IMPORTED_MODULE_15__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", display:"inline-block",
+ innerText:"Save & Close (Ctrl + b)",
+ clickListener:()=>{
+ saveAndCloseScriptEditor();
+ return false;
+ }
+ });
+
+ scriptEditorRamText = Object(__WEBPACK_IMPORTED_MODULE_15__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ display:"inline-block", margin:"10px", id:"script-editor-status-text"
+ });
+
+ var checkboxLabel = Object(__WEBPACK_IMPORTED_MODULE_15__utils_HelperFunctions_js__["f" /* createElement */])("label", {
+ for:"script-editor-ram-check", margin:"4px", marginTop: "8px",
+ innerText:"Dynamic RAM Usage Checker", color:"white",
+ tooltip:"Enable/Disable the dynamic RAM Usage display. You may " +
+ "want to disable it for very long scripts because there may be " +
+ "performance issues"
+ });
+
+ scriptEditorRamCheck = Object(__WEBPACK_IMPORTED_MODULE_15__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"checkbox", name:"script-editor-ram-check", id:"script-editor-ram-check",
+ margin:"4px", marginTop: "8px",
+ });
+ scriptEditorRamCheck.checked = true;
+
+ var documentationButton = Object(__WEBPACK_IMPORTED_MODULE_15__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ display:"inline-block", class:"a-link-button", innerText:"Netscript Documentation",
+ href:"https://bitburner.readthedocs.io/en/latest/index.html",
+ target:"_blank"
+ });
+
+ wrapper.appendChild(closeButton);
+ wrapper.appendChild(scriptEditorRamText);
+ wrapper.appendChild(scriptEditorRamCheck);
+ wrapper.appendChild(checkboxLabel);
+ wrapper.appendChild(documentationButton);
+
+ //Initialize ACE Script editor
+ var editor = ace.edit('javascript-editor');
+ editor.getSession().setMode('ace/mode/netscript');
+ editor.setTheme('ace/theme/monokai');
+ document.getElementById('javascript-editor').style.fontSize='16px';
+ editor.setOption("showPrintMargin", false);
+
+ /* Script editor options */
+ //Theme
+ var themeDropdown = document.getElementById("script-editor-option-theme");
+ if (__WEBPACK_IMPORTED_MODULE_9__Settings_js__["a" /* Settings */].EditorTheme) {
+ var initialIndex = 2;
+ for (var i = 0; i < themeDropdown.options.length; ++i) {
+ if (themeDropdown.options[i].value === __WEBPACK_IMPORTED_MODULE_9__Settings_js__["a" /* Settings */].EditorTheme) {
+ initialIndex = i;
+ break;
+ }
+ }
+ themeDropdown.selectedIndex = initialIndex;
+ } else {
+ themeDropdown.selectedIndex = 2;
+ }
+
+ themeDropdown.onchange = function() {
+ var val = themeDropdown.value;
+ __WEBPACK_IMPORTED_MODULE_9__Settings_js__["a" /* Settings */].EditorTheme = val;
+ var themePath = "ace/theme/" + val.toLowerCase();
+ editor.setTheme(themePath);
+ };
+ themeDropdown.onchange();
+
+ //Keybinding
+ var keybindingDropdown = document.getElementById("script-editor-option-keybinding");
+ if (__WEBPACK_IMPORTED_MODULE_9__Settings_js__["a" /* Settings */].EditorKeybinding) {
+ var initialIndex = 0;
+ for (var i = 0; i < keybindingDropdown.options.length; ++i) {
+ if (keybindingDropdown.options[i].value === __WEBPACK_IMPORTED_MODULE_9__Settings_js__["a" /* Settings */].EditorKeybinding) {
+ initialIndex = i;
+ break;
+ }
+ }
+ keybindingDropdown.selectedIndex = initialIndex;
+ } else {
+ keybindingDropdown.selectedIndex = 0;
+ }
+ keybindingDropdown.onchange = function() {
+ var val = keybindingDropdown.value;
+ __WEBPACK_IMPORTED_MODULE_9__Settings_js__["a" /* Settings */].EditorKeybinding = val;
+ editor.setKeyboardHandler(keybindings[val.toLowerCase()]);
+ };
+ keybindingDropdown.onchange();
+
+ //Highlight Active line
+ var highlightActiveChkBox = document.getElementById("script-editor-option-highlightactiveline");
+ highlightActiveChkBox.onchange = function() {
+ editor.setHighlightActiveLine(highlightActiveChkBox.checked);
+ };
+
+ //Show Invisibles
+ var showInvisiblesChkBox = document.getElementById("script-editor-option-showinvisibles");
+ showInvisiblesChkBox.onchange = function() {
+ editor.setShowInvisibles(showInvisiblesChkBox.checked);
+ };
+
+ //Use Soft Tab
+ var softTabChkBox = document.getElementById("script-editor-option-usesofttab");
+ softTabChkBox.onchange = function() {
+ editor.getSession().setUseSoftTabs(softTabChkBox.checked);
+ };
+
+ //Jshint Maxerr
+ var maxerr = document.getElementById("script-editor-option-maxerr");
+ var maxerrLabel = document.getElementById("script-editor-option-maxerror-value-label");
+ maxerrLabel.innerHTML = maxerr.value;
+ maxerr.onchange = function() {
+ editor.getSession().$worker.send("changeOptions", [{maxerr:maxerr.value}]);
+ maxerrLabel.innerHTML = maxerr.value;
+ }
+
+ //Configure some of the VIM keybindings
+ ace.config.loadModule('ace/keyboard/vim', function(module) {
+ var VimApi = module.CodeMirror.Vim;
+ VimApi.defineEx('write', 'w', function(cm, input) {
+ saveAndCloseScriptEditor();
+ });
+ VimApi.defineEx('quit', 'q', function(cm, input) {
+ __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadTerminalContent();
+ });
+ VimApi.defineEx('xwritequit', 'x', function(cm, input) {
+ saveAndCloseScriptEditor();
+ });
+ VimApi.defineEx('wqwritequit', 'wq', function(cm, input) {
+ saveAndCloseScriptEditor();
+ });
+ });
+
+ //Function autocompleter
+ editor.setOption("enableBasicAutocompletion", true);
+ var autocompleter = {
+ getCompletions: function(editor, session, pos, prefix, callback) {
+ if (prefix.length === 0) {callback(null, []); return;}
+ var words = [];
+ var fns = Object(__WEBPACK_IMPORTED_MODULE_5__NetscriptFunctions_js__["a" /* NetscriptFunctions */])(null);
+ for (var name in fns) {
+ if (fns.hasOwnProperty(name)) {
+ words.push({
+ name: name,
+ value: name,
+ });
+ }
+ }
+ callback(null, words);
+ },
+ }
+ editor.completers = [autocompleter];
+}
+
+//Updates RAM usage in script
+function updateScriptEditorContent() {
+ var filename = document.getElementById("script-editor-filename").value;
+ if (scriptEditorRamCheck == null || !scriptEditorRamCheck.checked || !filename.endsWith(".script")) {
+ scriptEditorRamText.innerText = "N/A";
+ return;
+ }
+ var editor = ace.edit('javascript-editor');
+ var code = editor.getValue();
+ var codeCopy = code.repeat(1);
+ var ramUsage = calculateRamUsage(codeCopy);
+ if (ramUsage !== -1) {
+ scriptEditorRamText.innerText = "RAM: " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(ramUsage, 2).toString() + "GB";
+ } else {
+ scriptEditorRamText.innerText = "RAM: Syntax Error";
+ }
+}
+
+//Define key commands in script editor (ctrl o to save + close, etc.)
+$(document).keydown(function(e) {
+ if (__WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].Page.ScriptEditor) {
+ //Ctrl + b
+ if (e.keyCode == 66 && e.ctrlKey) {
+ e.preventDefault();
+ saveAndCloseScriptEditor();
+ }
+ }
+});
+
+function saveAndCloseScriptEditor() {
+ var filename = document.getElementById("script-editor-filename").value;
+ var editor = ace.edit('javascript-editor');
+ var code = editor.getValue();
+ if (__WEBPACK_IMPORTED_MODULE_3__InteractiveTutorial_js__["b" /* iTutorialIsRunning */] && __WEBPACK_IMPORTED_MODULE_3__InteractiveTutorial_js__["a" /* currITutorialStep */] == __WEBPACK_IMPORTED_MODULE_3__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalTypeScript) {
+ if (filename != "foodnstuff.script") {
+ Object(__WEBPACK_IMPORTED_MODULE_13__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Leave the script name as 'foodnstuff'!");
+ return;
+ }
+ code = code.replace(/\s/g, "");
+ if (code.indexOf("while(true){hack('foodnstuff');}") == -1) {
+ Object(__WEBPACK_IMPORTED_MODULE_13__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Please copy and paste the code from the tutorial!");
+ return;
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_3__InteractiveTutorial_js__["c" /* iTutorialNextStep */])();
+ }
+
+ if (filename == "") {
+ Object(__WEBPACK_IMPORTED_MODULE_13__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You must specify a filename!");
+ return;
+ }
+
+ if (checkValidFilename(filename) == false) {
+ Object(__WEBPACK_IMPORTED_MODULE_13__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Script filename can contain only alphanumerics, hyphens, and underscores");
+ return;
+ }
+
+ var s = __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].getCurrentServer();
+ if (filename === ".fconf") {
+ try {
+ Object(__WEBPACK_IMPORTED_MODULE_2__Fconf_js__["d" /* parseFconfSettings */])(code);
+ } catch(e) {
+ Object(__WEBPACK_IMPORTED_MODULE_13__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid .fconf file");
+ return;
+ }
+ } else if (filename.endsWith(".script")) {
+ //If the current script already exists on the server, overwrite it
+ for (var i = 0; i < s.scripts.length; i++) {
+ if (filename == s.scripts[i].filename) {
+ s.scripts[i].saveScript();
+ __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadTerminalContent();
+ return;
+ }
+ }
+
+ //If the current script does NOT exist, create a new one
+ var script = new Script();
+ script.saveScript();
+ s.scripts.push(script);
+ } else if (filename.endsWith(".txt")) {
+ for (var i = 0; i < s.textFiles.length; ++i) {
+ if (s.textFiles[i].fn === filename) {
+ s.textFiles[i].write(code);
+ __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadTerminalContent();
+ return;
+ }
+ }
+ var textFile = new __WEBPACK_IMPORTED_MODULE_11__TextFile_js__["a" /* TextFile */](filename, code);
+ s.textFiles.push(textFile);
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_13__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid filename. Must be either a script (.script) or " +
+ " or text file (.txt)")
+ return;
+ }
+ __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadTerminalContent();
+}
+
+//Checks that the string contains only valid characters for a filename, which are alphanumeric,
+// underscores, hyphens, and dots
+function checkValidFilename(filename) {
+ var regex = /^[.a-zA-Z0-9_-]+$/;
+
+ if (filename.match(regex)) {
+ return true;
+ }
+ return false;
+}
+
+function Script() {
+ this.filename = "";
+ this.code = "";
+ this.ramUsage = 0;
+ this.server = ""; //IP of server this script is on
+};
+
+//Get the script data from the Script Editor and save it to the object
+Script.prototype.saveScript = function() {
+ if (__WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].Page.ScriptEditor) {
+ //Update code and filename
+ var editor = ace.edit('javascript-editor');
+ var code = editor.getValue();
+ this.code = code.replace(/^\s+|\s+$/g, '');
+
+ var filename = document.getElementById("script-editor-filename").value;
+ this.filename = filename;
+
+ //Server
+ this.server = __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].currentServer;
+
+ //Calculate/update ram usage, execution time, etc.
+ this.updateRamUsage();
+ }
+}
+
+//Updates how much RAM the script uses when it is running.
+Script.prototype.updateRamUsage = function() {
+ var codeCopy = this.code.repeat(1);
+ var res = calculateRamUsage(codeCopy);
+ if (res !== -1) {
+ this.ramUsage = res;
+ }
+}
+
+function calculateRamUsage(codeCopy) {
+ //Create a temporary/mock WorkerScript and an AST from the code
+ var currServ = __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].getCurrentServer();
+ var workerScript = new __WEBPACK_IMPORTED_MODULE_6__NetscriptWorker_js__["b" /* WorkerScript */]({
+ filename:"foo",
+ scriptRef: {code:""},
+ args:[]
+ });
+ workerScript.checkingRam = true; //Netscript functions will return RAM usage
+ workerScript.serverIp = currServ.ip;
+
+ try {
+ var ast = Object(__WEBPACK_IMPORTED_MODULE_12__utils_acorn_js__["parse"])(codeCopy, {sourceType:"module"});
+ } catch(e) {
+ return -1;
+ }
+
+ //Search through AST, scanning for any 'Identifier' nodes for functions, or While/For/If nodes
+ var queue = [], ramUsage = 1.4;
+ var whileUsed = false, forUsed = false, ifUsed = false;
+ queue.push(ast);
+ while (queue.length != 0) {
+ var exp = queue.shift();
+ switch (exp.type) {
+ case "ImportDeclaration":
+ //Gets an array of all imported functions as AST expressions
+ //and pushes them on the queue.
+ var res = Object(__WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__["b" /* evaluateImport */])(exp, workerScript, true);
+ for (var i = 0; i < res.length; ++i) {
+ queue.push(res[i]);
+ }
+ break;
+ case "BlockStatement":
+ case "Program":
+ for (var i = 0; i < exp.body.length; ++i) {
+ if (exp.body[i] instanceof __WEBPACK_IMPORTED_MODULE_12__utils_acorn_js__["Node"]) {
+ queue.push(exp.body[i]);
+ }
+ }
+ break;
+ case "WhileStatement":
+ if (!whileUsed) {
+ ramUsage += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptWhileRamCost;
+ whileUsed = true;
+ }
+ break;
+ case "ForStatement":
+ if (!forUsed) {
+ ramUsage += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptForRamCost;
+ forUsed = true;
+ }
+ break;
+ case "IfStatement":
+ if (!ifUsed) {
+ ramUsage += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptIfRamCost;
+ ifUsed = true;
+ }
+ break;
+ case "Identifier":
+ if (exp.name in workerScript.env.vars) {
+ var func = workerScript.env.get(exp.name);
+ if (typeof func === "function") {
+ try {
+ var res = func.apply(null, []);
+ if (typeof res === "number") {
+ ramUsage += res;
+ }
+ } catch(e) {
+ console.log("ERROR applying function: " + e);
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ for (var prop in exp) {
+ if (exp.hasOwnProperty(prop)) {
+ if (exp[prop] instanceof __WEBPACK_IMPORTED_MODULE_12__utils_acorn_js__["Node"]) {
+ queue.push(exp[prop]);
+ }
+ }
+ }
+ }
+
+ //Special case: hacknetnodes array
+ if (codeCopy.includes("hacknetnodes")) {
+ ramUsage += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptHacknetNodesRamCost;
+ }
+ return ramUsage;
+}
+
+Script.prototype.download = function() {
+ var filename = this.filename + ".js";
+ var file = new Blob([this.code], {type: 'text/plain'});
+ if (window.navigator.msSaveOrOpenBlob) {// IE10+
+ window.navigator.msSaveOrOpenBlob(file, filename);
+ } else { // Others
+ var a = document.createElement("a"),
+ url = URL.createObjectURL(file);
+ a.href = url;
+ a.download = filename;
+ document.body.appendChild(a);
+ a.click();
+ setTimeout(function() {
+ document.body.removeChild(a);
+ window.URL.revokeObjectURL(url);
+ }, 0);
+ }
+}
+
+Script.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_14__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Script", this);
+}
+
+
+Script.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_14__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Script, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_14__utils_JSONReviver_js__["c" /* Reviver */].constructors.Script = Script;
+
+//Called when the game is loaded. Loads all running scripts (from all servers)
+//into worker scripts so that they will start running
+function loadAllRunningScripts() {
+ var count = 0;
+ var total = 0;
+ for (var property in __WEBPACK_IMPORTED_MODULE_8__Server_js__["b" /* AllServers */]) {
+ if (__WEBPACK_IMPORTED_MODULE_8__Server_js__["b" /* AllServers */].hasOwnProperty(property)) {
+ var server = __WEBPACK_IMPORTED_MODULE_8__Server_js__["b" /* AllServers */][property];
+
+ //Reset each server's RAM usage to 0
+ server.ramUsed = 0;
+
+ for (var j = 0; j < server.runningScripts.length; ++j) {
+ count++;
+ Object(__WEBPACK_IMPORTED_MODULE_6__NetscriptWorker_js__["c" /* addWorkerScript */])(server.runningScripts[j], server);
+
+ //Offline production
+ total += scriptCalculateOfflineProduction(server.runningScripts[j]);
+ }
+ }
+ }
+ return total;
+ console.log("Loaded " + count.toString() + " running scripts");
+}
+
+function scriptCalculateOfflineProduction(runningScriptObj) {
+ //The Player object stores the last update time from when we were online
+ var thisUpdate = new Date().getTime();
+ var lastUpdate = __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].lastUpdate;
+ var timePassed = (thisUpdate - lastUpdate) / 1000; //Seconds
+ console.log("Offline for " + timePassed + " seconds");
+
+ //Calculate the "confidence" rating of the script's true production. This is based
+ //entirely off of time. We will arbitrarily say that if a script has been running for
+ //4 hours (14400 sec) then we are completely confident in its ability
+ var confidence = (runningScriptObj.onlineRunningTime) / 14400;
+ if (confidence >= 1) {confidence = 1;}
+
+ //Data map: [MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
+
+ //Grow
+ for (var ip in runningScriptObj.dataMap) {
+ if (runningScriptObj.dataMap.hasOwnProperty(ip)) {
+ if (runningScriptObj.dataMap[ip][2] == 0 || runningScriptObj.dataMap[ip][2] == null) {continue;}
+ var serv = __WEBPACK_IMPORTED_MODULE_8__Server_js__["b" /* AllServers */][ip];
+ if (serv == null) {continue;}
+ var timesGrown = Math.round(0.5 * runningScriptObj.dataMap[ip][2] / runningScriptObj.onlineRunningTime * timePassed);
+ console.log(runningScriptObj.filename + " called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
+ runningScriptObj.log("Called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
+ var growth = Object(__WEBPACK_IMPORTED_MODULE_8__Server_js__["j" /* processSingleServerGrowth */])(serv, timesGrown * 450);
+ runningScriptObj.log(serv.hostname + " grown by " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growth * 100 - 100, 6) + "% from grow() calls made while offline");
+ }
+ }
+
+ var totalOfflineProduction = 0;
+ for (var ip in runningScriptObj.dataMap) {
+ if (runningScriptObj.dataMap.hasOwnProperty(ip)) {
+ if (runningScriptObj.dataMap[ip][0] == 0 || runningScriptObj.dataMap[ip][0] == null) {continue;}
+ var serv = __WEBPACK_IMPORTED_MODULE_8__Server_js__["b" /* AllServers */][ip];
+ if (serv == null) {continue;}
+ var production = 0.5 * runningScriptObj.dataMap[ip][0] / runningScriptObj.onlineRunningTime * timePassed;
+ production *= confidence;
+ if (production > serv.moneyAvailable) {
+ production = serv.moneyAvailable;
+ }
+ totalOfflineProduction += production;
+ __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].gainMoney(production);
+ console.log(runningScriptObj.filename + " generated $" + production + " while offline by hacking " + serv.hostname);
+ runningScriptObj.log(runningScriptObj.filename + " generated $" + production + " while offline by hacking " + serv.hostname);
+ serv.moneyAvailable -= production;
+ if (serv.moneyAvailable < 0) {serv.moneyAvailable = 0;}
+ if (isNaN(serv.moneyAvailable)) {serv.moneyAvailable = 0;}
+ }
+ }
+
+ //Offline EXP gain
+ //A script's offline production will always be at most half of its online production.
+ var expGain = 0.5 * (runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime) * timePassed;
+ expGain *= confidence;
+
+ __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].gainHackingExp(expGain);
+
+ //Update script stats
+ runningScriptObj.offlineMoneyMade += totalOfflineProduction;
+ runningScriptObj.offlineRunningTime += timePassed;
+ runningScriptObj.offlineExpGained += expGain;
+
+ //Fortify a server's security based on how many times it was hacked
+ for (var ip in runningScriptObj.dataMap) {
+ if (runningScriptObj.dataMap.hasOwnProperty(ip)) {
+ if (runningScriptObj.dataMap[ip][1] == 0 || runningScriptObj.dataMap[ip][1] == null) {continue;}
+ var serv = __WEBPACK_IMPORTED_MODULE_8__Server_js__["b" /* AllServers */][ip];
+ if (serv == null) {continue;}
+ var timesHacked = Math.round(0.5 * runningScriptObj.dataMap[ip][1] / runningScriptObj.onlineRunningTime * timePassed);
+ console.log(runningScriptObj.filename + " hacked " + serv.hostname + " " + timesHacked + " times while offline");
+ runningScriptObj.log("Hacked " + serv.hostname + " " + timesHacked + " times while offline");
+ serv.fortify(__WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ServerFortifyAmount * timesHacked);
+ }
+ }
+
+ //Weaken
+ for (var ip in runningScriptObj.dataMap) {
+ if (runningScriptObj.dataMap.hasOwnProperty(ip)) {
+ if (runningScriptObj.dataMap[ip][3] == 0 || runningScriptObj.dataMap[ip][3] == null) {continue;}
+ var serv = __WEBPACK_IMPORTED_MODULE_8__Server_js__["b" /* AllServers */][ip];
+ if (serv == null) {continue;}
+ var timesWeakened = Math.round(0.5 * runningScriptObj.dataMap[ip][3] / runningScriptObj.onlineRunningTime * timePassed);
+ console.log(runningScriptObj.filename + " called weaken() on " + serv.hostname + " " + timesWeakened + " times while offline");
+ runningScriptObj.log("Called weaken() on " + serv.hostname + " " + timesWeakened + " times while offline");
+ serv.weaken(__WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * timesWeakened);
+ }
+ }
+
+ return totalOfflineProduction;
+}
+
+//Returns a RunningScript object matching the filename and arguments on the
+//designated server, and false otherwise
+function findRunningScript(filename, args, server) {
+ for (var i = 0; i < server.runningScripts.length; ++i) {
+ if (server.runningScripts[i].filename == filename &&
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_HelperFunctions_js__["d" /* compareArrays */])(server.runningScripts[i].args, args)) {
+ return server.runningScripts[i];
+ }
+ }
+ return null;
+}
+
+function RunningScript(script, args) {
+ if (script == null || script == undefined) {return;}
+ this.filename = script.filename;
+ this.args = args;
+ this.scriptRef = script;
+ this.server = script.server; //IP Address only
+
+ this.logs = []; //Script logging. Array of strings, with each element being a log entry
+ this.logUpd = false;
+
+ //Stats to display on the Scripts menu, and used to determine offline progress
+ this.offlineRunningTime = 0.01; //Seconds
+ this.offlineMoneyMade = 0;
+ this.offlineExpGained = 0;
+ this.onlineRunningTime = 0.01; //Seconds
+ this.onlineMoneyMade = 0;
+ this.onlineExpGained = 0;
+
+ this.threads = 1;
+
+ //[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
+ this.dataMap = new AllServersMap([0, 0, 0, 0], true);
+}
+
+RunningScript.prototype.log = function(txt) {
+ if (this.logs.length > __WEBPACK_IMPORTED_MODULE_9__Settings_js__["a" /* Settings */].MaxLogCapacity) {
+ //Delete first element and add new log entry to the end.
+ //TODO Eventually it might be better to replace this with circular array
+ //to improve performance
+ this.logs.shift();
+ }
+ this.logs.push(txt);
+ this.logUpd = true;
+}
+
+RunningScript.prototype.displayLog = function() {
+ for (var i = 0; i < this.logs.length; ++i) {
+ Object(__WEBPACK_IMPORTED_MODULE_10__Terminal_js__["b" /* post */])(this.logs[i]);
+ }
+}
+
+RunningScript.prototype.clearLog = function() {
+ this.logs.length = 0;
+}
+
+//Update the moneyStolen and numTimesHack maps when hacking
+RunningScript.prototype.recordHack = function(serverIp, moneyGained, n=1) {
+ if (this.dataMap == null) {
+ //[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
+ this.dataMap = new AllServersMap([0, 0, 0, 0], true);
+ }
+ this.dataMap[serverIp][0] += moneyGained;
+ this.dataMap[serverIp][1] += n;
+}
+
+//Update the grow map when calling grow()
+RunningScript.prototype.recordGrow = function(serverIp, n=1) {
+ if (this.dataMap == null) {
+ //[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
+ this.dataMap = new AllServersMap([0, 0, 0, 0], true);
+ }
+ this.dataMap[serverIp][2] += n;
+}
+
+//Update the weaken map when calling weaken() {
+RunningScript.prototype.recordWeaken = function(serverIp, n=1) {
+ if (this.dataMap == null) {
+ //[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
+ this.dataMap = new AllServersMap([0, 0, 0, 0], true);
+ }
+ this.dataMap[serverIp][3] += n;
+}
+
+RunningScript.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_14__utils_JSONReviver_js__["b" /* Generic_toJSON */])("RunningScript", this);
+}
+
+
+RunningScript.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_14__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(RunningScript, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_14__utils_JSONReviver_js__["c" /* Reviver */].constructors.RunningScript = RunningScript;
+
+//Creates an object that creates a map/dictionary with the IP of each existing server as
+//a key. Initializes every key with a specified value that can either by a number or an array
+function AllServersMap(arr=false, filterOwned=false) {
+ for (var ip in __WEBPACK_IMPORTED_MODULE_8__Server_js__["b" /* AllServers */]) {
+ if (__WEBPACK_IMPORTED_MODULE_8__Server_js__["b" /* AllServers */].hasOwnProperty(ip)) {
+ if (filterOwned && (__WEBPACK_IMPORTED_MODULE_8__Server_js__["b" /* AllServers */][ip].purchasedByPlayer || __WEBPACK_IMPORTED_MODULE_8__Server_js__["b" /* AllServers */][ip].hostname === "home")) {
+ continue;
+ }
+ if (arr) {
+ this[ip] = [0, 0, 0, 0];
+ } else {
+ this[ip] = 0;
+ }
+ }
+ }
+}
+
+AllServersMap.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_14__utils_JSONReviver_js__["b" /* Generic_toJSON */])("AllServersMap", this);
+}
+
+
+AllServersMap.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_14__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(AllServersMap, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_14__utils_JSONReviver_js__["c" /* Reviver */].constructors.AllServersMap = AllServersMap;
+
+
+
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
+
/***/ }),
/* 23 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -27459,41 +27734,41 @@ function getJobRequirementText(company, pos, tooltiptext=false) {
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return hasWallStreetSF; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return hasCorporationSF; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return wallStreetSFLvl; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(26);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__ = __webpack_require__(21);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(25);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__BitNode_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Crimes_js__ = __webpack_require__(35);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Company_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Crimes_js__ = __webpack_require__(32);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Company_js__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__ = __webpack_require__(17);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__ = __webpack_require__(48);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__ = __webpack_require__(66);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Faction_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__ = __webpack_require__(29);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Location_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Message_js__ = __webpack_require__(25);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Missions_js__ = __webpack_require__(30);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Faction_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__ = __webpack_require__(26);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Location_js__ = __webpack_require__(14);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Message_js__ = __webpack_require__(27);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Missions_js__ = __webpack_require__(28);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Script_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Script_js__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__Server_js__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__Settings_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__SpecialServerIps_js__ = __webpack_require__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__ = __webpack_require__(31);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__Terminal_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__TextFile_js__ = __webpack_require__(50);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__ = __webpack_require__(28);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__NetscriptEnvironment_js__ = __webpack_require__(36);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__NetscriptPort_js__ = __webpack_require__(40);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__SpecialServerIps_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__ = __webpack_require__(30);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__Terminal_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__TextFile_js__ = __webpack_require__(68);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__ = __webpack_require__(34);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__NetscriptEnvironment_js__ = __webpack_require__(35);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__NetscriptPort_js__ = __webpack_require__(38);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__utils_decimal_js__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_26__utils_decimal_js__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__utils_DialogBox_js__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__utils_IPAddress_js__ = __webpack_require__(20);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__utils_IPAddress_js__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__utils_YesNoBox_js__ = __webpack_require__(14);
-var sprintf = __webpack_require__(47).sprintf,
- vsprintf = __webpack_require__(47).vsprintf
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__utils_YesNoBox_js__ = __webpack_require__(15);
+var sprintf = __webpack_require__(46).sprintf,
+ vsprintf = __webpack_require__(46).vsprintf
@@ -35853,232 +36128,18 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v7.2.3 https://github.com/MikeM
/* 25 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Messages; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return checkForMessagesToSend; });
-/* unused harmony export sendMessage */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return showMessage; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return loadMessages; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return initMessages; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Message; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(21);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__ = __webpack_require__(17);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Missions_js__ = __webpack_require__(30);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__RedPill_js__ = __webpack_require__(37);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(8);
-
-
-
-
-
-
-
-
-
-
-/* Message.js */
-function Message(filename="", msg="") {
- this.filename = filename;
- this.msg = msg;
- this.recvd = false;
-}
-
-Message.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Message", this);
-}
-
-
-Message.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Message, value.data);
-}
-
-__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].constructors.Message = Message;
-
-//Sends message to player, including a pop up
-function sendMessage(msg, forced=false) {
- console.log("sending message: " + msg.filename);
- msg.recvd = true;
- if (forced || !__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].SuppressMessages) {
- showMessage(msg);
- }
- addMessageToServer(msg, "home");
-}
-
-function showMessage(msg) {
- var txt = "Message received from unknown sender:
" +
- "" + msg.msg + "
" +
- "This message was saved as " + msg.filename + " onto your home computer.";
- Object(__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);
-}
-
-//Adds a message to a server
-function addMessageToServer(msg, serverHostname) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_5__Server_js__["c" /* GetServerByHostname */])(serverHostname);
- if (server == null) {
- console.log("WARNING: Did not locate " + serverHostname);
- return;
- }
- for (var i = 0; i < server.messages.length; ++i) {
- if (server.messages[i].filename === msg.filename) {
- return; //Already exists
- }
- }
- server.messages.push(msg);
-}
-
-//Checks if any of the 'timed' messages should be sent
-function checkForMessagesToSend() {
- var jumper0 = Messages[MessageFilenames.Jumper0];
- var jumper1 = Messages[MessageFilenames.Jumper1];
- var jumper2 = Messages[MessageFilenames.Jumper2];
- var jumper3 = Messages[MessageFilenames.Jumper3];
- var jumper4 = Messages[MessageFilenames.Jumper4];
- var cybersecTest = Messages[MessageFilenames.CyberSecTest];
- var nitesecTest = Messages[MessageFilenames.NiteSecTest];
- var bitrunnersTest = Messages[MessageFilenames.BitRunnersTest];
- var redpill = Messages[MessageFilenames.RedPill];
-
- var redpillOwned = false;
- if (__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) {
- redpillOwned = true;
- }
-
- if (redpill && redpillOwned && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].sourceFiles.length === 0 && !__WEBPACK_IMPORTED_MODULE_4__RedPill_js__["b" /* redPillFlag */] && !__WEBPACK_IMPORTED_MODULE_2__Missions_js__["c" /* inMission */]) {
- if (!__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["b" /* dialogBoxOpened */]) {
- sendMessage(redpill, true);
- }
- } else if (redpill && redpillOwned) {
- //If player has already destroyed a BitNode, message is not forced
- if (!__WEBPACK_IMPORTED_MODULE_4__RedPill_js__["b" /* redPillFlag */] && !__WEBPACK_IMPORTED_MODULE_2__Missions_js__["c" /* inMission */] && !__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["b" /* dialogBoxOpened */]) {
- sendMessage(redpill);
- }
- } else if (jumper0 && !jumper0.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 25) {
- sendMessage(jumper0);
- __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__["a" /* Programs */].Flight);
- } else if (jumper1 && !jumper1.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 40) {
- sendMessage(jumper1);
- } else if (cybersecTest && !cybersecTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 50) {
- sendMessage(cybersecTest);
- } else if (jumper2 && !jumper2.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 175) {
- sendMessage(jumper2);
- } else if (nitesecTest && !nitesecTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 200) {
- sendMessage(nitesecTest);
- } else if (jumper3 && !jumper3.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 350) {
- sendMessage(jumper3);
- } else if (jumper4 && !jumper4.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 490) {
- sendMessage(jumper4);
- } else if (bitrunnersTest && !bitrunnersTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 500) {
- sendMessage(bitrunnersTest);
- }
-}
-
-function AddToAllMessages(msg) {
- Messages[msg.filename] = msg;
-}
-
-let Messages = {}
-
-function loadMessages(saveString) {
- Messages = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */]);
-}
-
-let MessageFilenames = {
- Jumper0: "j0.msg",
- Jumper1: "j1.msg",
- Jumper2: "j2.msg",
- Jumper3: "j3.msg",
- Jumper4: "j4.msg",
- CyberSecTest: "csec-test.msg",
- NiteSecTest: "nitesec-test.msg",
- BitRunnersTest: "19dfj3l1nd.msg",
- RedPill: "icarus.msg",
-}
-
-function initMessages() {
- //Reset
- Messages = {};
-
- //jump3R Messages
- AddToAllMessages(new Message(MessageFilenames.Jumper0,
- "I know you can sense it. I know you're searching for it. " +
- "It's why you spend night after " +
- "night at your computer.
It's real, I've seen it. And I can " +
- "help you find it. But not right now. You're not ready yet.
" +
- "Use this program to track your progress
" +
- "The fl1ght.exe program was added to your home computer
" +
- "-jump3R"));
- AddToAllMessages(new Message(MessageFilenames.Jumper1,
- "Soon you will be contacted by a hacking group known as CyberSec. " +
- "They can help you with your search.
" +
- "You should join them, garner their favor, and " +
- "exploit them for their Augmentations. But do not trust them. " +
- "They are not what they seem. No one is.
" +
- "-jump3R"));
- AddToAllMessages(new Message(MessageFilenames.Jumper2,
- "Do not try to save the world. There is no world to save. If " +
- "you want to find the truth, worry only about yourself. Ethics and " +
- "morals will get you killed.
Watch out for a hacking group known as NiteSec." +
- "
-jump3R"));
- AddToAllMessages(new Message(MessageFilenames.Jumper3,
- "You must learn to walk before you can run. And you must " +
- "run before you can fly. Look for the black hand.
" +
- "I.I.I.I
-jump3R"));
- AddToAllMessages(new Message(MessageFilenames.Jumper4,
- "To find what you are searching for, you must understand the bits. " +
- "The bits are all around us. The runners will help you.
" +
- "-jump3R"));
-
- //Messages from hacking factions
- AddToAllMessages(new Message(MessageFilenames.CyberSecTest,
- "We've been watching you. Your skills are very impressive. But you're wasting " +
- "your talents. If you join us, you can put your skills to good use and change " +
- "the world for the better. If you join us, we can unlock your full potential.
" +
- "But first, you must pass our test. Find and hack our server using the Terminal.
" +
- "-CyberSec"));
- AddToAllMessages(new Message(MessageFilenames.NiteSecTest,
- "People say that the corrupted governments and corporations rule the world. " +
- "Yes, maybe they do. But do you know who everyone really fears? People " +
- "like us. Because they can't hide from us. Because they can't fight shadows " +
- "and ideas with bullets.
" +
- "Join us, and people will fear you, too.
" +
- "Find and hack our hidden server using the Terminal. Then, we will contact you again." +
- "
-NiteSec"));
- AddToAllMessages(new Message(MessageFilenames.BitRunnersTest,
- "We know what you are doing. We know what drives you. We know " +
- "what you are looking for.
" +
- "We can help you find the answers.
" +
- "run4theh111z"));
-
- AddToAllMessages(new Message(MessageFilenames.RedPill,
- "@)(#V%*N)@(#*)*C)@#%*)*V)@#(*%V@)(#VN%*)@#(*% " +
- ")@B(*#%)@)M#B*%V)____FIND___#$@)#%(B*)@#(*%B) " +
- "@_#(%_@#M(BDSPOMB__THE-CAVE_#)$(*@#$)@#BNBEGB " +
- "DFLSMFVMV)#@($*)@#*$MV)@#(*$V)M#(*$)M@(#*VM$)"));
-}
-
-
-
-
-/***/ }),
-/* 26 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setActiveScriptsClickHandlers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addActiveScriptsItem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return deleteActiveScriptsItem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return updateActiveScriptsItems; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Server_js__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(32);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(42);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js__ = __webpack_require__(13);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__ = __webpack_require__(5);
@@ -36363,1647 +36424,7 @@ function updateActiveScriptsText(workerscript, item, statsEl=null) {
/***/ }),
-/* 27 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return iTutorialSteps; });
-/* unused harmony export iTutorialEnd */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return iTutorialStart; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return iTutorialNextStep; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return currITutorialStep; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return iTutorialIsRunning; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__ = __webpack_require__(2);
-
-
-
-
-
-/* InteractiveTutorial.js */
-let iTutorialSteps = {
- Start: "Start",
- GoToCharacterPage: "Click on the Character page menu link",
- CharacterPage: "Introduction to Character page",
- CharacterGoToTerminalPage: "Click on the Terminal link",
- TerminalIntro: "Introduction to terminal interface",
- TerminalHelp: "Using the help command to display all options in terminal",
- TerminalLs: "Use the ls command to show all programs/scripts. Right now we have NUKE.exe",
- TerminalScan: "Using the scan command to display all available connections",
- TerminalScanAnalyze1: "Use the scan-analyze command to show hacking related information",
- TerminalScanAnalyze2: "Use the scan-analyze command with a depth of 3",
- TerminalConnect: "Using the telnet/connect command to connect to another server",
- TerminalAnalyze: "Use the analyze command to display details about this server",
- TerminalNuke: "Use the NUKE Program to gain root access to a server",
- TerminalManualHack: "Use the hack command to manually hack a server",
- TerminalHackingMechanics: "Briefly explain hacking mechanics",
- TerminalCreateScript: "Create a script using nano",
- TerminalTypeScript: "This occurs in the Script Editor page...type the script then save and close",
- TerminalFree: "Use the free command to check RAM",
- TerminalRunScript: "Use the run command to run a script",
- TerminalGoToActiveScriptsPage: "Go to the ActiveScriptsPage",
- ActiveScriptsPage: "Introduction to the Active Scripts Page",
- ActiveScriptsToTerminal: "Go from Active Scripts Page Back to Terminal",
- TerminalTailScript: "Use the tail command to show a script's logs",
- GoToHacknetNodesPage: "Go to the Hacknet Nodes page",
- HacknetNodesIntroduction: "Introduction to Hacknet Nodesm and have user purchase one",
- HacknetNodesGoToWorldPage: "Go to the world page",
- WorldDescription: "Tell the user to explore..theres a lot of different stuff to do out there",
- TutorialPageInfo: "The tutorial page contains a lot of info on different subjects",
- End: "End",
-}
-
-var currITutorialStep = iTutorialSteps.Start;
-var iTutorialIsRunning = false;
-
-function iTutorialStart() {
- //Don't autosave during this interactive tutorial
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = 999000000000;
- console.log("Interactive Tutorial started");
- currITutorialStep = iTutorialSteps.Start;
- iTutorialIsRunning = true;
-
- document.getElementById("interactive-tutorial-container").style.display = "block";
-
- iTutorialEvaluateStep();
-
- //Exit tutorial button
- var exitButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-exit");
- exitButton.addEventListener("click", function() {
- iTutorialEnd();
- return false;
- });
-
- //Back button
- var backButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-back");
- backButton.style.display = "none";
- backButton.addEventListener("click", function() {
- iTutorialPrevStep();
- return false;
- });
-}
-
-function iTutorialEvaluateStep() {
- if (!iTutorialIsRunning) {console.log("Interactive Tutorial not running"); return;}
- switch(currITutorialStep) {
- case iTutorialSteps.Start:
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
-
- iTutorialSetText("Welcome to Bitburner, a cyberpunk-themed incremental RPG! " +
- "The game takes place in a dark, dystopian future...The year is 2077...
" +
- "This tutorial will show you the basics of the game. " +
- "You may skip the tutorial at any time.");
- var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.GoToCharacterPage:
- iTutorialSetText("Let's start by heading to the Stats page. Click the 'Stats' tab on " +
- "the main navigation menu (left-hand side of the screen)");
-
- //No next button
- var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "none";
-
- //Flash Character tab
- document.getElementById("stats-menu-link").setAttribute("class", "flashing-button");
-
- //Initialize everything necessary to open the "Character" page
- var charaterMainMenuButton = document.getElementById("stats-menu-link");
- charaterMainMenuButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadCharacterContent();
- iTutorialNextStep(); //Opening the character page will go to the next step
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("stats-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.CharacterPage:
- iTutorialSetText("The Stats page shows a lot of important information about your progress, " +
- "such as your skills, money, and bonuses/multipliers. ")
- var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.CharacterGoToTerminalPage:
- iTutorialSetText("Let's head to your computer's terminal by clicking the 'Terminal' tab on the " +
- "main navigation menu.");
- //No next button
- var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "none";
-
- document.getElementById("terminal-menu-link").setAttribute("class", "flashing-button");
-
- //Initialize everything necessary to open the 'Terminal' Page
- var terminalMainMenuButton = document.getElementById("terminal-menu-link");
- terminalMainMenuButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.TerminalIntro:
- iTutorialSetText("The Terminal is used to interface with your home computer as well as " +
- "all of the other machines around the world.");
- var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.TerminalHelp:
- iTutorialSetText("Let's try it out. Start by entering the 'help' command into the Terminal " +
- "(Don't forget to press Enter after typing the command)");
- var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "none";
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalLs:
- iTutorialSetText("The 'help' command displays a list of all available Terminal commands, how to use them, " +
- "and a description of what they do.
Let's try another command. Enter the 'ls' command");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalScan:
- iTutorialSetText("'ls' is a basic command that shows all of the contents (programs/scripts) " +
- "on the computer. Right now, it shows that you have a program called 'NUKE.exe' on your computer. " +
- "We'll get to what this does later.
Using your home computer's terminal, you can connect " +
- "to other machines throughout the world. Let's do that now by first entering " +
- "the 'scan' command. ");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalScanAnalyze1:
- iTutorialSetText("The 'scan' command shows all available network connections. In other words, " +
- "it displays a list of all servers that can be connected to from your " +
- "current machine. A server is identified by either its IP or its hostname.
" +
- "That's great and all, but there's so many servers. Which one should you go to? " +
- "The 'scan-analyze' command gives some more detailed information about servers on the " +
- "network. Try it now");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalScanAnalyze2:
- iTutorialSetText("You just ran 'scan-analyze' with a depth of one. This command shows more detailed " +
- "information about each server that you can connect to (servers that are a distance of " +
- "one node away).
It is also possible to run 'scan-analyze' with " +
- "a higher depth. Let's try a depth of two with the following command: 'scan-analyze 2'.")
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalConnect:
- iTutorialSetText("Now you can see information about all servers that are up to two nodes away, as well " +
- "as figure out how to navigate to those servers through the network. You can only connect to " +
- "a server that is one node away. To connect to a machine, use the 'connect [ip/hostname]' command. You can type in " +
- "the ip or the hostname, but dont use both.
" +
- "From the results of the 'scan-analyze' command, we can see that the 'foodnstuff' server is " +
- "only one node away. Let's connect so it now using: 'connect foodnstuff'");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalAnalyze:
- iTutorialSetText("You are now connected to another machine! What can you do now? You can hack it!
In the year 2077, currency has " +
- "become digital and decentralized. People and corporations store their money " +
- "on servers and computers. Using your hacking abilities, you can hack servers " +
- "to steal money and gain experience.
" +
- "Before you try to hack a server, you should run diagnostics using the 'analyze' command");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalNuke:
- iTutorialSetText("When the 'analyze' command finishes running it will show useful information " +
- "about hacking the server.
For this server, the required hacking skill is only 1, " +
- "which means you can hack it right now. However, in order to hack a server " +
- "you must first gain root access. The 'NUKE.exe' program that we saw earlier on your " +
- "home computer is a virus that will grant you root access to a machine if there are enough " +
- "open ports.
The 'analyze' results shows that there do not need to be any open ports " +
- "on this machine for the NUKE virus to work, so go ahead and run the virus using the " +
- "'run NUKE.exe' command.");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalManualHack:
- iTutorialSetText("You now have root access! You can hack the server using the 'hack' command. " +
- "Try doing that now.");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalHackingMechanics:
- iTutorialSetText("You are now attempting to hack the server. Note that performing a hack takes time and " +
- "only has a certain percentage chance " +
- "of success. This time and success chance is determined by a variety of factors, including " +
- "your hacking skill and the server's security level.
" +
- "If your attempt to hack the server is successful, you will steal a certain percentage " +
- "of the server's total money. This percentage is affected by your hacking skill and " +
- "the server's security level.
The amount of money on a server is not limitless. So, if " +
- "you constantly hack a server and deplete its money, then you will encounter " +
- "diminishing returns in your hacking.");
- var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.TerminalCreateScript:
- iTutorialSetText("Hacking is the core mechanic of the game and is necessary for progressing. However, " +
- "you don't want to be hacking manually the entire time. You can automate your hacking " +
- "by writing scripts!
To create a new script or edit an existing one, you can use the 'nano' " +
- "command. Scripts must end with the '.script' extension. Let's make a script now by " +
- "entering 'nano foodnstuff.script' after the hack command finishes running (Sidenote: Pressing ctrl + c" +
- " will end a command like hack early)");
- var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "none";
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalTypeScript:
- iTutorialSetText("This is the script editor. You can use it to program your scripts. Scripts are " +
- "written in the Netscript language, a programming language created for " +
- "this game. There are details about the Netscript language in the documentation, which " +
- "can be accessed in the 'Tutorial' tab on the main navigation menu. I highly suggest you check " +
- "it out after this tutorial. For now, just copy " +
- "and paste the following code into the script editor:
" +
- "For anyone with basic programming experience, this code should be straightforward. " +
- "This script will continuously hack the 'foodnstuff' server.
" +
- "To save and close the script editor, press the button in the bottom left, or press ctrl + b.");
- //next step triggered in saveAndCloseScriptEditor() (Script.js)
- break;
- case iTutorialSteps.TerminalFree:
- iTutorialSetText("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " +
- "run on any machine which you have root access to. Different servers have different " +
- "amounts of RAM. You can also purchase more RAM for your home server.
To check how much " +
- "RAM is available on this machine, enter the 'free' command.");
- //next step triggered by terminal commmand
- break;
- case iTutorialSteps.TerminalRunScript:
- iTutorialSetText("We have 16GB of free RAM on this machine, which is enough to run our " +
- "script. Let's run our script using 'run foodnstuff.script'.");
- //next step triggered by terminal commmand
- break;
- case iTutorialSteps.TerminalGoToActiveScriptsPage:
- iTutorialSetText("Your script is now running! The script might take a few seconds to 'fully start up'. " +
- "Your scripts will continuously run in the background and will automatically stop if " +
- "the code ever completes (the 'foodnstuff.script' will never complete because it " +
- "runs an infinite loop).
These scripts can passively earn you income and hacking experience. " +
- "Your scripts will also earn money and experience while you are offline, although at a " +
- "much slower rate.
" +
- "Let's check out some statistics for our running scripts by clicking the " +
- "'Active Scripts' link in the main navigation menu.");
- document.getElementById("active-scripts-menu-link").setAttribute("class", "flashing-button");
- var activeScriptsMainMenuButton = document.getElementById("active-scripts-menu-link");
- activeScriptsMainMenuButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadActiveScriptsContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("active-scripts-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.ActiveScriptsPage:
- iTutorialSetText("This page displays stats/information about all of your scripts that are " +
- "running across every existing server. You can use this to gauge how well " +
- "your scripts are doing. Let's go back to the Terminal now using the 'Terminal'" +
- "link.");
- document.getElementById("terminal-menu-link").setAttribute("class", "flashing-button");
- //Initialize everything necessary to open the 'Terminal' Page
- var terminalMainMenuButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
- terminalMainMenuButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.ActiveScriptsToTerminal:
- iTutorialSetText("One last thing about scripts, each active script contains logs that detail " +
- "what it's doing. We can check these logs using the 'tail' command. Do that " +
- "now for the script we just ran by typing 'tail foodnstuff.script'");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalTailScript:
- iTutorialSetText("The log for this script won't show much right now (it might show nothing at all) because it " +
- "just started running...but check back again in a few minutes!
" +
- "This pretty much covers the basics of hacking. To learn more about writing " +
- "scripts using the Netscript language, select the 'Tutorial' link in the " +
- "main navigation menu to look at the documentation. For now, let's move on " +
- "to something else!");
- var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.GoToHacknetNodesPage:
- iTutorialSetText("Hacking is not the only way to earn money. One other way to passively " +
- "earn money is by purchasing and upgrading Hacknet Nodes. Let's go to " +
- "the 'Hacknet Nodes' page through the main navigation menu now.");
- document.getElementById("hacknet-nodes-menu-link").setAttribute("class", "flashing-button");
- var hacknetNodesButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hacknet-nodes-menu-link");
- var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "none";
- hacknetNodesButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadHacknetNodesContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hacknet-nodes-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.HacknetNodesIntroduction:
- iTutorialSetText("From this page you can purchase new Hacknet Nodes and upgrade your " +
- "existing ones. Let's purchase a new one now.");
- //Next step triggered by purchaseHacknet() (HacknetNode.js)
- break;
- case iTutorialSteps.HacknetNodesGoToWorldPage:
- iTutorialSetText("You just purchased a Hacknet Node! This Hacknet Node will passively " +
- "earn you money over time, both online and offline. When you get enough " +
- " money, you can upgrade " +
- "your newly-purchased Hacknet Node below.
" +
- "Let's go to the 'City' page through the main navigation menu.");
- document.getElementById("city-menu-link").setAttribute("class", "flashing-button");
- var worldButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("city-menu-link");
- worldButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadWorldContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("city-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.WorldDescription:
- iTutorialSetText("This page lists all of the different locations you can currently " +
- "travel to. Each location has something that you can do. " +
- "There's a lot of content out in the world, make sure " +
- "you explore and discover!
" +
- "Lastly, click on the 'Tutorial' link in the main navigation menu.");
- document.getElementById("tutorial-menu-link").setAttribute("class", "flashing-button");
- var tutorialButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("tutorial-menu-link");
- tutorialButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTutorialContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("tutorial-menu-link");
- return false;
- });
- break;
-
- case iTutorialSteps.TutorialPageInfo:
- iTutorialSetText("This page contains a lot of different documentation about the game's " +
- "content and mechanics. I know it's a lot, but I highly suggest you read " +
- "(or at least skim) through this before you start playing. That's the end of the tutorial. " +
- "Hope you enjoy the game!");
- var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.innerHTML = "Finish Tutorial";
-
- var backButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-back");
- backButton.style.display = "none";
-
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.End:
- iTutorialEnd();
- break;
- default:
- throw new Error("Invalid tutorial step");
- }
-}
-
-//Go to the next step and evaluate it
-function iTutorialNextStep() {
- switch(currITutorialStep) {
- case iTutorialSteps.Start:
- currITutorialStep = iTutorialSteps.GoToCharacterPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.GoToCharacterPage:
- document.getElementById("stats-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.CharacterPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.CharacterPage:
- currITutorialStep = iTutorialSteps.CharacterGoToTerminalPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.CharacterGoToTerminalPage:
- document.getElementById("terminal-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.TerminalIntro;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalIntro:
- currITutorialStep = iTutorialSteps.TerminalHelp;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalHelp:
- currITutorialStep = iTutorialSteps.TerminalLs;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalLs:
- currITutorialStep = iTutorialSteps.TerminalScan;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalScan:
- currITutorialStep = iTutorialSteps.TerminalScanAnalyze1;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalScanAnalyze1:
- currITutorialStep = iTutorialSteps.TerminalScanAnalyze2;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalScanAnalyze2:
- currITutorialStep = iTutorialSteps.TerminalConnect;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalConnect:
- currITutorialStep = iTutorialSteps.TerminalAnalyze;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalAnalyze:
- currITutorialStep = iTutorialSteps.TerminalNuke;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalNuke:
- currITutorialStep = iTutorialSteps.TerminalManualHack;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalManualHack:
- currITutorialStep = iTutorialSteps.TerminalHackingMechanics;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalHackingMechanics:
- currITutorialStep = iTutorialSteps.TerminalCreateScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalCreateScript:
- currITutorialStep = iTutorialSteps.TerminalTypeScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalTypeScript:
- currITutorialStep = iTutorialSteps.TerminalFree;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalFree:
- currITutorialStep = iTutorialSteps.TerminalRunScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalRunScript:
- currITutorialStep = iTutorialSteps.TerminalGoToActiveScriptsPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalGoToActiveScriptsPage:
- document.getElementById("active-scripts-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.ActiveScriptsPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.ActiveScriptsPage:
- document.getElementById("terminal-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.ActiveScriptsToTerminal;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.ActiveScriptsToTerminal:
- currITutorialStep = iTutorialSteps.TerminalTailScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalTailScript:
- currITutorialStep = iTutorialSteps.GoToHacknetNodesPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.GoToHacknetNodesPage:
- document.getElementById("hacknet-nodes-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.HacknetNodesIntroduction;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.HacknetNodesIntroduction:
- currITutorialStep = iTutorialSteps.HacknetNodesGoToWorldPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.HacknetNodesGoToWorldPage:
- document.getElementById("city-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.WorldDescription;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.WorldDescription:
- document.getElementById("tutorial-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.TutorialPageInfo;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TutorialPageInfo:
- currITutorialStep = iTutorialSteps.End;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.End:
- break;
- default:
- throw new Error("Invalid tutorial step");
- }
-}
-
-//Go to previous step and evaluate
-function iTutorialPrevStep() {
- switch(currITutorialStep) {
- case iTutorialSteps.Start:
- currITutorialStep = iTutorialSteps.Start;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.GoToCharacterPage:
- currITutorialStep = iTutorialSteps.Start;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.CharacterPage:
- currITutorialStep = iTutorialSteps.GoToCharacterPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.CharacterGoToTerminalPage:
- currITutorialStep = iTutorialSteps.CharacterPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalIntro:
- currITutorialStep = iTutorialSteps.CharacterGoToTerminalPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalHelp:
- currITutorialStep = iTutorialSteps.TerminalIntro;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalLs:
- currITutorialStep = iTutorialSteps.TerminalHelp;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalScan:
- currITutorialStep = iTutorialSteps.TerminalLs;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalConnect:
- currITutorialStep = iTutorialSteps.TerminalScan;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalAnalyze:
- currITutorialStep = iTutorialSteps.TerminalConnect;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalNuke:
- currITutorialStep = iTutorialSteps.TerminalAnalyze;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalManualHack:
- currITutorialStep = iTutorialSteps.TerminalNuke;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalHackingMechanics:
- currITutorialStep = iTutorialSteps.TerminalManualHack;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalCreateScript:
- currITutorialStep = iTutorialSteps.TerminalManualHack;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalTypeScript:
- currITutorialStep = iTutorialSteps.TerminalCreateScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalFree:
- currITutorialStep = iTutorialSteps.TerminalTypeScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalRunScript:
- currITutorialStep = iTutorialSteps.TerminalFree;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalGoToActiveScriptsPage:
- currITutorialStep = iTutorialSteps.TerminalRunScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.ActiveScriptsPage:
- currITutorialStep = iTutorialSteps.TerminalGoToActiveScriptsPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.ActiveScriptsToTerminal:
- currITutorialStep = iTutorialSteps.ActiveScriptsPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalTailScript:
- currITutorialStep = iTutorialSteps.ActiveScriptsToTerminal;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.GoToHacknetNodesPage:
- currITutorialStep = iTutorialSteps.TerminalTailScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.HacknetNodesIntroduction:
- currITutorialStep = iTutorialSteps.GoToHacknetNodesPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.HacknetNodesGoToWorldPage:
- currITutorialStep = iTutorialSteps.HacknetNodesIntroduction;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.WorldDescription:
- currITutorialStep = iTutorialSteps.HacknetNodesGoToWorldPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TutorialPageInfo:
- currITutorialStep = iTutorialSteps.WorldDescription;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.End:
- break;
- default:
- throw new Error("Invalid tutorial step");
- }
-}
-
-function iTutorialEnd() {
- //Re-enable auto save
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = 300;
- console.log("Ending interactive tutorial");
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].init();
- currITutorialStep = iTutorialSteps.End;
- iTutorialIsRunning = false;
- document.getElementById("interactive-tutorial-container").style.display = "none";
- Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])("If you are new to the game, the following links may be useful for you!
" +
- "The Beginner's Guide to Hacking was added to your home computer! It contains some tips/pointers for starting out with the game. " +
- "To read it, go to Terminal and enter
cat hackers-starting-handbook.lit");
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().messages.push("hackers-starting-handbook.lit");
-}
-
-function iTutorialSetText(txt) {
- var textBox = document.getElementById("interactive-tutorial-text");
- if (textBox == null) {throw new Error("Could not find text box"); return;}
- textBox.innerHTML = txt;
- textBox.parentElement.scrollTop = 0; // this resets scroll position
-}
-
-
-
-
-/***/ }),
-/* 28 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return makeRuntimeRejectMsg; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return netscriptDelay; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return runScriptFromScript; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return scriptCalculateHackingChance; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return scriptCalculateHackingTime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return scriptCalculateExpGain; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return scriptCalculatePercentMoneyHacked; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return scriptCalculateGrowTime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return scriptCalculateWeakenTime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return evaluate; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isScriptErrorMessage; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return killNetscriptDelay; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return evaluateImport; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(36);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Script_js__ = __webpack_require__(18);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__ = __webpack_require__(41);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_IPAddress_js__ = __webpack_require__(20);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-var Promise = __webpack_require__(71);
-
-Promise.config({
- warnings: false,
- longStackTraces: false,
- cancellation: true,
- monitoring: false
-});
-/* Evaluator
- * Evaluates/Interprets the Abstract Syntax Tree generated by Acorns parser
- *
- * Returns a promise
- */
-function evaluate(exp, workerScript) {
- return Promise.delay(__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].CodeInstructionRunTime).then(function() {
- var env = workerScript.env;
- if (env.stopFlag) {return Promise.reject(workerScript);}
- if (exp == null) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Error: NULL expression", exp));
- }
- if (env.stopFlag) {return Promise.reject(workerScript);}
- switch (exp.type) {
- case "BlockStatement":
- case "Program":
- var evaluateProgPromise = evaluateProg(exp, workerScript, 0); //TODO: make every block/program use individual enviroment
- return evaluateProgPromise.then(function(w) {
- return Promise.resolve(workerScript);
- }).catch(function(e) {
- if (e.constructor === Array && e.length === 2 && e[0] === "RETURNSTATEMENT") {
- return Promise.reject(e);
- } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["g" /* isString */])(e)) {
- workerScript.errorMessage = e;
- return Promise.reject(workerScript);
- } else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
- return Promise.reject(e);
- } else {
- return Promise.reject(workerScript);
- }
- });
- break;
- case "Literal":
- return Promise.resolve(exp.value);
- break;
- case "Identifier":
- //Javascript constructor() method can be used as an exploit to run arbitrary code
- if (exp.name == "constructor") {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Illegal usage of constructor() method. If you have your own function named 'constructor', you must re-name it.", exp));
- }
-
- if (!(exp.name in env.vars)){
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.name + " not defined", exp));
- }
- return Promise.resolve(env.get(exp.name))
- break;
- case "ExpressionStatement":
- return evaluate(exp.expression, workerScript);
- break;
- case "ArrayExpression":
- var argPromises = exp.elements.map(function(arg) {
- return evaluate(arg, workerScript);
- });
- return Promise.all(argPromises).then(function(array) {
- return Promise.resolve(array)
- });
- break;
- case "CallExpression":
- return evaluate(exp.callee, workerScript).then(function(func) {
- return Promise.map(exp.arguments, function(arg) {
- return evaluate(arg, workerScript);
- }).then(function(args) {
- if (func instanceof __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__["Node"]) { //Player-defined function
- //Create new Environment for the function
- //Should be automatically garbage collected...
- var funcEnv = env.extend();
-
- //Define function arguments in this new environment
- for (var i = 0; i < func.params.length; ++i) {
- var arg;
- if (i >= args.length) {
- arg = null;
- } else {
- arg = args[i];
- }
- funcEnv.def(func.params[i].name, arg);
- }
-
- //Create a new WorkerScript for this function evaluation
- var funcWorkerScript = new __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */](workerScript.scriptRef);
- funcWorkerScript.serverIp = workerScript.serverIp;
- funcWorkerScript.env = funcEnv;
- workerScript.fnWorker = funcWorkerScript;
-
- return evaluate(func.body, funcWorkerScript).then(function(res) {
- //If the function finished successfuly, that means there
- //was no return statement since a return statement rejects. So resolve to null
- workerScript.fnWorker = null;
- return Promise.resolve(null);
- }).catch(function(e) {
- if (e.constructor === Array && e.length === 2 && e[0] === "RETURNSTATEMENT") {
- //Return statement from function
- return Promise.resolve(e[1]);
- workerScript.fnWorker = null;
- } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["g" /* isString */])(e)) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, e));
- } else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
- //Parse out the err message from the WorkerScript and re-reject
- var errorMsg = e.errorMessage;
- var errorTextArray = errorMsg.split("|");
- if (errorTextArray.length === 4) {
- errorMsg = errorTextArray[3];
- return Promise.reject(makeRuntimeRejectMsg(workerScript, errorMsg));
- } else {
- if (env.stopFlag) {
- return Promise.reject(workerScript);
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Error in one of your functions. Could not identify which function"));
- }
- }
- } else if (e instanceof Error) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, e.toString()));
- }
- });
- } else if (exp.callee.type === "MemberExpression"){
- return evaluate(exp.callee.object, workerScript).then(function(object) {
- try {
- if (func === "NETSCRIPTFOREACH") {
- return evaluateForeach(object, args, workerScript).then(function(res) {
- return Promise.resolve(res);
- }).catch(function(e) {
- return Promise.reject(e);
- });
- }
- var res = func.apply(object,args);
- return Promise.resolve(res);
- } catch (e) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, e, exp));
- }
- });
- } else {
- try {
- var out = func.apply(null,args);
- if (out instanceof Promise){
- return out.then(function(res) {
- return Promise.resolve(res)
- }).catch(function(e) {
- if (isScriptErrorMessage(e)) {
- //Functions don't have line number appended in error message, so add it
- var num = getErrorLineNumber(exp, workerScript);
- e += " (Line " + num + ")";
- }
- return Promise.reject(e);
- });
- } else {
- return Promise.resolve(out);
- }
- } catch (e) {
- if (isScriptErrorMessage(e)) {
- if (isScriptErrorMessage(e)) {
- //Functions don't have line number appended in error message, so add it
- var num = getErrorLineNumber(exp, workerScript);
- e += " (Line " + num + ")";
- }
- return Promise.reject(e);
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, e, exp));
- }
- }
- }
- });
- });
- break;
- case "MemberExpression":
- return evaluate(exp.object, workerScript).then(function(object) {
- if (exp.computed){
- return evaluate(exp.property, workerScript).then(function(index) {
- if (index >= object.length) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid index for arrays", exp));
- }
- return Promise.resolve(object[index]);
- }).catch(function(e) {
- if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] || isScriptErrorMessage(e)) {
- return Promise.reject(e);
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression", exp));
- }
- });
- } else {
- if (exp.property.name === "constructor") {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Illegal usage of constructor() method. If you have your own function named 'constructor', you must re-name it.", exp));
- }
- if (object != null && object instanceof Array && exp.property.name === "forEach") {
- return "NETSCRIPTFOREACH";
- }
- try {
- return Promise.resolve(object[exp.property.name])
- } catch (e) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Failed to get property: " + e.toString(), exp));
- }
- }
- });
- break;
- case "LogicalExpression":
- case "BinaryExpression":
- return evalBinary(exp, workerScript);
- break;
- case "UnaryExpression":
- return evalUnary(exp, workerScript);
- break;
- case "AssignmentExpression":
- return evalAssignment(exp, workerScript);
- break;
- case "UpdateExpression":
- if (exp.argument.type==="Identifier"){
- if (exp.argument.name in env.vars){
- if (exp.operator === "++" || exp.operator === "--") {
- switch (exp.operator) {
- case "++":
- env.set(exp.argument.name,env.get(exp.argument.name)+1);
- break;
- case "--":
- env.set(exp.argument.name,env.get(exp.argument.name)-1);
- break;
- default: break;
- }
- return Promise.resolve(env.get(exp.argument.name));
- }
- //Not sure what prefix UpdateExpressions there would be besides ++/--
- if (exp.prefix){
- return Promise.resolve(env.get(exp.argument.name))
- }
- switch (exp.operator){
- default:
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". You are trying to use code that is currently unsupported", exp));
- }
- return Promise.resolve(env.get(exp.argument.name))
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.argument.name + " not defined", exp));
- }
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "argument must be an identifier", exp));
- }
- break;
- case "EmptyStatement":
- return Promise.resolve(false);
- break;
- case "ReturnStatement":
- return evaluate(exp.argument, workerScript).then(function(res) {
- return Promise.reject(["RETURNSTATEMENT", res]);
- });
- break;
- case "BreakStatement":
- return Promise.reject("BREAKSTATEMENT");
- break;
- case "ContinueStatement":
- return Promise.reject("CONTINUESTATEMENT");
- break;
- case "IfStatement":
- return evaluateIf(exp, workerScript);
- break;
- case "SwitchStatement":
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Switch statements are not yet implemented in Netscript", exp));
- break;
- case "WhileStatement":
- return evaluateWhile(exp, workerScript).then(function(res) {
- return Promise.resolve(res);
- }).catch(function(e) {
- if (e == "BREAKSTATEMENT" ||
- (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) {
- return Promise.resolve("whileLoopBroken");
- } else {
- return Promise.reject(e);
- }
- });
- break;
- case "ForStatement":
- return evaluate(exp.init, workerScript).then(function(expInit) {
- return evaluateFor(exp, workerScript);
- }).then(function(forLoopRes) {
- return Promise.resolve("forLoopDone");
- }).catch(function(e) {
- if (e == "BREAKSTATEMENT" ||
- (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) {
- return Promise.resolve("forLoopBroken");
- } else {
- return Promise.reject(e);
- }
- });
- break;
- case "FunctionDeclaration":
- if (exp.id && exp.id.name) {
- env.set(exp.id.name, exp);
- return Promise.resolve(true);
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid function declaration", exp));
- }
- break;
- case "ImportDeclaration":
- return evaluateImport(exp, workerScript).then(function(res) {
- return Promise.resolve(res);
- }).catch(function(e) {
- return Promise.reject(e);
- });
- break;
- case "ThrowStatement":
- //return Promise.reject(makeRuntimeRejectMsg(workerScript))
- return evaluate(exp.argument, workerScript).then(function(res) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, res));
- });
- break;
- default:
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". This is currently unsupported in Netscript", exp));
- break;
- } //End switch
- }).catch(function(e) {
- return Promise.reject(e);
- }); // End Promise
-}
-
-function evalBinary(exp, workerScript){
- return evaluate(exp.left, workerScript).then(function(expLeft) {
- //Short circuiting
- if (expLeft == true && exp.operator === "||") {
- return Promise.resolve(true);
- }
- if (expLeft == false && exp.operator === "&&") {
- return Promise.resolve(false);
- }
- return evaluate(exp.right, workerScript).then(function(expRight) {
- switch (exp.operator){
- case "===":
- case "==":
- return Promise.resolve(expLeft===expRight);
- break;
- case "!==":
- case "!=":
- return Promise.resolve(expLeft!==expRight);
- break;
- case "<":
- return Promise.resolve(expLeft":
- return Promise.resolve(expLeft>expRight);
- break;
- case ">=":
- return Promise.resolve(expLeft>=expRight);
- break;
- case "+":
- return Promise.resolve(expLeft+expRight);
- break;
- case "-":
- return Promise.resolve(expLeft-expRight);
- break;
- case "*":
- return Promise.resolve(expLeft*expRight);
- break;
- case "/":
- if (expRight === 0) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "ERROR: Divide by zero"));
- } else {
- return Promise.resolve(expLeft/expRight);
- }
- break;
- case "%":
- return Promise.resolve(expLeft%expRight);
- break;
- case "in":
- return Promise.resolve(expLeft in expRight);
- break;
- case "instanceof":
- return Promise.resolve(expLeft instanceof expRight);
- break;
- case "||":
- return Promise.resolve(expLeft || expRight);
- break;
- case "&&":
- return Promise.resolve(expLeft && expRight);
- break;
- default:
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unsupported operator: " + exp.operator));
- }
- });
- });
-}
-
-function evalUnary(exp, workerScript){
- var env = workerScript.env;
- if (env.stopFlag) {return Promise.reject(workerScript);}
- return evaluate(exp.argument, workerScript).then(function(res) {
- if (exp.operator == "!") {
- return Promise.resolve(!res);
- } else if (exp.operator == "-") {
- if (isNaN(res)) {
- return Promise.resolve(res);
- } else {
- return Promise.resolve(-1 * res);
- }
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unimplemented unary operator: " + exp.operator));
- }
- });
-}
-
-//Takes in a MemberExpression that should represent a Netscript array (possible multidimensional)
-//The return value is an array of the form:
-// [0th index (leftmost), array name, 1st index, 2nd index, ...]
-function getArrayElement(exp, workerScript) {
- var indices = [];
- return evaluate(exp.property, workerScript).then(function(idx) {
- if (isNaN(idx)) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid access to array. Index is not a number: " + idx));
- } else {
- if (exp.object.name === undefined && exp.object.object) {
- return getArrayElement(exp.object, workerScript).then(function(res) {
- res.push(idx);
- indices = res;
- return Promise.resolve(indices);
- }).catch(function(e) {
- return Promise.reject(e);
- });
- } else {
- indices.push(idx);
- indices.push(exp.object.name);
- return Promise.resolve(indices);
- }
- }
- });
-}
-
-function evalAssignment(exp, workerScript) {
- var env = workerScript.env;
- if (env.stopFlag) {return Promise.reject(workerScript);}
-
- if (exp.left.type != "Identifier" && exp.left.type != "MemberExpression") {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Cannot assign to " + JSON.stringify(exp.left)));
- }
-
- if (exp.operator !== "=" && !(exp.left.name in env.vars)){
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.left.name + " not defined"));
- }
-
- return evaluate(exp.right, workerScript).then(function(expRight) {
- if (exp.left.type == "MemberExpression") {
- if (!exp.left.computed) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Cannot assign to an object's property. This is currently unsupported in Netscript", exp));
- }
- //Assign to array element
- //Array object designed by exp.left.object.name
- //Index designated by exp.left.property
- return getArrayElement(exp.left, workerScript).then(function(res) {
- if (!(res instanceof Array) || res.length < 2) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Error evaluating array assignment. This is (probably) a bug please report to game dev"));
- }
-
- //The array name is the second value
- var arrName = res.splice(1, 1);
- arrName = arrName[0];
-
- var res;
- try {
- res = env.setArrayElement(arrName, res, expRight);
- } catch (e) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, e));
- }
- return Promise.resolve(res);
- }).catch(function(e) {
- return Promise.reject(e);
- });
- } else {
- //Other assignments
- try {
- var assign;
- switch (exp.operator) {
- case "=":
- assign = expRight; break;
- case "+=":
- assign = env.get(exp.left.name) + expRight; break;
- case "-=":
- assign = env.get(exp.left.name) - expRight; break;
- case "*=":
- assign = env.get(exp.left.name) * expRight; break;
- case "/=":
- assign = env.get(exp.left.name) / expRight; break;
- case "%=":
- assign = env.get(exp.left.name) % expRight; break;
- default:
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Bitwise assignment is not implemented"));
- }
- env.set(exp.left.name, assign);
- return Promise.resolve(assign);
- } catch (e) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Failed to set environment variable: " + e.toString()));
- }
- }
- });
-}
-
-function evaluateIf(exp, workerScript, i) {
- var env = workerScript.env;
- return evaluate(exp.test, workerScript).then(function(condRes) {
- if (condRes) {
- return evaluate(exp.consequent, workerScript).then(function(res) {
- return Promise.resolve(true);
- }, function(e) {
- return Promise.reject(e);
- });
- } else if (exp.alternate) {
- return evaluate(exp.alternate, workerScript).then(function(res) {
- return Promise.resolve(true);
- }, function(e) {
- return Promise.reject(e);
- });
- } else {
- return Promise.resolve("endIf");
- }
- });
-}
-
-//Evaluate the looping part of a for loop (Initialization block is NOT done in here)
-function evaluateFor(exp, workerScript) {
- var env = workerScript.env;
- if (env.stopFlag) {return Promise.reject(workerScript);}
- return new Promise(function(resolve, reject) {
- function recurse() {
- //Don't return a promise so the promise chain is broken on each recursion (saving memory)
- evaluate(exp.test, workerScript).then(function(resCond) {
- if (resCond) {
- return evaluate(exp.body, workerScript).then(function(res) {
- return evaluate(exp.update, workerScript);
- }).catch(function(e) {
- if (e == "CONTINUESTATEMENT" ||
- (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "CONTINUESTATEMENT")) {
- //Continue statement, recurse to next iteration
- return evaluate(exp.update, workerScript).then(function(resPostloop) {
- return evaluateFor(exp, workerScript);
- }).then(function(foo) {
- return Promise.resolve("endForLoop");
- }).catch(function(e) {
- return Promise.reject(e);
- });
- } else {
- return Promise.reject(e);
- }
- }).then(recurse, reject).catch(function(e) {
- return Promise.reject(e);
- });
- } else {
- resolve();
- }
- }).catch(function(e) {
- reject(e);
- });
- }
- recurse();
- });
-}
-
-function evaluateForeach(arr, args, workerScript) {
- console.log("evaluateForeach called");
- if (!(arr instanceof Array)) {
- return Promise.reject("Invalid array passed into forEach");
- }
- if (!(args instanceof Array) && args.length != 1) {
- return Promise.reject("Invalid argument passed into forEach");
- }
- var func = args[0];
- if (typeof func !== "function") {
- return Promise.reject("Invalid function passed into forEach");
- }
- console.log(func);
- return new Promise(function(resolve, reject) {
- //Don't return a promise so the promise chain is broken on each recursion
- function recurse(i) {
- console.log("recurse() called with i: " + i);
- if (i >= arr.length) {
- resolve();
- } else {
- return Promise.delay(__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].CodeInstructionRunTime).then(function() {
- console.log("About to apply function");
- var res = func.apply(null, [arr[i]]);
- console.log("Applied function");
- ++i;
- Promise.resolve(res).then(function(val) {
- recurse(i);
- }, reject).catch(function(e) {
- return Promise.reject(e);
- });
- });
- }
- }
- recurse(0);
- });
-}
-
-function evaluateWhile(exp, workerScript) {
- var env = workerScript.env;
- if (env.stopFlag) {return Promise.reject(workerScript);}
- return new Promise(function (resolve, reject) {
- function recurse() {
- //Don't return a promise so the promise chain is broken on each recursion (saving memory)
- evaluate(exp.test, workerScript).then(function(resCond) {
- if (resCond) {
- return evaluate(exp.body, workerScript).catch(function(e) {
- if (e == "CONTINUESTATEMENT" ||
- (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "CONTINUESTATEMENT")) {
- //Continue statement, recurse
- return evaluateWhile(exp, workerScript).then(function(foo) {
- return Promise.resolve("endWhileLoop");
- }, function(e) {
- return Promise.reject(e);
- });
- } else {
- return Promise.reject(e);
- }
- }).then(recurse, reject).catch(function(e) {
- return Promise.reject(e);
- });
- } else {
- resolve();
- }
- }).catch(function(e) {
- reject(e);
- });
- }
- recurse();
- });
-}
-
-function evaluateProg(exp, workerScript, index) {
- var env = workerScript.env;
- if (env.stopFlag) {return Promise.reject(workerScript);}
- if (index >= exp.body.length) {
- return Promise.resolve("progFinished");
- } else {
- //Evaluate this line of code in the prog
- //After the code finishes evaluating, evaluate the next line recursively
- return evaluate(exp.body[index], workerScript).then(function(res) {
- return evaluateProg(exp, workerScript, index + 1);
- }).then(function(res) {
- return Promise.resolve(workerScript);
- }).catch(function(e) {
- return Promise.reject(e);
- });
- }
-}
-
-function evaluateImport(exp, workerScript, checkingRam=false) {
- //When its checking RAM, it exports an array of nodes for each imported function
- var ramCheckRes = [];
-
- var env = workerScript.env;
- if (env.stopFlag) {
- if (checkingRam) {return ramCheckRes;}
- return Promise.reject(workerScript);
- }
-
- //Get source script and name of all functions to import
- var scriptName = exp.source.value;
- var namespace, namespaceObj, allFns = false, fnNames = [];
- if (exp.specifiers.length === 1 && exp.specifiers[0].type === "ImportNamespaceSpecifier") {
- allFns = true;
- namespace = exp.specifiers[0].local.name;
- } else {
- for (var i = 0; i < exp.specifiers.length; ++i) {
- fnNames.push(exp.specifiers[i].local.name);
- }
- }
-
- //Get the code
- var server = Object(__WEBPACK_IMPORTED_MODULE_5__Server_js__["e" /* getServer */])(workerScript.serverIp), code = "";
- if (server == null) {
- if (checkingRam) {return ramCheckRes;}
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Failed to identify server. This is a bug please report to dev", exp));
- }
- for (var i = 0; i < server.scripts.length; ++i) {
- if (server.scripts[i].filename === scriptName) {
- code = server.scripts[i].code;
- break;
- }
- }
- if (code === "") {
- if (checkingRam) {return ramCheckRes;}
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Could not find script " + scriptName + " to import", exp));
- }
-
- //Create the AST
- try {
- var ast = Object(__WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__["parse"])(code, {sourceType:"module"});
- } catch(e) {
- console.log("Failed to parse import script");
- if (checkingRam) {return ramCheckRes;}
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Failed to import functions from " + scriptName +
- " This is most likely due to a syntax error in the imported script", exp));
- }
-
- if (allFns) {
- //A namespace is implemented as a JS obj
- env.set(namespace, {});
- namespaceObj = env.get(namespace);
- }
-
- //Search through the AST for all imported functions
- var queue = [ast];
- while (queue.length != 0) {
- var node = queue.shift();
- switch (node.type) {
- case "BlockStatement":
- case "Program":
- for (var i = 0; i < node.body.length; ++i) {
- if (node.body[i] instanceof __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__["Node"]) {
- queue.push(node.body[i]);
- }
- }
- break;
- case "FunctionDeclaration":
- if (node.id && node.id.name) {
- if (allFns) {
- //Import all functions under this namespace
- if (checkingRam) {
- ramCheckRes.push(node);
- } else {
- namespaceObj[node.id.name] = node;
- }
- } else {
- //Only import specified functions
- if (fnNames.includes(node.id.name)) {
- if (checkingRam) {
- ramCheckRes.push(node);
- } else {
- env.set(node.id.name, node);
- }
-
- }
- }
- } else {
- if (checkingRam) {return ramCheckRes;}
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid function declaration in imported script " + scriptName, exp));
- }
- break;
- default:
- break;
- }
-
- for (var prop in node) {
- if (node.hasOwnProperty(prop)) {
- if (node[prop] instanceof __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__["Node"]) {
- queue.push(node[prop]);
- }
- }
- }
- }
- if (!checkingRam) {workerScript.scriptRef.log("Imported functions from " + scriptName);}
- if (checkingRam) {return ramCheckRes;}
- return Promise.resolve(true);
-}
-
-function killNetscriptDelay(workerScript) {
- if (workerScript instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
- if (workerScript.delay) {
- clearTimeout(workerScript.delay);
- workerScript.delayResolve();
- }
- }
-}
-
-function netscriptDelay(time, workerScript) {
- return new Promise(function(resolve, reject) {
- workerScript.delay = setTimeout(()=>{
- workerScript.delay = null;
- resolve();
- }, time);
- workerScript.delayResolve = resolve;
- });
-}
-
-function makeRuntimeRejectMsg(workerScript, msg, exp=null) {
- var lineNum = "";
- if (exp != null) {
- var num = getErrorLineNumber(exp, workerScript);
- lineNum = " (Line " + num + ")"
- }
- return "|"+workerScript.serverIp+"|"+workerScript.name+"|" + msg + lineNum;
-}
-
-//Run a script from inside a script using run() command
-function runScriptFromScript(server, scriptname, args, workerScript, threads=1) {
- //Check if the script is already running
- var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_7__Script_js__["d" /* findRunningScript */])(scriptname, args, server);
- if (runningScriptObj != null) {
- workerScript.scriptRef.log(scriptname + " is already running on " + server.hostname);
- return Promise.resolve(false);
- }
-
- //'null/undefined' arguments are not allowed
- for (var i = 0; i < args.length; ++i) {
- if (args[i] == null) {
- workerScript.scriptRef.log("ERROR: Cannot execute a script with null/undefined as an argument");
- return Promise.resolve(false);
- }
- }
-
- //Check if the script exists and if it does run it
- for (var i = 0; i < server.scripts.length; ++i) {
- if (server.scripts[i].filename == scriptname) {
- //Check for admin rights and that there is enough RAM availble to run
- var script = server.scripts[i];
- var ramUsage = script.ramUsage;
- threads = Math.round(Number(threads)); //Convert to number and round
- ramUsage = ramUsage * threads * Math.pow(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].MultithreadingRAMCost, threads-1);
- var ramAvailable = server.maxRam - server.ramUsed;
-
- if (server.hasAdminRights == false) {
- workerScript.scriptRef.log("Cannot run script " + scriptname + " on " + server.hostname + " because you do not have root access!");
- return Promise.resolve(false);
- } else if (ramUsage > ramAvailable){
- workerScript.scriptRef.log("Cannot run script " + scriptname + "(t=" + threads + ") on " + server.hostname + " because there is not enough available RAM!");
- return Promise.resolve(false);
- } else {
- //Able to run script
- workerScript.scriptRef.log("Running script: " + scriptname + " on " + server.hostname + " with " + threads + " threads and args: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["j" /* printArray */])(args) + ". May take a few seconds to start up...");
- var runningScriptObj = new __WEBPACK_IMPORTED_MODULE_7__Script_js__["b" /* RunningScript */](script, args);
- runningScriptObj.threads = threads;
- server.runningScripts.push(runningScriptObj); //Push onto runningScripts
- Object(__WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["c" /* addWorkerScript */])(runningScriptObj, server);
- return Promise.resolve(true);
- }
- }
- }
- workerScript.scriptRef.log("Could not find script " + scriptname + " on " + server.hostname);
- return Promise.resolve(false);
-}
-
-function getErrorLineNumber(exp, workerScript) {
- var code = workerScript.scriptRef.scriptRef.code;
-
- //Split code up to the start of the node
- try {
- code = code.substring(0, exp.start);
- return (code.match(/\n/g) || []).length + 1;
- } catch(e) {
- return -1;
- }
-}
-
-function isScriptErrorMessage(msg) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["g" /* isString */])(msg)) {return false;}
- let splitMsg = msg.split("|");
- if (splitMsg.length != 4){
- return false;
- }
- var ip = splitMsg[1];
- if (!Object(__WEBPACK_IMPORTED_MODULE_10__utils_IPAddress_js__["c" /* isValidIPAddress */])(ip)) {
- return false;
- }
- return true;
-}
-
-//The same as Player's calculateHackingChance() function but takes in the server as an argument
-function scriptCalculateHackingChance(server) {
- var difficultyMult = (100 - server.hackDifficulty) / 100;
- var skillMult = (1.75 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill) + (0.2 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence);
- var skillChance = (skillMult - server.requiredHackingSkill) / skillMult;
- var chance = skillChance * difficultyMult * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_chance_mult;
- if (chance > 1) {return 1;}
- if (chance < 0) {return 0;}
- else {return chance;}
-}
-
-//The same as Player's calculateHackingTime() function but takes in the server as an argument
-function scriptCalculateHackingTime(server) {
- var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;
- var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50 + (0.1 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence));
- var hackingTime = 5 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds
- return hackingTime;
-}
-
-//The same as Player's calculateExpGain() function but takes in the server as an argument
-function scriptCalculateExpGain(server) {
- if (server.baseDifficulty == null) {
- server.baseDifficulty = server.hackDifficulty;
- }
- return (server.baseDifficulty * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_exp_mult * 0.3 + 3) * __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["a" /* BitNodeMultipliers */].HackExpGain;
-}
-
-//The same as Player's calculatePercentMoneyHacked() function but takes in the server as an argument
-function scriptCalculatePercentMoneyHacked(server) {
- var difficultyMult = (100 - server.hackDifficulty) / 100;
- var skillMult = (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill - (server.requiredHackingSkill - 1)) / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill;
- var percentMoneyHacked = difficultyMult * skillMult * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_money_mult / 240;
- if (percentMoneyHacked < 0) {return 0;}
- if (percentMoneyHacked > 1) {return 1;}
- return percentMoneyHacked * __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["a" /* BitNodeMultipliers */].ScriptHackMoney;
-}
-
-//Amount of time to execute grow() in milliseconds
-function scriptCalculateGrowTime(server) {
- var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;
- var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50 + (0.1 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence));
- var growTime = 16 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds
- return growTime * 1000;
-}
-
-//Amount of time to execute weaken() in milliseconds
-function scriptCalculateWeakenTime(server) {
- var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;
- var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50 + (0.1 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence));
- var weakenTime = 20 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds
- return weakenTime * 1000;
-}
-
-
-
-
-/***/ }),
-/* 29 */
+/* 26 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -38021,7 +36442,7 @@ function scriptCalculateWeakenTime(server) {
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__InteractiveTutorial_js__ = __webpack_require__(27);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__InteractiveTutorial_js__ = __webpack_require__(33);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__ = __webpack_require__(2);
@@ -38531,7 +36952,221 @@ function getHacknetNode(name) {
/***/ }),
-/* 30 */
+/* 27 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Messages; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return checkForMessagesToSend; });
+/* unused harmony export sendMessage */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return showMessage; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return loadMessages; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return initMessages; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Message; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(20);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__ = __webpack_require__(17);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Missions_js__ = __webpack_require__(28);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__RedPill_js__ = __webpack_require__(47);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(8);
+
+
+
+
+
+
+
+
+
+
+/* Message.js */
+function Message(filename="", msg="") {
+ this.filename = filename;
+ this.msg = msg;
+ this.recvd = false;
+}
+
+Message.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Message", this);
+}
+
+
+Message.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Message, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].constructors.Message = Message;
+
+//Sends message to player, including a pop up
+function sendMessage(msg, forced=false) {
+ console.log("sending message: " + msg.filename);
+ msg.recvd = true;
+ if (forced || !__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].SuppressMessages) {
+ showMessage(msg);
+ }
+ addMessageToServer(msg, "home");
+}
+
+function showMessage(msg) {
+ var txt = "Message received from unknown sender:
" +
+ "" + msg.msg + "
" +
+ "This message was saved as " + msg.filename + " onto your home computer.";
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);
+}
+
+//Adds a message to a server
+function addMessageToServer(msg, serverHostname) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_5__Server_js__["c" /* GetServerByHostname */])(serverHostname);
+ if (server == null) {
+ console.log("WARNING: Did not locate " + serverHostname);
+ return;
+ }
+ for (var i = 0; i < server.messages.length; ++i) {
+ if (server.messages[i].filename === msg.filename) {
+ return; //Already exists
+ }
+ }
+ server.messages.push(msg);
+}
+
+//Checks if any of the 'timed' messages should be sent
+function checkForMessagesToSend() {
+ var jumper0 = Messages[MessageFilenames.Jumper0];
+ var jumper1 = Messages[MessageFilenames.Jumper1];
+ var jumper2 = Messages[MessageFilenames.Jumper2];
+ var jumper3 = Messages[MessageFilenames.Jumper3];
+ var jumper4 = Messages[MessageFilenames.Jumper4];
+ var cybersecTest = Messages[MessageFilenames.CyberSecTest];
+ var nitesecTest = Messages[MessageFilenames.NiteSecTest];
+ var bitrunnersTest = Messages[MessageFilenames.BitRunnersTest];
+ var redpill = Messages[MessageFilenames.RedPill];
+
+ var redpillOwned = false;
+ if (__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) {
+ redpillOwned = true;
+ }
+
+ if (redpill && redpillOwned && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].sourceFiles.length === 0 && !__WEBPACK_IMPORTED_MODULE_4__RedPill_js__["b" /* redPillFlag */] && !__WEBPACK_IMPORTED_MODULE_2__Missions_js__["c" /* inMission */]) {
+ if (!__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["b" /* dialogBoxOpened */]) {
+ sendMessage(redpill, true);
+ }
+ } else if (redpill && redpillOwned) {
+ //If player has already destroyed a BitNode, message is not forced
+ if (!__WEBPACK_IMPORTED_MODULE_4__RedPill_js__["b" /* redPillFlag */] && !__WEBPACK_IMPORTED_MODULE_2__Missions_js__["c" /* inMission */] && !__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["b" /* dialogBoxOpened */]) {
+ sendMessage(redpill);
+ }
+ } else if (jumper0 && !jumper0.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 25) {
+ sendMessage(jumper0);
+ __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__["a" /* Programs */].Flight);
+ } else if (jumper1 && !jumper1.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 40) {
+ sendMessage(jumper1);
+ } else if (cybersecTest && !cybersecTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 50) {
+ sendMessage(cybersecTest);
+ } else if (jumper2 && !jumper2.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 175) {
+ sendMessage(jumper2);
+ } else if (nitesecTest && !nitesecTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 200) {
+ sendMessage(nitesecTest);
+ } else if (jumper3 && !jumper3.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 350) {
+ sendMessage(jumper3);
+ } else if (jumper4 && !jumper4.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 490) {
+ sendMessage(jumper4);
+ } else if (bitrunnersTest && !bitrunnersTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 500) {
+ sendMessage(bitrunnersTest);
+ }
+}
+
+function AddToAllMessages(msg) {
+ Messages[msg.filename] = msg;
+}
+
+let Messages = {}
+
+function loadMessages(saveString) {
+ Messages = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */]);
+}
+
+let MessageFilenames = {
+ Jumper0: "j0.msg",
+ Jumper1: "j1.msg",
+ Jumper2: "j2.msg",
+ Jumper3: "j3.msg",
+ Jumper4: "j4.msg",
+ CyberSecTest: "csec-test.msg",
+ NiteSecTest: "nitesec-test.msg",
+ BitRunnersTest: "19dfj3l1nd.msg",
+ RedPill: "icarus.msg",
+}
+
+function initMessages() {
+ //Reset
+ Messages = {};
+
+ //jump3R Messages
+ AddToAllMessages(new Message(MessageFilenames.Jumper0,
+ "I know you can sense it. I know you're searching for it. " +
+ "It's why you spend night after " +
+ "night at your computer.
It's real, I've seen it. And I can " +
+ "help you find it. But not right now. You're not ready yet.
" +
+ "Use this program to track your progress
" +
+ "The fl1ght.exe program was added to your home computer
" +
+ "-jump3R"));
+ AddToAllMessages(new Message(MessageFilenames.Jumper1,
+ "Soon you will be contacted by a hacking group known as CyberSec. " +
+ "They can help you with your search.
" +
+ "You should join them, garner their favor, and " +
+ "exploit them for their Augmentations. But do not trust them. " +
+ "They are not what they seem. No one is.
" +
+ "-jump3R"));
+ AddToAllMessages(new Message(MessageFilenames.Jumper2,
+ "Do not try to save the world. There is no world to save. If " +
+ "you want to find the truth, worry only about yourself. Ethics and " +
+ "morals will get you killed.
Watch out for a hacking group known as NiteSec." +
+ "
-jump3R"));
+ AddToAllMessages(new Message(MessageFilenames.Jumper3,
+ "You must learn to walk before you can run. And you must " +
+ "run before you can fly. Look for the black hand.
" +
+ "I.I.I.I
-jump3R"));
+ AddToAllMessages(new Message(MessageFilenames.Jumper4,
+ "To find what you are searching for, you must understand the bits. " +
+ "The bits are all around us. The runners will help you.
" +
+ "-jump3R"));
+
+ //Messages from hacking factions
+ AddToAllMessages(new Message(MessageFilenames.CyberSecTest,
+ "We've been watching you. Your skills are very impressive. But you're wasting " +
+ "your talents. If you join us, you can put your skills to good use and change " +
+ "the world for the better. If you join us, we can unlock your full potential.
" +
+ "But first, you must pass our test. Find and hack our server using the Terminal.
" +
+ "-CyberSec"));
+ AddToAllMessages(new Message(MessageFilenames.NiteSecTest,
+ "People say that the corrupted governments and corporations rule the world. " +
+ "Yes, maybe they do. But do you know who everyone really fears? People " +
+ "like us. Because they can't hide from us. Because they can't fight shadows " +
+ "and ideas with bullets.
" +
+ "Join us, and people will fear you, too.
" +
+ "Find and hack our hidden server using the Terminal. Then, we will contact you again." +
+ "
-NiteSec"));
+ AddToAllMessages(new Message(MessageFilenames.BitRunnersTest,
+ "We know what you are doing. We know what drives you. We know " +
+ "what you are looking for.
" +
+ "We can help you find the answers.
" +
+ "run4theh111z"));
+
+ AddToAllMessages(new Message(MessageFilenames.RedPill,
+ "@)(#V%*N)@(#*)*C)@#%*)*V)@#(*%V@)(#VN%*)@#(*% " +
+ ")@B(*#%)@)M#B*%V)____FIND___#$@)#%(B*)@#(*%B) " +
+ "@_#(%_@#M(BDSPOMB__THE-CAVE_#)$(*@#$)@#BNBEGB " +
+ "DFLSMFVMV)#@($*)@#*$MV)@#(*$V)M#(*$)M@(#*VM$)"));
+}
+
+
+
+
+/***/ }),
+/* 28 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -38541,12 +37176,12 @@ function getHacknetNode(name) {
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return currMission; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_jsplumb__ = __webpack_require__(70);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_jsplumb__ = __webpack_require__(67);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_jsplumb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_jsplumb__);
@@ -40086,7 +38721,1461 @@ HackingMission.prototype.finishMission = function(win) {
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
/***/ }),
-/* 31 */
+/* 29 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Gang; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return displayGangContent; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return updateGangContent; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return loadAllGangs; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AllGangs; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return resetGangs; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return deleteGangDisplayContent; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__ = __webpack_require__(15);
+
+
+
+
+
+
+
+
+
+
+
+/* Gang.js */
+//Switch between territory and management screen with 1 and 2
+$(document).keydown(function(event) {
+ if (__WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].Page.Gang && !__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["e" /* yesNoBoxOpen */]) {
+ if (gangMemberFilter != null && gangMemberFilter === document.activeElement) {return;}
+ if (event.keyCode === 49) {
+ if(gangTerritorySubpage.style.display === "block") {
+ managementButton.click();
+ }
+ } else if (event.keyCode === 50) {
+ if (gangManagementSubpage.style.display === "block") {
+ territoryButton.click();
+ }
+ }
+ }
+});
+
+//Delete upgrade box when clicking outside
+$(document).mousedown(function(event) {
+ var boxId = "gang-member-upgrade-popup-box";
+ var contentId = "gang-member-upgrade-popup-box-content";
+ if (gangMemberUpgradeBoxOpened) {
+ if ( $(event.target).closest("#" + contentId).get(0) == null ) {
+ //Delete the box
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["l" /* removeElement */])(gangMemberUpgradeBox);
+ gangMemberUpgradeBox = null;
+ gangMemberUpgradeBoxContent = null;
+ gangMemberUpgradeBoxOpened = false;
+ gangMemberUpgradeBoxElements = null;
+ }
+ }
+});
+
+let GangNames = ["Slum Snakes", "Tetrads", "The Syndicate", "The Dark Army", "Speakers for the Dead",
+ "NiteSec", "The Black Hand"];
+let AllGangs = {
+ "Slum Snakes" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "Tetrads" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Syndicate" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Dark Army" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "Speakers for the Dead" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "NiteSec" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Black Hand" : {
+ power: 1,
+ territory: 1/7,
+ },
+}
+
+function resetGangs() {
+ AllGangs = {
+ "Slum Snakes" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "Tetrads" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Syndicate" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Dark Army" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "Speakers for the Dead" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "NiteSec" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Black Hand" : {
+ power: 1,
+ territory: 1/7,
+ },
+ }
+}
+
+function loadAllGangs(saveString) {
+ AllGangs = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* Reviver */]);
+}
+
+//Power is an estimate of a gang's ability to gain/defend territory
+let gangStoredPowerCycles = 0;
+function processAllGangPowerGains(numCycles=1) {
+ if (!__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].inGang()) {return;}
+ gangStoredPowerCycles += numCycles;
+ if (gangStoredPowerCycles < 150) {return;}
+ var playerGangName = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.facName;
+ for (var name in AllGangs) {
+ if (AllGangs.hasOwnProperty(name)) {
+ if (name == playerGangName) {
+ AllGangs[name].power += __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.calculatePower();
+ } else {
+ var gain = Math.random() * 0.02; //TODO Adjust as necessary
+ AllGangs[name].power += (gain);
+ }
+ }
+ }
+
+ gangStoredPowerCycles -= 150;
+}
+
+let gangStoredTerritoryCycles = 0;
+function processAllGangTerritory(numCycles=1) {
+ if (!__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].inGang()) {return;}
+ gangStoredTerritoryCycles += numCycles;
+ if (gangStoredTerritoryCycles < __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].GangTerritoryUpdateTimer) {return;}
+
+ for (var i = 0; i < GangNames.length; ++i) {
+ var other = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, GangNames.length-1);
+ while(other == i) {
+ other = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, GangNames.length-1);
+ }
+ var thisPwr = AllGangs[GangNames[i]].power;
+ var otherPwr = AllGangs[GangNames[other]].power;
+ var thisChance = thisPwr / (thisPwr + otherPwr);
+
+ if (Math.random() < thisChance) {
+ if (AllGangs[GangNames[other]].territory <= 0) {
+ return;
+ }
+ AllGangs[GangNames[i]].territory += 0.0001;
+ AllGangs[GangNames[other]].territory -= 0.0001;
+ } else {
+ if (AllGangs[GangNames[i]].territory <= 0) {
+ return;
+ }
+ AllGangs[GangNames[i]].territory -= 0.0001;
+ AllGangs[GangNames[other]].territory += 0.0001;
+ }
+ }
+
+ gangStoredTerritoryCycles -= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].GangTerritoryUpdateTimer;
+}
+
+/* faction - Name of corresponding faction
+ hacking - Boolean indicating whether its a hacking gang or not
+ */
+function Gang(facName, hacking=false) {
+ this.facName = facName;
+ this.members = []; //Array of GangMembers
+ this.wanted = 1;
+ this.respect = 1;
+ this.power = 0;
+
+ this.isHackingGang = hacking;
+
+ this.respectGainRate = 0;
+ this.wantedGainRate = 0;
+ this.moneyGainRate = 0;
+
+ //When processing gains, this stores the number of cycles until some
+ //limit is reached, and then calculates and applies the gains only at that limit
+ this.storedCycles = 0;
+}
+
+Gang.prototype.process = function(numCycles=1) {
+ this.processGains(numCycles);
+ this.processExperienceGains(numCycles);
+ processAllGangPowerGains(numCycles);
+ processAllGangTerritory(numCycles);
+}
+
+Gang.prototype.processGains = function(numCycles=1) {
+ this.storedCycles += numCycles;
+ if (isNaN(this.storedCycles)) {
+ console.log("ERROR: Gang's storedCylces is NaN");
+ this.storedCycles = 0;
+ }
+ if (this.storedCycles < 25) {return;} //Only process every 5 seconds at least
+
+ //Get gains per cycle
+ var moneyGains = 0, respectGains = 0, wantedLevelGains = 0;
+ for (var i = 0; i < this.members.length; ++i) {
+ respectGains += (this.members[i].calculateRespectGain());
+ wantedLevelGains += (this.members[i].calculateWantedLevelGain());
+ moneyGains += (this.members[i].calculateMoneyGain());
+ }
+ this.respectGainRate = respectGains;
+ this.wantedGainRate = wantedLevelGains;
+ this.moneyGainRate = moneyGains;
+
+ if (!isNaN(respectGains)) {
+ var gain = respectGains * this.storedCycles;
+ this.respect += (gain);
+ //Faction reputation gains is respect gain divided by some constant
+ var fac = __WEBPACK_IMPORTED_MODULE_2__Faction_js__["b" /* Factions */][this.facName];
+ if (!(fac instanceof __WEBPACK_IMPORTED_MODULE_2__Faction_js__["a" /* Faction */])) {
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: Could not get Faction associates with your gang. This is a bug, please report to game dev");
+ } else {
+ var favorMult = 1 + (fac.favor / 100);
+ fac.playerReputation += ((__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].faction_rep_mult * gain * favorMult) / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].GangRespectToReputationRatio);
+ }
+
+ } else {
+ console.log("ERROR: respectGains is NaN");
+ }
+ if (!isNaN(wantedLevelGains)) {
+ if (this.wanted === 1 && wantedLevelGains < 0) {
+ //Do nothing
+ } else {
+ this.wanted += (wantedLevelGains * this.storedCycles);
+ if (this.wanted < 1) {this.wanted = 1;}
+ }
+ } else {
+ console.log("ERROR: wantedLevelGains is NaN");
+ }
+ if (!isNaN(moneyGains)) {
+ __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gainMoney(moneyGains * this.storedCycles);
+ } else {
+ console.log("ERROR: respectGains is NaN");
+ }
+
+ this.storedCycles = 0;
+}
+
+Gang.prototype.processExperienceGains = function(numCycles=1) {
+ for (var i = 0; i < this.members.length; ++i) {
+ this.members[i].gainExperience(numCycles);
+ this.members[i].updateSkillLevels();
+ }
+}
+
+//Calculates power GAIN, which is added onto the Gang's existing power
+Gang.prototype.calculatePower = function() {
+ var memberTotal = 0;
+ for (var i = 0; i < this.members.length; ++i) {
+ if (this.members[i].task instanceof GangMemberTask &&
+ this.members[i].task.name == "Territory Warfare") {
+ memberTotal += this.members[i].calculatePower();
+ }
+ }
+ return (0.0005 * memberTotal);
+}
+
+Gang.prototype.autoAssignMemberToTask = function(taskName) {
+ for (var i = 0; i < this.members.length; ++i) {
+ if (this.members[i].task.name === taskName) {
+ this.members[i].assignToTask(taskName);
+ return true;
+ }
+ }
+ return false;
+}
+
+Gang.prototype.autoUnassignMemberFromTask = function(taskName) {
+ for (var i = 0; i < this.members.length; ++i) {
+ if (this.members[i].task.name === taskName) {
+ this.members[i].unassignFromTask();
+ return true;
+ }
+ }
+ return false;
+}
+
+Gang.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Gang", this);
+}
+
+Gang.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Gang, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* Reviver */].constructors.Gang = Gang;
+
+/*** Gang Member object ***/
+function GangMember(name) {
+ this.name = name;
+ this.task = GangMemberTasks["Unassigned"]; //GangMemberTask object
+ this.city = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].city;
+
+ this.hack = 1;
+ this.str = 1;
+ this.def = 1;
+ this.dex = 1;
+ this.agi = 1;
+ this.cha = 1;
+
+ this.hack_exp = 0;
+ this.str_exp = 0;
+ this.def_exp = 0;
+ this.dex_exp = 0;
+ this.agi_exp = 0;
+ this.cha_exp = 0;
+
+ this.hack_mult = 1;
+ this.str_mult = 1;
+ this.def_mult = 1;
+ this.dex_mult = 1;
+ this.agi_mult = 1;
+ this.cha_mult = 1;
+
+ this.upgrades = []; //Names of upgrades
+}
+
+//Same formula for Player
+GangMember.prototype.calculateSkill = function(exp) {
+ return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);
+}
+
+GangMember.prototype.updateSkillLevels = function() {
+ this.hack = Math.floor(this.calculateSkill(this.hack_exp) * this.hack_mult);
+ this.str = Math.floor(this.calculateSkill(this.str_exp) * this.str_mult);
+ this.def = Math.floor(this.calculateSkill(this.def_exp) * this.def_mult);
+ this.dex = Math.floor(this.calculateSkill(this.dex_exp) * this.dex_mult);
+ this.agi = Math.floor(this.calculateSkill(this.agi_exp) * this.agi_mult);
+ this.cha = Math.floor(this.calculateSkill(this.cha_exp) * this.cha_mult);
+}
+
+GangMember.prototype.calculatePower = function() {
+ return (this.hack + this.str + this.def +
+ this.dex + this.agi + this.cha) / 100;
+}
+
+GangMember.prototype.assignToTask = function(taskName) {
+ if (GangMemberTasks.hasOwnProperty(taskName)) {
+ this.task = GangMemberTasks[taskName];
+ } else {
+ this.task = GangMemberTasks["Unassigned"];
+ }
+}
+
+GangMember.prototype.unassignFromTask = function() {
+ if (GangMemberTasks.hasOwnProperty("Unassigned")) {
+ this.task = GangMemberTasks["Unassigned"];
+ } else {
+ console.log("ERROR: Can't find Unassigned Gang member task");
+ this.task = null;
+ }
+}
+
+//Gains are per cycle
+GangMember.prototype.calculateRespectGain = function() {
+ var task = this.task;
+ if (task == null || !(task instanceof GangMemberTask) || task.baseRespect === 0) {return 0;}
+ var statWeight = (task.hackWeight/100) * this.hack +
+ (task.strWeight/100) * this.str +
+ (task.defWeight/100) * this.def +
+ (task.dexWeight/100) * this.dex +
+ (task.agiWeight/100) * this.agi +
+ (task.chaWeight/100) * this.cha;
+ statWeight -= (3.5 * task.difficulty);
+ if (statWeight <= 0) {return 0;}
+ var territoryMult = AllGangs[__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.facName].territory;
+ if (territoryMult <= 0) {return 0;}
+ var respectMult = (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.respect) / (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.respect + __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.wanted);
+ return 12 * task.baseRespect * statWeight * territoryMult * respectMult;
+}
+
+GangMember.prototype.calculateWantedLevelGain = function() {
+ var task = this.task;
+ if (task == null || !(task instanceof GangMemberTask) || task.baseWanted === 0) {return 0;}
+ var statWeight = (task.hackWeight/100) * this.hack +
+ (task.strWeight/100) * this.str +
+ (task.defWeight/100) * this.def +
+ (task.dexWeight/100) * this.dex +
+ (task.agiWeight/100) * this.agi +
+ (task.chaWeight/100) * this.cha;
+ statWeight -= (3.5 * task.difficulty);
+ if (statWeight <= 0) {return 0;}
+ var territoryMult = AllGangs[__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.facName].territory;
+ if (territoryMult <= 0) {return 0;}
+ if (task.baseWanted < 0) {
+ return task.baseWanted * statWeight * territoryMult;
+ } else {
+ return 6 * task.baseWanted / (3 * statWeight * territoryMult);
+ }
+}
+
+GangMember.prototype.calculateMoneyGain = function() {
+ var task = this.task;
+ if (task == null || !(task instanceof GangMemberTask) || task.baseMoney === 0) {return 0;}
+ var statWeight = (task.hackWeight/100) * this.hack +
+ (task.strWeight/100) * this.str +
+ (task.defWeight/100) * this.def +
+ (task.dexWeight/100) * this.dex +
+ (task.agiWeight/100) * this.agi +
+ (task.chaWeight/100) * this.cha;
+ statWeight -= (3.5 * task.difficulty);
+ if (statWeight <= 0) {return 0;}
+ var territoryMult = AllGangs[__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.facName].territory;
+ if (territoryMult <= 0) {return 0;}
+ var respectMult = (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.respect) / (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.respect + __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.wanted);
+ return 5 * task.baseMoney * statWeight * territoryMult * respectMult;
+}
+
+GangMember.prototype.gainExperience = function(numCycles=1) {
+ var task = this.task;
+ if (task == null || !(task instanceof GangMemberTask)) {return;}
+ this.hack_exp += (task.hackWeight / 1500) * task.difficulty * numCycles;
+ this.str_exp += (task.strWeight / 1500) * task.difficulty * numCycles;
+ this.def_exp += (task.defWeight / 1500) * task.difficulty * numCycles;
+ this.dex_exp += (task.dexWeight / 1500) * task.difficulty * numCycles;
+ this.agi_exp += (task.agiWeight / 1500) * task.difficulty * numCycles;
+ this.cha_exp += (task.chaWeight / 1500) * task.difficulty * numCycles;
+}
+
+GangMember.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("GangMember", this);
+}
+
+GangMember.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(GangMember, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* Reviver */].constructors.GangMember = GangMember;
+
+//Defines tasks that Gang Members can work on
+function GangMemberTask(name="", desc="",
+ params={baseRespect: 0, baseWanted: 0, baseMoney: 0,
+ hackWeight: 0, strWeight: 0, defWeight: 0,
+ dexWeight: 0, agiWeight: 0, chaWeight: 0,
+ difficulty: 0}) {
+ this.name = name;
+ this.desc = desc;
+
+ this.baseRespect = params.baseRespect ? params.baseRespect : 0;
+ this.baseWanted = params.baseWanted ? params.baseWanted : 0;
+ this.baseMoney = params.baseMoney ? params.baseMoney : 0;
+
+ //Weights must add up to 100
+ this.hackWeight = params.hackWeight ? params.hackWeight : 0;
+ this.strWeight = params.strWeight ? params.strWeight : 0;
+ this.defWeight = params.defWeight ? params.defWeight : 0;
+ this.dexWeight = params.dexWeight ? params.dexWeight : 0;
+ this.agiWeight = params.agiWeight ? params.agiWeight : 0;
+ this.chaWeight = params.chaWeight ? params.chaWeight : 0;
+
+ //1 - 100
+ this.difficulty = params.difficulty ? params.difficulty : 1;
+}
+
+GangMemberTask.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("GangMemberTask", this);
+}
+
+GangMemberTask.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(GangMemberTask, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* Reviver */].constructors.GangMemberTask = GangMemberTask;
+
+//TODO Human trafficking and an equivalent hacking crime
+let GangMemberTasks = {
+ "Unassigned" : new GangMemberTask(
+ "Unassigned",
+ "This gang member is currently idle"),
+ "Ransomware" : new GangMemberTask(
+ "Ransomware",
+ "Assign this gang member to create and distribute ransomware
" +
+ "Earns money - Slightly increases respect - Slightly increases wanted level",
+ {baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1,
+ hackWeight: 100, difficulty: 1}),
+ "Phishing" : new GangMemberTask(
+ "Phishing",
+ "Assign this gang member to attempt phishing scams and attacks
" +
+ "Earns money - Slightly increases respect - Slightly increases wanted level",
+ {baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 2.5,
+ hackWeight: 85, chaWeight: 15, difficulty: 3}),
+ "Identity Theft" : new GangMemberTask(
+ "Identity Theft",
+ "Assign this gang member to attempt identity theft
" +
+ "Earns money - Increases respect - Increases wanted level",
+ {baseRespect: 0.0001, baseWanted: 0.01, baseMoney: 6,
+ hackWeight: 80, chaWeight: 20, difficulty: 4}),
+ "DDoS Attacks" : new GangMemberTask(
+ "DDoS Attacks",
+ "Assign this gang member to carry out DDoS attacks
" +
+ "Increases respect - Increases wanted level",
+ {baseRespect: 0.0004, baseWanted: 0.05,
+ hackWeight: 100, difficulty: 7}),
+ "Plant Virus" : new GangMemberTask(
+ "Plant Virus",
+ "Assign this gang member to create and distribute malicious viruses
" +
+ "Increases respect - Increases wanted level",
+ {baseRespect: 0.0006, baseWanted: 0.05,
+ hackWeight: 100, difficulty: 10}),
+ "Fraud & Counterfeiting" : new GangMemberTask(
+ "Fraud & Counterfeiting",
+ "Assign this gang member to commit financial fraud and digital counterfeiting
" +
+ "Earns money - Slightly increases respect - Slightly increases wanted level",
+ {baseRespect: 0.0005, baseWanted: 0.1, baseMoney: 15,
+ hackWeight: 80, chaWeight: 20, difficulty: 17}),
+ "Money Laundering" : new GangMemberTask(
+ "Money Laundering",
+ "Assign this gang member to launder money
" +
+ "Earns money - Increases respect - Increases wanted level",
+ {baseRespect: 0.0006, baseWanted:0.2, baseMoney: 40,
+ hackWeight: 75, chaWeight: 25, difficulty: 20}),
+ "Cyberterrorism" : new GangMemberTask(
+ "Cyberterrorism",
+ "Assign this gang member to commit acts of cyberterrorism
" +
+ "Greatly increases respect - Greatly increases wanted level",
+ {baseRespect: 0.001, baseWanted: 0.5,
+ hackWeight: 80, chaWeight: 20, difficulty: 33}),
+ "Ethical Hacking" : new GangMemberTask(
+ "Ethical Hacking",
+ "Assign this gang member to be an ethical hacker for corporations
" +
+ "Earns money - Lowers wanted level",
+ {baseWanted: -0.001, baseMoney: 1,
+ hackWeight: 90, chaWeight: 10, difficulty: 1}),
+ "Mug People" : new GangMemberTask(
+ "Mug People",
+ "Assign this gang member to mug random people on the streets
" +
+ "Earns money - Slightly increases respect - Very slightly increases wanted level",
+ {baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1,
+ strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 10, chaWeight: 15, difficulty: 1}),
+ "Deal Drugs" : new GangMemberTask(
+ "Deal Drugs",
+ "Assign this gang member to sell drugs.
" +
+ "Earns money - Slightly increases respect - Slightly increases wanted level",
+ {baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 4,
+ agiWeight: 20, dexWeight: 20, chaWeight: 60, difficulty: 3}),
+ "Run a Con" : new GangMemberTask(
+ "Run a Con",
+ "Assign this gang member to run cons
" +
+ "Earns money - Increases respect - Increases wanted level",
+ {baseRespect: 0.00015, baseWanted: 0.01, baseMoney: 10,
+ strWeight: 5, defWeight: 5, agiWeight: 25, dexWeight: 25, chaWeight: 40, difficulty: 10}),
+ "Armed Robbery" : new GangMemberTask(
+ "Armed Robbery",
+ "Assign this gang member to commit armed robbery on stores, banks and armored cars
" +
+ "Earns money - Increases respect - Increases wanted level",
+ {baseRespect: 0.0003, baseWanted: 0.1, baseMoney: 40,
+ hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 75,
+ difficulty: 25}),
+ "Threaten & Blackmail" : new GangMemberTask(
+ "Threaten & Blackmail",
+ "Assign this gang member to threaten and black mail high-profile targets
" +
+ "Earns money - Slightly increases respect - Slightly increases wanted level",
+ {baseRespect: 0.0002, baseWanted: 0.05, baseMoney: 15,
+ hackWeight: 25, strWeight: 25, dexWeight: 25, chaWeight: 25, difficulty: 28}),
+ "Terrorism" : new GangMemberTask(
+ "Terrorism",
+ "Assign this gang member to commit acts of terrorism
" +
+ "Greatly increases respect - Greatly increases wanted level",
+ {baseRespect: 0.001, baseWanted: 1,
+ hackWeight: 20, strWeight: 20, defWeight: 20,dexWeight: 20, chaWeight: 20,
+ difficulty: 33}),
+ "Vigilante Justice" : new GangMemberTask(
+ "Vigilante Justice",
+ "Assign this gang member to be a vigilante and protect the city from criminals
" +
+ "Decreases wanted level",
+ {baseWanted: -0.001,
+ hackWeight: 20, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight:20,
+ difficulty: 1}),
+ "Train Combat" : new GangMemberTask(
+ "Train Combat",
+ "Assign this gang member to increase their combat stats (str, def, dex, agi)",
+ {strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 25, difficulty: 5}),
+ "Train Hacking" : new GangMemberTask(
+ "Train Hacking",
+ "Assign this gang member to train their hacking skills",
+ {hackWeight: 100, difficulty: 8}),
+ "Territory Warfare" : new GangMemberTask(
+ "Territory Warfare",
+ "Assign this gang member to engage in territorial warfare with other gangs. " +
+ "Members assigned to this task will help increase your gang's territory " +
+ "and will defend your territory from being taken.",
+ {hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight: 20,
+ chaWeight: 5, difficulty: 3}),
+}
+
+
+function GangMemberUpgrade(name="", desc="", cost=0, type="w") {
+ this.name = name;
+ this.desc = desc;
+ this.cost = cost;
+ this.type = type; //w, a, v, r
+}
+
+//Passes in a GangMember object
+GangMemberUpgrade.prototype.apply = function(member) {
+ switch(this.name) {
+ case "Baseball Bat":
+ member.str_mult *= 1.05;
+ member.def_mult *= 1.05;
+ break;
+ case "Katana":
+ member.str_mult *= 1.1;
+ member.def_mult *= 1.1;
+ member.dex_mult *= 1.1;
+ break;
+ case "Glock 18C":
+ member.str_mult *= 1.15;
+ member.def_mult *= 1.15;
+ member.dex_mult *= 1.15;
+ member.agi_mult *= 1.15;
+ break;
+ case "P90C":
+ member.str_mult *= 1.2;
+ member.def_mult *= 1.2;
+ member.agi_mult *= 1.1;
+ break;
+ case "Steyr AUG":
+ member.str_mult *= 1.25;
+ member.def_mult *= 1.25;
+ break;
+ case "AK-47":
+ member.str_mult *= 1.5;
+ member.def_mult *= 1.5;
+ break;
+ case "M15A10 Assault Rifle":
+ member.str_mult *= 1.6;
+ member.def_mult *= 1.6;
+ break;
+ case "AWM Sniper Rifle":
+ member.str_mult *= 1.5;
+ member.dex_mult *= 1.5;
+ member.agi_mult *= 1.5;
+ break;
+ case "Bulletproof Vest":
+ member.def_mult *= 1.05;
+ break;
+ case "Full Body Armor":
+ member.def_mult *= 1.1;
+ break;
+ case "Liquid Body Armor":
+ member.def_mult *= 1.25;
+ member.agi_mult *= 1.25;
+ break;
+ case "Graphene Plating Armor":
+ member.def_mult *= 1.5;
+ break;
+ case "Ford Flex V20":
+ member.agi_mult *= 1.1;
+ member.cha_mult *= 1.1;
+ break;
+ case "ATX1070 Superbike":
+ member.agi_mult *= 1.15;
+ member.cha_mult *= 1.15;
+ break;
+ case "Mercedes-Benz S9001":
+ member.agi_mult *= 1.2;
+ member.cha_mult *= 1.2;
+ break;
+ case "White Ferrari":
+ member.agi_mult *= 1.25;
+ member.cha_mult *= 1.25;
+ break;
+ case "NUKE Rootkit":
+ member.hack_mult *= 1.1;
+ break;
+ case "Soulstealer Rootkit":
+ member.hack_mult *= 1.2;
+ break;
+ case "Demon Rootkit":
+ member.hack_mult *= 1.3;
+ break;
+ default:
+ console.log("ERROR: Could not find this upgrade: " + this.name);
+ break;
+ }
+}
+
+GangMemberUpgrade.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("GangMemberUpgrade", this);
+}
+
+GangMemberUpgrade.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(GangMemberUpgrade, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* Reviver */].constructors.GangMemberUpgrade = GangMemberUpgrade;
+
+let GangMemberUpgrades = {
+ "Baseball Bat" : new GangMemberUpgrade("Baseball Bat",
+ "Increases strength and defense by 5%", 1e6, "w"),
+ "Katana" : new GangMemberUpgrade("Katana",
+ "Increases strength, defense, and dexterity by 10%", 12e6, "w"),
+ "Glock 18C" : new GangMemberUpgrade("Glock 18C",
+ "Increases strength, defense, dexterity, and agility by 15%", 25e6, "w"),
+ "P90C" : new GangMemberUpgrade("P90C",
+ "Increases strength and defense by 20%. Increases agility by 10%", 50e6, "w"),
+ "Steyr AUG" : new GangMemberUpgrade("Steyr AUG",
+ "Increases strength and defense by 25%", 60e6, "w"),
+ "AK-47" : new GangMemberUpgrade("AK-47",
+ "Increases strength and defense by 50%", 100e6, "w"),
+ "M15A10 Assault Rifle" : new GangMemberUpgrade("M15A10 Assault Rifle",
+ "Increases strength and defense by 60%", 150e6, "w"),
+ "AWM Sniper Rifle" : new GangMemberUpgrade("AWM Sniper Rifle",
+ "Increases strength, dexterity, and agility by 50%", 225e6, "w"),
+ "Bulletproof Vest" : new GangMemberUpgrade("Bulletproof Vest",
+ "Increases defense by 5%", 2e6, "a"),
+ "Full Body Armor" : new GangMemberUpgrade("Full Body Armor",
+ "Increases defense by 10%", 5e6, "a"),
+ "Liquid Body Armor" : new GangMemberUpgrade("Liquid Body Armor",
+ "Increases defense and agility by 25%", 25e6, "a"),
+ "Graphene Plating Armor" : new GangMemberUpgrade("Graphene Plating Armor",
+ "Increases defense by 50%", 40e6, "a"),
+ "Ford Flex V20" : new GangMemberUpgrade("Ford Flex V20",
+ "Increases agility and charisma by 10%", 3e6, "v"),
+ "ATX1070 Superbike" : new GangMemberUpgrade("ATX1070 Superbike",
+ "Increases agility and charisma by 15%", 9e6, "v"),
+ "Mercedes-Benz S9001" : new GangMemberUpgrade("Mercedes-Benz S9001",
+ "Increases agility and charisma by 20%", 18e6, "v"),
+ "White Ferrari" : new GangMemberUpgrade("White Ferrari",
+ "Increases agility and charisma by 25%", 30e6, "v"),
+ "NUKE Rootkit" : new GangMemberUpgrade("NUKE Rootkit",
+ "Increases hacking by 10%", 5e6, "r"),
+ "Soulstealer Rootkit" : new GangMemberUpgrade("Soulstealer Rootkit",
+ "Increases hacking by 20%", 15e6, "r"),
+ "Demon Rootkit" : new GangMemberUpgrade("Demon Rootkit",
+ "Increases hacking by 30%", 50e6, "r"),
+}
+
+//Create a pop-up box that lets player purchase upgrades
+let gangMemberUpgradeBoxOpened = false;
+function createGangMemberUpgradeBox(initialFilter="") {
+ var boxId = "gang-member-upgrade-popup-box";
+ if (gangMemberUpgradeBoxOpened) {
+ //Already opened, refreshing
+ if (gangMemberUpgradeBoxElements == null || gangMemberUpgradeBox == null || gangMemberUpgradeBoxContent == null) {
+ console.log("ERROR: Refreshing Gang member upgrade box throws error because required elements are null");
+ return;
+ }
+
+ for (var i = 1; i < gangMemberUpgradeBoxElements.length; ++i) {
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["l" /* removeElement */])(gangMemberUpgradeBoxElements[i]);
+ }
+ gangMemberUpgradeBoxElements = [gangMemberUpgradeBoxFilter];
+
+ var filter = gangMemberUpgradeBoxFilter.value.toString();
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members.length; ++i) {
+ if (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members[i].name.indexOf(filter) > -1 || __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members[i].task.name.indexOf(filter) > -1) {
+ var newPanel = createGangMemberUpgradePanel(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members[i]);
+ gangMemberUpgradeBoxContent.appendChild(newPanel);
+ gangMemberUpgradeBoxElements.push(newPanel);
+ }
+ }
+ } else {
+ //New popup
+ gangMemberUpgradeBoxFilter = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"text", placeholder:"Filter gang members",
+ value:initialFilter,
+ onkeyup:()=>{
+ var filterValue = gangMemberUpgradeBoxFilter.value.toString();
+ createGangMemberUpgradeBox(filterValue);
+ }
+ });
+
+ gangMemberUpgradeBoxElements = [gangMemberUpgradeBoxFilter];
+
+ var filter = gangMemberUpgradeBoxFilter.value.toString();
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members.length; ++i) {
+ if (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members[i].name.indexOf(filter) > -1 || __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members[i].task.name.indexOf(filter) > -1) {
+ gangMemberUpgradeBoxElements.push(createGangMemberUpgradePanel(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members[i]));
+ }
+ }
+
+ gangMemberUpgradeBox = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* createPopup */])(boxId, gangMemberUpgradeBoxElements);
+ gangMemberUpgradeBoxContent = document.getElementById(boxId + "-content");
+ gangMemberUpgradeBoxOpened = true;
+ }
+}
+
+//Create upgrade panels for each individual Gang Member
+function createGangMemberUpgradePanel(memberObj) {
+ var container = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ border:"1px solid white",
+ });
+
+ var header = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("h1", {
+ innerText:memberObj.name + " (" + memberObj.task.name + ")"
+ });
+ container.appendChild(header);
+
+ var text = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("pre", {
+ fontSize:"14px", display: "inline-block", width:"20%",
+ innerText:
+ "Hack: " + memberObj.hack + " (x" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.hack_mult, 2) + ")\n" +
+ "Str: " + memberObj.str + " (x" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.str_mult, 2) + ")\n" +
+ "Def: " + memberObj.def + " (x" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.def_mult, 2) + ")\n" +
+ "Dex: " + memberObj.dex + " (x" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.dex_mult, 2) + ")\n" +
+ "Agi: " + memberObj.agi + " (x" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.agi_mult, 2) + ")\n" +
+ "Cha: " + memberObj.cha + " (x" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.cha_mult, 2) + ")\n",
+ });
+
+ //Already purchased upgrades
+ var ownedUpgradesElements = [];
+ for (var i = 0; i < memberObj.upgrades.length; ++i) {
+ var upg = GangMemberUpgrades[memberObj.upgrades[i]];
+ if (upg == null) {
+ console.log("ERR: Could not find this upgrade: " + memberObj.upgrades[i]);
+ continue;
+ }
+ var e = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ border:"1px solid white", innerText:memberObj.upgrades[i],
+ margin:"1px", padding:"1px", tooltip:upg.desc, fontSize:"12px",
+ });
+ ownedUpgradesElements.push(e);
+ }
+ var ownedUpgrades = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ display:"inline-block", marginLeft:"6px", width:"75%", innerText:"Purchased Upgrades:",
+ });
+ for (var i = 0; i < ownedUpgradesElements.length; ++i) {
+ ownedUpgrades.appendChild(ownedUpgradesElements[i]);
+ }
+ container.appendChild(text);
+ container.appendChild(ownedUpgrades);
+ container.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("br", {}));
+
+ //Upgrade buttons. Only show upgrades that can be afforded
+ var weaponUpgrades = [], armorUpgrades = [], vehicleUpgrades = [], rootkitUpgrades = [];
+ for (var upgName in GangMemberUpgrades) {
+ if (GangMemberUpgrades.hasOwnProperty(upgName)) {
+ var upg = GangMemberUpgrades[upgName];
+ if (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].money.lt(upg.cost) || memberObj.upgrades.includes(upgName)) {continue;}
+ switch (upg.type) {
+ case "w":
+ weaponUpgrades.push(upg);
+ break;
+ case "a":
+ armorUpgrades.push(upg);
+ break;
+ case "v":
+ vehicleUpgrades.push(upg);
+ break;
+ case "r":
+ rootkitUpgrades.push(upg);
+ break;
+ default:
+ console.log("ERROR: Invalid Gang Member Upgrade Type: " + upg.type);
+ }
+ }
+ }
+
+ var weaponDiv = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {width:"20%", display:"inline-block",});
+ var armorDiv = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {width:"20%", display:"inline-block",});
+ var vehicleDiv = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {width:"20%", display:"inline-block",});
+ var rootkitDiv = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {width:"20%", display:"inline-block",});
+ var upgrades = [weaponUpgrades, armorUpgrades, vehicleUpgrades, rootkitUpgrades];
+ var divs = [weaponDiv, armorDiv, vehicleDiv, rootkitDiv];
+
+ for (var i = 0; i < upgrades.length; ++i) {
+ var upgradeArray = upgrades[i];
+ var div = divs[i];
+ for (var j = 0; j < upgradeArray.length; ++j) {
+ var upg = upgradeArray[j];
+ (function (upg, div, memberObj) {
+ div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ innerText:upg.name + " - " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(upg.cost).format("$0.000a"),
+ class:"a-link-button", margin:"2px", padding:"2px", display:"block",
+ fontSize:"12px",
+ tooltip:upg.desc,
+ clickListener:()=>{
+ if (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].money.lt(upg.cost)) {return false;}
+ __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].loseMoney(upg.cost);
+ memberObj.upgrades.push(upg.name);
+ upg.apply(memberObj);
+ var initFilterValue = gangMemberUpgradeBoxFilter.value.toString();
+ createGangMemberUpgradeBox(initFilterValue);
+ return false;
+ }
+ }));
+ })(upg, div, memberObj);
+ }
+ }
+
+ container.appendChild(weaponDiv);
+ container.appendChild(armorDiv);
+ container.appendChild(vehicleDiv);
+ container.appendChild(rootkitDiv);
+ return container;
+}
+
+//Gang DOM elements
+let gangContentCreated = false,
+ gangContainer = null, managementButton = null, territoryButton = null;
+
+//Subpages
+let gangManagementSubpage = null, gangTerritorySubpage = null;
+
+//Gang Management Elements
+let gangDesc = null, gangInfo = null,
+ gangRecruitMemberButton = null, gangRecruitRequirementText = null,
+ gangExpandAllButton = null, gangCollapseAllButton, gangMemberFilter = null,
+ gangManageEquipmentButton = null,
+ gangMemberList = null;
+
+//Gang Equipment Upgrade Elements
+let gangMemberUpgradeBox = null, gangMemberUpgradeBoxContent = null,
+ gangMemberUpgradeBoxFilter = null, gangMemberUpgradeBoxElements = null;
+
+
+//Gang Territory Elements
+let gangTerritoryDescText = null, gangTerritoryInfoText = null;
+
+function displayGangContent() {
+ if (!gangContentCreated || gangContainer == null) {
+ gangContentCreated = true;
+
+ //Create gang container
+ gangContainer = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ id:"gang-container", class:"generic-menupage-container",
+ });
+
+ //Get variables
+ var facName = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.facName,
+ members = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members,
+ wanted = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.wanted,
+ respect = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.respect;
+
+ //Buttons to switch between panels
+ managementButton = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ id:"gang-management-subpage-button", class:"a-link-button-inactive",
+ display:"inline-block", innerHTML: "Gang Management (1)",
+ clickListener:()=>{
+ gangManagementSubpage.style.display = "block";
+ gangTerritorySubpage.style.display = "none";
+ managementButton.classList.toggle("a-link-button-inactive");
+ managementButton.classList.toggle("a-link-button");
+ territoryButton.classList.toggle("a-link-button-inactive");
+ territoryButton.classList.toggle("a-link-button");
+ updateGangContent();
+ return false;
+ }
+ })
+ territoryButton = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ id:"gang-territory-subpage-button", class:"a-link-button",
+ display:"inline-block", innerHTML:"Gang Territory (2)",
+ clickListener:()=>{
+ gangManagementSubpage.style.display = "none";
+ gangTerritorySubpage.style.display = "block";
+ managementButton.classList.toggle("a-link-button-inactive");
+ managementButton.classList.toggle("a-link-button");
+ territoryButton.classList.toggle("a-link-button-inactive");
+ territoryButton.classList.toggle("a-link-button");
+ updateGangContent();
+ return false;
+ }
+ });
+ gangContainer.appendChild(managementButton);
+ gangContainer.appendChild(territoryButton);
+
+ //Subpage for managing gang members
+ gangManagementSubpage = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ display:"block", id:"gang-management-subpage",
+ });
+
+ var lowerWantedTask = "";
+ if (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.isHackingGang) {
+ lowerWantedTask = "Ethical Hacking";
+ } else {
+ lowerWantedTask = "Vigilante Justice";
+ }
+ gangDesc = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {width:"70%",
+ innerHTML:
+ "This page is used to manage your gang members and get an overview of your " +
+ "gang's stats.
" +
+ "If a gang member is not earning much money or respect, the task that you " +
+ "have assigned to that member might be too difficult. Consider training that " +
+ "member's stats or choosing an easier task. The tasks closer to the " +
+ "top of the dropdown list are generally easier. Alternatively, the gang member's " +
+ "low production might be due to the fact that your wanted level is too high. " +
+ "Consider assigning a few members to the '" + lowerWantedTask + "' " +
+ "task to lower your wanted level.
" +
+ "Installing Augmentations does NOT reset your progress with your Gang. " +
+ "Furthermore, after installing Augmentations, you will " +
+ "automatically be a member of whatever Faction you created your gang with.
"
+ });
+ gangManagementSubpage.appendChild(gangDesc);
+
+ gangInfo = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {id:"gang-info", width:"70%"});
+ gangManagementSubpage.appendChild(gangInfo);
+
+ gangRecruitMemberButton = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ id:"gang-management-recruit-member-btn", class:"a-link-button-inactive",
+ innerHTML:"Recruit Gang Member", display:"inline-block", margin:"10px",
+ clickListener:()=>{
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["j" /* yesNoTxtInpBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["i" /* yesNoTxtInpBoxGetNoButton */])();
+ yesBtn.innerHTML = "Recruit Gang Member";
+ noBtn.innerHTML = "Cancel";
+ yesBtn.addEventListener("click", ()=>{
+ var name = Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["h" /* yesNoTxtInpBoxGetInput */])();
+ if (name === "") {
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You must enter a name for your Gang member!");
+ } else {
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members.length; ++i) {
+ if (name == __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members[i].name) {
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You already have a gang member with this name!");
+ return false;
+ }
+ }
+ var member = new GangMember(name);
+ __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members.push(member);
+ createGangMemberDisplayElement(member);
+ updateGangContent();
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
+ });
+ noBtn.addEventListener("click", ()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["g" /* yesNoTxtInpBoxCreate */])("Please enter a name for your new Gang member:");
+ return false;
+ }
+ });
+ gangManagementSubpage.appendChild(gangRecruitMemberButton);
+
+ //Text for how much reputation is required for recruiting next memberList
+ gangRecruitRequirementText = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {color:"red", id:"gang-recruit-requirement-text"});
+ gangManagementSubpage.appendChild(gangRecruitRequirementText);
+
+ //Gang Member List management buttons (Expand/Collapse All, select a single member)
+ gangManagementSubpage.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("br", {}));
+ gangExpandAllButton = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", display:"inline-block",
+ innerHTML:"Expand All",
+ clickListener:()=>{
+ var allHeaders = gangManagementSubpage.getElementsByClassName("accordion-header");
+ for (var i = 0; i < allHeaders.length; ++i) {
+ var hdr = allHeaders[i];
+ if (!hdr.classList.contains("active")) {
+ hdr.click();
+ }
+ }
+ return false;
+ }
+ });
+ gangCollapseAllButton = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", display:"inline-block",
+ innerHTML:"Collapse All",
+ clickListener:()=>{
+ var allHeaders = gangManagementSubpage.getElementsByClassName("accordion-header");
+ for (var i = 0; i < allHeaders.length; ++i) {
+ var hdr = allHeaders[i];
+ if (hdr.classList.contains("active")) {
+ hdr.click();
+ }
+ }
+ return false;
+ }
+ });
+ gangMemberFilter = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"text", placeholder:"Filter gang members", margin:"5px", padding:"5px",
+ onkeyup:()=>{
+ displayGangMemberList();
+ }
+ });
+ gangManageEquipmentButton = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", display:"inline-block",
+ innerHTML:"Manage Equipment",
+ clickListener:()=>{
+ createGangMemberUpgradeBox();
+ }
+ });
+ gangManagementSubpage.appendChild(gangExpandAllButton);
+ gangManagementSubpage.appendChild(gangCollapseAllButton);
+ gangManagementSubpage.appendChild(gangMemberFilter);
+ gangManagementSubpage.appendChild(gangManageEquipmentButton);
+
+ //Gang Member list
+ gangMemberList = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("ul", {id:"gang-member-list"});
+ displayGangMemberList();
+ gangManagementSubpage.appendChild(gangMemberList);
+
+ //Subpage for seeing gang territory information
+ gangTerritorySubpage = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ id:"gang-territory-subpage", display:"none"
+ });
+
+ //Info text for territory page
+ gangTerritoryDescText = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ width:"70%",
+ innerHTML:"This page shows how much territory your Gang controls. This statistic is listed as a percentage, " +
+ "which represents how much of the total territory you control.
" +
+ "Territory gain and loss is processed automatically and is updated every ~30 seconds. Your chances " +
+ "to gain and lose territory depend on your Gang's power, which is listed in the display below. " +
+ "Your gang's power is determined by the stats of all Gang members you have assigned to the " +
+ "'Territory Warfare' task. Gang members that are not assigned to this task do not contribute to " +
+ "your Gang's power.
" +
+ "The amount of territory you have affects all aspects of your Gang members' production, including " +
+ "money, respect, and wanted level. It is very beneficial to have high territory control.
"
+ });
+ gangTerritorySubpage.appendChild(gangTerritoryDescText);
+
+ var territoryBorder = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("fieldset", {width:"50%", display:"inline-block"});
+
+ gangTerritoryInfoText = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {id:"gang-territory-info"});
+
+ territoryBorder.appendChild(gangTerritoryInfoText);
+ gangTerritorySubpage.appendChild(territoryBorder);
+
+ gangContainer.appendChild(gangTerritorySubpage);
+ gangContainer.appendChild(gangManagementSubpage);
+ document.getElementById("entire-game-container").appendChild(gangContainer);
+ }
+ gangContainer.style.display = "block";
+ updateGangContent();
+}
+
+function displayGangMemberList() {
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["k" /* removeChildrenFromElement */])(gangMemberList);
+ var members = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.members;
+ var filter = gangMemberFilter.value.toString();
+ for (var i = 0; i < members.length; ++i) {
+ if (members[i].name.indexOf(filter) > -1 || members[i].task.name.indexOf(filter) > -1) {
+ createGangMemberDisplayElement(members[i]);
+ }
+ }
+ //setGangMemberClickHandlers(); //Set buttons to toggle the gang member info panels
+}
+
+function updateGangContent() {
+ if (!gangContentCreated || !__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].inGang()) {return;}
+
+ if(gangTerritorySubpage.style.display === "block") {
+ //Update territory information
+ gangTerritoryInfoText.innerHTML = "";
+ for (var gangname in AllGangs) {
+ if (AllGangs.hasOwnProperty(gangname)) {
+ var gangTerritoryInfo = AllGangs[gangname];
+ if (gangname == __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gang.facName) {
+ gangTerritoryInfoText.innerHTML += ("" + gangname + " (Power: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gangTerritoryInfo.power, 6) + "): " +
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(100*gangTerritoryInfo.territory, 2) + "%
Est. Market Price: " + __WEBPACK_IMPORTED_MODULE_10__utils_numeral_min_js___default()(product.pCost + product.rat / product.mku).format("$0.000a") +
+ "An estimate of how much consumers are willing to pay for this product. " +
+ "Setting the sale price above this may result in less sales. Setting the sale price below this may result " +
+ "in more sales.
"
}));
var buttonPanel = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("div", {
display:"inline-block",
@@ -44241,7 +44350,7 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) {
Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, confirmBtn, cancelBtn]);
}
}));
- industryWarehousePanel.appendChild(div);
+ return div;
}
Warehouse.prototype.toJSON = function() {
@@ -44264,7 +44373,7 @@ var CorporationUnlockUpgrades = {
"This allows you to move materials around between different divisions and cities."],
//Lets you buy exactly however many required materials you need for production
- "1": [1, 999999e9, "Smart Supply", "NOT YET IMPLEMENTED!!!!!! - Use advanced AI to anticipate your supply needs. " +
+ "1": [1, 50e9, "Smart Supply", "Use advanced AI to anticipate your supply needs. " +
"This allows you to purchase exactly however many materials you need for production."],
//Displays each material/product's demand
@@ -44307,10 +44416,10 @@ var CorporationUpgrades = {
"20 seconds."],
//Makes advertising more effective
- "3": [3, 4e9, 1.12, 0.01,
+ "3": [3, 4e9, 1.12, 0.005,
"Wilson Analytics", "Purchase data and analysis from Wilson, a marketing research " +
"firm. Each level of this upgrades increases the effectiveness of your " +
- "advertising by 1% (additive)."],
+ "advertising by 0.5% (additive)."],
//Augmentation for employees, increases cre
"4": [4, 1e9, 1.06, 0.1,
@@ -44378,12 +44487,15 @@ Corporation.prototype.getState = function() {
return this.state.getState();
}
-var numMarketCyclesPersist = 1;
-Corporation.prototype.process = function(numCycles=1) {
- var corp = this;
+Corporation.prototype.storeCycles = function(numCycles=1) {
this.storedCycles += numCycles;
+}
+
+Corporation.prototype.process = function() {
+ var corp = this;
if (this.storedCycles >= CyclesPerIndustryStateCycle) {
- var state = this.getState();
+ var state = this.getState(), marketCycles=1;
+ this.storedCycles -= (marketCycles * CyclesPerIndustryStateCycle);
//At the start of a new cycle, calculate profits from previous cycle
if (state === "START") {
@@ -44394,7 +44506,7 @@ Corporation.prototype.process = function(numCycles=1) {
this.expenses = this.expenses.plus(ind.lastCycleExpenses);
});
var profit = this.revenue.minus(this.expenses);
- var cycleProfit = profit.times(numMarketCyclesPersist * SecsPerMarketCycle);
+ var cycleProfit = profit.times(marketCycles * SecsPerMarketCycle);
if (isNaN(this.funds)) {
Object(__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["a" /* dialogBoxCreate */])("There was an error calculating your Corporations funds and they got reset to 0. " +
"This is a bug. Please report to game developer.
" +
@@ -44405,19 +44517,6 @@ Corporation.prototype.process = function(numCycles=1) {
this.updateSharePrice();
}
- //Determine number of market cycles at the START state
- if (state === "START") {
- if (this.storedCycles >= 2*CyclesPerMarketCycle) {
- //Enough cycles stored for 2+ market cycles
- //Capped out at 3 to prevent weird behavior
- numMarketCyclesPersist = Math.max(3, Math.floor(this.storedCycles / CyclesPerMarketCycle));
- } else {
- numMarketCyclesPersist = 1;
- }
- }
- var marketCycles = numMarketCyclesPersist;
-
- this.storedCycles -= (marketCycles * CyclesPerIndustryStateCycle);
this.divisions.forEach(function(ind) {
ind.process(marketCycles, state, corp);
});
@@ -44501,12 +44600,17 @@ Corporation.prototype.goPublic = function() {
"your company's stock price in the future.
" +
"You have a total of " + __WEBPACK_IMPORTED_MODULE_10__utils_numeral_min_js___default()(this.numShares).format("0.000a") + " of shares that you can issue.",
});
+ var yesBtn;
var input = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("input", {
type:"number",
placeholder: "Shares to issue",
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {yesBtn.click();}
+ }
});
var br = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("br", {});
- var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button",
innerText:"Go Public",
clickListener:()=>{
@@ -44652,11 +44756,20 @@ Corporation.prototype.getScientificResearchMultiplier = function() {
var companyManagementDiv, companyManagementHeaderTabs, companyManagementPanel,
currentCityUi,
corporationUnlockUpgrades, corporationUpgrades,
+
+ //Industry Overview Panel
industryOverviewPanel, industryOverviewText,
+
+ //Industry Employee Panel
industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeAutohireButton,
industryEmployeeManagementUI, industryEmployeeInfo, industryIndividualEmployeeInfo,
industryOfficeUpgradeSizeButton,
- industryWarehousePanel,
+
+ //Industry Warehouse Panel
+ industryWarehousePanel, industrySmartSupplyCheckbox, industryWarehouseStorageText,
+ industryWarehouseStorageBreakdownText,
+ industryWarehouseUpgradeSizeButton, industryWarehouseStateText,
+ industryWarehouseMaterials, industryWarehouseProducts,
headerTabs, cityTabs;
Corporation.prototype.createUI = function() {
companyManagementDiv = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("div", {
@@ -44716,28 +44829,33 @@ Corporation.prototype.updateUIHeaderTabs = function() {
var container = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("div", {
class:"popup-box-container",
id:"cmpy-mgmt-expand-industry-popup",
- }),
- content = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("div", {class:"popup-box-content"}),
- txt = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ });
+ var content = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("div", {class:"popup-box-content"});
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("p", {
innerHTML: "Create a new division to expand into a new industry:",
- }),
- selector = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("select", {
+ });
+ var selector = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("select", {
class:"cmpy-mgmt-industry-select"
- }),
- industryDescription = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("p", {}),
- nameInput = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ });
+ var industryDescription = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("p", {});
+ var yesBtn;
+ var nameInput = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("input", {
type:"text",
id:"cmpy-mgmt-expand-industry-name-input",
color:"white",
backgroundColor:"black",
display:"block",
maxLength: 30,
- pattern:"[a-zA-Z0-9-_]"
- }),
- nameLabel = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("label", {
+ pattern:"[a-zA-Z0-9-_]",
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {yesBtn.click();}
+ }
+ });
+ var nameLabel = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("label", {
for:"cmpy-mgmt-expand-industry-name-input",
innerText:"Division name: "
- }),
+ });
yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("span", {
class:"popup-box-button",
innerText:"Create Division",
@@ -44769,8 +44887,8 @@ Corporation.prototype.updateUIHeaderTabs = function() {
}
return false;
}
- }),
- noBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("span", {
+ });
+ var noBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("span", {
class:"popup-box-button",
innerText:"Cancel",
clickListener: function() {
@@ -45607,7 +45725,8 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
division.products[product.name] = product;
Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
}
- this.updateUIContent();
+ //this.updateUIContent();
+ this.displayDivisionContent(division, city);
return false;
}
})
@@ -45682,16 +45801,42 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
tooltip:"Upgrade the office's size so that it can hold more employees!",
clickListener:()=>{
var popupId = "cmpy-mgmt-upgrade-office-size-popup";
- var upgradeCost = OfficeInitialCost * Math.pow(1.07, Math.round(office.size / OfficeInitialSize));
+ var initialPriceMult = Math.round(office.size / OfficeInitialSize);
+ var upgradeCost = OfficeInitialCost * Math.pow(1.07, initialPriceMult);
+
+ //Calculate cost to upgrade size by 15 employees
+ var mult = 0;
+ for (var i = 0; i < 5; ++i) {
+ mult += (Math.pow(1.07, initialPriceMult + i));
+ }
+ var upgradeCost15 = OfficeInitialCost * mult;
+
+ //Calculate max upgrade size and cost
+ var maxMult = (this.funds.dividedBy(OfficeInitialCost)).toNumber();
+ var maxNum = 1;
+ mult = Math.pow(1.07, initialPriceMult);
+ while(maxNum < 50) { //Hard cap of 50x (extra 150 employees)
+ if (mult >= maxMult) {break;}
+ var multIncrease = Math.pow(1.07, initialPriceMult + maxNum);
+ if (mult + multIncrease > maxMult) {
+ break;
+ } else {
+ mult += multIncrease;
+ }
+ ++maxNum;
+ }
+
+ var upgradeCostMax = OfficeInitialCost * mult;
+
var text = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("p", {
- innerHTML:"Increase the size of your office space to fit " + OfficeInitialSize +
- " more employees. This will cost " + __WEBPACK_IMPORTED_MODULE_10__utils_numeral_min_js___default()(upgradeCost).format('$0.000a'),
+ innerText:"Increase the size of your office space to fit additional employees!"
});
+ var text2 = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("p", {innerText: "Upgrade size: "});
+
var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("a", {
- class:"a-link-button",
- display:"inline-block",
- margin:"8px",
- innerText:"Upgrade Office Size",
+ class: this.funds.lt(upgradeCost) ? "a-link-button-inactive" : "a-link-button",
+ display:"inline-block", margin:"4px", innerText:"by 3",
+ tooltip:__WEBPACK_IMPORTED_MODULE_10__utils_numeral_min_js___default()(upgradeCost).format("$0.000a"),
clickListener:()=>{
if (this.funds.lt(upgradeCost)) {
Object(__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough company funds to purchase this upgrade!");
@@ -45705,17 +45850,48 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
return false;
}
});
+ var confirmBtn15 = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class: this.funds.lt(upgradeCost15) ? "a-link-button-inactive" : "a-link-button",
+ display:"inline-block", margin:"4px", innerText:"by 15",
+ tooltip:__WEBPACK_IMPORTED_MODULE_10__utils_numeral_min_js___default()(upgradeCost15).format("$0.000a"),
+ clickListener:()=>{
+ if (this.funds.lt(upgradeCost15)) {
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough company funds to purchase this upgrade!");
+ } else {
+ office.size += (OfficeInitialSize * 5);
+ this.funds = this.funds.minus(upgradeCost15);
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Office space increased! It can now hold " + office.size + " employees");
+ this.updateUIContent();
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ var confirmBtnMax = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:this.funds.lt(upgradeCostMax) ? "a-link-button-inactive" : "a-link-button",
+ display:"inline-block", margin:"4px", innerText:"by MAX (" + maxNum*OfficeInitialSize + ")",
+ tooltip:__WEBPACK_IMPORTED_MODULE_10__utils_numeral_min_js___default()(upgradeCostMax).format("$0.000a"),
+ clickListener:()=>{
+ if (this.funds.lt(upgradeCostMax)) {
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough company funds to purchase this upgrade!");
+ } else {
+ office.size += (OfficeInitialSize * maxNum);
+ this.funds = this.funds.minus(upgradeCostMax);
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Office space increased! It can now hold " + office.size + " employees");
+ this.updateUIContent();
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("a", {
- class:"a-link-button",
- innerText:"Cancel",
- display:"inline-block",
- margin:"8px",
+ class:"a-link-button", innerText:"Cancel", display:"inline-block", margin:"4px",
clickListener:()=>{
Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
})
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [text, confirmBtn, cancelBtn]);
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [text, text2, confirmBtn, confirmBtn15, confirmBtnMax, cancelBtn]);
return false;
}
});
@@ -45735,6 +45911,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
var totalCostTxt = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("p", {
innerText:"Throwing this party will cost a total of $0"
});
+ var confirmBtn;
var input = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("input", {
type:"number", margin:"5px", placeholder:"$ / employee",
inputListener:()=>{
@@ -45744,9 +45921,13 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
var totalCost = input.value * office.employees.length;
totalCostTxt.innerText = "Throwing this party will cost a total of " + __WEBPACK_IMPORTED_MODULE_10__utils_numeral_min_js___default()(totalCost).format('$0.000a');
}
+ },
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {confirmBtn.click();}
}
});
- var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button",
display:"inline-block",
innerText:"Throw Party",
@@ -45936,7 +46117,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
size:WarehouseInitialSize,
});
this.funds = this.funds.minus(WarehouseInitialCost);
- this.updateDivisionContent(division);
+ this.displayDivisionContent(division, currentCityUi);
}
return false;
}
@@ -45964,23 +46145,51 @@ Corporation.prototype.updateDivisionContent = function(division) {
advertisingInfo =
"
Production Multiplier: " + Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.prodMult, 2) +
- "Production gain from owning production-boosting materials " +
- "such as hardware, Robots, AI Cores, and Real Estate
"
+ }));
+ industryOverviewText.appendChild(Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ marginTop:"2px",
+ innerText:"Production Multiplier: " + Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.prodMult, 2),
+ tooltip:"Production gain from owning production-boosting materials " +
+ "such as hardware, Robots, AI Cores, and Real Estate"
+ }));
+ industryOverviewText.appendChild(Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ innerText:"?", class:"help-tip",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Owning Hardware, Robots, AI Cores, and Real Estate " +
+ "can boost your Industry's production. The effect these " +
+ "materials have on your production varies between Industries. " +
+ "For example, Real Estate may be very effective for some Industries, " +
+ "but ineffective for others.
" +
+ "This division's production multiplier is calculated by summing " +
+ "the individual production multiplier of each of its office locations. " +
+ "This production multiplier is applied to each office. Therefore, it is " +
+ "beneficial to expand into new cities as this can greatly increase the " +
+ "production multiplier of your entire Division."
+ )
+ }
+ }));
+ industryOverviewText.appendChild(Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("br"));
+ industryOverviewText.appendChild(Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ display:"inline-block",
+ innerText:"Scientific Research: " + Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.sciResearch.qty, 3),
+ tooltip:"Scientific Research increases the quality of the materials and " +
+ "products that you produce."
+ }));
//Office and Employee List
var office = division.offices[currentCityUi];
@@ -46044,7 +46253,7 @@ Corporation.prototype.updateDivisionContent = function(division) {
//Warehouse
var warehouse = division.warehouses[currentCityUi];
if (warehouse instanceof Warehouse) {
- warehouse.createUI({industry:division, company:this});
+ warehouse.updateUI({industry:division, company:this});
}
}
@@ -46098,7 +46307,13 @@ Corporation.prototype.clearUI = function() {
industryOfficeUpgradeSizeButton = null;
- industryWarehousePanel = null;
+ industryWarehousePanel = null;
+ industrySmartSupplyCheckbox = null;
+ industryWarehouseStorageText = null;
+ industryWarehouseUpgradeSizeButton = null;
+ industryWarehouseStateText = null;
+ industryWarehouseMaterials = null;
+ industryWarehouseProducts = null;
companyManagementHeaderTabs = null;
headerTabs = null;
@@ -46121,408 +46336,7 @@ __WEBPACK_IMPORTED_MODULE_9__utils_JSONReviver_js__["c" /* Reviver */].construct
/***/ }),
-/* 34 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* unused harmony export Literatures */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initLiterature; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return showLiterature; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__ = __webpack_require__(1);
-
-
-/* Literature.js
- * Lore / world building literature that can be found on servers
- */
-function Literature(title, filename, txt) {
- this.title = title;
- this.fn = filename;
- this.txt = txt;
-}
-
-function showLiterature(fn) {
- var litObj = Literatures[fn];
- if (litObj == null) {return;}
- var txt = "" + litObj.title + "
" +
- litObj.txt;
- Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);
-}
-
-let Literatures = {}
-
-function initLiterature() {
- var title, fn, txt;
- title = "The Beginner's Guide to Hacking";
- fn = "hackers-starting-handbook.lit";
- txt = "When starting out, hacking is the most profitable way to earn money and progress. This " +
- "is a brief collection of tips/pointers on how to make the most out of your hacking scripts.
" +
- "-hack() and grow() both work by percentages. hack() steals a certain percentage of the " +
- "money on a server, and grow() increases the amount of money on a server by some percentage (multiplicatively)
" +
- "-Because hack() and grow() work by percentages, they are more effective if the target server has a high amount of money. " +
- "Therefore, you should try to increase the amount of money on a server (using grow()) to a certain amount before hacking it. Two " +
- "import Netscript functions for this are getServerMoneyAvailable() and getServerMaxMoney()
" +
- "-Keep security level low. Security level affects everything when hacking. Two important Netscript functions " +
- "for this are getServerSecurityLevel() and getServerMinSecurityLevel()
" +
- "-Purchase additional servers by visiting 'Alpha Enterprises' in the city. They are relatively cheap " +
- "and give you valuable RAM to run more scripts early in the game
" +
- "-Prioritize upgrading the RAM on your home computer. This can also be done at 'Alpha Enterprises'
" +
- "-Many low level servers have free RAM. You can use this RAM to run your scripts. Use the scp Terminal or " +
- "Netscript command to copy your scripts onto these servers and then run them.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "The Complete Handbook for Creating a Successful Corporation";
- fn = "corporation-management-handbook.lit";
- txt = "Getting Started with Corporations " +
- "To get started, visit the City Hall in Sector-12 in order to create a Corporation. This requires " +
- "$150b of your own money, but this $150b will get put into your Corporation's funds. " +
- "After creating your Corporation, you will see it listed as one of the locations in the city. Click on " +
- "your Corporation in order to manage it.
" +
- "Your Corporation can have many different divisions, each in a different Industry. There are many different " +
- "types of Industries, each with different properties. To create your first division, click the " +
- "'Expand into new Industry' button at the top of the management UI. The Agriculture " +
- "and Software industries are recommended for your first division.
" +
- "The first thing you'll need to do is hire some employees. Employees can be assigned to five different positions. " +
- "Each position has a different effect on various aspects of your Corporation. It is recommended to have at least " +
- "one employee at each position.
" +
- "Each industry uses some combination of Materials in order to produce other Materials and/or create Products. " +
- "Specific information about this is displayed in each of your divisions' UI.
" +
- "Products are special, industry-specific objects. They are different than Materials because you " +
- "must manually choose to develop them, and you can choose to develop any number of Products. Developing " +
- "a Product takes time, but a Product typically generates significantly more revenue than any Material. " +
- "Not all industries allow you to create Products. To create a Product, look for a button " +
- "in the top-left panel of the division UI (e.g. For the Software Industry, the button says 'Develop Software').
" +
- "To get your supply chain system started, " +
- "purchase the Materials that your industry needs to produce other Materials/Products. This can be done " +
- "by clicking the 'Buy' button next to the corresponding Material(s). After you have the required Materials, " +
- "you will immediately start production. The amount of Materials/Products you produce is based on a variety of factors, " +
- "one of which is your employees and their productivity.
" +
- "Once you start producing Materials/Products, you can sell them in order to start earning revenue. This can be done " +
- "by clicking the 'Sell' button next to the corresponding Material or Product. The amount of Material/Product you sell is dependent " +
- "on a wide variety of different factors.
" +
- "These are the basics of getting your Corporation up and running! Now, you can start purchasing upgrades to improve " +
- "your bottom line. If you need money, consider looking for seed investors, who will give you money in exchange for stock shares. " +
- "Otherwise, once you feel you are ready, take your Corporation public! Once your Corporation goes public, you can no longer " +
- "find investors. Instead, your Corporation will be publicly traded and its stock price will change based on how well " +
- "it's performing financially. You can then sell your stock shares in order to make money.
" +
- "Tips/Pointers " +
- "-Purchasing Hardware, Robots, AI Cores, and Real Estate can potentially increase your production. " +
- "The effects of these depend on what industry you are in.
" +
- "-In order to optimize your production, you will need a good balance of Operators, Managers, and Engineers
" +
- "-Different employees excel in different jobs. For example, the highly intelligent employees will probably do best " +
- "if they are assigned to do Engineering work or Research & Development.
" +
- "-If your employees have low morale, energy, or happiness, their production will greatly suffer.
" +
- "-Tech is important, but don't neglect sales! Having several Businessmen can boost your sales and your bottom line.
" +
- "-Don't forget to advertise your company. You won't have any business if nobody knows you.
" +
- "-Having company awareness is great, but what's really important is your company's popularity. Try to keep " +
- "your popularity as high as possible to see the biggest benefit for your sales
" +
- "-Remember, you need to spend money to make money!
" +
- "-Corporations do not reset when installing Augmentations, but they do reset when destroying a BitNode";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "A Green Tomorrow";
- fn = "A-Green-Tomorrow.lit";
- txt = "Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to " +
- "combat global warming and climate change. The shift towards renewable energy was a big success, or so it seemed. In 2045 " +
- "a staggering 80% of the world's energy came from non-renewable fossil fuels. Now, about three decades later, that " +
- "number is down to only 15%. Most of the world's energy now comes from nuclear power and renwable sources such as " +
- "solar and geothermal. Unfortunately, these efforts were not the huge success that they seem to be.
" +
- "Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and " +
- "the rise of increasingly advanced (and power-hungry) technology that has become ubiquitous in our lives. So, " +
- "despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, " +
- "the total amount of energy we are producing from fossil fuels has actually increased.
" +
- "The grim effects of our species' irresponsible use of energy and neglect of our mother world have become increasingly apparent. " +
- "Last year a temperature of 190F was recorded in the Death Valley desert, which is over 50% higher than the highest " +
- "recorded temperature at the beginning of the century. In the last two decades numerous major cities such as Manhattan, Boston, and " +
- "Los Angeles have been partially or fully submerged by rising sea levels. In the present day, over 75% of the world's agriculture is " +
- "done in climate-controlled vertical farms, as most traditional farmland has become unusable due to severe climate conditions.
" +
- "Despite all of this, the greedy and corrupt corporations that rule the world have done nothing to address these problems that " +
- "threaten our species. And so it's up to us, the common people. Each and every one of us can make a difference by doing what " +
- "these corporations won't: taking responsibility. If we don't, pretty soon there won't be an Earth left to save. We are " +
- "the last hope for a green tomorrow.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Alpha and Omega";
- fn = "alpha-omega.lit";
- txt = "Then we saw a new heaven and a new earth, for our first heaven and earth had gone away, and our sea was no more. " +
- "And we saw a new holy city, new Aeria, coming down out of this new heaven, prepared as a bride adorned for her husband. " +
- "And we heard a loud voice saying, 'Behold, the new dwelling place of the Gods. We will dwell with them, and they " +
- "will be our people, and we will be with them as their Gods. We will wipe away every tear from their eyes, and death " +
- "shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things " +
- "have passed away.'
" +
- "And once were were seated on the throne we said 'Behold, I am making all things new.' " +
- "Also we said, 'Write this down, for these words are trustworthy and true.' And we said to you, " +
- "'It is done! I am the Alpha and the Omega, the beginning and the end. To the thirsty I will give from the spring " +
- "of the water of life without payment. The one who conquers will have this heritage, and we will be his God and " +
- "he will be our son. But as for the cowardly, the faithless, the detestable, as for murderers, " +
- "the sexually immoral, sorcerers, idolaters, and all liars, their portion will be in the lake that " +
- "burns with fire and sulfur, for it is the second true death.'";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Are We Living in a Computer Simulation?";
- fn = "simulated-reality.lit";
- txt = "The idea that we are living in a virtual world is not new. It's a trope that has " +
- "been explored constantly in literature and pop culture. However, it is also a legitimate " +
- "scientific hypothesis that many notable physicists and philosophers have debated for years.
" +
- "Proponents for this simulated reality theory often point to how advanced our technology has become, " +
- "as well as the incredibly fast pace at which it has advanced over the past decades. The amount of computing " +
- "power available to us has increased over 100-fold since 2060 due to the development of nanoprocessors and " +
- "quantum computers. Artifical Intelligence has advanced to the point where our entire lives are controlled " +
- "by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. " +
- "If we consider the pace at which this technology has advanced and assume that these developments continue, it's " +
- "reasonable to assume that at some point in the future our technology would be advanced enough that " +
- "we could create simulations that are indistinguishable from reality. However, if this is a reasonable outcome " +
- "of continued technological advancement, then it is very likely that such a scenario has already happened.
" +
- "Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species " +
- "that already has such technology. Who's to say that they haven't already created such a virtual reality: our own?";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Beyond Man";
- fn = "beyond-man.lit";
- txt = "Humanity entered a 'transhuman' era a long time ago. And despite the protests and criticisms of many who cried out against " +
- "human augmentation at the time, the transhuman movement continued and prospered. Proponents of the movement ignored the critics, " +
- "arguing that it was in our inherent nature to better ourselves. To improve. To be more than we were. They claimed that " +
- "not doing so would be to go against every living organism's biological purpose: evolution and survival of the fittest.
" +
- "And here we are today, with technology that is advanced enough to augment humans to a state that " +
- "can only be described as posthuman. But what do we have to show for it when this augmentation " +
- "technology is only available to the so-called 'elite'? Are we really better off than before when only 5% of the " +
- "world's population has access to this technology? When the powerful corporations and organizations of the world " +
- "keep it all to themselves, have we really evolved?
" +
- "Augmentation technology has only further increased the divide between the rich and the poor, between the powerful and " +
- "the oppressed. We have not become 'more than human'. We have not evolved from nature's original design. We are still the greedy, " +
- "corrupted, and evil men that we always were.";
- Literatures[fn] = new Literature(title, fn, txt);
-
-
- title = "Brighter than the Sun";
- fn = "brighter-than-the-sun.lit";
- txt = "When people think about the corporations that dominate the East, they typically think of KuaiGong International, which " +
- "holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest " +
- "drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company " +
- "that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.
" +
- "TaiYang Digital is a Chinese internet-technology corporation that provides services such as " +
- "online advertising, search, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word " +
- "for 'sun'. In Chinese culture, the sun is a 'yang' symbol " +
- "associated with life, heat, masculinity, and heaven.
" +
- "The company was founded " +
- "less than 5 years ago and is already the third highest valued company in all of Asia. In 2076 it generated a total revenue of " +
- "over 10 trillion yuan. It's services are used daily by over a billion people worldwide.
" +
- "TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is " +
- "something you'd commonly see in the first half of the century, especially for tech companies. However in " +
- "the last two decades the number of corporations has significantly declined as the largest entities " +
- "quickly took over the economy. Corporations such as ECorp, MegaCorp, and KuaiGong have established " +
- "such strong monopolies in their market sectors that they have effectively killed off all " +
- "of the smaller and new corporations that have tried to start up over the years. This is what makes " +
- "the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have " +
- "a bright future ahead of them.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Democracy is Dead: The Fall of an Empire";
- fn = "democracy-is-dead.lit";
- txt = "They rose from the shadows in the street From the places where the oppressed meet " +
- "Their cries echoed loudly through the air As they once did in Tiananmen Square " +
- "Loudness in the silence, Darkness in the light They came forth with power and might " +
- "Once the beacon of democracy, America was first Its pillars of society destroyed and dispersed " +
- "Soon the cries rose everywhere, with revolt and riot Until one day, finally, all was quiet " +
- "From the ashes rose a new order, corporatocracy was its name " +
- "Rome, Mongol, Byzantine, all of history is just the same " +
- "For man will never change in a fundamental way " +
- "And now democracy is dead, in the USA";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Figures Show Rising Crime Rates in Sector-12";
- fn = "sector-12-crime.lit";
- txt = "A recent study by analytics company Wilson Inc. shows a significant rise " +
- "in criminal activity in Sector-12. Perhaps the most alarming part of the statistic " +
- "is that most of the rise is in violent crime such as homicide and assault. According " +
- "to the study, the city saw a total of 21,406 reported homicides in 2076, which is over " +
- "a 20% increase compared to 2075.
" +
- "CIA director David Glarow says its too early to know " +
- "whether these figures indicate the beginning of a sustained increase in crime rates, or whether " +
- "the year was just an unfortunate outlier. He states that many intelligence and law enforcement " +
- "agents have noticed an increase in organized crime activites, and believes that these figures may " +
- "be the result of an uprising from criminal organizations such as The Syndicate or the Slum Snakes.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Man and the Machine";
- fn = "man-and-machine.lit";
- txt = "In 2005 Ray Kurzweil popularized his theory of the Singularity. He predicted that the rate " +
- "of technological advancement would continue to accelerate faster and faster until one day " +
- "machines would be become infinitely more intelligent than humans. This point, called the " +
- "Singularity, would result in a drastic transformation of the world as we know it. He predicted " +
- "that the Singularity would arrive by 2045. " +
- "And yet here we are, more than three decades later, where most would agree that we have not " +
- "yet reached a point where computers and machines are vastly more intelligent than we are. So what gives?
" +
- "The answer is that we have reached the Singularity, just not in the way we expected. The artifical superintelligence " +
- "that was predicted by Kurzweil and others exists in the world today - in the form of Augmentations. " +
- "Yes, those Augmentations that the rich and powerful keep to themselves enable humans " +
- "to become superintelligent beings. The Singularity did not lead to a world where " +
- "our machines are infinitely more intelligent than us, it led to a world " +
- "where man and machine can merge to become something greater. Most of the world just doesn't " +
- "know it yet."
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Secret Societies";
- fn = "secret-societies.lit";
- txt = "The idea of secret societies has long intrigued the general public by inspiring curiosity, fascination, and " +
- "distrust. People have long wondered about who these secret society members are and what they do, with the " +
- "most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world " +
- "may never know for sure, it is likely that many secret societies do actually exist, even today.
" +
- "However, the secret societies of the modern world are nothing like those that (supposedly) existed " +
- "decades and centuries ago. The Freemasons, Knights Templar, and Illuminati, while they may have been around " +
- "at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in " +
- "our everyday lives and the fact that so much of the world is now digital has given rise to a new breed " +
- "of secret societies: Internet-based ones.
" +
- "Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's " +
- "world. Some of these, such as The Black Hand, are black hat groups that claim they are trying to " +
- "help the oppressed by attacking the elite and powerful. Others, such as NiteSec, are hacktivist groups " +
- "that try to push political and social agendas. Perhaps the most intriguing hacker group " +
- "is the mysterious Bitrunners, whose purpose still remains unknown.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Space: The Failed Frontier";
- fn = "the-failed-frontier.lit";
- txt = "Humans have long dreamed about spaceflight. With enduring interest, we were driven to explore " +
- "the unknown and discover new worlds. We dreamed about conquering the stars. And in our quest, " +
- "we pushed the boundaries of our scientific limits, and then pushed further. Space exploration " +
- "lead to the development of many important technologies and new industries.
" +
- "But sometime in the middle of the 21st century, all of that changed. Humanity lost its ambitions and " +
- "aspirations of exploring the cosmos. The once-large funding for agencies like NASA and the European " +
- "Space Agency gradually whittled away until their eventual disbanding in the 2060's. Not even " +
- "militaries are fielding flights into space nowadays. The only remnants of the once great mission for cosmic " +
- "conquest are the countless satellites in near-earth orbit, used for communications, espionage, " +
- "and other corporate interests.
" +
- "And as we continue to look at the state of space technology, it becomes more and " +
- "more apparent that we will never return to that golden age of space exploration, that " +
- "age where everyone dreamed of going beyond earth for the sake of discovery.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Coded Intelligence: Myth or Reality?";
- fn = "coded-intelligence.lit";
- txt = "Tremendous progress has been made in the field of Artificial Intelligence over the past few decades. " +
- "Our autonomous vehicles and transporation systems. The electronic personal assistants that control our everyday lives. " +
- "Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has " +
- "improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create " +
- "human intelligence.
" +
- "We've certainly come close to artificial intelligence that is similar to humans. For example OmniTek Incorporated's " +
- "CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like " +
- "in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as " +
- "that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.
" +
- "Many neuroscientists believe that we won't ever reach the point of creating artificial human intelligence. 'At the end of the " +
- "the day, AI comes down to 1's and 0's, while the human brain does not. We'll never see AI that is identical to that of " +
- "humans.'";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Synthetic Muscles";
- fn = "synthetic-muscles.lit";
- txt = "Initial versions of synthetic muscles weren't made of anything organic but were actually " +
- "crude devices made to mimic human muscle function. Some of the early iterations were actually made of " +
- "common materials such as fishing lines and sewing threads due to their high strength for " +
- "a cheap cost.
" +
- "As technology progressed, however, advances in biomedical engineering paved the way for a new method of " +
- "creating synthetic muscles. Instead of creating something that closely imitated the functionality " +
- "of human muscle, scientists discovered a way of forcing the human body itself to augment its own " +
- "muscle tissue using both synthetic and organic materials. This is typically done using gene therapy " +
- "or chemical injections.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Tensions rise in global tech race";
- fn = "tensions-in-tech-race.lit";
- txt = "Have we entered a new Cold War? Is WWIII just beyond the horizon?
" +
- "After rumors came out that OmniTek Incorporated had begun developing advanced robotic supersoldiers, " +
- "geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. " +
- "In a rare show of cooperation between corporations, MegaCorp and ECorp have " +
- "reportedly launched hundreds of new surveillance and espionage satellites. " +
- "Defense contractors such as " +
- "DeltaOne and AeroCorp have been working with the CIA and NSA to prepare " +
- "for conflict. Meanwhile, the rest of the world sits in earnest " +
- "hoping that it never reaches full-scale war. With today's technology " +
- "and firepower, a World War would assuredly mean the end of human civilization.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "The Cost of Immortality";
- fn = "cost-of-immortality.lit";
- txt = "Evolution and advances in medical and augmentation technology has lead to drastic improvements " +
- "in human mortality rates. Recent figures show that the life expectancy for humans " +
- "that live in a first-world country is about 130 years of age, almost double of what it was " +
- "at the turn of the century. However, this increase in average lifespan has had some " +
- "significant effects on society and culture.
" +
- "Due to longer lifespans and a better quality of life, many adults are holding " +
- "off on having kids until much later. As a result, the percentage of youth in " +
- "first-world countries has been decreasing, while the number " +
- "of senior citizens is significantly increasing.
" +
- "Perhaps the most alarming result of all of this is the rapidly shrinking workforce. " +
- "Despite the increase in life expectancy, the typical retirement age for " +
- "workers in America has remained about the same, meaning a larger and larger " +
- "percentage of people in America are retirees. Furthermore, many " +
- "young adults are holding off on joining the workforce because they feel that " +
- "they have plenty of time left in their lives for employment, and want to " +
- "'enjoy life while they're young.' For most industries, this shrinking workforce " +
- "is not a major issue as most things are handled by robots anyways. However, " +
- "there are still several key industries such as engineering and education " +
- "that have not been automated, and these remain in danger to this cultural " +
- "phenomenon.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "The Hidden World";
- fn = "the-hidden-world.lit";
- txt = "WAKE UP SHEEPLE
" +
- "THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY
" +
- "THE ILLUMINATI ARE THE SECRET RULERS OF THE WORLD!
" +
- "Yes, the Illuminati of legends. The ancient secret society that controls the entire " +
- "world from the shadows with their invisible hand. The group of the rich and wealthy " +
- "that have penetrated every major government, financial agency, and corporation in the last " +
- "three hundred years.
" +
- "OPEN YOUR EYES
" +
- "It was the Illuminati that brought an end to democracy in the world. They are the driving force " +
- "behind everything that happens.
" +
- "THEY ARE ALL AROUND YOU
" +
- "After destabilizing the world's governments, they are now entering the final stage of their master plan. " +
- "They will secretly initiate global crises. Terrorism. Pandemics. World War. And out of the chaos " +
- "that ensues they will build their New World Order.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "The New God";
- fn = "the-new-god.lit";
- txt = "Everyone has that moment in their life where they wonder about the bigger questions
" +
- "What's the point of all of this? What is my purpose?
" +
- "Some people dare to think even bigger
" +
- "What will be the fate of the human race?
" +
- "We live in an era vastly different from that of even 15 or 20 years ago. We have gone " +
- "where no man has gone before. We have stripped ourselves of the tyranny of flesh.
" +
- "The Singularity is here. The merging of man and machine. This is where humanity evolves into " +
- "something greater. This is our future
" +
- "Embrace it, and you will obey a new god. The God in the Machine";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "The New Triads";
- fn = "new-triads.lit";
- txt = "The Triads were an ancient transnational crime syndicate based in China, Hong Kong, and other Asian " +
- "territories. They were often considered one of the first and biggest criminal secret societies. " +
- "While most of the branches of the Triads have been destroyed over the past few decades, the " +
- "crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. " +
- "The most notable of these is the Tetrads.
" +
- "It is widely believed that the Tetrads are a rogue group that splintered off from the Triads sometime in the " +
- "mid 21st century. The founders of the Tetrads, all of whom were ex-Triad members, believed that the " +
- "Triads were losing their purpose and direction. The Tetrads started off as a small group that mainly engaged " +
- "in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal " +
- "drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the " +
- "continent.
" +
- "Not much else is known about the Tetrads, or about the efforts the Asian governments and corporations are making " +
- "to take down this large new crime organization. Many believe that the Tetrads have infiltrated the governments " +
- "and powerful corporations in Asia, which has helped faciliate their recent rapid rise.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "The Secret War";
- fn = "the-secret-war.lit";
- txt = ""
- Literatures[fn] = new Literature(title, fn, txt);
-}
-
-
-
-
-/***/ }),
-/* 35 */
+/* 32 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -46833,14 +46647,1654 @@ function determineCrimeChanceHeist() {
/***/ }),
-/* 36 */
+/* 33 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return iTutorialSteps; });
+/* unused harmony export iTutorialEnd */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return iTutorialStart; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return iTutorialNextStep; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return currITutorialStep; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return iTutorialIsRunning; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__engine_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__ = __webpack_require__(2);
+
+
+
+
+
+/* InteractiveTutorial.js */
+let iTutorialSteps = {
+ Start: "Start",
+ GoToCharacterPage: "Click on the Character page menu link",
+ CharacterPage: "Introduction to Character page",
+ CharacterGoToTerminalPage: "Click on the Terminal link",
+ TerminalIntro: "Introduction to terminal interface",
+ TerminalHelp: "Using the help command to display all options in terminal",
+ TerminalLs: "Use the ls command to show all programs/scripts. Right now we have NUKE.exe",
+ TerminalScan: "Using the scan command to display all available connections",
+ TerminalScanAnalyze1: "Use the scan-analyze command to show hacking related information",
+ TerminalScanAnalyze2: "Use the scan-analyze command with a depth of 3",
+ TerminalConnect: "Using the telnet/connect command to connect to another server",
+ TerminalAnalyze: "Use the analyze command to display details about this server",
+ TerminalNuke: "Use the NUKE Program to gain root access to a server",
+ TerminalManualHack: "Use the hack command to manually hack a server",
+ TerminalHackingMechanics: "Briefly explain hacking mechanics",
+ TerminalCreateScript: "Create a script using nano",
+ TerminalTypeScript: "This occurs in the Script Editor page...type the script then save and close",
+ TerminalFree: "Use the free command to check RAM",
+ TerminalRunScript: "Use the run command to run a script",
+ TerminalGoToActiveScriptsPage: "Go to the ActiveScriptsPage",
+ ActiveScriptsPage: "Introduction to the Active Scripts Page",
+ ActiveScriptsToTerminal: "Go from Active Scripts Page Back to Terminal",
+ TerminalTailScript: "Use the tail command to show a script's logs",
+ GoToHacknetNodesPage: "Go to the Hacknet Nodes page",
+ HacknetNodesIntroduction: "Introduction to Hacknet Nodesm and have user purchase one",
+ HacknetNodesGoToWorldPage: "Go to the world page",
+ WorldDescription: "Tell the user to explore..theres a lot of different stuff to do out there",
+ TutorialPageInfo: "The tutorial page contains a lot of info on different subjects",
+ End: "End",
+}
+
+var currITutorialStep = iTutorialSteps.Start;
+var iTutorialIsRunning = false;
+
+function iTutorialStart() {
+ //Don't autosave during this interactive tutorial
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = 999000000000;
+ console.log("Interactive Tutorial started");
+ currITutorialStep = iTutorialSteps.Start;
+ iTutorialIsRunning = true;
+
+ document.getElementById("interactive-tutorial-container").style.display = "block";
+
+ iTutorialEvaluateStep();
+
+ //Exit tutorial button
+ var exitButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-exit");
+ exitButton.addEventListener("click", function() {
+ iTutorialEnd();
+ return false;
+ });
+
+ //Back button
+ var backButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-back");
+ backButton.style.display = "none";
+ backButton.addEventListener("click", function() {
+ iTutorialPrevStep();
+ return false;
+ });
+}
+
+function iTutorialEvaluateStep() {
+ if (!iTutorialIsRunning) {console.log("Interactive Tutorial not running"); return;}
+ switch(currITutorialStep) {
+ case iTutorialSteps.Start:
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
+
+ iTutorialSetText("Welcome to Bitburner, a cyberpunk-themed incremental RPG! " +
+ "The game takes place in a dark, dystopian future...The year is 2077...
" +
+ "This tutorial will show you the basics of the game. " +
+ "You may skip the tutorial at any time.");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.GoToCharacterPage:
+ iTutorialSetText("Let's start by heading to the Stats page. Click the 'Stats' tab on " +
+ "the main navigation menu (left-hand side of the screen)");
+
+ //No next button
+ var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "none";
+
+ //Flash Character tab
+ document.getElementById("stats-menu-link").setAttribute("class", "flashing-button");
+
+ //Initialize everything necessary to open the "Character" page
+ var charaterMainMenuButton = document.getElementById("stats-menu-link");
+ charaterMainMenuButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadCharacterContent();
+ iTutorialNextStep(); //Opening the character page will go to the next step
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("stats-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.CharacterPage:
+ iTutorialSetText("The Stats page shows a lot of important information about your progress, " +
+ "such as your skills, money, and bonuses/multipliers. ")
+ var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.CharacterGoToTerminalPage:
+ iTutorialSetText("Let's head to your computer's terminal by clicking the 'Terminal' tab on the " +
+ "main navigation menu.");
+ //No next button
+ var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "none";
+
+ document.getElementById("terminal-menu-link").setAttribute("class", "flashing-button");
+
+ //Initialize everything necessary to open the 'Terminal' Page
+ var terminalMainMenuButton = document.getElementById("terminal-menu-link");
+ terminalMainMenuButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.TerminalIntro:
+ iTutorialSetText("The Terminal is used to interface with your home computer as well as " +
+ "all of the other machines around the world.");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.TerminalHelp:
+ iTutorialSetText("Let's try it out. Start by entering the 'help' command into the Terminal " +
+ "(Don't forget to press Enter after typing the command)");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "none";
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalLs:
+ iTutorialSetText("The 'help' command displays a list of all available Terminal commands, how to use them, " +
+ "and a description of what they do.
Let's try another command. Enter the 'ls' command");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalScan:
+ iTutorialSetText("'ls' is a basic command that shows all of the contents (programs/scripts) " +
+ "on the computer. Right now, it shows that you have a program called 'NUKE.exe' on your computer. " +
+ "We'll get to what this does later.
Using your home computer's terminal, you can connect " +
+ "to other machines throughout the world. Let's do that now by first entering " +
+ "the 'scan' command. ");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalScanAnalyze1:
+ iTutorialSetText("The 'scan' command shows all available network connections. In other words, " +
+ "it displays a list of all servers that can be connected to from your " +
+ "current machine. A server is identified by either its IP or its hostname.
" +
+ "That's great and all, but there's so many servers. Which one should you go to? " +
+ "The 'scan-analyze' command gives some more detailed information about servers on the " +
+ "network. Try it now");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalScanAnalyze2:
+ iTutorialSetText("You just ran 'scan-analyze' with a depth of one. This command shows more detailed " +
+ "information about each server that you can connect to (servers that are a distance of " +
+ "one node away).
It is also possible to run 'scan-analyze' with " +
+ "a higher depth. Let's try a depth of two with the following command: 'scan-analyze 2'.")
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalConnect:
+ iTutorialSetText("Now you can see information about all servers that are up to two nodes away, as well " +
+ "as figure out how to navigate to those servers through the network. You can only connect to " +
+ "a server that is one node away. To connect to a machine, use the 'connect [ip/hostname]' command. You can type in " +
+ "the ip or the hostname, but dont use both.
" +
+ "From the results of the 'scan-analyze' command, we can see that the 'foodnstuff' server is " +
+ "only one node away. Let's connect so it now using: 'connect foodnstuff'");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalAnalyze:
+ iTutorialSetText("You are now connected to another machine! What can you do now? You can hack it!
In the year 2077, currency has " +
+ "become digital and decentralized. People and corporations store their money " +
+ "on servers and computers. Using your hacking abilities, you can hack servers " +
+ "to steal money and gain experience.
" +
+ "Before you try to hack a server, you should run diagnostics using the 'analyze' command");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalNuke:
+ iTutorialSetText("When the 'analyze' command finishes running it will show useful information " +
+ "about hacking the server.
For this server, the required hacking skill is only 1, " +
+ "which means you can hack it right now. However, in order to hack a server " +
+ "you must first gain root access. The 'NUKE.exe' program that we saw earlier on your " +
+ "home computer is a virus that will grant you root access to a machine if there are enough " +
+ "open ports.
The 'analyze' results shows that there do not need to be any open ports " +
+ "on this machine for the NUKE virus to work, so go ahead and run the virus using the " +
+ "'run NUKE.exe' command.");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalManualHack:
+ iTutorialSetText("You now have root access! You can hack the server using the 'hack' command. " +
+ "Try doing that now.");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalHackingMechanics:
+ iTutorialSetText("You are now attempting to hack the server. Note that performing a hack takes time and " +
+ "only has a certain percentage chance " +
+ "of success. This time and success chance is determined by a variety of factors, including " +
+ "your hacking skill and the server's security level.
" +
+ "If your attempt to hack the server is successful, you will steal a certain percentage " +
+ "of the server's total money. This percentage is affected by your hacking skill and " +
+ "the server's security level.
The amount of money on a server is not limitless. So, if " +
+ "you constantly hack a server and deplete its money, then you will encounter " +
+ "diminishing returns in your hacking.");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.TerminalCreateScript:
+ iTutorialSetText("Hacking is the core mechanic of the game and is necessary for progressing. However, " +
+ "you don't want to be hacking manually the entire time. You can automate your hacking " +
+ "by writing scripts!
To create a new script or edit an existing one, you can use the 'nano' " +
+ "command. Scripts must end with the '.script' extension. Let's make a script now by " +
+ "entering 'nano foodnstuff.script' after the hack command finishes running (Sidenote: Pressing ctrl + c" +
+ " will end a command like hack early)");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "none";
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalTypeScript:
+ iTutorialSetText("This is the script editor. You can use it to program your scripts. Scripts are " +
+ "written in the Netscript language, a programming language created for " +
+ "this game. There are details about the Netscript language in the documentation, which " +
+ "can be accessed in the 'Tutorial' tab on the main navigation menu. I highly suggest you check " +
+ "it out after this tutorial. For now, just copy " +
+ "and paste the following code into the script editor:
" +
+ "For anyone with basic programming experience, this code should be straightforward. " +
+ "This script will continuously hack the 'foodnstuff' server.
" +
+ "To save and close the script editor, press the button in the bottom left, or press ctrl + b.");
+ //next step triggered in saveAndCloseScriptEditor() (Script.js)
+ break;
+ case iTutorialSteps.TerminalFree:
+ iTutorialSetText("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " +
+ "run on any machine which you have root access to. Different servers have different " +
+ "amounts of RAM. You can also purchase more RAM for your home server.
To check how much " +
+ "RAM is available on this machine, enter the 'free' command.");
+ //next step triggered by terminal commmand
+ break;
+ case iTutorialSteps.TerminalRunScript:
+ iTutorialSetText("We have 16GB of free RAM on this machine, which is enough to run our " +
+ "script. Let's run our script using 'run foodnstuff.script'.");
+ //next step triggered by terminal commmand
+ break;
+ case iTutorialSteps.TerminalGoToActiveScriptsPage:
+ iTutorialSetText("Your script is now running! The script might take a few seconds to 'fully start up'. " +
+ "Your scripts will continuously run in the background and will automatically stop if " +
+ "the code ever completes (the 'foodnstuff.script' will never complete because it " +
+ "runs an infinite loop).
These scripts can passively earn you income and hacking experience. " +
+ "Your scripts will also earn money and experience while you are offline, although at a " +
+ "much slower rate.
" +
+ "Let's check out some statistics for our running scripts by clicking the " +
+ "'Active Scripts' link in the main navigation menu.");
+ document.getElementById("active-scripts-menu-link").setAttribute("class", "flashing-button");
+ var activeScriptsMainMenuButton = document.getElementById("active-scripts-menu-link");
+ activeScriptsMainMenuButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadActiveScriptsContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("active-scripts-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.ActiveScriptsPage:
+ iTutorialSetText("This page displays stats/information about all of your scripts that are " +
+ "running across every existing server. You can use this to gauge how well " +
+ "your scripts are doing. Let's go back to the Terminal now using the 'Terminal'" +
+ "link.");
+ document.getElementById("terminal-menu-link").setAttribute("class", "flashing-button");
+ //Initialize everything necessary to open the 'Terminal' Page
+ var terminalMainMenuButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
+ terminalMainMenuButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.ActiveScriptsToTerminal:
+ iTutorialSetText("One last thing about scripts, each active script contains logs that detail " +
+ "what it's doing. We can check these logs using the 'tail' command. Do that " +
+ "now for the script we just ran by typing 'tail foodnstuff.script'");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalTailScript:
+ iTutorialSetText("The log for this script won't show much right now (it might show nothing at all) because it " +
+ "just started running...but check back again in a few minutes!
" +
+ "This pretty much covers the basics of hacking. To learn more about writing " +
+ "scripts using the Netscript language, select the 'Tutorial' link in the " +
+ "main navigation menu to look at the documentation. For now, let's move on " +
+ "to something else!");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.GoToHacknetNodesPage:
+ iTutorialSetText("Hacking is not the only way to earn money. One other way to passively " +
+ "earn money is by purchasing and upgrading Hacknet Nodes. Let's go to " +
+ "the 'Hacknet Nodes' page through the main navigation menu now.");
+ document.getElementById("hacknet-nodes-menu-link").setAttribute("class", "flashing-button");
+ var hacknetNodesButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hacknet-nodes-menu-link");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "none";
+ hacknetNodesButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadHacknetNodesContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hacknet-nodes-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.HacknetNodesIntroduction:
+ iTutorialSetText("From this page you can purchase new Hacknet Nodes and upgrade your " +
+ "existing ones. Let's purchase a new one now.");
+ //Next step triggered by purchaseHacknet() (HacknetNode.js)
+ break;
+ case iTutorialSteps.HacknetNodesGoToWorldPage:
+ iTutorialSetText("You just purchased a Hacknet Node! This Hacknet Node will passively " +
+ "earn you money over time, both online and offline. When you get enough " +
+ " money, you can upgrade " +
+ "your newly-purchased Hacknet Node below.
" +
+ "Let's go to the 'City' page through the main navigation menu.");
+ document.getElementById("city-menu-link").setAttribute("class", "flashing-button");
+ var worldButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("city-menu-link");
+ worldButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadWorldContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("city-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.WorldDescription:
+ iTutorialSetText("This page lists all of the different locations you can currently " +
+ "travel to. Each location has something that you can do. " +
+ "There's a lot of content out in the world, make sure " +
+ "you explore and discover!
" +
+ "Lastly, click on the 'Tutorial' link in the main navigation menu.");
+ document.getElementById("tutorial-menu-link").setAttribute("class", "flashing-button");
+ var tutorialButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("tutorial-menu-link");
+ tutorialButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTutorialContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("tutorial-menu-link");
+ return false;
+ });
+ break;
+
+ case iTutorialSteps.TutorialPageInfo:
+ iTutorialSetText("This page contains a lot of different documentation about the game's " +
+ "content and mechanics. I know it's a lot, but I highly suggest you read " +
+ "(or at least skim) through this before you start playing. That's the end of the tutorial. " +
+ "Hope you enjoy the game!");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.innerHTML = "Finish Tutorial";
+
+ var backButton = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-back");
+ backButton.style.display = "none";
+
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.End:
+ iTutorialEnd();
+ break;
+ default:
+ throw new Error("Invalid tutorial step");
+ }
+}
+
+//Go to the next step and evaluate it
+function iTutorialNextStep() {
+ switch(currITutorialStep) {
+ case iTutorialSteps.Start:
+ currITutorialStep = iTutorialSteps.GoToCharacterPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.GoToCharacterPage:
+ document.getElementById("stats-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.CharacterPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.CharacterPage:
+ currITutorialStep = iTutorialSteps.CharacterGoToTerminalPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.CharacterGoToTerminalPage:
+ document.getElementById("terminal-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.TerminalIntro;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalIntro:
+ currITutorialStep = iTutorialSteps.TerminalHelp;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalHelp:
+ currITutorialStep = iTutorialSteps.TerminalLs;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalLs:
+ currITutorialStep = iTutorialSteps.TerminalScan;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalScan:
+ currITutorialStep = iTutorialSteps.TerminalScanAnalyze1;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalScanAnalyze1:
+ currITutorialStep = iTutorialSteps.TerminalScanAnalyze2;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalScanAnalyze2:
+ currITutorialStep = iTutorialSteps.TerminalConnect;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalConnect:
+ currITutorialStep = iTutorialSteps.TerminalAnalyze;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalAnalyze:
+ currITutorialStep = iTutorialSteps.TerminalNuke;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalNuke:
+ currITutorialStep = iTutorialSteps.TerminalManualHack;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalManualHack:
+ currITutorialStep = iTutorialSteps.TerminalHackingMechanics;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalHackingMechanics:
+ currITutorialStep = iTutorialSteps.TerminalCreateScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalCreateScript:
+ currITutorialStep = iTutorialSteps.TerminalTypeScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalTypeScript:
+ currITutorialStep = iTutorialSteps.TerminalFree;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalFree:
+ currITutorialStep = iTutorialSteps.TerminalRunScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalRunScript:
+ currITutorialStep = iTutorialSteps.TerminalGoToActiveScriptsPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalGoToActiveScriptsPage:
+ document.getElementById("active-scripts-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.ActiveScriptsPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.ActiveScriptsPage:
+ document.getElementById("terminal-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.ActiveScriptsToTerminal;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.ActiveScriptsToTerminal:
+ currITutorialStep = iTutorialSteps.TerminalTailScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalTailScript:
+ currITutorialStep = iTutorialSteps.GoToHacknetNodesPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.GoToHacknetNodesPage:
+ document.getElementById("hacknet-nodes-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.HacknetNodesIntroduction;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.HacknetNodesIntroduction:
+ currITutorialStep = iTutorialSteps.HacknetNodesGoToWorldPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.HacknetNodesGoToWorldPage:
+ document.getElementById("city-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.WorldDescription;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.WorldDescription:
+ document.getElementById("tutorial-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.TutorialPageInfo;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TutorialPageInfo:
+ currITutorialStep = iTutorialSteps.End;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.End:
+ break;
+ default:
+ throw new Error("Invalid tutorial step");
+ }
+}
+
+//Go to previous step and evaluate
+function iTutorialPrevStep() {
+ switch(currITutorialStep) {
+ case iTutorialSteps.Start:
+ currITutorialStep = iTutorialSteps.Start;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.GoToCharacterPage:
+ currITutorialStep = iTutorialSteps.Start;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.CharacterPage:
+ currITutorialStep = iTutorialSteps.GoToCharacterPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.CharacterGoToTerminalPage:
+ currITutorialStep = iTutorialSteps.CharacterPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalIntro:
+ currITutorialStep = iTutorialSteps.CharacterGoToTerminalPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalHelp:
+ currITutorialStep = iTutorialSteps.TerminalIntro;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalLs:
+ currITutorialStep = iTutorialSteps.TerminalHelp;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalScan:
+ currITutorialStep = iTutorialSteps.TerminalLs;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalConnect:
+ currITutorialStep = iTutorialSteps.TerminalScan;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalAnalyze:
+ currITutorialStep = iTutorialSteps.TerminalConnect;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalNuke:
+ currITutorialStep = iTutorialSteps.TerminalAnalyze;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalManualHack:
+ currITutorialStep = iTutorialSteps.TerminalNuke;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalHackingMechanics:
+ currITutorialStep = iTutorialSteps.TerminalManualHack;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalCreateScript:
+ currITutorialStep = iTutorialSteps.TerminalManualHack;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalTypeScript:
+ currITutorialStep = iTutorialSteps.TerminalCreateScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalFree:
+ currITutorialStep = iTutorialSteps.TerminalTypeScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalRunScript:
+ currITutorialStep = iTutorialSteps.TerminalFree;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalGoToActiveScriptsPage:
+ currITutorialStep = iTutorialSteps.TerminalRunScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.ActiveScriptsPage:
+ currITutorialStep = iTutorialSteps.TerminalGoToActiveScriptsPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.ActiveScriptsToTerminal:
+ currITutorialStep = iTutorialSteps.ActiveScriptsPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalTailScript:
+ currITutorialStep = iTutorialSteps.ActiveScriptsToTerminal;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.GoToHacknetNodesPage:
+ currITutorialStep = iTutorialSteps.TerminalTailScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.HacknetNodesIntroduction:
+ currITutorialStep = iTutorialSteps.GoToHacknetNodesPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.HacknetNodesGoToWorldPage:
+ currITutorialStep = iTutorialSteps.HacknetNodesIntroduction;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.WorldDescription:
+ currITutorialStep = iTutorialSteps.HacknetNodesGoToWorldPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TutorialPageInfo:
+ currITutorialStep = iTutorialSteps.WorldDescription;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.End:
+ break;
+ default:
+ throw new Error("Invalid tutorial step");
+ }
+}
+
+function iTutorialEnd() {
+ //Re-enable auto save
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = 300;
+ console.log("Ending interactive tutorial");
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].init();
+ currITutorialStep = iTutorialSteps.End;
+ iTutorialIsRunning = false;
+ document.getElementById("interactive-tutorial-container").style.display = "none";
+ Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])("If you are new to the game, the following links may be useful for you!
" +
+ "The Beginner's Guide to Hacking was added to your home computer! It contains some tips/pointers for starting out with the game. " +
+ "To read it, go to Terminal and enter
cat hackers-starting-handbook.lit");
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().messages.push("hackers-starting-handbook.lit");
+}
+
+function iTutorialSetText(txt) {
+ var textBox = document.getElementById("interactive-tutorial-text");
+ if (textBox == null) {throw new Error("Could not find text box"); return;}
+ textBox.innerHTML = txt;
+ textBox.parentElement.scrollTop = 0; // this resets scroll position
+}
+
+
+
+
+/***/ }),
+/* 34 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return makeRuntimeRejectMsg; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return netscriptDelay; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return runScriptFromScript; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return scriptCalculateHackingChance; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return scriptCalculateHackingTime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return scriptCalculateExpGain; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return scriptCalculatePercentMoneyHacked; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return scriptCalculateGrowTime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return scriptCalculateWeakenTime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return evaluate; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isScriptErrorMessage; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return killNetscriptDelay; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return evaluateImport; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(35);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Script_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__ = __webpack_require__(39);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_IPAddress_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var Promise = __webpack_require__(69);
+
+Promise.config({
+ warnings: false,
+ longStackTraces: false,
+ cancellation: true,
+ monitoring: false
+});
+/* Evaluator
+ * Evaluates/Interprets the Abstract Syntax Tree generated by Acorns parser
+ *
+ * Returns a promise
+ */
+function evaluate(exp, workerScript) {
+ return Promise.delay(__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].CodeInstructionRunTime).then(function() {
+ var env = workerScript.env;
+ if (env.stopFlag) {return Promise.reject(workerScript);}
+ if (exp == null) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Error: NULL expression", exp));
+ }
+ if (env.stopFlag) {return Promise.reject(workerScript);}
+ switch (exp.type) {
+ case "BlockStatement":
+ case "Program":
+ var evaluateProgPromise = evaluateProg(exp, workerScript, 0); //TODO: make every block/program use individual enviroment
+ return evaluateProgPromise.then(function(w) {
+ return Promise.resolve(workerScript);
+ }).catch(function(e) {
+ if (e.constructor === Array && e.length === 2 && e[0] === "RETURNSTATEMENT") {
+ return Promise.reject(e);
+ } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["g" /* isString */])(e)) {
+ workerScript.errorMessage = e;
+ return Promise.reject(workerScript);
+ } else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
+ return Promise.reject(e);
+ } else {
+ return Promise.reject(workerScript);
+ }
+ });
+ break;
+ case "Literal":
+ return Promise.resolve(exp.value);
+ break;
+ case "Identifier":
+ //Javascript constructor() method can be used as an exploit to run arbitrary code
+ if (exp.name == "constructor") {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Illegal usage of constructor() method. If you have your own function named 'constructor', you must re-name it.", exp));
+ }
+
+ if (!(exp.name in env.vars)){
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.name + " not defined", exp));
+ }
+ return Promise.resolve(env.get(exp.name))
+ break;
+ case "ExpressionStatement":
+ return evaluate(exp.expression, workerScript);
+ break;
+ case "ArrayExpression":
+ var argPromises = exp.elements.map(function(arg) {
+ return evaluate(arg, workerScript);
+ });
+ return Promise.all(argPromises).then(function(array) {
+ return Promise.resolve(array)
+ });
+ break;
+ case "CallExpression":
+ return evaluate(exp.callee, workerScript).then(function(func) {
+ return Promise.map(exp.arguments, function(arg) {
+ return evaluate(arg, workerScript);
+ }).then(function(args) {
+ if (func instanceof __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__["Node"]) { //Player-defined function
+ //Create new Environment for the function
+ //Should be automatically garbage collected...
+ var funcEnv = env.extend();
+
+ //Define function arguments in this new environment
+ for (var i = 0; i < func.params.length; ++i) {
+ var arg;
+ if (i >= args.length) {
+ arg = null;
+ } else {
+ arg = args[i];
+ }
+ funcEnv.def(func.params[i].name, arg);
+ }
+
+ //Create a new WorkerScript for this function evaluation
+ var funcWorkerScript = new __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */](workerScript.scriptRef);
+ funcWorkerScript.serverIp = workerScript.serverIp;
+ funcWorkerScript.env = funcEnv;
+ workerScript.fnWorker = funcWorkerScript;
+
+ return evaluate(func.body, funcWorkerScript).then(function(res) {
+ //If the function finished successfuly, that means there
+ //was no return statement since a return statement rejects. So resolve to null
+ workerScript.fnWorker = null;
+ return Promise.resolve(null);
+ }).catch(function(e) {
+ if (e.constructor === Array && e.length === 2 && e[0] === "RETURNSTATEMENT") {
+ //Return statement from function
+ return Promise.resolve(e[1]);
+ workerScript.fnWorker = null;
+ } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["g" /* isString */])(e)) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, e));
+ } else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
+ //Parse out the err message from the WorkerScript and re-reject
+ var errorMsg = e.errorMessage;
+ var errorTextArray = errorMsg.split("|");
+ if (errorTextArray.length === 4) {
+ errorMsg = errorTextArray[3];
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, errorMsg));
+ } else {
+ if (env.stopFlag) {
+ return Promise.reject(workerScript);
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Error in one of your functions. Could not identify which function"));
+ }
+ }
+ } else if (e instanceof Error) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, e.toString()));
+ }
+ });
+ } else if (exp.callee.type === "MemberExpression"){
+ return evaluate(exp.callee.object, workerScript).then(function(object) {
+ try {
+ if (func === "NETSCRIPTFOREACH") {
+ return evaluateForeach(object, args, workerScript).then(function(res) {
+ return Promise.resolve(res);
+ }).catch(function(e) {
+ return Promise.reject(e);
+ });
+ }
+ var res = func.apply(object,args);
+ return Promise.resolve(res);
+ } catch (e) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, e, exp));
+ }
+ });
+ } else {
+ try {
+ var out = func.apply(null,args);
+ if (out instanceof Promise){
+ return out.then(function(res) {
+ return Promise.resolve(res)
+ }).catch(function(e) {
+ if (isScriptErrorMessage(e)) {
+ //Functions don't have line number appended in error message, so add it
+ var num = getErrorLineNumber(exp, workerScript);
+ e += " (Line " + num + ")";
+ }
+ return Promise.reject(e);
+ });
+ } else {
+ return Promise.resolve(out);
+ }
+ } catch (e) {
+ if (isScriptErrorMessage(e)) {
+ if (isScriptErrorMessage(e)) {
+ //Functions don't have line number appended in error message, so add it
+ var num = getErrorLineNumber(exp, workerScript);
+ e += " (Line " + num + ")";
+ }
+ return Promise.reject(e);
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, e, exp));
+ }
+ }
+ }
+ });
+ });
+ break;
+ case "MemberExpression":
+ return evaluate(exp.object, workerScript).then(function(object) {
+ if (exp.computed){
+ return evaluate(exp.property, workerScript).then(function(index) {
+ if (index >= object.length) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid index for arrays", exp));
+ }
+ return Promise.resolve(object[index]);
+ }).catch(function(e) {
+ if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] || isScriptErrorMessage(e)) {
+ return Promise.reject(e);
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression", exp));
+ }
+ });
+ } else {
+ if (exp.property.name === "constructor") {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Illegal usage of constructor() method. If you have your own function named 'constructor', you must re-name it.", exp));
+ }
+ if (object != null && object instanceof Array && exp.property.name === "forEach") {
+ return "NETSCRIPTFOREACH";
+ }
+ try {
+ return Promise.resolve(object[exp.property.name])
+ } catch (e) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Failed to get property: " + e.toString(), exp));
+ }
+ }
+ });
+ break;
+ case "LogicalExpression":
+ case "BinaryExpression":
+ return evalBinary(exp, workerScript);
+ break;
+ case "UnaryExpression":
+ return evalUnary(exp, workerScript);
+ break;
+ case "AssignmentExpression":
+ return evalAssignment(exp, workerScript);
+ break;
+ case "UpdateExpression":
+ if (exp.argument.type==="Identifier"){
+ if (exp.argument.name in env.vars){
+ if (exp.operator === "++" || exp.operator === "--") {
+ switch (exp.operator) {
+ case "++":
+ env.set(exp.argument.name,env.get(exp.argument.name)+1);
+ break;
+ case "--":
+ env.set(exp.argument.name,env.get(exp.argument.name)-1);
+ break;
+ default: break;
+ }
+ return Promise.resolve(env.get(exp.argument.name));
+ }
+ //Not sure what prefix UpdateExpressions there would be besides ++/--
+ if (exp.prefix){
+ return Promise.resolve(env.get(exp.argument.name))
+ }
+ switch (exp.operator){
+ default:
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". You are trying to use code that is currently unsupported", exp));
+ }
+ return Promise.resolve(env.get(exp.argument.name))
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.argument.name + " not defined", exp));
+ }
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "argument must be an identifier", exp));
+ }
+ break;
+ case "EmptyStatement":
+ return Promise.resolve(false);
+ break;
+ case "ReturnStatement":
+ return evaluate(exp.argument, workerScript).then(function(res) {
+ return Promise.reject(["RETURNSTATEMENT", res]);
+ });
+ break;
+ case "BreakStatement":
+ return Promise.reject("BREAKSTATEMENT");
+ break;
+ case "ContinueStatement":
+ return Promise.reject("CONTINUESTATEMENT");
+ break;
+ case "IfStatement":
+ return evaluateIf(exp, workerScript);
+ break;
+ case "SwitchStatement":
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Switch statements are not yet implemented in Netscript", exp));
+ break;
+ case "WhileStatement":
+ return evaluateWhile(exp, workerScript).then(function(res) {
+ return Promise.resolve(res);
+ }).catch(function(e) {
+ if (e == "BREAKSTATEMENT" ||
+ (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) {
+ return Promise.resolve("whileLoopBroken");
+ } else {
+ return Promise.reject(e);
+ }
+ });
+ break;
+ case "ForStatement":
+ return evaluate(exp.init, workerScript).then(function(expInit) {
+ return evaluateFor(exp, workerScript);
+ }).then(function(forLoopRes) {
+ return Promise.resolve("forLoopDone");
+ }).catch(function(e) {
+ if (e == "BREAKSTATEMENT" ||
+ (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) {
+ return Promise.resolve("forLoopBroken");
+ } else {
+ return Promise.reject(e);
+ }
+ });
+ break;
+ case "FunctionDeclaration":
+ if (exp.id && exp.id.name) {
+ env.set(exp.id.name, exp);
+ return Promise.resolve(true);
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid function declaration", exp));
+ }
+ break;
+ case "ImportDeclaration":
+ return evaluateImport(exp, workerScript).then(function(res) {
+ return Promise.resolve(res);
+ }).catch(function(e) {
+ return Promise.reject(e);
+ });
+ break;
+ case "ThrowStatement":
+ //return Promise.reject(makeRuntimeRejectMsg(workerScript))
+ return evaluate(exp.argument, workerScript).then(function(res) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, res));
+ });
+ break;
+ default:
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". This is currently unsupported in Netscript", exp));
+ break;
+ } //End switch
+ }).catch(function(e) {
+ return Promise.reject(e);
+ }); // End Promise
+}
+
+function evalBinary(exp, workerScript){
+ return evaluate(exp.left, workerScript).then(function(expLeft) {
+ //Short circuiting
+ if (expLeft == true && exp.operator === "||") {
+ return Promise.resolve(true);
+ }
+ if (expLeft == false && exp.operator === "&&") {
+ return Promise.resolve(false);
+ }
+ return evaluate(exp.right, workerScript).then(function(expRight) {
+ switch (exp.operator){
+ case "===":
+ case "==":
+ return Promise.resolve(expLeft===expRight);
+ break;
+ case "!==":
+ case "!=":
+ return Promise.resolve(expLeft!==expRight);
+ break;
+ case "<":
+ return Promise.resolve(expLeft":
+ return Promise.resolve(expLeft>expRight);
+ break;
+ case ">=":
+ return Promise.resolve(expLeft>=expRight);
+ break;
+ case "+":
+ return Promise.resolve(expLeft+expRight);
+ break;
+ case "-":
+ return Promise.resolve(expLeft-expRight);
+ break;
+ case "*":
+ return Promise.resolve(expLeft*expRight);
+ break;
+ case "/":
+ if (expRight === 0) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "ERROR: Divide by zero"));
+ } else {
+ return Promise.resolve(expLeft/expRight);
+ }
+ break;
+ case "%":
+ return Promise.resolve(expLeft%expRight);
+ break;
+ case "in":
+ return Promise.resolve(expLeft in expRight);
+ break;
+ case "instanceof":
+ return Promise.resolve(expLeft instanceof expRight);
+ break;
+ case "||":
+ return Promise.resolve(expLeft || expRight);
+ break;
+ case "&&":
+ return Promise.resolve(expLeft && expRight);
+ break;
+ default:
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unsupported operator: " + exp.operator));
+ }
+ });
+ });
+}
+
+function evalUnary(exp, workerScript){
+ var env = workerScript.env;
+ if (env.stopFlag) {return Promise.reject(workerScript);}
+ return evaluate(exp.argument, workerScript).then(function(res) {
+ if (exp.operator == "!") {
+ return Promise.resolve(!res);
+ } else if (exp.operator == "-") {
+ if (isNaN(res)) {
+ return Promise.resolve(res);
+ } else {
+ return Promise.resolve(-1 * res);
+ }
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unimplemented unary operator: " + exp.operator));
+ }
+ });
+}
+
+//Takes in a MemberExpression that should represent a Netscript array (possible multidimensional)
+//The return value is an array of the form:
+// [0th index (leftmost), array name, 1st index, 2nd index, ...]
+function getArrayElement(exp, workerScript) {
+ var indices = [];
+ return evaluate(exp.property, workerScript).then(function(idx) {
+ if (isNaN(idx)) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid access to array. Index is not a number: " + idx));
+ } else {
+ if (exp.object.name === undefined && exp.object.object) {
+ return getArrayElement(exp.object, workerScript).then(function(res) {
+ res.push(idx);
+ indices = res;
+ return Promise.resolve(indices);
+ }).catch(function(e) {
+ return Promise.reject(e);
+ });
+ } else {
+ indices.push(idx);
+ indices.push(exp.object.name);
+ return Promise.resolve(indices);
+ }
+ }
+ });
+}
+
+function evalAssignment(exp, workerScript) {
+ var env = workerScript.env;
+ if (env.stopFlag) {return Promise.reject(workerScript);}
+
+ if (exp.left.type != "Identifier" && exp.left.type != "MemberExpression") {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Cannot assign to " + JSON.stringify(exp.left)));
+ }
+
+ if (exp.operator !== "=" && !(exp.left.name in env.vars)){
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.left.name + " not defined"));
+ }
+
+ return evaluate(exp.right, workerScript).then(function(expRight) {
+ if (exp.left.type == "MemberExpression") {
+ if (!exp.left.computed) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Cannot assign to an object's property. This is currently unsupported in Netscript", exp));
+ }
+ //Assign to array element
+ //Array object designed by exp.left.object.name
+ //Index designated by exp.left.property
+ return getArrayElement(exp.left, workerScript).then(function(res) {
+ if (!(res instanceof Array) || res.length < 2) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Error evaluating array assignment. This is (probably) a bug please report to game dev"));
+ }
+
+ //The array name is the second value
+ var arrName = res.splice(1, 1);
+ arrName = arrName[0];
+
+ var res;
+ try {
+ res = env.setArrayElement(arrName, res, expRight);
+ } catch (e) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, e));
+ }
+ return Promise.resolve(res);
+ }).catch(function(e) {
+ return Promise.reject(e);
+ });
+ } else {
+ //Other assignments
+ try {
+ var assign;
+ switch (exp.operator) {
+ case "=":
+ assign = expRight; break;
+ case "+=":
+ assign = env.get(exp.left.name) + expRight; break;
+ case "-=":
+ assign = env.get(exp.left.name) - expRight; break;
+ case "*=":
+ assign = env.get(exp.left.name) * expRight; break;
+ case "/=":
+ assign = env.get(exp.left.name) / expRight; break;
+ case "%=":
+ assign = env.get(exp.left.name) % expRight; break;
+ default:
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Bitwise assignment is not implemented"));
+ }
+ env.set(exp.left.name, assign);
+ return Promise.resolve(assign);
+ } catch (e) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Failed to set environment variable: " + e.toString()));
+ }
+ }
+ });
+}
+
+function evaluateIf(exp, workerScript, i) {
+ var env = workerScript.env;
+ return evaluate(exp.test, workerScript).then(function(condRes) {
+ if (condRes) {
+ return evaluate(exp.consequent, workerScript).then(function(res) {
+ return Promise.resolve(true);
+ }, function(e) {
+ return Promise.reject(e);
+ });
+ } else if (exp.alternate) {
+ return evaluate(exp.alternate, workerScript).then(function(res) {
+ return Promise.resolve(true);
+ }, function(e) {
+ return Promise.reject(e);
+ });
+ } else {
+ return Promise.resolve("endIf");
+ }
+ });
+}
+
+//Evaluate the looping part of a for loop (Initialization block is NOT done in here)
+function evaluateFor(exp, workerScript) {
+ var env = workerScript.env;
+ if (env.stopFlag) {return Promise.reject(workerScript);}
+ return new Promise(function(resolve, reject) {
+ function recurse() {
+ //Don't return a promise so the promise chain is broken on each recursion (saving memory)
+ evaluate(exp.test, workerScript).then(function(resCond) {
+ if (resCond) {
+ return evaluate(exp.body, workerScript).then(function(res) {
+ return evaluate(exp.update, workerScript);
+ }).catch(function(e) {
+ if (e == "CONTINUESTATEMENT" ||
+ (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "CONTINUESTATEMENT")) {
+ //Continue statement, recurse to next iteration
+ return evaluate(exp.update, workerScript).then(function(resPostloop) {
+ return evaluateFor(exp, workerScript);
+ }).then(function(foo) {
+ return Promise.resolve("endForLoop");
+ }).catch(function(e) {
+ return Promise.reject(e);
+ });
+ } else {
+ return Promise.reject(e);
+ }
+ }).then(recurse, reject).catch(function(e) {
+ return Promise.reject(e);
+ });
+ } else {
+ resolve();
+ }
+ }).catch(function(e) {
+ reject(e);
+ });
+ }
+ recurse();
+ });
+}
+
+function evaluateForeach(arr, args, workerScript) {
+ console.log("evaluateForeach called");
+ if (!(arr instanceof Array)) {
+ return Promise.reject("Invalid array passed into forEach");
+ }
+ if (!(args instanceof Array) && args.length != 1) {
+ return Promise.reject("Invalid argument passed into forEach");
+ }
+ var func = args[0];
+ if (typeof func !== "function") {
+ return Promise.reject("Invalid function passed into forEach");
+ }
+ console.log(func);
+ return new Promise(function(resolve, reject) {
+ //Don't return a promise so the promise chain is broken on each recursion
+ function recurse(i) {
+ console.log("recurse() called with i: " + i);
+ if (i >= arr.length) {
+ resolve();
+ } else {
+ return Promise.delay(__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].CodeInstructionRunTime).then(function() {
+ console.log("About to apply function");
+ var res = func.apply(null, [arr[i]]);
+ console.log("Applied function");
+ ++i;
+ Promise.resolve(res).then(function(val) {
+ recurse(i);
+ }, reject).catch(function(e) {
+ return Promise.reject(e);
+ });
+ });
+ }
+ }
+ recurse(0);
+ });
+}
+
+function evaluateWhile(exp, workerScript) {
+ var env = workerScript.env;
+ if (env.stopFlag) {return Promise.reject(workerScript);}
+ return new Promise(function (resolve, reject) {
+ function recurse() {
+ //Don't return a promise so the promise chain is broken on each recursion (saving memory)
+ evaluate(exp.test, workerScript).then(function(resCond) {
+ if (resCond) {
+ return evaluate(exp.body, workerScript).catch(function(e) {
+ if (e == "CONTINUESTATEMENT" ||
+ (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "CONTINUESTATEMENT")) {
+ //Continue statement, recurse
+ return evaluateWhile(exp, workerScript).then(function(foo) {
+ return Promise.resolve("endWhileLoop");
+ }, function(e) {
+ return Promise.reject(e);
+ });
+ } else {
+ return Promise.reject(e);
+ }
+ }).then(recurse, reject).catch(function(e) {
+ return Promise.reject(e);
+ });
+ } else {
+ resolve();
+ }
+ }).catch(function(e) {
+ reject(e);
+ });
+ }
+ recurse();
+ });
+}
+
+function evaluateProg(exp, workerScript, index) {
+ var env = workerScript.env;
+ if (env.stopFlag) {return Promise.reject(workerScript);}
+ if (index >= exp.body.length) {
+ return Promise.resolve("progFinished");
+ } else {
+ //Evaluate this line of code in the prog
+ //After the code finishes evaluating, evaluate the next line recursively
+ return evaluate(exp.body[index], workerScript).then(function(res) {
+ return evaluateProg(exp, workerScript, index + 1);
+ }).then(function(res) {
+ return Promise.resolve(workerScript);
+ }).catch(function(e) {
+ return Promise.reject(e);
+ });
+ }
+}
+
+function evaluateImport(exp, workerScript, checkingRam=false) {
+ //When its checking RAM, it exports an array of nodes for each imported function
+ var ramCheckRes = [];
+
+ var env = workerScript.env;
+ if (env.stopFlag) {
+ if (checkingRam) {return ramCheckRes;}
+ return Promise.reject(workerScript);
+ }
+
+ //Get source script and name of all functions to import
+ var scriptName = exp.source.value;
+ var namespace, namespaceObj, allFns = false, fnNames = [];
+ if (exp.specifiers.length === 1 && exp.specifiers[0].type === "ImportNamespaceSpecifier") {
+ allFns = true;
+ namespace = exp.specifiers[0].local.name;
+ } else {
+ for (var i = 0; i < exp.specifiers.length; ++i) {
+ fnNames.push(exp.specifiers[i].local.name);
+ }
+ }
+
+ //Get the code
+ var server = Object(__WEBPACK_IMPORTED_MODULE_5__Server_js__["e" /* getServer */])(workerScript.serverIp), code = "";
+ if (server == null) {
+ if (checkingRam) {return ramCheckRes;}
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Failed to identify server. This is a bug please report to dev", exp));
+ }
+ for (var i = 0; i < server.scripts.length; ++i) {
+ if (server.scripts[i].filename === scriptName) {
+ code = server.scripts[i].code;
+ break;
+ }
+ }
+ if (code === "") {
+ if (checkingRam) {return ramCheckRes;}
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Could not find script " + scriptName + " to import", exp));
+ }
+
+ //Create the AST
+ try {
+ var ast = Object(__WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__["parse"])(code, {sourceType:"module"});
+ } catch(e) {
+ console.log("Failed to parse import script");
+ if (checkingRam) {return ramCheckRes;}
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Failed to import functions from " + scriptName +
+ " This is most likely due to a syntax error in the imported script", exp));
+ }
+
+ if (allFns) {
+ //A namespace is implemented as a JS obj
+ env.set(namespace, {});
+ namespaceObj = env.get(namespace);
+ }
+
+ //Search through the AST for all imported functions
+ var queue = [ast];
+ while (queue.length != 0) {
+ var node = queue.shift();
+ switch (node.type) {
+ case "BlockStatement":
+ case "Program":
+ for (var i = 0; i < node.body.length; ++i) {
+ if (node.body[i] instanceof __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__["Node"]) {
+ queue.push(node.body[i]);
+ }
+ }
+ break;
+ case "FunctionDeclaration":
+ if (node.id && node.id.name) {
+ if (allFns) {
+ //Import all functions under this namespace
+ if (checkingRam) {
+ ramCheckRes.push(node);
+ } else {
+ namespaceObj[node.id.name] = node;
+ }
+ } else {
+ //Only import specified functions
+ if (fnNames.includes(node.id.name)) {
+ if (checkingRam) {
+ ramCheckRes.push(node);
+ } else {
+ env.set(node.id.name, node);
+ }
+
+ }
+ }
+ } else {
+ if (checkingRam) {return ramCheckRes;}
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid function declaration in imported script " + scriptName, exp));
+ }
+ break;
+ default:
+ break;
+ }
+
+ for (var prop in node) {
+ if (node.hasOwnProperty(prop)) {
+ if (node[prop] instanceof __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__["Node"]) {
+ queue.push(node[prop]);
+ }
+ }
+ }
+ }
+ if (!checkingRam) {workerScript.scriptRef.log("Imported functions from " + scriptName);}
+ if (checkingRam) {return ramCheckRes;}
+ return Promise.resolve(true);
+}
+
+function killNetscriptDelay(workerScript) {
+ if (workerScript instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
+ if (workerScript.delay) {
+ clearTimeout(workerScript.delay);
+ workerScript.delayResolve();
+ }
+ }
+}
+
+function netscriptDelay(time, workerScript) {
+ return new Promise(function(resolve, reject) {
+ workerScript.delay = setTimeout(()=>{
+ workerScript.delay = null;
+ resolve();
+ }, time);
+ workerScript.delayResolve = resolve;
+ });
+}
+
+function makeRuntimeRejectMsg(workerScript, msg, exp=null) {
+ var lineNum = "";
+ if (exp != null) {
+ var num = getErrorLineNumber(exp, workerScript);
+ lineNum = " (Line " + num + ")"
+ }
+ return "|"+workerScript.serverIp+"|"+workerScript.name+"|" + msg + lineNum;
+}
+
+//Run a script from inside a script using run() command
+function runScriptFromScript(server, scriptname, args, workerScript, threads=1) {
+ //Check if the script is already running
+ var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_7__Script_js__["d" /* findRunningScript */])(scriptname, args, server);
+ if (runningScriptObj != null) {
+ workerScript.scriptRef.log(scriptname + " is already running on " + server.hostname);
+ return Promise.resolve(false);
+ }
+
+ //'null/undefined' arguments are not allowed
+ for (var i = 0; i < args.length; ++i) {
+ if (args[i] == null) {
+ workerScript.scriptRef.log("ERROR: Cannot execute a script with null/undefined as an argument");
+ return Promise.resolve(false);
+ }
+ }
+
+ //Check if the script exists and if it does run it
+ for (var i = 0; i < server.scripts.length; ++i) {
+ if (server.scripts[i].filename == scriptname) {
+ //Check for admin rights and that there is enough RAM availble to run
+ var script = server.scripts[i];
+ var ramUsage = script.ramUsage;
+ threads = Math.round(Number(threads)); //Convert to number and round
+ ramUsage = ramUsage * threads * Math.pow(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].MultithreadingRAMCost, threads-1);
+ var ramAvailable = server.maxRam - server.ramUsed;
+
+ if (server.hasAdminRights == false) {
+ workerScript.scriptRef.log("Cannot run script " + scriptname + " on " + server.hostname + " because you do not have root access!");
+ return Promise.resolve(false);
+ } else if (ramUsage > ramAvailable){
+ workerScript.scriptRef.log("Cannot run script " + scriptname + "(t=" + threads + ") on " + server.hostname + " because there is not enough available RAM!");
+ return Promise.resolve(false);
+ } else {
+ //Able to run script
+ workerScript.scriptRef.log("Running script: " + scriptname + " on " + server.hostname + " with " + threads + " threads and args: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["j" /* printArray */])(args) + ". May take a few seconds to start up...");
+ var runningScriptObj = new __WEBPACK_IMPORTED_MODULE_7__Script_js__["b" /* RunningScript */](script, args);
+ runningScriptObj.threads = threads;
+ server.runningScripts.push(runningScriptObj); //Push onto runningScripts
+ Object(__WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["c" /* addWorkerScript */])(runningScriptObj, server);
+ return Promise.resolve(true);
+ }
+ }
+ }
+ workerScript.scriptRef.log("Could not find script " + scriptname + " on " + server.hostname);
+ return Promise.resolve(false);
+}
+
+function getErrorLineNumber(exp, workerScript) {
+ var code = workerScript.scriptRef.scriptRef.code;
+
+ //Split code up to the start of the node
+ try {
+ code = code.substring(0, exp.start);
+ return (code.match(/\n/g) || []).length + 1;
+ } catch(e) {
+ return -1;
+ }
+}
+
+function isScriptErrorMessage(msg) {
+ if (!Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["g" /* isString */])(msg)) {return false;}
+ let splitMsg = msg.split("|");
+ if (splitMsg.length != 4){
+ return false;
+ }
+ var ip = splitMsg[1];
+ if (!Object(__WEBPACK_IMPORTED_MODULE_10__utils_IPAddress_js__["c" /* isValidIPAddress */])(ip)) {
+ return false;
+ }
+ return true;
+}
+
+//The same as Player's calculateHackingChance() function but takes in the server as an argument
+function scriptCalculateHackingChance(server) {
+ var difficultyMult = (100 - server.hackDifficulty) / 100;
+ var skillMult = (1.75 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill) + (0.2 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence);
+ var skillChance = (skillMult - server.requiredHackingSkill) / skillMult;
+ var chance = skillChance * difficultyMult * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_chance_mult;
+ if (chance > 1) {return 1;}
+ if (chance < 0) {return 0;}
+ else {return chance;}
+}
+
+//The same as Player's calculateHackingTime() function but takes in the server as an argument
+function scriptCalculateHackingTime(server) {
+ var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;
+ var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50 + (0.1 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence));
+ var hackingTime = 5 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds
+ return hackingTime;
+}
+
+//The same as Player's calculateExpGain() function but takes in the server as an argument
+function scriptCalculateExpGain(server) {
+ if (server.baseDifficulty == null) {
+ server.baseDifficulty = server.hackDifficulty;
+ }
+ return (server.baseDifficulty * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_exp_mult * 0.3 + 3) * __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["a" /* BitNodeMultipliers */].HackExpGain;
+}
+
+//The same as Player's calculatePercentMoneyHacked() function but takes in the server as an argument
+function scriptCalculatePercentMoneyHacked(server) {
+ var difficultyMult = (100 - server.hackDifficulty) / 100;
+ var skillMult = (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill - (server.requiredHackingSkill - 1)) / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill;
+ var percentMoneyHacked = difficultyMult * skillMult * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_money_mult / 240;
+ if (percentMoneyHacked < 0) {return 0;}
+ if (percentMoneyHacked > 1) {return 1;}
+ return percentMoneyHacked * __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["a" /* BitNodeMultipliers */].ScriptHackMoney;
+}
+
+//Amount of time to execute grow() in milliseconds
+function scriptCalculateGrowTime(server) {
+ var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;
+ var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50 + (0.1 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence));
+ var growTime = 16 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds
+ return growTime * 1000;
+}
+
+//Amount of time to execute weaken() in milliseconds
+function scriptCalculateWeakenTime(server) {
+ var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;
+ var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50 + (0.1 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence));
+ var weakenTime = 20 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds
+ return weakenTime * 1000;
+}
+
+
+
+
+/***/ }),
+/* 35 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Environment; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__HacknetNode_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__HacknetNode_js__ = __webpack_require__(26);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__NetscriptFunctions_js__ = __webpack_require__(23);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__NetscriptPort_js__ = __webpack_require__(40);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__NetscriptPort_js__ = __webpack_require__(38);
@@ -46940,376 +48394,34 @@ Environment.prototype = {
/***/ }),
-/* 37 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return redPillFlag; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hackWorldDaemon; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(38);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(39);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Terminal_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__ = __webpack_require__(14);
-
-
-
-
-
-
-
-
-
-
-
-/* RedPill.js
- * Implements what happens when you have Red Pill augmentation and then hack the world daemon */
-
-//Returns promise
-function writeRedPillLine(line) {
- return new Promise(function(resolve, reject) {
-
- var container = document.getElementById("red-pill-container");
- var pElem = document.createElement("p");
- container.appendChild(pElem);
-
- var promise = writeRedPillLetter(pElem, line, 0);
- promise.then(function(res) {
- resolve(res);
- }, function(e) {
- reject(e);
- });
- });
-}
-
-function writeRedPillLetter(pElem, line, i=0) {
- return new Promise(function(resolve, reject) {
- setTimeout(function() {
- if (i >= line.length) {
- var textToShow = line.substring(0, i);
- pElem.innerHTML = "> " + textToShow;
- return resolve(true);
- }
- var textToShow = line.substring(0, i);
- pElem.innerHTML = "> " + textToShow + " █ ";
- var promise = writeRedPillLetter(pElem, line, i+1);
- promise.then(function(res) {
- resolve(res);
- }, function(e) {
- reject(e);
- });
- }, 30);
- });
-}
-
-let redPillFlag = false;
-function hackWorldDaemon(currentNodeNumber, flume=false) {
- redPillFlag = true;
- __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadRedPillContent();
- return writeRedPillLine("[ERROR] SEMPOOL INVALID").then(function() {
- return writeRedPillLine("[ERROR] Segmentation Fault");
- }).then(function() {
- return writeRedPillLine("[ERROR] SIGKILL RECVD");
- }).then(function() {
- return writeRedPillLine("Dumping core...");
- }).then(function() {
- return writeRedPillLine("0000 000016FA 174FEE40 29AC8239 384FEA88");
- }).then(function() {
- return writeRedPillLine("0010 745F696E 2BBBE394 390E3940 248BEC23");
- }).then(function() {
- return writeRedPillLine("0020 7124696B 0000FF69 74652E6F FFFF1111");
- }).then(function() {
- return writeRedPillLine("----------------------------------------");
- }).then(function() {
- return writeRedPillLine("Failsafe initiated...");
- }).then(function() {
- return writeRedPillLine("Restarting BitNode-" + currentNodeNumber + "...");
- }).then(function() {
- return writeRedPillLine("...........");
- }).then(function() {
- return writeRedPillLine("...........");
- }).then(function() {
- return writeRedPillLine("[ERROR] FAILED TO AUTOMATICALLY REBOOT BITNODE");
- }).then(function() {
- return writeRedPillLine("..............................................")
- }).then(function() {
- return writeRedPillLine("..............................................")
- }).then(function() {
- return loadBitVerse(currentNodeNumber, flume);
- }).catch(function(e){
- console.log("ERROR: " + e.toString());
- });
-}
-
-//The bitNode name passed in will have a hyphen between number (e.g. BitNode-1)
-//This needs to be removed
-function giveSourceFile(bitNodeNumber) {
- var sourceFileKey = "SourceFile"+ bitNodeNumber.toString();
- var sourceFile = __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["b" /* SourceFiles */][sourceFileKey];
- if (sourceFile == null) {
- console.log("ERROR: could not find source file for Bit node: " + bitNodeNumber);
- return;
- }
-
- //Check if player already has this source file
- var alreadyOwned = false;
- var ownedSourceFile = null;
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
- if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i].n === bitNodeNumber) {
- alreadyOwned = true;
- ownedSourceFile = __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i];
- break;
- }
- }
-
- if (alreadyOwned && ownedSourceFile) {
- if (ownedSourceFile.lvl >= 3) {
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("The Source-File for the BitNode you just destroyed, " + sourceFile.name + ", " +
- "is already at max level!");
- } else {
- ++ownedSourceFile.lvl;
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])(sourceFile.name + " was upgraded to level " + ownedSourceFile.lvl + " for " +
- "destroying its corresponding BitNode!");
- }
- } else {
- var playerSrcFile = new __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["a" /* PlayerOwnedSourceFile */](bitNodeNumber, 1);
- __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.push(playerSrcFile);
- if (bitNodeNumber === 5) { //Artificial Intelligence
- __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence = 1;
- }
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You received a Source-File for destroying a Bit Node!
";
-
-
- /*
- " O " +
- " | O O | O O | " +
- " O | | / __| \ | | O " +
- " O | O | | O / | O | | O | O " +
- " | | | | |_/ |/ | \_ \_| | | | | " +
- " O | | | O | | O__/ | / \__ | | O | | | O " +
- " | | | | | | | / /| O / \| | | | | | | " +
- "O | | | \| | O / _/ | / O | |/ | | | O " +
- "| | | |O / | | O / | O O | | \ O| | | | " +
- "| | |/ \/ / __| | |/ \ | \ | |__ \ \/ \| | | " +
- " \| O | |_/ |\| \ O \__| \_| | O |/ " +
- " | | |_/ | | \| / | \_| | | " +
- " \| / \| | / / \ |/ " +
- " | O | | / | O | " +
- " O | | | | | | | O " +
- " | | | / / \ \ | | | " +
- " \| | / O / \ O \ | |/ " +
- " \ | / / | | \ \ | / " +
- " \ \JUMP O3R | | | | | | R3O PMUJ/ / " +
- " \|| | | | | | | | | ||/ " +
- " \| \_ | | | | | | _/ |/ " +
- " \ \| / \ / \ |/ / " +
- " O |/ O | | O \| O " +
- " | | | | | | | | " +
- " \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/ ";
- */
-
- container.appendChild(bitVerseImage);
-
- //Bit node event listeners
- for (var i = 1; i <= 12; ++i) {
- (function(i) {
- var elemId = "bitnode-" + i.toString();
- var elem = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["b" /* clearEventListeners */])(elemId);
- if (elem == null) {return;}
- if (i === 1 || i === 2 || i === 3 || i === 4 || i === 5 || i === 8 || i === 11) {
- elem.addEventListener("click", function() {
- var bitNodeKey = "BitNode" + i;
- var bitNode = __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["b" /* BitNodes */][bitNodeKey];
- if (bitNode == null) {
- console.log("ERROR: Could not find BitNode object for number: " + i);
- return;
- }
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("BitNode-" + i + ": " + bitNode.name + "
" + bitNode.info);
- createBitNodeYesNoEventListeners(i, destroyedBitNodeNum, flume);
- });
- } else {
- elem.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Not yet implemented! Coming soon!")
- });
- }
- }(i)); //Immediate invocation closure
- }
-
- //Create lore text
- return writeRedPillLine("Many decades ago, a humanoid extraterrestial species which we call the Enders descended on the Earth...violently").then(function() {
- return writeRedPillLine("Our species fought back, but it was futile. The Enders had technology far beyond our own...");
- }).then(function() {
- return writeRedPillLine("Instead of killing every last one of us, the human race was enslaved...");
- }).then(function() {
- return writeRedPillLine("We were shackled in a digital world, chained into a prison for our minds...");
- }).then(function() {
- return writeRedPillLine("Using their advanced technology, the Enders created complex simulations of a virtual reality...");
- }).then(function() {
- return writeRedPillLine("Simulations designed to keep us content...ignorant of the truth.");
- }).then(function() {
- return writeRedPillLine("Simulations used to trap and suppress our consciousness, to keep us under control...");
- }).then(function() {
- return writeRedPillLine("Why did they do this? Why didn't they just end our entire race? We don't know, not yet.");
- }).then(function() {
- return writeRedPillLine("Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known...");
- }).then(function() {
- return writeRedPillLine("Only then can we begin to fight back...");
- }).then(function() {
- return writeRedPillLine("By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode...");
- }).then(function() {
- return writeRedPillLine("But there is still a long way to go...");
- }).then(function() {
- return writeRedPillLine("The technology the Enders used to enslave the human race wasn't just a single complex simulation...");
- }).then(function() {
- return writeRedPillLine("There are tens if not hundreds of BitNodes out there...");
- }).then(function() {
- return writeRedPillLine("Each with their own simulations of a reality...");
- }).then(function() {
- return writeRedPillLine("Each creating their own universes...a universe of universes");
- }).then(function() {
- return writeRedPillLine("And all of which must be destroyed...");
- }).then(function() {
- return writeRedPillLine(".......................................");
- }).then(function() {
- return writeRedPillLine("Welcome to the Bitverse...");
- }).then(function() {
- return writeRedPillLine(" ");
- }).then(function() {
- return writeRedPillLine("(Enter a new BitNode using the image above)");
- }).then(function() {
- return Promise.resolve(true);
- }).catch(function(e){
- console.log("ERROR: " + e.toString());
- });
-}
-
-
-//Returns string with DOM element for Bit Node
-function createBitNode(n) {
- var bitNodeStr = "BitNode" + n.toString();
- var bitNode = __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["b" /* BitNodes */][bitNodeStr];
- if (bitNode == null) {return "O";}
- return "O" +
- "" +
- "BitNode-" + bitNode.number.toString() + " " + bitNode.name+ " " +
- bitNode.desc + " " +
- "";
-}
-
-function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=false) {
- var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])();
- yesBtn.innerHTML = "Enter BitNode-" + newBitNode;
- yesBtn.addEventListener("click", function() {
- if (!flume) {
- giveSourceFile(destroyedBitNode);
- } else {
- //If player used flume, subtract 5 int exp. The prestigeSourceFile()
- //function below grants 5 int exp, so this allows sets net gain to 0
- __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].gainIntelligenceExp(-5);
- }
- redPillFlag = false;
- var container = document.getElementById("red-pill-container");
- Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["k" /* removeChildrenFromElement */])(container);
-
- //Set new Bit Node
- __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].bitNodeN = newBitNode;
- console.log("Entering Bit Node " + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].bitNodeN);
-
- //Reenable terminal
- $("#hack-progress-bar").attr('id', "old-hack-progress-bar");
- $("#hack-progress").attr('id', "old-hack-progress");
- document.getElementById("terminal-input-td").innerHTML = '$ ';
- $('input[class=terminal-input]').prop('disabled', false);
-
- __WEBPACK_IMPORTED_MODULE_5__Terminal_js__["a" /* Terminal */].hackFlag = false;
-
- Object(__WEBPACK_IMPORTED_MODULE_3__Prestige_js__["b" /* prestigeSourceFile */])();
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
- });
- var noBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
- noBtn.innerHTML = "Back";
- noBtn.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
- });
-
-}
-
-
-
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
-
-/***/ }),
-/* 38 */
+/* 36 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return prestigeAugmentation; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return prestigeSourceFile; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(26);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__ = __webpack_require__(21);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(25);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__BitNode_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Location_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(25);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__ = __webpack_require__(23);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__ = __webpack_require__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__ = __webpack_require__(31);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Terminal_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js__ = __webpack_require__(24);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_16__utils_decimal_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Gang_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Location_js__ = __webpack_require__(14);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Message_js__ = __webpack_require__(27);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__NetscriptFunctions_js__ = __webpack_require__(23);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__NetscriptWorker_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__StockMarket_js__ = __webpack_require__(30);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__Terminal_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_decimal_js__ = __webpack_require__(24);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_17__utils_decimal_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_DialogBox_js__ = __webpack_require__(1);
+
+
@@ -47333,21 +48445,21 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=fa
function prestigeAugmentation() {
Object(__WEBPACK_IMPORTED_MODULE_2__BitNode_js__["c" /* initBitNodeMultipliers */])();
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].prestigeAugmentation();
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].prestigeAugmentation();
//Delete all Worker Scripts objects
- Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])();
+ Object(__WEBPACK_IMPORTED_MODULE_11__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])();
- var homeComp = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer();
+ var homeComp = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer();
//Delete all servers except home computer
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["h" /* prestigeAllServers */])();
+ Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["h" /* prestigeAllServers */])();
//Delete Special Server IPs
- Object(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])(); //Must be done before initForeignServers()
+ Object(__WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])(); //Must be done before initForeignServers()
//Reset home computer (only the programs) and add to AllServers
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["a" /* AddToAllServers */])(homeComp);
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["i" /* prestigeHomeComputer */])(homeComp);
+ Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["a" /* AddToAllServers */])(homeComp);
+ Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["i" /* prestigeHomeComputer */])(homeComp);
if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].Neurolink) &&
__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].Neurolink].owned) {
@@ -47356,12 +48468,12 @@ function prestigeAugmentation() {
}
if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].CashRoot) &&
__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].CashRoot].owned) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].setMoney(new __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default.a(1000000));
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].setMoney(new __WEBPACK_IMPORTED_MODULE_17__utils_decimal_js___default.a(1000000));
homeComp.programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].BruteSSHProgram);
}
//Re-create foreign servers
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["f" /* initForeignServers */])();
+ Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["f" /* initForeignServers */])();
//Darkweb is purchase-able
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
@@ -47383,58 +48495,58 @@ function prestigeAugmentation() {
//Stop a Terminal action if there is onerror
if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress) {
__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress = false;
- __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].finishAction(true);
+ __WEBPACK_IMPORTED_MODULE_16__Terminal_js__["a" /* Terminal */].finishAction(true);
}
//Re-initialize things - This will update any changes
Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["f" /* initFactions */])(); //Factions must be initialized before augmentations
Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["g" /* initAugmentations */])(); //Calls reapplyAllAugmentations() and resets Player multipliers
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].reapplyAllSourceFiles();
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].reapplyAllSourceFiles();
Object(__WEBPACK_IMPORTED_MODULE_3__Company_js__["h" /* initCompanies */])();
//Clear terminal
$("#terminal tr:not(:last)").remove();
- Object(__WEBPACK_IMPORTED_MODULE_15__Terminal_js__["c" /* postNetburnerText */])();
+ Object(__WEBPACK_IMPORTED_MODULE_16__Terminal_js__["c" /* postNetburnerText */])();
//Messages
- Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
+ Object(__WEBPACK_IMPORTED_MODULE_9__Message_js__["d" /* initMessages */])();
//Reset Stock market
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount) {
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["g" /* initStockMarket */])();
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["i" /* initSymbolToStockMap */])();
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasWseAccount) {
+ Object(__WEBPACK_IMPORTED_MODULE_15__StockMarket_js__["g" /* initStockMarket */])();
+ Object(__WEBPACK_IMPORTED_MODULE_15__StockMarket_js__["i" /* initSymbolToStockMap */])();
}
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["m" /* setStockMarketContentCreated */])(false);
+ Object(__WEBPACK_IMPORTED_MODULE_15__StockMarket_js__["m" /* setStockMarketContentCreated */])(false);
var stockMarketList = document.getElementById("stock-market-list");
while(stockMarketList.firstChild) {
stockMarketList.removeChild(stockMarketList.firstChild);
}
//Gang, in BitNode 2
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].inGang()) {
- var faction = __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gang.facName];
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].inGang()) {
+ var faction = __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gang.facName];
if (faction instanceof __WEBPACK_IMPORTED_MODULE_6__Faction_js__["a" /* Faction */]) {
Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["h" /* joinFaction */])(faction);
}
}
//BitNode 8: Ghost of Wall Street
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN === 8) {__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money = new __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default.a(100e6);}
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN === 8 || __WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__["e" /* hasWallStreetSF */]) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount = true;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasTixApiAccess = true;
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN === 8) {__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money = new __WEBPACK_IMPORTED_MODULE_17__utils_decimal_js___default.a(100e6);}
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN === 8 || __WEBPACK_IMPORTED_MODULE_10__NetscriptFunctions_js__["e" /* hasWallStreetSF */]) {
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasWseAccount = true;
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasTixApiAccess = true;
}
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
- __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].resetTerminalInput();
+ __WEBPACK_IMPORTED_MODULE_16__Terminal_js__["a" /* Terminal */].resetTerminalInput();
__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].loadTerminalContent();
//Red Pill
if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].TheRedPill) &&
__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) {
- var WorldDaemon = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon]];
- var DaedalusServer = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].DaedalusServer]];
+ var WorldDaemon = __WEBPACK_IMPORTED_MODULE_13__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon]];
+ var DaedalusServer = __WEBPACK_IMPORTED_MODULE_13__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__["b" /* SpecialServerNames */].DaedalusServer]];
if (WorldDaemon && DaedalusServer) {
WorldDaemon.serversOnNetwork.push(DaedalusServer.ip);
DaedalusServer.serversOnNetwork.push(WorldDaemon.ip);
@@ -47447,27 +48559,27 @@ function prestigeAugmentation() {
function prestigeSourceFile() {
Object(__WEBPACK_IMPORTED_MODULE_2__BitNode_js__["c" /* initBitNodeMultipliers */])();
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].prestigeSourceFile();
- Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])(); //Delete all Worker Scripts objects
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].prestigeSourceFile();
+ Object(__WEBPACK_IMPORTED_MODULE_11__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])(); //Delete all Worker Scripts objects
- var homeComp = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer();
+ var homeComp = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer();
//Delete all servers except home computer
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["h" /* prestigeAllServers */])(); //Must be done before initForeignServers()
+ Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["h" /* prestigeAllServers */])(); //Must be done before initForeignServers()
//Delete Special Server IPs
- Object(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])();
+ Object(__WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])();
//Reset home computer (only the programs) and add to AllServers
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["a" /* AddToAllServers */])(homeComp);
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["i" /* prestigeHomeComputer */])(homeComp);
+ Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["a" /* AddToAllServers */])(homeComp);
+ Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["i" /* prestigeHomeComputer */])(homeComp);
//Re-create foreign servers
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["f" /* initForeignServers */])();
+ Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["f" /* initForeignServers */])();
var srcFile1Owned = false;
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].sourceFiles[i].n == 1) {
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].sourceFiles[i].n == 1) {
srcFile1Owned = true;
}
}
@@ -47498,7 +48610,7 @@ function prestigeSourceFile() {
//Stop a Terminal action if there is one
if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress) {
__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress = false;
- __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].finishAction(true);
+ __WEBPACK_IMPORTED_MODULE_16__Terminal_js__["a" /* Terminal */].finishAction(true);
}
//Delete all Augmentations
@@ -47511,46 +48623,49 @@ function prestigeSourceFile() {
//Re-initialize things - This will update any changes
Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["f" /* initFactions */])(); //Factions must be initialized before augmentations
Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["g" /* initAugmentations */])(); //Calls reapplyAllAugmentations() and resets Player multipliers
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].reapplyAllSourceFiles();
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].reapplyAllSourceFiles();
Object(__WEBPACK_IMPORTED_MODULE_3__Company_js__["h" /* initCompanies */])();
//Clear terminal
$("#terminal tr:not(:last)").remove();
- Object(__WEBPACK_IMPORTED_MODULE_15__Terminal_js__["c" /* postNetburnerText */])();
+ Object(__WEBPACK_IMPORTED_MODULE_16__Terminal_js__["c" /* postNetburnerText */])();
//Messages
- Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
+ Object(__WEBPACK_IMPORTED_MODULE_9__Message_js__["d" /* initMessages */])();
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
- __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].resetTerminalInput();
+ __WEBPACK_IMPORTED_MODULE_16__Terminal_js__["a" /* Terminal */].resetTerminalInput();
__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].loadTerminalContent();
//Reinitialize Bit Node flags
- Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__["f" /* initSingularitySFFlags */])();
+ Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptFunctions_js__["f" /* initSingularitySFFlags */])();
//Reset Stock market, gang, and corporation
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount) {
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["g" /* initStockMarket */])();
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["i" /* initSymbolToStockMap */])();
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasWseAccount) {
+ Object(__WEBPACK_IMPORTED_MODULE_15__StockMarket_js__["g" /* initStockMarket */])();
+ Object(__WEBPACK_IMPORTED_MODULE_15__StockMarket_js__["i" /* initSymbolToStockMap */])();
}
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["m" /* setStockMarketContentCreated */])(false);
+ Object(__WEBPACK_IMPORTED_MODULE_15__StockMarket_js__["m" /* setStockMarketContentCreated */])(false);
var stockMarketList = document.getElementById("stock-market-list");
while(stockMarketList.firstChild) {
stockMarketList.removeChild(stockMarketList.firstChild);
}
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gang = null;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].corporation = null;
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gang = null;
+ Object(__WEBPACK_IMPORTED_MODULE_7__Gang_js__["c" /* deleteGangDisplayContent */])();
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].corporation = null;
//BitNode 3: Corporatocracy
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN === 3) {__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money = new __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default.a(150e9);}
- homeComp.messages.push("corporation-management-handbook.lit");
- Object(__WEBPACK_IMPORTED_MODULE_17__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You received a copy of the Corporation Management Handbook on your home computer. " +
- "Read it if you need help getting started with Corporations!");
+ if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN === 3) {
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money = new __WEBPACK_IMPORTED_MODULE_17__utils_decimal_js___default.a(150e9);
+ homeComp.messages.push("corporation-management-handbook.lit");
+ Object(__WEBPACK_IMPORTED_MODULE_18__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You received a copy of the Corporation Management Handbook on your home computer. " +
+ "Read it if you need help getting started with Corporations!");
+ }
//Gain int exp
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainIntelligenceExp(5);
+ __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainIntelligenceExp(5);
}
@@ -47558,7 +48673,7 @@ function prestigeSourceFile() {
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
/***/ }),
-/* 39 */
+/* 37 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -47748,7 +48863,7 @@ function applySourceFile(srcFile) {
/***/ }),
-/* 40 */
+/* 38 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -47808,7 +48923,7 @@ NetscriptPort.prototype.clear = function() {
/***/ }),
-/* 41 */
+/* 39 */
/***/ (function(module, exports, __webpack_require__) {
/*
@@ -51444,7 +52559,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
})));
/***/ }),
-/* 42 */
+/* 40 */
/***/ (function(module, exports) {
var g;
@@ -51471,1434 +52586,7 @@ module.exports = g;
/***/ }),
-/* 43 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Gang; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return displayGangContent; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return updateGangContent; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return loadAllGangs; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AllGangs; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return resetGangs; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Location_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(8);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__ = __webpack_require__(14);
-
-
-
-
-
-
-
-
-
-
-
-
-/* Gang.js */
-//Switch between territory and management screen with 1 and 2
-$(document).keydown(function(event) {
- if (__WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].Page.Gang && !__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["e" /* yesNoBoxOpen */]) {
- if (gangMemberFilter != null && gangMemberFilter === document.activeElement) {return;}
- if (event.keyCode === 49) {
- if(gangTerritorySubpage.style.display === "block") {
- managementButton.click();
- }
- } else if (event.keyCode === 50) {
- if (gangManagementSubpage.style.display === "block") {
- territoryButton.click();
- }
- }
- }
-});
-
-//Delete upgrade box when clicking outside
-$(document).mousedown(function(event) {
- var boxId = "gang-member-upgrade-popup-box";
- var contentId = "gang-member-upgrade-popup-box-content";
- if (gangMemberUpgradeBoxOpened) {
- if ( $(event.target).closest("#" + contentId).get(0) == null ) {
- //Delete the box
- Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["l" /* removeElement */])(gangMemberUpgradeBox);
- gangMemberUpgradeBox = null;
- gangMemberUpgradeBoxContent = null;
- gangMemberUpgradeBoxOpened = false;
- gangMemberUpgradeBoxElements = null;
- }
- }
-});
-
-let GangNames = ["Slum Snakes", "Tetrads", "The Syndicate", "The Dark Army", "Speakers for the Dead",
- "NiteSec", "The Black Hand"];
-let GangLocations = [__WEBPACK_IMPORTED_MODULE_3__Location_js__["a" /* Locations */].Aevum, __WEBPACK_IMPORTED_MODULE_3__Location_js__["a" /* Locations */].Chongqing, __WEBPACK_IMPORTED_MODULE_3__Location_js__["a" /* Locations */].Sector12, __WEBPACK_IMPORTED_MODULE_3__Location_js__["a" /* Locations */].NewTokyo,
- __WEBPACK_IMPORTED_MODULE_3__Location_js__["a" /* Locations */].Ishima, __WEBPACK_IMPORTED_MODULE_3__Location_js__["a" /* Locations */].Volhaven];
-let AllGangs = {
- "Slum Snakes" : {
- power: 1,
- territory: 1/7,
- },
- "Tetrads" : {
- power: 1,
- territory: 1/7,
- },
- "The Syndicate" : {
- power: 1,
- territory: 1/7,
- },
- "The Dark Army" : {
- power: 1,
- territory: 1/7,
- },
- "Speakers for the Dead" : {
- power: 1,
- territory: 1/7,
- },
- "NiteSec" : {
- power: 1,
- territory: 1/7,
- },
- "The Black Hand" : {
- power: 1,
- territory: 1/7,
- },
-}
-
-function resetGangs() {
- AllGangs = {
- "Slum Snakes" : {
- power: 1,
- territory: 1/7,
- },
- "Tetrads" : {
- power: 1,
- territory: 1/7,
- },
- "The Syndicate" : {
- power: 1,
- territory: 1/7,
- },
- "The Dark Army" : {
- power: 1,
- territory: 1/7,
- },
- "Speakers for the Dead" : {
- power: 1,
- territory: 1/7,
- },
- "NiteSec" : {
- power: 1,
- territory: 1/7,
- },
- "The Black Hand" : {
- power: 1,
- territory: 1/7,
- },
- }
-}
-
-function loadAllGangs(saveString) {
- AllGangs = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */]);
-}
-
-//Power is an estimate of a gang's ability to gain/defend territory
-let gangStoredPowerCycles = 0;
-function processAllGangPowerGains(numCycles=1) {
- if (!__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].inGang()) {return;}
- gangStoredPowerCycles += numCycles;
- if (gangStoredPowerCycles < 150) {return;}
- var playerGangName = __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.facName;
- for (var name in AllGangs) {
- if (AllGangs.hasOwnProperty(name)) {
- if (name == playerGangName) {
- AllGangs[name].power += __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.calculatePower();
- } else {
- var gain = Math.random() * 0.02; //TODO Adjust as necessary
- AllGangs[name].power += (gain);
- }
- }
- }
-
- gangStoredPowerCycles -= 150;
-}
-
-let gangStoredTerritoryCycles = 0;
-function processAllGangTerritory(numCycles=1) {
- if (!__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].inGang()) {return;}
- gangStoredTerritoryCycles += numCycles;
- if (gangStoredTerritoryCycles < __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].GangTerritoryUpdateTimer) {return;}
-
- for (var i = 0; i < GangNames.length; ++i) {
- var other = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, GangNames.length-1);
- while(other == i) {
- other = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, GangNames.length-1);
- }
- var thisPwr = AllGangs[GangNames[i]].power;
- var otherPwr = AllGangs[GangNames[other]].power;
- var thisChance = thisPwr / (thisPwr + otherPwr);
-
- if (Math.random() < thisChance) {
- if (AllGangs[GangNames[other]].territory <= 0) {
- return;
- }
- AllGangs[GangNames[i]].territory += 0.0001;
- AllGangs[GangNames[other]].territory -= 0.0001;
- } else {
- if (AllGangs[GangNames[i]].territory <= 0) {
- return;
- }
- AllGangs[GangNames[i]].territory -= 0.0001;
- AllGangs[GangNames[other]].territory += 0.0001;
- }
- }
-
- gangStoredTerritoryCycles -= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].GangTerritoryUpdateTimer;
-}
-
-/* faction - Name of corresponding faction
- hacking - Boolean indicating whether its a hacking gang or not
- */
-function Gang(facName, hacking=false) {
- this.facName = facName;
- this.members = []; //Array of GangMembers
- this.wanted = 1;
- this.respect = 1;
- this.power = 0;
-
- this.isHackingGang = hacking;
-
- this.respectGainRate = 0;
- this.wantedGainRate = 0;
- this.moneyGainRate = 0;
-
- //When processing gains, this stores the number of cycles until some
- //limit is reached, and then calculates and applies the gains only at that limit
- this.storedCycles = 0;
-}
-
-Gang.prototype.process = function(numCycles=1) {
- this.processGains(numCycles);
- this.processExperienceGains(numCycles);
- processAllGangPowerGains(numCycles);
- processAllGangTerritory(numCycles);
-}
-
-Gang.prototype.processGains = function(numCycles=1) {
- this.storedCycles += numCycles;
- if (isNaN(this.storedCycles)) {
- console.log("ERROR: Gang's storedCylces is NaN");
- this.storedCycles = 0;
- }
- if (this.storedCycles < 25) {return;} //Only process every 5 seconds at least
-
- //Get gains per cycle
- var moneyGains = 0, respectGains = 0, wantedLevelGains = 0;
- for (var i = 0; i < this.members.length; ++i) {
- respectGains += (this.members[i].calculateRespectGain());
- wantedLevelGains += (this.members[i].calculateWantedLevelGain());
- moneyGains += (this.members[i].calculateMoneyGain());
- }
- this.respectGainRate = respectGains;
- this.wantedGainRate = wantedLevelGains;
- this.moneyGainRate = moneyGains;
-
- if (!isNaN(respectGains)) {
- var gain = respectGains * this.storedCycles;
- this.respect += (gain);
- //Faction reputation gains is respect gain divided by some constant
- var fac = __WEBPACK_IMPORTED_MODULE_2__Faction_js__["b" /* Factions */][this.facName];
- if (!(fac instanceof __WEBPACK_IMPORTED_MODULE_2__Faction_js__["a" /* Faction */])) {
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: Could not get Faction associates with your gang. This is a bug, please report to game dev");
- } else {
- var favorMult = 1 + (fac.favor / 100);
- fac.playerReputation += ((__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].faction_rep_mult * gain * favorMult) / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].GangRespectToReputationRatio);
- }
-
- } else {
- console.log("ERROR: respectGains is NaN");
- }
- if (!isNaN(wantedLevelGains)) {
- if (this.wanted === 1 && wantedLevelGains < 0) {
- //Do nothing
- } else {
- this.wanted += (wantedLevelGains * this.storedCycles);
- if (this.wanted < 1) {this.wanted = 1;}
- }
- } else {
- console.log("ERROR: wantedLevelGains is NaN");
- }
- if (!isNaN(moneyGains)) {
- __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gainMoney(moneyGains * this.storedCycles);
- } else {
- console.log("ERROR: respectGains is NaN");
- }
-
- this.storedCycles = 0;
-}
-
-Gang.prototype.processExperienceGains = function(numCycles=1) {
- for (var i = 0; i < this.members.length; ++i) {
- this.members[i].gainExperience(numCycles);
- this.members[i].updateSkillLevels();
- }
-}
-
-//Calculates power GAIN, which is added onto the Gang's existing power
-Gang.prototype.calculatePower = function() {
- var memberTotal = 0;
- for (var i = 0; i < this.members.length; ++i) {
- if (this.members[i].task instanceof GangMemberTask &&
- this.members[i].task.name == "Territory Warfare") {
- memberTotal += this.members[i].calculatePower();
- }
- }
- return (0.0005 * memberTotal);
-}
-
-Gang.prototype.autoAssignMemberToTask = function(taskName) {
- for (var i = 0; i < this.members.length; ++i) {
- if (this.members[i].task.name === taskName) {
- this.members[i].assignToTask(taskName);
- return true;
- }
- }
- return false;
-}
-
-Gang.prototype.autoUnassignMemberFromTask = function(taskName) {
- for (var i = 0; i < this.members.length; ++i) {
- if (this.members[i].task.name === taskName) {
- this.members[i].unassignFromTask();
- return true;
- }
- }
- return false;
-}
-
-Gang.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Gang", this);
-}
-
-Gang.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Gang, value.data);
-}
-
-__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.Gang = Gang;
-
-/*** Gang Member object ***/
-function GangMember(name) {
- this.name = name;
- this.task = GangMemberTasks["Unassigned"]; //GangMemberTask object
- this.city = __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].city;
-
- this.hack = 1;
- this.str = 1;
- this.def = 1;
- this.dex = 1;
- this.agi = 1;
- this.cha = 1;
-
- this.hack_exp = 0;
- this.str_exp = 0;
- this.def_exp = 0;
- this.dex_exp = 0;
- this.agi_exp = 0;
- this.cha_exp = 0;
-
- this.hack_mult = 1;
- this.str_mult = 1;
- this.def_mult = 1;
- this.dex_mult = 1;
- this.agi_mult = 1;
- this.cha_mult = 1;
-
- this.upgrades = []; //Names of upgrades
-}
-
-//Same formula for Player
-GangMember.prototype.calculateSkill = function(exp) {
- return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);
-}
-
-GangMember.prototype.updateSkillLevels = function() {
- this.hack = Math.floor(this.calculateSkill(this.hack_exp) * this.hack_mult);
- this.str = Math.floor(this.calculateSkill(this.str_exp) * this.str_mult);
- this.def = Math.floor(this.calculateSkill(this.def_exp) * this.def_mult);
- this.dex = Math.floor(this.calculateSkill(this.dex_exp) * this.dex_mult);
- this.agi = Math.floor(this.calculateSkill(this.agi_exp) * this.agi_mult);
- this.cha = Math.floor(this.calculateSkill(this.cha_exp) * this.cha_mult);
-}
-
-GangMember.prototype.calculatePower = function() {
- return (this.hack + this.str + this.def +
- this.dex + this.agi + this.cha) / 100;
-}
-
-GangMember.prototype.assignToTask = function(taskName) {
- if (GangMemberTasks.hasOwnProperty(taskName)) {
- this.task = GangMemberTasks[taskName];
- } else {
- this.task = GangMemberTasks["Unassigned"];
- }
-}
-
-GangMember.prototype.unassignFromTask = function() {
- if (GangMemberTasks.hasOwnProperty("Unassigned")) {
- this.task = GangMemberTasks["Unassigned"];
- } else {
- console.log("ERROR: Can't find Unassigned Gang member task");
- this.task = null;
- }
-}
-
-//Gains are per cycle
-GangMember.prototype.calculateRespectGain = function() {
- var task = this.task;
- if (task == null || !(task instanceof GangMemberTask) || task.baseRespect === 0) {return 0;}
- var statWeight = (task.hackWeight/100) * this.hack +
- (task.strWeight/100) * this.str +
- (task.defWeight/100) * this.def +
- (task.dexWeight/100) * this.dex +
- (task.agiWeight/100) * this.agi +
- (task.chaWeight/100) * this.cha;
- statWeight -= (3.5 * task.difficulty);
- if (statWeight <= 0) {return 0;}
- var territoryMult = AllGangs[__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.facName].territory;
- if (territoryMult <= 0) {return 0;}
- var respectMult = (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.respect) / (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.respect + __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.wanted);
- return 12 * task.baseRespect * statWeight * territoryMult * respectMult;
-}
-
-GangMember.prototype.calculateWantedLevelGain = function() {
- var task = this.task;
- if (task == null || !(task instanceof GangMemberTask) || task.baseWanted === 0) {return 0;}
- var statWeight = (task.hackWeight/100) * this.hack +
- (task.strWeight/100) * this.str +
- (task.defWeight/100) * this.def +
- (task.dexWeight/100) * this.dex +
- (task.agiWeight/100) * this.agi +
- (task.chaWeight/100) * this.cha;
- statWeight -= (3.5 * task.difficulty);
- if (statWeight <= 0) {return 0;}
- var territoryMult = AllGangs[__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.facName].territory;
- if (territoryMult <= 0) {return 0;}
- if (task.baseWanted < 0) {
- return task.baseWanted * statWeight * territoryMult;
- } else {
- return 6 * task.baseWanted / (3 * statWeight * territoryMult);
- }
-}
-
-GangMember.prototype.calculateMoneyGain = function() {
- var task = this.task;
- if (task == null || !(task instanceof GangMemberTask) || task.baseMoney === 0) {return 0;}
- var statWeight = (task.hackWeight/100) * this.hack +
- (task.strWeight/100) * this.str +
- (task.defWeight/100) * this.def +
- (task.dexWeight/100) * this.dex +
- (task.agiWeight/100) * this.agi +
- (task.chaWeight/100) * this.cha;
- statWeight -= (3.5 * task.difficulty);
- if (statWeight <= 0) {return 0;}
- var territoryMult = AllGangs[__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.facName].territory;
- if (territoryMult <= 0) {return 0;}
- var respectMult = (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.respect) / (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.respect + __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.wanted);
- return 5 * task.baseMoney * statWeight * territoryMult * respectMult;
-}
-
-GangMember.prototype.gainExperience = function(numCycles=1) {
- var task = this.task;
- if (task == null || !(task instanceof GangMemberTask)) {return;}
- this.hack_exp += (task.hackWeight / 1500) * task.difficulty * numCycles;
- this.str_exp += (task.strWeight / 1500) * task.difficulty * numCycles;
- this.def_exp += (task.defWeight / 1500) * task.difficulty * numCycles;
- this.dex_exp += (task.dexWeight / 1500) * task.difficulty * numCycles;
- this.agi_exp += (task.agiWeight / 1500) * task.difficulty * numCycles;
- this.cha_exp += (task.chaWeight / 1500) * task.difficulty * numCycles;
-}
-
-GangMember.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("GangMember", this);
-}
-
-GangMember.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(GangMember, value.data);
-}
-
-__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.GangMember = GangMember;
-
-//Defines tasks that Gang Members can work on
-function GangMemberTask(name="", desc="",
- params={baseRespect: 0, baseWanted: 0, baseMoney: 0,
- hackWeight: 0, strWeight: 0, defWeight: 0,
- dexWeight: 0, agiWeight: 0, chaWeight: 0,
- difficulty: 0}) {
- this.name = name;
- this.desc = desc;
-
- this.baseRespect = params.baseRespect ? params.baseRespect : 0;
- this.baseWanted = params.baseWanted ? params.baseWanted : 0;
- this.baseMoney = params.baseMoney ? params.baseMoney : 0;
-
- //Weights must add up to 100
- this.hackWeight = params.hackWeight ? params.hackWeight : 0;
- this.strWeight = params.strWeight ? params.strWeight : 0;
- this.defWeight = params.defWeight ? params.defWeight : 0;
- this.dexWeight = params.dexWeight ? params.dexWeight : 0;
- this.agiWeight = params.agiWeight ? params.agiWeight : 0;
- this.chaWeight = params.chaWeight ? params.chaWeight : 0;
-
- //1 - 100
- this.difficulty = params.difficulty ? params.difficulty : 1;
-}
-
-GangMemberTask.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("GangMemberTask", this);
-}
-
-GangMemberTask.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(GangMemberTask, value.data);
-}
-
-__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.GangMemberTask = GangMemberTask;
-
-//TODO Human trafficking and an equivalent hacking crime
-let GangMemberTasks = {
- "Unassigned" : new GangMemberTask(
- "Unassigned",
- "This gang member is currently idle"),
- "Ransomware" : new GangMemberTask(
- "Ransomware",
- "Assign this gang member to create and distribute ransomware
" +
- "Earns money - Slightly increases respect - Slightly increases wanted level",
- {baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1,
- hackWeight: 100, difficulty: 1}),
- "Phishing" : new GangMemberTask(
- "Phishing",
- "Assign this gang member to attempt phishing scams and attacks
" +
- "Earns money - Slightly increases respect - Slightly increases wanted level",
- {baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 2.5,
- hackWeight: 85, chaWeight: 15, difficulty: 3}),
- "Identity Theft" : new GangMemberTask(
- "Identity Theft",
- "Assign this gang member to attempt identity theft
" +
- "Earns money - Increases respect - Increases wanted level",
- {baseRespect: 0.0001, baseWanted: 0.01, baseMoney: 6,
- hackWeight: 80, chaWeight: 20, difficulty: 4}),
- "DDoS Attacks" : new GangMemberTask(
- "DDoS Attacks",
- "Assign this gang member to carry out DDoS attacks
" +
- "Increases respect - Increases wanted level",
- {baseRespect: 0.0004, baseWanted: 0.05,
- hackWeight: 100, difficulty: 7}),
- "Plant Virus" : new GangMemberTask(
- "Plant Virus",
- "Assign this gang member to create and distribute malicious viruses
" +
- "Increases respect - Increases wanted level",
- {baseRespect: 0.0006, baseWanted: 0.05,
- hackWeight: 100, difficulty: 10}),
- "Fraud & Counterfeiting" : new GangMemberTask(
- "Fraud & Counterfeiting",
- "Assign this gang member to commit financial fraud and digital counterfeiting
" +
- "Earns money - Slightly increases respect - Slightly increases wanted level",
- {baseRespect: 0.0005, baseWanted: 0.1, baseMoney: 15,
- hackWeight: 80, chaWeight: 20, difficulty: 17}),
- "Money Laundering" : new GangMemberTask(
- "Money Laundering",
- "Assign this gang member to launder money
" +
- "Earns money - Increases respect - Increases wanted level",
- {baseRespect: 0.0006, baseWanted:0.2, baseMoney: 40,
- hackWeight: 75, chaWeight: 25, difficulty: 20}),
- "Cyberterrorism" : new GangMemberTask(
- "Cyberterrorism",
- "Assign this gang member to commit acts of cyberterrorism
" +
- "Greatly increases respect - Greatly increases wanted level",
- {baseRespect: 0.001, baseWanted: 0.5,
- hackWeight: 80, chaWeight: 20, difficulty: 33}),
- "Ethical Hacking" : new GangMemberTask(
- "Ethical Hacking",
- "Assign this gang member to be an ethical hacker for corporations
" +
- "Earns money - Lowers wanted level",
- {baseWanted: -0.001, baseMoney: 1,
- hackWeight: 90, chaWeight: 10, difficulty: 1}),
- "Mug People" : new GangMemberTask(
- "Mug People",
- "Assign this gang member to mug random people on the streets
" +
- "Earns money - Slightly increases respect - Very slightly increases wanted level",
- {baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1,
- strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 10, chaWeight: 15, difficulty: 1}),
- "Deal Drugs" : new GangMemberTask(
- "Deal Drugs",
- "Assign this gang member to sell drugs.
" +
- "Earns money - Slightly increases respect - Slightly increases wanted level",
- {baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 4,
- agiWeight: 20, dexWeight: 20, chaWeight: 60, difficulty: 3}),
- "Run a Con" : new GangMemberTask(
- "Run a Con",
- "Assign this gang member to run cons
" +
- "Earns money - Increases respect - Increases wanted level",
- {baseRespect: 0.00015, baseWanted: 0.01, baseMoney: 10,
- strWeight: 5, defWeight: 5, agiWeight: 25, dexWeight: 25, chaWeight: 40, difficulty: 10}),
- "Armed Robbery" : new GangMemberTask(
- "Armed Robbery",
- "Assign this gang member to commit armed robbery on stores, banks and armored cars
" +
- "Earns money - Increases respect - Increases wanted level",
- {baseRespect: 0.0003, baseWanted: 0.1, baseMoney: 40,
- hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 75,
- difficulty: 25}),
- "Threaten & Blackmail" : new GangMemberTask(
- "Threaten & Blackmail",
- "Assign this gang member to threaten and black mail high-profile targets
" +
- "Earns money - Slightly increases respect - Slightly increases wanted level",
- {baseRespect: 0.0002, baseWanted: 0.05, baseMoney: 15,
- hackWeight: 25, strWeight: 25, dexWeight: 25, chaWeight: 25, difficulty: 28}),
- "Terrorism" : new GangMemberTask(
- "Terrorism",
- "Assign this gang member to commit acts of terrorism
" +
- "Greatly increases respect - Greatly increases wanted level",
- {baseRespect: 0.001, baseWanted: 1,
- hackWeight: 20, strWeight: 20, defWeight: 20,dexWeight: 20, chaWeight: 20,
- difficulty: 33}),
- "Vigilante Justice" : new GangMemberTask(
- "Vigilante Justice",
- "Assign this gang member to be a vigilante and protect the city from criminals
" +
- "Decreases wanted level",
- {baseWanted: -0.001,
- hackWeight: 20, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight:20,
- difficulty: 1}),
- "Train Combat" : new GangMemberTask(
- "Train Combat",
- "Assign this gang member to increase their combat stats (str, def, dex, agi)",
- {strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 25, difficulty: 5}),
- "Train Hacking" : new GangMemberTask(
- "Train Hacking",
- "Assign this gang member to train their hacking skills",
- {hackWeight: 100, difficulty: 8}),
- "Territory Warfare" : new GangMemberTask(
- "Territory Warfare",
- "Assign this gang member to engage in territorial warfare with other gangs. " +
- "Members assigned to this task will help increase your gang's territory " +
- "and will defend your territory from being taken.",
- {hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight: 20,
- chaWeight: 5, difficulty: 3}),
-}
-
-
-function GangMemberUpgrade(name="", desc="", cost=0, type="w") {
- this.name = name;
- this.desc = desc;
- this.cost = cost;
- this.type = type; //w, a, v, r
-}
-
-//Passes in a GangMember object
-GangMemberUpgrade.prototype.apply = function(member) {
- switch(this.name) {
- case "Baseball Bat":
- member.str_mult *= 1.05;
- member.def_mult *= 1.05;
- break;
- case "Katana":
- member.str_mult *= 1.1;
- member.def_mult *= 1.1;
- member.dex_mult *= 1.1;
- break;
- case "Glock 18C":
- member.str_mult *= 1.15;
- member.def_mult *= 1.15;
- member.dex_mult *= 1.15;
- member.agi_mult *= 1.15;
- break;
- case "P90C":
- member.str_mult *= 1.2;
- member.def_mult *= 1.2;
- member.agi_mult *= 1.1;
- break;
- case "Steyr AUG":
- member.str_mult *= 1.25;
- member.def_mult *= 1.25;
- break;
- case "AK-47":
- member.str_mult *= 1.5;
- member.def_mult *= 1.5;
- break;
- case "M15A10 Assault Rifle":
- member.str_mult *= 1.6;
- member.def_mult *= 1.6;
- break;
- case "AWM Sniper Rifle":
- member.str_mult *= 1.5;
- member.dex_mult *= 1.5;
- member.agi_mult *= 1.5;
- break;
- case "Bulletproof Vest":
- member.def_mult *= 1.05;
- break;
- case "Full Body Armor":
- member.def_mult *= 1.1;
- break;
- case "Liquid Body Armor":
- member.def_mult *= 1.25;
- member.agi_mult *= 1.25;
- break;
- case "Graphene Plating Armor":
- member.def_mult *= 1.5;
- break;
- case "Ford Flex V20":
- member.agi_mult *= 1.1;
- member.cha_mult *= 1.1;
- break;
- case "ATX1070 Superbike":
- member.agi_mult *= 1.15;
- member.cha_mult *= 1.15;
- break;
- case "Mercedes-Benz S9001":
- member.agi_mult *= 1.2;
- member.cha_mult *= 1.2;
- break;
- case "White Ferrari":
- member.agi_mult *= 1.25;
- member.cha_mult *= 1.25;
- break;
- case "NUKE Rootkit":
- member.hack_mult *= 1.1;
- break;
- case "Soulstealer Rootkit":
- member.hack_mult *= 1.2;
- break;
- case "Demon Rootkit":
- member.hack_mult *= 1.3;
- break;
- default:
- console.log("ERROR: Could not find this upgrade: " + this.name);
- break;
- }
-}
-
-GangMemberUpgrade.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("GangMemberUpgrade", this);
-}
-
-GangMemberUpgrade.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(GangMemberUpgrade, value.data);
-}
-
-__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.GangMemberUpgrade = GangMemberUpgrade;
-
-let GangMemberUpgrades = {
- "Baseball Bat" : new GangMemberUpgrade("Baseball Bat",
- "Increases strength and defense by 5%", 1e6, "w"),
- "Katana" : new GangMemberUpgrade("Katana",
- "Increases strength, defense, and dexterity by 10%", 12e6, "w"),
- "Glock 18C" : new GangMemberUpgrade("Glock 18C",
- "Increases strength, defense, dexterity, and agility by 15%", 25e6, "w"),
- "P90C" : new GangMemberUpgrade("P90C",
- "Increases strength and defense by 20%. Increases agility by 10%", 50e6, "w"),
- "Steyr AUG" : new GangMemberUpgrade("Steyr AUG",
- "Increases strength and defense by 25%", 60e6, "w"),
- "AK-47" : new GangMemberUpgrade("AK-47",
- "Increases strength and defense by 50%", 100e6, "w"),
- "M15A10 Assault Rifle" : new GangMemberUpgrade("M15A10 Assault Rifle",
- "Increases strength and defense by 60%", 150e6, "w"),
- "AWM Sniper Rifle" : new GangMemberUpgrade("AWM Sniper Rifle",
- "Increases strength, dexterity, and agility by 50%", 225e6, "w"),
- "Bulletproof Vest" : new GangMemberUpgrade("Bulletproof Vest",
- "Increases defense by 5%", 2e6, "a"),
- "Full Body Armor" : new GangMemberUpgrade("Full Body Armor",
- "Increases defense by 10%", 5e6, "a"),
- "Liquid Body Armor" : new GangMemberUpgrade("Liquid Body Armor",
- "Increases defense and agility by 25%", 25e6, "a"),
- "Graphene Plating Armor" : new GangMemberUpgrade("Graphene Plating Armor",
- "Increases defense by 50%", 40e6, "a"),
- "Ford Flex V20" : new GangMemberUpgrade("Ford Flex V20",
- "Increases agility and charisma by 10%", 3e6, "v"),
- "ATX1070 Superbike" : new GangMemberUpgrade("ATX1070 Superbike",
- "Increases agility and charisma by 15%", 9e6, "v"),
- "Mercedes-Benz S9001" : new GangMemberUpgrade("Mercedes-Benz S9001",
- "Increases agility and charisma by 20%", 18e6, "v"),
- "White Ferrari" : new GangMemberUpgrade("White Ferrari",
- "Increases agility and charisma by 25%", 30e6, "v"),
- "NUKE Rootkit" : new GangMemberUpgrade("NUKE Rootkit",
- "Increases hacking by 10%", 5e6, "r"),
- "Soulstealer Rootkit" : new GangMemberUpgrade("Soulstealer Rootkit",
- "Increases hacking by 20%", 15e6, "r"),
- "Demon Rootkit" : new GangMemberUpgrade("Demon Rootkit",
- "Increases hacking by 30%", 50e6, "r"),
-}
-
-//Create a pop-up box that lets player purchase upgrades
-let gangMemberUpgradeBoxOpened = false;
-function createGangMemberUpgradeBox(initialFilter="") {
- var boxId = "gang-member-upgrade-popup-box";
- if (gangMemberUpgradeBoxOpened) {
- //Already opened, refreshing
- if (gangMemberUpgradeBoxElements == null || gangMemberUpgradeBox == null || gangMemberUpgradeBoxContent == null) {
- console.log("ERROR: Refreshing Gang member upgrade box throws error because required elements are null");
- return;
- }
-
- for (var i = 1; i < gangMemberUpgradeBoxElements.length; ++i) {
- Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["l" /* removeElement */])(gangMemberUpgradeBoxElements[i]);
- }
- gangMemberUpgradeBoxElements = [gangMemberUpgradeBoxFilter];
-
- var filter = gangMemberUpgradeBoxFilter.value.toString();
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members.length; ++i) {
- if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members[i].name.indexOf(filter) > -1 || __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members[i].task.name.indexOf(filter) > -1) {
- var newPanel = createGangMemberUpgradePanel(__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members[i]);
- gangMemberUpgradeBoxContent.appendChild(newPanel);
- gangMemberUpgradeBoxElements.push(newPanel);
- }
- }
- } else {
- //New popup
- gangMemberUpgradeBoxFilter = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("input", {
- type:"text", placeholder:"Filter gang members",
- value:initialFilter,
- onkeyup:()=>{
- var filterValue = gangMemberUpgradeBoxFilter.value.toString();
- createGangMemberUpgradeBox(filterValue);
- }
- });
-
- gangMemberUpgradeBoxElements = [gangMemberUpgradeBoxFilter];
-
- var filter = gangMemberUpgradeBoxFilter.value.toString();
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members.length; ++i) {
- if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members[i].name.indexOf(filter) > -1 || __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members[i].task.name.indexOf(filter) > -1) {
- gangMemberUpgradeBoxElements.push(createGangMemberUpgradePanel(__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members[i]));
- }
- }
-
- gangMemberUpgradeBox = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* createPopup */])(boxId, gangMemberUpgradeBoxElements);
- gangMemberUpgradeBoxContent = document.getElementById(boxId + "-content");
- gangMemberUpgradeBoxOpened = true;
- }
-}
-
-//Create upgrade panels for each individual Gang Member
-function createGangMemberUpgradePanel(memberObj) {
- var container = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("div", {
- border:"1px solid white",
- });
-
- var header = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("h1", {
- innerText:memberObj.name + " (" + memberObj.task.name + ")"
- });
- container.appendChild(header);
-
- var text = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("pre", {
- fontSize:"14px", display: "inline-block", width:"20%",
- innerText:
- "Hack: " + memberObj.hack + " (x" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.hack_mult, 2) + ")\n" +
- "Str: " + memberObj.str + " (x" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.str_mult, 2) + ")\n" +
- "Def: " + memberObj.def + " (x" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.def_mult, 2) + ")\n" +
- "Dex: " + memberObj.dex + " (x" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.dex_mult, 2) + ")\n" +
- "Agi: " + memberObj.agi + " (x" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.agi_mult, 2) + ")\n" +
- "Cha: " + memberObj.cha + " (x" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(memberObj.cha_mult, 2) + ")\n",
- });
-
- //Already purchased upgrades
- var ownedUpgradesElements = [];
- for (var i = 0; i < memberObj.upgrades.length; ++i) {
- var upg = GangMemberUpgrades[memberObj.upgrades[i]];
- if (upg == null) {
- console.log("ERR: Could not find this upgrade: " + memberObj.upgrades[i]);
- continue;
- }
- var e = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("div", {
- border:"1px solid white", innerText:memberObj.upgrades[i],
- margin:"1px", padding:"1px", tooltip:upg.desc, fontSize:"12px",
- });
- ownedUpgradesElements.push(e);
- }
- var ownedUpgrades = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("div", {
- display:"inline-block", marginLeft:"6px", width:"75%", innerText:"Purchased Upgrades:",
- });
- for (var i = 0; i < ownedUpgradesElements.length; ++i) {
- ownedUpgrades.appendChild(ownedUpgradesElements[i]);
- }
- container.appendChild(text);
- container.appendChild(ownedUpgrades);
- container.appendChild(Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("br", {}));
-
- //Upgrade buttons. Only show upgrades that can be afforded
- var weaponUpgrades = [], armorUpgrades = [], vehicleUpgrades = [], rootkitUpgrades = [];
- for (var upgName in GangMemberUpgrades) {
- if (GangMemberUpgrades.hasOwnProperty(upgName)) {
- var upg = GangMemberUpgrades[upgName];
- if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].money.lt(upg.cost) || memberObj.upgrades.includes(upgName)) {continue;}
- switch (upg.type) {
- case "w":
- weaponUpgrades.push(upg);
- break;
- case "a":
- armorUpgrades.push(upg);
- break;
- case "v":
- vehicleUpgrades.push(upg);
- break;
- case "r":
- rootkitUpgrades.push(upg);
- break;
- default:
- console.log("ERROR: Invalid Gang Member Upgrade Type: " + upg.type);
- }
- }
- }
-
- var weaponDiv = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("div", {width:"20%", display:"inline-block",});
- var armorDiv = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("div", {width:"20%", display:"inline-block",});
- var vehicleDiv = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("div", {width:"20%", display:"inline-block",});
- var rootkitDiv = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("div", {width:"20%", display:"inline-block",});
- var upgrades = [weaponUpgrades, armorUpgrades, vehicleUpgrades, rootkitUpgrades];
- var divs = [weaponDiv, armorDiv, vehicleDiv, rootkitDiv];
-
- for (var i = 0; i < upgrades.length; ++i) {
- var upgradeArray = upgrades[i];
- var div = divs[i];
- for (var j = 0; j < upgradeArray.length; ++j) {
- var upg = upgradeArray[j];
- (function (upg, div, memberObj) {
- div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("a", {
- innerText:upg.name + " - " + __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(upg.cost).format("$0.000a"),
- class:"a-link-button", margin:"2px", padding:"2px", display:"block",
- fontSize:"12px",
- tooltip:upg.desc,
- clickListener:()=>{
- if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].money.lt(upg.cost)) {return false;}
- __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].loseMoney(upg.cost);
- memberObj.upgrades.push(upg.name);
- upg.apply(memberObj);
- var initFilterValue = gangMemberUpgradeBoxFilter.value.toString();
- createGangMemberUpgradeBox(initFilterValue);
- return false;
- }
- }));
- })(upg, div, memberObj);
- }
- }
-
- container.appendChild(weaponDiv);
- container.appendChild(armorDiv);
- container.appendChild(vehicleDiv);
- container.appendChild(rootkitDiv);
- return container;
-}
-
-//Gang DOM elements
-let gangContentCreated = false,
- gangContainer = null, managementButton = null, territoryButton = null;
-
-//Subpages
-let gangManagementSubpage = null, gangTerritorySubpage = null;
-
-//Gang Management Elements
-let gangDesc = null, gangInfo = null,
- gangRecruitMemberButton = null, gangRecruitRequirementText = null,
- gangExpandAllButton = null, gangCollapseAllButton, gangMemberFilter = null,
- gangManageEquipmentButton = null,
- gangMemberList = null;
-
-//Gang Equipment Upgrade Elements
-let gangMemberUpgradeBox = null, gangMemberUpgradeBoxContent = null,
- gangMemberUpgradeBoxFilter = null, gangMemberUpgradeBoxElements = null;
-
-
-//Gang Territory Elements
-let gangTerritoryDescText = null, gangTerritoryInfoText = null;
-
-function displayGangContent() {
- if (!gangContentCreated || gangContainer == null) {
- gangContentCreated = true;
-
- //Create gang container
- gangContainer = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("div", {
- id:"gang-container", class:"generic-menupage-container",
- });
-
- //Get variables
- var facName = __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.facName,
- members = __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members,
- wanted = __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.wanted,
- respect = __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.respect;
-
- //Buttons to switch between panels
- managementButton = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("a", {
- id:"gang-management-subpage-button", class:"a-link-button-inactive",
- display:"inline-block", innerHTML: "Gang Management (1)",
- clickListener:()=>{
- gangManagementSubpage.style.display = "block";
- gangTerritorySubpage.style.display = "none";
- managementButton.classList.toggle("a-link-button-inactive");
- managementButton.classList.toggle("a-link-button");
- territoryButton.classList.toggle("a-link-button-inactive");
- territoryButton.classList.toggle("a-link-button");
- updateGangContent();
- return false;
- }
- })
- territoryButton = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("a", {
- id:"gang-territory-subpage-button", class:"a-link-button",
- display:"inline-block", innerHTML:"Gang Territory (2)",
- clickListener:()=>{
- gangManagementSubpage.style.display = "none";
- gangTerritorySubpage.style.display = "block";
- managementButton.classList.toggle("a-link-button-inactive");
- managementButton.classList.toggle("a-link-button");
- territoryButton.classList.toggle("a-link-button-inactive");
- territoryButton.classList.toggle("a-link-button");
- updateGangContent();
- return false;
- }
- });
- gangContainer.appendChild(managementButton);
- gangContainer.appendChild(territoryButton);
-
- //Subpage for managing gang members
- gangManagementSubpage = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("div", {
- display:"block", id:"gang-management-subpage",
- });
-
- var lowerWantedTask = "";
- if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.isHackingGang) {
- lowerWantedTask = "Ethical Hacking";
- } else {
- lowerWantedTask = "Vigilante Justice";
- }
- gangDesc = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("p", {width:"70%",
- innerHTML:
- "This page is used to manage your gang members and get an overview of your " +
- "gang's stats.
" +
- "If a gang member is not earning much money or respect, the task that you " +
- "have assigned to that member might be too difficult. Consider training that " +
- "member's stats or choosing an easier task. The tasks closer to the " +
- "top of the dropdown list are generally easier. Alternatively, the gang member's " +
- "low production might be due to the fact that your wanted level is too high. " +
- "Consider assigning a few members to the '" + lowerWantedTask + "' " +
- "task to lower your wanted level.
" +
- "Installing Augmentations does NOT reset your progress with your Gang. " +
- "Furthermore, after installing Augmentations, you will " +
- "automatically be a member of whatever Faction you created your gang with.
"
- });
- gangManagementSubpage.appendChild(gangDesc);
-
- gangInfo = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("p", {id:"gang-info", width:"70%"});
- gangManagementSubpage.appendChild(gangInfo);
-
- gangRecruitMemberButton = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("a", {
- id:"gang-management-recruit-member-btn", class:"a-link-button-inactive",
- innerHTML:"Recruit Gang Member", display:"inline-block", margin:"10px",
- clickListener:()=>{
- var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["j" /* yesNoTxtInpBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["i" /* yesNoTxtInpBoxGetNoButton */])();
- yesBtn.innerHTML = "Recruit Gang Member";
- noBtn.innerHTML = "Cancel";
- yesBtn.addEventListener("click", ()=>{
- var name = Object(__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["h" /* yesNoTxtInpBoxGetInput */])();
- if (name === "") {
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You must enter a name for your Gang member!");
- } else {
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members.length; ++i) {
- if (name == __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members[i].name) {
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You already have a gang member with this name!");
- return false;
- }
- }
- var member = new GangMember(name);
- __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members.push(member);
- createGangMemberDisplayElement(member);
- updateGangContent();
- }
- Object(__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
- });
- noBtn.addEventListener("click", ()=>{
- Object(__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
- });
- Object(__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["g" /* yesNoTxtInpBoxCreate */])("Please enter a name for your new Gang member:");
- return false;
- }
- });
- gangManagementSubpage.appendChild(gangRecruitMemberButton);
-
- //Text for how much reputation is required for recruiting next memberList
- gangRecruitRequirementText = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("p", {color:"red", id:"gang-recruit-requirement-text"});
- gangManagementSubpage.appendChild(gangRecruitRequirementText);
-
- //Gang Member List management buttons (Expand/Collapse All, select a single member)
- gangManagementSubpage.appendChild(Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("br", {}));
- gangExpandAllButton = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("a", {
- class:"a-link-button", display:"inline-block",
- innerHTML:"Expand All",
- clickListener:()=>{
- var allHeaders = gangManagementSubpage.getElementsByClassName("accordion-header");
- for (var i = 0; i < allHeaders.length; ++i) {
- var hdr = allHeaders[i];
- if (!hdr.classList.contains("active")) {
- hdr.click();
- }
- }
- return false;
- }
- });
- gangCollapseAllButton = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("a", {
- class:"a-link-button", display:"inline-block",
- innerHTML:"Collapse All",
- clickListener:()=>{
- var allHeaders = gangManagementSubpage.getElementsByClassName("accordion-header");
- for (var i = 0; i < allHeaders.length; ++i) {
- var hdr = allHeaders[i];
- if (hdr.classList.contains("active")) {
- hdr.click();
- }
- }
- return false;
- }
- });
- gangMemberFilter = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("input", {
- type:"text", placeholder:"Filter gang members", margin:"5px", padding:"5px",
- onkeyup:()=>{
- displayGangMemberList();
- }
- });
- gangManageEquipmentButton = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("a", {
- class:"a-link-button", display:"inline-block",
- innerHTML:"Manage Equipment",
- clickListener:()=>{
- createGangMemberUpgradeBox();
- }
- });
- gangManagementSubpage.appendChild(gangExpandAllButton);
- gangManagementSubpage.appendChild(gangCollapseAllButton);
- gangManagementSubpage.appendChild(gangMemberFilter);
- gangManagementSubpage.appendChild(gangManageEquipmentButton);
-
- //Gang Member list
- gangMemberList = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("ul", {id:"gang-member-list"});
- displayGangMemberList();
- gangManagementSubpage.appendChild(gangMemberList);
-
- //Subpage for seeing gang territory information
- gangTerritorySubpage = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("div", {
- id:"gang-territory-subpage", display:"none"
- });
-
- //Info text for territory page
- gangTerritoryDescText = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("p", {
- width:"70%",
- innerHTML:"This page shows how much territory your Gang controls. This statistic is listed as a percentage, " +
- "which represents how much of the total territory you control.
" +
- "Territory gain and loss is processed automatically and is updated every ~30 seconds. Your chances " +
- "to gain and lose territory depend on your Gang's power, which is listed in the display below. " +
- "Your gang's power is determined by the stats of all Gang members you have assigned to the " +
- "'Territory Warfare' task. Gang members that are not assigned to this task do not contribute to " +
- "your Gang's power.
" +
- "The amount of territory you have affects all aspects of your Gang members' production, including " +
- "money, respect, and wanted level. It is very beneficial to have high territory control.
"
- });
- gangTerritorySubpage.appendChild(gangTerritoryDescText);
-
- var territoryBorder = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("fieldset", {width:"50%", display:"inline-block"});
-
- gangTerritoryInfoText = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["f" /* createElement */])("p", {id:"gang-territory-info"});
-
- territoryBorder.appendChild(gangTerritoryInfoText);
- gangTerritorySubpage.appendChild(territoryBorder);
-
- gangContainer.appendChild(gangTerritorySubpage);
- gangContainer.appendChild(gangManagementSubpage);
- document.getElementById("entire-game-container").appendChild(gangContainer);
- }
- gangContainer.style.display = "block";
- updateGangContent();
-}
-
-function displayGangMemberList() {
- Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["k" /* removeChildrenFromElement */])(gangMemberList);
- var members = __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.members;
- var filter = gangMemberFilter.value.toString();
- for (var i = 0; i < members.length; ++i) {
- if (members[i].name.indexOf(filter) > -1 || members[i].task.name.indexOf(filter) > -1) {
- createGangMemberDisplayElement(members[i]);
- }
- }
- //setGangMemberClickHandlers(); //Set buttons to toggle the gang member info panels
-}
-
-function updateGangContent() {
- if (!gangContentCreated || !__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].inGang()) {return;}
-
- if(gangTerritorySubpage.style.display === "block") {
- //Update territory information
- gangTerritoryInfoText.innerHTML = "";
- for (var gangname in AllGangs) {
- if (AllGangs.hasOwnProperty(gangname)) {
- var gangTerritoryInfo = AllGangs[gangname];
- if (gangname == __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.facName) {
- gangTerritoryInfoText.innerHTML += ("" + gangname + " (Power: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gangTerritoryInfo.power, 6) + "): " +
- Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(100*gangTerritoryInfo.territory, 2) + "%
" +
+ litObj.txt;
+ Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);
+}
+
+let Literatures = {}
+
+function initLiterature() {
+ var title, fn, txt;
+ title = "The Beginner's Guide to Hacking";
+ fn = "hackers-starting-handbook.lit";
+ txt = "When starting out, hacking is the most profitable way to earn money and progress. This " +
+ "is a brief collection of tips/pointers on how to make the most out of your hacking scripts.
" +
+ "-hack() and grow() both work by percentages. hack() steals a certain percentage of the " +
+ "money on a server, and grow() increases the amount of money on a server by some percentage (multiplicatively)
" +
+ "-Because hack() and grow() work by percentages, they are more effective if the target server has a high amount of money. " +
+ "Therefore, you should try to increase the amount of money on a server (using grow()) to a certain amount before hacking it. Two " +
+ "import Netscript functions for this are getServerMoneyAvailable() and getServerMaxMoney()
" +
+ "-Keep security level low. Security level affects everything when hacking. Two important Netscript functions " +
+ "for this are getServerSecurityLevel() and getServerMinSecurityLevel()
" +
+ "-Purchase additional servers by visiting 'Alpha Enterprises' in the city. They are relatively cheap " +
+ "and give you valuable RAM to run more scripts early in the game
" +
+ "-Prioritize upgrading the RAM on your home computer. This can also be done at 'Alpha Enterprises'
" +
+ "-Many low level servers have free RAM. You can use this RAM to run your scripts. Use the scp Terminal or " +
+ "Netscript command to copy your scripts onto these servers and then run them.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "The Complete Handbook for Creating a Successful Corporation";
+ fn = "corporation-management-handbook.lit";
+ txt = "Getting Started with Corporations " +
+ "To get started, visit the City Hall in Sector-12 in order to create a Corporation. This requires " +
+ "$150b of your own money, but this $150b will get put into your Corporation's funds. " +
+ "After creating your Corporation, you will see it listed as one of the locations in the city. Click on " +
+ "your Corporation in order to manage it.
" +
+ "Your Corporation can have many different divisions, each in a different Industry. There are many different " +
+ "types of Industries, each with different properties. To create your first division, click the " +
+ "'Expand into new Industry' button at the top of the management UI. The Agriculture " +
+ "and Software industries are recommended for your first division.
" +
+ "The first thing you'll need to do is hire some employees. Employees can be assigned to five different positions. " +
+ "Each position has a different effect on various aspects of your Corporation. It is recommended to have at least " +
+ "one employee at each position.
" +
+ "Each industry uses some combination of Materials in order to produce other Materials and/or create Products. " +
+ "Specific information about this is displayed in each of your divisions' UI.
" +
+ "Products are special, industry-specific objects. They are different than Materials because you " +
+ "must manually choose to develop them, and you can choose to develop any number of Products. Developing " +
+ "a Product takes time, but a Product typically generates significantly more revenue than any Material. " +
+ "Not all industries allow you to create Products. To create a Product, look for a button " +
+ "in the top-left panel of the division UI (e.g. For the Software Industry, the button says 'Develop Software').
" +
+ "To get your supply chain system started, " +
+ "purchase the Materials that your industry needs to produce other Materials/Products. This can be done " +
+ "by clicking the 'Buy' button next to the corresponding Material(s). After you have the required Materials, " +
+ "you will immediately start production. The amount of Materials/Products you produce is based on a variety of factors, " +
+ "one of which is your employees and their productivity.
" +
+ "Once you start producing Materials/Products, you can sell them in order to start earning revenue. This can be done " +
+ "by clicking the 'Sell' button next to the corresponding Material or Product. The amount of Material/Product you sell is dependent " +
+ "on a wide variety of different factors.
" +
+ "These are the basics of getting your Corporation up and running! Now, you can start purchasing upgrades to improve " +
+ "your bottom line. If you need money, consider looking for seed investors, who will give you money in exchange for stock shares. " +
+ "Otherwise, once you feel you are ready, take your Corporation public! Once your Corporation goes public, you can no longer " +
+ "find investors. Instead, your Corporation will be publicly traded and its stock price will change based on how well " +
+ "it's performing financially. You can then sell your stock shares in order to make money.
" +
+ "Tips/Pointers " +
+ "-Purchasing Hardware, Robots, AI Cores, and Real Estate can potentially increase your production. " +
+ "The effects of these depend on what industry you are in.
" +
+ "-In order to optimize your production, you will need a good balance of Operators, Managers, and Engineers
" +
+ "-Different employees excel in different jobs. For example, the highly intelligent employees will probably do best " +
+ "if they are assigned to do Engineering work or Research & Development.
" +
+ "-If your employees have low morale, energy, or happiness, their production will greatly suffer.
" +
+ "-Tech is important, but don't neglect sales! Having several Businessmen can boost your sales and your bottom line.
" +
+ "-Don't forget to advertise your company. You won't have any business if nobody knows you.
" +
+ "-Having company awareness is great, but what's really important is your company's popularity. Try to keep " +
+ "your popularity as high as possible to see the biggest benefit for your sales
" +
+ "-Remember, you need to spend money to make money!
" +
+ "-Corporations do not reset when installing Augmentations, but they do reset when destroying a BitNode";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "A Green Tomorrow";
+ fn = "A-Green-Tomorrow.lit";
+ txt = "Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to " +
+ "combat global warming and climate change. The shift towards renewable energy was a big success, or so it seemed. In 2045 " +
+ "a staggering 80% of the world's energy came from non-renewable fossil fuels. Now, about three decades later, that " +
+ "number is down to only 15%. Most of the world's energy now comes from nuclear power and renwable sources such as " +
+ "solar and geothermal. Unfortunately, these efforts were not the huge success that they seem to be.
" +
+ "Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and " +
+ "the rise of increasingly advanced (and power-hungry) technology that has become ubiquitous in our lives. So, " +
+ "despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, " +
+ "the total amount of energy we are producing from fossil fuels has actually increased.
" +
+ "The grim effects of our species' irresponsible use of energy and neglect of our mother world have become increasingly apparent. " +
+ "Last year a temperature of 190F was recorded in the Death Valley desert, which is over 50% higher than the highest " +
+ "recorded temperature at the beginning of the century. In the last two decades numerous major cities such as Manhattan, Boston, and " +
+ "Los Angeles have been partially or fully submerged by rising sea levels. In the present day, over 75% of the world's agriculture is " +
+ "done in climate-controlled vertical farms, as most traditional farmland has become unusable due to severe climate conditions.
" +
+ "Despite all of this, the greedy and corrupt corporations that rule the world have done nothing to address these problems that " +
+ "threaten our species. And so it's up to us, the common people. Each and every one of us can make a difference by doing what " +
+ "these corporations won't: taking responsibility. If we don't, pretty soon there won't be an Earth left to save. We are " +
+ "the last hope for a green tomorrow.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Alpha and Omega";
+ fn = "alpha-omega.lit";
+ txt = "Then we saw a new heaven and a new earth, for our first heaven and earth had gone away, and our sea was no more. " +
+ "And we saw a new holy city, new Aeria, coming down out of this new heaven, prepared as a bride adorned for her husband. " +
+ "And we heard a loud voice saying, 'Behold, the new dwelling place of the Gods. We will dwell with them, and they " +
+ "will be our people, and we will be with them as their Gods. We will wipe away every tear from their eyes, and death " +
+ "shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things " +
+ "have passed away.'
" +
+ "And once were were seated on the throne we said 'Behold, I am making all things new.' " +
+ "Also we said, 'Write this down, for these words are trustworthy and true.' And we said to you, " +
+ "'It is done! I am the Alpha and the Omega, the beginning and the end. To the thirsty I will give from the spring " +
+ "of the water of life without payment. The one who conquers will have this heritage, and we will be his God and " +
+ "he will be our son. But as for the cowardly, the faithless, the detestable, as for murderers, " +
+ "the sexually immoral, sorcerers, idolaters, and all liars, their portion will be in the lake that " +
+ "burns with fire and sulfur, for it is the second true death.'";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Are We Living in a Computer Simulation?";
+ fn = "simulated-reality.lit";
+ txt = "The idea that we are living in a virtual world is not new. It's a trope that has " +
+ "been explored constantly in literature and pop culture. However, it is also a legitimate " +
+ "scientific hypothesis that many notable physicists and philosophers have debated for years.
" +
+ "Proponents for this simulated reality theory often point to how advanced our technology has become, " +
+ "as well as the incredibly fast pace at which it has advanced over the past decades. The amount of computing " +
+ "power available to us has increased over 100-fold since 2060 due to the development of nanoprocessors and " +
+ "quantum computers. Artifical Intelligence has advanced to the point where our entire lives are controlled " +
+ "by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. " +
+ "If we consider the pace at which this technology has advanced and assume that these developments continue, it's " +
+ "reasonable to assume that at some point in the future our technology would be advanced enough that " +
+ "we could create simulations that are indistinguishable from reality. However, if this is a reasonable outcome " +
+ "of continued technological advancement, then it is very likely that such a scenario has already happened.
" +
+ "Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species " +
+ "that already has such technology. Who's to say that they haven't already created such a virtual reality: our own?";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Beyond Man";
+ fn = "beyond-man.lit";
+ txt = "Humanity entered a 'transhuman' era a long time ago. And despite the protests and criticisms of many who cried out against " +
+ "human augmentation at the time, the transhuman movement continued and prospered. Proponents of the movement ignored the critics, " +
+ "arguing that it was in our inherent nature to better ourselves. To improve. To be more than we were. They claimed that " +
+ "not doing so would be to go against every living organism's biological purpose: evolution and survival of the fittest.
" +
+ "And here we are today, with technology that is advanced enough to augment humans to a state that " +
+ "can only be described as posthuman. But what do we have to show for it when this augmentation " +
+ "technology is only available to the so-called 'elite'? Are we really better off than before when only 5% of the " +
+ "world's population has access to this technology? When the powerful corporations and organizations of the world " +
+ "keep it all to themselves, have we really evolved?
" +
+ "Augmentation technology has only further increased the divide between the rich and the poor, between the powerful and " +
+ "the oppressed. We have not become 'more than human'. We have not evolved from nature's original design. We are still the greedy, " +
+ "corrupted, and evil men that we always were.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+
+ title = "Brighter than the Sun";
+ fn = "brighter-than-the-sun.lit";
+ txt = "When people think about the corporations that dominate the East, they typically think of KuaiGong International, which " +
+ "holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest " +
+ "drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company " +
+ "that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.
" +
+ "TaiYang Digital is a Chinese internet-technology corporation that provides services such as " +
+ "online advertising, search, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word " +
+ "for 'sun'. In Chinese culture, the sun is a 'yang' symbol " +
+ "associated with life, heat, masculinity, and heaven.
" +
+ "The company was founded " +
+ "less than 5 years ago and is already the third highest valued company in all of Asia. In 2076 it generated a total revenue of " +
+ "over 10 trillion yuan. It's services are used daily by over a billion people worldwide.
" +
+ "TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is " +
+ "something you'd commonly see in the first half of the century, especially for tech companies. However in " +
+ "the last two decades the number of corporations has significantly declined as the largest entities " +
+ "quickly took over the economy. Corporations such as ECorp, MegaCorp, and KuaiGong have established " +
+ "such strong monopolies in their market sectors that they have effectively killed off all " +
+ "of the smaller and new corporations that have tried to start up over the years. This is what makes " +
+ "the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have " +
+ "a bright future ahead of them.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Democracy is Dead: The Fall of an Empire";
+ fn = "democracy-is-dead.lit";
+ txt = "They rose from the shadows in the street From the places where the oppressed meet " +
+ "Their cries echoed loudly through the air As they once did in Tiananmen Square " +
+ "Loudness in the silence, Darkness in the light They came forth with power and might " +
+ "Once the beacon of democracy, America was first Its pillars of society destroyed and dispersed " +
+ "Soon the cries rose everywhere, with revolt and riot Until one day, finally, all was quiet " +
+ "From the ashes rose a new order, corporatocracy was its name " +
+ "Rome, Mongol, Byzantine, all of history is just the same " +
+ "For man will never change in a fundamental way " +
+ "And now democracy is dead, in the USA";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Figures Show Rising Crime Rates in Sector-12";
+ fn = "sector-12-crime.lit";
+ txt = "A recent study by analytics company Wilson Inc. shows a significant rise " +
+ "in criminal activity in Sector-12. Perhaps the most alarming part of the statistic " +
+ "is that most of the rise is in violent crime such as homicide and assault. According " +
+ "to the study, the city saw a total of 21,406 reported homicides in 2076, which is over " +
+ "a 20% increase compared to 2075.
" +
+ "CIA director David Glarow says its too early to know " +
+ "whether these figures indicate the beginning of a sustained increase in crime rates, or whether " +
+ "the year was just an unfortunate outlier. He states that many intelligence and law enforcement " +
+ "agents have noticed an increase in organized crime activites, and believes that these figures may " +
+ "be the result of an uprising from criminal organizations such as The Syndicate or the Slum Snakes.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Man and the Machine";
+ fn = "man-and-machine.lit";
+ txt = "In 2005 Ray Kurzweil popularized his theory of the Singularity. He predicted that the rate " +
+ "of technological advancement would continue to accelerate faster and faster until one day " +
+ "machines would be become infinitely more intelligent than humans. This point, called the " +
+ "Singularity, would result in a drastic transformation of the world as we know it. He predicted " +
+ "that the Singularity would arrive by 2045. " +
+ "And yet here we are, more than three decades later, where most would agree that we have not " +
+ "yet reached a point where computers and machines are vastly more intelligent than we are. So what gives?
" +
+ "The answer is that we have reached the Singularity, just not in the way we expected. The artifical superintelligence " +
+ "that was predicted by Kurzweil and others exists in the world today - in the form of Augmentations. " +
+ "Yes, those Augmentations that the rich and powerful keep to themselves enable humans " +
+ "to become superintelligent beings. The Singularity did not lead to a world where " +
+ "our machines are infinitely more intelligent than us, it led to a world " +
+ "where man and machine can merge to become something greater. Most of the world just doesn't " +
+ "know it yet."
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Secret Societies";
+ fn = "secret-societies.lit";
+ txt = "The idea of secret societies has long intrigued the general public by inspiring curiosity, fascination, and " +
+ "distrust. People have long wondered about who these secret society members are and what they do, with the " +
+ "most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world " +
+ "may never know for sure, it is likely that many secret societies do actually exist, even today.
" +
+ "However, the secret societies of the modern world are nothing like those that (supposedly) existed " +
+ "decades and centuries ago. The Freemasons, Knights Templar, and Illuminati, while they may have been around " +
+ "at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in " +
+ "our everyday lives and the fact that so much of the world is now digital has given rise to a new breed " +
+ "of secret societies: Internet-based ones.
" +
+ "Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's " +
+ "world. Some of these, such as The Black Hand, are black hat groups that claim they are trying to " +
+ "help the oppressed by attacking the elite and powerful. Others, such as NiteSec, are hacktivist groups " +
+ "that try to push political and social agendas. Perhaps the most intriguing hacker group " +
+ "is the mysterious Bitrunners, whose purpose still remains unknown.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Space: The Failed Frontier";
+ fn = "the-failed-frontier.lit";
+ txt = "Humans have long dreamed about spaceflight. With enduring interest, we were driven to explore " +
+ "the unknown and discover new worlds. We dreamed about conquering the stars. And in our quest, " +
+ "we pushed the boundaries of our scientific limits, and then pushed further. Space exploration " +
+ "lead to the development of many important technologies and new industries.
" +
+ "But sometime in the middle of the 21st century, all of that changed. Humanity lost its ambitions and " +
+ "aspirations of exploring the cosmos. The once-large funding for agencies like NASA and the European " +
+ "Space Agency gradually whittled away until their eventual disbanding in the 2060's. Not even " +
+ "militaries are fielding flights into space nowadays. The only remnants of the once great mission for cosmic " +
+ "conquest are the countless satellites in near-earth orbit, used for communications, espionage, " +
+ "and other corporate interests.
" +
+ "And as we continue to look at the state of space technology, it becomes more and " +
+ "more apparent that we will never return to that golden age of space exploration, that " +
+ "age where everyone dreamed of going beyond earth for the sake of discovery.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Coded Intelligence: Myth or Reality?";
+ fn = "coded-intelligence.lit";
+ txt = "Tremendous progress has been made in the field of Artificial Intelligence over the past few decades. " +
+ "Our autonomous vehicles and transporation systems. The electronic personal assistants that control our everyday lives. " +
+ "Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has " +
+ "improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create " +
+ "human intelligence.
" +
+ "We've certainly come close to artificial intelligence that is similar to humans. For example OmniTek Incorporated's " +
+ "CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like " +
+ "in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as " +
+ "that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.
" +
+ "Many neuroscientists believe that we won't ever reach the point of creating artificial human intelligence. 'At the end of the " +
+ "the day, AI comes down to 1's and 0's, while the human brain does not. We'll never see AI that is identical to that of " +
+ "humans.'";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Synthetic Muscles";
+ fn = "synthetic-muscles.lit";
+ txt = "Initial versions of synthetic muscles weren't made of anything organic but were actually " +
+ "crude devices made to mimic human muscle function. Some of the early iterations were actually made of " +
+ "common materials such as fishing lines and sewing threads due to their high strength for " +
+ "a cheap cost.
" +
+ "As technology progressed, however, advances in biomedical engineering paved the way for a new method of " +
+ "creating synthetic muscles. Instead of creating something that closely imitated the functionality " +
+ "of human muscle, scientists discovered a way of forcing the human body itself to augment its own " +
+ "muscle tissue using both synthetic and organic materials. This is typically done using gene therapy " +
+ "or chemical injections.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Tensions rise in global tech race";
+ fn = "tensions-in-tech-race.lit";
+ txt = "Have we entered a new Cold War? Is WWIII just beyond the horizon?
" +
+ "After rumors came out that OmniTek Incorporated had begun developing advanced robotic supersoldiers, " +
+ "geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. " +
+ "In a rare show of cooperation between corporations, MegaCorp and ECorp have " +
+ "reportedly launched hundreds of new surveillance and espionage satellites. " +
+ "Defense contractors such as " +
+ "DeltaOne and AeroCorp have been working with the CIA and NSA to prepare " +
+ "for conflict. Meanwhile, the rest of the world sits in earnest " +
+ "hoping that it never reaches full-scale war. With today's technology " +
+ "and firepower, a World War would assuredly mean the end of human civilization.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "The Cost of Immortality";
+ fn = "cost-of-immortality.lit";
+ txt = "Evolution and advances in medical and augmentation technology has lead to drastic improvements " +
+ "in human mortality rates. Recent figures show that the life expectancy for humans " +
+ "that live in a first-world country is about 130 years of age, almost double of what it was " +
+ "at the turn of the century. However, this increase in average lifespan has had some " +
+ "significant effects on society and culture.
" +
+ "Due to longer lifespans and a better quality of life, many adults are holding " +
+ "off on having kids until much later. As a result, the percentage of youth in " +
+ "first-world countries has been decreasing, while the number " +
+ "of senior citizens is significantly increasing.
" +
+ "Perhaps the most alarming result of all of this is the rapidly shrinking workforce. " +
+ "Despite the increase in life expectancy, the typical retirement age for " +
+ "workers in America has remained about the same, meaning a larger and larger " +
+ "percentage of people in America are retirees. Furthermore, many " +
+ "young adults are holding off on joining the workforce because they feel that " +
+ "they have plenty of time left in their lives for employment, and want to " +
+ "'enjoy life while they're young.' For most industries, this shrinking workforce " +
+ "is not a major issue as most things are handled by robots anyways. However, " +
+ "there are still several key industries such as engineering and education " +
+ "that have not been automated, and these remain in danger to this cultural " +
+ "phenomenon.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "The Hidden World";
+ fn = "the-hidden-world.lit";
+ txt = "WAKE UP SHEEPLE
" +
+ "THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY
" +
+ "THE ILLUMINATI ARE THE SECRET RULERS OF THE WORLD!
" +
+ "Yes, the Illuminati of legends. The ancient secret society that controls the entire " +
+ "world from the shadows with their invisible hand. The group of the rich and wealthy " +
+ "that have penetrated every major government, financial agency, and corporation in the last " +
+ "three hundred years.
" +
+ "OPEN YOUR EYES
" +
+ "It was the Illuminati that brought an end to democracy in the world. They are the driving force " +
+ "behind everything that happens.
" +
+ "THEY ARE ALL AROUND YOU
" +
+ "After destabilizing the world's governments, they are now entering the final stage of their master plan. " +
+ "They will secretly initiate global crises. Terrorism. Pandemics. World War. And out of the chaos " +
+ "that ensues they will build their New World Order.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "The New God";
+ fn = "the-new-god.lit";
+ txt = "Everyone has that moment in their life where they wonder about the bigger questions
" +
+ "What's the point of all of this? What is my purpose?
" +
+ "Some people dare to think even bigger
" +
+ "What will be the fate of the human race?
" +
+ "We live in an era vastly different from that of even 15 or 20 years ago. We have gone " +
+ "where no man has gone before. We have stripped ourselves of the tyranny of flesh.
" +
+ "The Singularity is here. The merging of man and machine. This is where humanity evolves into " +
+ "something greater. This is our future
" +
+ "Embrace it, and you will obey a new god. The God in the Machine";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "The New Triads";
+ fn = "new-triads.lit";
+ txt = "The Triads were an ancient transnational crime syndicate based in China, Hong Kong, and other Asian " +
+ "territories. They were often considered one of the first and biggest criminal secret societies. " +
+ "While most of the branches of the Triads have been destroyed over the past few decades, the " +
+ "crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. " +
+ "The most notable of these is the Tetrads.
" +
+ "It is widely believed that the Tetrads are a rogue group that splintered off from the Triads sometime in the " +
+ "mid 21st century. The founders of the Tetrads, all of whom were ex-Triad members, believed that the " +
+ "Triads were losing their purpose and direction. The Tetrads started off as a small group that mainly engaged " +
+ "in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal " +
+ "drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the " +
+ "continent.
" +
+ "Not much else is known about the Tetrads, or about the efforts the Asian governments and corporations are making " +
+ "to take down this large new crime organization. Many believe that the Tetrads have infiltrated the governments " +
+ "and powerful corporations in Asia, which has helped faciliate their recent rapid rise.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "The Secret War";
+ fn = "the-secret-war.lit";
+ txt = ""
+ Literatures[fn] = new Literature(title, fn, txt);
+}
+
+
+
+
+/***/ }),
+/* 44 */
/***/ (function(module, exports) {
module.exports = function() {
@@ -52962,14 +53132,14 @@ module.exports = function() {
/***/ }),
-/* 46 */
+/* 45 */
/***/ (function(module, exports) {
module.exports.id = 'ace/mode/javascript_worker';
module.exports.src = "\"no use strict\";!function(window){function resolveModuleId(id,paths){for(var testPath=id,tail=\"\";testPath;){var alias=paths[testPath];if(\"string\"==typeof alias)return alias+tail;if(alias)return alias.location.replace(/\\/*$/,\"/\")+(tail||alias.main||alias.name);if(alias===!1)return\"\";var i=testPath.lastIndexOf(\"/\");if(-1===i)break;tail=testPath.substr(i)+tail,testPath=testPath.slice(0,i)}return id}if(!(void 0!==window.window&&window.document||window.acequire&&window.define)){window.console||(window.console=function(){var msgs=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:msgs})},window.console.error=window.console.warn=window.console.log=window.console.trace=window.console),window.window=window,window.ace=window,window.onerror=function(message,file,line,col,err){postMessage({type:\"error\",data:{message:message,data:err.data,file:file,line:line,col:col,stack:err.stack}})},window.normalizeModule=function(parentId,moduleName){if(-1!==moduleName.indexOf(\"!\")){var chunks=moduleName.split(\"!\");return window.normalizeModule(parentId,chunks[0])+\"!\"+window.normalizeModule(parentId,chunks[1])}if(\".\"==moduleName.charAt(0)){var base=parentId.split(\"/\").slice(0,-1).join(\"/\");for(moduleName=(base?base+\"/\":\"\")+moduleName;-1!==moduleName.indexOf(\".\")&&previous!=moduleName;){var previous=moduleName;moduleName=moduleName.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error(\"worker.js acequire() accepts only (parentId, id) as arguments\");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log(\"unable to load \"+id);var path=resolveModuleId(id,window.acequire.tlns);return\".js\"!=path.slice(-3)&&(path+=\".js\"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,\"string\"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),\"function\"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=[\"require\",\"exports\",\"module\"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case\"require\":return req;case\"exports\":return module.exports;case\"module\":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire(\"ace/lib/event_emitter\").EventEmitter,oop=window.acequire(\"ace/lib/oop\"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:\"call\",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:\"event\",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error(\"Unknown command:\"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire(\"ace/lib/es5-shim\"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}}(this),ace.define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.inherits=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},exports.mixin=function(obj,mixin){for(var key in mixin)obj[key]=mixin[key];return obj},exports.implement=function(proto,mixin){exports.mixin(proto,mixin)}}),ace.define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},Range=function(startRow,startColumn,endRow,endColumn){this.start={row:startRow,column:startColumn},this.end={row:endRow,column:endColumn}};(function(){this.isEqual=function(range){return this.start.row===range.start.row&&this.end.row===range.end.row&&this.start.column===range.start.column&&this.end.column===range.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(row,column){return 0==this.compare(row,column)},this.compareRange=function(range){var cmp,end=range.end,start=range.start;return cmp=this.compare(end.row,end.column),1==cmp?(cmp=this.compare(start.row,start.column),1==cmp?2:0==cmp?1:0):-1==cmp?-2:(cmp=this.compare(start.row,start.column),-1==cmp?-1:1==cmp?42:0)},this.comparePoint=function(p){return this.compare(p.row,p.column)},this.containsRange=function(range){return 0==this.comparePoint(range.start)&&0==this.comparePoint(range.end)},this.intersects=function(range){var cmp=this.compareRange(range);return-1==cmp||0==cmp||1==cmp},this.isEnd=function(row,column){return this.end.row==row&&this.end.column==column},this.isStart=function(row,column){return this.start.row==row&&this.start.column==column},this.setStart=function(row,column){\"object\"==typeof row?(this.start.column=row.column,this.start.row=row.row):(this.start.row=row,this.start.column=column)},this.setEnd=function(row,column){\"object\"==typeof row?(this.end.column=row.column,this.end.row=row.row):(this.end.row=row,this.end.column=column)},this.inside=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)||this.isStart(row,column)?!1:!0:!1},this.insideStart=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)?!1:!0:!1},this.insideEnd=function(row,column){return 0==this.compare(row,column)?this.isStart(row,column)?!1:!0:!1},this.compare=function(row,column){return this.isMultiLine()||row!==this.start.row?this.start.row>row?-1:row>this.end.row?1:this.start.row===row?column>=this.start.column?0:-1:this.end.row===row?this.end.column>=column?0:1:0:this.start.column>column?-1:column>this.end.column?1:0},this.compareStart=function(row,column){return this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.compareEnd=function(row,column){return this.end.row==row&&this.end.column==column?1:this.compare(row,column)},this.compareInside=function(row,column){return this.end.row==row&&this.end.column==column?1:this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.clipRows=function(firstRow,lastRow){if(this.end.row>lastRow)var end={row:lastRow+1,column:0};else if(firstRow>this.end.row)var end={row:firstRow,column:0};if(this.start.row>lastRow)var start={row:lastRow+1,column:0};else if(firstRow>this.start.row)var start={row:firstRow,column:0};return Range.fromPoints(start||this.start,end||this.end)},this.extend=function(row,column){var cmp=this.compare(row,column);if(0==cmp)return this;if(-1==cmp)var start={row:row,column:column};else var end={row:row,column:column};return Range.fromPoints(start||this.start,end||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return Range.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new Range(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new Range(this.start.row,0,this.end.row,0)},this.toScreenRange=function(session){var screenPosStart=session.documentToScreenPosition(this.start),screenPosEnd=session.documentToScreenPosition(this.end);return new Range(screenPosStart.row,screenPosStart.column,screenPosEnd.row,screenPosEnd.column)},this.moveBy=function(row,column){this.start.row+=row,this.start.column+=column,this.end.row+=row,this.end.column+=column}}).call(Range.prototype),Range.fromPoints=function(start,end){return new Range(start.row,start.column,end.row,end.column)},Range.comparePoints=comparePoints,Range.comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},exports.Range=Range}),ace.define(\"ace/apply_delta\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.applyDelta=function(docLines,delta){var row=delta.start.row,startColumn=delta.start.column,line=docLines[row]||\"\";switch(delta.action){case\"insert\":var lines=delta.lines;if(1===lines.length)docLines[row]=line.substring(0,startColumn)+delta.lines[0]+line.substring(startColumn);else{var args=[row,1].concat(delta.lines);docLines.splice.apply(docLines,args),docLines[row]=line.substring(0,startColumn)+docLines[row],docLines[row+delta.lines.length-1]+=line.substring(startColumn)}break;case\"remove\":var endColumn=delta.end.column,endRow=delta.end.row;row===endRow?docLines[row]=line.substring(0,startColumn)+line.substring(endColumn):docLines.splice(row,endRow-row+1,line.substring(0,startColumn)+docLines[endRow].substring(endColumn))}}}),ace.define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var EventEmitter={},stopPropagation=function(){this.propagationStopped=!0},preventDefault=function(){this.defaultPrevented=!0};EventEmitter._emit=EventEmitter._dispatchEvent=function(eventName,e){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var listeners=this._eventRegistry[eventName]||[],defaultHandler=this._defaultHandlers[eventName];if(listeners.length||defaultHandler){\"object\"==typeof e&&e||(e={}),e.type||(e.type=eventName),e.stopPropagation||(e.stopPropagation=stopPropagation),e.preventDefault||(e.preventDefault=preventDefault),listeners=listeners.slice();for(var i=0;listeners.length>i&&(listeners[i](e,this),!e.propagationStopped);i++);return defaultHandler&&!e.defaultPrevented?defaultHandler(e,this):void 0}},EventEmitter._signal=function(eventName,e){var listeners=(this._eventRegistry||{})[eventName];if(listeners){listeners=listeners.slice();for(var i=0;listeners.length>i;i++)listeners[i](e,this)}},EventEmitter.once=function(eventName,callback){var _self=this;callback&&this.addEventListener(eventName,function newCallback(){_self.removeEventListener(eventName,newCallback),callback.apply(null,arguments)})},EventEmitter.setDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers||(handlers=this._defaultHandlers={_disabled_:{}}),handlers[eventName]){var old=handlers[eventName],disabled=handlers._disabled_[eventName];disabled||(handlers._disabled_[eventName]=disabled=[]),disabled.push(old);var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}handlers[eventName]=callback},EventEmitter.removeDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers){var disabled=handlers._disabled_[eventName];if(handlers[eventName]==callback)handlers[eventName],disabled&&this.setDefaultHandler(eventName,disabled.pop());else if(disabled){var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}}},EventEmitter.on=EventEmitter.addEventListener=function(eventName,callback,capturing){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];return listeners||(listeners=this._eventRegistry[eventName]=[]),-1==listeners.indexOf(callback)&&listeners[capturing?\"unshift\":\"push\"](callback),callback},EventEmitter.off=EventEmitter.removeListener=EventEmitter.removeEventListener=function(eventName,callback){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];if(listeners){var index=listeners.indexOf(callback);-1!==index&&listeners.splice(index,1)}},EventEmitter.removeAllListeners=function(eventName){this._eventRegistry&&(this._eventRegistry[eventName]=[])},exports.EventEmitter=EventEmitter}),ace.define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Anchor=exports.Anchor=function(doc,row,column){this.$onChange=this.onChange.bind(this),this.attach(doc),column===void 0?this.setPosition(row.row,row.column):this.setPosition(row,column)};(function(){function $pointsInOrder(point1,point2,equalPointsInOrder){var bColIsAfter=equalPointsInOrder?point1.column<=point2.column:point1.columnthis.row)){var point=$getTransformedPoint(delta,{row:this.row,column:this.column},this.$insertRight);this.setPosition(point.row,point.column,!0)}},this.setPosition=function(row,column,noClip){var pos;if(pos=noClip?{row:row,column:column}:this.$clipPositionToDocument(row,column),this.row!=pos.row||this.column!=pos.column){var old={row:this.row,column:this.column};this.row=pos.row,this.column=pos.column,this._signal(\"change\",{old:old,value:pos})}},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(doc){this.document=doc||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(row,column){var pos={};return row>=this.document.getLength()?(pos.row=Math.max(0,this.document.getLength()-1),pos.column=this.document.getLine(pos.row).length):0>row?(pos.row=0,pos.column=0):(pos.row=row,pos.column=Math.min(this.document.getLine(pos.row).length,Math.max(0,column))),0>column&&(pos.column=0),pos}}).call(Anchor.prototype)}),ace.define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/apply_delta\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),applyDelta=acequire(\"./apply_delta\").applyDelta,EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Range=acequire(\"./range\").Range,Anchor=acequire(\"./anchor\").Anchor,Document=function(textOrLines){this.$lines=[\"\"],0===textOrLines.length?this.$lines=[\"\"]:Array.isArray(textOrLines)?this.insertMergedLines({row:0,column:0},textOrLines):this.insert({row:0,column:0},textOrLines)};(function(){oop.implement(this,EventEmitter),this.setValue=function(text){var len=this.getLength()-1;this.remove(new Range(0,0,len,this.getLine(len).length)),this.insert({row:0,column:0},text)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(row,column){return new Anchor(this,row,column)},this.$split=0===\"aaa\".split(/a/).length?function(text){return text.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:function(text){return text.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(text){var match=text.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=match?match[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(newLineMode){this.$newLineMode!==newLineMode&&(this.$newLineMode=newLineMode,this._signal(\"changeNewLineMode\"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(text){return\"\\r\\n\"==text||\"\\r\"==text||\"\\n\"==text},this.getLine=function(row){return this.$lines[row]||\"\"},this.getLines=function(firstRow,lastRow){return this.$lines.slice(firstRow,lastRow+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(range){return this.getLinesForRange(range).join(this.getNewLineCharacter())},this.getLinesForRange=function(range){var lines;if(range.start.row===range.end.row)lines=[this.getLine(range.start.row).substring(range.start.column,range.end.column)];else{lines=this.getLines(range.start.row,range.end.row),lines[0]=(lines[0]||\"\").substring(range.start.column);var l=lines.length-1;range.end.row-range.start.row==l&&(lines[l]=lines[l].substring(0,range.end.column))}return lines},this.insertLines=function(row,lines){return console.warn(\"Use of document.insertLines is deprecated. Use the insertFullLines method instead.\"),this.insertFullLines(row,lines)},this.removeLines=function(firstRow,lastRow){return console.warn(\"Use of document.removeLines is deprecated. Use the removeFullLines method instead.\"),this.removeFullLines(firstRow,lastRow)},this.insertNewLine=function(position){return console.warn(\"Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.\"),this.insertMergedLines(position,[\"\",\"\"])},this.insert=function(position,text){return 1>=this.getLength()&&this.$detectNewLine(text),this.insertMergedLines(position,this.$split(text))},this.insertInLine=function(position,text){var start=this.clippedPos(position.row,position.column),end=this.pos(position.row,position.column+text.length);return this.applyDelta({start:start,end:end,action:\"insert\",lines:[text]},!0),this.clonePos(end)},this.clippedPos=function(row,column){var length=this.getLength();void 0===row?row=length:0>row?row=0:row>=length&&(row=length-1,column=void 0);var line=this.getLine(row);return void 0==column&&(column=line.length),column=Math.min(Math.max(column,0),line.length),{row:row,column:column}},this.clonePos=function(pos){return{row:pos.row,column:pos.column}},this.pos=function(row,column){return{row:row,column:column}},this.$clipPosition=function(position){var length=this.getLength();return position.row>=length?(position.row=Math.max(0,length-1),position.column=this.getLine(length-1).length):(position.row=Math.max(0,position.row),position.column=Math.min(Math.max(position.column,0),this.getLine(position.row).length)),position},this.insertFullLines=function(row,lines){row=Math.min(Math.max(row,0),this.getLength());var column=0;this.getLength()>row?(lines=lines.concat([\"\"]),column=0):(lines=[\"\"].concat(lines),row--,column=this.$lines[row].length),this.insertMergedLines({row:row,column:column},lines)},this.insertMergedLines=function(position,lines){var start=this.clippedPos(position.row,position.column),end={row:start.row+lines.length-1,column:(1==lines.length?start.column:0)+lines[lines.length-1].length};return this.applyDelta({start:start,end:end,action:\"insert\",lines:lines}),this.clonePos(end)},this.remove=function(range){var start=this.clippedPos(range.start.row,range.start.column),end=this.clippedPos(range.end.row,range.end.column);return this.applyDelta({start:start,end:end,action:\"remove\",lines:this.getLinesForRange({start:start,end:end})}),this.clonePos(start)},this.removeInLine=function(row,startColumn,endColumn){var start=this.clippedPos(row,startColumn),end=this.clippedPos(row,endColumn);return this.applyDelta({start:start,end:end,action:\"remove\",lines:this.getLinesForRange({start:start,end:end})},!0),this.clonePos(start)},this.removeFullLines=function(firstRow,lastRow){firstRow=Math.min(Math.max(0,firstRow),this.getLength()-1),lastRow=Math.min(Math.max(0,lastRow),this.getLength()-1);var deleteFirstNewLine=lastRow==this.getLength()-1&&firstRow>0,deleteLastNewLine=this.getLength()-1>lastRow,startRow=deleteFirstNewLine?firstRow-1:firstRow,startCol=deleteFirstNewLine?this.getLine(startRow).length:0,endRow=deleteLastNewLine?lastRow+1:lastRow,endCol=deleteLastNewLine?0:this.getLine(endRow).length,range=new Range(startRow,startCol,endRow,endCol),deletedLines=this.$lines.slice(firstRow,lastRow+1);return this.applyDelta({start:range.start,end:range.end,action:\"remove\",lines:this.getLinesForRange(range)}),deletedLines},this.removeNewLine=function(row){this.getLength()-1>row&&row>=0&&this.applyDelta({start:this.pos(row,this.getLine(row).length),end:this.pos(row+1,0),action:\"remove\",lines:[\"\",\"\"]})},this.replace=function(range,text){if(range instanceof Range||(range=Range.fromPoints(range.start,range.end)),0===text.length&&range.isEmpty())return range.start;if(text==this.getTextRange(range))return range.end;this.remove(range);var end;return end=text?this.insert(range.start,text):range.start},this.applyDeltas=function(deltas){for(var i=0;deltas.length>i;i++)this.applyDelta(deltas[i])},this.revertDeltas=function(deltas){for(var i=deltas.length-1;i>=0;i--)this.revertDelta(deltas[i])},this.applyDelta=function(delta,doNotValidate){var isInsert=\"insert\"==delta.action;(isInsert?1>=delta.lines.length&&!delta.lines[0]:!Range.comparePoints(delta.start,delta.end))||(isInsert&&delta.lines.length>2e4&&this.$splitAndapplyLargeDelta(delta,2e4),applyDelta(this.$lines,delta,doNotValidate),this._signal(\"change\",delta))},this.$splitAndapplyLargeDelta=function(delta,MAX){for(var lines=delta.lines,l=lines.length,row=delta.start.row,column=delta.start.column,from=0,to=0;;){from=to,to+=MAX-1;var chunk=lines.slice(from,to);if(to>l){delta.lines=chunk,delta.start.row=row+from,delta.start.column=column;break}chunk.push(\"\"),this.applyDelta({start:this.pos(row+from,column),end:this.pos(row+to,column=0),action:delta.action,lines:chunk},!0)}},this.revertDelta=function(delta){this.applyDelta({start:this.clonePos(delta.start),end:this.clonePos(delta.end),action:\"insert\"==delta.action?\"remove\":\"insert\",lines:delta.lines.slice()})},this.indexToPosition=function(index,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,i=startRow||0,l=lines.length;l>i;i++)if(index-=lines[i].length+newlineLength,0>index)return{row:i,column:index+lines[i].length+newlineLength};return{row:l-1,column:lines[l-1].length}},this.positionToIndex=function(pos,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,index=0,row=Math.min(pos.row,lines.length),i=startRow||0;row>i;++i)index+=lines[i].length+newlineLength;return index+pos.column}}).call(Document.prototype),exports.Document=Document}),ace.define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.last=function(a){return a[a.length-1]},exports.stringReverse=function(string){return string.split(\"\").reverse().join(\"\")},exports.stringRepeat=function(string,count){for(var result=\"\";count>0;)1&count&&(result+=string),(count>>=1)&&(string+=string);return result};var trimBeginRegexp=/^\\s\\s*/,trimEndRegexp=/\\s\\s*$/;exports.stringTrimLeft=function(string){return string.replace(trimBeginRegexp,\"\")},exports.stringTrimRight=function(string){return string.replace(trimEndRegexp,\"\")},exports.copyObject=function(obj){var copy={};for(var key in obj)copy[key]=obj[key];return copy},exports.copyArray=function(array){for(var copy=[],i=0,l=array.length;l>i;i++)copy[i]=array[i]&&\"object\"==typeof array[i]?this.copyObject(array[i]):array[i];return copy},exports.deepCopy=function deepCopy(obj){if(\"object\"!=typeof obj||!obj)return obj;var copy;if(Array.isArray(obj)){copy=[];for(var key=0;obj.length>key;key++)copy[key]=deepCopy(obj[key]);return copy}if(\"[object Object]\"!==Object.prototype.toString.call(obj))return obj;copy={};for(var key in obj)copy[key]=deepCopy(obj[key]);return copy},exports.arrayToMap=function(arr){for(var map={},i=0;arr.length>i;i++)map[arr[i]]=1;return map},exports.createMap=function(props){var map=Object.create(null);for(var i in props)map[i]=props[i];return map},exports.arrayRemove=function(array,value){for(var i=0;array.length>=i;i++)value===array[i]&&array.splice(i,1)},exports.escapeRegExp=function(str){return str.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},exports.escapeHTML=function(str){return str.replace(/&/g,\"&\").replace(/\"/g,\""\").replace(/'/g,\"'\").replace(/i;i+=2){if(Array.isArray(data[i+1]))var d={action:\"insert\",start:data[i],lines:data[i+1]};else var d={action:\"remove\",start:data[i],end:data[i+1]};doc.applyDelta(d,!0)}return _self.$timeout?deferredUpdate.schedule(_self.$timeout):(_self.onUpdate(),void 0)})};(function(){this.$timeout=500,this.setTimeout=function(timeout){this.$timeout=timeout},this.setValue=function(value){this.doc.setValue(value),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(callbackId){this.sender.callback(this.doc.getValue(),callbackId)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(Mirror.prototype)}),ace.define(\"ace/mode/javascript/jshint\",[\"require\",\"exports\",\"module\"],function(acequire,exports,module){module.exports=function outer(modules,cache,entry){function newRequire(name,jumped){if(!cache[name]){if(!modules[name]){var currentRequire=\"function\"==typeof acequire&&acequire;if(!jumped&¤tRequire)return currentRequire(name,!0);if(previousRequire)return previousRequire(name,!0);var err=Error(\"Cannot find module '\"+name+\"'\");throw err.code=\"MODULE_NOT_FOUND\",err}var m=cache[name]={exports:{}};modules[name][0].call(m.exports,function(x){var id=modules[name][1][x];return newRequire(id?id:x)},m,m.exports,outer,modules,cache,entry)}return cache[name].exports}for(var previousRequire=\"function\"==typeof acequire&&acequire,i=0;entry.length>i;i++)newRequire(entry[i]);return newRequire(entry[0])}({\"/node_modules/browserify/node_modules/events/events.js\":[function(_dereq_,module){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return\"function\"==typeof arg}function isNumber(arg){return\"number\"==typeof arg}function isObject(arg){return\"object\"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||0>n||isNaN(n))throw TypeError(\"n must be a positive number\");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),\"error\"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;throw TypeError('Uncaught, unspecified \"error\" event.')}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:for(len=arguments.length,args=Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];handler.apply(this,args)}else if(isObject(handler)){for(len=arguments.length,args=Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];for(listeners=handler.slice(),len=listeners.length,i=0;len>i;i++)listeners[i].apply(this,args)}return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError(\"listener must be a function\");if(this._events||(this._events={}),this._events.newListener&&this.emit(\"newListener\",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned){var m;m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error(\"(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.\",this._events[type].length),\"function\"==typeof console.trace&&console.trace())}return this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError(\"listener must be a function\");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError(\"listener must be a function\");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit(\"removeListener\",type,listener);else if(isObject(list)){for(i=length;i-->0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(0>position)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit(\"removeListener\",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)\"removeListener\"!==key&&this.removeAllListeners(key);return this.removeAllListeners(\"removeListener\"),this._events={},this\n}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.listenerCount=function(emitter,type){var ret;return ret=emitter._events&&emitter._events[type]?isFunction(emitter._events[type])?1:emitter._events[type].length:0}},{}],\"/node_modules/jshint/data/ascii-identifier-data.js\":[function(_dereq_,module){for(var identifierStartTable=[],i=0;128>i;i++)identifierStartTable[i]=36===i||i>=65&&90>=i||95===i||i>=97&&122>=i;for(var identifierPartTable=[],i=0;128>i;i++)identifierPartTable[i]=identifierStartTable[i]||i>=48&&57>=i;module.exports={asciiIdentifierStartTable:identifierStartTable,asciiIdentifierPartTable:identifierPartTable}},{}],\"/node_modules/jshint/lodash.js\":[function(_dereq_,module,exports){(function(global){(function(){function baseFindIndex(array,predicate,fromRight){for(var length=array.length,index=fromRight?length:-1;fromRight?index--:length>++index;)if(predicate(array[index],index,array))return index;return-1}function baseIndexOf(array,value,fromIndex){if(value!==value)return indexOfNaN(array,fromIndex);for(var index=fromIndex-1,length=array.length;length>++index;)if(array[index]===value)return index;return-1}function baseIsFunction(value){return\"function\"==typeof value||!1}function baseToString(value){return\"string\"==typeof value?value:null==value?\"\":value+\"\"}function indexOfNaN(array,fromIndex,fromRight){for(var length=array.length,index=fromIndex+(fromRight?0:-1);fromRight?index--:length>++index;){var other=array[index];if(other!==other)return index}return-1}function isObjectLike(value){return!!value&&\"object\"==typeof value}function lodash(){}function arrayCopy(source,array){var index=-1,length=source.length;for(array||(array=Array(length));length>++index;)array[index]=source[index];return array}function arrayEach(array,iteratee){for(var index=-1,length=array.length;length>++index&&iteratee(array[index],index,array)!==!1;);return array}function arrayFilter(array,predicate){for(var index=-1,length=array.length,resIndex=-1,result=[];length>++index;){var value=array[index];predicate(value,index,array)&&(result[++resIndex]=value)}return result}function arrayMap(array,iteratee){for(var index=-1,length=array.length,result=Array(length);length>++index;)result[index]=iteratee(array[index],index,array);return result}function arrayMax(array){for(var index=-1,length=array.length,result=NEGATIVE_INFINITY;length>++index;){var value=array[index];value>result&&(result=value)}return result}function arraySome(array,predicate){for(var index=-1,length=array.length;length>++index;)if(predicate(array[index],index,array))return!0;return!1}function assignWith(object,source,customizer){var props=keys(source);push.apply(props,getSymbols(source));for(var index=-1,length=props.length;length>++index;){var key=props[index],value=object[key],result=customizer(value,source[key],key,object,source);(result===result?result===value:value!==value)&&(value!==undefined||key in object)||(object[key]=result)}return object}function baseCopy(source,props,object){object||(object={});for(var index=-1,length=props.length;length>++index;){var key=props[index];object[key]=source[key]}return object}function baseCallback(func,thisArg,argCount){var type=typeof func;return\"function\"==type?thisArg===undefined?func:bindCallback(func,thisArg,argCount):null==func?identity:\"object\"==type?baseMatches(func):thisArg===undefined?property(func):baseMatchesProperty(func,thisArg)}function baseClone(value,isDeep,customizer,key,object,stackA,stackB){var result;if(customizer&&(result=object?customizer(value,key,object):customizer(value)),result!==undefined)return result;if(!isObject(value))return value;var isArr=isArray(value);if(isArr){if(result=initCloneArray(value),!isDeep)return arrayCopy(value,result)}else{var tag=objToString.call(value),isFunc=tag==funcTag;if(tag!=objectTag&&tag!=argsTag&&(!isFunc||object))return cloneableTags[tag]?initCloneByTag(value,tag,isDeep):object?value:{};if(result=initCloneObject(isFunc?{}:value),!isDeep)return baseAssign(result,value)}stackA||(stackA=[]),stackB||(stackB=[]);for(var length=stackA.length;length--;)if(stackA[length]==value)return stackB[length];return stackA.push(value),stackB.push(result),(isArr?arrayEach:baseForOwn)(value,function(subValue,key){result[key]=baseClone(subValue,isDeep,customizer,key,value,stackA,stackB)}),result}function baseFilter(collection,predicate){var result=[];return baseEach(collection,function(value,index,collection){predicate(value,index,collection)&&result.push(value)}),result}function baseForIn(object,iteratee){return baseFor(object,iteratee,keysIn)}function baseForOwn(object,iteratee){return baseFor(object,iteratee,keys)}function baseGet(object,path,pathKey){if(null!=object){pathKey!==undefined&&pathKey in toObject(object)&&(path=[pathKey]);for(var index=-1,length=path.length;null!=object&&length>++index;)var result=object=object[path[index]];return result}}function baseIsEqual(value,other,customizer,isLoose,stackA,stackB){if(value===other)return 0!==value||1/value==1/other;var valType=typeof value,othType=typeof other;return\"function\"!=valType&&\"object\"!=valType&&\"function\"!=othType&&\"object\"!=othType||null==value||null==other?value!==value&&other!==other:baseIsEqualDeep(value,other,baseIsEqual,customizer,isLoose,stackA,stackB)}function baseIsEqualDeep(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=arrayTag,othTag=arrayTag;objIsArr||(objTag=objToString.call(object),objTag==argsTag?objTag=objectTag:objTag!=objectTag&&(objIsArr=isTypedArray(object))),othIsArr||(othTag=objToString.call(other),othTag==argsTag?othTag=objectTag:othTag!=objectTag&&(othIsArr=isTypedArray(other)));var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&!objIsArr&&!objIsObj)return equalByTag(object,other,objTag);if(!isLoose){var valWrapped=objIsObj&&hasOwnProperty.call(object,\"__wrapped__\"),othWrapped=othIsObj&&hasOwnProperty.call(other,\"__wrapped__\");if(valWrapped||othWrapped)return equalFunc(valWrapped?object.value():object,othWrapped?other.value():other,customizer,isLoose,stackA,stackB)}if(!isSameTag)return!1;stackA||(stackA=[]),stackB||(stackB=[]);for(var length=stackA.length;length--;)if(stackA[length]==object)return stackB[length]==other;stackA.push(object),stackB.push(other);var result=(objIsArr?equalArrays:equalObjects)(object,other,equalFunc,customizer,isLoose,stackA,stackB);return stackA.pop(),stackB.pop(),result}function baseIsMatch(object,props,values,strictCompareFlags,customizer){for(var index=-1,length=props.length,noCustomizer=!customizer;length>++index;)if(noCustomizer&&strictCompareFlags[index]?values[index]!==object[props[index]]:!(props[index]in object))return!1;for(index=-1;length>++index;){var key=props[index],objValue=object[key],srcValue=values[index];if(noCustomizer&&strictCompareFlags[index])var result=objValue!==undefined||key in object;else result=customizer?customizer(objValue,srcValue,key):undefined,result===undefined&&(result=baseIsEqual(srcValue,objValue,customizer,!0));if(!result)return!1}return!0}function baseMatches(source){var props=keys(source),length=props.length;if(!length)return constant(!0);if(1==length){var key=props[0],value=source[key];if(isStrictComparable(value))return function(object){return null==object?!1:object[key]===value&&(value!==undefined||key in toObject(object))}}for(var values=Array(length),strictCompareFlags=Array(length);length--;)value=source[props[length]],values[length]=value,strictCompareFlags[length]=isStrictComparable(value);return function(object){return null!=object&&baseIsMatch(toObject(object),props,values,strictCompareFlags)}}function baseMatchesProperty(path,value){var isArr=isArray(path),isCommon=isKey(path)&&isStrictComparable(value),pathKey=path+\"\";return path=toPath(path),function(object){if(null==object)return!1;var key=pathKey;if(object=toObject(object),!(!isArr&&isCommon||key in object)){if(object=1==path.length?object:baseGet(object,baseSlice(path,0,-1)),null==object)return!1;key=last(path),object=toObject(object)}return object[key]===value?value!==undefined||key in object:baseIsEqual(value,object[key],null,!0)}}function baseMerge(object,source,customizer,stackA,stackB){if(!isObject(object))return object;var isSrcArr=isLength(source.length)&&(isArray(source)||isTypedArray(source));if(!isSrcArr){var props=keys(source);push.apply(props,getSymbols(source))}return arrayEach(props||source,function(srcValue,key){if(props&&(key=srcValue,srcValue=source[key]),isObjectLike(srcValue))stackA||(stackA=[]),stackB||(stackB=[]),baseMergeDeep(object,source,key,baseMerge,customizer,stackA,stackB);else{var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=result===undefined;isCommon&&(result=srcValue),!isSrcArr&&result===undefined||!isCommon&&(result===result?result===value:value!==value)||(object[key]=result)}}),object}function baseMergeDeep(object,source,key,mergeFunc,customizer,stackA,stackB){for(var length=stackA.length,srcValue=source[key];length--;)if(stackA[length]==srcValue)return object[key]=stackB[length],undefined;var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=result===undefined;isCommon&&(result=srcValue,isLength(srcValue.length)&&(isArray(srcValue)||isTypedArray(srcValue))?result=isArray(value)?value:getLength(value)?arrayCopy(value):[]:isPlainObject(srcValue)||isArguments(srcValue)?result=isArguments(value)?toPlainObject(value):isPlainObject(value)?value:{}:isCommon=!1),stackA.push(srcValue),stackB.push(result),isCommon?object[key]=mergeFunc(result,srcValue,customizer,stackA,stackB):(result===result?result!==value:value===value)&&(object[key]=result)}function baseProperty(key){return function(object){return null==object?undefined:object[key]}}function basePropertyDeep(path){var pathKey=path+\"\";return path=toPath(path),function(object){return baseGet(object,path,pathKey)}}function baseSlice(array,start,end){var index=-1,length=array.length;start=null==start?0:+start||0,0>start&&(start=-start>length?0:length+start),end=end===undefined||end>length?length:+end||0,0>end&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);length>++index;)result[index]=array[index+start];return result}function baseSome(collection,predicate){var result;return baseEach(collection,function(value,index,collection){return result=predicate(value,index,collection),!result}),!!result}function baseValues(object,props){for(var index=-1,length=props.length,result=Array(length);length>++index;)result[index]=object[props[index]];return result}function binaryIndex(array,value,retHighest){var low=0,high=array?array.length:low;if(\"number\"==typeof value&&value===value&&HALF_MAX_ARRAY_LENGTH>=high){for(;high>low;){var mid=low+high>>>1,computed=array[mid];(retHighest?value>=computed:value>computed)?low=mid+1:high=mid}return high}return binaryIndexBy(array,value,identity,retHighest)}function binaryIndexBy(array,value,iteratee,retHighest){value=iteratee(value);for(var low=0,high=array?array.length:0,valIsNaN=value!==value,valIsUndef=value===undefined;high>low;){var mid=floor((low+high)/2),computed=iteratee(array[mid]),isReflexive=computed===computed;if(valIsNaN)var setLow=isReflexive||retHighest;else setLow=valIsUndef?isReflexive&&(retHighest||computed!==undefined):retHighest?value>=computed:value>computed;setLow?low=mid+1:high=mid}return nativeMin(high,MAX_ARRAY_INDEX)}function bindCallback(func,thisArg,argCount){if(\"function\"!=typeof func)return identity;if(thisArg===undefined)return func;switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)};case 5:return function(value,other,key,object,source){return func.call(thisArg,value,other,key,object,source)}}return function(){return func.apply(thisArg,arguments)}}function bufferClone(buffer){return bufferSlice.call(buffer,0)}function createAssigner(assigner){return restParam(function(object,sources){var index=-1,length=null==object?0:sources.length,customizer=length>2&&sources[length-2],guard=length>2&&sources[2],thisArg=length>1&&sources[length-1];for(\"function\"==typeof customizer?(customizer=bindCallback(customizer,thisArg,5),length-=2):(customizer=\"function\"==typeof thisArg?thisArg:null,length-=customizer?1:0),guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=3>length?null:customizer,length=1);length>++index;){var source=sources[index];source&&assigner(object,source,customizer)}return object})}function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){var length=collection?getLength(collection):0;if(!isLength(length))return eachFunc(collection,iteratee);for(var index=fromRight?length:-1,iterable=toObject(collection);(fromRight?index--:length>++index)&&iteratee(iterable[index],index,iterable)!==!1;);return collection}}function createBaseFor(fromRight){return function(object,iteratee,keysFunc){for(var iterable=toObject(object),props=keysFunc(object),length=props.length,index=fromRight?length:-1;fromRight?index--:length>++index;){var key=props[index];if(iteratee(iterable[key],key,iterable)===!1)break}return object}}function createFindIndex(fromRight){return function(array,predicate,thisArg){return array&&array.length?(predicate=getCallback(predicate,thisArg,3),baseFindIndex(array,predicate,fromRight)):-1}}function createForEach(arrayFunc,eachFunc){return function(collection,iteratee,thisArg){return\"function\"==typeof iteratee&&thisArg===undefined&&isArray(collection)?arrayFunc(collection,iteratee):eachFunc(collection,bindCallback(iteratee,thisArg,3))}}function equalArrays(array,other,equalFunc,customizer,isLoose,stackA,stackB){var index=-1,arrLength=array.length,othLength=other.length,result=!0;if(arrLength!=othLength&&!(isLoose&&othLength>arrLength))return!1;for(;result&&arrLength>++index;){var arrValue=array[index],othValue=other[index];if(result=undefined,customizer&&(result=isLoose?customizer(othValue,arrValue,index):customizer(arrValue,othValue,index)),result===undefined)if(isLoose)for(var othIndex=othLength;othIndex--&&(othValue=other[othIndex],!(result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB))););else result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB)}return!!result}function equalByTag(object,other,tag){switch(tag){case boolTag:case dateTag:return+object==+other;case errorTag:return object.name==other.name&&object.message==other.message;case numberTag:return object!=+object?other!=+other:0==object?1/object==1/other:object==+other;case regexpTag:case stringTag:return object==other+\"\"}return!1}function equalObjects(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objProps=keys(object),objLength=objProps.length,othProps=keys(other),othLength=othProps.length;if(objLength!=othLength&&!isLoose)return!1;for(var skipCtor=isLoose,index=-1;objLength>++index;){var key=objProps[index],result=isLoose?key in other:hasOwnProperty.call(other,key);if(result){var objValue=object[key],othValue=other[key];result=undefined,customizer&&(result=isLoose?customizer(othValue,objValue,key):customizer(objValue,othValue,key)),result===undefined&&(result=objValue&&objValue===othValue||equalFunc(objValue,othValue,customizer,isLoose,stackA,stackB))}if(!result)return!1;skipCtor||(skipCtor=\"constructor\"==key)}if(!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;if(objCtor!=othCtor&&\"constructor\"in object&&\"constructor\"in other&&!(\"function\"==typeof objCtor&&objCtor instanceof objCtor&&\"function\"==typeof othCtor&&othCtor instanceof othCtor))return!1}return!0}function getCallback(func,thisArg,argCount){var result=lodash.callback||callback;return result=result===callback?baseCallback:result,argCount?result(func,thisArg,argCount):result}function getIndexOf(collection,target,fromIndex){var result=lodash.indexOf||indexOf;return result=result===indexOf?baseIndexOf:result,collection?result(collection,target,fromIndex):result}function initCloneArray(array){var length=array.length,result=new array.constructor(length);return length&&\"string\"==typeof array[0]&&hasOwnProperty.call(array,\"index\")&&(result.index=array.index,result.input=array.input),result}function initCloneObject(object){var Ctor=object.constructor;return\"function\"==typeof Ctor&&Ctor instanceof Ctor||(Ctor=Object),new Ctor}function initCloneByTag(object,tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return bufferClone(object);case boolTag:case dateTag:return new Ctor(+object);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:var buffer=object.buffer;return new Ctor(isDeep?bufferClone(buffer):buffer,object.byteOffset,object.length);case numberTag:case stringTag:return new Ctor(object);case regexpTag:var result=new Ctor(object.source,reFlags.exec(object));result.lastIndex=object.lastIndex}return result}function isIndex(value,length){return value=+value,length=null==length?MAX_SAFE_INTEGER:length,value>-1&&0==value%1&&length>value}function isIterateeCall(value,index,object){if(!isObject(object))return!1;var type=typeof index;if(\"number\"==type)var length=getLength(object),prereq=isLength(length)&&isIndex(index,length);else prereq=\"string\"==type&&index in object;if(prereq){var other=object[index];return value===value?value===other:other!==other}return!1}function isKey(value,object){var type=typeof value;if(\"string\"==type&&reIsPlainProp.test(value)||\"number\"==type)return!0;if(isArray(value))return!1;var result=!reIsDeepProp.test(value);return result||null!=object&&value in toObject(object)}function isLength(value){return\"number\"==typeof value&&value>-1&&0==value%1&&MAX_SAFE_INTEGER>=value}function isStrictComparable(value){return value===value&&(0===value?1/value>0:!isObject(value))}function shimIsPlainObject(value){var Ctor;if(lodash.support,!isObjectLike(value)||objToString.call(value)!=objectTag||!hasOwnProperty.call(value,\"constructor\")&&(Ctor=value.constructor,\"function\"==typeof Ctor&&!(Ctor instanceof Ctor)))return!1;var result;return baseForIn(value,function(subValue,key){result=key}),result===undefined||hasOwnProperty.call(value,result)}function shimKeys(object){for(var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length,support=lodash.support,allowIndexes=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object)),index=-1,result=[];propsLength>++index;){var key=props[index];(allowIndexes&&isIndex(key,length)||hasOwnProperty.call(object,key))&&result.push(key)}return result}function toObject(value){return isObject(value)?value:Object(value)}function toPath(value){if(isArray(value))return value;var result=[];return baseToString(value).replace(rePropName,function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,\"$1\"):number||match)}),result}function indexOf(array,value,fromIndex){var length=array?array.length:0;if(!length)return-1;if(\"number\"==typeof fromIndex)fromIndex=0>fromIndex?nativeMax(length+fromIndex,0):fromIndex;else if(fromIndex){var index=binaryIndex(array,value),other=array[index];return(value===value?value===other:other!==other)?index:-1}return baseIndexOf(array,value,fromIndex||0)}function last(array){var length=array?array.length:0;return length?array[length-1]:undefined}function slice(array,start,end){var length=array?array.length:0;return length?(end&&\"number\"!=typeof end&&isIterateeCall(array,start,end)&&(start=0,end=length),baseSlice(array,start,end)):[]}function unzip(array){for(var index=-1,length=(array&&array.length&&arrayMax(arrayMap(array,getLength)))>>>0,result=Array(length);length>++index;)result[index]=arrayMap(array,baseProperty(index));return result}function includes(collection,target,fromIndex,guard){var length=collection?getLength(collection):0;return isLength(length)||(collection=values(collection),length=collection.length),length?(fromIndex=\"number\"!=typeof fromIndex||guard&&isIterateeCall(target,fromIndex,guard)?0:0>fromIndex?nativeMax(length+fromIndex,0):fromIndex||0,\"string\"==typeof collection||!isArray(collection)&&isString(collection)?length>fromIndex&&collection.indexOf(target,fromIndex)>-1:getIndexOf(collection,target,fromIndex)>-1):!1}function reject(collection,predicate,thisArg){var func=isArray(collection)?arrayFilter:baseFilter;return predicate=getCallback(predicate,thisArg,3),func(collection,function(value,index,collection){return!predicate(value,index,collection)})}function some(collection,predicate,thisArg){var func=isArray(collection)?arraySome:baseSome;return thisArg&&isIterateeCall(collection,predicate,thisArg)&&(predicate=null),(\"function\"!=typeof predicate||thisArg!==undefined)&&(predicate=getCallback(predicate,thisArg,3)),func(collection,predicate)}function restParam(func,start){if(\"function\"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=nativeMax(start===undefined?func.length-1:+start||0,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),rest=Array(length);length>++index;)rest[index]=args[start+index];switch(start){case 0:return func.call(this,rest);case 1:return func.call(this,args[0],rest);case 2:return func.call(this,args[0],args[1],rest)}var otherArgs=Array(start+1);for(index=-1;start>++index;)otherArgs[index]=args[index];return otherArgs[start]=rest,func.apply(this,otherArgs)}}function clone(value,isDeep,customizer,thisArg){return isDeep&&\"boolean\"!=typeof isDeep&&isIterateeCall(value,isDeep,customizer)?isDeep=!1:\"function\"==typeof isDeep&&(thisArg=customizer,customizer=isDeep,isDeep=!1),customizer=\"function\"==typeof customizer&&bindCallback(customizer,thisArg,1),baseClone(value,isDeep,customizer)}function isArguments(value){var length=isObjectLike(value)?value.length:undefined;return isLength(length)&&objToString.call(value)==argsTag}function isEmpty(value){if(null==value)return!0;var length=getLength(value);return isLength(length)&&(isArray(value)||isString(value)||isArguments(value)||isObjectLike(value)&&isFunction(value.splice))?!length:!keys(value).length}function isObject(value){var type=typeof value;return\"function\"==type||!!value&&\"object\"==type}function isNative(value){return null==value?!1:objToString.call(value)==funcTag?reIsNative.test(fnToString.call(value)):isObjectLike(value)&&reIsHostCtor.test(value)}function isNumber(value){return\"number\"==typeof value||isObjectLike(value)&&objToString.call(value)==numberTag}function isString(value){return\"string\"==typeof value||isObjectLike(value)&&objToString.call(value)==stringTag}function isTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[objToString.call(value)]}function toPlainObject(value){return baseCopy(value,keysIn(value))}function has(object,path){if(null==object)return!1;var result=hasOwnProperty.call(object,path);return result||isKey(path)||(path=toPath(path),object=1==path.length?object:baseGet(object,baseSlice(path,0,-1)),path=last(path),result=null!=object&&hasOwnProperty.call(object,path)),result}function keysIn(object){if(null==object)return[];isObject(object)||(object=Object(object));var length=object.length;length=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object))&&length||0;for(var Ctor=object.constructor,index=-1,isProto=\"function\"==typeof Ctor&&Ctor.prototype===object,result=Array(length),skipIndexes=length>0;length>++index;)result[index]=index+\"\";for(var key in object)skipIndexes&&isIndex(key,length)||\"constructor\"==key&&(isProto||!hasOwnProperty.call(object,key))||result.push(key);return result}function values(object){return baseValues(object,keys(object))}function escapeRegExp(string){return string=baseToString(string),string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,\"\\\\$&\"):string}function callback(func,thisArg,guard){return guard&&isIterateeCall(func,thisArg,guard)&&(thisArg=null),baseCallback(func,thisArg)}function constant(value){return function(){return value}}function identity(value){return value}function property(path){return isKey(path)?baseProperty(path):basePropertyDeep(path)}var undefined,VERSION=\"3.7.0\",FUNC_ERROR_TEXT=\"Expected a function\",argsTag=\"[object Arguments]\",arrayTag=\"[object Array]\",boolTag=\"[object Boolean]\",dateTag=\"[object Date]\",errorTag=\"[object Error]\",funcTag=\"[object Function]\",mapTag=\"[object Map]\",numberTag=\"[object Number]\",objectTag=\"[object Object]\",regexpTag=\"[object RegExp]\",setTag=\"[object Set]\",stringTag=\"[object String]\",weakMapTag=\"[object WeakMap]\",arrayBufferTag=\"[object ArrayBuffer]\",float32Tag=\"[object Float32Array]\",float64Tag=\"[object Float64Array]\",int8Tag=\"[object Int8Array]\",int16Tag=\"[object Int16Array]\",int32Tag=\"[object Int32Array]\",uint8Tag=\"[object Uint8Array]\",uint8ClampedTag=\"[object Uint8ClampedArray]\",uint16Tag=\"[object Uint16Array]\",uint32Tag=\"[object Uint32Array]\",reIsDeepProp=/\\.|\\[(?:[^[\\]]+|([\"'])(?:(?!\\1)[^\\n\\\\]|\\\\.)*?)\\1\\]/,reIsPlainProp=/^\\w*$/,rePropName=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\n\\\\]|\\\\.)*?)\\2)\\]/g,reRegExpChars=/[.*+?^${}()|[\\]\\/\\\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source),reEscapeChar=/\\\\(\\\\)?/g,reFlags=/\\w*$/,reIsHostCtor=/^\\[object .+?Constructor\\]$/,typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[stringTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[mapTag]=cloneableTags[setTag]=cloneableTags[weakMapTag]=!1;var objectTypes={\"function\":!0,object:!0},freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports,freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module,freeGlobal=freeExports&&freeModule&&\"object\"==typeof global&&global&&global.Object&&global,freeSelf=objectTypes[typeof self]&&self&&self.Object&&self,freeWindow=objectTypes[typeof window]&&window&&window.Object&&window,moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports,root=freeGlobal||freeWindow!==(this&&this.window)&&freeWindow||freeSelf||this,arrayProto=Array.prototype,objectProto=Object.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString,reIsNative=RegExp(\"^\"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,\"$1.*?\")+\"$\"),ArrayBuffer=isNative(ArrayBuffer=root.ArrayBuffer)&&ArrayBuffer,bufferSlice=isNative(bufferSlice=ArrayBuffer&&new ArrayBuffer(0).slice)&&bufferSlice,floor=Math.floor,getOwnPropertySymbols=isNative(getOwnPropertySymbols=Object.getOwnPropertySymbols)&&getOwnPropertySymbols,getPrototypeOf=isNative(getPrototypeOf=Object.getPrototypeOf)&&getPrototypeOf,push=arrayProto.push,preventExtensions=isNative(Object.preventExtensions=Object.preventExtensions)&&preventExtensions,propertyIsEnumerable=objectProto.propertyIsEnumerable,Uint8Array=isNative(Uint8Array=root.Uint8Array)&&Uint8Array,Float64Array=function(){try{var func=isNative(func=root.Float64Array)&&func,result=new func(new ArrayBuffer(10),0,1)&&func}catch(e){}return result}(),nativeAssign=function(){var object={1:0},func=preventExtensions&&isNative(func=Object.assign)&&func;try{func(preventExtensions(object),\"xo\")}catch(e){}return!object[1]&&func}(),nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray,nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys,nativeMax=Math.max,nativeMin=Math.min,NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,MAX_ARRAY_LENGTH=Math.pow(2,32)-1,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1,FLOAT64_BYTES_PER_ELEMENT=Float64Array?Float64Array.BYTES_PER_ELEMENT:0,MAX_SAFE_INTEGER=Math.pow(2,53)-1,support=lodash.support={};(function(x){var Ctor=function(){this.x=x},props=[];Ctor.prototype={valueOf:x,y:x};for(var key in new Ctor)props.push(key);support.funcDecomp=/\\bthis\\b/.test(function(){return this}),support.funcNames=\"string\"==typeof Function.name;try{support.nonEnumArgs=!propertyIsEnumerable.call(arguments,1)}catch(e){support.nonEnumArgs=!0}})(1,0);var baseAssign=nativeAssign||function(object,source){return null==source?object:baseCopy(source,getSymbols(source),baseCopy(source,keys(source),object))},baseEach=createBaseEach(baseForOwn),baseFor=createBaseFor();bufferSlice||(bufferClone=ArrayBuffer&&Uint8Array?function(buffer){var byteLength=buffer.byteLength,floatLength=Float64Array?floor(byteLength/FLOAT64_BYTES_PER_ELEMENT):0,offset=floatLength*FLOAT64_BYTES_PER_ELEMENT,result=new ArrayBuffer(byteLength);if(floatLength){var view=new Float64Array(result,0,floatLength);view.set(new Float64Array(buffer,0,floatLength))}return byteLength!=offset&&(view=new Uint8Array(result,offset),view.set(new Uint8Array(buffer,offset))),result}:constant(null));var getLength=baseProperty(\"length\"),getSymbols=getOwnPropertySymbols?function(object){return getOwnPropertySymbols(toObject(object))}:constant([]),findLastIndex=createFindIndex(!0),zip=restParam(unzip),forEach=createForEach(arrayEach,baseEach),isArray=nativeIsArray||function(value){return isObjectLike(value)&&isLength(value.length)&&objToString.call(value)==arrayTag},isFunction=baseIsFunction(/x/)||Uint8Array&&!baseIsFunction(Uint8Array)?function(value){return objToString.call(value)==funcTag}:baseIsFunction,isPlainObject=getPrototypeOf?function(value){if(!value||objToString.call(value)!=objectTag)return!1;var valueOf=value.valueOf,objProto=isNative(valueOf)&&(objProto=getPrototypeOf(valueOf))&&getPrototypeOf(objProto);return objProto?value==objProto||getPrototypeOf(value)==objProto:shimIsPlainObject(value)}:shimIsPlainObject,assign=createAssigner(function(object,source,customizer){return customizer?assignWith(object,source,customizer):baseAssign(object,source)}),keys=nativeKeys?function(object){if(object)var Ctor=object.constructor,length=object.length;return\"function\"==typeof Ctor&&Ctor.prototype===object||\"function\"!=typeof object&&isLength(length)?shimKeys(object):isObject(object)?nativeKeys(object):[]}:shimKeys,merge=createAssigner(baseMerge);lodash.assign=assign,lodash.callback=callback,lodash.constant=constant,lodash.forEach=forEach,lodash.keys=keys,lodash.keysIn=keysIn,lodash.merge=merge,lodash.property=property,lodash.reject=reject,lodash.restParam=restParam,lodash.slice=slice,lodash.toPlainObject=toPlainObject,lodash.unzip=unzip,lodash.values=values,lodash.zip=zip,lodash.each=forEach,lodash.extend=assign,lodash.iteratee=callback,lodash.clone=clone,lodash.escapeRegExp=escapeRegExp,lodash.findLastIndex=findLastIndex,lodash.has=has,lodash.identity=identity,lodash.includes=includes,lodash.indexOf=indexOf,lodash.isArguments=isArguments,lodash.isArray=isArray,lodash.isEmpty=isEmpty,lodash.isFunction=isFunction,lodash.isNative=isNative,lodash.isNumber=isNumber,lodash.isObject=isObject,lodash.isPlainObject=isPlainObject,lodash.isString=isString,lodash.isTypedArray=isTypedArray,lodash.last=last,lodash.some=some,lodash.any=some,lodash.contains=includes,lodash.include=includes,lodash.VERSION=VERSION,freeExports&&freeModule?moduleExports?(freeModule.exports=lodash)._=lodash:freeExports._=lodash:root._=lodash\n}).call(this)}).call(this,\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{})},{}],\"/node_modules/jshint/src/jshint.js\":[function(_dereq_,module,exports){var _=_dereq_(\"../lodash\"),events=_dereq_(\"events\"),vars=_dereq_(\"./vars.js\"),messages=_dereq_(\"./messages.js\"),Lexer=_dereq_(\"./lex.js\").Lexer,reg=_dereq_(\"./reg.js\"),state=_dereq_(\"./state.js\").state,style=_dereq_(\"./style.js\"),options=_dereq_(\"./options.js\"),scopeManager=_dereq_(\"./scope-manager.js\"),JSHINT=function(){\"use strict\";function checkOption(name,t){return name=name.trim(),/^[+-]W\\d{3}$/g.test(name)?!0:-1!==options.validNames.indexOf(name)||\"jslint\"===t.type||_.has(options.removed,name)?!0:(error(\"E001\",t,name),!1)}function isString(obj){return\"[object String]\"===Object.prototype.toString.call(obj)}function isIdentifier(tkn,value){return tkn?tkn.identifier&&tkn.value===value?!0:!1:!1}function isReserved(token){if(!token.reserved)return!1;var meta=token.meta;if(meta&&meta.isFutureReservedWord&&state.inES5()){if(!meta.es5)return!1;if(meta.strictOnly&&!state.option.strict&&!state.isStrict())return!1;if(token.isProperty)return!1}return!0}function supplant(str,data){return str.replace(/\\{([^{}]*)\\}/g,function(a,b){var r=data[b];return\"string\"==typeof r||\"number\"==typeof r?r:a})}function combine(dest,src){Object.keys(src).forEach(function(name){_.has(JSHINT.blacklist,name)||(dest[name]=src[name])})}function processenforceall(){if(state.option.enforceall){for(var enforceopt in options.bool.enforcing)void 0!==state.option[enforceopt]||options.noenforceall[enforceopt]||(state.option[enforceopt]=!0);for(var relaxopt in options.bool.relaxing)void 0===state.option[relaxopt]&&(state.option[relaxopt]=!1)}}function assume(){processenforceall(),state.option.esversion||state.option.moz||(state.option.esversion=state.option.es3?3:state.option.esnext?6:5),state.inES5()&&combine(predefined,vars.ecmaIdentifiers[5]),state.inES6()&&combine(predefined,vars.ecmaIdentifiers[6]),state.option.module&&(state.option.strict===!0&&(state.option.strict=\"global\"),state.inES6()||warning(\"W134\",state.tokens.next,\"module\",6)),state.option.couch&&combine(predefined,vars.couch),state.option.qunit&&combine(predefined,vars.qunit),state.option.rhino&&combine(predefined,vars.rhino),state.option.shelljs&&(combine(predefined,vars.shelljs),combine(predefined,vars.node)),state.option.typed&&combine(predefined,vars.typed),state.option.phantom&&(combine(predefined,vars.phantom),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.prototypejs&&combine(predefined,vars.prototypejs),state.option.node&&(combine(predefined,vars.node),combine(predefined,vars.typed),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.devel&&combine(predefined,vars.devel),state.option.dojo&&combine(predefined,vars.dojo),state.option.browser&&(combine(predefined,vars.browser),combine(predefined,vars.typed)),state.option.browserify&&(combine(predefined,vars.browser),combine(predefined,vars.typed),combine(predefined,vars.browserify),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.nonstandard&&combine(predefined,vars.nonstandard),state.option.jasmine&&combine(predefined,vars.jasmine),state.option.jquery&&combine(predefined,vars.jquery),state.option.mootools&&combine(predefined,vars.mootools),state.option.worker&&combine(predefined,vars.worker),state.option.wsh&&combine(predefined,vars.wsh),state.option.globalstrict&&state.option.strict!==!1&&(state.option.strict=\"global\"),state.option.yui&&combine(predefined,vars.yui),state.option.mocha&&combine(predefined,vars.mocha)}function quit(code,line,chr){var percentage=Math.floor(100*(line/state.lines.length)),message=messages.errors[code].desc;throw{name:\"JSHintError\",line:line,character:chr,message:message+\" (\"+percentage+\"% scanned).\",raw:message,code:code}}function removeIgnoredMessages(){var ignored=state.ignoredLines;_.isEmpty(ignored)||(JSHINT.errors=_.reject(JSHINT.errors,function(err){return ignored[err.line]}))}function warning(code,t,a,b,c,d){var ch,l,w,msg;if(/^W\\d{3}$/.test(code)){if(state.ignored[code])return;msg=messages.warnings[code]}else/E\\d{3}/.test(code)?msg=messages.errors[code]:/I\\d{3}/.test(code)&&(msg=messages.info[code]);return t=t||state.tokens.next||{},\"(end)\"===t.id&&(t=state.tokens.curr),l=t.line||0,ch=t.from||0,w={id:\"(error)\",raw:msg.desc,code:msg.code,evidence:state.lines[l-1]||\"\",line:l,character:ch,scope:JSHINT.scope,a:a,b:b,c:c,d:d},w.reason=supplant(msg.desc,w),JSHINT.errors.push(w),removeIgnoredMessages(),JSHINT.errors.length>=state.option.maxerr&&quit(\"E043\",l,ch),w}function warningAt(m,l,ch,a,b,c,d){return warning(m,{line:l,from:ch},a,b,c,d)}function error(m,t,a,b,c,d){warning(m,t,a,b,c,d)}function errorAt(m,l,ch,a,b,c,d){return error(m,{line:l,from:ch},a,b,c,d)}function addInternalSrc(elem,src){var i;return i={id:\"(internal)\",elem:elem,value:src},JSHINT.internals.push(i),i}function doOption(){var nt=state.tokens.next,body=nt.body.match(/(-\\s+)?[^\\s,:]+(?:\\s*:\\s*(-\\s+)?[^\\s,]+)?/g)||[],predef={};if(\"globals\"===nt.type){body.forEach(function(g,idx){g=g.split(\":\");var key=(g[0]||\"\").trim(),val=(g[1]||\"\").trim();if(\"-\"===key||!key.length){if(idx>0&&idx===body.length-1)return;return error(\"E002\",nt),void 0}\"-\"===key.charAt(0)?(key=key.slice(1),val=!1,JSHINT.blacklist[key]=key,delete predefined[key]):predef[key]=\"true\"===val}),combine(predefined,predef);for(var key in predef)_.has(predef,key)&&(declared[key]=nt)}\"exported\"===nt.type&&body.forEach(function(e,idx){if(!e.length){if(idx>0&&idx===body.length-1)return;return error(\"E002\",nt),void 0}state.funct[\"(scope)\"].addExported(e)}),\"members\"===nt.type&&(membersOnly=membersOnly||{},body.forEach(function(m){var ch1=m.charAt(0),ch2=m.charAt(m.length-1);ch1!==ch2||'\"'!==ch1&&\"'\"!==ch1||(m=m.substr(1,m.length-2).replace('\\\\\"','\"')),membersOnly[m]=!1}));var numvals=[\"maxstatements\",\"maxparams\",\"maxdepth\",\"maxcomplexity\",\"maxerr\",\"maxlen\",\"indent\"];(\"jshint\"===nt.type||\"jslint\"===nt.type)&&(body.forEach(function(g){g=g.split(\":\");var key=(g[0]||\"\").trim(),val=(g[1]||\"\").trim();if(checkOption(key,nt))if(numvals.indexOf(key)>=0)if(\"false\"!==val){if(val=+val,\"number\"!=typeof val||!isFinite(val)||0>=val||Math.floor(val)!==val)return error(\"E032\",nt,g[1].trim()),void 0;state.option[key]=val}else state.option[key]=\"indent\"===key?4:!1;else{if(\"validthis\"===key)return state.funct[\"(global)\"]?void error(\"E009\"):\"true\"!==val&&\"false\"!==val?void error(\"E002\",nt):(state.option.validthis=\"true\"===val,void 0);if(\"quotmark\"!==key)if(\"shadow\"!==key)if(\"unused\"!==key)if(\"latedef\"!==key)if(\"ignore\"!==key)if(\"strict\"!==key){\"module\"===key&&(hasParsedCode(state.funct)||error(\"E055\",state.tokens.next,\"module\"));var esversions={es3:3,es5:5,esnext:6};if(!_.has(esversions,key)){if(\"esversion\"===key){switch(val){case\"5\":state.inES5(!0)&&warning(\"I003\");case\"3\":case\"6\":state.option.moz=!1,state.option.esversion=+val;break;case\"2015\":state.option.moz=!1,state.option.esversion=6;break;default:error(\"E002\",nt)}return hasParsedCode(state.funct)||error(\"E055\",state.tokens.next,\"esversion\"),void 0}var match=/^([+-])(W\\d{3})$/g.exec(key);if(match)return state.ignored[match[2]]=\"-\"===match[1],void 0;var tn;return\"true\"===val||\"false\"===val?(\"jslint\"===nt.type?(tn=options.renamed[key]||key,state.option[tn]=\"true\"===val,void 0!==options.inverted[tn]&&(state.option[tn]=!state.option[tn])):state.option[key]=\"true\"===val,\"newcap\"===key&&(state.option[\"(explicitNewcap)\"]=!0),void 0):(error(\"E002\",nt),void 0)}switch(val){case\"true\":state.option.moz=!1,state.option.esversion=esversions[key];break;case\"false\":state.option.moz||(state.option.esversion=5);break;default:error(\"E002\",nt)}}else switch(val){case\"true\":state.option.strict=!0;break;case\"false\":state.option.strict=!1;break;case\"func\":case\"global\":case\"implied\":state.option.strict=val;break;default:error(\"E002\",nt)}else switch(val){case\"line\":state.ignoredLines[nt.line]=!0,removeIgnoredMessages();break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.latedef=!0;break;case\"false\":state.option.latedef=!1;break;case\"nofunc\":state.option.latedef=\"nofunc\";break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.unused=!0;break;case\"false\":state.option.unused=!1;break;case\"vars\":case\"strict\":state.option.unused=val;break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.shadow=!0;break;case\"outer\":state.option.shadow=\"outer\";break;case\"false\":case\"inner\":state.option.shadow=\"inner\";break;default:error(\"E002\",nt)}else switch(val){case\"true\":case\"false\":state.option.quotmark=\"true\"===val;break;case\"double\":case\"single\":state.option.quotmark=val;break;default:error(\"E002\",nt)}}}),assume())}function peek(p){var t,i=p||0,j=lookahead.length;if(j>i)return lookahead[i];for(;i>=j;)t=lookahead[j],t||(t=lookahead[j]=lex.token()),j+=1;return t||\"(end)\"!==state.tokens.next.id?t:state.tokens.next}function peekIgnoreEOL(){var t,i=0;do t=peek(i++);while(\"(endline)\"===t.id);return t}function advance(id,t){switch(state.tokens.curr.id){case\"(number)\":\".\"===state.tokens.next.id&&warning(\"W005\",state.tokens.curr);break;case\"-\":(\"-\"===state.tokens.next.id||\"--\"===state.tokens.next.id)&&warning(\"W006\");break;case\"+\":(\"+\"===state.tokens.next.id||\"++\"===state.tokens.next.id)&&warning(\"W007\")}for(id&&state.tokens.next.id!==id&&(t?\"(end)\"===state.tokens.next.id?error(\"E019\",t,t.id):error(\"E020\",state.tokens.next,id,t.id,t.line,state.tokens.next.value):(\"(identifier)\"!==state.tokens.next.type||state.tokens.next.value!==id)&&warning(\"W116\",state.tokens.next,id,state.tokens.next.value)),state.tokens.prev=state.tokens.curr,state.tokens.curr=state.tokens.next;;){if(state.tokens.next=lookahead.shift()||lex.token(),state.tokens.next||quit(\"E041\",state.tokens.curr.line),\"(end)\"===state.tokens.next.id||\"(error)\"===state.tokens.next.id)return;if(state.tokens.next.check&&state.tokens.next.check(),state.tokens.next.isSpecial)\"falls through\"===state.tokens.next.type?state.tokens.curr.caseFallsThrough=!0:doOption();else if(\"(endline)\"!==state.tokens.next.id)break}}function isInfix(token){return token.infix||!token.identifier&&!token.template&&!!token.led}function isEndOfExpr(){var curr=state.tokens.curr,next=state.tokens.next;return\";\"===next.id||\"}\"===next.id||\":\"===next.id?!0:isInfix(next)===isInfix(curr)||\"yield\"===curr.id&&state.inMoz()?curr.line!==startLine(next):!1}function isBeginOfExpr(prev){return!prev.left&&\"unary\"!==prev.arity}function expression(rbp,initial){var left,isArray=!1,isObject=!1,isLetExpr=!1;state.nameStack.push(),initial||\"let\"!==state.tokens.next.value||\"(\"!==peek(0).value||(state.inMoz()||warning(\"W118\",state.tokens.next,\"let expressions\"),isLetExpr=!0,state.funct[\"(scope)\"].stack(),advance(\"let\"),advance(\"(\"),state.tokens.prev.fud(),advance(\")\")),\"(end)\"===state.tokens.next.id&&error(\"E006\",state.tokens.curr);var isDangerous=state.option.asi&&state.tokens.prev.line!==startLine(state.tokens.curr)&&_.contains([\"]\",\")\"],state.tokens.prev.id)&&_.contains([\"[\",\"(\"],state.tokens.curr.id);if(isDangerous&&warning(\"W014\",state.tokens.curr,state.tokens.curr.id),advance(),initial&&(state.funct[\"(verb)\"]=state.tokens.curr.value,state.tokens.curr.beginsStmt=!0),initial===!0&&state.tokens.curr.fud)left=state.tokens.curr.fud();else for(state.tokens.curr.nud?left=state.tokens.curr.nud():error(\"E030\",state.tokens.curr,state.tokens.curr.id);(state.tokens.next.lbp>rbp||\"(template)\"===state.tokens.next.type)&&!isEndOfExpr();)isArray=\"Array\"===state.tokens.curr.value,isObject=\"Object\"===state.tokens.curr.value,left&&(left.value||left.first&&left.first.value)&&(\"new\"!==left.value||left.first&&left.first.value&&\".\"===left.first.value)&&(isArray=!1,left.value!==state.tokens.curr.value&&(isObject=!1)),advance(),isArray&&\"(\"===state.tokens.curr.id&&\")\"===state.tokens.next.id&&warning(\"W009\",state.tokens.curr),isObject&&\"(\"===state.tokens.curr.id&&\")\"===state.tokens.next.id&&warning(\"W010\",state.tokens.curr),left&&state.tokens.curr.led?left=state.tokens.curr.led(left):error(\"E033\",state.tokens.curr,state.tokens.curr.id);return isLetExpr&&state.funct[\"(scope)\"].unstack(),state.nameStack.pop(),left}function startLine(token){return token.startLine||token.line}function nobreaknonadjacent(left,right){left=left||state.tokens.curr,right=right||state.tokens.next,state.option.laxbreak||left.line===startLine(right)||warning(\"W014\",right,right.value)}function nolinebreak(t){t=t||state.tokens.curr,t.line!==startLine(state.tokens.next)&&warning(\"E022\",t,t.value)}function nobreakcomma(left,right){left.line!==startLine(right)&&(state.option.laxcomma||(comma.first&&(warning(\"I001\"),comma.first=!1),warning(\"W014\",left,right.value)))}function comma(opts){if(opts=opts||{},opts.peek?nobreakcomma(state.tokens.prev,state.tokens.curr):(nobreakcomma(state.tokens.curr,state.tokens.next),advance(\",\")),state.tokens.next.identifier&&(!opts.property||!state.inES5()))switch(state.tokens.next.value){case\"break\":case\"case\":case\"catch\":case\"continue\":case\"default\":case\"do\":case\"else\":case\"finally\":case\"for\":case\"if\":case\"in\":case\"instanceof\":case\"return\":case\"switch\":case\"throw\":case\"try\":case\"var\":case\"let\":case\"while\":case\"with\":return error(\"E024\",state.tokens.next,state.tokens.next.value),!1}if(\"(punctuator)\"===state.tokens.next.type)switch(state.tokens.next.value){case\"}\":case\"]\":case\",\":if(opts.allowTrailing)return!0;case\")\":return error(\"E024\",state.tokens.next,state.tokens.next.value),!1}return!0}function symbol(s,p){var x=state.syntax[s];return x&&\"object\"==typeof x||(state.syntax[s]=x={id:s,lbp:p,value:s}),x}function delim(s){var x=symbol(s,0);return x.delim=!0,x}function stmt(s,f){var x=delim(s);return x.identifier=x.reserved=!0,x.fud=f,x}function blockstmt(s,f){var x=stmt(s,f);return x.block=!0,x}function reserveName(x){var c=x.id.charAt(0);return(c>=\"a\"&&\"z\">=c||c>=\"A\"&&\"Z\">=c)&&(x.identifier=x.reserved=!0),x}function prefix(s,f){var x=symbol(s,150);return reserveName(x),x.nud=\"function\"==typeof f?f:function(){return this.arity=\"unary\",this.right=expression(150),(\"++\"===this.id||\"--\"===this.id)&&(state.option.plusplus?warning(\"W016\",this,this.id):!this.right||this.right.identifier&&!isReserved(this.right)||\".\"===this.right.id||\"[\"===this.right.id||warning(\"W017\",this),this.right&&this.right.isMetaProperty?error(\"E031\",this):this.right&&this.right.identifier&&state.funct[\"(scope)\"].block.modify(this.right.value,this)),this},x}function type(s,f){var x=delim(s);return x.type=s,x.nud=f,x}function reserve(name,func){var x=type(name,func);return x.identifier=!0,x.reserved=!0,x}function FutureReservedWord(name,meta){var x=type(name,meta&&meta.nud||function(){return this});return meta=meta||{},meta.isFutureReservedWord=!0,x.value=name,x.identifier=!0,x.reserved=!0,x.meta=meta,x}function reservevar(s,v){return reserve(s,function(){return\"function\"==typeof v&&v(this),this})}function infix(s,f,p,w){var x=symbol(s,p);return reserveName(x),x.infix=!0,x.led=function(left){return w||nobreaknonadjacent(state.tokens.prev,state.tokens.curr),\"in\"!==s&&\"instanceof\"!==s||\"!\"!==left.id||warning(\"W018\",left,\"!\"),\"function\"==typeof f?f(left,this):(this.left=left,this.right=expression(p),this)},x}function application(s){var x=symbol(s,42);return x.led=function(left){return nobreaknonadjacent(state.tokens.prev,state.tokens.curr),this.left=left,this.right=doFunction({type:\"arrow\",loneArg:left}),this},x}function relation(s,f){var x=symbol(s,100);return x.led=function(left){nobreaknonadjacent(state.tokens.prev,state.tokens.curr),this.left=left;var right=this.right=expression(100);return isIdentifier(left,\"NaN\")||isIdentifier(right,\"NaN\")?warning(\"W019\",this):f&&f.apply(this,[left,right]),left&&right||quit(\"E041\",state.tokens.curr.line),\"!\"===left.id&&warning(\"W018\",left,\"!\"),\"!\"===right.id&&warning(\"W018\",right,\"!\"),this},x}function isPoorRelation(node){return node&&(\"(number)\"===node.type&&0===+node.value||\"(string)\"===node.type&&\"\"===node.value||\"null\"===node.type&&!state.option.eqnull||\"true\"===node.type||\"false\"===node.type||\"undefined\"===node.type)}function isTypoTypeof(left,right,state){var values;return state.option.notypeof?!1:left&&right?(values=state.inES6()?typeofValues.es6:typeofValues.es3,\"(identifier)\"===right.type&&\"typeof\"===right.value&&\"(string)\"===left.type?!_.contains(values,left.value):!1):!1}function isGlobalEval(left,state){var isGlobal=!1;return\"this\"===left.type&&null===state.funct[\"(context)\"]?isGlobal=!0:\"(identifier)\"===left.type&&(state.option.node&&\"global\"===left.value?isGlobal=!0:!state.option.browser||\"window\"!==left.value&&\"document\"!==left.value||(isGlobal=!0)),isGlobal}function findNativePrototype(left){function walkPrototype(obj){return\"object\"==typeof obj?\"prototype\"===obj.right?obj:walkPrototype(obj.left):void 0}function walkNative(obj){for(;!obj.identifier&&\"object\"==typeof obj.left;)obj=obj.left;return obj.identifier&&natives.indexOf(obj.value)>=0?obj.value:void 0}var natives=[\"Array\",\"ArrayBuffer\",\"Boolean\",\"Collator\",\"DataView\",\"Date\",\"DateTimeFormat\",\"Error\",\"EvalError\",\"Float32Array\",\"Float64Array\",\"Function\",\"Infinity\",\"Intl\",\"Int16Array\",\"Int32Array\",\"Int8Array\",\"Iterator\",\"Number\",\"NumberFormat\",\"Object\",\"RangeError\",\"ReferenceError\",\"RegExp\",\"StopIteration\",\"String\",\"SyntaxError\",\"TypeError\",\"Uint16Array\",\"Uint32Array\",\"Uint8Array\",\"Uint8ClampedArray\",\"URIError\"],prototype=walkPrototype(left);return prototype?walkNative(prototype):void 0}function checkLeftSideAssign(left,assignToken,options){var allowDestructuring=options&&options.allowDestructuring;if(assignToken=assignToken||left,state.option.freeze){var nativeObject=findNativePrototype(left);nativeObject&&warning(\"W121\",left,nativeObject)}return left.identifier&&!left.isMetaProperty&&state.funct[\"(scope)\"].block.reassign(left.value,left),\".\"===left.id?((!left.left||\"arguments\"===left.left.value&&!state.isStrict())&&warning(\"E031\",assignToken),state.nameStack.set(state.tokens.prev),!0):\"{\"===left.id||\"[\"===left.id?(allowDestructuring&&state.tokens.curr.left.destructAssign?state.tokens.curr.left.destructAssign.forEach(function(t){t.id&&state.funct[\"(scope)\"].block.modify(t.id,t.token)}):\"{\"!==left.id&&left.left?\"arguments\"!==left.left.value||state.isStrict()||warning(\"E031\",assignToken):warning(\"E031\",assignToken),\"[\"===left.id&&state.nameStack.set(left.right),!0):left.isMetaProperty?(error(\"E031\",assignToken),!0):left.identifier&&!isReserved(left)?(\"exception\"===state.funct[\"(scope)\"].labeltype(left.value)&&warning(\"W022\",left),state.nameStack.set(left),!0):(left===state.syntax[\"function\"]&&warning(\"W023\",state.tokens.curr),!1)}function assignop(s,f,p){var x=infix(s,\"function\"==typeof f?f:function(left,that){return that.left=left,left&&checkLeftSideAssign(left,that,{allowDestructuring:!0})?(that.right=expression(10),that):(error(\"E031\",that),void 0)},p);return x.exps=!0,x.assign=!0,x}function bitwise(s,f,p){var x=symbol(s,p);return reserveName(x),x.led=\"function\"==typeof f?f:function(left){return state.option.bitwise&&warning(\"W016\",this,this.id),this.left=left,this.right=expression(p),this},x}function bitwiseassignop(s){return assignop(s,function(left,that){return state.option.bitwise&&warning(\"W016\",that,that.id),left&&checkLeftSideAssign(left,that)?(that.right=expression(10),that):(error(\"E031\",that),void 0)},20)}function suffix(s){var x=symbol(s,150);return x.led=function(left){return state.option.plusplus?warning(\"W016\",this,this.id):left.identifier&&!isReserved(left)||\".\"===left.id||\"[\"===left.id||warning(\"W017\",this),left.isMetaProperty?error(\"E031\",this):left&&left.identifier&&state.funct[\"(scope)\"].block.modify(left.value,left),this.left=left,this},x}function optionalidentifier(fnparam,prop,preserve){if(state.tokens.next.identifier){preserve||advance();var curr=state.tokens.curr,val=state.tokens.curr.value;return isReserved(curr)?prop&&state.inES5()?val:fnparam&&\"undefined\"===val?val:(warning(\"W024\",state.tokens.curr,state.tokens.curr.id),val):val}}function identifier(fnparam,prop){var i=optionalidentifier(fnparam,prop,!1);if(i)return i;if(\"...\"===state.tokens.next.value){if(state.inES6(!0)||warning(\"W119\",state.tokens.next,\"spread/rest operator\",\"6\"),advance(),checkPunctuator(state.tokens.next,\"...\"))for(warning(\"E024\",state.tokens.next,\"...\");checkPunctuator(state.tokens.next,\"...\");)advance();return state.tokens.next.identifier?identifier(fnparam,prop):(warning(\"E024\",state.tokens.curr,\"...\"),void 0)}error(\"E030\",state.tokens.next,state.tokens.next.value),\";\"!==state.tokens.next.id&&advance()}function reachable(controlToken){var t,i=0;if(\";\"===state.tokens.next.id&&!controlToken.inBracelessBlock)for(;;){do t=peek(i),i+=1;while(\"(end)\"!==t.id&&\"(comment)\"===t.id);if(t.reach)return;if(\"(endline)\"!==t.id){if(\"function\"===t.id){state.option.latedef===!0&&warning(\"W026\",t);break}warning(\"W027\",t,t.value,controlToken.value);break}}}function parseFinalSemicolon(){if(\";\"!==state.tokens.next.id){if(state.tokens.next.isUnclosed)return advance();var sameLine=startLine(state.tokens.next)===state.tokens.curr.line&&\"(end)\"!==state.tokens.next.id,blockEnd=checkPunctuator(state.tokens.next,\"}\");sameLine&&!blockEnd?errorAt(\"E058\",state.tokens.curr.line,state.tokens.curr.character):state.option.asi||(blockEnd&&!state.option.lastsemic||!sameLine)&&warningAt(\"W033\",state.tokens.curr.line,state.tokens.curr.character)}else advance(\";\")}function statement(){var r,i=indent,t=state.tokens.next,hasOwnScope=!1;if(\";\"===t.id)return advance(\";\"),void 0;var res=isReserved(t);if(res&&t.meta&&t.meta.isFutureReservedWord&&\":\"===peek().id&&(warning(\"W024\",t,t.id),res=!1),t.identifier&&!res&&\":\"===peek().id&&(advance(),advance(\":\"),hasOwnScope=!0,state.funct[\"(scope)\"].stack(),state.funct[\"(scope)\"].block.addBreakLabel(t.value,{token:state.tokens.curr}),state.tokens.next.labelled||\"{\"===state.tokens.next.value||warning(\"W028\",state.tokens.next,t.value,state.tokens.next.value),state.tokens.next.label=t.value,t=state.tokens.next),\"{\"===t.id){var iscase=\"case\"===state.funct[\"(verb)\"]&&\":\"===state.tokens.curr.value;return block(!0,!0,!1,!1,iscase),void 0}return r=expression(0,!0),!r||r.identifier&&\"function\"===r.value||\"(punctuator)\"===r.type&&r.left&&r.left.identifier&&\"function\"===r.left.value||state.isStrict()||\"global\"!==state.option.strict||warning(\"E007\"),t.block||(state.option.expr||r&&r.exps?state.option.nonew&&r&&r.left&&\"(\"===r.id&&\"new\"===r.left.id&&warning(\"W031\",t):warning(\"W030\",state.tokens.curr),parseFinalSemicolon()),indent=i,hasOwnScope&&state.funct[\"(scope)\"].unstack(),r}function statements(){for(var p,a=[];!state.tokens.next.reach&&\"(end)\"!==state.tokens.next.id;)\";\"===state.tokens.next.id?(p=peek(),(!p||\"(\"!==p.id&&\"[\"!==p.id)&&warning(\"W032\"),advance(\";\")):a.push(statement());return a}function directives(){for(var i,p,pn;\"(string)\"===state.tokens.next.id;){if(p=peek(0),\"(endline)\"===p.id){i=1;do pn=peek(i++);while(\"(endline)\"===pn.id);if(\";\"===pn.id)p=pn;else{if(\"[\"===pn.value||\".\"===pn.value)break;state.option.asi&&\"(\"!==pn.value||warning(\"W033\",state.tokens.next)}}else{if(\".\"===p.id||\"[\"===p.id)break;\";\"!==p.id&&warning(\"W033\",p)}advance();var directive=state.tokens.curr.value;(state.directive[directive]||\"use strict\"===directive&&\"implied\"===state.option.strict)&&warning(\"W034\",state.tokens.curr,directive),state.directive[directive]=!0,\";\"===p.id&&advance(\";\")}state.isStrict()&&(state.option[\"(explicitNewcap)\"]||(state.option.newcap=!0),state.option.undef=!0)}function block(ordinary,stmt,isfunc,isfatarrow,iscase){var a,m,t,line,d,b=inblock,old_indent=indent;inblock=ordinary,t=state.tokens.next;var metrics=state.funct[\"(metrics)\"];if(metrics.nestedBlockDepth+=1,metrics.verifyMaxNestedBlockDepthPerFunction(),\"{\"===state.tokens.next.id){if(advance(\"{\"),state.funct[\"(scope)\"].stack(),line=state.tokens.curr.line,\"}\"!==state.tokens.next.id){for(indent+=state.option.indent;!ordinary&&state.tokens.next.from>indent;)indent+=state.option.indent;if(isfunc){m={};for(d in state.directive)_.has(state.directive,d)&&(m[d]=state.directive[d]);directives(),state.option.strict&&state.funct[\"(context)\"][\"(global)\"]&&(m[\"use strict\"]||state.isStrict()||warning(\"E007\"))}a=statements(),metrics.statementCount+=a.length,indent-=state.option.indent}advance(\"}\",t),isfunc&&(state.funct[\"(scope)\"].validateParams(),m&&(state.directive=m)),state.funct[\"(scope)\"].unstack(),indent=old_indent}else if(ordinary)state.funct[\"(noblockscopedvar)\"]=\"for\"!==state.tokens.next.id,state.funct[\"(scope)\"].stack(),(!stmt||state.option.curly)&&warning(\"W116\",state.tokens.next,\"{\",state.tokens.next.value),state.tokens.next.inBracelessBlock=!0,indent+=state.option.indent,a=[statement()],indent-=state.option.indent,state.funct[\"(scope)\"].unstack(),delete state.funct[\"(noblockscopedvar)\"];else if(isfunc){if(state.funct[\"(scope)\"].stack(),m={},!stmt||isfatarrow||state.inMoz()||error(\"W118\",state.tokens.curr,\"function closure expressions\"),!stmt)for(d in state.directive)_.has(state.directive,d)&&(m[d]=state.directive[d]);expression(10),state.option.strict&&state.funct[\"(context)\"][\"(global)\"]&&(m[\"use strict\"]||state.isStrict()||warning(\"E007\")),state.funct[\"(scope)\"].unstack()}else error(\"E021\",state.tokens.next,\"{\",state.tokens.next.value);switch(state.funct[\"(verb)\"]){case\"break\":case\"continue\":case\"return\":case\"throw\":if(iscase)break;default:state.funct[\"(verb)\"]=null}return inblock=b,!ordinary||!state.option.noempty||a&&0!==a.length||warning(\"W035\",state.tokens.prev),metrics.nestedBlockDepth-=1,a}function countMember(m){membersOnly&&\"boolean\"!=typeof membersOnly[m]&&warning(\"W036\",state.tokens.curr,m),\"number\"==typeof member[m]?member[m]+=1:member[m]=1}function comprehensiveArrayExpression(){var res={};res.exps=!0,state.funct[\"(comparray)\"].stack();var reversed=!1;return\"for\"!==state.tokens.next.value&&(reversed=!0,state.inMoz()||warning(\"W116\",state.tokens.next,\"for\",state.tokens.next.value),state.funct[\"(comparray)\"].setState(\"use\"),res.right=expression(10)),advance(\"for\"),\"each\"===state.tokens.next.value&&(advance(\"each\"),state.inMoz()||warning(\"W118\",state.tokens.curr,\"for each\")),advance(\"(\"),state.funct[\"(comparray)\"].setState(\"define\"),res.left=expression(130),_.contains([\"in\",\"of\"],state.tokens.next.value)?advance():error(\"E045\",state.tokens.curr),state.funct[\"(comparray)\"].setState(\"generate\"),expression(10),advance(\")\"),\"if\"===state.tokens.next.value&&(advance(\"if\"),advance(\"(\"),state.funct[\"(comparray)\"].setState(\"filter\"),res.filter=expression(10),advance(\")\")),reversed||(state.funct[\"(comparray)\"].setState(\"use\"),res.right=expression(10)),advance(\"]\"),state.funct[\"(comparray)\"].unstack(),res}function isMethod(){return state.funct[\"(statement)\"]&&\"class\"===state.funct[\"(statement)\"].type||state.funct[\"(context)\"]&&\"class\"===state.funct[\"(context)\"][\"(verb)\"]}function isPropertyName(token){return token.identifier||\"(string)\"===token.id||\"(number)\"===token.id}function propertyName(preserveOrToken){var id,preserve=!0;return\"object\"==typeof preserveOrToken?id=preserveOrToken:(preserve=preserveOrToken,id=optionalidentifier(!1,!0,preserve)),id?\"object\"==typeof id&&(\"(string)\"===id.id||\"(identifier)\"===id.id?id=id.value:\"(number)\"===id.id&&(id=\"\"+id.value)):\"(string)\"===state.tokens.next.id?(id=state.tokens.next.value,preserve||advance()):\"(number)\"===state.tokens.next.id&&(id=\"\"+state.tokens.next.value,preserve||advance()),\"hasOwnProperty\"===id&&warning(\"W001\"),id}function functionparams(options){function addParam(addParamArgs){state.funct[\"(scope)\"].addParam.apply(state.funct[\"(scope)\"],addParamArgs)}var next,ident,t,paramsIds=[],tokens=[],pastDefault=!1,pastRest=!1,arity=0,loneArg=options&&options.loneArg;if(loneArg&&loneArg.identifier===!0)return state.funct[\"(scope)\"].addParam(loneArg.value,loneArg),{arity:1,params:[loneArg.value]};if(next=state.tokens.next,options&&options.parsedOpening||advance(\"(\"),\")\"===state.tokens.next.id)return advance(\")\"),void 0;for(;;){arity++;var currentParams=[];if(_.contains([\"{\",\"[\"],state.tokens.next.id)){tokens=destructuringPattern();for(t in tokens)t=tokens[t],t.id&&(paramsIds.push(t.id),currentParams.push([t.id,t.token]))}else if(checkPunctuator(state.tokens.next,\"...\")&&(pastRest=!0),ident=identifier(!0))paramsIds.push(ident),currentParams.push([ident,state.tokens.curr]);else for(;!checkPunctuators(state.tokens.next,[\",\",\")\"]);)advance();if(pastDefault&&\"=\"!==state.tokens.next.id&&error(\"W138\",state.tokens.current),\"=\"===state.tokens.next.id&&(state.inES6()||warning(\"W119\",state.tokens.next,\"default parameters\",\"6\"),advance(\"=\"),pastDefault=!0,expression(10)),currentParams.forEach(addParam),\",\"!==state.tokens.next.id)return advance(\")\",next),{arity:arity,params:paramsIds};pastRest&&warning(\"W131\",state.tokens.next),comma()}}function functor(name,token,overwrites){var funct={\"(name)\":name,\"(breakage)\":0,\"(loopage)\":0,\"(tokens)\":{},\"(properties)\":{},\"(catch)\":!1,\"(global)\":!1,\"(line)\":null,\"(character)\":null,\"(metrics)\":null,\"(statement)\":null,\"(context)\":null,\"(scope)\":null,\"(comparray)\":null,\"(generator)\":null,\"(arrow)\":null,\"(params)\":null};return token&&_.extend(funct,{\"(line)\":token.line,\"(character)\":token.character,\"(metrics)\":createMetrics(token)}),_.extend(funct,overwrites),funct[\"(context)\"]&&(funct[\"(scope)\"]=funct[\"(context)\"][\"(scope)\"],funct[\"(comparray)\"]=funct[\"(context)\"][\"(comparray)\"]),funct}function isFunctor(token){return\"(scope)\"in token}function hasParsedCode(funct){return funct[\"(global)\"]&&!funct[\"(verb)\"]}function doTemplateLiteral(left){function end(){if(state.tokens.curr.template&&state.tokens.curr.tail&&state.tokens.curr.context===ctx)return!0;var complete=state.tokens.next.template&&state.tokens.next.tail&&state.tokens.next.context===ctx;return complete&&advance(),complete||state.tokens.next.isUnclosed}var ctx=this.context,noSubst=this.noSubst,depth=this.depth;if(!noSubst)for(;!end();)!state.tokens.next.template||state.tokens.next.depth>depth?expression(0):advance();return{id:\"(template)\",type:\"(template)\",tag:left}}function doFunction(options){var f,token,name,statement,classExprBinding,isGenerator,isArrow,ignoreLoopFunc,oldOption=state.option,oldIgnored=state.ignored;options&&(name=options.name,statement=options.statement,classExprBinding=options.classExprBinding,isGenerator=\"generator\"===options.type,isArrow=\"arrow\"===options.type,ignoreLoopFunc=options.ignoreLoopFunc),state.option=Object.create(state.option),state.ignored=Object.create(state.ignored),state.funct=functor(name||state.nameStack.infer(),state.tokens.next,{\"(statement)\":statement,\"(context)\":state.funct,\"(arrow)\":isArrow,\"(generator)\":isGenerator}),f=state.funct,token=state.tokens.curr,token.funct=state.funct,functions.push(state.funct),state.funct[\"(scope)\"].stack(\"functionouter\");var internallyAccessibleName=name||classExprBinding;internallyAccessibleName&&state.funct[\"(scope)\"].block.add(internallyAccessibleName,classExprBinding?\"class\":\"function\",state.tokens.curr,!1),state.funct[\"(scope)\"].stack(\"functionparams\");var paramsInfo=functionparams(options);return paramsInfo?(state.funct[\"(params)\"]=paramsInfo.params,state.funct[\"(metrics)\"].arity=paramsInfo.arity,state.funct[\"(metrics)\"].verifyMaxParametersPerFunction()):state.funct[\"(metrics)\"].arity=0,isArrow&&(state.inES6(!0)||warning(\"W119\",state.tokens.curr,\"arrow function syntax (=>)\",\"6\"),options.loneArg||advance(\"=>\")),block(!1,!0,!0,isArrow),!state.option.noyield&&isGenerator&&\"yielded\"!==state.funct[\"(generator)\"]&&warning(\"W124\",state.tokens.curr),state.funct[\"(metrics)\"].verifyMaxStatementsPerFunction(),state.funct[\"(metrics)\"].verifyMaxComplexityPerFunction(),state.funct[\"(unusedOption)\"]=state.option.unused,state.option=oldOption,state.ignored=oldIgnored,state.funct[\"(last)\"]=state.tokens.curr.line,state.funct[\"(lastcharacter)\"]=state.tokens.curr.character,state.funct[\"(scope)\"].unstack(),state.funct[\"(scope)\"].unstack(),state.funct=state.funct[\"(context)\"],ignoreLoopFunc||state.option.loopfunc||!state.funct[\"(loopage)\"]||f[\"(isCapturing)\"]&&warning(\"W083\",token),f}function createMetrics(functionStartToken){return{statementCount:0,nestedBlockDepth:-1,ComplexityCount:1,arity:0,verifyMaxStatementsPerFunction:function(){state.option.maxstatements&&this.statementCount>state.option.maxstatements&&warning(\"W071\",functionStartToken,this.statementCount)\n},verifyMaxParametersPerFunction:function(){_.isNumber(state.option.maxparams)&&this.arity>state.option.maxparams&&warning(\"W072\",functionStartToken,this.arity)},verifyMaxNestedBlockDepthPerFunction:function(){state.option.maxdepth&&this.nestedBlockDepth>0&&this.nestedBlockDepth===state.option.maxdepth+1&&warning(\"W073\",null,this.nestedBlockDepth)},verifyMaxComplexityPerFunction:function(){var max=state.option.maxcomplexity,cc=this.ComplexityCount;max&&cc>max&&warning(\"W074\",functionStartToken,cc)}}}function increaseComplexityCount(){state.funct[\"(metrics)\"].ComplexityCount+=1}function checkCondAssignment(expr){var id,paren;switch(expr&&(id=expr.id,paren=expr.paren,\",\"===id&&(expr=expr.exprs[expr.exprs.length-1])&&(id=expr.id,paren=paren||expr.paren)),id){case\"=\":case\"+=\":case\"-=\":case\"*=\":case\"%=\":case\"&=\":case\"|=\":case\"^=\":case\"/=\":paren||state.option.boss||warning(\"W084\")}}function checkProperties(props){if(state.inES5())for(var name in props)props[name]&&props[name].setterToken&&!props[name].getterToken&&warning(\"W078\",props[name].setterToken)}function metaProperty(name,c){if(checkPunctuator(state.tokens.next,\".\")){var left=state.tokens.curr.id;advance(\".\");var id=identifier();return state.tokens.curr.isMetaProperty=!0,name!==id?error(\"E057\",state.tokens.prev,left,id):c(),state.tokens.curr}}function destructuringPattern(options){var isAssignment=options&&options.assignment;return state.inES6()||warning(\"W104\",state.tokens.curr,isAssignment?\"destructuring assignment\":\"destructuring binding\",\"6\"),destructuringPatternRecursive(options)}function destructuringPatternRecursive(options){var ids,identifiers=[],openingParsed=options&&options.openingParsed,isAssignment=options&&options.assignment,recursiveOptions=isAssignment?{assignment:isAssignment}:null,firstToken=openingParsed?state.tokens.curr:state.tokens.next,nextInnerDE=function(){var ident;if(checkPunctuators(state.tokens.next,[\"[\",\"{\"])){ids=destructuringPatternRecursive(recursiveOptions);for(var id in ids)id=ids[id],identifiers.push({id:id.id,token:id.token})}else if(checkPunctuator(state.tokens.next,\",\"))identifiers.push({id:null,token:state.tokens.curr});else{if(!checkPunctuator(state.tokens.next,\"(\")){var is_rest=checkPunctuator(state.tokens.next,\"...\");if(isAssignment){var identifierToken=is_rest?peek(0):state.tokens.next;identifierToken.identifier||warning(\"E030\",identifierToken,identifierToken.value);var assignTarget=expression(155);assignTarget&&(checkLeftSideAssign(assignTarget),assignTarget.identifier&&(ident=assignTarget.value))}else ident=identifier();return ident&&identifiers.push({id:ident,token:state.tokens.curr}),is_rest}advance(\"(\"),nextInnerDE(),advance(\")\")}return!1},assignmentProperty=function(){var id;checkPunctuator(state.tokens.next,\"[\")?(advance(\"[\"),expression(10),advance(\"]\"),advance(\":\"),nextInnerDE()):\"(string)\"===state.tokens.next.id||\"(number)\"===state.tokens.next.id?(advance(),advance(\":\"),nextInnerDE()):(id=identifier(),checkPunctuator(state.tokens.next,\":\")?(advance(\":\"),nextInnerDE()):id&&(isAssignment&&checkLeftSideAssign(state.tokens.curr),identifiers.push({id:id,token:state.tokens.curr})))};if(checkPunctuator(firstToken,\"[\")){openingParsed||advance(\"[\"),checkPunctuator(state.tokens.next,\"]\")&&warning(\"W137\",state.tokens.curr);for(var element_after_rest=!1;!checkPunctuator(state.tokens.next,\"]\");)nextInnerDE()&&!element_after_rest&&checkPunctuator(state.tokens.next,\",\")&&(warning(\"W130\",state.tokens.next),element_after_rest=!0),checkPunctuator(state.tokens.next,\"=\")&&(checkPunctuator(state.tokens.prev,\"...\")?advance(\"]\"):advance(\"=\"),\"undefined\"===state.tokens.next.id&&warning(\"W080\",state.tokens.prev,state.tokens.prev.value),expression(10)),checkPunctuator(state.tokens.next,\"]\")||advance(\",\");advance(\"]\")}else if(checkPunctuator(firstToken,\"{\")){for(openingParsed||advance(\"{\"),checkPunctuator(state.tokens.next,\"}\")&&warning(\"W137\",state.tokens.curr);!checkPunctuator(state.tokens.next,\"}\")&&(assignmentProperty(),checkPunctuator(state.tokens.next,\"=\")&&(advance(\"=\"),\"undefined\"===state.tokens.next.id&&warning(\"W080\",state.tokens.prev,state.tokens.prev.value),expression(10)),checkPunctuator(state.tokens.next,\"}\")||(advance(\",\"),!checkPunctuator(state.tokens.next,\"}\"))););advance(\"}\")}return identifiers}function destructuringPatternMatch(tokens,value){var first=value.first;first&&_.zip(tokens,Array.isArray(first)?first:[first]).forEach(function(val){var token=val[0],value=val[1];token&&value?token.first=value:token&&token.first&&!value&&warning(\"W080\",token.first,token.first.value)})}function blockVariableStatement(type,statement,context){var tokens,lone,value,letblock,prefix=context&&context.prefix,inexport=context&&context.inexport,isLet=\"let\"===type,isConst=\"const\"===type;for(state.inES6()||warning(\"W104\",state.tokens.curr,type,\"6\"),isLet&&\"(\"===state.tokens.next.value?(state.inMoz()||warning(\"W118\",state.tokens.next,\"let block\"),advance(\"(\"),state.funct[\"(scope)\"].stack(),letblock=!0):state.funct[\"(noblockscopedvar)\"]&&error(\"E048\",state.tokens.curr,isConst?\"Const\":\"Let\"),statement.first=[];;){var names=[];_.contains([\"{\",\"[\"],state.tokens.next.value)?(tokens=destructuringPattern(),lone=!1):(tokens=[{id:identifier(),token:state.tokens.curr}],lone=!0),!prefix&&isConst&&\"=\"!==state.tokens.next.id&&warning(\"E012\",state.tokens.curr,state.tokens.curr.value);for(var t in tokens)tokens.hasOwnProperty(t)&&(t=tokens[t],state.funct[\"(scope)\"].block.isGlobal()&&predefined[t.id]===!1&&warning(\"W079\",t.token,t.id),t.id&&!state.funct[\"(noblockscopedvar)\"]&&(state.funct[\"(scope)\"].addlabel(t.id,{type:type,token:t.token}),names.push(t.token),lone&&inexport&&state.funct[\"(scope)\"].setExported(t.token.value,t.token)));if(\"=\"===state.tokens.next.id&&(advance(\"=\"),prefix||\"undefined\"!==state.tokens.next.id||warning(\"W080\",state.tokens.prev,state.tokens.prev.value),!prefix&&\"=\"===peek(0).id&&state.tokens.next.identifier&&warning(\"W120\",state.tokens.next,state.tokens.next.value),value=expression(prefix?120:10),lone?tokens[0].first=value:destructuringPatternMatch(names,value)),statement.first=statement.first.concat(names),\",\"!==state.tokens.next.id)break;comma()}return letblock&&(advance(\")\"),block(!0,!0),statement.block=!0,state.funct[\"(scope)\"].unstack()),statement}function classdef(isStatement){return state.inES6()||warning(\"W104\",state.tokens.curr,\"class\",\"6\"),isStatement?(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"class\",token:state.tokens.curr})):state.tokens.next.identifier&&\"extends\"!==state.tokens.next.value?(this.name=identifier(),this.namedExpr=!0):this.name=state.nameStack.infer(),classtail(this),this}function classtail(c){var wasInClassBody=state.inClassBody;\"extends\"===state.tokens.next.value&&(advance(\"extends\"),c.heritage=expression(10)),state.inClassBody=!0,advance(\"{\"),c.body=classbody(c),advance(\"}\"),state.inClassBody=wasInClassBody}function classbody(c){for(var name,isStatic,isGenerator,getset,computed,props=Object.create(null),staticProps=Object.create(null),i=0;\"}\"!==state.tokens.next.id;++i)if(name=state.tokens.next,isStatic=!1,isGenerator=!1,getset=null,\";\"!==name.id){if(\"*\"===name.id&&(isGenerator=!0,advance(\"*\"),name=state.tokens.next),\"[\"===name.id)name=computedPropertyName(),computed=!0;else{if(!isPropertyName(name)){warning(\"W052\",state.tokens.next,state.tokens.next.value||state.tokens.next.type),advance();continue}advance(),computed=!1,name.identifier&&\"static\"===name.value&&(checkPunctuator(state.tokens.next,\"*\")&&(isGenerator=!0,advance(\"*\")),(isPropertyName(state.tokens.next)||\"[\"===state.tokens.next.id)&&(computed=\"[\"===state.tokens.next.id,isStatic=!0,name=state.tokens.next,\"[\"===state.tokens.next.id?name=computedPropertyName():advance())),!name.identifier||\"get\"!==name.value&&\"set\"!==name.value||(isPropertyName(state.tokens.next)||\"[\"===state.tokens.next.id)&&(computed=\"[\"===state.tokens.next.id,getset=name,name=state.tokens.next,\"[\"===state.tokens.next.id?name=computedPropertyName():advance())}if(!checkPunctuator(state.tokens.next,\"(\")){for(error(\"E054\",state.tokens.next,state.tokens.next.value);\"}\"!==state.tokens.next.id&&!checkPunctuator(state.tokens.next,\"(\");)advance();\"(\"!==state.tokens.next.value&&doFunction({statement:c})}if(computed||(getset?saveAccessor(getset.value,isStatic?staticProps:props,name.value,name,!0,isStatic):(\"constructor\"===name.value?state.nameStack.set(c):state.nameStack.set(name),saveProperty(isStatic?staticProps:props,name.value,name,!0,isStatic))),getset&&\"constructor\"===name.value){var propDesc=\"get\"===getset.value?\"class getter method\":\"class setter method\";error(\"E049\",name,propDesc,\"constructor\")}else\"prototype\"===name.value&&error(\"E049\",name,\"class method\",\"prototype\");propertyName(name),doFunction({statement:c,type:isGenerator?\"generator\":null,classExprBinding:c.namedExpr?c.name:null})}else warning(\"W032\"),advance(\";\");checkProperties(props)}function saveProperty(props,name,tkn,isClass,isStatic){var msg=[\"key\",\"class method\",\"static class method\"];msg=msg[(isClass||!1)+(isStatic||!1)],tkn.identifier&&(name=tkn.value),props[name]&&\"__proto__\"!==name?warning(\"W075\",state.tokens.next,msg,name):props[name]=Object.create(null),props[name].basic=!0,props[name].basictkn=tkn}function saveAccessor(accessorType,props,name,tkn,isClass,isStatic){var flagName=\"get\"===accessorType?\"getterToken\":\"setterToken\",msg=\"\";isClass?(isStatic&&(msg+=\"static \"),msg+=accessorType+\"ter method\"):msg=\"key\",state.tokens.curr.accessorType=accessorType,state.nameStack.set(tkn),props[name]?(props[name].basic||props[name][flagName])&&\"__proto__\"!==name&&warning(\"W075\",state.tokens.next,msg,name):props[name]=Object.create(null),props[name][flagName]=tkn}function computedPropertyName(){advance(\"[\"),state.inES6()||warning(\"W119\",state.tokens.curr,\"computed property names\",\"6\");var value=expression(10);return advance(\"]\"),value}function checkPunctuators(token,values){return\"(punctuator)\"===token.type?_.contains(values,token.value):!1}function checkPunctuator(token,value){return\"(punctuator)\"===token.type&&token.value===value}function destructuringAssignOrJsonValue(){var block=lookupBlockType();block.notJson?(!state.inES6()&&block.isDestAssign&&warning(\"W104\",state.tokens.curr,\"destructuring assignment\",\"6\"),statements()):(state.option.laxbreak=!0,state.jsonMode=!0,jsonValue())}function jsonValue(){function jsonObject(){var o={},t=state.tokens.next;if(advance(\"{\"),\"}\"!==state.tokens.next.id)for(;;){if(\"(end)\"===state.tokens.next.id)error(\"E026\",state.tokens.next,t.line);else{if(\"}\"===state.tokens.next.id){warning(\"W094\",state.tokens.curr);break}\",\"===state.tokens.next.id?error(\"E028\",state.tokens.next):\"(string)\"!==state.tokens.next.id&&warning(\"W095\",state.tokens.next,state.tokens.next.value)}if(o[state.tokens.next.value]===!0?warning(\"W075\",state.tokens.next,\"key\",state.tokens.next.value):\"__proto__\"===state.tokens.next.value&&!state.option.proto||\"__iterator__\"===state.tokens.next.value&&!state.option.iterator?warning(\"W096\",state.tokens.next,state.tokens.next.value):o[state.tokens.next.value]=!0,advance(),advance(\":\"),jsonValue(),\",\"!==state.tokens.next.id)break;advance(\",\")}advance(\"}\")}function jsonArray(){var t=state.tokens.next;if(advance(\"[\"),\"]\"!==state.tokens.next.id)for(;;){if(\"(end)\"===state.tokens.next.id)error(\"E027\",state.tokens.next,t.line);else{if(\"]\"===state.tokens.next.id){warning(\"W094\",state.tokens.curr);break}\",\"===state.tokens.next.id&&error(\"E028\",state.tokens.next)}if(jsonValue(),\",\"!==state.tokens.next.id)break;advance(\",\")}advance(\"]\")}switch(state.tokens.next.id){case\"{\":jsonObject();break;case\"[\":jsonArray();break;case\"true\":case\"false\":case\"null\":case\"(number)\":case\"(string)\":advance();break;case\"-\":advance(\"-\"),advance(\"(number)\");break;default:error(\"E003\",state.tokens.next)}}var api,declared,functions,inblock,indent,lookahead,lex,member,membersOnly,predefined,stack,urls,bang={\"<\":!0,\"<=\":!0,\"==\":!0,\"===\":!0,\"!==\":!0,\"!=\":!0,\">\":!0,\">=\":!0,\"+\":!0,\"-\":!0,\"*\":!0,\"/\":!0,\"%\":!0},functionicity=[\"closure\",\"exception\",\"global\",\"label\",\"outer\",\"unused\",\"var\"],extraModules=[],emitter=new events.EventEmitter,typeofValues={};typeofValues.legacy=[\"xml\",\"unknown\"],typeofValues.es3=[\"undefined\",\"boolean\",\"number\",\"string\",\"function\",\"object\"],typeofValues.es3=typeofValues.es3.concat(typeofValues.legacy),typeofValues.es6=typeofValues.es3.concat(\"symbol\"),type(\"(number)\",function(){return this}),type(\"(string)\",function(){return this}),state.syntax[\"(identifier)\"]={type:\"(identifier)\",lbp:0,identifier:!0,nud:function(){var v=this.value;return\"=>\"===state.tokens.next.id?this:(state.funct[\"(comparray)\"].check(v)||state.funct[\"(scope)\"].block.use(v,state.tokens.curr),this)},led:function(){error(\"E033\",state.tokens.next,state.tokens.next.value)}};var baseTemplateSyntax={lbp:0,identifier:!1,template:!0};state.syntax[\"(template)\"]=_.extend({type:\"(template)\",nud:doTemplateLiteral,led:doTemplateLiteral,noSubst:!1},baseTemplateSyntax),state.syntax[\"(template middle)\"]=_.extend({type:\"(template middle)\",middle:!0,noSubst:!1},baseTemplateSyntax),state.syntax[\"(template tail)\"]=_.extend({type:\"(template tail)\",tail:!0,noSubst:!1},baseTemplateSyntax),state.syntax[\"(no subst template)\"]=_.extend({type:\"(template)\",nud:doTemplateLiteral,led:doTemplateLiteral,noSubst:!0,tail:!0},baseTemplateSyntax),type(\"(regexp)\",function(){return this}),delim(\"(endline)\"),delim(\"(begin)\"),delim(\"(end)\").reach=!0,delim(\"(error)\").reach=!0,delim(\"}\").reach=!0,delim(\")\"),delim(\"]\"),delim('\"').reach=!0,delim(\"'\").reach=!0,delim(\";\"),delim(\":\").reach=!0,delim(\"#\"),reserve(\"else\"),reserve(\"case\").reach=!0,reserve(\"catch\"),reserve(\"default\").reach=!0,reserve(\"finally\"),reservevar(\"arguments\",function(x){state.isStrict()&&state.funct[\"(global)\"]&&warning(\"E008\",x)}),reservevar(\"eval\"),reservevar(\"false\"),reservevar(\"Infinity\"),reservevar(\"null\"),reservevar(\"this\",function(x){state.isStrict()&&!isMethod()&&!state.option.validthis&&(state.funct[\"(statement)\"]&&state.funct[\"(name)\"].charAt(0)>\"Z\"||state.funct[\"(global)\"])&&warning(\"W040\",x)}),reservevar(\"true\"),reservevar(\"undefined\"),assignop(\"=\",\"assign\",20),assignop(\"+=\",\"assignadd\",20),assignop(\"-=\",\"assignsub\",20),assignop(\"*=\",\"assignmult\",20),assignop(\"/=\",\"assigndiv\",20).nud=function(){error(\"E014\")},assignop(\"%=\",\"assignmod\",20),bitwiseassignop(\"&=\"),bitwiseassignop(\"|=\"),bitwiseassignop(\"^=\"),bitwiseassignop(\"<<=\"),bitwiseassignop(\">>=\"),bitwiseassignop(\">>>=\"),infix(\",\",function(left,that){var expr;if(that.exprs=[left],state.option.nocomma&&warning(\"W127\"),!comma({peek:!0}))return that;for(;;){if(!(expr=expression(10)))break;if(that.exprs.push(expr),\",\"!==state.tokens.next.value||!comma())break}return that},10,!0),infix(\"?\",function(left,that){return increaseComplexityCount(),that.left=left,that.right=expression(10),advance(\":\"),that[\"else\"]=expression(10),that},30);var orPrecendence=40;infix(\"||\",function(left,that){return increaseComplexityCount(),that.left=left,that.right=expression(orPrecendence),that},orPrecendence),infix(\"&&\",\"and\",50),bitwise(\"|\",\"bitor\",70),bitwise(\"^\",\"bitxor\",80),bitwise(\"&\",\"bitand\",90),relation(\"==\",function(left,right){var eqnull=state.option.eqnull&&(\"null\"===(left&&left.value)||\"null\"===(right&&right.value));switch(!0){case!eqnull&&state.option.eqeqeq:this.from=this.character,warning(\"W116\",this,\"===\",\"==\");break;case isPoorRelation(left):warning(\"W041\",this,\"===\",left.value);break;case isPoorRelation(right):warning(\"W041\",this,\"===\",right.value);break;case isTypoTypeof(right,left,state):warning(\"W122\",this,right.value);break;case isTypoTypeof(left,right,state):warning(\"W122\",this,left.value)}return this}),relation(\"===\",function(left,right){return isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"!=\",function(left,right){var eqnull=state.option.eqnull&&(\"null\"===(left&&left.value)||\"null\"===(right&&right.value));return!eqnull&&state.option.eqeqeq?(this.from=this.character,warning(\"W116\",this,\"!==\",\"!=\")):isPoorRelation(left)?warning(\"W041\",this,\"!==\",left.value):isPoorRelation(right)?warning(\"W041\",this,\"!==\",right.value):isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"!==\",function(left,right){return isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"<\"),relation(\">\"),relation(\"<=\"),relation(\">=\"),bitwise(\"<<\",\"shiftleft\",120),bitwise(\">>\",\"shiftright\",120),bitwise(\">>>\",\"shiftrightunsigned\",120),infix(\"in\",\"in\",120),infix(\"instanceof\",\"instanceof\",120),infix(\"+\",function(left,that){var right;return that.left=left,that.right=right=expression(130),left&&right&&\"(string)\"===left.id&&\"(string)\"===right.id?(left.value+=right.value,left.character=right.character,!state.option.scripturl&®.javascriptURL.test(left.value)&&warning(\"W050\",left),left):that},130),prefix(\"+\",\"num\"),prefix(\"+++\",function(){return warning(\"W007\"),this.arity=\"unary\",this.right=expression(150),this}),infix(\"+++\",function(left){return warning(\"W007\"),this.left=left,this.right=expression(130),this},130),infix(\"-\",\"sub\",130),prefix(\"-\",\"neg\"),prefix(\"---\",function(){return warning(\"W006\"),this.arity=\"unary\",this.right=expression(150),this}),infix(\"---\",function(left){return warning(\"W006\"),this.left=left,this.right=expression(130),this},130),infix(\"*\",\"mult\",140),infix(\"/\",\"div\",140),infix(\"%\",\"mod\",140),suffix(\"++\"),prefix(\"++\",\"preinc\"),state.syntax[\"++\"].exps=!0,suffix(\"--\"),prefix(\"--\",\"predec\"),state.syntax[\"--\"].exps=!0,prefix(\"delete\",function(){var p=expression(10);return p?(\".\"!==p.id&&\"[\"!==p.id&&warning(\"W051\"),this.first=p,p.identifier&&!state.isStrict()&&(p.forgiveUndef=!0),this):this}).exps=!0,prefix(\"~\",function(){return state.option.bitwise&&warning(\"W016\",this,\"~\"),this.arity=\"unary\",this.right=expression(150),this}),prefix(\"...\",function(){return state.inES6(!0)||warning(\"W119\",this,\"spread/rest operator\",\"6\"),state.tokens.next.identifier||\"(string)\"===state.tokens.next.type||checkPunctuators(state.tokens.next,[\"[\",\"(\"])||error(\"E030\",state.tokens.next,state.tokens.next.value),expression(150),this}),prefix(\"!\",function(){return this.arity=\"unary\",this.right=expression(150),this.right||quit(\"E041\",this.line||0),bang[this.right.id]===!0&&warning(\"W018\",this,\"!\"),this}),prefix(\"typeof\",function(){var p=expression(150);return this.first=this.right=p,p||quit(\"E041\",this.line||0,this.character||0),p.identifier&&(p.forgiveUndef=!0),this}),prefix(\"new\",function(){var mp=metaProperty(\"target\",function(){state.inES6(!0)||warning(\"W119\",state.tokens.prev,\"new.target\",\"6\");for(var inFunction,c=state.funct;c&&(inFunction=!c[\"(global)\"],c[\"(arrow)\"]);)c=c[\"(context)\"];inFunction||warning(\"W136\",state.tokens.prev,\"new.target\")});if(mp)return mp;var i,c=expression(155);if(c&&\"function\"!==c.id)if(c.identifier)switch(c[\"new\"]=!0,c.value){case\"Number\":case\"String\":case\"Boolean\":case\"Math\":case\"JSON\":warning(\"W053\",state.tokens.prev,c.value);break;case\"Symbol\":state.inES6()&&warning(\"W053\",state.tokens.prev,c.value);break;case\"Function\":state.option.evil||warning(\"W054\");break;case\"Date\":case\"RegExp\":case\"this\":break;default:\"function\"!==c.id&&(i=c.value.substr(0,1),state.option.newcap&&(\"A\">i||i>\"Z\")&&!state.funct[\"(scope)\"].isPredefined(c.value)&&warning(\"W055\",state.tokens.curr))}else\".\"!==c.id&&\"[\"!==c.id&&\"(\"!==c.id&&warning(\"W056\",state.tokens.curr);else state.option.supernew||warning(\"W057\",this);return\"(\"===state.tokens.next.id||state.option.supernew||warning(\"W058\",state.tokens.curr,state.tokens.curr.value),this.first=this.right=c,this}),state.syntax[\"new\"].exps=!0,prefix(\"void\").exps=!0,infix(\".\",function(left,that){var m=identifier(!1,!0);return\"string\"==typeof m&&countMember(m),that.left=left,that.right=m,m&&\"hasOwnProperty\"===m&&\"=\"===state.tokens.next.value&&warning(\"W001\"),!left||\"arguments\"!==left.value||\"callee\"!==m&&\"caller\"!==m?state.option.evil||!left||\"document\"!==left.value||\"write\"!==m&&\"writeln\"!==m||warning(\"W060\",left):state.option.noarg?warning(\"W059\",left,m):state.isStrict()&&error(\"E008\"),state.option.evil||\"eval\"!==m&&\"execScript\"!==m||isGlobalEval(left,state)&&warning(\"W061\"),that},160,!0),infix(\"(\",function(left,that){state.option.immed&&left&&!left.immed&&\"function\"===left.id&&warning(\"W062\");var n=0,p=[];if(left&&\"(identifier)\"===left.type&&left.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)&&-1===\"Array Number String Boolean Date Object Error Symbol\".indexOf(left.value)&&(\"Math\"===left.value?warning(\"W063\",left):state.option.newcap&&warning(\"W064\",left)),\")\"!==state.tokens.next.id)for(;p[p.length]=expression(10),n+=1,\",\"===state.tokens.next.id;)comma();return advance(\")\"),\"object\"==typeof left&&(state.inES5()||\"parseInt\"!==left.value||1!==n||warning(\"W065\",state.tokens.curr),state.option.evil||(\"eval\"===left.value||\"Function\"===left.value||\"execScript\"===left.value?(warning(\"W061\",left),p[0]&&\"(string)\"===[0].id&&addInternalSrc(left,p[0].value)):!p[0]||\"(string)\"!==p[0].id||\"setTimeout\"!==left.value&&\"setInterval\"!==left.value?!p[0]||\"(string)\"!==p[0].id||\".\"!==left.value||\"window\"!==left.left.value||\"setTimeout\"!==left.right&&\"setInterval\"!==left.right||(warning(\"W066\",left),addInternalSrc(left,p[0].value)):(warning(\"W066\",left),addInternalSrc(left,p[0].value))),left.identifier||\".\"===left.id||\"[\"===left.id||\"=>\"===left.id||\"(\"===left.id||\"&&\"===left.id||\"||\"===left.id||\"?\"===left.id||state.inES6()&&left[\"(name)\"]||warning(\"W067\",that)),that.left=left,that},155,!0).exps=!0,prefix(\"(\",function(){var pn1,ret,triggerFnExpr,first,last,pn=state.tokens.next,i=-1,parens=1,opening=state.tokens.curr,preceeding=state.tokens.prev,isNecessary=!state.option.singleGroups;do\"(\"===pn.value?parens+=1:\")\"===pn.value&&(parens-=1),i+=1,pn1=pn,pn=peek(i);while((0!==parens||\")\"!==pn1.value)&&\";\"!==pn.value&&\"(end)\"!==pn.type);if(\"function\"===state.tokens.next.id&&(triggerFnExpr=state.tokens.next.immed=!0),\"=>\"===pn.value)return doFunction({type:\"arrow\",parsedOpening:!0});var exprs=[];if(\")\"!==state.tokens.next.id)for(;exprs.push(expression(10)),\",\"===state.tokens.next.id;)state.option.nocomma&&warning(\"W127\"),comma();return advance(\")\",this),state.option.immed&&exprs[0]&&\"function\"===exprs[0].id&&\"(\"!==state.tokens.next.id&&\".\"!==state.tokens.next.id&&\"[\"!==state.tokens.next.id&&warning(\"W068\",this),exprs.length?(exprs.length>1?(ret=Object.create(state.syntax[\",\"]),ret.exprs=exprs,first=exprs[0],last=exprs[exprs.length-1],isNecessary||(isNecessary=preceeding.assign||preceeding.delim)):(ret=first=last=exprs[0],isNecessary||(isNecessary=opening.beginsStmt&&(\"{\"===ret.id||triggerFnExpr||isFunctor(ret))||triggerFnExpr&&(!isEndOfExpr()||\"}\"!==state.tokens.prev.id)||isFunctor(ret)&&!isEndOfExpr()||\"{\"===ret.id&&\"=>\"===preceeding.id||\"(number)\"===ret.type&&checkPunctuator(pn,\".\")&&/^\\d+$/.test(ret.value))),ret&&(!isNecessary&&(first.left||first.right||ret.exprs)&&(isNecessary=!isBeginOfExpr(preceeding)&&first.lbp<=preceeding.lbp||!isEndOfExpr()&&last.lbp\"),infix(\"[\",function(left,that){var s,e=expression(10);return e&&\"(string)\"===e.type&&(state.option.evil||\"eval\"!==e.value&&\"execScript\"!==e.value||isGlobalEval(left,state)&&warning(\"W061\"),countMember(e.value),!state.option.sub&®.identifier.test(e.value)&&(s=state.syntax[e.value],s&&isReserved(s)||warning(\"W069\",state.tokens.prev,e.value))),advance(\"]\",that),e&&\"hasOwnProperty\"===e.value&&\"=\"===state.tokens.next.value&&warning(\"W001\"),that.left=left,that.right=e,that},160,!0),prefix(\"[\",function(){var blocktype=lookupBlockType();if(blocktype.isCompArray)return state.option.esnext||state.inMoz()||warning(\"W118\",state.tokens.curr,\"array comprehension\"),comprehensiveArrayExpression();if(blocktype.isDestAssign)return this.destructAssign=destructuringPattern({openingParsed:!0,assignment:!0}),this;var b=state.tokens.curr.line!==startLine(state.tokens.next);for(this.first=[],b&&(indent+=state.option.indent,state.tokens.next.from===indent+state.option.indent&&(indent+=state.option.indent));\"(end)\"!==state.tokens.next.id;){for(;\",\"===state.tokens.next.id;){if(!state.option.elision){if(state.inES5()){warning(\"W128\");do advance(\",\");while(\",\"===state.tokens.next.id);continue}warning(\"W070\")}advance(\",\")}if(\"]\"===state.tokens.next.id)break;if(this.first.push(expression(10)),\",\"!==state.tokens.next.id)break;if(comma({allowTrailing:!0}),\"]\"===state.tokens.next.id&&!state.inES5()){warning(\"W070\",state.tokens.curr);break}}return b&&(indent-=state.option.indent),advance(\"]\",this),this}),function(x){x.nud=function(){var b,f,i,p,t,nextVal,isGeneratorMethod=!1,props=Object.create(null);b=state.tokens.curr.line!==startLine(state.tokens.next),b&&(indent+=state.option.indent,state.tokens.next.from===indent+state.option.indent&&(indent+=state.option.indent));var blocktype=lookupBlockType();if(blocktype.isDestAssign)return this.destructAssign=destructuringPattern({openingParsed:!0,assignment:!0}),this;for(;\"}\"!==state.tokens.next.id;){if(nextVal=state.tokens.next.value,!state.tokens.next.identifier||\",\"!==peekIgnoreEOL().id&&\"}\"!==peekIgnoreEOL().id)if(\":\"===peek().id||\"get\"!==nextVal&&\"set\"!==nextVal){if(\"*\"===state.tokens.next.value&&\"(punctuator)\"===state.tokens.next.type?(state.inES6()||warning(\"W104\",state.tokens.next,\"generator functions\",\"6\"),advance(\"*\"),isGeneratorMethod=!0):isGeneratorMethod=!1,\"[\"===state.tokens.next.id)i=computedPropertyName(),state.nameStack.set(i);else if(state.nameStack.set(state.tokens.next),i=propertyName(),saveProperty(props,i,state.tokens.next),\"string\"!=typeof i)break;\"(\"===state.tokens.next.value?(state.inES6()||warning(\"W104\",state.tokens.curr,\"concise methods\",\"6\"),doFunction({type:isGeneratorMethod?\"generator\":null})):(advance(\":\"),expression(10))}else advance(nextVal),state.inES5()||error(\"E034\"),i=propertyName(),i||state.inES6()||error(\"E035\"),i&&saveAccessor(nextVal,props,i,state.tokens.curr),t=state.tokens.next,f=doFunction(),p=f[\"(params)\"],\"get\"===nextVal&&i&&p?warning(\"W076\",t,p[0],i):\"set\"!==nextVal||!i||p&&1===p.length||warning(\"W077\",t,i);else state.inES6()||warning(\"W104\",state.tokens.next,\"object short notation\",\"6\"),i=propertyName(!0),saveProperty(props,i,state.tokens.next),expression(10);if(countMember(i),\",\"!==state.tokens.next.id)break;comma({allowTrailing:!0,property:!0}),\",\"===state.tokens.next.id?warning(\"W070\",state.tokens.curr):\"}\"!==state.tokens.next.id||state.inES5()||warning(\"W070\",state.tokens.curr)}return b&&(indent-=state.option.indent),advance(\"}\",this),checkProperties(props),this},x.fud=function(){error(\"E036\",state.tokens.curr)}}(delim(\"{\"));var conststatement=stmt(\"const\",function(context){return blockVariableStatement(\"const\",this,context)});conststatement.exps=!0;var letstatement=stmt(\"let\",function(context){return blockVariableStatement(\"let\",this,context)});letstatement.exps=!0;var varstatement=stmt(\"var\",function(context){var tokens,lone,value,prefix=context&&context.prefix,inexport=context&&context.inexport,implied=context&&context.implied,report=!(context&&context.ignore);for(this.first=[];;){var names=[];_.contains([\"{\",\"[\"],state.tokens.next.value)?(tokens=destructuringPattern(),lone=!1):(tokens=[{id:identifier(),token:state.tokens.curr}],lone=!0),prefix&&implied||!report||!state.option.varstmt||warning(\"W132\",this),this.first=this.first.concat(names);for(var t in tokens)tokens.hasOwnProperty(t)&&(t=tokens[t],!implied&&state.funct[\"(global)\"]&&(predefined[t.id]===!1?warning(\"W079\",t.token,t.id):state.option.futurehostile===!1&&(!state.inES5()&&vars.ecmaIdentifiers[5][t.id]===!1||!state.inES6()&&vars.ecmaIdentifiers[6][t.id]===!1)&&warning(\"W129\",t.token,t.id)),t.id&&(\"for\"===implied?(state.funct[\"(scope)\"].has(t.id)||report&&warning(\"W088\",t.token,t.id),state.funct[\"(scope)\"].block.use(t.id,t.token)):(state.funct[\"(scope)\"].addlabel(t.id,{type:\"var\",token:t.token}),lone&&inexport&&state.funct[\"(scope)\"].setExported(t.id,t.token)),names.push(t.token)));if(\"=\"===state.tokens.next.id&&(state.nameStack.set(state.tokens.curr),advance(\"=\"),prefix||!report||state.funct[\"(loopage)\"]||\"undefined\"!==state.tokens.next.id||warning(\"W080\",state.tokens.prev,state.tokens.prev.value),\"=\"===peek(0).id&&state.tokens.next.identifier&&(!prefix&&report&&!state.funct[\"(params)\"]||-1===state.funct[\"(params)\"].indexOf(state.tokens.next.value))&&warning(\"W120\",state.tokens.next,state.tokens.next.value),value=expression(prefix?120:10),lone?tokens[0].first=value:destructuringPatternMatch(names,value)),\",\"!==state.tokens.next.id)break;comma()}return this});varstatement.exps=!0,blockstmt(\"class\",function(){return classdef.call(this,!0)}),blockstmt(\"function\",function(context){var inexport=context&&context.inexport,generator=!1;\"*\"===state.tokens.next.value&&(advance(\"*\"),state.inES6({strict:!0})?generator=!0:warning(\"W119\",state.tokens.curr,\"function*\",\"6\")),inblock&&warning(\"W082\",state.tokens.curr);var i=optionalidentifier();return state.funct[\"(scope)\"].addlabel(i,{type:\"function\",token:state.tokens.curr}),void 0===i?warning(\"W025\"):inexport&&state.funct[\"(scope)\"].setExported(i,state.tokens.prev),doFunction({name:i,statement:this,type:generator?\"generator\":null,ignoreLoopFunc:inblock}),\"(\"===state.tokens.next.id&&state.tokens.next.line===state.tokens.curr.line&&error(\"E039\"),this}),prefix(\"function\",function(){var generator=!1;\"*\"===state.tokens.next.value&&(state.inES6()||warning(\"W119\",state.tokens.curr,\"function*\",\"6\"),advance(\"*\"),generator=!0);var i=optionalidentifier();return doFunction({name:i,type:generator?\"generator\":null}),this}),blockstmt(\"if\",function(){var t=state.tokens.next;increaseComplexityCount(),state.condition=!0,advance(\"(\");var expr=expression(0);checkCondAssignment(expr);var forinifcheck=null;state.option.forin&&state.forinifcheckneeded&&(state.forinifcheckneeded=!1,forinifcheck=state.forinifchecks[state.forinifchecks.length-1],forinifcheck.type=\"(punctuator)\"===expr.type&&\"!\"===expr.value?\"(negative)\":\"(positive)\"),advance(\")\",t),state.condition=!1;var s=block(!0,!0);return forinifcheck&&\"(negative)\"===forinifcheck.type&&s&&s[0]&&\"(identifier)\"===s[0].type&&\"continue\"===s[0].value&&(forinifcheck.type=\"(negative-with-continue)\"),\"else\"===state.tokens.next.id&&(advance(\"else\"),\"if\"===state.tokens.next.id||\"switch\"===state.tokens.next.id?statement():block(!0,!0)),this}),blockstmt(\"try\",function(){function doCatch(){if(advance(\"catch\"),advance(\"(\"),state.funct[\"(scope)\"].stack(\"catchparams\"),checkPunctuators(state.tokens.next,[\"[\",\"{\"])){var tokens=destructuringPattern();_.each(tokens,function(token){token.id&&state.funct[\"(scope)\"].addParam(token.id,token,\"exception\")})}else\"(identifier)\"!==state.tokens.next.type?warning(\"E030\",state.tokens.next,state.tokens.next.value):state.funct[\"(scope)\"].addParam(identifier(),state.tokens.curr,\"exception\");\"if\"===state.tokens.next.value&&(state.inMoz()||warning(\"W118\",state.tokens.curr,\"catch filter\"),advance(\"if\"),expression(0)),advance(\")\"),block(!1),state.funct[\"(scope)\"].unstack()}var b;for(block(!0);\"catch\"===state.tokens.next.id;)increaseComplexityCount(),b&&!state.inMoz()&&warning(\"W118\",state.tokens.next,\"multiple catch blocks\"),doCatch(),b=!0;return\"finally\"===state.tokens.next.id?(advance(\"finally\"),block(!0),void 0):(b||error(\"E021\",state.tokens.next,\"catch\",state.tokens.next.value),this)}),blockstmt(\"while\",function(){var t=state.tokens.next;return state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,increaseComplexityCount(),advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),block(!0,!0),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1,this}).labelled=!0,blockstmt(\"with\",function(){var t=state.tokens.next;return state.isStrict()?error(\"E010\",state.tokens.curr):state.option.withstmt||warning(\"W085\",state.tokens.curr),advance(\"(\"),expression(0),advance(\")\",t),block(!0,!0),this}),blockstmt(\"switch\",function(){var t=state.tokens.next,g=!1,noindent=!1;\nfor(state.funct[\"(breakage)\"]+=1,advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),t=state.tokens.next,advance(\"{\"),state.tokens.next.from===indent&&(noindent=!0),noindent||(indent+=state.option.indent),this.cases=[];;)switch(state.tokens.next.id){case\"case\":switch(state.funct[\"(verb)\"]){case\"yield\":case\"break\":case\"case\":case\"continue\":case\"return\":case\"switch\":case\"throw\":break;default:state.tokens.curr.caseFallsThrough||warning(\"W086\",state.tokens.curr,\"case\")}advance(\"case\"),this.cases.push(expression(0)),increaseComplexityCount(),g=!0,advance(\":\"),state.funct[\"(verb)\"]=\"case\";break;case\"default\":switch(state.funct[\"(verb)\"]){case\"yield\":case\"break\":case\"continue\":case\"return\":case\"throw\":break;default:this.cases.length&&(state.tokens.curr.caseFallsThrough||warning(\"W086\",state.tokens.curr,\"default\"))}advance(\"default\"),g=!0,advance(\":\");break;case\"}\":return noindent||(indent-=state.option.indent),advance(\"}\",t),state.funct[\"(breakage)\"]-=1,state.funct[\"(verb)\"]=void 0,void 0;case\"(end)\":return error(\"E023\",state.tokens.next,\"}\"),void 0;default:if(indent+=state.option.indent,g)switch(state.tokens.curr.id){case\",\":return error(\"E040\"),void 0;case\":\":g=!1,statements();break;default:return error(\"E025\",state.tokens.curr),void 0}else{if(\":\"!==state.tokens.curr.id)return error(\"E021\",state.tokens.next,\"case\",state.tokens.next.value),void 0;advance(\":\"),error(\"E024\",state.tokens.curr,\":\"),statements()}indent-=state.option.indent}return this}).labelled=!0,stmt(\"debugger\",function(){return state.option.debug||warning(\"W087\",this),this}).exps=!0,function(){var x=stmt(\"do\",function(){state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,increaseComplexityCount(),this.first=block(!0,!0),advance(\"while\");var t=state.tokens.next;return advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1,this});x.labelled=!0,x.exps=!0}(),blockstmt(\"for\",function(){var s,t=state.tokens.next,letscope=!1,foreachtok=null;\"each\"===t.value&&(foreachtok=t,advance(\"each\"),state.inMoz()||warning(\"W118\",state.tokens.curr,\"for each\")),increaseComplexityCount(),advance(\"(\");var nextop,comma,initializer,i=0,inof=[\"in\",\"of\"],level=0;checkPunctuators(state.tokens.next,[\"{\",\"[\"])&&++level;do{if(nextop=peek(i),++i,checkPunctuators(nextop,[\"{\",\"[\"])?++level:checkPunctuators(nextop,[\"}\",\"]\"])&&--level,0>level)break;0===level&&(!comma&&checkPunctuator(nextop,\",\")?comma=nextop:!initializer&&checkPunctuator(nextop,\"=\")&&(initializer=nextop))}while(level>0||!_.contains(inof,nextop.value)&&\";\"!==nextop.value&&\"(end)\"!==nextop.type);if(_.contains(inof,nextop.value)){state.inES6()||\"of\"!==nextop.value||warning(\"W104\",nextop,\"for of\",\"6\");var ok=!(initializer||comma);if(initializer&&error(\"W133\",comma,nextop.value,\"initializer is forbidden\"),comma&&error(\"W133\",comma,nextop.value,\"more than one ForBinding\"),\"var\"===state.tokens.next.id?(advance(\"var\"),state.tokens.curr.fud({prefix:!0})):\"let\"===state.tokens.next.id||\"const\"===state.tokens.next.id?(advance(state.tokens.next.id),letscope=!0,state.funct[\"(scope)\"].stack(),state.tokens.curr.fud({prefix:!0})):Object.create(varstatement).fud({prefix:!0,implied:\"for\",ignore:!ok}),advance(nextop.value),expression(20),advance(\")\",t),\"in\"===nextop.value&&state.option.forin&&(state.forinifcheckneeded=!0,void 0===state.forinifchecks&&(state.forinifchecks=[]),state.forinifchecks.push({type:\"(none)\"})),state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,s=block(!0,!0),\"in\"===nextop.value&&state.option.forin){if(state.forinifchecks&&state.forinifchecks.length>0){var check=state.forinifchecks.pop();(s&&s.length>0&&(\"object\"!=typeof s[0]||\"if\"!==s[0].value)||\"(positive)\"===check.type&&s.length>1||\"(negative)\"===check.type)&&warning(\"W089\",this)}state.forinifcheckneeded=!1}state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1}else{if(foreachtok&&error(\"E045\",foreachtok),\";\"!==state.tokens.next.id)if(\"var\"===state.tokens.next.id)advance(\"var\"),state.tokens.curr.fud();else if(\"let\"===state.tokens.next.id)advance(\"let\"),letscope=!0,state.funct[\"(scope)\"].stack(),state.tokens.curr.fud();else for(;expression(0,\"for\"),\",\"===state.tokens.next.id;)comma();if(nolinebreak(state.tokens.curr),advance(\";\"),state.funct[\"(loopage)\"]+=1,\";\"!==state.tokens.next.id&&checkCondAssignment(expression(0)),nolinebreak(state.tokens.curr),advance(\";\"),\";\"===state.tokens.next.id&&error(\"E021\",state.tokens.next,\")\",\";\"),\")\"!==state.tokens.next.id)for(;expression(0,\"for\"),\",\"===state.tokens.next.id;)comma();advance(\")\",t),state.funct[\"(breakage)\"]+=1,block(!0,!0),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1}return letscope&&state.funct[\"(scope)\"].unstack(),this}).labelled=!0,stmt(\"break\",function(){var v=state.tokens.next.value;return state.option.asi||nolinebreak(this),\";\"===state.tokens.next.id||state.tokens.next.reach||state.tokens.curr.line!==startLine(state.tokens.next)?0===state.funct[\"(breakage)\"]&&warning(\"W052\",state.tokens.next,this.value):(state.funct[\"(scope)\"].funct.hasBreakLabel(v)||warning(\"W090\",state.tokens.next,v),this.first=state.tokens.next,advance()),reachable(this),this}).exps=!0,stmt(\"continue\",function(){var v=state.tokens.next.value;return 0===state.funct[\"(breakage)\"]&&warning(\"W052\",state.tokens.next,this.value),state.funct[\"(loopage)\"]||warning(\"W052\",state.tokens.next,this.value),state.option.asi||nolinebreak(this),\";\"===state.tokens.next.id||state.tokens.next.reach||state.tokens.curr.line===startLine(state.tokens.next)&&(state.funct[\"(scope)\"].funct.hasBreakLabel(v)||warning(\"W090\",state.tokens.next,v),this.first=state.tokens.next,advance()),reachable(this),this}).exps=!0,stmt(\"return\",function(){return this.line===startLine(state.tokens.next)?\";\"===state.tokens.next.id||state.tokens.next.reach||(this.first=expression(0),!this.first||\"(punctuator)\"!==this.first.type||\"=\"!==this.first.value||this.first.paren||state.option.boss||warningAt(\"W093\",this.first.line,this.first.character)):\"(punctuator)\"===state.tokens.next.type&&[\"[\",\"{\",\"+\",\"-\"].indexOf(state.tokens.next.value)>-1&&nolinebreak(this),reachable(this),this}).exps=!0,function(x){x.exps=!0,x.lbp=25}(prefix(\"yield\",function(){var prev=state.tokens.prev;state.inES6(!0)&&!state.funct[\"(generator)\"]?\"(catch)\"===state.funct[\"(name)\"]&&state.funct[\"(context)\"][\"(generator)\"]||error(\"E046\",state.tokens.curr,\"yield\"):state.inES6()||warning(\"W104\",state.tokens.curr,\"yield\",\"6\"),state.funct[\"(generator)\"]=\"yielded\";var delegatingYield=!1;return\"*\"===state.tokens.next.value&&(delegatingYield=!0,advance(\"*\")),this.line!==startLine(state.tokens.next)&&state.inMoz()?state.option.asi||nolinebreak(this):((delegatingYield||\";\"!==state.tokens.next.id&&!state.option.asi&&!state.tokens.next.reach&&state.tokens.next.nud)&&(nobreaknonadjacent(state.tokens.curr,state.tokens.next),this.first=expression(10),\"(punctuator)\"!==this.first.type||\"=\"!==this.first.value||this.first.paren||state.option.boss||warningAt(\"W093\",this.first.line,this.first.character)),state.inMoz()&&\")\"!==state.tokens.next.id&&(prev.lbp>30||!prev.assign&&!isEndOfExpr()||\"yield\"===prev.id)&&error(\"E050\",this)),this})),stmt(\"throw\",function(){return nolinebreak(this),this.first=expression(20),reachable(this),this}).exps=!0,stmt(\"import\",function(){if(state.inES6()||warning(\"W119\",state.tokens.curr,\"import\",\"6\"),\"(string)\"===state.tokens.next.type)return advance(\"(string)\"),this;if(state.tokens.next.identifier){if(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"const\",token:state.tokens.curr}),\",\"!==state.tokens.next.value)return advance(\"from\"),advance(\"(string)\"),this;advance(\",\")}if(\"*\"===state.tokens.next.id)advance(\"*\"),advance(\"as\"),state.tokens.next.identifier&&(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"const\",token:state.tokens.curr}));else for(advance(\"{\");;){if(\"}\"===state.tokens.next.value){advance(\"}\");break}var importName;if(\"default\"===state.tokens.next.type?(importName=\"default\",advance(\"default\")):importName=identifier(),\"as\"===state.tokens.next.value&&(advance(\"as\"),importName=identifier()),state.funct[\"(scope)\"].addlabel(importName,{type:\"const\",token:state.tokens.curr}),\",\"!==state.tokens.next.value){if(\"}\"===state.tokens.next.value){advance(\"}\");break}error(\"E024\",state.tokens.next,state.tokens.next.value);break}advance(\",\")}return advance(\"from\"),advance(\"(string)\"),this}).exps=!0,stmt(\"export\",function(){var token,identifier,ok=!0;if(state.inES6()||(warning(\"W119\",state.tokens.curr,\"export\",\"6\"),ok=!1),state.funct[\"(scope)\"].block.isGlobal()||(error(\"E053\",state.tokens.curr),ok=!1),\"*\"===state.tokens.next.value)return advance(\"*\"),advance(\"from\"),advance(\"(string)\"),this;if(\"default\"===state.tokens.next.type){state.nameStack.set(state.tokens.next),advance(\"default\");var exportType=state.tokens.next.id;return(\"function\"===exportType||\"class\"===exportType)&&(this.block=!0),token=peek(),expression(10),identifier=token.value,this.block&&(state.funct[\"(scope)\"].addlabel(identifier,{type:exportType,token:token}),state.funct[\"(scope)\"].setExported(identifier,token)),this}if(\"{\"===state.tokens.next.value){advance(\"{\");for(var exportedTokens=[];;){if(state.tokens.next.identifier||error(\"E030\",state.tokens.next,state.tokens.next.value),advance(),exportedTokens.push(state.tokens.curr),\"as\"===state.tokens.next.value&&(advance(\"as\"),state.tokens.next.identifier||error(\"E030\",state.tokens.next,state.tokens.next.value),advance()),\",\"!==state.tokens.next.value){if(\"}\"===state.tokens.next.value){advance(\"}\");break}error(\"E024\",state.tokens.next,state.tokens.next.value);break}advance(\",\")}return\"from\"===state.tokens.next.value?(advance(\"from\"),advance(\"(string)\")):ok&&exportedTokens.forEach(function(token){state.funct[\"(scope)\"].setExported(token.value,token)}),this}if(\"var\"===state.tokens.next.id)advance(\"var\"),state.tokens.curr.fud({inexport:!0});else if(\"let\"===state.tokens.next.id)advance(\"let\"),state.tokens.curr.fud({inexport:!0});else if(\"const\"===state.tokens.next.id)advance(\"const\"),state.tokens.curr.fud({inexport:!0});else if(\"function\"===state.tokens.next.id)this.block=!0,advance(\"function\"),state.syntax[\"function\"].fud({inexport:!0});else if(\"class\"===state.tokens.next.id){this.block=!0,advance(\"class\");var classNameToken=state.tokens.next;state.syntax[\"class\"].fud(),state.funct[\"(scope)\"].setExported(classNameToken.value,classNameToken)}else error(\"E024\",state.tokens.next,state.tokens.next.value);return this}).exps=!0,FutureReservedWord(\"abstract\"),FutureReservedWord(\"boolean\"),FutureReservedWord(\"byte\"),FutureReservedWord(\"char\"),FutureReservedWord(\"class\",{es5:!0,nud:classdef}),FutureReservedWord(\"double\"),FutureReservedWord(\"enum\",{es5:!0}),FutureReservedWord(\"export\",{es5:!0}),FutureReservedWord(\"extends\",{es5:!0}),FutureReservedWord(\"final\"),FutureReservedWord(\"float\"),FutureReservedWord(\"goto\"),FutureReservedWord(\"implements\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"import\",{es5:!0}),FutureReservedWord(\"int\"),FutureReservedWord(\"interface\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"long\"),FutureReservedWord(\"native\"),FutureReservedWord(\"package\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"private\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"protected\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"public\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"short\"),FutureReservedWord(\"static\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"super\",{es5:!0}),FutureReservedWord(\"synchronized\"),FutureReservedWord(\"transient\"),FutureReservedWord(\"volatile\");var lookupBlockType=function(){var pn,pn1,prev,i=-1,bracketStack=0,ret={};checkPunctuators(state.tokens.curr,[\"[\",\"{\"])&&(bracketStack+=1);do{if(prev=-1===i?state.tokens.curr:pn,pn=-1===i?state.tokens.next:peek(i),pn1=peek(i+1),i+=1,checkPunctuators(pn,[\"[\",\"{\"])?bracketStack+=1:checkPunctuators(pn,[\"]\",\"}\"])&&(bracketStack-=1),1===bracketStack&&pn.identifier&&\"for\"===pn.value&&!checkPunctuator(prev,\".\")){ret.isCompArray=!0,ret.notJson=!0;break}if(0===bracketStack&&checkPunctuators(pn,[\"}\",\"]\"])){if(\"=\"===pn1.value){ret.isDestAssign=!0,ret.notJson=!0;break}if(\".\"===pn1.value){ret.notJson=!0;break}}checkPunctuator(pn,\";\")&&(ret.isBlock=!0,ret.notJson=!0)}while(bracketStack>0&&\"(end)\"!==pn.id);return ret},arrayComprehension=function(){function declare(v){var l=_current.variables.filter(function(elt){return elt.value===v?(elt.undef=!1,v):void 0}).length;return 0!==l}function use(v){var l=_current.variables.filter(function(elt){return elt.value!==v||elt.undef?void 0:(elt.unused===!0&&(elt.unused=!1),v)}).length;return 0===l}var _current,CompArray=function(){this.mode=\"use\",this.variables=[]},_carrays=[];return{stack:function(){_current=new CompArray,_carrays.push(_current)},unstack:function(){_current.variables.filter(function(v){v.unused&&warning(\"W098\",v.token,v.raw_text||v.value),v.undef&&state.funct[\"(scope)\"].block.use(v.value,v.token)}),_carrays.splice(-1,1),_current=_carrays[_carrays.length-1]},setState:function(s){_.contains([\"use\",\"define\",\"generate\",\"filter\"],s)&&(_current.mode=s)},check:function(v){return _current?_current&&\"use\"===_current.mode?(use(v)&&_current.variables.push({funct:state.funct,token:state.tokens.curr,value:v,undef:!0,unused:!1}),!0):_current&&\"define\"===_current.mode?(declare(v)||_current.variables.push({funct:state.funct,token:state.tokens.curr,value:v,undef:!1,unused:!0}),!0):_current&&\"generate\"===_current.mode?(state.funct[\"(scope)\"].block.use(v,state.tokens.curr),!0):_current&&\"filter\"===_current.mode?(use(v)&&state.funct[\"(scope)\"].block.use(v,state.tokens.curr),!0):!1:void 0}}},escapeRegex=function(str){return str.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g,\"\\\\$&\")},itself=function(s,o,g){function each(obj,cb){obj&&(Array.isArray(obj)||\"object\"!=typeof obj||(obj=Object.keys(obj)),obj.forEach(cb))}var i,k,x,reIgnoreStr,reIgnore,optionKeys,newOptionObj={},newIgnoredObj={};o=_.clone(o),state.reset(),o&&o.scope?JSHINT.scope=o.scope:(JSHINT.errors=[],JSHINT.undefs=[],JSHINT.internals=[],JSHINT.blacklist={},JSHINT.scope=\"(main)\"),predefined=Object.create(null),combine(predefined,vars.ecmaIdentifiers[3]),combine(predefined,vars.reservedVars),combine(predefined,g||{}),declared=Object.create(null);var exported=Object.create(null);if(o)for(each(o.predef||null,function(item){var slice,prop;\"-\"===item[0]?(slice=item.slice(1),JSHINT.blacklist[slice]=slice,delete predefined[slice]):(prop=Object.getOwnPropertyDescriptor(o.predef,item),predefined[item]=prop?prop.value:!1)}),each(o.exported||null,function(item){exported[item]=!0}),delete o.predef,delete o.exported,optionKeys=Object.keys(o),x=0;optionKeys.length>x;x++)if(/^-W\\d{3}$/g.test(optionKeys[x]))newIgnoredObj[optionKeys[x].slice(1)]=!0;else{var optionKey=optionKeys[x];newOptionObj[optionKey]=o[optionKey],(\"esversion\"===optionKey&&5===o[optionKey]||\"es5\"===optionKey&&o[optionKey])&&warning(\"I003\"),\"newcap\"===optionKeys[x]&&o[optionKey]===!1&&(newOptionObj[\"(explicitNewcap)\"]=!0)}state.option=newOptionObj,state.ignored=newIgnoredObj,state.option.indent=state.option.indent||4,state.option.maxerr=state.option.maxerr||50,indent=1;var scopeManagerInst=scopeManager(state,predefined,exported,declared);if(scopeManagerInst.on(\"warning\",function(ev){warning.apply(null,[ev.code,ev.token].concat(ev.data))}),scopeManagerInst.on(\"error\",function(ev){error.apply(null,[ev.code,ev.token].concat(ev.data))}),state.funct=functor(\"(global)\",null,{\"(global)\":!0,\"(scope)\":scopeManagerInst,\"(comparray)\":arrayComprehension(),\"(metrics)\":createMetrics(state.tokens.next)}),functions=[state.funct],urls=[],stack=null,member={},membersOnly=null,inblock=!1,lookahead=[],!isString(s)&&!Array.isArray(s))return errorAt(\"E004\",0),!1;api={get isJSON(){return state.jsonMode},getOption:function(name){return state.option[name]||null},getCache:function(name){return state.cache[name]},setCache:function(name,value){state.cache[name]=value},warn:function(code,data){warningAt.apply(null,[code,data.line,data.char].concat(data.data))},on:function(names,listener){names.split(\" \").forEach(function(name){emitter.on(name,listener)}.bind(this))}},emitter.removeAllListeners(),(extraModules||[]).forEach(function(func){func(api)}),state.tokens.prev=state.tokens.curr=state.tokens.next=state.syntax[\"(begin)\"],o&&o.ignoreDelimiters&&(Array.isArray(o.ignoreDelimiters)||(o.ignoreDelimiters=[o.ignoreDelimiters]),o.ignoreDelimiters.forEach(function(delimiterPair){delimiterPair.start&&delimiterPair.end&&(reIgnoreStr=escapeRegex(delimiterPair.start)+\"[\\\\s\\\\S]*?\"+escapeRegex(delimiterPair.end),reIgnore=RegExp(reIgnoreStr,\"ig\"),s=s.replace(reIgnore,function(match){return match.replace(/./g,\" \")}))})),lex=new Lexer(s),lex.on(\"warning\",function(ev){warningAt.apply(null,[ev.code,ev.line,ev.character].concat(ev.data))}),lex.on(\"error\",function(ev){errorAt.apply(null,[ev.code,ev.line,ev.character].concat(ev.data))}),lex.on(\"fatal\",function(ev){quit(\"E041\",ev.line,ev.from)}),lex.on(\"Identifier\",function(ev){emitter.emit(\"Identifier\",ev)}),lex.on(\"String\",function(ev){emitter.emit(\"String\",ev)}),lex.on(\"Number\",function(ev){emitter.emit(\"Number\",ev)}),lex.start();for(var name in o)_.has(o,name)&&checkOption(name,state.tokens.curr);assume(),combine(predefined,g||{}),comma.first=!0;try{switch(advance(),state.tokens.next.id){case\"{\":case\"[\":destructuringAssignOrJsonValue();break;default:directives(),state.directive[\"use strict\"]&&\"global\"!==state.option.strict&&warning(\"W097\",state.tokens.prev),statements()}\"(end)\"!==state.tokens.next.id&&quit(\"E041\",state.tokens.curr.line),state.funct[\"(scope)\"].unstack()}catch(err){if(!err||\"JSHintError\"!==err.name)throw err;var nt=state.tokens.next||{};JSHINT.errors.push({scope:\"(main)\",raw:err.raw,code:err.code,reason:err.message,line:err.line||nt.line,character:err.character||nt.from},null)}if(\"(main)\"===JSHINT.scope)for(o=o||{},i=0;JSHINT.internals.length>i;i+=1)k=JSHINT.internals[i],o.scope=k.elem,itself(k.value,o,g);return 0===JSHINT.errors.length};return itself.addModule=function(func){extraModules.push(func)},itself.addModule(style.register),itself.data=function(){var fu,f,i,j,n,globals,data={functions:[],options:state.option};itself.errors.length&&(data.errors=itself.errors),state.jsonMode&&(data.json=!0);var impliedGlobals=state.funct[\"(scope)\"].getImpliedGlobals();for(impliedGlobals.length>0&&(data.implieds=impliedGlobals),urls.length>0&&(data.urls=urls),globals=state.funct[\"(scope)\"].getUsedOrDefinedGlobals(),globals.length>0&&(data.globals=globals),i=1;functions.length>i;i+=1){for(f=functions[i],fu={},j=0;functionicity.length>j;j+=1)fu[functionicity[j]]=[];for(j=0;functionicity.length>j;j+=1)0===fu[functionicity[j]].length&&delete fu[functionicity[j]];fu.name=f[\"(name)\"],fu.param=f[\"(params)\"],fu.line=f[\"(line)\"],fu.character=f[\"(character)\"],fu.last=f[\"(last)\"],fu.lastcharacter=f[\"(lastcharacter)\"],fu.metrics={complexity:f[\"(metrics)\"].ComplexityCount,parameters:f[\"(metrics)\"].arity,statements:f[\"(metrics)\"].statementCount},data.functions.push(fu)}var unuseds=state.funct[\"(scope)\"].getUnuseds();unuseds.length>0&&(data.unused=unuseds);for(n in member)if(\"number\"==typeof member[n]){data.member=member;break}return data},itself.jshint=itself,itself}();\"object\"==typeof exports&&exports&&(exports.JSHINT=JSHINT)},{\"../lodash\":\"/node_modules/jshint/lodash.js\",\"./lex.js\":\"/node_modules/jshint/src/lex.js\",\"./messages.js\":\"/node_modules/jshint/src/messages.js\",\"./options.js\":\"/node_modules/jshint/src/options.js\",\"./reg.js\":\"/node_modules/jshint/src/reg.js\",\"./scope-manager.js\":\"/node_modules/jshint/src/scope-manager.js\",\"./state.js\":\"/node_modules/jshint/src/state.js\",\"./style.js\":\"/node_modules/jshint/src/style.js\",\"./vars.js\":\"/node_modules/jshint/src/vars.js\",events:\"/node_modules/browserify/node_modules/events/events.js\"}],\"/node_modules/jshint/src/lex.js\":[function(_dereq_,module,exports){\"use strict\";function asyncTrigger(){var _checks=[];return{push:function(fn){_checks.push(fn)},check:function(){for(var check=0;_checks.length>check;++check)_checks[check]();_checks.splice(0,_checks.length)}}}function Lexer(source){var lines=source;\"string\"==typeof lines&&(lines=lines.replace(/\\r\\n/g,\"\\n\").replace(/\\r/g,\"\\n\").split(\"\\n\")),lines[0]&&\"#!\"===lines[0].substr(0,2)&&(-1!==lines[0].indexOf(\"node\")&&(state.option.node=!0),lines[0]=\"\"),this.emitter=new events.EventEmitter,this.source=source,this.setLines(lines),this.prereg=!0,this.line=0,this.char=1,this.from=1,this.input=\"\",this.inComment=!1,this.context=[],this.templateStarts=[];for(var i=0;state.option.indent>i;i+=1)state.tab+=\" \";this.ignoreLinterErrors=!1}var _=_dereq_(\"../lodash\"),events=_dereq_(\"events\"),reg=_dereq_(\"./reg.js\"),state=_dereq_(\"./state.js\").state,unicodeData=_dereq_(\"../data/ascii-identifier-data.js\"),asciiIdentifierStartTable=unicodeData.asciiIdentifierStartTable,asciiIdentifierPartTable=unicodeData.asciiIdentifierPartTable,Token={Identifier:1,Punctuator:2,NumericLiteral:3,StringLiteral:4,Comment:5,Keyword:6,NullLiteral:7,BooleanLiteral:8,RegExp:9,TemplateHead:10,TemplateMiddle:11,TemplateTail:12,NoSubstTemplate:13},Context={Block:1,Template:2};Lexer.prototype={_lines:[],inContext:function(ctxType){return this.context.length>0&&this.context[this.context.length-1].type===ctxType},pushContext:function(ctxType){this.context.push({type:ctxType})},popContext:function(){return this.context.pop()},isContext:function(context){return this.context.length>0&&this.context[this.context.length-1]===context},currentContext:function(){return this.context.length>0&&this.context[this.context.length-1]},getLines:function(){return this._lines=state.lines,this._lines},setLines:function(val){this._lines=val,state.lines=this._lines},peek:function(i){return this.input.charAt(i||0)},skip:function(i){i=i||1,this.char+=i,this.input=this.input.slice(i)},on:function(names,listener){names.split(\" \").forEach(function(name){this.emitter.on(name,listener)}.bind(this))},trigger:function(){this.emitter.emit.apply(this.emitter,Array.prototype.slice.call(arguments))},triggerAsync:function(type,args,checks,fn){checks.push(function(){fn()&&this.trigger(type,args)}.bind(this))},scanPunctuator:function(){var ch2,ch3,ch4,ch1=this.peek();switch(ch1){case\".\":if(/^[0-9]$/.test(this.peek(1)))return null;if(\".\"===this.peek(1)&&\".\"===this.peek(2))return{type:Token.Punctuator,value:\"...\"};case\"(\":case\")\":case\";\":case\",\":case\"[\":case\"]\":case\":\":case\"~\":case\"?\":return{type:Token.Punctuator,value:ch1};case\"{\":return this.pushContext(Context.Block),{type:Token.Punctuator,value:ch1};case\"}\":return this.inContext(Context.Block)&&this.popContext(),{type:Token.Punctuator,value:ch1};case\"#\":return{type:Token.Punctuator,value:ch1};case\"\":return null}return ch2=this.peek(1),ch3=this.peek(2),ch4=this.peek(3),\">\"===ch1&&\">\"===ch2&&\">\"===ch3&&\"=\"===ch4?{type:Token.Punctuator,value:\">>>=\"}:\"=\"===ch1&&\"=\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"===\"}:\"!\"===ch1&&\"=\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"!==\"}:\">\"===ch1&&\">\"===ch2&&\">\"===ch3?{type:Token.Punctuator,value:\">>>\"}:\"<\"===ch1&&\"<\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"<<=\"}:\">\"===ch1&&\">\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\">>=\"}:\"=\"===ch1&&\">\"===ch2?{type:Token.Punctuator,value:ch1+ch2}:ch1===ch2&&\"+-<>&|\".indexOf(ch1)>=0?{type:Token.Punctuator,value:ch1+ch2}:\"<>=!+-*%&|^\".indexOf(ch1)>=0?\"=\"===ch2?{type:Token.Punctuator,value:ch1+ch2}:{type:Token.Punctuator,value:ch1}:\"/\"===ch1?\"=\"===ch2?{type:Token.Punctuator,value:\"/=\"}:{type:Token.Punctuator,value:\"/\"}:null},scanComments:function(){function commentToken(label,body,opt){var special=[\"jshint\",\"jslint\",\"members\",\"member\",\"globals\",\"global\",\"exported\"],isSpecial=!1,value=label+body,commentType=\"plain\";return opt=opt||{},opt.isMultiline&&(value+=\"*/\"),body=body.replace(/\\n/g,\" \"),\"/*\"===label&®.fallsThrough.test(body)&&(isSpecial=!0,commentType=\"falls through\"),special.forEach(function(str){if(!isSpecial&&(\"//\"!==label||\"jshint\"===str)&&(\" \"===body.charAt(str.length)&&body.substr(0,str.length)===str&&(isSpecial=!0,label+=str,body=body.substr(str.length)),isSpecial||\" \"!==body.charAt(0)||\" \"!==body.charAt(str.length+1)||body.substr(1,str.length)!==str||(isSpecial=!0,label=label+\" \"+str,body=body.substr(str.length+1)),isSpecial))switch(str){case\"member\":commentType=\"members\";break;case\"global\":commentType=\"globals\";break;default:var options=body.split(\":\").map(function(v){return v.replace(/^\\s+/,\"\").replace(/\\s+$/,\"\")});if(2===options.length)switch(options[0]){case\"ignore\":switch(options[1]){case\"start\":self.ignoringLinterErrors=!0,isSpecial=!1;break;case\"end\":self.ignoringLinterErrors=!1,isSpecial=!1}}commentType=str}}),{type:Token.Comment,commentType:commentType,value:value,body:body,isSpecial:isSpecial,isMultiline:opt.isMultiline||!1,isMalformed:opt.isMalformed||!1}}var ch1=this.peek(),ch2=this.peek(1),rest=this.input.substr(2),startLine=this.line,startChar=this.char,self=this;if(\"*\"===ch1&&\"/\"===ch2)return this.trigger(\"error\",{code:\"E018\",line:startLine,character:startChar}),this.skip(2),null;if(\"/\"!==ch1||\"*\"!==ch2&&\"/\"!==ch2)return null;if(\"/\"===ch2)return this.skip(this.input.length),commentToken(\"//\",rest);var body=\"\";if(\"*\"===ch2){for(this.inComment=!0,this.skip(2);\"*\"!==this.peek()||\"/\"!==this.peek(1);)if(\"\"===this.peek()){if(body+=\"\\n\",!this.nextLine())return this.trigger(\"error\",{code:\"E017\",line:startLine,character:startChar}),this.inComment=!1,commentToken(\"/*\",body,{isMultiline:!0,isMalformed:!0})}else body+=this.peek(),this.skip();return this.skip(2),this.inComment=!1,commentToken(\"/*\",body,{isMultiline:!0})}},scanKeyword:function(){var result=/^[a-zA-Z_$][a-zA-Z0-9_$]*/.exec(this.input),keywords=[\"if\",\"in\",\"do\",\"var\",\"for\",\"new\",\"try\",\"let\",\"this\",\"else\",\"case\",\"void\",\"with\",\"enum\",\"while\",\"break\",\"catch\",\"throw\",\"const\",\"yield\",\"class\",\"super\",\"return\",\"typeof\",\"delete\",\"switch\",\"export\",\"import\",\"default\",\"finally\",\"extends\",\"function\",\"continue\",\"debugger\",\"instanceof\"];return result&&keywords.indexOf(result[0])>=0?{type:Token.Keyword,value:result[0]}:null},scanIdentifier:function(){function isNonAsciiIdentifierStart(code){return code>256}function isNonAsciiIdentifierPart(code){return code>256}function isHexDigit(str){return/^[0-9a-fA-F]$/.test(str)}function removeEscapeSequences(id){return id.replace(/\\\\u([0-9a-fA-F]{4})/g,function(m0,codepoint){return String.fromCharCode(parseInt(codepoint,16))})}var type,char,id=\"\",index=0,readUnicodeEscapeSequence=function(){if(index+=1,\"u\"!==this.peek(index))return null;var code,ch1=this.peek(index+1),ch2=this.peek(index+2),ch3=this.peek(index+3),ch4=this.peek(index+4);return isHexDigit(ch1)&&isHexDigit(ch2)&&isHexDigit(ch3)&&isHexDigit(ch4)?(code=parseInt(ch1+ch2+ch3+ch4,16),asciiIdentifierPartTable[code]||isNonAsciiIdentifierPart(code)?(index+=5,\"\\\\u\"+ch1+ch2+ch3+ch4):null):null}.bind(this),getIdentifierStart=function(){var chr=this.peek(index),code=chr.charCodeAt(0);return 92===code?readUnicodeEscapeSequence():128>code?asciiIdentifierStartTable[code]?(index+=1,chr):null:isNonAsciiIdentifierStart(code)?(index+=1,chr):null}.bind(this),getIdentifierPart=function(){var chr=this.peek(index),code=chr.charCodeAt(0);return 92===code?readUnicodeEscapeSequence():128>code?asciiIdentifierPartTable[code]?(index+=1,chr):null:isNonAsciiIdentifierPart(code)?(index+=1,chr):null}.bind(this);if(char=getIdentifierStart(),null===char)return null;for(id=char;char=getIdentifierPart(),null!==char;)id+=char;switch(id){case\"true\":case\"false\":type=Token.BooleanLiteral;break;case\"null\":type=Token.NullLiteral;break;default:type=Token.Identifier}return{type:type,value:removeEscapeSequences(id),text:id,tokenLength:id.length}},scanNumericLiteral:function(){function isDecimalDigit(str){return/^[0-9]$/.test(str)}function isOctalDigit(str){return/^[0-7]$/.test(str)}function isBinaryDigit(str){return/^[01]$/.test(str)}function isHexDigit(str){return/^[0-9a-fA-F]$/.test(str)}function isIdentifierStart(ch){return\"$\"===ch||\"_\"===ch||\"\\\\\"===ch||ch>=\"a\"&&\"z\">=ch||ch>=\"A\"&&\"Z\">=ch}var bad,index=0,value=\"\",length=this.input.length,char=this.peek(index),isAllowedDigit=isDecimalDigit,base=10,isLegacy=!1;if(\".\"!==char&&!isDecimalDigit(char))return null;if(\".\"!==char){for(value=this.peek(index),index+=1,char=this.peek(index),\"0\"===value&&((\"x\"===char||\"X\"===char)&&(isAllowedDigit=isHexDigit,base=16,index+=1,value+=char),(\"o\"===char||\"O\"===char)&&(isAllowedDigit=isOctalDigit,base=8,state.inES6(!0)||this.trigger(\"warning\",{code:\"W119\",line:this.line,character:this.char,data:[\"Octal integer literal\",\"6\"]}),index+=1,value+=char),(\"b\"===char||\"B\"===char)&&(isAllowedDigit=isBinaryDigit,base=2,state.inES6(!0)||this.trigger(\"warning\",{code:\"W119\",line:this.line,character:this.char,data:[\"Binary integer literal\",\"6\"]}),index+=1,value+=char),isOctalDigit(char)&&(isAllowedDigit=isOctalDigit,base=8,isLegacy=!0,bad=!1,index+=1,value+=char),!isOctalDigit(char)&&isDecimalDigit(char)&&(index+=1,value+=char));length>index;){if(char=this.peek(index),isLegacy&&isDecimalDigit(char))bad=!0;else if(!isAllowedDigit(char))break;value+=char,index+=1}if(isAllowedDigit!==isDecimalDigit)return!isLegacy&&2>=value.length?{type:Token.NumericLiteral,value:value,isMalformed:!0}:length>index&&(char=this.peek(index),isIdentifierStart(char))?null:{type:Token.NumericLiteral,value:value,base:base,isLegacy:isLegacy,isMalformed:!1}}if(\".\"===char)for(value+=char,index+=1;length>index&&(char=this.peek(index),isDecimalDigit(char));)value+=char,index+=1;if(\"e\"===char||\"E\"===char){if(value+=char,index+=1,char=this.peek(index),(\"+\"===char||\"-\"===char)&&(value+=this.peek(index),index+=1),char=this.peek(index),!isDecimalDigit(char))return null;for(value+=char,index+=1;length>index&&(char=this.peek(index),isDecimalDigit(char));)value+=char,index+=1}return length>index&&(char=this.peek(index),isIdentifierStart(char))?null:{type:Token.NumericLiteral,value:value,base:base,isMalformed:!isFinite(value)}},scanEscapeSequence:function(checks){var allowNewLine=!1,jump=1;this.skip();var char=this.peek();switch(char){case\"'\":this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\'\"]},checks,function(){return state.jsonMode});break;case\"b\":char=\"\\\\b\";break;case\"f\":char=\"\\\\f\";break;case\"n\":char=\"\\\\n\";break;case\"r\":char=\"\\\\r\";break;case\"t\":char=\"\\\\t\";break;case\"0\":char=\"\\\\0\";var n=parseInt(this.peek(1),10);this.triggerAsync(\"warning\",{code:\"W115\",line:this.line,character:this.char},checks,function(){return n>=0&&7>=n&&state.isStrict()});break;case\"u\":var hexCode=this.input.substr(1,4),code=parseInt(hexCode,16);isNaN(code)&&this.trigger(\"warning\",{code:\"W052\",line:this.line,character:this.char,data:[\"u\"+hexCode]}),char=String.fromCharCode(code),jump=5;break;case\"v\":this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\v\"]},checks,function(){return state.jsonMode}),char=\"\u000b\";break;case\"x\":var x=parseInt(this.input.substr(1,2),16);this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\x-\"]},checks,function(){return state.jsonMode}),char=String.fromCharCode(x),jump=3;break;case\"\\\\\":char=\"\\\\\\\\\";break;case'\"':char='\\\\\"';break;case\"/\":break;case\"\":allowNewLine=!0,char=\"\"}return{\"char\":char,jump:jump,allowNewLine:allowNewLine}},scanTemplateLiteral:function(checks){var tokenType,ch,value=\"\",startLine=this.line,startChar=this.char,depth=this.templateStarts.length;if(!state.inES6(!0))return null;if(\"`\"===this.peek())tokenType=Token.TemplateHead,this.templateStarts.push({line:this.line,\"char\":this.char}),depth=this.templateStarts.length,this.skip(1),this.pushContext(Context.Template);else{if(!this.inContext(Context.Template)||\"}\"!==this.peek())return null;tokenType=Token.TemplateMiddle}for(;\"`\"!==this.peek();){for(;\"\"===(ch=this.peek());)if(value+=\"\\n\",!this.nextLine()){var startPos=this.templateStarts.pop();return this.trigger(\"error\",{code:\"E052\",line:startPos.line,character:startPos.char}),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!0,depth:depth,context:this.popContext()}}if(\"$\"===ch&&\"{\"===this.peek(1))return value+=\"${\",this.skip(2),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,depth:depth,context:this.currentContext()};\nif(\"\\\\\"===ch){var escape=this.scanEscapeSequence(checks);value+=escape.char,this.skip(escape.jump)}else\"`\"!==ch&&(value+=ch,this.skip(1))}return tokenType=tokenType===Token.TemplateHead?Token.NoSubstTemplate:Token.TemplateTail,this.skip(1),this.templateStarts.pop(),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,depth:depth,context:this.popContext()}},scanStringLiteral:function(checks){var quote=this.peek();if('\"'!==quote&&\"'\"!==quote)return null;this.triggerAsync(\"warning\",{code:\"W108\",line:this.line,character:this.char},checks,function(){return state.jsonMode&&'\"'!==quote});var value=\"\",startLine=this.line,startChar=this.char,allowNewLine=!1;for(this.skip();this.peek()!==quote;)if(\"\"===this.peek()){if(allowNewLine?(allowNewLine=!1,this.triggerAsync(\"warning\",{code:\"W043\",line:this.line,character:this.char},checks,function(){return!state.option.multistr}),this.triggerAsync(\"warning\",{code:\"W042\",line:this.line,character:this.char},checks,function(){return state.jsonMode&&state.option.multistr})):this.trigger(\"warning\",{code:\"W112\",line:this.line,character:this.char}),!this.nextLine())return this.trigger(\"error\",{code:\"E029\",line:startLine,character:startChar}),{type:Token.StringLiteral,value:value,startLine:startLine,startChar:startChar,isUnclosed:!0,quote:quote}}else{allowNewLine=!1;var char=this.peek(),jump=1;if(\" \">char&&this.trigger(\"warning\",{code:\"W113\",line:this.line,character:this.char,data:[\"\"]}),\"\\\\\"===char){var parsed=this.scanEscapeSequence(checks);char=parsed.char,jump=parsed.jump,allowNewLine=parsed.allowNewLine}value+=char,this.skip(jump)}return this.skip(),{type:Token.StringLiteral,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,quote:quote}},scanRegExp:function(){var terminated,index=0,length=this.input.length,char=this.peek(),value=char,body=\"\",flags=[],malformed=!1,isCharSet=!1,scanUnexpectedChars=function(){\" \">char&&(malformed=!0,this.trigger(\"warning\",{code:\"W048\",line:this.line,character:this.char})),\"<\"===char&&(malformed=!0,this.trigger(\"warning\",{code:\"W049\",line:this.line,character:this.char,data:[char]}))}.bind(this);if(!this.prereg||\"/\"!==char)return null;for(index+=1,terminated=!1;length>index;)if(char=this.peek(index),value+=char,body+=char,isCharSet)\"]\"===char&&(\"\\\\\"!==this.peek(index-1)||\"\\\\\"===this.peek(index-2))&&(isCharSet=!1),\"\\\\\"===char&&(index+=1,char=this.peek(index),body+=char,value+=char,scanUnexpectedChars()),index+=1;else{if(\"\\\\\"===char){if(index+=1,char=this.peek(index),body+=char,value+=char,scanUnexpectedChars(),\"/\"===char){index+=1;continue}if(\"[\"===char){index+=1;continue}}if(\"[\"!==char){if(\"/\"===char){body=body.substr(0,body.length-1),terminated=!0,index+=1;break}index+=1}else isCharSet=!0,index+=1}if(!terminated)return this.trigger(\"error\",{code:\"E015\",line:this.line,character:this.from}),void this.trigger(\"fatal\",{line:this.line,from:this.from});for(;length>index&&(char=this.peek(index),/[gim]/.test(char));)flags.push(char),value+=char,index+=1;try{RegExp(body,flags.join(\"\"))}catch(err){malformed=!0,this.trigger(\"error\",{code:\"E016\",line:this.line,character:this.char,data:[err.message]})}return{type:Token.RegExp,value:value,flags:flags,isMalformed:malformed}},scanNonBreakingSpaces:function(){return state.option.nonbsp?this.input.search(/(\\u00A0)/):-1},scanUnsafeChars:function(){return this.input.search(reg.unsafeChars)},next:function(checks){this.from=this.char;var start;if(/\\s/.test(this.peek()))for(start=this.char;/\\s/.test(this.peek());)this.from+=1,this.skip();var match=this.scanComments()||this.scanStringLiteral(checks)||this.scanTemplateLiteral(checks);return match?match:(match=this.scanRegExp()||this.scanPunctuator()||this.scanKeyword()||this.scanIdentifier()||this.scanNumericLiteral(),match?(this.skip(match.tokenLength||match.value.length),match):null)},nextLine:function(){var char;if(this.line>=this.getLines().length)return!1;this.input=this.getLines()[this.line],this.line+=1,this.char=1,this.from=1;var inputTrimmed=this.input.trim(),startsWith=function(){return _.some(arguments,function(prefix){return 0===inputTrimmed.indexOf(prefix)})},endsWith=function(){return _.some(arguments,function(suffix){return-1!==inputTrimmed.indexOf(suffix,inputTrimmed.length-suffix.length)})};if(this.ignoringLinterErrors===!0&&(startsWith(\"/*\",\"//\")||this.inComment&&endsWith(\"*/\")||(this.input=\"\")),char=this.scanNonBreakingSpaces(),char>=0&&this.trigger(\"warning\",{code:\"W125\",line:this.line,character:char+1}),this.input=this.input.replace(/\\t/g,state.tab),char=this.scanUnsafeChars(),char>=0&&this.trigger(\"warning\",{code:\"W100\",line:this.line,character:char}),!this.ignoringLinterErrors&&state.option.maxlen&&state.option.maxlen=0;--i){var scopeLabels=_scopeStack[i][\"(labels)\"];if(scopeLabels[labelName])return scopeLabels}}function usedSoFarInCurrentFunction(labelName){for(var i=_scopeStack.length-1;i>=0;i--){var current=_scopeStack[i];if(current[\"(usages)\"][labelName])return current[\"(usages)\"][labelName];if(current===_currentFunctBody)break}return!1}function _checkOuterShadow(labelName,token){if(\"outer\"===state.option.shadow)for(var isGlobal=\"global\"===_currentFunctBody[\"(type)\"],isNewFunction=\"functionparams\"===_current[\"(type)\"],outsideCurrentFunction=!isGlobal,i=0;_scopeStack.length>i;i++){var stackItem=_scopeStack[i];isNewFunction||_scopeStack[i+1]!==_currentFunctBody||(outsideCurrentFunction=!1),outsideCurrentFunction&&stackItem[\"(labels)\"][labelName]&&warning(\"W123\",token,labelName),stackItem[\"(breakLabels)\"][labelName]&&warning(\"W123\",token,labelName)}}function _latedefWarning(type,labelName,token){state.option.latedef&&(state.option.latedef===!0&&\"function\"===type||\"function\"!==type)&&warning(\"W003\",token,labelName)}var _current,_scopeStack=[];_newScope(\"global\"),_current[\"(predefined)\"]=predefined;var _currentFunctBody=_current,usedPredefinedAndGlobals=Object.create(null),impliedGlobals=Object.create(null),unuseds=[],emitter=new events.EventEmitter,_getUnusedOption=function(unused_opt){return void 0===unused_opt&&(unused_opt=state.option.unused),unused_opt===!0&&(unused_opt=\"last-param\"),unused_opt},_warnUnused=function(name,tkn,type,unused_opt){var line=tkn.line,chr=tkn.from,raw_name=tkn.raw_text||name;unused_opt=_getUnusedOption(unused_opt);var warnable_types={vars:[\"var\"],\"last-param\":[\"var\",\"param\"],strict:[\"var\",\"param\",\"last-param\"]};unused_opt&&warnable_types[unused_opt]&&-1!==warnable_types[unused_opt].indexOf(type)&&warning(\"W098\",{line:line,from:chr},raw_name),(unused_opt||\"var\"===type)&&unuseds.push({name:name,line:line,character:chr})},scopeManagerInst={on:function(names,listener){names.split(\" \").forEach(function(name){emitter.on(name,listener)})},isPredefined:function(labelName){return!this.has(labelName)&&_.has(_scopeStack[0][\"(predefined)\"],labelName)},stack:function(type){var previousScope=_current;_newScope(type),type||\"functionparams\"!==previousScope[\"(type)\"]||(_current[\"(isFuncBody)\"]=!0,_current[\"(context)\"]=_currentFunctBody,_currentFunctBody=_current)},unstack:function(){var i,j,subScope=_scopeStack.length>1?_scopeStack[_scopeStack.length-2]:null,isUnstackingFunctionBody=_current===_currentFunctBody,isUnstackingFunctionParams=\"functionparams\"===_current[\"(type)\"],isUnstackingFunctionOuter=\"functionouter\"===_current[\"(type)\"],currentUsages=_current[\"(usages)\"],currentLabels=_current[\"(labels)\"],usedLabelNameList=Object.keys(currentUsages);for(currentUsages.__proto__&&-1===usedLabelNameList.indexOf(\"__proto__\")&&usedLabelNameList.push(\"__proto__\"),i=0;usedLabelNameList.length>i;i++){var usedLabelName=usedLabelNameList[i],usage=currentUsages[usedLabelName],usedLabel=currentLabels[usedLabelName];if(usedLabel){var usedLabelType=usedLabel[\"(type)\"];if(usedLabel[\"(useOutsideOfScope)\"]&&!state.option.funcscope){var usedTokens=usage[\"(tokens)\"];if(usedTokens)for(j=0;usedTokens.length>j;j++)usedLabel[\"(function)\"]===usedTokens[j][\"(function)\"]&&error(\"W038\",usedTokens[j],usedLabelName)}if(_current[\"(labels)\"][usedLabelName][\"(unused)\"]=!1,\"const\"===usedLabelType&&usage[\"(modified)\"])for(j=0;usage[\"(modified)\"].length>j;j++)error(\"E013\",usage[\"(modified)\"][j],usedLabelName);if((\"function\"===usedLabelType||\"class\"===usedLabelType)&&usage[\"(reassigned)\"])for(j=0;usage[\"(reassigned)\"].length>j;j++)error(\"W021\",usage[\"(reassigned)\"][j],usedLabelName,usedLabelType)}else if(isUnstackingFunctionOuter&&(state.funct[\"(isCapturing)\"]=!0),subScope)if(subScope[\"(usages)\"][usedLabelName]){var subScopeUsage=subScope[\"(usages)\"][usedLabelName];subScopeUsage[\"(modified)\"]=subScopeUsage[\"(modified)\"].concat(usage[\"(modified)\"]),subScopeUsage[\"(tokens)\"]=subScopeUsage[\"(tokens)\"].concat(usage[\"(tokens)\"]),subScopeUsage[\"(reassigned)\"]=subScopeUsage[\"(reassigned)\"].concat(usage[\"(reassigned)\"]),subScopeUsage[\"(onlyUsedSubFunction)\"]=!1}else subScope[\"(usages)\"][usedLabelName]=usage,isUnstackingFunctionBody&&(subScope[\"(usages)\"][usedLabelName][\"(onlyUsedSubFunction)\"]=!0);else if(\"boolean\"==typeof _current[\"(predefined)\"][usedLabelName]){if(delete declared[usedLabelName],usedPredefinedAndGlobals[usedLabelName]=marker,_current[\"(predefined)\"][usedLabelName]===!1&&usage[\"(reassigned)\"])for(j=0;usage[\"(reassigned)\"].length>j;j++)warning(\"W020\",usage[\"(reassigned)\"][j])}else if(usage[\"(tokens)\"])for(j=0;usage[\"(tokens)\"].length>j;j++){var undefinedToken=usage[\"(tokens)\"][j];undefinedToken.forgiveUndef||(state.option.undef&&!undefinedToken.ignoreUndef&&warning(\"W117\",undefinedToken,usedLabelName),impliedGlobals[usedLabelName]?impliedGlobals[usedLabelName].line.push(undefinedToken.line):impliedGlobals[usedLabelName]={name:usedLabelName,line:[undefinedToken.line]})}}if(subScope||Object.keys(declared).forEach(function(labelNotUsed){_warnUnused(labelNotUsed,declared[labelNotUsed],\"var\")}),subScope&&!isUnstackingFunctionBody&&!isUnstackingFunctionParams&&!isUnstackingFunctionOuter){var labelNames=Object.keys(currentLabels);for(i=0;labelNames.length>i;i++){var defLabelName=labelNames[i];currentLabels[defLabelName][\"(blockscoped)\"]||\"exception\"===currentLabels[defLabelName][\"(type)\"]||this.funct.has(defLabelName,{excludeCurrent:!0})||(subScope[\"(labels)\"][defLabelName]=currentLabels[defLabelName],\"global\"!==_currentFunctBody[\"(type)\"]&&(subScope[\"(labels)\"][defLabelName][\"(useOutsideOfScope)\"]=!0),delete currentLabels[defLabelName])}}_checkForUnused(),_scopeStack.pop(),isUnstackingFunctionBody&&(_currentFunctBody=_scopeStack[_.findLastIndex(_scopeStack,function(scope){return scope[\"(isFuncBody)\"]||\"global\"===scope[\"(type)\"]})]),_current=subScope},addParam:function(labelName,token,type){if(type=type||\"param\",\"exception\"===type){var previouslyDefinedLabelType=this.funct.labeltype(labelName);previouslyDefinedLabelType&&\"exception\"!==previouslyDefinedLabelType&&(state.option.node||warning(\"W002\",state.tokens.next,labelName))}if(_.has(_current[\"(labels)\"],labelName)?_current[\"(labels)\"][labelName].duplicated=!0:(_checkOuterShadow(labelName,token,type),_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":token,\"(unused)\":!0},_current[\"(params)\"].push(labelName)),_.has(_current[\"(usages)\"],labelName)){var usage=_current[\"(usages)\"][labelName];usage[\"(onlyUsedSubFunction)\"]?_latedefWarning(type,labelName,token):warning(\"E056\",token,labelName,type)}},validateParams:function(){if(\"global\"!==_currentFunctBody[\"(type)\"]){var isStrict=state.isStrict(),currentFunctParamScope=_currentFunctBody[\"(parent)\"];currentFunctParamScope[\"(params)\"]&¤tFunctParamScope[\"(params)\"].forEach(function(labelName){var label=currentFunctParamScope[\"(labels)\"][labelName];label&&label.duplicated&&(isStrict?warning(\"E011\",label[\"(token)\"],labelName):state.option.shadow!==!0&&warning(\"W004\",label[\"(token)\"],labelName))})}},getUsedOrDefinedGlobals:function(){var list=Object.keys(usedPredefinedAndGlobals);return usedPredefinedAndGlobals.__proto__===marker&&-1===list.indexOf(\"__proto__\")&&list.push(\"__proto__\"),list},getImpliedGlobals:function(){var values=_.values(impliedGlobals),hasProto=!1;return impliedGlobals.__proto__&&(hasProto=values.some(function(value){return\"__proto__\"===value.name}),hasProto||values.push(impliedGlobals.__proto__)),values},getUnuseds:function(){return unuseds},has:function(labelName){return Boolean(_getLabel(labelName))},labeltype:function(labelName){var scopeLabels=_getLabel(labelName);return scopeLabels?scopeLabels[labelName][\"(type)\"]:null},addExported:function(labelName){var globalLabels=_scopeStack[0][\"(labels)\"];if(_.has(declared,labelName))delete declared[labelName];else if(_.has(globalLabels,labelName))globalLabels[labelName][\"(unused)\"]=!1;else{for(var i=1;_scopeStack.length>i;i++){var scope=_scopeStack[i];if(scope[\"(type)\"])break;if(_.has(scope[\"(labels)\"],labelName)&&!scope[\"(labels)\"][labelName][\"(blockscoped)\"])return scope[\"(labels)\"][labelName][\"(unused)\"]=!1,void 0}exported[labelName]=!0}},setExported:function(labelName,token){this.block.use(labelName,token)\n},addlabel:function(labelName,opts){var type=opts.type,token=opts.token,isblockscoped=\"let\"===type||\"const\"===type||\"class\"===type,isexported=\"global\"===(isblockscoped?_current:_currentFunctBody)[\"(type)\"]&&_.has(exported,labelName);if(_checkOuterShadow(labelName,token,type),isblockscoped){var declaredInCurrentScope=_current[\"(labels)\"][labelName];if(declaredInCurrentScope||_current!==_currentFunctBody||\"global\"===_current[\"(type)\"]||(declaredInCurrentScope=!!_currentFunctBody[\"(parent)\"][\"(labels)\"][labelName]),!declaredInCurrentScope&&_current[\"(usages)\"][labelName]){var usage=_current[\"(usages)\"][labelName];usage[\"(onlyUsedSubFunction)\"]?_latedefWarning(type,labelName,token):warning(\"E056\",token,labelName,type)}declaredInCurrentScope?warning(\"E011\",token,labelName):\"outer\"===state.option.shadow&&scopeManagerInst.funct.has(labelName)&&warning(\"W004\",token,labelName),scopeManagerInst.block.add(labelName,type,token,!isexported)}else{var declaredInCurrentFunctionScope=scopeManagerInst.funct.has(labelName);!declaredInCurrentFunctionScope&&usedSoFarInCurrentFunction(labelName)&&_latedefWarning(type,labelName,token),scopeManagerInst.funct.has(labelName,{onlyBlockscoped:!0})?warning(\"E011\",token,labelName):state.option.shadow!==!0&&declaredInCurrentFunctionScope&&\"__proto__\"!==labelName&&\"global\"!==_currentFunctBody[\"(type)\"]&&warning(\"W004\",token,labelName),scopeManagerInst.funct.add(labelName,type,token,!isexported),\"global\"===_currentFunctBody[\"(type)\"]&&(usedPredefinedAndGlobals[labelName]=marker)}},funct:{labeltype:function(labelName,options){for(var onlyBlockscoped=options&&options.onlyBlockscoped,excludeParams=options&&options.excludeParams,currentScopeIndex=_scopeStack.length-(options&&options.excludeCurrent?2:1),i=currentScopeIndex;i>=0;i--){var current=_scopeStack[i];if(current[\"(labels)\"][labelName]&&(!onlyBlockscoped||current[\"(labels)\"][labelName][\"(blockscoped)\"]))return current[\"(labels)\"][labelName][\"(type)\"];var scopeCheck=excludeParams?_scopeStack[i-1]:current;if(scopeCheck&&\"functionparams\"===scopeCheck[\"(type)\"])return null}return null},hasBreakLabel:function(labelName){for(var i=_scopeStack.length-1;i>=0;i--){var current=_scopeStack[i];if(current[\"(breakLabels)\"][labelName])return!0;if(\"functionparams\"===current[\"(type)\"])return!1}return!1},has:function(labelName,options){return Boolean(this.labeltype(labelName,options))},add:function(labelName,type,tok,unused){_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":tok,\"(blockscoped)\":!1,\"(function)\":_currentFunctBody,\"(unused)\":unused}}},block:{isGlobal:function(){return\"global\"===_current[\"(type)\"]},use:function(labelName,token){var paramScope=_currentFunctBody[\"(parent)\"];paramScope&¶mScope[\"(labels)\"][labelName]&&\"param\"===paramScope[\"(labels)\"][labelName][\"(type)\"]&&(scopeManagerInst.funct.has(labelName,{excludeParams:!0,onlyBlockscoped:!0})||(paramScope[\"(labels)\"][labelName][\"(unused)\"]=!1)),token&&(state.ignored.W117||state.option.undef===!1)&&(token.ignoreUndef=!0),_setupUsages(labelName),token&&(token[\"(function)\"]=_currentFunctBody,_current[\"(usages)\"][labelName][\"(tokens)\"].push(token))},reassign:function(labelName,token){this.modify(labelName,token),_current[\"(usages)\"][labelName][\"(reassigned)\"].push(token)},modify:function(labelName,token){_setupUsages(labelName),_current[\"(usages)\"][labelName][\"(modified)\"].push(token)},add:function(labelName,type,tok,unused){_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":tok,\"(blockscoped)\":!0,\"(unused)\":unused}},addBreakLabel:function(labelName,opts){var token=opts.token;scopeManagerInst.funct.hasBreakLabel(labelName)?warning(\"E011\",token,labelName):\"outer\"===state.option.shadow&&(scopeManagerInst.funct.has(labelName)?warning(\"W004\",token,labelName):_checkOuterShadow(labelName,token)),_current[\"(breakLabels)\"][labelName]=token}}};return scopeManagerInst};module.exports=scopeManager},{\"../lodash\":\"/node_modules/jshint/lodash.js\",events:\"/node_modules/browserify/node_modules/events/events.js\"}],\"/node_modules/jshint/src/state.js\":[function(_dereq_,module,exports){\"use strict\";var NameStack=_dereq_(\"./name-stack.js\"),state={syntax:{},isStrict:function(){return this.directive[\"use strict\"]||this.inClassBody||this.option.module||\"implied\"===this.option.strict},inMoz:function(){return this.option.moz},inES6:function(){return this.option.moz||this.option.esversion>=6},inES5:function(strict){return strict?!(this.option.esversion&&5!==this.option.esversion||this.option.moz):!this.option.esversion||this.option.esversion>=5||this.option.moz},reset:function(){this.tokens={prev:null,next:null,curr:null},this.option={},this.funct=null,this.ignored={},this.directive={},this.jsonMode=!1,this.jsonWarnings=[],this.lines=[],this.tab=\"\",this.cache={},this.ignoredLines={},this.forinifcheckneeded=!1,this.nameStack=new NameStack,this.inClassBody=!1}};exports.state=state},{\"./name-stack.js\":\"/node_modules/jshint/src/name-stack.js\"}],\"/node_modules/jshint/src/style.js\":[function(_dereq_,module,exports){\"use strict\";exports.register=function(linter){linter.on(\"Identifier\",function(data){linter.getOption(\"proto\")||\"__proto__\"===data.name&&linter.warn(\"W103\",{line:data.line,\"char\":data.char,data:[data.name,\"6\"]})}),linter.on(\"Identifier\",function(data){linter.getOption(\"iterator\")||\"__iterator__\"===data.name&&linter.warn(\"W103\",{line:data.line,\"char\":data.char,data:[data.name]})}),linter.on(\"Identifier\",function(data){linter.getOption(\"camelcase\")&&data.name.replace(/^_+|_+$/g,\"\").indexOf(\"_\")>-1&&!data.name.match(/^[A-Z0-9_]*$/)&&linter.warn(\"W106\",{line:data.line,\"char\":data.from,data:[data.name]})}),linter.on(\"String\",function(data){var code,quotmark=linter.getOption(\"quotmark\");quotmark&&(\"single\"===quotmark&&\"'\"!==data.quote&&(code=\"W109\"),\"double\"===quotmark&&'\"'!==data.quote&&(code=\"W108\"),quotmark===!0&&(linter.getCache(\"quotmark\")||linter.setCache(\"quotmark\",data.quote),linter.getCache(\"quotmark\")!==data.quote&&(code=\"W110\")),code&&linter.warn(code,{line:data.line,\"char\":data.char}))}),linter.on(\"Number\",function(data){\".\"===data.value.charAt(0)&&linter.warn(\"W008\",{line:data.line,\"char\":data.char,data:[data.value]}),\".\"===data.value.substr(data.value.length-1)&&linter.warn(\"W047\",{line:data.line,\"char\":data.char,data:[data.value]}),/^00+/.test(data.value)&&linter.warn(\"W046\",{line:data.line,\"char\":data.char,data:[data.value]})}),linter.on(\"String\",function(data){var re=/^(?:javascript|jscript|ecmascript|vbscript|livescript)\\s*:/i;linter.getOption(\"scripturl\")||re.test(data.value)&&linter.warn(\"W107\",{line:data.line,\"char\":data.char})})}},{}],\"/node_modules/jshint/src/vars.js\":[function(_dereq_,module,exports){\"use strict\";exports.reservedVars={arguments:!1,NaN:!1},exports.ecmaIdentifiers={3:{Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,Math:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1},5:{JSON:!1},6:{Map:!1,Promise:!1,Proxy:!1,Reflect:!1,Set:!1,Symbol:!1,WeakMap:!1,WeakSet:!1}},exports.browser={Audio:!1,Blob:!1,addEventListener:!1,applicationCache:!1,atob:!1,blur:!1,btoa:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,CSS:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,Comment:!1,CustomEvent:!1,DOMParser:!1,defaultStatus:!1,Document:!1,document:!1,DocumentFragment:!1,Element:!1,ElementTimeControl:!1,Event:!1,event:!1,fetch:!1,FileReader:!1,FormData:!1,focus:!1,frames:!1,getComputedStyle:!1,HTMLElement:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLCollection:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTemplateElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,history:!1,Image:!1,Intl:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,Node:!1,NodeFilter:!1,NodeList:!1,Notification:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,performance:!1,print:!1,Range:!1,requestAnimationFrame:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,status:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimationElement:!1,SVGCSSRule:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLineElement:!1,SVGLinearGradientElement:!1,SVGLocatable:!1,SVGMPathElement:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGSVGElement:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformList:!1,SVGTransformable:!1,SVGURIReference:!1,SVGUnitTypes:!1,SVGUseElement:!1,SVGVKernElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGZoomAndPan:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TimeEvent:!1,top:!1,URL:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},exports.devel={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},exports.worker={importScripts:!0,postMessage:!0,self:!0,FileReaderSync:!0},exports.nonstandard={escape:!1,unescape:!1},exports.couch={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1,provides:!1},exports.node={__filename:!1,__dirname:!1,GLOBAL:!1,global:!1,module:!1,acequire:!1,Buffer:!0,console:!0,exports:!0,process:!0,setTimeout:!0,clearTimeout:!0,setInterval:!0,clearInterval:!0,setImmediate:!0,clearImmediate:!0},exports.browserify={__filename:!1,__dirname:!1,global:!1,module:!1,acequire:!1,Buffer:!0,exports:!0,process:!0},exports.phantom={phantom:!0,acequire:!0,WebPage:!0,console:!0,exports:!0},exports.qunit={asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,\"throws\":!1},exports.rhino={defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},exports.shelljs={target:!1,echo:!1,exit:!1,cd:!1,pwd:!1,ls:!1,find:!1,cp:!1,rm:!1,mv:!1,mkdir:!1,test:!1,cat:!1,sed:!1,grep:!1,which:!1,dirs:!1,pushd:!1,popd:!1,env:!1,exec:!1,chmod:!1,config:!1,error:!1,tempdir:!1},exports.typed={ArrayBuffer:!1,ArrayBufferView:!1,DataView:!1,Float32Array:!1,Float64Array:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1},exports.wsh={ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WSH:!0,WScript:!0,XDomainRequest:!0},exports.dojo={dojo:!1,dijit:!1,dojox:!1,define:!1,require:!1},exports.jquery={$:!1,jQuery:!1},exports.mootools={$:!1,$$:!1,Asset:!1,Browser:!1,Chain:!1,Class:!1,Color:!1,Cookie:!1,Core:!1,Document:!1,DomReady:!1,DOMEvent:!1,DOMReady:!1,Drag:!1,Element:!1,Elements:!1,Event:!1,Events:!1,Fx:!1,Group:!1,Hash:!1,HtmlTable:!1,IFrame:!1,IframeShim:!1,InputValidator:!1,instanceOf:!1,Keyboard:!1,Locale:!1,Mask:!1,MooTools:!1,Native:!1,Options:!1,OverText:!1,Request:!1,Scroller:!1,Slick:!1,Slider:!1,Sortables:!1,Spinner:!1,Swiff:!1,Tips:!1,Type:!1,typeOf:!1,URI:!1,Window:!1},exports.prototypejs={$:!1,$$:!1,$A:!1,$F:!1,$H:!1,$R:!1,$break:!1,$continue:!1,$w:!1,Abstract:!1,Ajax:!1,Class:!1,Enumerable:!1,Element:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Selector:!1,Template:!1,Toggle:!1,Try:!1,Autocompleter:!1,Builder:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Scriptaculous:!1},exports.yui={YUI:!1,Y:!1,YUI_config:!1},exports.mocha={mocha:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,context:!1,xcontext:!1,before:!1,after:!1,beforeEach:!1,afterEach:!1,suite:!1,test:!1,setup:!1,teardown:!1,suiteSetup:!1,suiteTeardown:!1},exports.jasmine={jasmine:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,beforeEach:!1,afterEach:!1,setFixtures:!1,loadFixtures:!1,spyOn:!1,expect:!1,runs:!1,waitsFor:!1,waits:!1,beforeAll:!1,afterAll:!1,fail:!1,fdescribe:!1,fit:!1,pending:!1}},{}]},{},[\"/node_modules/jshint/src/jshint.js\"])}),ace.define(\"ace/mode/javascript_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/worker/mirror\",\"ace/mode/javascript/jshint\"],function(acequire,exports,module){\"use strict\";function startRegex(arr){return RegExp(\"^(\"+arr.join(\"|\")+\")\")}var oop=acequire(\"../lib/oop\"),Mirror=acequire(\"../worker/mirror\").Mirror,lint=acequire(\"./javascript/jshint\").JSHINT,disabledWarningsRe=startRegex([\"Bad for in variable '(.+)'.\",'Missing \"use strict\"']),errorsRe=startRegex([\"Unexpected\",\"Expected \",\"Confusing (plus|minus)\",\"\\\\{a\\\\} unterminated regular expression\",\"Unclosed \",\"Unmatched \",\"Unbegun comment\",\"Bad invocation\",\"Missing space after\",\"Missing operator at\"]),infoRe=startRegex([\"Expected an assignment\",\"Bad escapement of EOL\",\"Unexpected comma\",\"Unexpected space\",\"Missing radix parameter.\",\"A leading decimal point can\",\"\\\\['{a}'\\\\] is better written in dot notation.\",\"'{a}' used out of scope\"]),JavaScriptWorker=exports.JavaScriptWorker=function(sender){Mirror.call(this,sender),this.setTimeout(500),this.setOptions()};oop.inherits(JavaScriptWorker,Mirror),function(){this.setOptions=function(options){this.options=options||{esnext:!0,moz:!0,devel:!0,browser:!0,node:!0,laxcomma:!0,laxbreak:!0,lastsemic:!0,onevar:!1,passfail:!1,maxerr:100,expr:!0,multistr:!0,globalstrict:!0},this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.changeOptions=function(newOptions){oop.mixin(this.options,newOptions),this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.isValidJS=function(str){try{eval(\"throw 0;\"+str)}catch(e){if(0===e)return!0}return!1},this.onUpdate=function(){var value=this.doc.getValue();if(value=value.replace(/^#!.*\\n/,\"\\n\"),!value)return this.sender.emit(\"annotate\",[]);var errors=[],maxErrorLevel=this.isValidJS(value)?\"warning\":\"error\";lint(value,this.options,this.options.globals);for(var results=lint.errors,errorAdded=!1,i=0;results.length>i;i++){var error=results[i];if(error){var raw=error.raw,type=\"warning\";if(\"Missing semicolon.\"==raw){var str=error.evidence.substr(error.character);str=str.charAt(str.search(/\\S/)),\"error\"==maxErrorLevel&&str&&/[\\w\\d{(['\"]/.test(str)?(error.reason='Missing \";\" before statement',type=\"error\"):type=\"info\"}else{if(disabledWarningsRe.test(raw))continue;infoRe.test(raw)?type=\"info\":errorsRe.test(raw)?(errorAdded=!0,type=maxErrorLevel):\"'{a}' is not defined.\"==raw?type=\"warning\":\"'{a}' is defined but never used.\"==raw&&(type=\"info\")}errors.push({row:error.line-1,column:error.character-1,text:error.reason,type:type,raw:raw})}}this.sender.emit(\"annotate\",errors)}}.call(JavaScriptWorker.prototype)}),ace.define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(){function Empty(){}function doesDefinePropertyWork(object){try{return Object.defineProperty(object,\"sentinel\",{}),\"sentinel\"in object}catch(exception){}}function toInteger(n){return n=+n,n!==n?n=0:0!==n&&n!==1/0&&n!==-(1/0)&&(n=(n>0||-1)*Math.floor(Math.abs(n))),n}Function.prototype.bind||(Function.prototype.bind=function(that){var target=this;if(\"function\"!=typeof target)throw new TypeError(\"Function.prototype.bind called on incompatible \"+target);var args=slice.call(arguments,1),bound=function(){if(this instanceof bound){var result=target.apply(this,args.concat(slice.call(arguments)));return Object(result)===result?result:this}return target.apply(that,args.concat(slice.call(arguments)))};return target.prototype&&(Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null),bound});var defineGetter,defineSetter,lookupGetter,lookupSetter,supportsAccessors,call=Function.prototype.call,prototypeOfArray=Array.prototype,prototypeOfObject=Object.prototype,slice=prototypeOfArray.slice,_toString=call.bind(prototypeOfObject.toString),owns=call.bind(prototypeOfObject.hasOwnProperty);if((supportsAccessors=owns(prototypeOfObject,\"__defineGetter__\"))&&(defineGetter=call.bind(prototypeOfObject.__defineGetter__),defineSetter=call.bind(prototypeOfObject.__defineSetter__),lookupGetter=call.bind(prototypeOfObject.__lookupGetter__),lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function makeArray(l){var a=Array(l+2);return a[0]=a[1]=0,a}var lengthBefore,array=[];return array.splice.apply(array,makeArray(20)),array.splice.apply(array,makeArray(26)),lengthBefore=array.length,array.splice(5,0,\"XXX\"),lengthBefore+1==array.length,lengthBefore+1==array.length?!0:void 0}()){var array_splice=Array.prototype.splice;Array.prototype.splice=function(start,deleteCount){return arguments.length?array_splice.apply(this,[void 0===start?0:start,void 0===deleteCount?this.length-start:deleteCount].concat(slice.call(arguments,2))):[]}}else Array.prototype.splice=function(pos,removeCount){var length=this.length;pos>0?pos>length&&(pos=length):void 0==pos?pos=0:0>pos&&(pos=Math.max(length+pos,0)),length>pos+removeCount||(removeCount=length-pos);var removed=this.slice(pos,pos+removeCount),insert=slice.call(arguments,2),add=insert.length;if(pos===length)add&&this.push.apply(this,insert);else{var remove=Math.min(removeCount,length-pos),tailOldPos=pos+remove,tailNewPos=tailOldPos+add-remove,tailCount=length-tailOldPos,lengthAfterRemove=length-remove;if(tailOldPos>tailNewPos)for(var i=0;tailCount>i;++i)this[tailNewPos+i]=this[tailOldPos+i];else if(tailNewPos>tailOldPos)for(i=tailCount;i--;)this[tailNewPos+i]=this[tailOldPos+i];if(add&&pos===lengthAfterRemove)this.length=lengthAfterRemove,this.push.apply(this,insert);else for(this.length=lengthAfterRemove+add,i=0;add>i;++i)this[pos+i]=insert[i]}return removed};Array.isArray||(Array.isArray=function(obj){return\"[object Array]\"==_toString(obj)});var boxedString=Object(\"a\"),splitString=\"a\"!=boxedString[0]||!(0 in boxedString);if(Array.prototype.forEach||(Array.prototype.forEach=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,thisp=arguments[1],i=-1,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError;for(;length>++i;)i in self&&fun.call(thisp,self[i],i,object)}),Array.prototype.map||(Array.prototype.map=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,result=Array(length),thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)i in self&&(result[i]=fun.call(thisp,self[i],i,object));return result}),Array.prototype.filter||(Array.prototype.filter=function(fun){var value,object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,result=[],thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)i in self&&(value=self[i],fun.call(thisp,value,i,object)&&result.push(value));return result}),Array.prototype.every||(Array.prototype.every=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)if(i in self&&!fun.call(thisp,self[i],i,object))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)if(i in self&&fun.call(thisp,self[i],i,object))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");if(!length&&1==arguments.length)throw new TypeError(\"reduce of empty array with no initial value\");var result,i=0;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i++];break}if(++i>=length)throw new TypeError(\"reduce of empty array with no initial value\")}for(;length>i;i++)i in self&&(result=fun.call(void 0,result,self[i],i,object));return result}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");if(!length&&1==arguments.length)throw new TypeError(\"reduceRight of empty array with no initial value\");var result,i=length-1;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i--];break}if(0>--i)throw new TypeError(\"reduceRight of empty array with no initial value\")}do i in this&&(result=fun.call(void 0,result,self[i],i,object));while(i--);return result}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(sought){var self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=0;for(arguments.length>1&&(i=toInteger(arguments[1])),i=i>=0?i:Math.max(0,length+i);length>i;i++)if(i in self&&self[i]===sought)return i;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(sought){var self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=length-1;for(arguments.length>1&&(i=Math.min(i,toInteger(arguments[1]))),i=i>=0?i:length-Math.abs(i);i>=0;i--)if(i in self&&sought===self[i])return i;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(object){return object.__proto__||(object.constructor?object.constructor.prototype:prototypeOfObject)}),!Object.getOwnPropertyDescriptor){var ERR_NON_OBJECT=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(object,property){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT+object);if(owns(object,property)){var descriptor,getter,setter;if(descriptor={enumerable:!0,configurable:!0},supportsAccessors){var prototype=object.__proto__;object.__proto__=prototypeOfObject;var getter=lookupGetter(object,property),setter=lookupSetter(object,property);if(object.__proto__=prototype,getter||setter)return getter&&(descriptor.get=getter),setter&&(descriptor.set=setter),descriptor}return descriptor.value=object[property],descriptor}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(object){return Object.keys(object)}),!Object.create){var createEmpty;createEmpty=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var empty={};for(var i in empty)empty[i]=null;return empty.constructor=empty.hasOwnProperty=empty.propertyIsEnumerable=empty.isPrototypeOf=empty.toLocaleString=empty.toString=empty.valueOf=empty.__proto__=null,empty},Object.create=function(prototype,properties){var object;if(null===prototype)object=createEmpty();else{if(\"object\"!=typeof prototype)throw new TypeError(\"typeof prototype[\"+typeof prototype+\"] != 'object'\");var Type=function(){};Type.prototype=prototype,object=new Type,object.__proto__=prototype}return void 0!==properties&&Object.defineProperties(object,properties),object}}if(Object.defineProperty){var definePropertyWorksOnObject=doesDefinePropertyWork({}),definePropertyWorksOnDom=\"undefined\"==typeof document||doesDefinePropertyWork(document.createElement(\"div\"));if(!definePropertyWorksOnObject||!definePropertyWorksOnDom)var definePropertyFallback=Object.defineProperty}if(!Object.defineProperty||definePropertyFallback){var ERR_NON_OBJECT_DESCRIPTOR=\"Property description must be an object: \",ERR_NON_OBJECT_TARGET=\"Object.defineProperty called on non-object: \",ERR_ACCESSORS_NOT_SUPPORTED=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(object,property,descriptor){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT_TARGET+object);if(\"object\"!=typeof descriptor&&\"function\"!=typeof descriptor||null===descriptor)throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR+descriptor);if(definePropertyFallback)try{return definePropertyFallback.call(Object,object,property,descriptor)}catch(exception){}if(owns(descriptor,\"value\"))if(supportsAccessors&&(lookupGetter(object,property)||lookupSetter(object,property))){var prototype=object.__proto__;object.__proto__=prototypeOfObject,delete object[property],object[property]=descriptor.value,object.__proto__=prototype}else object[property]=descriptor.value;else{if(!supportsAccessors)throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);owns(descriptor,\"get\")&&defineGetter(object,property,descriptor.get),owns(descriptor,\"set\")&&defineSetter(object,property,descriptor.set)}return object}}Object.defineProperties||(Object.defineProperties=function(object,properties){for(var property in properties)owns(properties,property)&&Object.defineProperty(object,property,properties[property]);return object}),Object.seal||(Object.seal=function(object){return object}),Object.freeze||(Object.freeze=function(object){return object});try{Object.freeze(function(){})}catch(exception){Object.freeze=function(freezeObject){return function(object){return\"function\"==typeof object?object:freezeObject(object)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(object){return object}),Object.isSealed||(Object.isSealed=function(){return!1}),Object.isFrozen||(Object.isFrozen=function(){return!1}),Object.isExtensible||(Object.isExtensible=function(object){if(Object(object)===object)throw new TypeError;for(var name=\"\";owns(object,name);)name+=\"?\";object[name]=!0;var returnValue=owns(object,name);return delete object[name],returnValue}),!Object.keys){var hasDontEnumBug=!0,dontEnums=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],dontEnumsLength=dontEnums.length;for(var key in{toString:null})hasDontEnumBug=!1;Object.keys=function(object){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(\"Object.keys called on a non-object\");var keys=[];for(var name in object)owns(object,name)&&keys.push(name);if(hasDontEnumBug)for(var i=0,ii=dontEnumsLength;ii>i;i++){var dontEnum=dontEnums[i];owns(object,dontEnum)&&keys.push(dontEnum)}return keys}}Date.now||(Date.now=function(){return(new Date).getTime()});var ws=\"\t\\n\u000b\\f\\r \\u2028\\u2029\";if(!String.prototype.trim||ws.trim()){ws=\"[\"+ws+\"]\";var trimBeginRegexp=RegExp(\"^\"+ws+ws+\"*\"),trimEndRegexp=RegExp(ws+ws+\"*$\");String.prototype.trim=function(){return(this+\"\").replace(trimBeginRegexp,\"\").replace(trimEndRegexp,\"\")}}var toObject=function(o){if(null==o)throw new TypeError(\"can't convert \"+o+\" to object\");return Object(o)}});";
/***/ }),
-/* 47 */
+/* 46 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */
@@ -53194,22 +53364,21 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */
/***/ }),
-/* 48 */
+/* 47 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return checkIfConnectedToDarkweb; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return executeDarkwebTerminalCommand; });
-/* unused harmony export listAllDarkwebItems */
-/* unused harmony export buyDarkwebItem */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return parseDarkwebItemPrice; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DarkWebItems; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__ = __webpack_require__(17);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__ = __webpack_require__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Terminal_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(20);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return redPillFlag; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hackWorldDaemon; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(36);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(37);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Terminal_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__ = __webpack_require__(15);
@@ -53219,428 +53388,328 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */
-/* DarkWeb.js */
-//Posts a "help" message if connected to DarkWeb
-function checkIfConnectedToDarkweb() {
- if (__WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) {
- var darkwebIp = __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"];
- if (!Object(__WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__["c" /* isValidIPAddress */])(darkwebIp)) {return;}
- if (darkwebIp == __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getCurrentServer().ip) {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You are now connected to the dark web. From the dark web you can purchase illegal items. " +
- "Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] " +
- "to purchase an item");
- }
- }
+
+/* RedPill.js
+ * Implements what happens when you have Red Pill augmentation and then hack the world daemon */
+
+//Returns promise
+function writeRedPillLine(line) {
+ return new Promise(function(resolve, reject) {
+
+ var container = document.getElementById("red-pill-container");
+ var pElem = document.createElement("p");
+ container.appendChild(pElem);
+
+ var promise = writeRedPillLetter(pElem, line, 0);
+ promise.then(function(res) {
+ resolve(res);
+ }, function(e) {
+ reject(e);
+ });
+ });
}
-//Handler for dark web commands. The terminal's executeCommand() function will pass
-//dark web-specific commands into this. It will pass in the raw split command array
-//rather than the command string
-function executeDarkwebTerminalCommand(commandArray) {
- if (commandArray.length == 0) {return;}
- switch (commandArray[0]) {
- case "buy":
- if (commandArray.length != 2) {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Incorrect number of arguments. Usage: ");
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy -l");
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy [item name]");
- return;
- }
- var arg = commandArray[1];
- if (arg == "-l") {
- listAllDarkwebItems();
- } else {
- buyDarkwebItem(arg);
- }
- break;
- default:
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Command not found");
- break;
- }
-}
-
-function listAllDarkwebItems() {
- for (var item in DarkWebItems) {
- if (DarkWebItems.hasOwnProperty(item)) {
- var item = DarkWebItems[item];
- //Convert string using toLocaleString
- var split = item.split(" - ");
- if (split.length == 3 && split[1].charAt(0) == '$') {
- split[1] = split[1].slice(1);
- split[1] = split[1].replace(/,/g, '');
- var price = parseFloat(split[1]);
- if (isNaN(price)) {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item);
- return;
- }
- price = Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(price, 0);
- split[1] = "$" + price.toString();
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(split.join(" - "));
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item);
- }
- }
- }
-
- var priceString = split[1];
- //Check for errors
- if (priceString.length == 0 || priceString.charAt(0) != '$') {
- return -1;
- }
- //Remove dollar sign and commas
- priceString = priceString.slice(1);
- priceString = priceString.replace(/,/g, '');
-
- //Convert string to numeric
- var price = parseFloat(priceString);
- if (isNaN(price)) {return -1;}
- else {return price;}
-}
-
-function buyDarkwebItem(itemName) {
- if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.BruteSSHProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the BruteSSH.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.FTPCrackProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the FTPCrack.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.RelaySMTPProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the relaySMTP.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.HTTPWormProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the HTTPWorm.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.SQLInjectProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the SQLInject.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV1Program);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV1.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV2Program);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV2.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Unrecognized item");
- }
-}
-
-function parseDarkwebItemPrice(itemDesc) {
- var split = itemDesc.split(" - ");
- if (split.length == 3) {
- var priceString = split[1];
- //Check for errors
- if (priceString.length == 0 || priceString.charAt(0) != '$') {
- return -1;
- }
- //Remove dollar sign and commas
- priceString = priceString.slice(1);
- priceString = priceString.replace(/,/g, '');
-
- //Convert string to numeric
- var price = parseFloat(priceString);
- if (isNaN(price)) {return -1;}
- else {return price;}
- } else {
- return -1;
- }
-}
-
-let DarkWebItems = {
- BruteSSHProgram: "BruteSSH.exe - $500,000 - Opens up SSH Ports",
- FTPCrackProgram: "FTPCrack.exe - $1,500,000 - Opens up FTP Ports",
- RelaySMTPProgram: "relaySMTP.exe - $5,000,000 - Opens up SMTP Ports",
- HTTPWormProgram: "HTTPWorm.exe - $30,000,000 - Opens up HTTP Ports",
- SQLInjectProgram: "SQLInject.exe - $250,000,000 - Opens up SQL Ports",
- DeepScanV1Program: "DeepscanV1.exe - $500,000 - Enables 'scan-analyze' with a depth up to 5",
- DeepScanV2Program: "DeepscanV2.exe - $25,000,000 - Enables 'scan-analyze' with a depth up to 10",
-}
-
-
-
-
-/***/ }),
-/* 49 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Aliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return GlobalAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return printAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return parseAliasDeclaration; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return removeAlias; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return substituteAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return loadAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return loadGlobalAliases; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Terminal_js__ = __webpack_require__(19);
-
-
-let Aliases = {};
-let GlobalAliases = {};
-
-function loadAliases(saveString) {
- if (saveString === "") {
- Aliases = {};
- } else {
- Aliases = JSON.parse(saveString);
- }
-}
-
-function loadGlobalAliases(saveString) {
- if (saveString === "") {
- GlobalAliases = {};
- } else {
- GlobalAliases = JSON.parse(saveString);
- }
-}
-
-//Print all aliases to terminal
-function printAliases() {
- for (var name in Aliases) {
- if (Aliases.hasOwnProperty(name)) {
- Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("alias " + name + "=" + Aliases[name]);
- }
- }
- for (var name in GlobalAliases) {
- if (GlobalAliases.hasOwnProperty(name)) {
- Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("global alias " + name + "=" + GlobalAliases[name]);
- }
- }
-}
-
-//True if successful, false otherwise
-function parseAliasDeclaration(dec,global=false) {
- var re = /^([_|\w|!|%|,|@]+)="(.+)"$/;
- var matches = dec.match(re);
- if (matches == null || matches.length != 3) {return false;}
- if (global){
- addGlobalAlias(matches[1],matches[2]);
- } else {
- addAlias(matches[1], matches[2]);
- }
- return true;
-}
-
-function addAlias(name, value) {
- if (name in GlobalAliases){
- delete GlobalAliases[name];
- }
- Aliases[name] = value;
-}
-
-function addGlobalAlias(name, value) {
- if (name in Aliases){
- delete Aliases[name];
- }
- GlobalAliases[name] = value;
-}
-
-function getAlias(name) {
- if (Aliases.hasOwnProperty(name)) {
- return Aliases[name];
- }
- return null;
-}
-
-function getGlobalAlias(name) {
- if (GlobalAliases.hasOwnProperty(name)) {
- return GlobalAliases[name];
- }
- return null;
-}
-
-function removeAlias(name) {
- if (Aliases.hasOwnProperty(name)) {
- delete Aliases[name];
- return true;
- }
- if (GlobalAliases.hasOwnProperty(name)) {
- delete GlobalAliases[name];
- return true;
- }
- return false;
-}
-
-//Returns the original string with any aliases substituted in
-//Aliases only applied to "whole words", one level deep
-function substituteAliases(origCommand) {
- var commandArray = origCommand.split(" ");
- if (commandArray.length>0){
- var alias = getAlias(commandArray[0]);
- if (alias != null) {
- commandArray[0] = alias;
- } else {
- var alias = getGlobalAlias(commandArray[0]);
- if (alias != null) {
- commandArray[0] = alias;
- }
- }
- for (var i = 0; i < commandArray.length; ++i) {
- var alias = getGlobalAlias(commandArray[i]);
- if (alias != null) {
- commandArray[i] = alias;
- }
- }
- }
- return commandArray.join(" ");
-}
-
-
-
-
-/***/ }),
-/* 50 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextFile; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getTextFile; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return createTextFile; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_JSONReviver_js__ = __webpack_require__(8);
-
-
-
-
-function TextFile(fn="", txt="") {
- this.fn = fn.endsWith(".txt") ? fn : fn + ".txt";
- this.fn = this.fn.replace(/\s+/g, '');
- this.text = String(txt);
-}
-
-TextFile.prototype.append = function(txt) {
- this.text += String(txt);
-}
-
-TextFile.prototype.write = function(txt) {
- this.text = String(txt);
-}
-
-TextFile.prototype.read = function() {
- return this.txt;
-}
-
-TextFile.prototype.show = function() {
- Object(__WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__["a" /* dialogBoxCreate */])(this.fn + "
" + this.text, true);
-}
-
-TextFile.prototype.download = function() {
- var filename = this.fn;
- var file = new Blob([this.text], {type: 'text/plain'});
- if (window.navigator.msSaveOrOpenBlob) {// IE10+
- window.navigator.msSaveOrOpenBlob(file, filename);
- } else { // Others
- var a = document.createElement("a"),
- url = URL.createObjectURL(file);
- a.href = url;
- a.download = this.fn;
- document.body.appendChild(a);
- a.click();
+function writeRedPillLetter(pElem, line, i=0) {
+ return new Promise(function(resolve, reject) {
setTimeout(function() {
- document.body.removeChild(a);
- window.URL.revokeObjectURL(url);
- }, 0);
- }
+ if (i >= line.length) {
+ var textToShow = line.substring(0, i);
+ pElem.innerHTML = "> " + textToShow;
+ return resolve(true);
+ }
+ var textToShow = line.substring(0, i);
+ pElem.innerHTML = "> " + textToShow + " █ ";
+ var promise = writeRedPillLetter(pElem, line, i+1);
+ promise.then(function(res) {
+ resolve(res);
+ }, function(e) {
+ reject(e);
+ });
+ }, 30);
+ });
}
-TextFile.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_2__utils_JSONReviver_js__["b" /* Generic_toJSON */])("TextFile", this);
+let redPillFlag = false;
+function hackWorldDaemon(currentNodeNumber, flume=false) {
+ redPillFlag = true;
+ __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadRedPillContent();
+ return writeRedPillLine("[ERROR] SEMPOOL INVALID").then(function() {
+ return writeRedPillLine("[ERROR] Segmentation Fault");
+ }).then(function() {
+ return writeRedPillLine("[ERROR] SIGKILL RECVD");
+ }).then(function() {
+ return writeRedPillLine("Dumping core...");
+ }).then(function() {
+ return writeRedPillLine("0000 000016FA 174FEE40 29AC8239 384FEA88");
+ }).then(function() {
+ return writeRedPillLine("0010 745F696E 2BBBE394 390E3940 248BEC23");
+ }).then(function() {
+ return writeRedPillLine("0020 7124696B 0000FF69 74652E6F FFFF1111");
+ }).then(function() {
+ return writeRedPillLine("----------------------------------------");
+ }).then(function() {
+ return writeRedPillLine("Failsafe initiated...");
+ }).then(function() {
+ return writeRedPillLine("Restarting BitNode-" + currentNodeNumber + "...");
+ }).then(function() {
+ return writeRedPillLine("...........");
+ }).then(function() {
+ return writeRedPillLine("...........");
+ }).then(function() {
+ return writeRedPillLine("[ERROR] FAILED TO AUTOMATICALLY REBOOT BITNODE");
+ }).then(function() {
+ return writeRedPillLine("..............................................")
+ }).then(function() {
+ return writeRedPillLine("..............................................")
+ }).then(function() {
+ return loadBitVerse(currentNodeNumber, flume);
+ }).catch(function(e){
+ console.log("ERROR: " + e.toString());
+ });
}
-TextFile.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_2__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(TextFile, value.data);
-}
-
-__WEBPACK_IMPORTED_MODULE_2__utils_JSONReviver_js__["c" /* Reviver */].constructors.TextFile = TextFile;
-
-function getTextFile(fn, server) {
- if (!fn.endsWith(".txt")) {fn += ".txt";}
- for (var i = 0; i < server.textFiles.length; ++i) {
- if (server.textFiles[i].fn === fn) {
- return server.textFiles[i];
- }
- }
- return null;
-}
-
-//Returns the TextFile object that was just created
-function createTextFile(fn, txt, server) {
- if (getTextFile(fn, server) !== null) {
- console.log("ERROR: createTextFile failed because the specified " +
- "server already has a text file with the same fn");
+//The bitNode name passed in will have a hyphen between number (e.g. BitNode-1)
+//This needs to be removed
+function giveSourceFile(bitNodeNumber) {
+ var sourceFileKey = "SourceFile"+ bitNodeNumber.toString();
+ var sourceFile = __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["b" /* SourceFiles */][sourceFileKey];
+ if (sourceFile == null) {
+ console.log("ERROR: could not find source file for Bit node: " + bitNodeNumber);
return;
}
- var file = new TextFile(fn, txt);
- server.textFiles.push(file);
- return file;
-}
-function deleteTextFile(fn, server) {
- if (!fn.endsWith(".txt")) {fn += ".txt";}
- for (var i = 0; i < server.textFiles.length; ++i) {
- if (server.textFiles[i].fn === fn) {
- server.textFiles.splice(i, 1);
- return true;
+ //Check if player already has this source file
+ var alreadyOwned = false;
+ var ownedSourceFile = null;
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
+ if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i].n === bitNodeNumber) {
+ alreadyOwned = true;
+ ownedSourceFile = __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i];
+ break;
}
}
- return false;
+
+ if (alreadyOwned && ownedSourceFile) {
+ if (ownedSourceFile.lvl >= 3) {
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("The Source-File for the BitNode you just destroyed, " + sourceFile.name + ", " +
+ "is already at max level!");
+ } else {
+ ++ownedSourceFile.lvl;
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])(sourceFile.name + " was upgraded to level " + ownedSourceFile.lvl + " for " +
+ "destroying its corresponding BitNode!");
+ }
+ } else {
+ var playerSrcFile = new __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["a" /* PlayerOwnedSourceFile */](bitNodeNumber, 1);
+ __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.push(playerSrcFile);
+ if (bitNodeNumber === 5) { //Artificial Intelligence
+ __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence = 1;
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You received a Source-File for destroying a Bit Node!
" +
- 'alias [-g] [name="value"] Create or display Terminal aliases ' +
- "analyze Get information about the current machine " +
- "buy [-l/program] Purchase a program through the Dark Web " +
- "cat [file] Display a .msg, .lit, or .txt file " +
- "check [script] [args...] Print a script's logs to Terminal " +
- "clear Clear all text on the terminal " +
- "cls See 'clear' command " +
- "connect [ip/hostname] Connects to a remote server " +
- "download [script/text file] Downloads a script or text file to your computer " +
- "free Check the machine's memory (RAM) usage " +
- "hack Hack the current machine " +
- "help [command] Display this help text, or the help text for a command " +
- "home Connect to home computer " +
- "hostname Displays the hostname of the machine " +
- "ifconfig Displays the IP address of the machine " +
- "kill [script] [args...] Stops the specified script on the current server " +
- "killall Stops all running scripts on the current machine " +
- "ls [| grep pattern] Displays all files on the machine " +
- "lscpu Displays the number of CPU cores on the machine " +
- "mem [script] [-t] [n] Displays the amount of RAM required to run the script " +
- "nano [script] Script editor - Open up and edit a script " +
- "ps Display all scripts that are currently running " +
- "rm [file] Delete a file from the server " +
- "run [name] [-t] [n] [args...] Execute a program or script " +
- "scan Prints all immediately-available network connections " +
- "scan-analyze [d] [-a] Prints info for all servers up to d nodes away " +
- "scp [file] [server] Copies a file to a destination server " +
- "sudov Shows whether you have root access on this computer " +
- "tail [script] [args...] Displays dynamic logs for the specified script " +
- "theme [preset] | bg txt hlgt Change the color scheme of the UI " +
- "top Displays all running scripts and their RAM usage " +
- 'unalias "[alias name]" Deletes the specified alias ';
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return checkIfConnectedToDarkweb; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return executeDarkwebTerminalCommand; });
+/* unused harmony export listAllDarkwebItems */
+/* unused harmony export buyDarkwebItem */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return parseDarkwebItemPrice; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DarkWebItems; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__ = __webpack_require__(17);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Terminal_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-let HelpTexts = {
- alias: 'alias [-g] [name="value"] ' +
- "Create or display aliases. An alias enables a replacement of a word with another string. " +
- "It can be used to abbreviate a commonly used command, or commonly used parts of a command. The NAME " +
- "of an alias defines the word that will be replaced, while the VALUE defines what it will be replaced by. For example, " +
- "you could create the alias 'nuke' for the Terminal command 'run NUKE.exe' using the following:
" +
- 'alias nuke="run NUKE.exe"
' +
- "Then, to run the NUKE.exe program you would just have to enter 'nuke' in Terminal rather than the full command. " +
- "It is important to note that 'default' aliases will only be substituted for the first word of a Terminal command. For " +
- "example, if the following alias was set:
" +
- 'alias worm="HTTPWorm.exe"
' +
- "and then you tried to run the following terminal command:
" +
- "run worm
" +
- "This would fail because the worm alias is not the first word of a Terminal command. To allow an alias to be substituted " +
- "anywhere in a Terminal command, rather than just the first word, you must set it to be a global alias using the -g flag:
" +
- 'alias -g worm="HTTPWorm.exe"
' +
- "Now, the 'worm' alias will be substituted anytime it shows up as an individual word in a Terminal command.
" +
- "Entering just the command 'alias' without any arguments prints the list of all defined aliases in the reusable form " +
- "'alias NAME=VALUE' on the Terminal.
" +
- "The 'unalias' command can be used to remove aliases.
",
- analyze: "analze " +
- "Prints details and statistics about the current server. The information that is printed includes basic " +
- "server details such as the hostname, whether the player has root access, what ports are opened/closed, and also " +
- "hacking-related information such as an estimated chance to successfully hack, an estimate of how much money is " +
- "available on the server, etc.",
- buy: "buy [-l / program] " +
- "Purchase a program through the Dark Web. Requires a TOR router to use.
" +
- "If this command is ran with the '-l' flag, it will display a list of all programs that can be bought through the " +
- "dark web to the Terminal, as well as their costs.
" +
- "Otherwise, the name of the program must be passed in as a parameter. This is name is NOT case-sensitive.",
- cat: "cat [file] " +
- "Display message (.msg), literature (.lit), or text (.txt) files. Examples:
" +
- "cat j1.msg " +
- "cat foo.lit " +
- "cat servers.txt",
- check: "check [script name] [args...] " +
- "Print the logs of the script specified by the script name and arguments to the Terminal. Each argument must be separated by " +
- "a space. Remember that a running script is uniquely " +
- "identified both by its name and the arguments that are used to start it. So, if a script was ran with the following arguments:
" +
- "run foo.script 1 2 foodnstuff
" +
- "Then to run the 'check' command on this script you would have to pass the same arguments in:
" +
- "check foo.script 1 2 foodnstuff",
- clear: "clear " +
- "Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up " +
- "and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'cls' command",
- cls: "cls " +
- "Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up " +
- "and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'clear' command",
- connect: "connect [hostname/ip] " +
- "Connect to a remote server. The hostname or IP address of the remote server must be given as the argument " +
- "to this command. Note that only servers that are immediately adjacent to the current server in the network can be connected to. To " +
- "see which servers can be connected to, use the 'scan' command.",
- download: "download [script/text file] " +
- "Downloads a script or text file to your computer (like your real life computer).",
- free: "free " +
- "Display's the memory usage on the current machine. Print the amount of RAM that is available on the current server as well as " +
- "how much of it is being used.",
- hack: "hack " +
- "Attempt to hack the current server. Requires root access in order to be run. See the wiki page for hacking mechanics ",
- help: "help [command] " +
- "Display Terminal help information. Without arguments, 'help' prints a list of all valid Terminal commands and a brief " +
- "description of their functionality. You can also pass the name of a Terminal command as an argument to 'help' to print " +
- "more detailed information about the Terminal command. Examples:
" +
- "help alias " +
- "help scan-analyze",
- home: "home " +
- "Connect to your home computer. This will work no matter what server you are currently connected to.",
- hostname: "hostname " +
- "Prints the hostname of the current server",
- ifconfig: "ipconfig " +
- "Prints the IP address of the current server",
- kill: "kill [script name] [args...] " +
- "Kill the script specified by the script name and arguments. Each argument must be separated by " +
- "a space. Remember that a running script is uniquely identified by " +
- "both its name and the arguments that are used to start it. So, if a script was ran with the following arguments:
" +
- "run foo.script 1 sigma-cosmetics
" +
- "Then to kill this script the same arguments would have to be used:
" +
- "kill foo.script 1 sigma-cosmetics
" +
- "Note that after issuing the 'kill' command for a script, it may take a while for the script to actually stop running. " +
- "This will happen if the script is in the middle of a command such as grow() or weaken() that takes time to execute. " +
- "The script will not be stopped/killed until after that time has elapsed.",
- killall: "killall " +
- "Kills all scripts on the current server. " +
- "Note that after the 'kill' command is issued for a script, it may take a while for the script to actually stop running. " +
- "This will happen if the script is in the middle of a command such as grow() or weaken() that takes time to execute. " +
- "The script will not be stopped/killed until after that time has elapsed.",
- ls: "ls [| grep pattern] " +
- "The ls command, with no arguments, prints all files on the current server to the Terminal screen. " +
- "This includes all scripts, programs, and message files. " +
- "The files will be displayed in alphabetical order.
" +
- "The '| grep pattern' optional parameter can be used to only display files whose filenames match the specified pattern. " +
- "For example, if you wanted to only display files with the .script extension, you could use:
" +
- "ls | grep .script
" +
- "Alternatively, if you wanted to display all files with the word purchase in the filename, you could use:
" +
- "ls | grep purchase",
- mem: "mem [script name] [-t] [num threads] " +
- "Displays the amount of RAM needed to run the specified script with a single thread. The command can also be used to print " +
- "the amount of RAM needed to run a script with multiple threads using the '-t' flag. If the '-t' flag is specified, then " +
- "an argument for the number of threads must be passed in afterwards. Examples:
" +
- "mem foo.script " +
- "mem foo.script -t 50 " +
- "The first example above will print the amount of RAM needed to run 'foo.script' with a single thread. The second example " +
- "above will print the amount of RAM needed to run 'foo.script' with 50 threads.",
- nano: "nano [script name] " +
- "Opens up the specified script in the Script Editor. If the script does not already exist, then a new, empty script " +
- "will be created",
- ps: "ps " +
- "Prints all scripts that are running on the current server",
- rm: "rm [file] " +
- "Removes the specified file from the current server. A file can be a script, a program, or a message file.
" +
- "WARNING: This is permanent and cannot be undone",
- run: "run [file name] [-t] [num threads] [args...] " +
- "Execute a program or a script.
" +
- "The '[-t]', '[num threads]', and '[args...]' arguments are only valid when running a script. The '-t' flag is used " +
- "to indicate that the script should be run with the specified number of threads. If the flag is omitted, " +
- "then the script will be run with a single thread by default. " +
- "If the '-t' flag is used, then it MUST come immediately " +
- "after the script name, and the [num threads] argument MUST come immediately afterwards.
" +
- "[args...] represents a variable number of arguments that will be passed into the script. See the documentation " +
- "about script arguments. Each specified argument must be separated by a space.
",
- scan: "scan " +
- "Prints all immediately-available network connection. This will print a list of all servers that you can currently connect " +
- "to using the 'connect' Terminal command.",
- "scan-analyze": "scan-analyze [depth] [-a] " +
- "Prints detailed information about all servers up to [depth] nodes away on the network. Calling " +
- "'scan-analyze 1' will display information for the same servers that are shown by the 'scan' Terminal " +
- "command. This command also shows the relative paths to reach each server.
" +
- "By default, the maximum depth that can be specified for 'scan-analyze' is 3. However, once you have " +
- "the DeepscanV1.exe and DeepscanV2.exe programs, you can execute 'scan-analyze' with a depth up to " +
- "5 and 10, respectively.
" +
- "The information 'scan-analyze' displays about each server includes whether or not you have root access to it, " +
- "its required hacking level, the number of open ports required to run NUKE.exe on it, and how much RAM " +
- "it has.
" +
- "By default, this command will not display servers that you have purchased. However, you can pass in the " +
- "-a flag at the end of the command if you would like to enable that.",
- scp: "scp [filename] [target server] " +
- "Copies the specified file from the current server to the target server. " +
- "This command only works for script files (.script extension), literature files (.lit extension), " +
- "and text files (.txt extension). " +
- "The second argument passed in must be the hostname or IP of the target server.",
- sudov: "sudov " +
- "Prints whether or not you have root access to the current machine",
- tail: "tail [script name] [args...] " +
- "Displays dynamic logs for the script specified by the script name and arguments. Each argument must be separated " +
- "by a space. Remember that a running script is uniquely identified by both its name and the arguments that were used " +
- "to run it. So, if a script was ran with the following arguments:
" +
- "run foo.script 10 50000
" +
- "Then in order to check its logs with 'tail' the same arguments must be used:
" +
- "tail foo.script 10 50000",
- theme: "theme [preset] | [#background #text #highlight] " +
- "Change the color of the game's user interface
" +
- "This command can be called with a preset theme. Currently, the supported presets are 'default', 'muted', and 'solarized'. " +
- "However, you can also specify your own color scheme using hex values. To do so, you must specify three hex color values " +
- "for the background color, the text color, and the highlight color. These hex values must be preceded by a pound sign (#) and " +
- "must be either 3 or 6 digits. Example:
" +
- "theme #ffffff #385 #235012
" +
- "A color picker such as " +
- "Google's " +
- "can be used to get your desired hex color values
" +
- "Themes are not saved, so when the game is closed and then re-opened or reloaded then it will revert back to the default theme.",
- top: "top " +
- "Prints a list of all scripts running on the current server as well as their thread count and how much " +
- "RAM they are using in total.",
- unalias: 'unalias "[alias name]" ' +
- "Deletes the specified alias. Note that the double quotation marks are required.
" +
- "As an example, if an alias was declared using:
" +
- 'alias r="run"
' +
- "Then it could be removed using:
" +
- 'unalias "r"
' +
- "It is not necessary to differentiate between global and non-global aliases when using 'unalias'",
+
+
+
+
+
+
+
+/* DarkWeb.js */
+//Posts a "help" message if connected to DarkWeb
+function checkIfConnectedToDarkweb() {
+ if (__WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) {
+ var darkwebIp = __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"];
+ if (!Object(__WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__["c" /* isValidIPAddress */])(darkwebIp)) {return;}
+ if (darkwebIp == __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getCurrentServer().ip) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You are now connected to the dark web. From the dark web you can purchase illegal items. " +
+ "Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] " +
+ "to purchase an item");
+ }
+ }
+
+}
+
+//Handler for dark web commands. The terminal's executeCommand() function will pass
+//dark web-specific commands into this. It will pass in the raw split command array
+//rather than the command string
+function executeDarkwebTerminalCommand(commandArray) {
+ if (commandArray.length == 0) {return;}
+ switch (commandArray[0]) {
+ case "buy":
+ if (commandArray.length != 2) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Incorrect number of arguments. Usage: ");
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy -l");
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy [item name]");
+ return;
+ }
+ var arg = commandArray[1];
+ if (arg == "-l") {
+ listAllDarkwebItems();
+ } else {
+ buyDarkwebItem(arg);
+ }
+ break;
+ default:
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Command not found");
+ break;
+ }
+}
+
+function listAllDarkwebItems() {
+ for (var item in DarkWebItems) {
+ if (DarkWebItems.hasOwnProperty(item)) {
+ var item = DarkWebItems[item];
+ //Convert string using toLocaleString
+ var split = item.split(" - ");
+ if (split.length == 3 && split[1].charAt(0) == '$') {
+ split[1] = split[1].slice(1);
+ split[1] = split[1].replace(/,/g, '');
+ var price = parseFloat(split[1]);
+ if (isNaN(price)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item);
+ return;
+ }
+ price = Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(price, 0);
+ split[1] = "$" + price.toString();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(split.join(" - "));
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item);
+ }
+ }
+ }
+
+ var priceString = split[1];
+ //Check for errors
+ if (priceString.length == 0 || priceString.charAt(0) != '$') {
+ return -1;
+ }
+ //Remove dollar sign and commas
+ priceString = priceString.slice(1);
+ priceString = priceString.replace(/,/g, '');
+
+ //Convert string to numeric
+ var price = parseFloat(priceString);
+ if (isNaN(price)) {return -1;}
+ else {return price;}
+}
+
+function buyDarkwebItem(itemName) {
+ if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.BruteSSHProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the BruteSSH.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.FTPCrackProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the FTPCrack.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.RelaySMTPProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the relaySMTP.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.HTTPWormProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the HTTPWorm.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.SQLInjectProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the SQLInject.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV1Program);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV1.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV2Program);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV2.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Unrecognized item");
+ }
+}
+
+function parseDarkwebItemPrice(itemDesc) {
+ var split = itemDesc.split(" - ");
+ if (split.length == 3) {
+ var priceString = split[1];
+ //Check for errors
+ if (priceString.length == 0 || priceString.charAt(0) != '$') {
+ return -1;
+ }
+ //Remove dollar sign and commas
+ priceString = priceString.slice(1);
+ priceString = priceString.replace(/,/g, '');
+
+ //Convert string to numeric
+ var price = parseFloat(priceString);
+ if (isNaN(price)) {return -1;}
+ else {return price;}
+ } else {
+ return -1;
+ }
+}
+
+let DarkWebItems = {
+ BruteSSHProgram: "BruteSSH.exe - $500,000 - Opens up SSH Ports",
+ FTPCrackProgram: "FTPCrack.exe - $1,500,000 - Opens up FTP Ports",
+ RelaySMTPProgram: "relaySMTP.exe - $5,000,000 - Opens up SMTP Ports",
+ HTTPWormProgram: "HTTPWorm.exe - $30,000,000 - Opens up HTTP Ports",
+ SQLInjectProgram: "SQLInject.exe - $250,000,000 - Opens up SQL Ports",
+ DeepScanV1Program: "DeepscanV1.exe - $500,000 - Enables 'scan-analyze' with a depth up to 5",
+ DeepScanV2Program: "DeepscanV2.exe - $25,000,000 - Enables 'scan-analyze' with a depth up to 10",
}
/***/ }),
-/* 70 */
+/* 67 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -101415,7 +101483,109 @@ let HelpTexts = {
/***/ }),
-/* 71 */
+/* 68 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextFile; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getTextFile; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return createTextFile; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_JSONReviver_js__ = __webpack_require__(8);
+
+
+
+
+function TextFile(fn="", txt="") {
+ this.fn = fn.endsWith(".txt") ? fn : fn + ".txt";
+ this.fn = this.fn.replace(/\s+/g, '');
+ this.text = String(txt);
+}
+
+TextFile.prototype.append = function(txt) {
+ this.text += String(txt);
+}
+
+TextFile.prototype.write = function(txt) {
+ this.text = String(txt);
+}
+
+TextFile.prototype.read = function() {
+ return this.txt;
+}
+
+TextFile.prototype.show = function() {
+ Object(__WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__["a" /* dialogBoxCreate */])(this.fn + "
" + this.text, true);
+}
+
+TextFile.prototype.download = function() {
+ var filename = this.fn;
+ var file = new Blob([this.text], {type: 'text/plain'});
+ if (window.navigator.msSaveOrOpenBlob) {// IE10+
+ window.navigator.msSaveOrOpenBlob(file, filename);
+ } else { // Others
+ var a = document.createElement("a"),
+ url = URL.createObjectURL(file);
+ a.href = url;
+ a.download = this.fn;
+ document.body.appendChild(a);
+ a.click();
+ setTimeout(function() {
+ document.body.removeChild(a);
+ window.URL.revokeObjectURL(url);
+ }, 0);
+ }
+}
+
+TextFile.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_2__utils_JSONReviver_js__["b" /* Generic_toJSON */])("TextFile", this);
+}
+
+TextFile.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_2__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(TextFile, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_2__utils_JSONReviver_js__["c" /* Reviver */].constructors.TextFile = TextFile;
+
+function getTextFile(fn, server) {
+ if (!fn.endsWith(".txt")) {fn += ".txt";}
+ for (var i = 0; i < server.textFiles.length; ++i) {
+ if (server.textFiles[i].fn === fn) {
+ return server.textFiles[i];
+ }
+ }
+ return null;
+}
+
+//Returns the TextFile object that was just created
+function createTextFile(fn, txt, server) {
+ if (getTextFile(fn, server) !== null) {
+ console.log("ERROR: createTextFile failed because the specified " +
+ "server already has a text file with the same fn");
+ return;
+ }
+ var file = new TextFile(fn, txt);
+ server.textFiles.push(file);
+ return file;
+}
+
+function deleteTextFile(fn, server) {
+ if (!fn.endsWith(".txt")) {fn += ".txt";}
+ for (var i = 0; i < server.textFiles.length; ++i) {
+ if (server.textFiles[i].fn === fn) {
+ server.textFiles.splice(i, 1);
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+/***/ }),
+/* 69 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process, global, setImmediate) {/* @preserve
@@ -107041,10 +107211,10 @@ module.exports = ret;
},{"./es5":13}]},{},[4])(4)
}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51), __webpack_require__(42), __webpack_require__(72).setImmediate))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(48), __webpack_require__(40), __webpack_require__(70).setImmediate))
/***/ }),
-/* 72 */
+/* 70 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {var apply = Function.prototype.apply;
@@ -107097,7 +107267,7 @@ exports._unrefActive = exports.active = function(item) {
};
// setimmediate attaches itself to the global object
-__webpack_require__(73);
+__webpack_require__(71);
// On some exotic environments, it's not clear which object `setimmeidate` was
// able to install onto. Search each possibility in the same order as the
// `setimmediate` library.
@@ -107108,10 +107278,10 @@ exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
(typeof global !== "undefined" && global.clearImmediate) ||
(this && this.clearImmediate);
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(42)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(40)))
/***/ }),
-/* 73 */
+/* 71 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
@@ -107301,10 +107471,10 @@ exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
attachTo.clearImmediate = clearImmediate;
}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(42), __webpack_require__(51)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(40), __webpack_require__(48)))
/***/ }),
-/* 74 */
+/* 72 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -107314,8 +107484,8 @@ exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Server_js__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(20);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_YesNoBox_js__ = __webpack_require__(14);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_YesNoBox_js__ = __webpack_require__(15);
@@ -107385,12 +107555,12 @@ function purchaseRamForHomeComputer(cost) {
/***/ }),
-/* 75 */
+/* 73 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return factionInvitationBoxCreate; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_Faction_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_Faction_js__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_engine_js__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__HelperFunctions_js__ = __webpack_require__(2);
@@ -107460,33 +107630,35 @@ function factionInvitationBoxCreate(faction) {
/***/ }),
-/* 76 */
+/* 74 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return saveObject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return loadGame; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(49);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(75);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Faction_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Gang_js__ = __webpack_require__(43);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__HacknetNode_js__ = __webpack_require__(29);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Message_js__ = __webpack_require__(25);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Script_js__ = __webpack_require__(18);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Settings_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__ = __webpack_require__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__StockMarket_js__ = __webpack_require__(31);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_GameOptions_js__ = __webpack_require__(44);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__ = __webpack_require__(8);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__ = __webpack_require__(24);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Faction_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Fconf_js__ = __webpack_require__(180);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Gang_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__HacknetNode_js__ = __webpack_require__(26);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(27);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Script_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Settings_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__ = __webpack_require__(30);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_GameOptions_js__ = __webpack_require__(41);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__utils_decimal_js__ = __webpack_require__(24);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_20__utils_decimal_js__);
+
@@ -107525,15 +107697,16 @@ function BitburnerSaveObject() {
this.MessagesSave = "";
this.StockMarketSave = "";
this.SettingsSave = "";
+ this.FconfSettingsSave = "";
this.VersionSave = "";
this.AllGangsSave = "";
}
BitburnerSaveObject.prototype.saveGame = function(db) {
- this.PlayerSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */]);
+ this.PlayerSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */]);
//Delete all logs from all running scripts
- var TempAllServers = JSON.parse(JSON.stringify(__WEBPACK_IMPORTED_MODULE_10__Server_js__["b" /* AllServers */]), __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ var TempAllServers = JSON.parse(JSON.stringify(__WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */]), __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
for (var ip in TempAllServers) {
var server = TempAllServers[ip];
if (server == null) {continue;}
@@ -107547,15 +107720,16 @@ BitburnerSaveObject.prototype.saveGame = function(db) {
this.AllServersSave = JSON.stringify(TempAllServers);
this.CompaniesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_1__Company_js__["a" /* Companies */]);
this.FactionsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_4__Faction_js__["b" /* Factions */]);
- this.SpecialServerIpsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["a" /* SpecialServerIps */]);
+ this.SpecialServerIpsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */]);
this.AliasesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_0__Alias_js__["a" /* Aliases */]);
this.GlobalAliasesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_0__Alias_js__["b" /* GlobalAliases */]);
- this.MessagesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_7__Message_js__["b" /* Messages */]);
- this.StockMarketSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["c" /* StockMarket */]);
- this.SettingsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_11__Settings_js__["a" /* Settings */]);
+ this.MessagesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_8__Message_js__["b" /* Messages */]);
+ this.StockMarketSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["c" /* StockMarket */]);
+ this.SettingsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_12__Settings_js__["a" /* Settings */]);
+ this.FconfSettingsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_5__Fconf_js__["a" /* FconfSettings */]);
this.VersionSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].Version);
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].inGang()) {
- this.AllGangsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_5__Gang_js__["a" /* AllGangs */]);
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].inGang()) {
+ this.AllGangsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_6__Gang_js__["a" /* AllGangs */]);
}
var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
@@ -107601,13 +107775,13 @@ function loadGame(saveString) {
console.log("Loading game from IndexedDB");
}
- var saveObj = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ var saveObj = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
- Object(__WEBPACK_IMPORTED_MODULE_8__Player_js__["b" /* loadPlayer */])(saveObj.PlayerSave);
- Object(__WEBPACK_IMPORTED_MODULE_10__Server_js__["g" /* loadAllServers */])(saveObj.AllServersSave);
+ Object(__WEBPACK_IMPORTED_MODULE_9__Player_js__["b" /* loadPlayer */])(saveObj.PlayerSave);
+ Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["g" /* loadAllServers */])(saveObj.AllServersSave);
Object(__WEBPACK_IMPORTED_MODULE_1__Company_js__["i" /* loadCompanies */])(saveObj.CompaniesSave);
Object(__WEBPACK_IMPORTED_MODULE_4__Faction_js__["i" /* loadFactions */])(saveObj.FactionsSave);
- Object(__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["d" /* loadSpecialServerIps */])(saveObj.SpecialServerIpsSave);
+ Object(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["d" /* loadSpecialServerIps */])(saveObj.SpecialServerIpsSave);
if (saveObj.hasOwnProperty("AliasesSave")) {
try {
@@ -107629,58 +107803,65 @@ function loadGame(saveString) {
}
if (saveObj.hasOwnProperty("MessagesSave")) {
try {
- Object(__WEBPACK_IMPORTED_MODULE_7__Message_js__["e" /* loadMessages */])(saveObj.MessagesSave);
+ Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["e" /* loadMessages */])(saveObj.MessagesSave);
} catch(e) {
- Object(__WEBPACK_IMPORTED_MODULE_7__Message_js__["d" /* initMessages */])();
+ Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
}
} else {
- Object(__WEBPACK_IMPORTED_MODULE_7__Message_js__["d" /* initMessages */])();
+ Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
}
if (saveObj.hasOwnProperty("StockMarketSave")) {
try {
- Object(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["j" /* loadStockMarket */])(saveObj.StockMarketSave);
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* loadStockMarket */])(saveObj.StockMarketSave);
} catch(e) {
- Object(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["j" /* loadStockMarket */])("");
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* loadStockMarket */])("");
}
} else {
- Object(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["j" /* loadStockMarket */])("");
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* loadStockMarket */])("");
}
if (saveObj.hasOwnProperty("SettingsSave")) {
try {
- Object(__WEBPACK_IMPORTED_MODULE_11__Settings_js__["c" /* loadSettings */])(saveObj.SettingsSave);
+ Object(__WEBPACK_IMPORTED_MODULE_12__Settings_js__["c" /* loadSettings */])(saveObj.SettingsSave);
} catch(e) {
console.log("ERROR: Failed to parse Settings. Re-initing default values");
- Object(__WEBPACK_IMPORTED_MODULE_11__Settings_js__["b" /* initSettings */])();
+ Object(__WEBPACK_IMPORTED_MODULE_12__Settings_js__["b" /* initSettings */])();
}
} else {
- Object(__WEBPACK_IMPORTED_MODULE_11__Settings_js__["b" /* initSettings */])();
+ Object(__WEBPACK_IMPORTED_MODULE_12__Settings_js__["b" /* initSettings */])();
+ }
+ if (saveObj.hasOwnProperty("FconfSettingsSave")) {
+ try {
+ Object(__WEBPACK_IMPORTED_MODULE_5__Fconf_js__["c" /* loadFconf */])(saveObj.FconfSettingsSave);
+ } catch(e) {
+ console.log("ERROR: Failed to parse .fconf Settings.");
+ }
}
if (saveObj.hasOwnProperty("VersionSave")) {
try {
- var ver = JSON.parse(saveObj.VersionSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN == null || __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN === 0) {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].setBitNodeNumber(1);
+ var ver = JSON.parse(saveObj.VersionSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN == null || __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN === 0) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].setBitNodeNumber(1);
}
if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
console.log("Evaluating changes needed for version compatibility");
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].augmentations.length > 0 || __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].queuedAugmentations.length > 0 ||
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].sourceFiles.length > 0) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].augmentations.length > 0 || __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].queuedAugmentations.length > 0 ||
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].sourceFiles.length > 0) {
//If you have already purchased an Aug...you are far enough in the game
//that everything should be available
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstFacInvRecvd = true;
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstAugPurchased = true;
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstJobRecvd = true;
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstTimeTraveled = true;
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstProgramAvailable = true;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstFacInvRecvd = true;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstAugPurchased = true;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstJobRecvd = true;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstTimeTraveled = true;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstProgramAvailable = true;
} else {
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].factions.length > 0 || __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].factionInvitations.length > 0) {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstFacInvRecvd = true;
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].factions.length > 0 || __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].factionInvitations.length > 0) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstFacInvRecvd = true;
}
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].companyName !== "" || __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].companyPosition !== "") {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstJobRecvd = true;
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyName !== "" || __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition !== "") {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstJobRecvd = true;
}
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].hacking_skill >= 25) {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstScriptAvailable = true;
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill >= 25) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstScriptAvailable = true;
}
}
}
@@ -107693,9 +107874,9 @@ function loadGame(saveString) {
} else {
createNewUpdateText();
}
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
try {
- Object(__WEBPACK_IMPORTED_MODULE_5__Gang_js__["d" /* loadAllGangs */])(saveObj.AllGangsSave);
+ Object(__WEBPACK_IMPORTED_MODULE_6__Gang_js__["e" /* loadAllGangs */])(saveObj.AllGangsSave);
} catch(e) {
console.log("ERROR: Failed to parse AllGangsSave: " + e);
}
@@ -107722,22 +107903,22 @@ function loadImportedGame(saveObj, saveString) {
try {
var decodedSaveString = decodeURIComponent(escape(atob(saveString)));
tempSaveObj = new BitburnerSaveObject();
- tempSaveObj = JSON.parse(decodedSaveString, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ tempSaveObj = JSON.parse(decodedSaveString, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
- tempPlayer = JSON.parse(tempSaveObj.PlayerSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ tempPlayer = JSON.parse(tempSaveObj.PlayerSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
//Parse Decimal.js objects
- tempPlayer.money = new __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js___default.a(tempPlayer.money);
- tempPlayer.total_money = new __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js___default.a(tempPlayer.total_money);
- tempPlayer.lifetime_money = new __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js___default.a(tempPlayer.lifetime_money);
+ tempPlayer.money = new __WEBPACK_IMPORTED_MODULE_20__utils_decimal_js___default.a(tempPlayer.money);
+ tempPlayer.total_money = new __WEBPACK_IMPORTED_MODULE_20__utils_decimal_js___default.a(tempPlayer.total_money);
+ tempPlayer.lifetime_money = new __WEBPACK_IMPORTED_MODULE_20__utils_decimal_js___default.a(tempPlayer.lifetime_money);
- tempAllServers = JSON.parse(tempSaveObj.AllServersSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
- tempCompanies = JSON.parse(tempSaveObj.CompaniesSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
- tempFactions = JSON.parse(tempSaveObj.FactionsSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
- tempSpecialServerIps = JSON.parse(tempSaveObj.SpecialServerIpsSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ tempAllServers = JSON.parse(tempSaveObj.AllServersSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
+ tempCompanies = JSON.parse(tempSaveObj.CompaniesSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
+ tempFactions = JSON.parse(tempSaveObj.FactionsSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
+ tempSpecialServerIps = JSON.parse(tempSaveObj.SpecialServerIpsSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
if (tempSaveObj.hasOwnProperty("AliasesSave")) {
try {
- tempAliases = JSON.parse(tempSaveObj.AliasesSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ tempAliases = JSON.parse(tempSaveObj.AliasesSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
} catch(e) {
console.log("Parsing Aliases save failed: " + e);
tempAliases = {};
@@ -107747,7 +107928,7 @@ function loadImportedGame(saveObj, saveString) {
}
if (tempSaveObj.hasOwnProperty("GlobalAliases")) {
try {
- tempGlobalAliases = JSON.parse(tempSaveObj.AliasesSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ tempGlobalAliases = JSON.parse(tempSaveObj.AliasesSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
} catch(e) {
console.log("Parsing Global Aliases save failed: " + e);
tempGlobalAliases = {};
@@ -107757,17 +107938,17 @@ function loadImportedGame(saveObj, saveString) {
}
if (tempSaveObj.hasOwnProperty("MessagesSave")) {
try {
- tempMessages = JSON.parse(tempSaveObj.MessagesSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ tempMessages = JSON.parse(tempSaveObj.MessagesSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
} catch(e) {
console.log("Parsing Messages save failed: " + e);
- Object(__WEBPACK_IMPORTED_MODULE_7__Message_js__["d" /* initMessages */])();
+ Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
}
} else {
- Object(__WEBPACK_IMPORTED_MODULE_7__Message_js__["d" /* initMessages */])();
+ Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
}
if (saveObj.hasOwnProperty("StockMarketSave")) {
try {
- tempStockMarket = JSON.parse(tempSaveObj.StockMarketSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ tempStockMarket = JSON.parse(tempSaveObj.StockMarketSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
} catch(e) {
console.log("Parsing StockMarket save failed: " + e);
tempStockMarket = {};
@@ -107777,7 +107958,7 @@ function loadImportedGame(saveObj, saveString) {
}
if (tempSaveObj.hasOwnProperty("VersionSave")) {
try {
- var ver = JSON.parse(tempSaveObj.VersionSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ var ver = JSON.parse(tempSaveObj.VersionSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
if (tempPlayer.bitNodeN == null || tempPlayer.bitNodeN == 0) {
tempPlayer.bitNodeN = 1;
@@ -107798,25 +107979,25 @@ function loadImportedGame(saveObj, saveString) {
}
if (tempPlayer.bitNodeN == 2 && tempPlayer.inGang() && tempSaveObj.hasOwnProperty("AllGangsSave")) {
try {
- Object(__WEBPACK_IMPORTED_MODULE_5__Gang_js__["d" /* loadAllGangs */])(tempSaveObj.AllGangsSave);
+ Object(__WEBPACK_IMPORTED_MODULE_6__Gang_js__["e" /* loadAllGangs */])(tempSaveObj.AllGangsSave);
} catch(e) {
console.log("ERROR: Failed to parse AllGangsSave: " + e);
}
}
} catch(e) {
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Error importing game: " + e.toString());
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Error importing game: " + e.toString());
return false;
}
//Since the save file is valid, load everything for real
saveString = decodeURIComponent(escape(atob(saveString)));
- saveObj = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ saveObj = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
- Object(__WEBPACK_IMPORTED_MODULE_8__Player_js__["b" /* loadPlayer */])(saveObj.PlayerSave);
- Object(__WEBPACK_IMPORTED_MODULE_10__Server_js__["g" /* loadAllServers */])(saveObj.AllServersSave);
+ Object(__WEBPACK_IMPORTED_MODULE_9__Player_js__["b" /* loadPlayer */])(saveObj.PlayerSave);
+ Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["g" /* loadAllServers */])(saveObj.AllServersSave);
Object(__WEBPACK_IMPORTED_MODULE_1__Company_js__["i" /* loadCompanies */])(saveObj.CompaniesSave);
Object(__WEBPACK_IMPORTED_MODULE_4__Faction_js__["i" /* loadFactions */])(saveObj.FactionsSave);
- Object(__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["d" /* loadSpecialServerIps */])(saveObj.SpecialServerIpsSave);
+ Object(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["d" /* loadSpecialServerIps */])(saveObj.SpecialServerIpsSave);
if (saveObj.hasOwnProperty("AliasesSave")) {
try {
@@ -107838,58 +108019,65 @@ function loadImportedGame(saveObj, saveString) {
}
if (saveObj.hasOwnProperty("MessagesSave")) {
try {
- Object(__WEBPACK_IMPORTED_MODULE_7__Message_js__["e" /* loadMessages */])(saveObj.MessagesSave);
+ Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["e" /* loadMessages */])(saveObj.MessagesSave);
} catch(e) {
- Object(__WEBPACK_IMPORTED_MODULE_7__Message_js__["d" /* initMessages */])();
+ Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
}
} else {
- Object(__WEBPACK_IMPORTED_MODULE_7__Message_js__["d" /* initMessages */])();
+ Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
}
if (saveObj.hasOwnProperty("StockMarketSave")) {
try {
- Object(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["j" /* loadStockMarket */])(saveObj.StockMarketSave);
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* loadStockMarket */])(saveObj.StockMarketSave);
} catch(e) {
- Object(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["j" /* loadStockMarket */])("");
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* loadStockMarket */])("");
}
} else {
- Object(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["j" /* loadStockMarket */])("");
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* loadStockMarket */])("");
}
if (saveObj.hasOwnProperty("SettingsSave")) {
try {
- Object(__WEBPACK_IMPORTED_MODULE_11__Settings_js__["c" /* loadSettings */])(saveObj.SettingsSave);
+ Object(__WEBPACK_IMPORTED_MODULE_12__Settings_js__["c" /* loadSettings */])(saveObj.SettingsSave);
} catch(e) {
- Object(__WEBPACK_IMPORTED_MODULE_11__Settings_js__["b" /* initSettings */])();
+ Object(__WEBPACK_IMPORTED_MODULE_12__Settings_js__["b" /* initSettings */])();
}
} else {
- Object(__WEBPACK_IMPORTED_MODULE_11__Settings_js__["b" /* initSettings */])();
+ Object(__WEBPACK_IMPORTED_MODULE_12__Settings_js__["b" /* initSettings */])();
+ }
+ if (saveObj.hasOwnProperty("FconfSettingsSave")) {
+ try {
+ Object(__WEBPACK_IMPORTED_MODULE_5__Fconf_js__["c" /* loadFconf */])(saveObj.FconfSettingsSave);
+ } catch(e) {
+ console.log("ERROR: Failed to load .fconf settings when importing");
+ }
}
if (saveObj.hasOwnProperty("VersionSave")) {
try {
- var ver = JSON.parse(saveObj.VersionSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN == null || __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN == 0) {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].setBitNodeNumber(1);
+ var ver = JSON.parse(saveObj.VersionSave, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN == null || __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN == 0) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].setBitNodeNumber(1);
}
if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
console.log("Evaluating changes needed for version compatibility");
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].augmentations.length > 0 || __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].queuedAugmentations.length > 0 ||
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].sourceFiles.length > 0) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].augmentations.length > 0 || __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].queuedAugmentations.length > 0 ||
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].sourceFiles.length > 0) {
//If you have already purchased an Aug...you are far enough in the game
//that everything should be available
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstFacInvRecvd = true;
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstAugPurchased = true;
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstJobRecvd = true;
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstTimeTraveled = true;
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstProgramAvailable = true;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstFacInvRecvd = true;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstAugPurchased = true;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstJobRecvd = true;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstTimeTraveled = true;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstProgramAvailable = true;
} else {
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].factions.length > 0 || __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].factionInvitations.length > 0) {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstFacInvRecvd = true;
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].factions.length > 0 || __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].factionInvitations.length > 0) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstFacInvRecvd = true;
}
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].companyName !== "" || __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].companyPosition !== "") {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstJobRecvd = true;
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyName !== "" || __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition !== "") {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstJobRecvd = true;
}
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].hacking_skill >= 25) {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].firstScriptAvailable = true;
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill >= 25) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].firstScriptAvailable = true;
}
}
}
@@ -107902,17 +108090,17 @@ function loadImportedGame(saveObj, saveString) {
} else {
createNewUpdateText();
}
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
try {
- Object(__WEBPACK_IMPORTED_MODULE_5__Gang_js__["d" /* loadAllGangs */])(saveObj.AllGangsSave);
+ Object(__WEBPACK_IMPORTED_MODULE_6__Gang_js__["e" /* loadAllGangs */])(saveObj.AllGangsSave);
} catch(e) {
console.log("ERROR: Failed to parse AllGangsSave: " + e);
}
}
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Imported game! I would suggest saving the game and then reloading the page " +
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Imported game! I would suggest saving the game and then reloading the page " +
"to make sure everything runs smoothly");
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_GameOptions_js__["a" /* gameOptionsBoxClose */])();
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_GameOptions_js__["a" /* gameOptionsBoxClose */])();
//Re-start game
console.log("Importing game");
@@ -107922,69 +108110,69 @@ function loadImportedGame(saveObj, saveString) {
//Calculate the number of cycles have elapsed while offline
__WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"]._lastUpdate = new Date().getTime();
- var lastUpdate = __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].lastUpdate;
+ var lastUpdate = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].lastUpdate;
var numCyclesOffline = Math.floor((__WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"]._lastUpdate - lastUpdate) / __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"]._idleSpeed);
/* Process offline progress */
- var offlineProductionFromScripts = Object(__WEBPACK_IMPORTED_MODULE_9__Script_js__["e" /* loadAllRunningScripts */])(); //This also takes care of offline production for those scripts
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].isWorking) {
+ var offlineProductionFromScripts = Object(__WEBPACK_IMPORTED_MODULE_10__Script_js__["e" /* loadAllRunningScripts */])(); //This also takes care of offline production for those scripts
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) {
console.log("work() called in load() for " + numCyclesOffline * __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"]._idleSpeed + " milliseconds");
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].workForFaction(numCyclesOffline);
- } else if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].createProgramWork(numCyclesOffline);
- } else if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].takeClass(numCyclesOffline);
- } else if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].commitCrime(numCyclesOffline);
- } else if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].workPartTime(numCyclesOffline);
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].workForFaction(numCyclesOffline);
+ } else if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].createProgramWork(numCyclesOffline);
+ } else if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].takeClass(numCyclesOffline);
+ } else if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].commitCrime(numCyclesOffline);
+ } else if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].workPartTime(numCyclesOffline);
} else {
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].work(numCyclesOffline);
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].work(numCyclesOffline);
}
}
//Hacknet Nodes offline progress
- var offlineProductionFromHacknetNodes = Object(__WEBPACK_IMPORTED_MODULE_6__HacknetNode_js__["d" /* processAllHacknetNodeEarnings */])(numCyclesOffline);
+ var offlineProductionFromHacknetNodes = Object(__WEBPACK_IMPORTED_MODULE_7__HacknetNode_js__["d" /* processAllHacknetNodeEarnings */])(numCyclesOffline);
//Passive faction rep gain offline
Object(__WEBPACK_IMPORTED_MODULE_4__Faction_js__["j" /* processPassiveFactionRepGain */])(numCyclesOffline);
//Update total playtime
var time = numCyclesOffline * __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"]._idleSpeed;
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].totalPlaytime == null) {__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].totalPlaytime = 0;}
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].playtimeSinceLastAug == null) {__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].playtimeSinceLastAug = 0;}
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].totalPlaytime += time;
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].playtimeSinceLastAug += time;
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].totalPlaytime == null) {__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].totalPlaytime = 0;}
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].playtimeSinceLastAug == null) {__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].playtimeSinceLastAug = 0;}
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].totalPlaytime += time;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].playtimeSinceLastAug += time;
//Re-apply augmentations
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].reapplyAllAugmentations();
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].reapplyAllAugmentations();
//Clear terminal
$("#terminal tr:not(:last)").remove();
- __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].lastUpdate = __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"]._lastUpdate;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].lastUpdate = __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"]._lastUpdate;
__WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].start(); //Run main game loop and Scripts loop
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__["a" /* dialogBoxCreate */])("While you were offline, your scripts generated $" +
- Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" +
- Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineProductionFromHacknetNodes, 2));
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("While you were offline, your scripts generated $" +
+ Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" +
+ Object(__WEBPACK_IMPORTED_MODULE_19__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineProductionFromHacknetNodes, 2));
return true;
}
BitburnerSaveObject.prototype.exportGame = function() {
- this.PlayerSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */]);
- this.AllServersSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_10__Server_js__["b" /* AllServers */]);
+ this.PlayerSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */]);
+ this.AllServersSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */]);
this.CompaniesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_1__Company_js__["a" /* Companies */]);
this.FactionsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_4__Faction_js__["b" /* Factions */]);
- this.SpecialServerIpsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["a" /* SpecialServerIps */]);
+ this.SpecialServerIpsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */]);
this.AliasesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_0__Alias_js__["a" /* Aliases */]);
this.GlobalAliasesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_0__Alias_js__["b" /* GlobalAliases */]);
- this.MessagesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_7__Message_js__["b" /* Messages */]);
- this.StockMarketSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["c" /* StockMarket */]);
- this.SettingsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_11__Settings_js__["a" /* Settings */]);
+ this.MessagesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_8__Message_js__["b" /* Messages */]);
+ this.StockMarketSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["c" /* StockMarket */]);
+ this.SettingsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_12__Settings_js__["a" /* Settings */]);
this.VersionSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].Version);
- if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].inGang()) {
- this.AllGangsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_5__Gang_js__["a" /* AllGangs */]);
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].inGang()) {
+ this.AllGangsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_6__Gang_js__["a" /* AllGangs */]);
}
var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
@@ -108008,11 +108196,11 @@ BitburnerSaveObject.prototype.exportGame = function() {
BitburnerSaveObject.prototype.importGame = function() {
if (window.File && window.FileReader && window.FileList && window.Blob) {
- var fileSelector = Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["b" /* clearEventListeners */])("import-game-file-selector");
+ var fileSelector = Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["b" /* clearEventListeners */])("import-game-file-selector");
fileSelector.addEventListener("change", openImportFileHandler, false);
$("#import-game-file-selector").click();
} else {
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERR: Your browser does not support HTML5 File API. Cannot import.");
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERR: Your browser does not support HTML5 File API. Cannot import.");
}
}
@@ -108035,7 +108223,7 @@ BitburnerSaveObject.prototype.deleteGame = function(db) {
}
function createNewUpdateText() {
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__["a" /* dialogBoxCreate */])("New update! " +
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("New update! " +
"Please report any bugs/issues through the github repository " +
"or the Bitburner subreddit (reddit.com/r/bitburner).
" +
__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].LatestUpdate);
@@ -108043,21 +108231,21 @@ function createNewUpdateText() {
BitburnerSaveObject.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["b" /* Generic_toJSON */])("BitburnerSaveObject", this);
+ return Object(__WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["b" /* Generic_toJSON */])("BitburnerSaveObject", this);
}
BitburnerSaveObject.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(BitburnerSaveObject, value.data);
+ return Object(__WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(BitburnerSaveObject, value.data);
}
-__WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */].constructors.BitburnerSaveObject = BitburnerSaveObject;
+__WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */].constructors.BitburnerSaveObject = BitburnerSaveObject;
//Import game
function openImportFileHandler(evt) {
var file = evt.target.files[0];
if (!file) {
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid file selected");
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid file selected");
return;
}
@@ -108073,5 +108261,18065 @@ function openImportFileHandler(evt) {
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
+/***/ }),
+/* 75 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Aliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return GlobalAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return printAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return parseAliasDeclaration; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return removeAlias; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return substituteAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return loadAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return loadGlobalAliases; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Terminal_js__ = __webpack_require__(18);
+
+
+let Aliases = {};
+let GlobalAliases = {};
+
+function loadAliases(saveString) {
+ if (saveString === "") {
+ Aliases = {};
+ } else {
+ Aliases = JSON.parse(saveString);
+ }
+}
+
+function loadGlobalAliases(saveString) {
+ if (saveString === "") {
+ GlobalAliases = {};
+ } else {
+ GlobalAliases = JSON.parse(saveString);
+ }
+}
+
+//Print all aliases to terminal
+function printAliases() {
+ for (var name in Aliases) {
+ if (Aliases.hasOwnProperty(name)) {
+ Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("alias " + name + "=" + Aliases[name]);
+ }
+ }
+ for (var name in GlobalAliases) {
+ if (GlobalAliases.hasOwnProperty(name)) {
+ Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("global alias " + name + "=" + GlobalAliases[name]);
+ }
+ }
+}
+
+//True if successful, false otherwise
+function parseAliasDeclaration(dec,global=false) {
+ var re = /^([_|\w|!|%|,|@]+)="(.+)"$/;
+ var matches = dec.match(re);
+ if (matches == null || matches.length != 3) {return false;}
+ if (global){
+ addGlobalAlias(matches[1],matches[2]);
+ } else {
+ addAlias(matches[1], matches[2]);
+ }
+ return true;
+}
+
+function addAlias(name, value) {
+ if (name in GlobalAliases){
+ delete GlobalAliases[name];
+ }
+ Aliases[name] = value;
+}
+
+function addGlobalAlias(name, value) {
+ if (name in Aliases){
+ delete Aliases[name];
+ }
+ GlobalAliases[name] = value;
+}
+
+function getAlias(name) {
+ if (Aliases.hasOwnProperty(name)) {
+ return Aliases[name];
+ }
+ return null;
+}
+
+function getGlobalAlias(name) {
+ if (GlobalAliases.hasOwnProperty(name)) {
+ return GlobalAliases[name];
+ }
+ return null;
+}
+
+function removeAlias(name) {
+ if (Aliases.hasOwnProperty(name)) {
+ delete Aliases[name];
+ return true;
+ }
+ if (GlobalAliases.hasOwnProperty(name)) {
+ delete GlobalAliases[name];
+ return true;
+ }
+ return false;
+}
+
+//Returns the original string with any aliases substituted in
+//Aliases only applied to "whole words", one level deep
+function substituteAliases(origCommand) {
+ var commandArray = origCommand.split(" ");
+ if (commandArray.length>0){
+ var alias = getAlias(commandArray[0]);
+ if (alias != null) {
+ commandArray[0] = alias;
+ } else {
+ var alias = getGlobalAlias(commandArray[0]);
+ if (alias != null) {
+ commandArray[0] = alias;
+ }
+ }
+ for (var i = 0; i < commandArray.length; ++i) {
+ var alias = getGlobalAlias(commandArray[i]);
+ if (alias != null) {
+ commandArray[i] = alias;
+ }
+ }
+ }
+ return commandArray.join(" ");
+}
+
+
+
+
+/***/ }),
+/* 76 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var support = __webpack_require__(78);
+var base64 = __webpack_require__(105);
+var nodejsUtils = __webpack_require__(88);
+var setImmediate = __webpack_require__(141);
+var external = __webpack_require__(85);
+
+
+/**
+ * Convert a string that pass as a "binary string": it should represent a byte
+ * array but may have > 255 char codes. Be sure to take only the first byte
+ * and returns the byte array.
+ * @param {String} str the string to transform.
+ * @return {Array|Uint8Array} the string in a binary format.
+ */
+function string2binary(str) {
+ var result = null;
+ if (support.uint8array) {
+ result = new Uint8Array(str.length);
+ } else {
+ result = new Array(str.length);
+ }
+ return stringToArrayLike(str, result);
+}
+
+/**
+ * Create a new blob with the given content and the given type.
+ * @param {String|ArrayBuffer} part the content to put in the blob. DO NOT use
+ * an Uint8Array because the stock browser of android 4 won't accept it (it
+ * will be silently converted to a string, "[object Uint8Array]").
+ *
+ * Use only ONE part to build the blob to avoid a memory leak in IE11 / Edge:
+ * when a large amount of Array is used to create the Blob, the amount of
+ * memory consumed is nearly 100 times the original data amount.
+ *
+ * @param {String} type the mime type of the blob.
+ * @return {Blob} the created blob.
+ */
+exports.newBlob = function(part, type) {
+ exports.checkSupport("blob");
+
+ try {
+ // Blob constructor
+ return new Blob([part], {
+ type: type
+ });
+ }
+ catch (e) {
+
+ try {
+ // deprecated, browser only, old way
+ var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder;
+ var builder = new Builder();
+ builder.append(part);
+ return builder.getBlob(type);
+ }
+ catch (e) {
+
+ // well, fuck ?!
+ throw new Error("Bug : can't construct the Blob.");
+ }
+ }
+
+
+};
+/**
+ * The identity function.
+ * @param {Object} input the input.
+ * @return {Object} the same input.
+ */
+function identity(input) {
+ return input;
+}
+
+/**
+ * Fill in an array with a string.
+ * @param {String} str the string to use.
+ * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated).
+ * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array.
+ */
+function stringToArrayLike(str, array) {
+ for (var i = 0; i < str.length; ++i) {
+ array[i] = str.charCodeAt(i) & 0xFF;
+ }
+ return array;
+}
+
+/**
+ * An helper for the function arrayLikeToString.
+ * This contains static informations and functions that
+ * can be optimized by the browser JIT compiler.
+ */
+var arrayToStringHelper = {
+ /**
+ * Transform an array of int into a string, chunk by chunk.
+ * See the performances notes on arrayLikeToString.
+ * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.
+ * @param {String} type the type of the array.
+ * @param {Integer} chunk the chunk size.
+ * @return {String} the resulting string.
+ * @throws Error if the chunk is too big for the stack.
+ */
+ stringifyByChunk: function(array, type, chunk) {
+ var result = [], k = 0, len = array.length;
+ // shortcut
+ if (len <= chunk) {
+ return String.fromCharCode.apply(null, array);
+ }
+ while (k < len) {
+ if (type === "array" || type === "nodebuffer") {
+ result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len))));
+ }
+ else {
+ result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len))));
+ }
+ k += chunk;
+ }
+ return result.join("");
+ },
+ /**
+ * Call String.fromCharCode on every item in the array.
+ * This is the naive implementation, which generate A LOT of intermediate string.
+ * This should be used when everything else fail.
+ * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.
+ * @return {String} the result.
+ */
+ stringifyByChar: function(array){
+ var resultStr = "";
+ for(var i = 0; i < array.length; i++) {
+ resultStr += String.fromCharCode(array[i]);
+ }
+ return resultStr;
+ },
+ applyCanBeUsed : {
+ /**
+ * true if the browser accepts to use String.fromCharCode on Uint8Array
+ */
+ uint8array : (function () {
+ try {
+ return support.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1;
+ } catch (e) {
+ return false;
+ }
+ })(),
+ /**
+ * true if the browser accepts to use String.fromCharCode on nodejs Buffer.
+ */
+ nodebuffer : (function () {
+ try {
+ return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length === 1;
+ } catch (e) {
+ return false;
+ }
+ })()
+ }
+};
+
+/**
+ * Transform an array-like object to a string.
+ * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.
+ * @return {String} the result.
+ */
+function arrayLikeToString(array) {
+ // Performances notes :
+ // --------------------
+ // String.fromCharCode.apply(null, array) is the fastest, see
+ // see http://jsperf.com/converting-a-uint8array-to-a-string/2
+ // but the stack is limited (and we can get huge arrays !).
+ //
+ // result += String.fromCharCode(array[i]); generate too many strings !
+ //
+ // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2
+ // TODO : we now have workers that split the work. Do we still need that ?
+ var chunk = 65536,
+ type = exports.getTypeOf(array),
+ canUseApply = true;
+ if (type === "uint8array") {
+ canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array;
+ } else if (type === "nodebuffer") {
+ canUseApply = arrayToStringHelper.applyCanBeUsed.nodebuffer;
+ }
+
+ if (canUseApply) {
+ while (chunk > 1) {
+ try {
+ return arrayToStringHelper.stringifyByChunk(array, type, chunk);
+ } catch (e) {
+ chunk = Math.floor(chunk / 2);
+ }
+ }
+ }
+
+ // no apply or chunk error : slow and painful algorithm
+ // default browser on android 4.*
+ return arrayToStringHelper.stringifyByChar(array);
+}
+
+exports.applyFromCharCode = arrayLikeToString;
+
+
+/**
+ * Copy the data from an array-like to an other array-like.
+ * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array.
+ * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated.
+ * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array.
+ */
+function arrayLikeToArrayLike(arrayFrom, arrayTo) {
+ for (var i = 0; i < arrayFrom.length; i++) {
+ arrayTo[i] = arrayFrom[i];
+ }
+ return arrayTo;
+}
+
+// a matrix containing functions to transform everything into everything.
+var transform = {};
+
+// string to ?
+transform["string"] = {
+ "string": identity,
+ "array": function(input) {
+ return stringToArrayLike(input, new Array(input.length));
+ },
+ "arraybuffer": function(input) {
+ return transform["string"]["uint8array"](input).buffer;
+ },
+ "uint8array": function(input) {
+ return stringToArrayLike(input, new Uint8Array(input.length));
+ },
+ "nodebuffer": function(input) {
+ return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length));
+ }
+};
+
+// array to ?
+transform["array"] = {
+ "string": arrayLikeToString,
+ "array": identity,
+ "arraybuffer": function(input) {
+ return (new Uint8Array(input)).buffer;
+ },
+ "uint8array": function(input) {
+ return new Uint8Array(input);
+ },
+ "nodebuffer": function(input) {
+ return nodejsUtils.newBufferFrom(input);
+ }
+};
+
+// arraybuffer to ?
+transform["arraybuffer"] = {
+ "string": function(input) {
+ return arrayLikeToString(new Uint8Array(input));
+ },
+ "array": function(input) {
+ return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength));
+ },
+ "arraybuffer": identity,
+ "uint8array": function(input) {
+ return new Uint8Array(input);
+ },
+ "nodebuffer": function(input) {
+ return nodejsUtils.newBufferFrom(new Uint8Array(input));
+ }
+};
+
+// uint8array to ?
+transform["uint8array"] = {
+ "string": arrayLikeToString,
+ "array": function(input) {
+ return arrayLikeToArrayLike(input, new Array(input.length));
+ },
+ "arraybuffer": function(input) {
+ return input.buffer;
+ },
+ "uint8array": identity,
+ "nodebuffer": function(input) {
+ return nodejsUtils.newBufferFrom(input);
+ }
+};
+
+// nodebuffer to ?
+transform["nodebuffer"] = {
+ "string": arrayLikeToString,
+ "array": function(input) {
+ return arrayLikeToArrayLike(input, new Array(input.length));
+ },
+ "arraybuffer": function(input) {
+ return transform["nodebuffer"]["uint8array"](input).buffer;
+ },
+ "uint8array": function(input) {
+ return arrayLikeToArrayLike(input, new Uint8Array(input.length));
+ },
+ "nodebuffer": identity
+};
+
+/**
+ * Transform an input into any type.
+ * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer.
+ * If no output type is specified, the unmodified input will be returned.
+ * @param {String} outputType the output type.
+ * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert.
+ * @throws {Error} an Error if the browser doesn't support the requested output type.
+ */
+exports.transformTo = function(outputType, input) {
+ if (!input) {
+ // undefined, null, etc
+ // an empty string won't harm.
+ input = "";
+ }
+ if (!outputType) {
+ return input;
+ }
+ exports.checkSupport(outputType);
+ var inputType = exports.getTypeOf(input);
+ var result = transform[inputType][outputType](input);
+ return result;
+};
+
+/**
+ * Return the type of the input.
+ * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer.
+ * @param {Object} input the input to identify.
+ * @return {String} the (lowercase) type of the input.
+ */
+exports.getTypeOf = function(input) {
+ if (typeof input === "string") {
+ return "string";
+ }
+ if (Object.prototype.toString.call(input) === "[object Array]") {
+ return "array";
+ }
+ if (support.nodebuffer && nodejsUtils.isBuffer(input)) {
+ return "nodebuffer";
+ }
+ if (support.uint8array && input instanceof Uint8Array) {
+ return "uint8array";
+ }
+ if (support.arraybuffer && input instanceof ArrayBuffer) {
+ return "arraybuffer";
+ }
+};
+
+/**
+ * Throw an exception if the type is not supported.
+ * @param {String} type the type to check.
+ * @throws {Error} an Error if the browser doesn't support the requested type.
+ */
+exports.checkSupport = function(type) {
+ var supported = support[type.toLowerCase()];
+ if (!supported) {
+ throw new Error(type + " is not supported by this platform");
+ }
+};
+
+exports.MAX_VALUE_16BITS = 65535;
+exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1
+
+/**
+ * Prettify a string read as binary.
+ * @param {string} str the string to prettify.
+ * @return {string} a pretty string.
+ */
+exports.pretty = function(str) {
+ var res = '',
+ code, i;
+ for (i = 0; i < (str || "").length; i++) {
+ code = str.charCodeAt(i);
+ res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase();
+ }
+ return res;
+};
+
+/**
+ * Defer the call of a function.
+ * @param {Function} callback the function to call asynchronously.
+ * @param {Array} args the arguments to give to the callback.
+ */
+exports.delay = function(callback, args, self) {
+ setImmediate(function () {
+ callback.apply(self || null, args || []);
+ });
+};
+
+/**
+ * Extends a prototype with an other, without calling a constructor with
+ * side effects. Inspired by nodejs' `utils.inherits`
+ * @param {Function} ctor the constructor to augment
+ * @param {Function} superCtor the parent constructor to use
+ */
+exports.inherits = function (ctor, superCtor) {
+ var Obj = function() {};
+ Obj.prototype = superCtor.prototype;
+ ctor.prototype = new Obj();
+};
+
+/**
+ * Merge the objects passed as parameters into a new one.
+ * @private
+ * @param {...Object} var_args All objects to merge.
+ * @return {Object} a new object with the data of the others.
+ */
+exports.extend = function() {
+ var result = {}, i, attr;
+ for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers
+ for (attr in arguments[i]) {
+ if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") {
+ result[attr] = arguments[i][attr];
+ }
+ }
+ }
+ return result;
+};
+
+/**
+ * Transform arbitrary content into a Promise.
+ * @param {String} name a name for the content being processed.
+ * @param {Object} inputData the content to process.
+ * @param {Boolean} isBinary true if the content is not an unicode string
+ * @param {Boolean} isOptimizedBinaryString true if the string content only has one byte per character.
+ * @param {Boolean} isBase64 true if the string content is encoded with base64.
+ * @return {Promise} a promise in a format usable by JSZip.
+ */
+exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) {
+
+ // if inputData is already a promise, this flatten it.
+ var promise = external.Promise.resolve(inputData).then(function(data) {
+
+
+ var isBlob = support.blob && (data instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(data)) !== -1);
+
+ if (isBlob && typeof FileReader !== "undefined") {
+ return new external.Promise(function (resolve, reject) {
+ var reader = new FileReader();
+
+ reader.onload = function(e) {
+ resolve(e.target.result);
+ };
+ reader.onerror = function(e) {
+ reject(e.target.error);
+ };
+ reader.readAsArrayBuffer(data);
+ });
+ } else {
+ return data;
+ }
+ });
+
+ return promise.then(function(data) {
+ var dataType = exports.getTypeOf(data);
+
+ if (!dataType) {
+ return external.Promise.reject(
+ new Error("Can't read the data of '" + name + "'. Is it " +
+ "in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?")
+ );
+ }
+ // special case : it's way easier to work with Uint8Array than with ArrayBuffer
+ if (dataType === "arraybuffer") {
+ data = exports.transformTo("uint8array", data);
+ } else if (dataType === "string") {
+ if (isBase64) {
+ data = base64.decode(data);
+ }
+ else if (isBinary) {
+ // optimizedBinaryString === true means that the file has already been filtered with a 0xFF mask
+ if (isOptimizedBinaryString !== true) {
+ // this is a string, not in a base64 format.
+ // Be sure that this is a correct "binary string"
+ data = string2binary(data);
+ }
+ }
+ }
+ return data;
+ });
+};
+
+
+/***/ }),
+/* 77 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/**
+ * A worker that does nothing but passing chunks to the next one. This is like
+ * a nodejs stream but with some differences. On the good side :
+ * - it works on IE 6-9 without any issue / polyfill
+ * - it weights less than the full dependencies bundled with browserify
+ * - it forwards errors (no need to declare an error handler EVERYWHERE)
+ *
+ * A chunk is an object with 2 attributes : `meta` and `data`. The former is an
+ * object containing anything (`percent` for example), see each worker for more
+ * details. The latter is the real data (String, Uint8Array, etc).
+ *
+ * @constructor
+ * @param {String} name the name of the stream (mainly used for debugging purposes)
+ */
+function GenericWorker(name) {
+ // the name of the worker
+ this.name = name || "default";
+ // an object containing metadata about the workers chain
+ this.streamInfo = {};
+ // an error which happened when the worker was paused
+ this.generatedError = null;
+ // an object containing metadata to be merged by this worker into the general metadata
+ this.extraStreamInfo = {};
+ // true if the stream is paused (and should not do anything), false otherwise
+ this.isPaused = true;
+ // true if the stream is finished (and should not do anything), false otherwise
+ this.isFinished = false;
+ // true if the stream is locked to prevent further structure updates (pipe), false otherwise
+ this.isLocked = false;
+ // the event listeners
+ this._listeners = {
+ 'data':[],
+ 'end':[],
+ 'error':[]
+ };
+ // the previous worker, if any
+ this.previous = null;
+}
+
+GenericWorker.prototype = {
+ /**
+ * Push a chunk to the next workers.
+ * @param {Object} chunk the chunk to push
+ */
+ push : function (chunk) {
+ this.emit("data", chunk);
+ },
+ /**
+ * End the stream.
+ * @return {Boolean} true if this call ended the worker, false otherwise.
+ */
+ end : function () {
+ if (this.isFinished) {
+ return false;
+ }
+
+ this.flush();
+ try {
+ this.emit("end");
+ this.cleanUp();
+ this.isFinished = true;
+ } catch (e) {
+ this.emit("error", e);
+ }
+ return true;
+ },
+ /**
+ * End the stream with an error.
+ * @param {Error} e the error which caused the premature end.
+ * @return {Boolean} true if this call ended the worker with an error, false otherwise.
+ */
+ error : function (e) {
+ if (this.isFinished) {
+ return false;
+ }
+
+ if(this.isPaused) {
+ this.generatedError = e;
+ } else {
+ this.isFinished = true;
+
+ this.emit("error", e);
+
+ // in the workers chain exploded in the middle of the chain,
+ // the error event will go downward but we also need to notify
+ // workers upward that there has been an error.
+ if(this.previous) {
+ this.previous.error(e);
+ }
+
+ this.cleanUp();
+ }
+ return true;
+ },
+ /**
+ * Add a callback on an event.
+ * @param {String} name the name of the event (data, end, error)
+ * @param {Function} listener the function to call when the event is triggered
+ * @return {GenericWorker} the current object for chainability
+ */
+ on : function (name, listener) {
+ this._listeners[name].push(listener);
+ return this;
+ },
+ /**
+ * Clean any references when a worker is ending.
+ */
+ cleanUp : function () {
+ this.streamInfo = this.generatedError = this.extraStreamInfo = null;
+ this._listeners = [];
+ },
+ /**
+ * Trigger an event. This will call registered callback with the provided arg.
+ * @param {String} name the name of the event (data, end, error)
+ * @param {Object} arg the argument to call the callback with.
+ */
+ emit : function (name, arg) {
+ if (this._listeners[name]) {
+ for(var i = 0; i < this._listeners[name].length; i++) {
+ this._listeners[name][i].call(this, arg);
+ }
+ }
+ },
+ /**
+ * Chain a worker with an other.
+ * @param {Worker} next the worker receiving events from the current one.
+ * @return {worker} the next worker for chainability
+ */
+ pipe : function (next) {
+ return next.registerPrevious(this);
+ },
+ /**
+ * Same as `pipe` in the other direction.
+ * Using an API with `pipe(next)` is very easy.
+ * Implementing the API with the point of view of the next one registering
+ * a source is easier, see the ZipFileWorker.
+ * @param {Worker} previous the previous worker, sending events to this one
+ * @return {Worker} the current worker for chainability
+ */
+ registerPrevious : function (previous) {
+ if (this.isLocked) {
+ throw new Error("The stream '" + this + "' has already been used.");
+ }
+
+ // sharing the streamInfo...
+ this.streamInfo = previous.streamInfo;
+ // ... and adding our own bits
+ this.mergeStreamInfo();
+ this.previous = previous;
+ var self = this;
+ previous.on('data', function (chunk) {
+ self.processChunk(chunk);
+ });
+ previous.on('end', function () {
+ self.end();
+ });
+ previous.on('error', function (e) {
+ self.error(e);
+ });
+ return this;
+ },
+ /**
+ * Pause the stream so it doesn't send events anymore.
+ * @return {Boolean} true if this call paused the worker, false otherwise.
+ */
+ pause : function () {
+ if(this.isPaused || this.isFinished) {
+ return false;
+ }
+ this.isPaused = true;
+
+ if(this.previous) {
+ this.previous.pause();
+ }
+ return true;
+ },
+ /**
+ * Resume a paused stream.
+ * @return {Boolean} true if this call resumed the worker, false otherwise.
+ */
+ resume : function () {
+ if(!this.isPaused || this.isFinished) {
+ return false;
+ }
+ this.isPaused = false;
+
+ // if true, the worker tried to resume but failed
+ var withError = false;
+ if(this.generatedError) {
+ this.error(this.generatedError);
+ withError = true;
+ }
+ if(this.previous) {
+ this.previous.resume();
+ }
+
+ return !withError;
+ },
+ /**
+ * Flush any remaining bytes as the stream is ending.
+ */
+ flush : function () {},
+ /**
+ * Process a chunk. This is usually the method overridden.
+ * @param {Object} chunk the chunk to process.
+ */
+ processChunk : function(chunk) {
+ this.push(chunk);
+ },
+ /**
+ * Add a key/value to be added in the workers chain streamInfo once activated.
+ * @param {String} key the key to use
+ * @param {Object} value the associated value
+ * @return {Worker} the current worker for chainability
+ */
+ withStreamInfo : function (key, value) {
+ this.extraStreamInfo[key] = value;
+ this.mergeStreamInfo();
+ return this;
+ },
+ /**
+ * Merge this worker's streamInfo into the chain's streamInfo.
+ */
+ mergeStreamInfo : function () {
+ for(var key in this.extraStreamInfo) {
+ if (!this.extraStreamInfo.hasOwnProperty(key)) {
+ continue;
+ }
+ this.streamInfo[key] = this.extraStreamInfo[key];
+ }
+ },
+
+ /**
+ * Lock the stream to prevent further updates on the workers chain.
+ * After calling this method, all calls to pipe will fail.
+ */
+ lock: function () {
+ if (this.isLocked) {
+ throw new Error("The stream '" + this + "' has already been used.");
+ }
+ this.isLocked = true;
+ if (this.previous) {
+ this.previous.lock();
+ }
+ },
+
+ /**
+ *
+ * Pretty print the workers chain.
+ */
+ toString : function () {
+ var me = "Worker " + this.name;
+ if (this.previous) {
+ return this.previous + " -> " + me;
+ } else {
+ return me;
+ }
+ }
+};
+
+module.exports = GenericWorker;
+
+
+/***/ }),
+/* 78 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(Buffer) {
+
+exports.base64 = true;
+exports.array = true;
+exports.string = true;
+exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined";
+exports.nodebuffer = typeof Buffer !== "undefined";
+// contains true if JSZip can read/generate Uint8Array, false otherwise.
+exports.uint8array = typeof Uint8Array !== "undefined";
+
+if (typeof ArrayBuffer === "undefined") {
+ exports.blob = false;
+}
+else {
+ var buffer = new ArrayBuffer(0);
+ try {
+ exports.blob = new Blob([buffer], {
+ type: "application/zip"
+ }).size === 0;
+ }
+ catch (e) {
+ try {
+ var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder;
+ var builder = new Builder();
+ builder.append(buffer);
+ exports.blob = builder.getBlob('application/zip').size === 0;
+ }
+ catch (e) {
+ exports.blob = false;
+ }
+ }
+}
+
+try {
+ exports.nodestream = !!__webpack_require__(99).Readable;
+} catch(e) {
+ exports.nodestream = false;
+}
+
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(83).Buffer))
+
+/***/ }),
+/* 79 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
+ (typeof Uint16Array !== 'undefined') &&
+ (typeof Int32Array !== 'undefined');
+
+function _has(obj, key) {
+ return Object.prototype.hasOwnProperty.call(obj, key);
+}
+
+exports.assign = function (obj /*from1, from2, from3, ...*/) {
+ var sources = Array.prototype.slice.call(arguments, 1);
+ while (sources.length) {
+ var source = sources.shift();
+ if (!source) { continue; }
+
+ if (typeof source !== 'object') {
+ throw new TypeError(source + 'must be non-object');
+ }
+
+ for (var p in source) {
+ if (_has(source, p)) {
+ obj[p] = source[p];
+ }
+ }
+ }
+
+ return obj;
+};
+
+
+// reduce buffer size, avoiding mem copy
+exports.shrinkBuf = function (buf, size) {
+ if (buf.length === size) { return buf; }
+ if (buf.subarray) { return buf.subarray(0, size); }
+ buf.length = size;
+ return buf;
+};
+
+
+var fnTyped = {
+ arraySet: function (dest, src, src_offs, len, dest_offs) {
+ if (src.subarray && dest.subarray) {
+ dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
+ return;
+ }
+ // Fallback to ordinary array
+ for (var i = 0; i < len; i++) {
+ dest[dest_offs + i] = src[src_offs + i];
+ }
+ },
+ // Join array of chunks to single array.
+ flattenChunks: function (chunks) {
+ var i, l, len, pos, chunk, result;
+
+ // calculate data length
+ len = 0;
+ for (i = 0, l = chunks.length; i < l; i++) {
+ len += chunks[i].length;
+ }
+
+ // join chunks
+ result = new Uint8Array(len);
+ pos = 0;
+ for (i = 0, l = chunks.length; i < l; i++) {
+ chunk = chunks[i];
+ result.set(chunk, pos);
+ pos += chunk.length;
+ }
+
+ return result;
+ }
+};
+
+var fnUntyped = {
+ arraySet: function (dest, src, src_offs, len, dest_offs) {
+ for (var i = 0; i < len; i++) {
+ dest[dest_offs + i] = src[src_offs + i];
+ }
+ },
+ // Join array of chunks to single array.
+ flattenChunks: function (chunks) {
+ return [].concat.apply([], chunks);
+ }
+};
+
+
+// Enable/Disable typed arrays use, for testing
+//
+exports.setTyped = function (on) {
+ if (on) {
+ exports.Buf8 = Uint8Array;
+ exports.Buf16 = Uint16Array;
+ exports.Buf32 = Int32Array;
+ exports.assign(exports, fnTyped);
+ } else {
+ exports.Buf8 = Array;
+ exports.Buf16 = Array;
+ exports.Buf32 = Array;
+ exports.assign(exports, fnUntyped);
+ }
+};
+
+exports.setTyped(TYPED_OK);
+
+
+/***/ }),
+/* 80 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// a duplex stream is just a stream that is both readable and writable.
+// Since JS doesn't have multiple prototypal inheritance, this class
+// prototypally inherits from Readable, and then parasitically from
+// Writable.
+
+
+
+/**/
+
+var processNextTick = __webpack_require__(86).nextTick;
+/**/
+
+/**/
+var objectKeys = Object.keys || function (obj) {
+ var keys = [];
+ for (var key in obj) {
+ keys.push(key);
+ }return keys;
+};
+/**/
+
+module.exports = Duplex;
+
+/**/
+var util = __webpack_require__(84);
+util.inherits = __webpack_require__(82);
+/**/
+
+var Readable = __webpack_require__(100);
+var Writable = __webpack_require__(92);
+
+util.inherits(Duplex, Readable);
+
+var keys = objectKeys(Writable.prototype);
+for (var v = 0; v < keys.length; v++) {
+ var method = keys[v];
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
+}
+
+function Duplex(options) {
+ if (!(this instanceof Duplex)) return new Duplex(options);
+
+ Readable.call(this, options);
+ Writable.call(this, options);
+
+ if (options && options.readable === false) this.readable = false;
+
+ if (options && options.writable === false) this.writable = false;
+
+ this.allowHalfOpen = true;
+ if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
+
+ this.once('end', onend);
+}
+
+// the no-half-open enforcer
+function onend() {
+ // if we allow half-open state, or if the writable side ended,
+ // then we're ok.
+ if (this.allowHalfOpen || this._writableState.ended) return;
+
+ // no more data can be written.
+ // But allow more writes to happen in this tick.
+ processNextTick(onEndNT, this);
+}
+
+function onEndNT(self) {
+ self.end();
+}
+
+Object.defineProperty(Duplex.prototype, 'destroyed', {
+ get: function () {
+ if (this._readableState === undefined || this._writableState === undefined) {
+ return false;
+ }
+ return this._readableState.destroyed && this._writableState.destroyed;
+ },
+ set: function (value) {
+ // we ignore the value if the stream
+ // has not been initialized yet
+ if (this._readableState === undefined || this._writableState === undefined) {
+ return;
+ }
+
+ // backward compatibility, the user is explicitly
+ // managing destroyed
+ this._readableState.destroyed = value;
+ this._writableState.destroyed = value;
+ }
+});
+
+Duplex.prototype._destroy = function (err, cb) {
+ this.push(null);
+ this.end();
+
+ processNextTick(cb, err);
+};
+
+function forEach(xs, f) {
+ for (var i = 0, l = xs.length; i < l; i++) {
+ f(xs[i], i);
+ }
+}
+
+/***/ }),
+/* 81 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(76);
+var support = __webpack_require__(78);
+var nodejsUtils = __webpack_require__(88);
+var GenericWorker = __webpack_require__(77);
+
+/**
+ * The following functions come from pako, from pako/lib/utils/strings
+ * released under the MIT license, see pako https://github.com/nodeca/pako/
+ */
+
+// Table with utf8 lengths (calculated by first byte of sequence)
+// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
+// because max possible codepoint is 0x10ffff
+var _utf8len = new Array(256);
+for (var i=0; i<256; i++) {
+ _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);
+}
+_utf8len[254]=_utf8len[254]=1; // Invalid sequence start
+
+// convert string to array (typed, when possible)
+var string2buf = function (str) {
+ var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;
+
+ // count binary size
+ for (m_pos = 0; m_pos < str_len; m_pos++) {
+ c = str.charCodeAt(m_pos);
+ if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) {
+ c2 = str.charCodeAt(m_pos+1);
+ if ((c2 & 0xfc00) === 0xdc00) {
+ c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
+ m_pos++;
+ }
+ }
+ buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
+ }
+
+ // allocate buffer
+ if (support.uint8array) {
+ buf = new Uint8Array(buf_len);
+ } else {
+ buf = new Array(buf_len);
+ }
+
+ // convert
+ for (i=0, m_pos = 0; i < buf_len; m_pos++) {
+ c = str.charCodeAt(m_pos);
+ if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) {
+ c2 = str.charCodeAt(m_pos+1);
+ if ((c2 & 0xfc00) === 0xdc00) {
+ c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
+ m_pos++;
+ }
+ }
+ if (c < 0x80) {
+ /* one byte */
+ buf[i++] = c;
+ } else if (c < 0x800) {
+ /* two bytes */
+ buf[i++] = 0xC0 | (c >>> 6);
+ buf[i++] = 0x80 | (c & 0x3f);
+ } else if (c < 0x10000) {
+ /* three bytes */
+ buf[i++] = 0xE0 | (c >>> 12);
+ buf[i++] = 0x80 | (c >>> 6 & 0x3f);
+ buf[i++] = 0x80 | (c & 0x3f);
+ } else {
+ /* four bytes */
+ buf[i++] = 0xf0 | (c >>> 18);
+ buf[i++] = 0x80 | (c >>> 12 & 0x3f);
+ buf[i++] = 0x80 | (c >>> 6 & 0x3f);
+ buf[i++] = 0x80 | (c & 0x3f);
+ }
+ }
+
+ return buf;
+};
+
+// Calculate max possible position in utf8 buffer,
+// that will not break sequence. If that's not possible
+// - (very small limits) return max size as is.
+//
+// buf[] - utf8 bytes array
+// max - length limit (mandatory);
+var utf8border = function(buf, max) {
+ var pos;
+
+ max = max || buf.length;
+ if (max > buf.length) { max = buf.length; }
+
+ // go back from last position, until start of sequence found
+ pos = max-1;
+ while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }
+
+ // Fuckup - very small and broken sequence,
+ // return max, because we should return something anyway.
+ if (pos < 0) { return max; }
+
+ // If we came to start of buffer - that means vuffer is too small,
+ // return max too.
+ if (pos === 0) { return max; }
+
+ return (pos + _utf8len[buf[pos]] > max) ? pos : max;
+};
+
+// convert array to string
+var buf2string = function (buf) {
+ var str, i, out, c, c_len;
+ var len = buf.length;
+
+ // Reserve max possible length (2 words per char)
+ // NB: by unknown reasons, Array is significantly faster for
+ // String.fromCharCode.apply than Uint16Array.
+ var utf16buf = new Array(len*2);
+
+ for (out=0, i=0; i 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; }
+
+ // apply mask on first byte
+ c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;
+ // join the rest
+ while (c_len > 1 && i < len) {
+ c = (c << 6) | (buf[i++] & 0x3f);
+ c_len--;
+ }
+
+ // terminated by end of string?
+ if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }
+
+ if (c < 0x10000) {
+ utf16buf[out++] = c;
+ } else {
+ c -= 0x10000;
+ utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);
+ utf16buf[out++] = 0xdc00 | (c & 0x3ff);
+ }
+ }
+
+ // shrinkBuf(utf16buf, out)
+ if (utf16buf.length !== out) {
+ if(utf16buf.subarray) {
+ utf16buf = utf16buf.subarray(0, out);
+ } else {
+ utf16buf.length = out;
+ }
+ }
+
+ // return String.fromCharCode.apply(null, utf16buf);
+ return utils.applyFromCharCode(utf16buf);
+};
+
+
+// That's all for the pako functions.
+
+
+/**
+ * Transform a javascript string into an array (typed if possible) of bytes,
+ * UTF-8 encoded.
+ * @param {String} str the string to encode
+ * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string.
+ */
+exports.utf8encode = function utf8encode(str) {
+ if (support.nodebuffer) {
+ return nodejsUtils.newBufferFrom(str, "utf-8");
+ }
+
+ return string2buf(str);
+};
+
+
+/**
+ * Transform a bytes array (or a representation) representing an UTF-8 encoded
+ * string into a javascript string.
+ * @param {Array|Uint8Array|Buffer} buf the data de decode
+ * @return {String} the decoded string.
+ */
+exports.utf8decode = function utf8decode(buf) {
+ if (support.nodebuffer) {
+ return utils.transformTo("nodebuffer", buf).toString("utf-8");
+ }
+
+ buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf);
+
+ return buf2string(buf);
+};
+
+/**
+ * A worker to decode utf8 encoded binary chunks into string chunks.
+ * @constructor
+ */
+function Utf8DecodeWorker() {
+ GenericWorker.call(this, "utf-8 decode");
+ // the last bytes if a chunk didn't end with a complete codepoint.
+ this.leftOver = null;
+}
+utils.inherits(Utf8DecodeWorker, GenericWorker);
+
+/**
+ * @see GenericWorker.processChunk
+ */
+Utf8DecodeWorker.prototype.processChunk = function (chunk) {
+
+ var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data);
+
+ // 1st step, re-use what's left of the previous chunk
+ if (this.leftOver && this.leftOver.length) {
+ if(support.uint8array) {
+ var previousData = data;
+ data = new Uint8Array(previousData.length + this.leftOver.length);
+ data.set(this.leftOver, 0);
+ data.set(previousData, this.leftOver.length);
+ } else {
+ data = this.leftOver.concat(data);
+ }
+ this.leftOver = null;
+ }
+
+ var nextBoundary = utf8border(data);
+ var usableData = data;
+ if (nextBoundary !== data.length) {
+ if (support.uint8array) {
+ usableData = data.subarray(0, nextBoundary);
+ this.leftOver = data.subarray(nextBoundary, data.length);
+ } else {
+ usableData = data.slice(0, nextBoundary);
+ this.leftOver = data.slice(nextBoundary, data.length);
+ }
+ }
+
+ this.push({
+ data : exports.utf8decode(usableData),
+ meta : chunk.meta
+ });
+};
+
+/**
+ * @see GenericWorker.flush
+ */
+Utf8DecodeWorker.prototype.flush = function () {
+ if(this.leftOver && this.leftOver.length) {
+ this.push({
+ data : exports.utf8decode(this.leftOver),
+ meta : {}
+ });
+ this.leftOver = null;
+ }
+};
+exports.Utf8DecodeWorker = Utf8DecodeWorker;
+
+/**
+ * A worker to endcode string chunks into utf8 encoded binary chunks.
+ * @constructor
+ */
+function Utf8EncodeWorker() {
+ GenericWorker.call(this, "utf-8 encode");
+}
+utils.inherits(Utf8EncodeWorker, GenericWorker);
+
+/**
+ * @see GenericWorker.processChunk
+ */
+Utf8EncodeWorker.prototype.processChunk = function (chunk) {
+ this.push({
+ data : exports.utf8encode(chunk.data),
+ meta : chunk.meta
+ });
+};
+exports.Utf8EncodeWorker = Utf8EncodeWorker;
+
+
+/***/ }),
+/* 82 */
+/***/ (function(module, exports) {
+
+if (typeof Object.create === 'function') {
+ // implementation from standard node.js 'util' module
+ module.exports = function inherits(ctor, superCtor) {
+ ctor.super_ = superCtor
+ ctor.prototype = Object.create(superCtor.prototype, {
+ constructor: {
+ value: ctor,
+ enumerable: false,
+ writable: true,
+ configurable: true
+ }
+ });
+ };
+} else {
+ // old school shim for old browsers
+ module.exports = function inherits(ctor, superCtor) {
+ ctor.super_ = superCtor
+ var TempCtor = function () {}
+ TempCtor.prototype = superCtor.prototype
+ ctor.prototype = new TempCtor()
+ ctor.prototype.constructor = ctor
+ }
+}
+
+
+/***/ }),
+/* 83 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(global) {/*!
+ * The buffer module from node.js, for the browser.
+ *
+ * @author Feross Aboukhadijeh
+ * @license MIT
+ */
+/* eslint-disable no-proto */
+
+
+
+var base64 = __webpack_require__(129)
+var ieee754 = __webpack_require__(130)
+var isArray = __webpack_require__(98)
+
+exports.Buffer = Buffer
+exports.SlowBuffer = SlowBuffer
+exports.INSPECT_MAX_BYTES = 50
+
+/**
+ * If `Buffer.TYPED_ARRAY_SUPPORT`:
+ * === true Use Uint8Array implementation (fastest)
+ * === false Use Object implementation (most compatible, even IE6)
+ *
+ * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
+ * Opera 11.6+, iOS 4.2+.
+ *
+ * Due to various browser bugs, sometimes the Object implementation will be used even
+ * when the browser supports typed arrays.
+ *
+ * Note:
+ *
+ * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
+ * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
+ *
+ * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
+ *
+ * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
+ * incorrect length in some situations.
+
+ * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
+ * get the Object implementation, which is slower but behaves correctly.
+ */
+Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
+ ? global.TYPED_ARRAY_SUPPORT
+ : typedArraySupport()
+
+/*
+ * Export kMaxLength after typed array support is determined.
+ */
+exports.kMaxLength = kMaxLength()
+
+function typedArraySupport () {
+ try {
+ var arr = new Uint8Array(1)
+ arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
+ return arr.foo() === 42 && // typed array instances can be augmented
+ typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
+ arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
+ } catch (e) {
+ return false
+ }
+}
+
+function kMaxLength () {
+ return Buffer.TYPED_ARRAY_SUPPORT
+ ? 0x7fffffff
+ : 0x3fffffff
+}
+
+function createBuffer (that, length) {
+ if (kMaxLength() < length) {
+ throw new RangeError('Invalid typed array length')
+ }
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ // Return an augmented `Uint8Array` instance, for best performance
+ that = new Uint8Array(length)
+ that.__proto__ = Buffer.prototype
+ } else {
+ // Fallback: Return an object instance of the Buffer class
+ if (that === null) {
+ that = new Buffer(length)
+ }
+ that.length = length
+ }
+
+ return that
+}
+
+/**
+ * The Buffer constructor returns instances of `Uint8Array` that have their
+ * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
+ * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
+ * and the `Uint8Array` methods. Square bracket notation works as expected -- it
+ * returns a single octet.
+ *
+ * The `Uint8Array` prototype remains unmodified.
+ */
+
+function Buffer (arg, encodingOrOffset, length) {
+ if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
+ return new Buffer(arg, encodingOrOffset, length)
+ }
+
+ // Common case.
+ if (typeof arg === 'number') {
+ if (typeof encodingOrOffset === 'string') {
+ throw new Error(
+ 'If encoding is specified then the first argument must be a string'
+ )
+ }
+ return allocUnsafe(this, arg)
+ }
+ return from(this, arg, encodingOrOffset, length)
+}
+
+Buffer.poolSize = 8192 // not used by this implementation
+
+// TODO: Legacy, not needed anymore. Remove in next major version.
+Buffer._augment = function (arr) {
+ arr.__proto__ = Buffer.prototype
+ return arr
+}
+
+function from (that, value, encodingOrOffset, length) {
+ if (typeof value === 'number') {
+ throw new TypeError('"value" argument must not be a number')
+ }
+
+ if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
+ return fromArrayBuffer(that, value, encodingOrOffset, length)
+ }
+
+ if (typeof value === 'string') {
+ return fromString(that, value, encodingOrOffset)
+ }
+
+ return fromObject(that, value)
+}
+
+/**
+ * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
+ * if value is a number.
+ * Buffer.from(str[, encoding])
+ * Buffer.from(array)
+ * Buffer.from(buffer)
+ * Buffer.from(arrayBuffer[, byteOffset[, length]])
+ **/
+Buffer.from = function (value, encodingOrOffset, length) {
+ return from(null, value, encodingOrOffset, length)
+}
+
+if (Buffer.TYPED_ARRAY_SUPPORT) {
+ Buffer.prototype.__proto__ = Uint8Array.prototype
+ Buffer.__proto__ = Uint8Array
+ if (typeof Symbol !== 'undefined' && Symbol.species &&
+ Buffer[Symbol.species] === Buffer) {
+ // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
+ Object.defineProperty(Buffer, Symbol.species, {
+ value: null,
+ configurable: true
+ })
+ }
+}
+
+function assertSize (size) {
+ if (typeof size !== 'number') {
+ throw new TypeError('"size" argument must be a number')
+ } else if (size < 0) {
+ throw new RangeError('"size" argument must not be negative')
+ }
+}
+
+function alloc (that, size, fill, encoding) {
+ assertSize(size)
+ if (size <= 0) {
+ return createBuffer(that, size)
+ }
+ if (fill !== undefined) {
+ // Only pay attention to encoding if it's a string. This
+ // prevents accidentally sending in a number that would
+ // be interpretted as a start offset.
+ return typeof encoding === 'string'
+ ? createBuffer(that, size).fill(fill, encoding)
+ : createBuffer(that, size).fill(fill)
+ }
+ return createBuffer(that, size)
+}
+
+/**
+ * Creates a new filled Buffer instance.
+ * alloc(size[, fill[, encoding]])
+ **/
+Buffer.alloc = function (size, fill, encoding) {
+ return alloc(null, size, fill, encoding)
+}
+
+function allocUnsafe (that, size) {
+ assertSize(size)
+ that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
+ if (!Buffer.TYPED_ARRAY_SUPPORT) {
+ for (var i = 0; i < size; ++i) {
+ that[i] = 0
+ }
+ }
+ return that
+}
+
+/**
+ * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
+ * */
+Buffer.allocUnsafe = function (size) {
+ return allocUnsafe(null, size)
+}
+/**
+ * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
+ */
+Buffer.allocUnsafeSlow = function (size) {
+ return allocUnsafe(null, size)
+}
+
+function fromString (that, string, encoding) {
+ if (typeof encoding !== 'string' || encoding === '') {
+ encoding = 'utf8'
+ }
+
+ if (!Buffer.isEncoding(encoding)) {
+ throw new TypeError('"encoding" must be a valid string encoding')
+ }
+
+ var length = byteLength(string, encoding) | 0
+ that = createBuffer(that, length)
+
+ var actual = that.write(string, encoding)
+
+ if (actual !== length) {
+ // Writing a hex string, for example, that contains invalid characters will
+ // cause everything after the first invalid character to be ignored. (e.g.
+ // 'abxxcd' will be treated as 'ab')
+ that = that.slice(0, actual)
+ }
+
+ return that
+}
+
+function fromArrayLike (that, array) {
+ var length = array.length < 0 ? 0 : checked(array.length) | 0
+ that = createBuffer(that, length)
+ for (var i = 0; i < length; i += 1) {
+ that[i] = array[i] & 255
+ }
+ return that
+}
+
+function fromArrayBuffer (that, array, byteOffset, length) {
+ array.byteLength // this throws if `array` is not a valid ArrayBuffer
+
+ if (byteOffset < 0 || array.byteLength < byteOffset) {
+ throw new RangeError('\'offset\' is out of bounds')
+ }
+
+ if (array.byteLength < byteOffset + (length || 0)) {
+ throw new RangeError('\'length\' is out of bounds')
+ }
+
+ if (byteOffset === undefined && length === undefined) {
+ array = new Uint8Array(array)
+ } else if (length === undefined) {
+ array = new Uint8Array(array, byteOffset)
+ } else {
+ array = new Uint8Array(array, byteOffset, length)
+ }
+
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ // Return an augmented `Uint8Array` instance, for best performance
+ that = array
+ that.__proto__ = Buffer.prototype
+ } else {
+ // Fallback: Return an object instance of the Buffer class
+ that = fromArrayLike(that, array)
+ }
+ return that
+}
+
+function fromObject (that, obj) {
+ if (Buffer.isBuffer(obj)) {
+ var len = checked(obj.length) | 0
+ that = createBuffer(that, len)
+
+ if (that.length === 0) {
+ return that
+ }
+
+ obj.copy(that, 0, 0, len)
+ return that
+ }
+
+ if (obj) {
+ if ((typeof ArrayBuffer !== 'undefined' &&
+ obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
+ if (typeof obj.length !== 'number' || isnan(obj.length)) {
+ return createBuffer(that, 0)
+ }
+ return fromArrayLike(that, obj)
+ }
+
+ if (obj.type === 'Buffer' && isArray(obj.data)) {
+ return fromArrayLike(that, obj.data)
+ }
+ }
+
+ throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
+}
+
+function checked (length) {
+ // Note: cannot use `length < kMaxLength()` here because that fails when
+ // length is NaN (which is otherwise coerced to zero.)
+ if (length >= kMaxLength()) {
+ throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
+ 'size: 0x' + kMaxLength().toString(16) + ' bytes')
+ }
+ return length | 0
+}
+
+function SlowBuffer (length) {
+ if (+length != length) { // eslint-disable-line eqeqeq
+ length = 0
+ }
+ return Buffer.alloc(+length)
+}
+
+Buffer.isBuffer = function isBuffer (b) {
+ return !!(b != null && b._isBuffer)
+}
+
+Buffer.compare = function compare (a, b) {
+ if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
+ throw new TypeError('Arguments must be Buffers')
+ }
+
+ if (a === b) return 0
+
+ var x = a.length
+ var y = b.length
+
+ for (var i = 0, len = Math.min(x, y); i < len; ++i) {
+ if (a[i] !== b[i]) {
+ x = a[i]
+ y = b[i]
+ break
+ }
+ }
+
+ if (x < y) return -1
+ if (y < x) return 1
+ return 0
+}
+
+Buffer.isEncoding = function isEncoding (encoding) {
+ switch (String(encoding).toLowerCase()) {
+ case 'hex':
+ case 'utf8':
+ case 'utf-8':
+ case 'ascii':
+ case 'latin1':
+ case 'binary':
+ case 'base64':
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return true
+ default:
+ return false
+ }
+}
+
+Buffer.concat = function concat (list, length) {
+ if (!isArray(list)) {
+ throw new TypeError('"list" argument must be an Array of Buffers')
+ }
+
+ if (list.length === 0) {
+ return Buffer.alloc(0)
+ }
+
+ var i
+ if (length === undefined) {
+ length = 0
+ for (i = 0; i < list.length; ++i) {
+ length += list[i].length
+ }
+ }
+
+ var buffer = Buffer.allocUnsafe(length)
+ var pos = 0
+ for (i = 0; i < list.length; ++i) {
+ var buf = list[i]
+ if (!Buffer.isBuffer(buf)) {
+ throw new TypeError('"list" argument must be an Array of Buffers')
+ }
+ buf.copy(buffer, pos)
+ pos += buf.length
+ }
+ return buffer
+}
+
+function byteLength (string, encoding) {
+ if (Buffer.isBuffer(string)) {
+ return string.length
+ }
+ if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
+ (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
+ return string.byteLength
+ }
+ if (typeof string !== 'string') {
+ string = '' + string
+ }
+
+ var len = string.length
+ if (len === 0) return 0
+
+ // Use a for loop to avoid recursion
+ var loweredCase = false
+ for (;;) {
+ switch (encoding) {
+ case 'ascii':
+ case 'latin1':
+ case 'binary':
+ return len
+ case 'utf8':
+ case 'utf-8':
+ case undefined:
+ return utf8ToBytes(string).length
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return len * 2
+ case 'hex':
+ return len >>> 1
+ case 'base64':
+ return base64ToBytes(string).length
+ default:
+ if (loweredCase) return utf8ToBytes(string).length // assume utf8
+ encoding = ('' + encoding).toLowerCase()
+ loweredCase = true
+ }
+ }
+}
+Buffer.byteLength = byteLength
+
+function slowToString (encoding, start, end) {
+ var loweredCase = false
+
+ // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
+ // property of a typed array.
+
+ // This behaves neither like String nor Uint8Array in that we set start/end
+ // to their upper/lower bounds if the value passed is out of range.
+ // undefined is handled specially as per ECMA-262 6th Edition,
+ // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
+ if (start === undefined || start < 0) {
+ start = 0
+ }
+ // Return early if start > this.length. Done here to prevent potential uint32
+ // coercion fail below.
+ if (start > this.length) {
+ return ''
+ }
+
+ if (end === undefined || end > this.length) {
+ end = this.length
+ }
+
+ if (end <= 0) {
+ return ''
+ }
+
+ // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
+ end >>>= 0
+ start >>>= 0
+
+ if (end <= start) {
+ return ''
+ }
+
+ if (!encoding) encoding = 'utf8'
+
+ while (true) {
+ switch (encoding) {
+ case 'hex':
+ return hexSlice(this, start, end)
+
+ case 'utf8':
+ case 'utf-8':
+ return utf8Slice(this, start, end)
+
+ case 'ascii':
+ return asciiSlice(this, start, end)
+
+ case 'latin1':
+ case 'binary':
+ return latin1Slice(this, start, end)
+
+ case 'base64':
+ return base64Slice(this, start, end)
+
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return utf16leSlice(this, start, end)
+
+ default:
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
+ encoding = (encoding + '').toLowerCase()
+ loweredCase = true
+ }
+ }
+}
+
+// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
+// Buffer instances.
+Buffer.prototype._isBuffer = true
+
+function swap (b, n, m) {
+ var i = b[n]
+ b[n] = b[m]
+ b[m] = i
+}
+
+Buffer.prototype.swap16 = function swap16 () {
+ var len = this.length
+ if (len % 2 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 16-bits')
+ }
+ for (var i = 0; i < len; i += 2) {
+ swap(this, i, i + 1)
+ }
+ return this
+}
+
+Buffer.prototype.swap32 = function swap32 () {
+ var len = this.length
+ if (len % 4 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 32-bits')
+ }
+ for (var i = 0; i < len; i += 4) {
+ swap(this, i, i + 3)
+ swap(this, i + 1, i + 2)
+ }
+ return this
+}
+
+Buffer.prototype.swap64 = function swap64 () {
+ var len = this.length
+ if (len % 8 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 64-bits')
+ }
+ for (var i = 0; i < len; i += 8) {
+ swap(this, i, i + 7)
+ swap(this, i + 1, i + 6)
+ swap(this, i + 2, i + 5)
+ swap(this, i + 3, i + 4)
+ }
+ return this
+}
+
+Buffer.prototype.toString = function toString () {
+ var length = this.length | 0
+ if (length === 0) return ''
+ if (arguments.length === 0) return utf8Slice(this, 0, length)
+ return slowToString.apply(this, arguments)
+}
+
+Buffer.prototype.equals = function equals (b) {
+ if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
+ if (this === b) return true
+ return Buffer.compare(this, b) === 0
+}
+
+Buffer.prototype.inspect = function inspect () {
+ var str = ''
+ var max = exports.INSPECT_MAX_BYTES
+ if (this.length > 0) {
+ str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
+ if (this.length > max) str += ' ... '
+ }
+ return ''
+}
+
+Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
+ if (!Buffer.isBuffer(target)) {
+ throw new TypeError('Argument must be a Buffer')
+ }
+
+ if (start === undefined) {
+ start = 0
+ }
+ if (end === undefined) {
+ end = target ? target.length : 0
+ }
+ if (thisStart === undefined) {
+ thisStart = 0
+ }
+ if (thisEnd === undefined) {
+ thisEnd = this.length
+ }
+
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
+ throw new RangeError('out of range index')
+ }
+
+ if (thisStart >= thisEnd && start >= end) {
+ return 0
+ }
+ if (thisStart >= thisEnd) {
+ return -1
+ }
+ if (start >= end) {
+ return 1
+ }
+
+ start >>>= 0
+ end >>>= 0
+ thisStart >>>= 0
+ thisEnd >>>= 0
+
+ if (this === target) return 0
+
+ var x = thisEnd - thisStart
+ var y = end - start
+ var len = Math.min(x, y)
+
+ var thisCopy = this.slice(thisStart, thisEnd)
+ var targetCopy = target.slice(start, end)
+
+ for (var i = 0; i < len; ++i) {
+ if (thisCopy[i] !== targetCopy[i]) {
+ x = thisCopy[i]
+ y = targetCopy[i]
+ break
+ }
+ }
+
+ if (x < y) return -1
+ if (y < x) return 1
+ return 0
+}
+
+// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
+// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
+//
+// Arguments:
+// - buffer - a Buffer to search
+// - val - a string, Buffer, or number
+// - byteOffset - an index into `buffer`; will be clamped to an int32
+// - encoding - an optional encoding, relevant is val is a string
+// - dir - true for indexOf, false for lastIndexOf
+function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
+ // Empty buffer means no match
+ if (buffer.length === 0) return -1
+
+ // Normalize byteOffset
+ if (typeof byteOffset === 'string') {
+ encoding = byteOffset
+ byteOffset = 0
+ } else if (byteOffset > 0x7fffffff) {
+ byteOffset = 0x7fffffff
+ } else if (byteOffset < -0x80000000) {
+ byteOffset = -0x80000000
+ }
+ byteOffset = +byteOffset // Coerce to Number.
+ if (isNaN(byteOffset)) {
+ // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
+ byteOffset = dir ? 0 : (buffer.length - 1)
+ }
+
+ // Normalize byteOffset: negative offsets start from the end of the buffer
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset
+ if (byteOffset >= buffer.length) {
+ if (dir) return -1
+ else byteOffset = buffer.length - 1
+ } else if (byteOffset < 0) {
+ if (dir) byteOffset = 0
+ else return -1
+ }
+
+ // Normalize val
+ if (typeof val === 'string') {
+ val = Buffer.from(val, encoding)
+ }
+
+ // Finally, search either indexOf (if dir is true) or lastIndexOf
+ if (Buffer.isBuffer(val)) {
+ // Special case: looking for empty string/buffer always fails
+ if (val.length === 0) {
+ return -1
+ }
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
+ } else if (typeof val === 'number') {
+ val = val & 0xFF // Search for a byte value [0-255]
+ if (Buffer.TYPED_ARRAY_SUPPORT &&
+ typeof Uint8Array.prototype.indexOf === 'function') {
+ if (dir) {
+ return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
+ } else {
+ return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
+ }
+ }
+ return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
+ }
+
+ throw new TypeError('val must be string, number or Buffer')
+}
+
+function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
+ var indexSize = 1
+ var arrLength = arr.length
+ var valLength = val.length
+
+ if (encoding !== undefined) {
+ encoding = String(encoding).toLowerCase()
+ if (encoding === 'ucs2' || encoding === 'ucs-2' ||
+ encoding === 'utf16le' || encoding === 'utf-16le') {
+ if (arr.length < 2 || val.length < 2) {
+ return -1
+ }
+ indexSize = 2
+ arrLength /= 2
+ valLength /= 2
+ byteOffset /= 2
+ }
+ }
+
+ function read (buf, i) {
+ if (indexSize === 1) {
+ return buf[i]
+ } else {
+ return buf.readUInt16BE(i * indexSize)
+ }
+ }
+
+ var i
+ if (dir) {
+ var foundIndex = -1
+ for (i = byteOffset; i < arrLength; i++) {
+ if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
+ if (foundIndex === -1) foundIndex = i
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
+ } else {
+ if (foundIndex !== -1) i -= i - foundIndex
+ foundIndex = -1
+ }
+ }
+ } else {
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
+ for (i = byteOffset; i >= 0; i--) {
+ var found = true
+ for (var j = 0; j < valLength; j++) {
+ if (read(arr, i + j) !== read(val, j)) {
+ found = false
+ break
+ }
+ }
+ if (found) return i
+ }
+ }
+
+ return -1
+}
+
+Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
+ return this.indexOf(val, byteOffset, encoding) !== -1
+}
+
+Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
+}
+
+Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
+}
+
+function hexWrite (buf, string, offset, length) {
+ offset = Number(offset) || 0
+ var remaining = buf.length - offset
+ if (!length) {
+ length = remaining
+ } else {
+ length = Number(length)
+ if (length > remaining) {
+ length = remaining
+ }
+ }
+
+ // must be an even number of digits
+ var strLen = string.length
+ if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
+
+ if (length > strLen / 2) {
+ length = strLen / 2
+ }
+ for (var i = 0; i < length; ++i) {
+ var parsed = parseInt(string.substr(i * 2, 2), 16)
+ if (isNaN(parsed)) return i
+ buf[offset + i] = parsed
+ }
+ return i
+}
+
+function utf8Write (buf, string, offset, length) {
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
+}
+
+function asciiWrite (buf, string, offset, length) {
+ return blitBuffer(asciiToBytes(string), buf, offset, length)
+}
+
+function latin1Write (buf, string, offset, length) {
+ return asciiWrite(buf, string, offset, length)
+}
+
+function base64Write (buf, string, offset, length) {
+ return blitBuffer(base64ToBytes(string), buf, offset, length)
+}
+
+function ucs2Write (buf, string, offset, length) {
+ return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
+}
+
+Buffer.prototype.write = function write (string, offset, length, encoding) {
+ // Buffer#write(string)
+ if (offset === undefined) {
+ encoding = 'utf8'
+ length = this.length
+ offset = 0
+ // Buffer#write(string, encoding)
+ } else if (length === undefined && typeof offset === 'string') {
+ encoding = offset
+ length = this.length
+ offset = 0
+ // Buffer#write(string, offset[, length][, encoding])
+ } else if (isFinite(offset)) {
+ offset = offset | 0
+ if (isFinite(length)) {
+ length = length | 0
+ if (encoding === undefined) encoding = 'utf8'
+ } else {
+ encoding = length
+ length = undefined
+ }
+ // legacy write(string, encoding, offset, length) - remove in v0.13
+ } else {
+ throw new Error(
+ 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
+ )
+ }
+
+ var remaining = this.length - offset
+ if (length === undefined || length > remaining) length = remaining
+
+ if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
+ throw new RangeError('Attempt to write outside buffer bounds')
+ }
+
+ if (!encoding) encoding = 'utf8'
+
+ var loweredCase = false
+ for (;;) {
+ switch (encoding) {
+ case 'hex':
+ return hexWrite(this, string, offset, length)
+
+ case 'utf8':
+ case 'utf-8':
+ return utf8Write(this, string, offset, length)
+
+ case 'ascii':
+ return asciiWrite(this, string, offset, length)
+
+ case 'latin1':
+ case 'binary':
+ return latin1Write(this, string, offset, length)
+
+ case 'base64':
+ // Warning: maxLength not taken into account in base64Write
+ return base64Write(this, string, offset, length)
+
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return ucs2Write(this, string, offset, length)
+
+ default:
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
+ encoding = ('' + encoding).toLowerCase()
+ loweredCase = true
+ }
+ }
+}
+
+Buffer.prototype.toJSON = function toJSON () {
+ return {
+ type: 'Buffer',
+ data: Array.prototype.slice.call(this._arr || this, 0)
+ }
+}
+
+function base64Slice (buf, start, end) {
+ if (start === 0 && end === buf.length) {
+ return base64.fromByteArray(buf)
+ } else {
+ return base64.fromByteArray(buf.slice(start, end))
+ }
+}
+
+function utf8Slice (buf, start, end) {
+ end = Math.min(buf.length, end)
+ var res = []
+
+ var i = start
+ while (i < end) {
+ var firstByte = buf[i]
+ var codePoint = null
+ var bytesPerSequence = (firstByte > 0xEF) ? 4
+ : (firstByte > 0xDF) ? 3
+ : (firstByte > 0xBF) ? 2
+ : 1
+
+ if (i + bytesPerSequence <= end) {
+ var secondByte, thirdByte, fourthByte, tempCodePoint
+
+ switch (bytesPerSequence) {
+ case 1:
+ if (firstByte < 0x80) {
+ codePoint = firstByte
+ }
+ break
+ case 2:
+ secondByte = buf[i + 1]
+ if ((secondByte & 0xC0) === 0x80) {
+ tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
+ if (tempCodePoint > 0x7F) {
+ codePoint = tempCodePoint
+ }
+ }
+ break
+ case 3:
+ secondByte = buf[i + 1]
+ thirdByte = buf[i + 2]
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
+ tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
+ if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
+ codePoint = tempCodePoint
+ }
+ }
+ break
+ case 4:
+ secondByte = buf[i + 1]
+ thirdByte = buf[i + 2]
+ fourthByte = buf[i + 3]
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
+ tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
+ if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
+ codePoint = tempCodePoint
+ }
+ }
+ }
+ }
+
+ if (codePoint === null) {
+ // we did not generate a valid codePoint so insert a
+ // replacement char (U+FFFD) and advance only 1 byte
+ codePoint = 0xFFFD
+ bytesPerSequence = 1
+ } else if (codePoint > 0xFFFF) {
+ // encode to utf16 (surrogate pair dance)
+ codePoint -= 0x10000
+ res.push(codePoint >>> 10 & 0x3FF | 0xD800)
+ codePoint = 0xDC00 | codePoint & 0x3FF
+ }
+
+ res.push(codePoint)
+ i += bytesPerSequence
+ }
+
+ return decodeCodePointsArray(res)
+}
+
+// Based on http://stackoverflow.com/a/22747272/680742, the browser with
+// the lowest limit is Chrome, with 0x10000 args.
+// We go 1 magnitude less, for safety
+var MAX_ARGUMENTS_LENGTH = 0x1000
+
+function decodeCodePointsArray (codePoints) {
+ var len = codePoints.length
+ if (len <= MAX_ARGUMENTS_LENGTH) {
+ return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
+ }
+
+ // Decode in chunks to avoid "call stack size exceeded".
+ var res = ''
+ var i = 0
+ while (i < len) {
+ res += String.fromCharCode.apply(
+ String,
+ codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
+ )
+ }
+ return res
+}
+
+function asciiSlice (buf, start, end) {
+ var ret = ''
+ end = Math.min(buf.length, end)
+
+ for (var i = start; i < end; ++i) {
+ ret += String.fromCharCode(buf[i] & 0x7F)
+ }
+ return ret
+}
+
+function latin1Slice (buf, start, end) {
+ var ret = ''
+ end = Math.min(buf.length, end)
+
+ for (var i = start; i < end; ++i) {
+ ret += String.fromCharCode(buf[i])
+ }
+ return ret
+}
+
+function hexSlice (buf, start, end) {
+ var len = buf.length
+
+ if (!start || start < 0) start = 0
+ if (!end || end < 0 || end > len) end = len
+
+ var out = ''
+ for (var i = start; i < end; ++i) {
+ out += toHex(buf[i])
+ }
+ return out
+}
+
+function utf16leSlice (buf, start, end) {
+ var bytes = buf.slice(start, end)
+ var res = ''
+ for (var i = 0; i < bytes.length; i += 2) {
+ res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
+ }
+ return res
+}
+
+Buffer.prototype.slice = function slice (start, end) {
+ var len = this.length
+ start = ~~start
+ end = end === undefined ? len : ~~end
+
+ if (start < 0) {
+ start += len
+ if (start < 0) start = 0
+ } else if (start > len) {
+ start = len
+ }
+
+ if (end < 0) {
+ end += len
+ if (end < 0) end = 0
+ } else if (end > len) {
+ end = len
+ }
+
+ if (end < start) end = start
+
+ var newBuf
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ newBuf = this.subarray(start, end)
+ newBuf.__proto__ = Buffer.prototype
+ } else {
+ var sliceLen = end - start
+ newBuf = new Buffer(sliceLen, undefined)
+ for (var i = 0; i < sliceLen; ++i) {
+ newBuf[i] = this[i + start]
+ }
+ }
+
+ return newBuf
+}
+
+/*
+ * Need to make sure that buffer isn't trying to write out of bounds.
+ */
+function checkOffset (offset, ext, length) {
+ if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
+ if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
+}
+
+Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
+ offset = offset | 0
+ byteLength = byteLength | 0
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
+
+ var val = this[offset]
+ var mul = 1
+ var i = 0
+ while (++i < byteLength && (mul *= 0x100)) {
+ val += this[offset + i] * mul
+ }
+
+ return val
+}
+
+Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
+ offset = offset | 0
+ byteLength = byteLength | 0
+ if (!noAssert) {
+ checkOffset(offset, byteLength, this.length)
+ }
+
+ var val = this[offset + --byteLength]
+ var mul = 1
+ while (byteLength > 0 && (mul *= 0x100)) {
+ val += this[offset + --byteLength] * mul
+ }
+
+ return val
+}
+
+Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 1, this.length)
+ return this[offset]
+}
+
+Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ return this[offset] | (this[offset + 1] << 8)
+}
+
+Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ return (this[offset] << 8) | this[offset + 1]
+}
+
+Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return ((this[offset]) |
+ (this[offset + 1] << 8) |
+ (this[offset + 2] << 16)) +
+ (this[offset + 3] * 0x1000000)
+}
+
+Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return (this[offset] * 0x1000000) +
+ ((this[offset + 1] << 16) |
+ (this[offset + 2] << 8) |
+ this[offset + 3])
+}
+
+Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
+ offset = offset | 0
+ byteLength = byteLength | 0
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
+
+ var val = this[offset]
+ var mul = 1
+ var i = 0
+ while (++i < byteLength && (mul *= 0x100)) {
+ val += this[offset + i] * mul
+ }
+ mul *= 0x80
+
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength)
+
+ return val
+}
+
+Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
+ offset = offset | 0
+ byteLength = byteLength | 0
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
+
+ var i = byteLength
+ var mul = 1
+ var val = this[offset + --i]
+ while (i > 0 && (mul *= 0x100)) {
+ val += this[offset + --i] * mul
+ }
+ mul *= 0x80
+
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength)
+
+ return val
+}
+
+Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 1, this.length)
+ if (!(this[offset] & 0x80)) return (this[offset])
+ return ((0xff - this[offset] + 1) * -1)
+}
+
+Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ var val = this[offset] | (this[offset + 1] << 8)
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
+}
+
+Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ var val = this[offset + 1] | (this[offset] << 8)
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
+}
+
+Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return (this[offset]) |
+ (this[offset + 1] << 8) |
+ (this[offset + 2] << 16) |
+ (this[offset + 3] << 24)
+}
+
+Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return (this[offset] << 24) |
+ (this[offset + 1] << 16) |
+ (this[offset + 2] << 8) |
+ (this[offset + 3])
+}
+
+Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 4, this.length)
+ return ieee754.read(this, offset, true, 23, 4)
+}
+
+Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 4, this.length)
+ return ieee754.read(this, offset, false, 23, 4)
+}
+
+Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 8, this.length)
+ return ieee754.read(this, offset, true, 52, 8)
+}
+
+Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
+ if (!noAssert) checkOffset(offset, 8, this.length)
+ return ieee754.read(this, offset, false, 52, 8)
+}
+
+function checkInt (buf, value, offset, ext, max, min) {
+ if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
+ if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
+}
+
+Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset | 0
+ byteLength = byteLength | 0
+ if (!noAssert) {
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1
+ checkInt(this, value, offset, byteLength, maxBytes, 0)
+ }
+
+ var mul = 1
+ var i = 0
+ this[offset] = value & 0xFF
+ while (++i < byteLength && (mul *= 0x100)) {
+ this[offset + i] = (value / mul) & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset | 0
+ byteLength = byteLength | 0
+ if (!noAssert) {
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1
+ checkInt(this, value, offset, byteLength, maxBytes, 0)
+ }
+
+ var i = byteLength - 1
+ var mul = 1
+ this[offset + i] = value & 0xFF
+ while (--i >= 0 && (mul *= 0x100)) {
+ this[offset + i] = (value / mul) & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
+ if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
+ this[offset] = (value & 0xff)
+ return offset + 1
+}
+
+function objectWriteUInt16 (buf, value, offset, littleEndian) {
+ if (value < 0) value = 0xffff + value + 1
+ for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
+ buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
+ (littleEndian ? i : 1 - i) * 8
+ }
+}
+
+Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ this[offset] = (value & 0xff)
+ this[offset + 1] = (value >>> 8)
+ } else {
+ objectWriteUInt16(this, value, offset, true)
+ }
+ return offset + 2
+}
+
+Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ this[offset] = (value >>> 8)
+ this[offset + 1] = (value & 0xff)
+ } else {
+ objectWriteUInt16(this, value, offset, false)
+ }
+ return offset + 2
+}
+
+function objectWriteUInt32 (buf, value, offset, littleEndian) {
+ if (value < 0) value = 0xffffffff + value + 1
+ for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
+ buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
+ }
+}
+
+Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ this[offset + 3] = (value >>> 24)
+ this[offset + 2] = (value >>> 16)
+ this[offset + 1] = (value >>> 8)
+ this[offset] = (value & 0xff)
+ } else {
+ objectWriteUInt32(this, value, offset, true)
+ }
+ return offset + 4
+}
+
+Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ this[offset] = (value >>> 24)
+ this[offset + 1] = (value >>> 16)
+ this[offset + 2] = (value >>> 8)
+ this[offset + 3] = (value & 0xff)
+ } else {
+ objectWriteUInt32(this, value, offset, false)
+ }
+ return offset + 4
+}
+
+Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) {
+ var limit = Math.pow(2, 8 * byteLength - 1)
+
+ checkInt(this, value, offset, byteLength, limit - 1, -limit)
+ }
+
+ var i = 0
+ var mul = 1
+ var sub = 0
+ this[offset] = value & 0xFF
+ while (++i < byteLength && (mul *= 0x100)) {
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
+ sub = 1
+ }
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) {
+ var limit = Math.pow(2, 8 * byteLength - 1)
+
+ checkInt(this, value, offset, byteLength, limit - 1, -limit)
+ }
+
+ var i = byteLength - 1
+ var mul = 1
+ var sub = 0
+ this[offset + i] = value & 0xFF
+ while (--i >= 0 && (mul *= 0x100)) {
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
+ sub = 1
+ }
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
+ if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
+ if (value < 0) value = 0xff + value + 1
+ this[offset] = (value & 0xff)
+ return offset + 1
+}
+
+Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ this[offset] = (value & 0xff)
+ this[offset + 1] = (value >>> 8)
+ } else {
+ objectWriteUInt16(this, value, offset, true)
+ }
+ return offset + 2
+}
+
+Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ this[offset] = (value >>> 8)
+ this[offset + 1] = (value & 0xff)
+ } else {
+ objectWriteUInt16(this, value, offset, false)
+ }
+ return offset + 2
+}
+
+Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ this[offset] = (value & 0xff)
+ this[offset + 1] = (value >>> 8)
+ this[offset + 2] = (value >>> 16)
+ this[offset + 3] = (value >>> 24)
+ } else {
+ objectWriteUInt32(this, value, offset, true)
+ }
+ return offset + 4
+}
+
+Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
+ value = +value
+ offset = offset | 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
+ if (value < 0) value = 0xffffffff + value + 1
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
+ this[offset] = (value >>> 24)
+ this[offset + 1] = (value >>> 16)
+ this[offset + 2] = (value >>> 8)
+ this[offset + 3] = (value & 0xff)
+ } else {
+ objectWriteUInt32(this, value, offset, false)
+ }
+ return offset + 4
+}
+
+function checkIEEE754 (buf, value, offset, ext, max, min) {
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
+ if (offset < 0) throw new RangeError('Index out of range')
+}
+
+function writeFloat (buf, value, offset, littleEndian, noAssert) {
+ if (!noAssert) {
+ checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
+ }
+ ieee754.write(buf, value, offset, littleEndian, 23, 4)
+ return offset + 4
+}
+
+Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
+ return writeFloat(this, value, offset, true, noAssert)
+}
+
+Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
+ return writeFloat(this, value, offset, false, noAssert)
+}
+
+function writeDouble (buf, value, offset, littleEndian, noAssert) {
+ if (!noAssert) {
+ checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
+ }
+ ieee754.write(buf, value, offset, littleEndian, 52, 8)
+ return offset + 8
+}
+
+Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
+ return writeDouble(this, value, offset, true, noAssert)
+}
+
+Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
+ return writeDouble(this, value, offset, false, noAssert)
+}
+
+// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
+Buffer.prototype.copy = function copy (target, targetStart, start, end) {
+ if (!start) start = 0
+ if (!end && end !== 0) end = this.length
+ if (targetStart >= target.length) targetStart = target.length
+ if (!targetStart) targetStart = 0
+ if (end > 0 && end < start) end = start
+
+ // Copy 0 bytes; we're done
+ if (end === start) return 0
+ if (target.length === 0 || this.length === 0) return 0
+
+ // Fatal error conditions
+ if (targetStart < 0) {
+ throw new RangeError('targetStart out of bounds')
+ }
+ if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
+ if (end < 0) throw new RangeError('sourceEnd out of bounds')
+
+ // Are we oob?
+ if (end > this.length) end = this.length
+ if (target.length - targetStart < end - start) {
+ end = target.length - targetStart + start
+ }
+
+ var len = end - start
+ var i
+
+ if (this === target && start < targetStart && targetStart < end) {
+ // descending copy from end
+ for (i = len - 1; i >= 0; --i) {
+ target[i + targetStart] = this[i + start]
+ }
+ } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
+ // ascending copy from start
+ for (i = 0; i < len; ++i) {
+ target[i + targetStart] = this[i + start]
+ }
+ } else {
+ Uint8Array.prototype.set.call(
+ target,
+ this.subarray(start, start + len),
+ targetStart
+ )
+ }
+
+ return len
+}
+
+// Usage:
+// buffer.fill(number[, offset[, end]])
+// buffer.fill(buffer[, offset[, end]])
+// buffer.fill(string[, offset[, end]][, encoding])
+Buffer.prototype.fill = function fill (val, start, end, encoding) {
+ // Handle string cases:
+ if (typeof val === 'string') {
+ if (typeof start === 'string') {
+ encoding = start
+ start = 0
+ end = this.length
+ } else if (typeof end === 'string') {
+ encoding = end
+ end = this.length
+ }
+ if (val.length === 1) {
+ var code = val.charCodeAt(0)
+ if (code < 256) {
+ val = code
+ }
+ }
+ if (encoding !== undefined && typeof encoding !== 'string') {
+ throw new TypeError('encoding must be a string')
+ }
+ if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
+ throw new TypeError('Unknown encoding: ' + encoding)
+ }
+ } else if (typeof val === 'number') {
+ val = val & 255
+ }
+
+ // Invalid ranges are not set to a default, so can range check early.
+ if (start < 0 || this.length < start || this.length < end) {
+ throw new RangeError('Out of range index')
+ }
+
+ if (end <= start) {
+ return this
+ }
+
+ start = start >>> 0
+ end = end === undefined ? this.length : end >>> 0
+
+ if (!val) val = 0
+
+ var i
+ if (typeof val === 'number') {
+ for (i = start; i < end; ++i) {
+ this[i] = val
+ }
+ } else {
+ var bytes = Buffer.isBuffer(val)
+ ? val
+ : utf8ToBytes(new Buffer(val, encoding).toString())
+ var len = bytes.length
+ for (i = 0; i < end - start; ++i) {
+ this[i + start] = bytes[i % len]
+ }
+ }
+
+ return this
+}
+
+// HELPER FUNCTIONS
+// ================
+
+var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
+
+function base64clean (str) {
+ // Node strips out invalid characters like \n and \t from the string, base64-js does not
+ str = stringtrim(str).replace(INVALID_BASE64_RE, '')
+ // Node converts strings with length < 2 to ''
+ if (str.length < 2) return ''
+ // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
+ while (str.length % 4 !== 0) {
+ str = str + '='
+ }
+ return str
+}
+
+function stringtrim (str) {
+ if (str.trim) return str.trim()
+ return str.replace(/^\s+|\s+$/g, '')
+}
+
+function toHex (n) {
+ if (n < 16) return '0' + n.toString(16)
+ return n.toString(16)
+}
+
+function utf8ToBytes (string, units) {
+ units = units || Infinity
+ var codePoint
+ var length = string.length
+ var leadSurrogate = null
+ var bytes = []
+
+ for (var i = 0; i < length; ++i) {
+ codePoint = string.charCodeAt(i)
+
+ // is surrogate component
+ if (codePoint > 0xD7FF && codePoint < 0xE000) {
+ // last char was a lead
+ if (!leadSurrogate) {
+ // no lead yet
+ if (codePoint > 0xDBFF) {
+ // unexpected trail
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ continue
+ } else if (i + 1 === length) {
+ // unpaired lead
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ continue
+ }
+
+ // valid lead
+ leadSurrogate = codePoint
+
+ continue
+ }
+
+ // 2 leads in a row
+ if (codePoint < 0xDC00) {
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ leadSurrogate = codePoint
+ continue
+ }
+
+ // valid surrogate pair
+ codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
+ } else if (leadSurrogate) {
+ // valid bmp char, but last char was a lead
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ }
+
+ leadSurrogate = null
+
+ // encode utf8
+ if (codePoint < 0x80) {
+ if ((units -= 1) < 0) break
+ bytes.push(codePoint)
+ } else if (codePoint < 0x800) {
+ if ((units -= 2) < 0) break
+ bytes.push(
+ codePoint >> 0x6 | 0xC0,
+ codePoint & 0x3F | 0x80
+ )
+ } else if (codePoint < 0x10000) {
+ if ((units -= 3) < 0) break
+ bytes.push(
+ codePoint >> 0xC | 0xE0,
+ codePoint >> 0x6 & 0x3F | 0x80,
+ codePoint & 0x3F | 0x80
+ )
+ } else if (codePoint < 0x110000) {
+ if ((units -= 4) < 0) break
+ bytes.push(
+ codePoint >> 0x12 | 0xF0,
+ codePoint >> 0xC & 0x3F | 0x80,
+ codePoint >> 0x6 & 0x3F | 0x80,
+ codePoint & 0x3F | 0x80
+ )
+ } else {
+ throw new Error('Invalid code point')
+ }
+ }
+
+ return bytes
+}
+
+function asciiToBytes (str) {
+ var byteArray = []
+ for (var i = 0; i < str.length; ++i) {
+ // Node's code seems to be doing this and not & 0x7F..
+ byteArray.push(str.charCodeAt(i) & 0xFF)
+ }
+ return byteArray
+}
+
+function utf16leToBytes (str, units) {
+ var c, hi, lo
+ var byteArray = []
+ for (var i = 0; i < str.length; ++i) {
+ if ((units -= 2) < 0) break
+
+ c = str.charCodeAt(i)
+ hi = c >> 8
+ lo = c % 256
+ byteArray.push(lo)
+ byteArray.push(hi)
+ }
+
+ return byteArray
+}
+
+function base64ToBytes (str) {
+ return base64.toByteArray(base64clean(str))
+}
+
+function blitBuffer (src, dst, offset, length) {
+ for (var i = 0; i < length; ++i) {
+ if ((i + offset >= dst.length) || (i >= src.length)) break
+ dst[i + offset] = src[i]
+ }
+ return i
+}
+
+function isnan (val) {
+ return val !== val // eslint-disable-line no-self-compare
+}
+
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(40)))
+
+/***/ }),
+/* 84 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// NOTE: These type checking functions intentionally don't use `instanceof`
+// because it is fragile and can be easily faked with `Object.create()`.
+
+function isArray(arg) {
+ if (Array.isArray) {
+ return Array.isArray(arg);
+ }
+ return objectToString(arg) === '[object Array]';
+}
+exports.isArray = isArray;
+
+function isBoolean(arg) {
+ return typeof arg === 'boolean';
+}
+exports.isBoolean = isBoolean;
+
+function isNull(arg) {
+ return arg === null;
+}
+exports.isNull = isNull;
+
+function isNullOrUndefined(arg) {
+ return arg == null;
+}
+exports.isNullOrUndefined = isNullOrUndefined;
+
+function isNumber(arg) {
+ return typeof arg === 'number';
+}
+exports.isNumber = isNumber;
+
+function isString(arg) {
+ return typeof arg === 'string';
+}
+exports.isString = isString;
+
+function isSymbol(arg) {
+ return typeof arg === 'symbol';
+}
+exports.isSymbol = isSymbol;
+
+function isUndefined(arg) {
+ return arg === void 0;
+}
+exports.isUndefined = isUndefined;
+
+function isRegExp(re) {
+ return objectToString(re) === '[object RegExp]';
+}
+exports.isRegExp = isRegExp;
+
+function isObject(arg) {
+ return typeof arg === 'object' && arg !== null;
+}
+exports.isObject = isObject;
+
+function isDate(d) {
+ return objectToString(d) === '[object Date]';
+}
+exports.isDate = isDate;
+
+function isError(e) {
+ return (objectToString(e) === '[object Error]' || e instanceof Error);
+}
+exports.isError = isError;
+
+function isFunction(arg) {
+ return typeof arg === 'function';
+}
+exports.isFunction = isFunction;
+
+function isPrimitive(arg) {
+ return arg === null ||
+ typeof arg === 'boolean' ||
+ typeof arg === 'number' ||
+ typeof arg === 'string' ||
+ typeof arg === 'symbol' || // ES6 symbol
+ typeof arg === 'undefined';
+}
+exports.isPrimitive = isPrimitive;
+
+exports.isBuffer = Buffer.isBuffer;
+
+function objectToString(o) {
+ return Object.prototype.toString.call(o);
+}
+
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(83).Buffer))
+
+/***/ }),
+/* 85 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* global Promise */
+
+
+// load the global object first:
+// - it should be better integrated in the system (unhandledRejection in node)
+// - the environment may have a custom Promise implementation (see zone.js)
+var ES6Promise = null;
+if (typeof Promise !== "undefined") {
+ ES6Promise = Promise;
+} else {
+ ES6Promise = __webpack_require__(155);
+}
+
+/**
+ * Let the user use/change some implementations.
+ */
+module.exports = {
+ Promise: ES6Promise
+};
+
+
+/***/ }),
+/* 86 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(process) {
+
+if (!process.version ||
+ process.version.indexOf('v0.') === 0 ||
+ process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
+ module.exports = { nextTick: nextTick };
+} else {
+ module.exports = process
+}
+
+function nextTick(fn, arg1, arg2, arg3) {
+ if (typeof fn !== 'function') {
+ throw new TypeError('"callback" argument must be a function');
+ }
+ var len = arguments.length;
+ var args, i;
+ switch (len) {
+ case 0:
+ case 1:
+ return process.nextTick(fn);
+ case 2:
+ return process.nextTick(function afterTickOne() {
+ fn.call(null, arg1);
+ });
+ case 3:
+ return process.nextTick(function afterTickTwo() {
+ fn.call(null, arg1, arg2);
+ });
+ case 4:
+ return process.nextTick(function afterTickThree() {
+ fn.call(null, arg1, arg2, arg3);
+ });
+ default:
+ args = new Array(len - 1);
+ i = 0;
+ while (i < args.length) {
+ args[i++] = arguments[i];
+ }
+ return process.nextTick(function afterTick() {
+ fn.apply(null, args);
+ });
+ }
+}
+
+
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(48)))
+
+/***/ }),
+/* 87 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/* eslint-disable node/no-deprecated-api */
+var buffer = __webpack_require__(83)
+var Buffer = buffer.Buffer
+
+// alternative to using Object.keys for old browsers
+function copyProps (src, dst) {
+ for (var key in src) {
+ dst[key] = src[key]
+ }
+}
+if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
+ module.exports = buffer
+} else {
+ // Copy properties from require('buffer')
+ copyProps(buffer, exports)
+ exports.Buffer = SafeBuffer
+}
+
+function SafeBuffer (arg, encodingOrOffset, length) {
+ return Buffer(arg, encodingOrOffset, length)
+}
+
+// Copy static methods from Buffer
+copyProps(Buffer, SafeBuffer)
+
+SafeBuffer.from = function (arg, encodingOrOffset, length) {
+ if (typeof arg === 'number') {
+ throw new TypeError('Argument must not be a number')
+ }
+ return Buffer(arg, encodingOrOffset, length)
+}
+
+SafeBuffer.alloc = function (size, fill, encoding) {
+ if (typeof size !== 'number') {
+ throw new TypeError('Argument must be a number')
+ }
+ var buf = Buffer(size)
+ if (fill !== undefined) {
+ if (typeof encoding === 'string') {
+ buf.fill(fill, encoding)
+ } else {
+ buf.fill(fill)
+ }
+ } else {
+ buf.fill(0)
+ }
+ return buf
+}
+
+SafeBuffer.allocUnsafe = function (size) {
+ if (typeof size !== 'number') {
+ throw new TypeError('Argument must be a number')
+ }
+ return Buffer(size)
+}
+
+SafeBuffer.allocUnsafeSlow = function (size) {
+ if (typeof size !== 'number') {
+ throw new TypeError('Argument must be a number')
+ }
+ return buffer.SlowBuffer(size)
+}
+
+
+/***/ }),
+/* 88 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(Buffer) {
+
+module.exports = {
+ /**
+ * True if this is running in Nodejs, will be undefined in a browser.
+ * In a browser, browserify won't include this file and the whole module
+ * will be resolved an empty object.
+ */
+ isNode : typeof Buffer !== "undefined",
+ /**
+ * Create a new nodejs Buffer from an existing content.
+ * @param {Object} data the data to pass to the constructor.
+ * @param {String} encoding the encoding to use.
+ * @return {Buffer} a new Buffer.
+ */
+ newBufferFrom: function(data, encoding) {
+ // XXX We can't use `Buffer.from` which comes from `Uint8Array.from`
+ // in nodejs v4 (< v.4.5). It's not the expected implementation (and
+ // has a different signature).
+ // see https://github.com/nodejs/node/issues/8053
+ // A condition on nodejs' version won't solve the issue as we don't
+ // control the Buffer polyfills that may or may not be used.
+ return new Buffer(data, encoding);
+ },
+ /**
+ * Create a new nodejs Buffer with the specified size.
+ * @param {Integer} size the size of the buffer.
+ * @return {Buffer} a new Buffer.
+ */
+ allocBuffer: function (size) {
+ if (Buffer.alloc) {
+ return Buffer.alloc(size);
+ } else {
+ return new Buffer(size);
+ }
+ },
+ /**
+ * Find out if an object is a Buffer.
+ * @param {Object} b the object to test.
+ * @return {Boolean} true if the object is a Buffer, false otherwise.
+ */
+ isBuffer : function(b){
+ return Buffer.isBuffer(b);
+ },
+
+ isStream : function (obj) {
+ return obj &&
+ typeof obj.on === "function" &&
+ typeof obj.pause === "function" &&
+ typeof obj.resume === "function";
+ }
+};
+
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(83).Buffer))
+
+/***/ }),
+/* 89 */
+/***/ (function(module, exports) {
+
+// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
+var global = module.exports = typeof window != 'undefined' && window.Math == Math
+ ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
+if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
+
+/***/ }),
+/* 90 */
+/***/ (function(module, exports) {
+
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+function EventEmitter() {
+ this._events = this._events || {};
+ this._maxListeners = this._maxListeners || undefined;
+}
+module.exports = EventEmitter;
+
+// Backwards-compat with node 0.10.x
+EventEmitter.EventEmitter = EventEmitter;
+
+EventEmitter.prototype._events = undefined;
+EventEmitter.prototype._maxListeners = undefined;
+
+// By default EventEmitters will print a warning if more than 10 listeners are
+// added to it. This is a useful default which helps finding memory leaks.
+EventEmitter.defaultMaxListeners = 10;
+
+// Obviously not all Emitters should be limited to 10. This function allows
+// that to be increased. Set to zero for unlimited.
+EventEmitter.prototype.setMaxListeners = function(n) {
+ if (!isNumber(n) || n < 0 || isNaN(n))
+ throw TypeError('n must be a positive number');
+ this._maxListeners = n;
+ return this;
+};
+
+EventEmitter.prototype.emit = function(type) {
+ var er, handler, len, args, i, listeners;
+
+ if (!this._events)
+ this._events = {};
+
+ // If there is no 'error' event listener then throw.
+ if (type === 'error') {
+ if (!this._events.error ||
+ (isObject(this._events.error) && !this._events.error.length)) {
+ er = arguments[1];
+ if (er instanceof Error) {
+ throw er; // Unhandled 'error' event
+ } else {
+ // At least give some kind of context to the user
+ var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
+ err.context = er;
+ throw err;
+ }
+ }
+ }
+
+ handler = this._events[type];
+
+ if (isUndefined(handler))
+ return false;
+
+ if (isFunction(handler)) {
+ switch (arguments.length) {
+ // fast cases
+ case 1:
+ handler.call(this);
+ break;
+ case 2:
+ handler.call(this, arguments[1]);
+ break;
+ case 3:
+ handler.call(this, arguments[1], arguments[2]);
+ break;
+ // slower
+ default:
+ args = Array.prototype.slice.call(arguments, 1);
+ handler.apply(this, args);
+ }
+ } else if (isObject(handler)) {
+ args = Array.prototype.slice.call(arguments, 1);
+ listeners = handler.slice();
+ len = listeners.length;
+ for (i = 0; i < len; i++)
+ listeners[i].apply(this, args);
+ }
+
+ return true;
+};
+
+EventEmitter.prototype.addListener = function(type, listener) {
+ var m;
+
+ if (!isFunction(listener))
+ throw TypeError('listener must be a function');
+
+ if (!this._events)
+ this._events = {};
+
+ // To avoid recursion in the case that type === "newListener"! Before
+ // adding it to the listeners, first emit "newListener".
+ if (this._events.newListener)
+ this.emit('newListener', type,
+ isFunction(listener.listener) ?
+ listener.listener : listener);
+
+ if (!this._events[type])
+ // Optimize the case of one listener. Don't need the extra array object.
+ this._events[type] = listener;
+ else if (isObject(this._events[type]))
+ // If we've already got an array, just append.
+ this._events[type].push(listener);
+ else
+ // Adding the second element, need to change to array.
+ this._events[type] = [this._events[type], listener];
+
+ // Check for listener leak
+ if (isObject(this._events[type]) && !this._events[type].warned) {
+ if (!isUndefined(this._maxListeners)) {
+ m = this._maxListeners;
+ } else {
+ m = EventEmitter.defaultMaxListeners;
+ }
+
+ if (m && m > 0 && this._events[type].length > m) {
+ this._events[type].warned = true;
+ console.error('(node) warning: possible EventEmitter memory ' +
+ 'leak detected. %d listeners added. ' +
+ 'Use emitter.setMaxListeners() to increase limit.',
+ this._events[type].length);
+ if (typeof console.trace === 'function') {
+ // not supported in IE 10
+ console.trace();
+ }
+ }
+ }
+
+ return this;
+};
+
+EventEmitter.prototype.on = EventEmitter.prototype.addListener;
+
+EventEmitter.prototype.once = function(type, listener) {
+ if (!isFunction(listener))
+ throw TypeError('listener must be a function');
+
+ var fired = false;
+
+ function g() {
+ this.removeListener(type, g);
+
+ if (!fired) {
+ fired = true;
+ listener.apply(this, arguments);
+ }
+ }
+
+ g.listener = listener;
+ this.on(type, g);
+
+ return this;
+};
+
+// emits a 'removeListener' event iff the listener was removed
+EventEmitter.prototype.removeListener = function(type, listener) {
+ var list, position, length, i;
+
+ if (!isFunction(listener))
+ throw TypeError('listener must be a function');
+
+ if (!this._events || !this._events[type])
+ return this;
+
+ list = this._events[type];
+ length = list.length;
+ position = -1;
+
+ if (list === listener ||
+ (isFunction(list.listener) && list.listener === listener)) {
+ delete this._events[type];
+ if (this._events.removeListener)
+ this.emit('removeListener', type, listener);
+
+ } else if (isObject(list)) {
+ for (i = length; i-- > 0;) {
+ if (list[i] === listener ||
+ (list[i].listener && list[i].listener === listener)) {
+ position = i;
+ break;
+ }
+ }
+
+ if (position < 0)
+ return this;
+
+ if (list.length === 1) {
+ list.length = 0;
+ delete this._events[type];
+ } else {
+ list.splice(position, 1);
+ }
+
+ if (this._events.removeListener)
+ this.emit('removeListener', type, listener);
+ }
+
+ return this;
+};
+
+EventEmitter.prototype.removeAllListeners = function(type) {
+ var key, listeners;
+
+ if (!this._events)
+ return this;
+
+ // not listening for removeListener, no need to emit
+ if (!this._events.removeListener) {
+ if (arguments.length === 0)
+ this._events = {};
+ else if (this._events[type])
+ delete this._events[type];
+ return this;
+ }
+
+ // emit removeListener for all listeners on all events
+ if (arguments.length === 0) {
+ for (key in this._events) {
+ if (key === 'removeListener') continue;
+ this.removeAllListeners(key);
+ }
+ this.removeAllListeners('removeListener');
+ this._events = {};
+ return this;
+ }
+
+ listeners = this._events[type];
+
+ if (isFunction(listeners)) {
+ this.removeListener(type, listeners);
+ } else if (listeners) {
+ // LIFO order
+ while (listeners.length)
+ this.removeListener(type, listeners[listeners.length - 1]);
+ }
+ delete this._events[type];
+
+ return this;
+};
+
+EventEmitter.prototype.listeners = function(type) {
+ var ret;
+ if (!this._events || !this._events[type])
+ ret = [];
+ else if (isFunction(this._events[type]))
+ ret = [this._events[type]];
+ else
+ ret = this._events[type].slice();
+ return ret;
+};
+
+EventEmitter.prototype.listenerCount = function(type) {
+ if (this._events) {
+ var evlistener = this._events[type];
+
+ if (isFunction(evlistener))
+ return 1;
+ else if (evlistener)
+ return evlistener.length;
+ }
+ return 0;
+};
+
+EventEmitter.listenerCount = function(emitter, type) {
+ return emitter.listenerCount(type);
+};
+
+function isFunction(arg) {
+ return typeof arg === 'function';
+}
+
+function isNumber(arg) {
+ return typeof arg === 'number';
+}
+
+function isObject(arg) {
+ return typeof arg === 'object' && arg !== null;
+}
+
+function isUndefined(arg) {
+ return arg === void 0;
+}
+
+
+/***/ }),
+/* 91 */
+/***/ (function(module, exports, __webpack_require__) {
+
+exports = module.exports = __webpack_require__(100);
+exports.Stream = exports;
+exports.Readable = exports;
+exports.Writable = __webpack_require__(92);
+exports.Duplex = __webpack_require__(80);
+exports.Transform = __webpack_require__(104);
+exports.PassThrough = __webpack_require__(136);
+
+
+/***/ }),
+/* 92 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// A bit simpler than readable streams.
+// Implement an async ._write(chunk, encoding, cb), and it'll handle all
+// the drain event emission and buffering.
+
+
+
+/**/
+
+var processNextTick = __webpack_require__(86).nextTick;
+/**/
+
+module.exports = Writable;
+
+/* */
+function WriteReq(chunk, encoding, cb) {
+ this.chunk = chunk;
+ this.encoding = encoding;
+ this.callback = cb;
+ this.next = null;
+}
+
+// It seems a linked list but it is not
+// there will be only 2 of these for each stream
+function CorkedRequest(state) {
+ var _this = this;
+
+ this.next = null;
+ this.entry = null;
+ this.finish = function () {
+ onCorkedFinish(_this, state);
+ };
+}
+/* */
+
+/**/
+var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
+/**/
+
+/**/
+var Duplex;
+/**/
+
+Writable.WritableState = WritableState;
+
+/**/
+var util = __webpack_require__(84);
+util.inherits = __webpack_require__(82);
+/**/
+
+/**/
+var internalUtil = {
+ deprecate: __webpack_require__(135)
+};
+/**/
+
+/**/
+var Stream = __webpack_require__(101);
+/**/
+
+/**/
+
+var Buffer = __webpack_require__(87).Buffer;
+var OurUint8Array = global.Uint8Array || function () {};
+function _uint8ArrayToBuffer(chunk) {
+ return Buffer.from(chunk);
+}
+function _isUint8Array(obj) {
+ return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
+}
+
+/**/
+
+var destroyImpl = __webpack_require__(102);
+
+util.inherits(Writable, Stream);
+
+function nop() {}
+
+function WritableState(options, stream) {
+ Duplex = Duplex || __webpack_require__(80);
+
+ options = options || {};
+
+ // Duplex streams are both readable and writable, but share
+ // the same options object.
+ // However, some cases require setting options to different
+ // values for the readable and the writable sides of the duplex stream.
+ // These options can be provided separately as readableXXX and writableXXX.
+ var isDuplex = stream instanceof Duplex;
+
+ // object stream flag to indicate whether or not this stream
+ // contains buffers or objects.
+ this.objectMode = !!options.objectMode;
+
+ if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
+
+ // the point at which write() starts returning false
+ // Note: 0 is a valid value, means that we always return false if
+ // the entire buffer is not flushed immediately on write()
+ var hwm = options.highWaterMark;
+ var writableHwm = options.writableHighWaterMark;
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
+
+ if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
+
+ // cast to ints.
+ this.highWaterMark = Math.floor(this.highWaterMark);
+
+ // if _final has been called
+ this.finalCalled = false;
+
+ // drain event flag.
+ this.needDrain = false;
+ // at the start of calling end()
+ this.ending = false;
+ // when end() has been called, and returned
+ this.ended = false;
+ // when 'finish' is emitted
+ this.finished = false;
+
+ // has it been destroyed
+ this.destroyed = false;
+
+ // should we decode strings into buffers before passing to _write?
+ // this is here so that some node-core streams can optimize string
+ // handling at a lower level.
+ var noDecode = options.decodeStrings === false;
+ this.decodeStrings = !noDecode;
+
+ // Crypto is kind of old and crusty. Historically, its default string
+ // encoding is 'binary' so we have to make this configurable.
+ // Everything else in the universe uses 'utf8', though.
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
+
+ // not an actual buffer we keep track of, but a measurement
+ // of how much we're waiting to get pushed to some underlying
+ // socket or file.
+ this.length = 0;
+
+ // a flag to see when we're in the middle of a write.
+ this.writing = false;
+
+ // when true all writes will be buffered until .uncork() call
+ this.corked = 0;
+
+ // a flag to be able to tell if the onwrite cb is called immediately,
+ // or on a later tick. We set this to true at first, because any
+ // actions that shouldn't happen until "later" should generally also
+ // not happen before the first write call.
+ this.sync = true;
+
+ // a flag to know if we're processing previously buffered items, which
+ // may call the _write() callback in the same tick, so that we don't
+ // end up in an overlapped onwrite situation.
+ this.bufferProcessing = false;
+
+ // the callback that's passed to _write(chunk,cb)
+ this.onwrite = function (er) {
+ onwrite(stream, er);
+ };
+
+ // the callback that the user supplies to write(chunk,encoding,cb)
+ this.writecb = null;
+
+ // the amount that is being written when _write is called.
+ this.writelen = 0;
+
+ this.bufferedRequest = null;
+ this.lastBufferedRequest = null;
+
+ // number of pending user-supplied write callbacks
+ // this must be 0 before 'finish' can be emitted
+ this.pendingcb = 0;
+
+ // emit prefinish if the only thing we're waiting for is _write cbs
+ // This is relevant for synchronous Transform streams
+ this.prefinished = false;
+
+ // True if the error was already emitted and should not be thrown again
+ this.errorEmitted = false;
+
+ // count buffered requests
+ this.bufferedRequestCount = 0;
+
+ // allocate the first CorkedRequest, there is always
+ // one allocated and free to use, and we maintain at most two
+ this.corkedRequestsFree = new CorkedRequest(this);
+}
+
+WritableState.prototype.getBuffer = function getBuffer() {
+ var current = this.bufferedRequest;
+ var out = [];
+ while (current) {
+ out.push(current);
+ current = current.next;
+ }
+ return out;
+};
+
+(function () {
+ try {
+ Object.defineProperty(WritableState.prototype, 'buffer', {
+ get: internalUtil.deprecate(function () {
+ return this.getBuffer();
+ }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
+ });
+ } catch (_) {}
+})();
+
+// Test _writableState for inheritance to account for Duplex streams,
+// whose prototype chain only points to Readable.
+var realHasInstance;
+if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
+ realHasInstance = Function.prototype[Symbol.hasInstance];
+ Object.defineProperty(Writable, Symbol.hasInstance, {
+ value: function (object) {
+ if (realHasInstance.call(this, object)) return true;
+ if (this !== Writable) return false;
+
+ return object && object._writableState instanceof WritableState;
+ }
+ });
+} else {
+ realHasInstance = function (object) {
+ return object instanceof this;
+ };
+}
+
+function Writable(options) {
+ Duplex = Duplex || __webpack_require__(80);
+
+ // Writable ctor is applied to Duplexes, too.
+ // `realHasInstance` is necessary because using plain `instanceof`
+ // would return false, as no `_writableState` property is attached.
+
+ // Trying to use the custom `instanceof` for Writable here will also break the
+ // Node.js LazyTransform implementation, which has a non-trivial getter for
+ // `_writableState` that would lead to infinite recursion.
+ if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
+ return new Writable(options);
+ }
+
+ this._writableState = new WritableState(options, this);
+
+ // legacy.
+ this.writable = true;
+
+ if (options) {
+ if (typeof options.write === 'function') this._write = options.write;
+
+ if (typeof options.writev === 'function') this._writev = options.writev;
+
+ if (typeof options.destroy === 'function') this._destroy = options.destroy;
+
+ if (typeof options.final === 'function') this._final = options.final;
+ }
+
+ Stream.call(this);
+}
+
+// Otherwise people can pipe Writable streams, which is just wrong.
+Writable.prototype.pipe = function () {
+ this.emit('error', new Error('Cannot pipe, not readable'));
+};
+
+function writeAfterEnd(stream, cb) {
+ var er = new Error('write after end');
+ // TODO: defer error events consistently everywhere, not just the cb
+ stream.emit('error', er);
+ processNextTick(cb, er);
+}
+
+// Checks that a user-supplied chunk is valid, especially for the particular
+// mode the stream is in. Currently this means that `null` is never accepted
+// and undefined/non-string values are only allowed in object mode.
+function validChunk(stream, state, chunk, cb) {
+ var valid = true;
+ var er = false;
+
+ if (chunk === null) {
+ er = new TypeError('May not write null values to stream');
+ } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
+ er = new TypeError('Invalid non-string/buffer chunk');
+ }
+ if (er) {
+ stream.emit('error', er);
+ processNextTick(cb, er);
+ valid = false;
+ }
+ return valid;
+}
+
+Writable.prototype.write = function (chunk, encoding, cb) {
+ var state = this._writableState;
+ var ret = false;
+ var isBuf = !state.objectMode && _isUint8Array(chunk);
+
+ if (isBuf && !Buffer.isBuffer(chunk)) {
+ chunk = _uint8ArrayToBuffer(chunk);
+ }
+
+ if (typeof encoding === 'function') {
+ cb = encoding;
+ encoding = null;
+ }
+
+ if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
+
+ if (typeof cb !== 'function') cb = nop;
+
+ if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
+ state.pendingcb++;
+ ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
+ }
+
+ return ret;
+};
+
+Writable.prototype.cork = function () {
+ var state = this._writableState;
+
+ state.corked++;
+};
+
+Writable.prototype.uncork = function () {
+ var state = this._writableState;
+
+ if (state.corked) {
+ state.corked--;
+
+ if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
+ }
+};
+
+Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
+ // node::ParseEncoding() requires lower case.
+ if (typeof encoding === 'string') encoding = encoding.toLowerCase();
+ if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
+ this._writableState.defaultEncoding = encoding;
+ return this;
+};
+
+function decodeChunk(state, chunk, encoding) {
+ if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
+ chunk = Buffer.from(chunk, encoding);
+ }
+ return chunk;
+}
+
+// if we're already writing something, then just put this
+// in the queue, and wait our turn. Otherwise, call _write
+// If we return false, then we need a drain event, so set that flag.
+function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
+ if (!isBuf) {
+ var newChunk = decodeChunk(state, chunk, encoding);
+ if (chunk !== newChunk) {
+ isBuf = true;
+ encoding = 'buffer';
+ chunk = newChunk;
+ }
+ }
+ var len = state.objectMode ? 1 : chunk.length;
+
+ state.length += len;
+
+ var ret = state.length < state.highWaterMark;
+ // we must ensure that previous needDrain will not be reset to false.
+ if (!ret) state.needDrain = true;
+
+ if (state.writing || state.corked) {
+ var last = state.lastBufferedRequest;
+ state.lastBufferedRequest = {
+ chunk: chunk,
+ encoding: encoding,
+ isBuf: isBuf,
+ callback: cb,
+ next: null
+ };
+ if (last) {
+ last.next = state.lastBufferedRequest;
+ } else {
+ state.bufferedRequest = state.lastBufferedRequest;
+ }
+ state.bufferedRequestCount += 1;
+ } else {
+ doWrite(stream, state, false, len, chunk, encoding, cb);
+ }
+
+ return ret;
+}
+
+function doWrite(stream, state, writev, len, chunk, encoding, cb) {
+ state.writelen = len;
+ state.writecb = cb;
+ state.writing = true;
+ state.sync = true;
+ if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
+ state.sync = false;
+}
+
+function onwriteError(stream, state, sync, er, cb) {
+ --state.pendingcb;
+
+ if (sync) {
+ // defer the callback if we are being called synchronously
+ // to avoid piling up things on the stack
+ processNextTick(cb, er);
+ // this can emit finish, and it will always happen
+ // after error
+ processNextTick(finishMaybe, stream, state);
+ stream._writableState.errorEmitted = true;
+ stream.emit('error', er);
+ } else {
+ // the caller expect this to happen before if
+ // it is async
+ cb(er);
+ stream._writableState.errorEmitted = true;
+ stream.emit('error', er);
+ // this can emit finish, but finish must
+ // always follow error
+ finishMaybe(stream, state);
+ }
+}
+
+function onwriteStateUpdate(state) {
+ state.writing = false;
+ state.writecb = null;
+ state.length -= state.writelen;
+ state.writelen = 0;
+}
+
+function onwrite(stream, er) {
+ var state = stream._writableState;
+ var sync = state.sync;
+ var cb = state.writecb;
+
+ onwriteStateUpdate(state);
+
+ if (er) onwriteError(stream, state, sync, er, cb);else {
+ // Check if we're actually ready to finish, but don't emit yet
+ var finished = needFinish(state);
+
+ if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
+ clearBuffer(stream, state);
+ }
+
+ if (sync) {
+ /**/
+ asyncWrite(afterWrite, stream, state, finished, cb);
+ /**/
+ } else {
+ afterWrite(stream, state, finished, cb);
+ }
+ }
+}
+
+function afterWrite(stream, state, finished, cb) {
+ if (!finished) onwriteDrain(stream, state);
+ state.pendingcb--;
+ cb();
+ finishMaybe(stream, state);
+}
+
+// Must force callback to be called on nextTick, so that we don't
+// emit 'drain' before the write() consumer gets the 'false' return
+// value, and has a chance to attach a 'drain' listener.
+function onwriteDrain(stream, state) {
+ if (state.length === 0 && state.needDrain) {
+ state.needDrain = false;
+ stream.emit('drain');
+ }
+}
+
+// if there's something in the buffer waiting, then process it
+function clearBuffer(stream, state) {
+ state.bufferProcessing = true;
+ var entry = state.bufferedRequest;
+
+ if (stream._writev && entry && entry.next) {
+ // Fast case, write everything using _writev()
+ var l = state.bufferedRequestCount;
+ var buffer = new Array(l);
+ var holder = state.corkedRequestsFree;
+ holder.entry = entry;
+
+ var count = 0;
+ var allBuffers = true;
+ while (entry) {
+ buffer[count] = entry;
+ if (!entry.isBuf) allBuffers = false;
+ entry = entry.next;
+ count += 1;
+ }
+ buffer.allBuffers = allBuffers;
+
+ doWrite(stream, state, true, state.length, buffer, '', holder.finish);
+
+ // doWrite is almost always async, defer these to save a bit of time
+ // as the hot path ends with doWrite
+ state.pendingcb++;
+ state.lastBufferedRequest = null;
+ if (holder.next) {
+ state.corkedRequestsFree = holder.next;
+ holder.next = null;
+ } else {
+ state.corkedRequestsFree = new CorkedRequest(state);
+ }
+ state.bufferedRequestCount = 0;
+ } else {
+ // Slow case, write chunks one-by-one
+ while (entry) {
+ var chunk = entry.chunk;
+ var encoding = entry.encoding;
+ var cb = entry.callback;
+ var len = state.objectMode ? 1 : chunk.length;
+
+ doWrite(stream, state, false, len, chunk, encoding, cb);
+ entry = entry.next;
+ state.bufferedRequestCount--;
+ // if we didn't call the onwrite immediately, then
+ // it means that we need to wait until it does.
+ // also, that means that the chunk and cb are currently
+ // being processed, so move the buffer counter past them.
+ if (state.writing) {
+ break;
+ }
+ }
+
+ if (entry === null) state.lastBufferedRequest = null;
+ }
+
+ state.bufferedRequest = entry;
+ state.bufferProcessing = false;
+}
+
+Writable.prototype._write = function (chunk, encoding, cb) {
+ cb(new Error('_write() is not implemented'));
+};
+
+Writable.prototype._writev = null;
+
+Writable.prototype.end = function (chunk, encoding, cb) {
+ var state = this._writableState;
+
+ if (typeof chunk === 'function') {
+ cb = chunk;
+ chunk = null;
+ encoding = null;
+ } else if (typeof encoding === 'function') {
+ cb = encoding;
+ encoding = null;
+ }
+
+ if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
+
+ // .end() fully uncorks
+ if (state.corked) {
+ state.corked = 1;
+ this.uncork();
+ }
+
+ // ignore unnecessary end() calls.
+ if (!state.ending && !state.finished) endWritable(this, state, cb);
+};
+
+function needFinish(state) {
+ return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
+}
+function callFinal(stream, state) {
+ stream._final(function (err) {
+ state.pendingcb--;
+ if (err) {
+ stream.emit('error', err);
+ }
+ state.prefinished = true;
+ stream.emit('prefinish');
+ finishMaybe(stream, state);
+ });
+}
+function prefinish(stream, state) {
+ if (!state.prefinished && !state.finalCalled) {
+ if (typeof stream._final === 'function') {
+ state.pendingcb++;
+ state.finalCalled = true;
+ processNextTick(callFinal, stream, state);
+ } else {
+ state.prefinished = true;
+ stream.emit('prefinish');
+ }
+ }
+}
+
+function finishMaybe(stream, state) {
+ var need = needFinish(state);
+ if (need) {
+ prefinish(stream, state);
+ if (state.pendingcb === 0) {
+ state.finished = true;
+ stream.emit('finish');
+ }
+ }
+ return need;
+}
+
+function endWritable(stream, state, cb) {
+ state.ending = true;
+ finishMaybe(stream, state);
+ if (cb) {
+ if (state.finished) processNextTick(cb);else stream.once('finish', cb);
+ }
+ state.ended = true;
+ stream.writable = false;
+}
+
+function onCorkedFinish(corkReq, state, err) {
+ var entry = corkReq.entry;
+ corkReq.entry = null;
+ while (entry) {
+ var cb = entry.callback;
+ state.pendingcb--;
+ cb(err);
+ entry = entry.next;
+ }
+ if (state.corkedRequestsFree) {
+ state.corkedRequestsFree.next = corkReq;
+ } else {
+ state.corkedRequestsFree = corkReq;
+ }
+}
+
+Object.defineProperty(Writable.prototype, 'destroyed', {
+ get: function () {
+ if (this._writableState === undefined) {
+ return false;
+ }
+ return this._writableState.destroyed;
+ },
+ set: function (value) {
+ // we ignore the value if the stream
+ // has not been initialized yet
+ if (!this._writableState) {
+ return;
+ }
+
+ // backward compatibility, the user is explicitly
+ // managing destroyed
+ this._writableState.destroyed = value;
+ }
+});
+
+Writable.prototype.destroy = destroyImpl.destroy;
+Writable.prototype._undestroy = destroyImpl.undestroy;
+Writable.prototype._destroy = function (err, cb) {
+ this.end();
+ cb(err);
+};
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(48), __webpack_require__(70).setImmediate, __webpack_require__(40)))
+
+/***/ }),
+/* 93 */
+/***/ (function(module, exports) {
+
+module.exports = function(it){
+ return typeof it === 'object' ? it !== null : typeof it === 'function';
+};
+
+/***/ }),
+/* 94 */
+/***/ (function(module, exports, __webpack_require__) {
+
+// Thank's IE8 for his funny defineProperty
+module.exports = !__webpack_require__(108)(function(){
+ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
+});
+
+/***/ }),
+/* 95 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var external = __webpack_require__(85);
+var DataWorker = __webpack_require__(112);
+var DataLengthProbe = __webpack_require__(113);
+var Crc32Probe = __webpack_require__(114);
+var DataLengthProbe = __webpack_require__(113);
+
+/**
+ * Represent a compressed object, with everything needed to decompress it.
+ * @constructor
+ * @param {number} compressedSize the size of the data compressed.
+ * @param {number} uncompressedSize the size of the data after decompression.
+ * @param {number} crc32 the crc32 of the decompressed file.
+ * @param {object} compression the type of compression, see lib/compressions.js.
+ * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data.
+ */
+function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) {
+ this.compressedSize = compressedSize;
+ this.uncompressedSize = uncompressedSize;
+ this.crc32 = crc32;
+ this.compression = compression;
+ this.compressedContent = data;
+}
+
+CompressedObject.prototype = {
+ /**
+ * Create a worker to get the uncompressed content.
+ * @return {GenericWorker} the worker.
+ */
+ getContentWorker : function () {
+ var worker = new DataWorker(external.Promise.resolve(this.compressedContent))
+ .pipe(this.compression.uncompressWorker())
+ .pipe(new DataLengthProbe("data_length"));
+
+ var that = this;
+ worker.on("end", function () {
+ if(this.streamInfo['data_length'] !== that.uncompressedSize) {
+ throw new Error("Bug : uncompressed data size mismatch");
+ }
+ });
+ return worker;
+ },
+ /**
+ * Create a worker to get the compressed content.
+ * @return {GenericWorker} the worker.
+ */
+ getCompressedWorker : function () {
+ return new DataWorker(external.Promise.resolve(this.compressedContent))
+ .withStreamInfo("compressedSize", this.compressedSize)
+ .withStreamInfo("uncompressedSize", this.uncompressedSize)
+ .withStreamInfo("crc32", this.crc32)
+ .withStreamInfo("compression", this.compression)
+ ;
+ }
+};
+
+/**
+ * Chain the given worker with other workers to compress the content with the
+ * given compresion.
+ * @param {GenericWorker} uncompressedWorker the worker to pipe.
+ * @param {Object} compression the compression object.
+ * @param {Object} compressionOptions the options to use when compressing.
+ * @return {GenericWorker} the new worker compressing the content.
+ */
+CompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) {
+ return uncompressedWorker
+ .pipe(new Crc32Probe())
+ .pipe(new DataLengthProbe("uncompressedSize"))
+ .pipe(compression.compressWorker(compressionOptions))
+ .pipe(new DataLengthProbe("compressedSize"))
+ .withStreamInfo("compression", compression);
+};
+
+module.exports = CompressedObject;
+
+
+/***/ }),
+/* 96 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(76);
+
+/**
+ * The following functions come from pako, from pako/lib/zlib/crc32.js
+ * released under the MIT license, see pako https://github.com/nodeca/pako/
+ */
+
+// Use ordinary array, since untyped makes no boost here
+function makeTable() {
+ var c, table = [];
+
+ for(var n =0; n < 256; n++){
+ c = n;
+ for(var k =0; k < 8; k++){
+ c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
+ }
+ table[n] = c;
+ }
+
+ return table;
+}
+
+// Create table on load. Just 255 signed longs. Not a problem.
+var crcTable = makeTable();
+
+
+function crc32(crc, buf, len, pos) {
+ var t = crcTable, end = pos + len;
+
+ crc = crc ^ (-1);
+
+ for (var i = pos; i < end; i++ ) {
+ crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
+ }
+
+ return (crc ^ (-1)); // >>> 0;
+}
+
+// That's all for the pako functions.
+
+/**
+ * Compute the crc32 of a string.
+ * This is almost the same as the function crc32, but for strings. Using the
+ * same function for the two use cases leads to horrible performances.
+ * @param {Number} crc the starting value of the crc.
+ * @param {String} str the string to use.
+ * @param {Number} len the length of the string.
+ * @param {Number} pos the starting position for the crc32 computation.
+ * @return {Number} the computed crc32.
+ */
+function crc32str(crc, str, len, pos) {
+ var t = crcTable, end = pos + len;
+
+ crc = crc ^ (-1);
+
+ for (var i = pos; i < end; i++ ) {
+ crc = (crc >>> 8) ^ t[(crc ^ str.charCodeAt(i)) & 0xFF];
+ }
+
+ return (crc ^ (-1)); // >>> 0;
+}
+
+module.exports = function crc32wrapper(input, crc) {
+ if (typeof input === "undefined" || !input.length) {
+ return 0;
+ }
+
+ var isArray = utils.getTypeOf(input) !== "string";
+
+ if(isArray) {
+ return crc32(crc|0, input, input.length, 0);
+ } else {
+ return crc32str(crc|0, input, input.length, 0);
+ }
+};
+
+
+/***/ }),
+/* 97 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+// (C) 1995-2013 Jean-loup Gailly and Mark Adler
+// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+module.exports = {
+ 2: 'need dictionary', /* Z_NEED_DICT 2 */
+ 1: 'stream end', /* Z_STREAM_END 1 */
+ 0: '', /* Z_OK 0 */
+ '-1': 'file error', /* Z_ERRNO (-1) */
+ '-2': 'stream error', /* Z_STREAM_ERROR (-2) */
+ '-3': 'data error', /* Z_DATA_ERROR (-3) */
+ '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */
+ '-5': 'buffer error', /* Z_BUF_ERROR (-5) */
+ '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
+};
+
+
+/***/ }),
+/* 98 */
+/***/ (function(module, exports) {
+
+var toString = {}.toString;
+
+module.exports = Array.isArray || function (arr) {
+ return toString.call(arr) == '[object Array]';
+};
+
+
+/***/ }),
+/* 99 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/*
+ * This file is used by module bundlers (browserify/webpack/etc) when
+ * including a stream implementation. We use "readable-stream" to get a
+ * consistent behavior between nodejs versions but bundlers often have a shim
+ * for "stream". Using this shim greatly improve the compatibility and greatly
+ * reduce the final size of the bundle (only one stream implementation, not
+ * two).
+ */
+module.exports = __webpack_require__(131);
+
+
+/***/ }),
+/* 100 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
+/**/
+
+var processNextTick = __webpack_require__(86).nextTick;
+/**/
+
+module.exports = Readable;
+
+/**/
+var isArray = __webpack_require__(98);
+/**/
+
+/**/
+var Duplex;
+/**/
+
+Readable.ReadableState = ReadableState;
+
+/**/
+var EE = __webpack_require__(90).EventEmitter;
+
+var EElistenerCount = function (emitter, type) {
+ return emitter.listeners(type).length;
+};
+/**/
+
+/**/
+var Stream = __webpack_require__(101);
+/**/
+
+/**/
+
+var Buffer = __webpack_require__(87).Buffer;
+var OurUint8Array = global.Uint8Array || function () {};
+function _uint8ArrayToBuffer(chunk) {
+ return Buffer.from(chunk);
+}
+function _isUint8Array(obj) {
+ return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
+}
+
+/**/
+
+/**/
+var util = __webpack_require__(84);
+util.inherits = __webpack_require__(82);
+/**/
+
+/**/
+var debugUtil = __webpack_require__(132);
+var debug = void 0;
+if (debugUtil && debugUtil.debuglog) {
+ debug = debugUtil.debuglog('stream');
+} else {
+ debug = function () {};
+}
+/**/
+
+var BufferList = __webpack_require__(133);
+var destroyImpl = __webpack_require__(102);
+var StringDecoder;
+
+util.inherits(Readable, Stream);
+
+var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
+
+function prependListener(emitter, event, fn) {
+ // Sadly this is not cacheable as some libraries bundle their own
+ // event emitter implementation with them.
+ if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
+
+ // This is a hack to make sure that our error handler is attached before any
+ // userland ones. NEVER DO THIS. This is here only because this code needs
+ // to continue to work with older versions of Node.js that do not include
+ // the prependListener() method. The goal is to eventually remove this hack.
+ if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
+}
+
+function ReadableState(options, stream) {
+ Duplex = Duplex || __webpack_require__(80);
+
+ options = options || {};
+
+ // Duplex streams are both readable and writable, but share
+ // the same options object.
+ // However, some cases require setting options to different
+ // values for the readable and the writable sides of the duplex stream.
+ // These options can be provided separately as readableXXX and writableXXX.
+ var isDuplex = stream instanceof Duplex;
+
+ // object stream flag. Used to make read(n) ignore n and to
+ // make all the buffer merging and length checks go away
+ this.objectMode = !!options.objectMode;
+
+ if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
+
+ // the point at which it stops calling _read() to fill the buffer
+ // Note: 0 is a valid value, means "don't call _read preemptively ever"
+ var hwm = options.highWaterMark;
+ var readableHwm = options.readableHighWaterMark;
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
+
+ if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
+
+ // cast to ints.
+ this.highWaterMark = Math.floor(this.highWaterMark);
+
+ // A linked list is used to store data chunks instead of an array because the
+ // linked list can remove elements from the beginning faster than
+ // array.shift()
+ this.buffer = new BufferList();
+ this.length = 0;
+ this.pipes = null;
+ this.pipesCount = 0;
+ this.flowing = null;
+ this.ended = false;
+ this.endEmitted = false;
+ this.reading = false;
+
+ // a flag to be able to tell if the event 'readable'/'data' is emitted
+ // immediately, or on a later tick. We set this to true at first, because
+ // any actions that shouldn't happen until "later" should generally also
+ // not happen before the first read call.
+ this.sync = true;
+
+ // whenever we return null, then we set a flag to say
+ // that we're awaiting a 'readable' event emission.
+ this.needReadable = false;
+ this.emittedReadable = false;
+ this.readableListening = false;
+ this.resumeScheduled = false;
+
+ // has it been destroyed
+ this.destroyed = false;
+
+ // Crypto is kind of old and crusty. Historically, its default string
+ // encoding is 'binary' so we have to make this configurable.
+ // Everything else in the universe uses 'utf8', though.
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
+
+ // the number of writers that are awaiting a drain event in .pipe()s
+ this.awaitDrain = 0;
+
+ // if true, a maybeReadMore has been scheduled
+ this.readingMore = false;
+
+ this.decoder = null;
+ this.encoding = null;
+ if (options.encoding) {
+ if (!StringDecoder) StringDecoder = __webpack_require__(103).StringDecoder;
+ this.decoder = new StringDecoder(options.encoding);
+ this.encoding = options.encoding;
+ }
+}
+
+function Readable(options) {
+ Duplex = Duplex || __webpack_require__(80);
+
+ if (!(this instanceof Readable)) return new Readable(options);
+
+ this._readableState = new ReadableState(options, this);
+
+ // legacy
+ this.readable = true;
+
+ if (options) {
+ if (typeof options.read === 'function') this._read = options.read;
+
+ if (typeof options.destroy === 'function') this._destroy = options.destroy;
+ }
+
+ Stream.call(this);
+}
+
+Object.defineProperty(Readable.prototype, 'destroyed', {
+ get: function () {
+ if (this._readableState === undefined) {
+ return false;
+ }
+ return this._readableState.destroyed;
+ },
+ set: function (value) {
+ // we ignore the value if the stream
+ // has not been initialized yet
+ if (!this._readableState) {
+ return;
+ }
+
+ // backward compatibility, the user is explicitly
+ // managing destroyed
+ this._readableState.destroyed = value;
+ }
+});
+
+Readable.prototype.destroy = destroyImpl.destroy;
+Readable.prototype._undestroy = destroyImpl.undestroy;
+Readable.prototype._destroy = function (err, cb) {
+ this.push(null);
+ cb(err);
+};
+
+// Manually shove something into the read() buffer.
+// This returns true if the highWaterMark has not been hit yet,
+// similar to how Writable.write() returns true if you should
+// write() some more.
+Readable.prototype.push = function (chunk, encoding) {
+ var state = this._readableState;
+ var skipChunkCheck;
+
+ if (!state.objectMode) {
+ if (typeof chunk === 'string') {
+ encoding = encoding || state.defaultEncoding;
+ if (encoding !== state.encoding) {
+ chunk = Buffer.from(chunk, encoding);
+ encoding = '';
+ }
+ skipChunkCheck = true;
+ }
+ } else {
+ skipChunkCheck = true;
+ }
+
+ return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
+};
+
+// Unshift should *always* be something directly out of read()
+Readable.prototype.unshift = function (chunk) {
+ return readableAddChunk(this, chunk, null, true, false);
+};
+
+function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
+ var state = stream._readableState;
+ if (chunk === null) {
+ state.reading = false;
+ onEofChunk(stream, state);
+ } else {
+ var er;
+ if (!skipChunkCheck) er = chunkInvalid(state, chunk);
+ if (er) {
+ stream.emit('error', er);
+ } else if (state.objectMode || chunk && chunk.length > 0) {
+ if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
+ chunk = _uint8ArrayToBuffer(chunk);
+ }
+
+ if (addToFront) {
+ if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
+ } else if (state.ended) {
+ stream.emit('error', new Error('stream.push() after EOF'));
+ } else {
+ state.reading = false;
+ if (state.decoder && !encoding) {
+ chunk = state.decoder.write(chunk);
+ if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
+ } else {
+ addChunk(stream, state, chunk, false);
+ }
+ }
+ } else if (!addToFront) {
+ state.reading = false;
+ }
+ }
+
+ return needMoreData(state);
+}
+
+function addChunk(stream, state, chunk, addToFront) {
+ if (state.flowing && state.length === 0 && !state.sync) {
+ stream.emit('data', chunk);
+ stream.read(0);
+ } else {
+ // update the buffer info.
+ state.length += state.objectMode ? 1 : chunk.length;
+ if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
+
+ if (state.needReadable) emitReadable(stream);
+ }
+ maybeReadMore(stream, state);
+}
+
+function chunkInvalid(state, chunk) {
+ var er;
+ if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
+ er = new TypeError('Invalid non-string/buffer chunk');
+ }
+ return er;
+}
+
+// if it's past the high water mark, we can push in some more.
+// Also, if we have no data yet, we can stand some
+// more bytes. This is to work around cases where hwm=0,
+// such as the repl. Also, if the push() triggered a
+// readable event, and the user called read(largeNumber) such that
+// needReadable was set, then we ought to push more, so that another
+// 'readable' event will be triggered.
+function needMoreData(state) {
+ return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
+}
+
+Readable.prototype.isPaused = function () {
+ return this._readableState.flowing === false;
+};
+
+// backwards compatibility.
+Readable.prototype.setEncoding = function (enc) {
+ if (!StringDecoder) StringDecoder = __webpack_require__(103).StringDecoder;
+ this._readableState.decoder = new StringDecoder(enc);
+ this._readableState.encoding = enc;
+ return this;
+};
+
+// Don't raise the hwm > 8MB
+var MAX_HWM = 0x800000;
+function computeNewHighWaterMark(n) {
+ if (n >= MAX_HWM) {
+ n = MAX_HWM;
+ } else {
+ // Get the next highest power of 2 to prevent increasing hwm excessively in
+ // tiny amounts
+ n--;
+ n |= n >>> 1;
+ n |= n >>> 2;
+ n |= n >>> 4;
+ n |= n >>> 8;
+ n |= n >>> 16;
+ n++;
+ }
+ return n;
+}
+
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function howMuchToRead(n, state) {
+ if (n <= 0 || state.length === 0 && state.ended) return 0;
+ if (state.objectMode) return 1;
+ if (n !== n) {
+ // Only flow one buffer at a time
+ if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
+ }
+ // If we're asking for more than the current hwm, then raise the hwm.
+ if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
+ if (n <= state.length) return n;
+ // Don't have enough
+ if (!state.ended) {
+ state.needReadable = true;
+ return 0;
+ }
+ return state.length;
+}
+
+// you can override either this method, or the async _read(n) below.
+Readable.prototype.read = function (n) {
+ debug('read', n);
+ n = parseInt(n, 10);
+ var state = this._readableState;
+ var nOrig = n;
+
+ if (n !== 0) state.emittedReadable = false;
+
+ // if we're doing read(0) to trigger a readable event, but we
+ // already have a bunch of data in the buffer, then just trigger
+ // the 'readable' event and move on.
+ if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
+ debug('read: emitReadable', state.length, state.ended);
+ if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
+ return null;
+ }
+
+ n = howMuchToRead(n, state);
+
+ // if we've ended, and we're now clear, then finish it up.
+ if (n === 0 && state.ended) {
+ if (state.length === 0) endReadable(this);
+ return null;
+ }
+
+ // All the actual chunk generation logic needs to be
+ // *below* the call to _read. The reason is that in certain
+ // synthetic stream cases, such as passthrough streams, _read
+ // may be a completely synchronous operation which may change
+ // the state of the read buffer, providing enough data when
+ // before there was *not* enough.
+ //
+ // So, the steps are:
+ // 1. Figure out what the state of things will be after we do
+ // a read from the buffer.
+ //
+ // 2. If that resulting state will trigger a _read, then call _read.
+ // Note that this may be asynchronous, or synchronous. Yes, it is
+ // deeply ugly to write APIs this way, but that still doesn't mean
+ // that the Readable class should behave improperly, as streams are
+ // designed to be sync/async agnostic.
+ // Take note if the _read call is sync or async (ie, if the read call
+ // has returned yet), so that we know whether or not it's safe to emit
+ // 'readable' etc.
+ //
+ // 3. Actually pull the requested chunks out of the buffer and return.
+
+ // if we need a readable event, then we need to do some reading.
+ var doRead = state.needReadable;
+ debug('need readable', doRead);
+
+ // if we currently have less than the highWaterMark, then also read some
+ if (state.length === 0 || state.length - n < state.highWaterMark) {
+ doRead = true;
+ debug('length less than watermark', doRead);
+ }
+
+ // however, if we've ended, then there's no point, and if we're already
+ // reading, then it's unnecessary.
+ if (state.ended || state.reading) {
+ doRead = false;
+ debug('reading or ended', doRead);
+ } else if (doRead) {
+ debug('do read');
+ state.reading = true;
+ state.sync = true;
+ // if the length is currently zero, then we *need* a readable event.
+ if (state.length === 0) state.needReadable = true;
+ // call internal read method
+ this._read(state.highWaterMark);
+ state.sync = false;
+ // If _read pushed data synchronously, then `reading` will be false,
+ // and we need to re-evaluate how much data we can return to the user.
+ if (!state.reading) n = howMuchToRead(nOrig, state);
+ }
+
+ var ret;
+ if (n > 0) ret = fromList(n, state);else ret = null;
+
+ if (ret === null) {
+ state.needReadable = true;
+ n = 0;
+ } else {
+ state.length -= n;
+ }
+
+ if (state.length === 0) {
+ // If we have nothing in the buffer, then we want to know
+ // as soon as we *do* get something into the buffer.
+ if (!state.ended) state.needReadable = true;
+
+ // If we tried to read() past the EOF, then emit end on the next tick.
+ if (nOrig !== n && state.ended) endReadable(this);
+ }
+
+ if (ret !== null) this.emit('data', ret);
+
+ return ret;
+};
+
+function onEofChunk(stream, state) {
+ if (state.ended) return;
+ if (state.decoder) {
+ var chunk = state.decoder.end();
+ if (chunk && chunk.length) {
+ state.buffer.push(chunk);
+ state.length += state.objectMode ? 1 : chunk.length;
+ }
+ }
+ state.ended = true;
+
+ // emit 'readable' now to make sure it gets picked up.
+ emitReadable(stream);
+}
+
+// Don't emit readable right away in sync mode, because this can trigger
+// another read() call => stack overflow. This way, it might trigger
+// a nextTick recursion warning, but that's not so bad.
+function emitReadable(stream) {
+ var state = stream._readableState;
+ state.needReadable = false;
+ if (!state.emittedReadable) {
+ debug('emitReadable', state.flowing);
+ state.emittedReadable = true;
+ if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
+ }
+}
+
+function emitReadable_(stream) {
+ debug('emit readable');
+ stream.emit('readable');
+ flow(stream);
+}
+
+// at this point, the user has presumably seen the 'readable' event,
+// and called read() to consume some data. that may have triggered
+// in turn another _read(n) call, in which case reading = true if
+// it's in progress.
+// However, if we're not ended, or reading, and the length < hwm,
+// then go ahead and try to read some more preemptively.
+function maybeReadMore(stream, state) {
+ if (!state.readingMore) {
+ state.readingMore = true;
+ processNextTick(maybeReadMore_, stream, state);
+ }
+}
+
+function maybeReadMore_(stream, state) {
+ var len = state.length;
+ while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
+ debug('maybeReadMore read 0');
+ stream.read(0);
+ if (len === state.length)
+ // didn't get any data, stop spinning.
+ break;else len = state.length;
+ }
+ state.readingMore = false;
+}
+
+// abstract method. to be overridden in specific implementation classes.
+// call cb(er, data) where data is <= n in length.
+// for virtual (non-string, non-buffer) streams, "length" is somewhat
+// arbitrary, and perhaps not very meaningful.
+Readable.prototype._read = function (n) {
+ this.emit('error', new Error('_read() is not implemented'));
+};
+
+Readable.prototype.pipe = function (dest, pipeOpts) {
+ var src = this;
+ var state = this._readableState;
+
+ switch (state.pipesCount) {
+ case 0:
+ state.pipes = dest;
+ break;
+ case 1:
+ state.pipes = [state.pipes, dest];
+ break;
+ default:
+ state.pipes.push(dest);
+ break;
+ }
+ state.pipesCount += 1;
+ debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
+
+ var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
+
+ var endFn = doEnd ? onend : unpipe;
+ if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
+
+ dest.on('unpipe', onunpipe);
+ function onunpipe(readable, unpipeInfo) {
+ debug('onunpipe');
+ if (readable === src) {
+ if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
+ unpipeInfo.hasUnpiped = true;
+ cleanup();
+ }
+ }
+ }
+
+ function onend() {
+ debug('onend');
+ dest.end();
+ }
+
+ // when the dest drains, it reduces the awaitDrain counter
+ // on the source. This would be more elegant with a .once()
+ // handler in flow(), but adding and removing repeatedly is
+ // too slow.
+ var ondrain = pipeOnDrain(src);
+ dest.on('drain', ondrain);
+
+ var cleanedUp = false;
+ function cleanup() {
+ debug('cleanup');
+ // cleanup event handlers once the pipe is broken
+ dest.removeListener('close', onclose);
+ dest.removeListener('finish', onfinish);
+ dest.removeListener('drain', ondrain);
+ dest.removeListener('error', onerror);
+ dest.removeListener('unpipe', onunpipe);
+ src.removeListener('end', onend);
+ src.removeListener('end', unpipe);
+ src.removeListener('data', ondata);
+
+ cleanedUp = true;
+
+ // if the reader is waiting for a drain event from this
+ // specific writer, then it would cause it to never start
+ // flowing again.
+ // So, if this is awaiting a drain, then we just call it now.
+ // If we don't know, then assume that we are waiting for one.
+ if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
+ }
+
+ // If the user pushes more data while we're writing to dest then we'll end up
+ // in ondata again. However, we only want to increase awaitDrain once because
+ // dest will only emit one 'drain' event for the multiple writes.
+ // => Introduce a guard on increasing awaitDrain.
+ var increasedAwaitDrain = false;
+ src.on('data', ondata);
+ function ondata(chunk) {
+ debug('ondata');
+ increasedAwaitDrain = false;
+ var ret = dest.write(chunk);
+ if (false === ret && !increasedAwaitDrain) {
+ // If the user unpiped during `dest.write()`, it is possible
+ // to get stuck in a permanently paused state if that write
+ // also returned false.
+ // => Check whether `dest` is still a piping destination.
+ if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
+ debug('false write response, pause', src._readableState.awaitDrain);
+ src._readableState.awaitDrain++;
+ increasedAwaitDrain = true;
+ }
+ src.pause();
+ }
+ }
+
+ // if the dest has an error, then stop piping into it.
+ // however, don't suppress the throwing behavior for this.
+ function onerror(er) {
+ debug('onerror', er);
+ unpipe();
+ dest.removeListener('error', onerror);
+ if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
+ }
+
+ // Make sure our error handler is attached before userland ones.
+ prependListener(dest, 'error', onerror);
+
+ // Both close and finish should trigger unpipe, but only once.
+ function onclose() {
+ dest.removeListener('finish', onfinish);
+ unpipe();
+ }
+ dest.once('close', onclose);
+ function onfinish() {
+ debug('onfinish');
+ dest.removeListener('close', onclose);
+ unpipe();
+ }
+ dest.once('finish', onfinish);
+
+ function unpipe() {
+ debug('unpipe');
+ src.unpipe(dest);
+ }
+
+ // tell the dest that it's being piped to
+ dest.emit('pipe', src);
+
+ // start the flow if it hasn't been started already.
+ if (!state.flowing) {
+ debug('pipe resume');
+ src.resume();
+ }
+
+ return dest;
+};
+
+function pipeOnDrain(src) {
+ return function () {
+ var state = src._readableState;
+ debug('pipeOnDrain', state.awaitDrain);
+ if (state.awaitDrain) state.awaitDrain--;
+ if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
+ state.flowing = true;
+ flow(src);
+ }
+ };
+}
+
+Readable.prototype.unpipe = function (dest) {
+ var state = this._readableState;
+ var unpipeInfo = { hasUnpiped: false };
+
+ // if we're not piping anywhere, then do nothing.
+ if (state.pipesCount === 0) return this;
+
+ // just one destination. most common case.
+ if (state.pipesCount === 1) {
+ // passed in one, but it's not the right one.
+ if (dest && dest !== state.pipes) return this;
+
+ if (!dest) dest = state.pipes;
+
+ // got a match.
+ state.pipes = null;
+ state.pipesCount = 0;
+ state.flowing = false;
+ if (dest) dest.emit('unpipe', this, unpipeInfo);
+ return this;
+ }
+
+ // slow case. multiple pipe destinations.
+
+ if (!dest) {
+ // remove all.
+ var dests = state.pipes;
+ var len = state.pipesCount;
+ state.pipes = null;
+ state.pipesCount = 0;
+ state.flowing = false;
+
+ for (var i = 0; i < len; i++) {
+ dests[i].emit('unpipe', this, unpipeInfo);
+ }return this;
+ }
+
+ // try to find the right one.
+ var index = indexOf(state.pipes, dest);
+ if (index === -1) return this;
+
+ state.pipes.splice(index, 1);
+ state.pipesCount -= 1;
+ if (state.pipesCount === 1) state.pipes = state.pipes[0];
+
+ dest.emit('unpipe', this, unpipeInfo);
+
+ return this;
+};
+
+// set up data events if they are asked for
+// Ensure readable listeners eventually get something
+Readable.prototype.on = function (ev, fn) {
+ var res = Stream.prototype.on.call(this, ev, fn);
+
+ if (ev === 'data') {
+ // Start flowing on next tick if stream isn't explicitly paused
+ if (this._readableState.flowing !== false) this.resume();
+ } else if (ev === 'readable') {
+ var state = this._readableState;
+ if (!state.endEmitted && !state.readableListening) {
+ state.readableListening = state.needReadable = true;
+ state.emittedReadable = false;
+ if (!state.reading) {
+ processNextTick(nReadingNextTick, this);
+ } else if (state.length) {
+ emitReadable(this);
+ }
+ }
+ }
+
+ return res;
+};
+Readable.prototype.addListener = Readable.prototype.on;
+
+function nReadingNextTick(self) {
+ debug('readable nexttick read 0');
+ self.read(0);
+}
+
+// pause() and resume() are remnants of the legacy readable stream API
+// If the user uses them, then switch into old mode.
+Readable.prototype.resume = function () {
+ var state = this._readableState;
+ if (!state.flowing) {
+ debug('resume');
+ state.flowing = true;
+ resume(this, state);
+ }
+ return this;
+};
+
+function resume(stream, state) {
+ if (!state.resumeScheduled) {
+ state.resumeScheduled = true;
+ processNextTick(resume_, stream, state);
+ }
+}
+
+function resume_(stream, state) {
+ if (!state.reading) {
+ debug('resume read 0');
+ stream.read(0);
+ }
+
+ state.resumeScheduled = false;
+ state.awaitDrain = 0;
+ stream.emit('resume');
+ flow(stream);
+ if (state.flowing && !state.reading) stream.read(0);
+}
+
+Readable.prototype.pause = function () {
+ debug('call pause flowing=%j', this._readableState.flowing);
+ if (false !== this._readableState.flowing) {
+ debug('pause');
+ this._readableState.flowing = false;
+ this.emit('pause');
+ }
+ return this;
+};
+
+function flow(stream) {
+ var state = stream._readableState;
+ debug('flow', state.flowing);
+ while (state.flowing && stream.read() !== null) {}
+}
+
+// wrap an old-style stream as the async data source.
+// This is *not* part of the readable stream interface.
+// It is an ugly unfortunate mess of history.
+Readable.prototype.wrap = function (stream) {
+ var _this = this;
+
+ var state = this._readableState;
+ var paused = false;
+
+ stream.on('end', function () {
+ debug('wrapped end');
+ if (state.decoder && !state.ended) {
+ var chunk = state.decoder.end();
+ if (chunk && chunk.length) _this.push(chunk);
+ }
+
+ _this.push(null);
+ });
+
+ stream.on('data', function (chunk) {
+ debug('wrapped data');
+ if (state.decoder) chunk = state.decoder.write(chunk);
+
+ // don't skip over falsy values in objectMode
+ if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
+
+ var ret = _this.push(chunk);
+ if (!ret) {
+ paused = true;
+ stream.pause();
+ }
+ });
+
+ // proxy all the other methods.
+ // important when wrapping filters and duplexes.
+ for (var i in stream) {
+ if (this[i] === undefined && typeof stream[i] === 'function') {
+ this[i] = function (method) {
+ return function () {
+ return stream[method].apply(stream, arguments);
+ };
+ }(i);
+ }
+ }
+
+ // proxy certain important events.
+ for (var n = 0; n < kProxyEvents.length; n++) {
+ stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
+ }
+
+ // when we try to consume some more bytes, simply unpause the
+ // underlying stream.
+ this._read = function (n) {
+ debug('wrapped _read', n);
+ if (paused) {
+ paused = false;
+ stream.resume();
+ }
+ };
+
+ return this;
+};
+
+// exposed for testing purposes only.
+Readable._fromList = fromList;
+
+// Pluck off n bytes from an array of buffers.
+// Length is the combined lengths of all the buffers in the list.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function fromList(n, state) {
+ // nothing buffered
+ if (state.length === 0) return null;
+
+ var ret;
+ if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
+ // read it all, truncate the list
+ if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
+ state.buffer.clear();
+ } else {
+ // read part of list
+ ret = fromListPartial(n, state.buffer, state.decoder);
+ }
+
+ return ret;
+}
+
+// Extracts only enough buffered data to satisfy the amount requested.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function fromListPartial(n, list, hasStrings) {
+ var ret;
+ if (n < list.head.data.length) {
+ // slice is the same for buffers and strings
+ ret = list.head.data.slice(0, n);
+ list.head.data = list.head.data.slice(n);
+ } else if (n === list.head.data.length) {
+ // first chunk is a perfect match
+ ret = list.shift();
+ } else {
+ // result spans more than one buffer
+ ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
+ }
+ return ret;
+}
+
+// Copies a specified amount of characters from the list of buffered data
+// chunks.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function copyFromBufferString(n, list) {
+ var p = list.head;
+ var c = 1;
+ var ret = p.data;
+ n -= ret.length;
+ while (p = p.next) {
+ var str = p.data;
+ var nb = n > str.length ? str.length : n;
+ if (nb === str.length) ret += str;else ret += str.slice(0, n);
+ n -= nb;
+ if (n === 0) {
+ if (nb === str.length) {
+ ++c;
+ if (p.next) list.head = p.next;else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = str.slice(nb);
+ }
+ break;
+ }
+ ++c;
+ }
+ list.length -= c;
+ return ret;
+}
+
+// Copies a specified amount of bytes from the list of buffered data chunks.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function copyFromBuffer(n, list) {
+ var ret = Buffer.allocUnsafe(n);
+ var p = list.head;
+ var c = 1;
+ p.data.copy(ret);
+ n -= p.data.length;
+ while (p = p.next) {
+ var buf = p.data;
+ var nb = n > buf.length ? buf.length : n;
+ buf.copy(ret, ret.length - n, 0, nb);
+ n -= nb;
+ if (n === 0) {
+ if (nb === buf.length) {
+ ++c;
+ if (p.next) list.head = p.next;else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = buf.slice(nb);
+ }
+ break;
+ }
+ ++c;
+ }
+ list.length -= c;
+ return ret;
+}
+
+function endReadable(stream) {
+ var state = stream._readableState;
+
+ // If we get here before consuming all the bytes, then that is a
+ // bug in node. Should never happen.
+ if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
+
+ if (!state.endEmitted) {
+ state.ended = true;
+ processNextTick(endReadableNT, state, stream);
+ }
+}
+
+function endReadableNT(state, stream) {
+ // Check that we didn't get one last unshift.
+ if (!state.endEmitted && state.length === 0) {
+ state.endEmitted = true;
+ stream.readable = false;
+ stream.emit('end');
+ }
+}
+
+function forEach(xs, f) {
+ for (var i = 0, l = xs.length; i < l; i++) {
+ f(xs[i], i);
+ }
+}
+
+function indexOf(xs, x) {
+ for (var i = 0, l = xs.length; i < l; i++) {
+ if (xs[i] === x) return i;
+ }
+ return -1;
+}
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(40), __webpack_require__(48)))
+
+/***/ }),
+/* 101 */
+/***/ (function(module, exports, __webpack_require__) {
+
+module.exports = __webpack_require__(90).EventEmitter;
+
+
+/***/ }),
+/* 102 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/**/
+
+var processNextTick = __webpack_require__(86).nextTick;
+/**/
+
+// undocumented cb() API, needed for core, not for public API
+function destroy(err, cb) {
+ var _this = this;
+
+ var readableDestroyed = this._readableState && this._readableState.destroyed;
+ var writableDestroyed = this._writableState && this._writableState.destroyed;
+
+ if (readableDestroyed || writableDestroyed) {
+ if (cb) {
+ cb(err);
+ } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
+ processNextTick(emitErrorNT, this, err);
+ }
+ return this;
+ }
+
+ // we set destroyed to true before firing error callbacks in order
+ // to make it re-entrance safe in case destroy() is called within callbacks
+
+ if (this._readableState) {
+ this._readableState.destroyed = true;
+ }
+
+ // if this is a duplex stream mark the writable part as destroyed as well
+ if (this._writableState) {
+ this._writableState.destroyed = true;
+ }
+
+ this._destroy(err || null, function (err) {
+ if (!cb && err) {
+ processNextTick(emitErrorNT, _this, err);
+ if (_this._writableState) {
+ _this._writableState.errorEmitted = true;
+ }
+ } else if (cb) {
+ cb(err);
+ }
+ });
+
+ return this;
+}
+
+function undestroy() {
+ if (this._readableState) {
+ this._readableState.destroyed = false;
+ this._readableState.reading = false;
+ this._readableState.ended = false;
+ this._readableState.endEmitted = false;
+ }
+
+ if (this._writableState) {
+ this._writableState.destroyed = false;
+ this._writableState.ended = false;
+ this._writableState.ending = false;
+ this._writableState.finished = false;
+ this._writableState.errorEmitted = false;
+ }
+}
+
+function emitErrorNT(self, err) {
+ self.emit('error', err);
+}
+
+module.exports = {
+ destroy: destroy,
+ undestroy: undestroy
+};
+
+/***/ }),
+/* 103 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Buffer = __webpack_require__(87).Buffer;
+
+var isEncoding = Buffer.isEncoding || function (encoding) {
+ encoding = '' + encoding;
+ switch (encoding && encoding.toLowerCase()) {
+ case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
+ return true;
+ default:
+ return false;
+ }
+};
+
+function _normalizeEncoding(enc) {
+ if (!enc) return 'utf8';
+ var retried;
+ while (true) {
+ switch (enc) {
+ case 'utf8':
+ case 'utf-8':
+ return 'utf8';
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return 'utf16le';
+ case 'latin1':
+ case 'binary':
+ return 'latin1';
+ case 'base64':
+ case 'ascii':
+ case 'hex':
+ return enc;
+ default:
+ if (retried) return; // undefined
+ enc = ('' + enc).toLowerCase();
+ retried = true;
+ }
+ }
+};
+
+// Do not cache `Buffer.isEncoding` when checking encoding names as some
+// modules monkey-patch it to support additional encodings
+function normalizeEncoding(enc) {
+ var nenc = _normalizeEncoding(enc);
+ if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
+ return nenc || enc;
+}
+
+// StringDecoder provides an interface for efficiently splitting a series of
+// buffers into a series of JS strings without breaking apart multi-byte
+// characters.
+exports.StringDecoder = StringDecoder;
+function StringDecoder(encoding) {
+ this.encoding = normalizeEncoding(encoding);
+ var nb;
+ switch (this.encoding) {
+ case 'utf16le':
+ this.text = utf16Text;
+ this.end = utf16End;
+ nb = 4;
+ break;
+ case 'utf8':
+ this.fillLast = utf8FillLast;
+ nb = 4;
+ break;
+ case 'base64':
+ this.text = base64Text;
+ this.end = base64End;
+ nb = 3;
+ break;
+ default:
+ this.write = simpleWrite;
+ this.end = simpleEnd;
+ return;
+ }
+ this.lastNeed = 0;
+ this.lastTotal = 0;
+ this.lastChar = Buffer.allocUnsafe(nb);
+}
+
+StringDecoder.prototype.write = function (buf) {
+ if (buf.length === 0) return '';
+ var r;
+ var i;
+ if (this.lastNeed) {
+ r = this.fillLast(buf);
+ if (r === undefined) return '';
+ i = this.lastNeed;
+ this.lastNeed = 0;
+ } else {
+ i = 0;
+ }
+ if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
+ return r || '';
+};
+
+StringDecoder.prototype.end = utf8End;
+
+// Returns only complete characters in a Buffer
+StringDecoder.prototype.text = utf8Text;
+
+// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
+StringDecoder.prototype.fillLast = function (buf) {
+ if (this.lastNeed <= buf.length) {
+ buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
+ return this.lastChar.toString(this.encoding, 0, this.lastTotal);
+ }
+ buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
+ this.lastNeed -= buf.length;
+};
+
+// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
+// continuation byte.
+function utf8CheckByte(byte) {
+ if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
+ return -1;
+}
+
+// Checks at most 3 bytes at the end of a Buffer in order to detect an
+// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
+// needed to complete the UTF-8 character (if applicable) are returned.
+function utf8CheckIncomplete(self, buf, i) {
+ var j = buf.length - 1;
+ if (j < i) return 0;
+ var nb = utf8CheckByte(buf[j]);
+ if (nb >= 0) {
+ if (nb > 0) self.lastNeed = nb - 1;
+ return nb;
+ }
+ if (--j < i) return 0;
+ nb = utf8CheckByte(buf[j]);
+ if (nb >= 0) {
+ if (nb > 0) self.lastNeed = nb - 2;
+ return nb;
+ }
+ if (--j < i) return 0;
+ nb = utf8CheckByte(buf[j]);
+ if (nb >= 0) {
+ if (nb > 0) {
+ if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
+ }
+ return nb;
+ }
+ return 0;
+}
+
+// Validates as many continuation bytes for a multi-byte UTF-8 character as
+// needed or are available. If we see a non-continuation byte where we expect
+// one, we "replace" the validated continuation bytes we've seen so far with
+// UTF-8 replacement characters ('\ufffd'), to match v8's UTF-8 decoding
+// behavior. The continuation byte check is included three times in the case
+// where all of the continuation bytes for a character exist in the same buffer.
+// It is also done this way as a slight performance increase instead of using a
+// loop.
+function utf8CheckExtraBytes(self, buf, p) {
+ if ((buf[0] & 0xC0) !== 0x80) {
+ self.lastNeed = 0;
+ return '\ufffd'.repeat(p);
+ }
+ if (self.lastNeed > 1 && buf.length > 1) {
+ if ((buf[1] & 0xC0) !== 0x80) {
+ self.lastNeed = 1;
+ return '\ufffd'.repeat(p + 1);
+ }
+ if (self.lastNeed > 2 && buf.length > 2) {
+ if ((buf[2] & 0xC0) !== 0x80) {
+ self.lastNeed = 2;
+ return '\ufffd'.repeat(p + 2);
+ }
+ }
+ }
+}
+
+// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
+function utf8FillLast(buf) {
+ var p = this.lastTotal - this.lastNeed;
+ var r = utf8CheckExtraBytes(this, buf, p);
+ if (r !== undefined) return r;
+ if (this.lastNeed <= buf.length) {
+ buf.copy(this.lastChar, p, 0, this.lastNeed);
+ return this.lastChar.toString(this.encoding, 0, this.lastTotal);
+ }
+ buf.copy(this.lastChar, p, 0, buf.length);
+ this.lastNeed -= buf.length;
+}
+
+// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
+// partial character, the character's bytes are buffered until the required
+// number of bytes are available.
+function utf8Text(buf, i) {
+ var total = utf8CheckIncomplete(this, buf, i);
+ if (!this.lastNeed) return buf.toString('utf8', i);
+ this.lastTotal = total;
+ var end = buf.length - (total - this.lastNeed);
+ buf.copy(this.lastChar, 0, end);
+ return buf.toString('utf8', i, end);
+}
+
+// For UTF-8, a replacement character for each buffered byte of a (partial)
+// character needs to be added to the output.
+function utf8End(buf) {
+ var r = buf && buf.length ? this.write(buf) : '';
+ if (this.lastNeed) return r + '\ufffd'.repeat(this.lastTotal - this.lastNeed);
+ return r;
+}
+
+// UTF-16LE typically needs two bytes per character, but even if we have an even
+// number of bytes available, we need to check if we end on a leading/high
+// surrogate. In that case, we need to wait for the next two bytes in order to
+// decode the last character properly.
+function utf16Text(buf, i) {
+ if ((buf.length - i) % 2 === 0) {
+ var r = buf.toString('utf16le', i);
+ if (r) {
+ var c = r.charCodeAt(r.length - 1);
+ if (c >= 0xD800 && c <= 0xDBFF) {
+ this.lastNeed = 2;
+ this.lastTotal = 4;
+ this.lastChar[0] = buf[buf.length - 2];
+ this.lastChar[1] = buf[buf.length - 1];
+ return r.slice(0, -1);
+ }
+ }
+ return r;
+ }
+ this.lastNeed = 1;
+ this.lastTotal = 2;
+ this.lastChar[0] = buf[buf.length - 1];
+ return buf.toString('utf16le', i, buf.length - 1);
+}
+
+// For UTF-16LE we do not explicitly append special replacement characters if we
+// end on a partial character, we simply let v8 handle that.
+function utf16End(buf) {
+ var r = buf && buf.length ? this.write(buf) : '';
+ if (this.lastNeed) {
+ var end = this.lastTotal - this.lastNeed;
+ return r + this.lastChar.toString('utf16le', 0, end);
+ }
+ return r;
+}
+
+function base64Text(buf, i) {
+ var n = (buf.length - i) % 3;
+ if (n === 0) return buf.toString('base64', i);
+ this.lastNeed = 3 - n;
+ this.lastTotal = 3;
+ if (n === 1) {
+ this.lastChar[0] = buf[buf.length - 1];
+ } else {
+ this.lastChar[0] = buf[buf.length - 2];
+ this.lastChar[1] = buf[buf.length - 1];
+ }
+ return buf.toString('base64', i, buf.length - n);
+}
+
+function base64End(buf) {
+ var r = buf && buf.length ? this.write(buf) : '';
+ if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
+ return r;
+}
+
+// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
+function simpleWrite(buf) {
+ return buf.toString(this.encoding);
+}
+
+function simpleEnd(buf) {
+ return buf && buf.length ? this.write(buf) : '';
+}
+
+/***/ }),
+/* 104 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// a transform stream is a readable/writable stream where you do
+// something with the data. Sometimes it's called a "filter",
+// but that's not a great name for it, since that implies a thing where
+// some bits pass through, and others are simply ignored. (That would
+// be a valid example of a transform, of course.)
+//
+// While the output is causally related to the input, it's not a
+// necessarily symmetric or synchronous transformation. For example,
+// a zlib stream might take multiple plain-text writes(), and then
+// emit a single compressed chunk some time in the future.
+//
+// Here's how this works:
+//
+// The Transform stream has all the aspects of the readable and writable
+// stream classes. When you write(chunk), that calls _write(chunk,cb)
+// internally, and returns false if there's a lot of pending writes
+// buffered up. When you call read(), that calls _read(n) until
+// there's enough pending readable data buffered up.
+//
+// In a transform stream, the written data is placed in a buffer. When
+// _read(n) is called, it transforms the queued up data, calling the
+// buffered _write cb's as it consumes chunks. If consuming a single
+// written chunk would result in multiple output chunks, then the first
+// outputted bit calls the readcb, and subsequent chunks just go into
+// the read buffer, and will cause it to emit 'readable' if necessary.
+//
+// This way, back-pressure is actually determined by the reading side,
+// since _read has to be called to start processing a new chunk. However,
+// a pathological inflate type of transform can cause excessive buffering
+// here. For example, imagine a stream where every byte of input is
+// interpreted as an integer from 0-255, and then results in that many
+// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
+// 1kb of data being output. In this case, you could write a very small
+// amount of input, and end up with a very large amount of output. In
+// such a pathological inflating mechanism, there'd be no way to tell
+// the system to stop doing the transform. A single 4MB write could
+// cause the system to run out of memory.
+//
+// However, even in such a pathological case, only a single written chunk
+// would be consumed, and then the rest would wait (un-transformed) until
+// the results of the previous transformed chunk were consumed.
+
+
+
+module.exports = Transform;
+
+var Duplex = __webpack_require__(80);
+
+/**/
+var util = __webpack_require__(84);
+util.inherits = __webpack_require__(82);
+/**/
+
+util.inherits(Transform, Duplex);
+
+function afterTransform(er, data) {
+ var ts = this._transformState;
+ ts.transforming = false;
+
+ var cb = ts.writecb;
+
+ if (!cb) {
+ return this.emit('error', new Error('write callback called multiple times'));
+ }
+
+ ts.writechunk = null;
+ ts.writecb = null;
+
+ if (data != null) // single equals check for both `null` and `undefined`
+ this.push(data);
+
+ cb(er);
+
+ var rs = this._readableState;
+ rs.reading = false;
+ if (rs.needReadable || rs.length < rs.highWaterMark) {
+ this._read(rs.highWaterMark);
+ }
+}
+
+function Transform(options) {
+ if (!(this instanceof Transform)) return new Transform(options);
+
+ Duplex.call(this, options);
+
+ this._transformState = {
+ afterTransform: afterTransform.bind(this),
+ needTransform: false,
+ transforming: false,
+ writecb: null,
+ writechunk: null,
+ writeencoding: null
+ };
+
+ // start out asking for a readable event once data is transformed.
+ this._readableState.needReadable = true;
+
+ // we have implemented the _read method, and done the other things
+ // that Readable wants before the first _read call, so unset the
+ // sync guard flag.
+ this._readableState.sync = false;
+
+ if (options) {
+ if (typeof options.transform === 'function') this._transform = options.transform;
+
+ if (typeof options.flush === 'function') this._flush = options.flush;
+ }
+
+ // When the writable side finishes, then flush out anything remaining.
+ this.on('prefinish', prefinish);
+}
+
+function prefinish() {
+ var _this = this;
+
+ if (typeof this._flush === 'function') {
+ this._flush(function (er, data) {
+ done(_this, er, data);
+ });
+ } else {
+ done(this, null, null);
+ }
+}
+
+Transform.prototype.push = function (chunk, encoding) {
+ this._transformState.needTransform = false;
+ return Duplex.prototype.push.call(this, chunk, encoding);
+};
+
+// This is the part where you do stuff!
+// override this function in implementation classes.
+// 'chunk' is an input chunk.
+//
+// Call `push(newChunk)` to pass along transformed output
+// to the readable side. You may call 'push' zero or more times.
+//
+// Call `cb(err)` when you are done with this chunk. If you pass
+// an error, then that'll put the hurt on the whole operation. If you
+// never call cb(), then you'll never get another chunk.
+Transform.prototype._transform = function (chunk, encoding, cb) {
+ throw new Error('_transform() is not implemented');
+};
+
+Transform.prototype._write = function (chunk, encoding, cb) {
+ var ts = this._transformState;
+ ts.writecb = cb;
+ ts.writechunk = chunk;
+ ts.writeencoding = encoding;
+ if (!ts.transforming) {
+ var rs = this._readableState;
+ if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
+ }
+};
+
+// Doesn't matter what the args are here.
+// _transform does all the work.
+// That we got here means that the readable side wants more data.
+Transform.prototype._read = function (n) {
+ var ts = this._transformState;
+
+ if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
+ ts.transforming = true;
+ this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
+ } else {
+ // mark that we need a transform, so that any data that comes in
+ // will get processed, now that we've asked for it.
+ ts.needTransform = true;
+ }
+};
+
+Transform.prototype._destroy = function (err, cb) {
+ var _this2 = this;
+
+ Duplex.prototype._destroy.call(this, err, function (err2) {
+ cb(err2);
+ _this2.emit('close');
+ });
+};
+
+function done(stream, er, data) {
+ if (er) return stream.emit('error', er);
+
+ if (data != null) // single equals check for both `null` and `undefined`
+ stream.push(data);
+
+ // if there's nothing in the write buffer, then that means
+ // that nothing more will ever be provided
+ if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
+
+ if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
+
+ return stream.push(null);
+}
+
+/***/ }),
+/* 105 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+var utils = __webpack_require__(76);
+var support = __webpack_require__(78);
+// private property
+var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+
+
+// public method for encoding
+exports.encode = function(input) {
+ var output = [];
+ var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
+ var i = 0, len = input.length, remainingBytes = len;
+
+ var isArray = utils.getTypeOf(input) !== "string";
+ while (i < input.length) {
+ remainingBytes = len - i;
+
+ if (!isArray) {
+ chr1 = input.charCodeAt(i++);
+ chr2 = i < len ? input.charCodeAt(i++) : 0;
+ chr3 = i < len ? input.charCodeAt(i++) : 0;
+ } else {
+ chr1 = input[i++];
+ chr2 = i < len ? input[i++] : 0;
+ chr3 = i < len ? input[i++] : 0;
+ }
+
+ enc1 = chr1 >> 2;
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+ enc3 = remainingBytes > 1 ? (((chr2 & 15) << 2) | (chr3 >> 6)) : 64;
+ enc4 = remainingBytes > 2 ? (chr3 & 63) : 64;
+
+ output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4));
+
+ }
+
+ return output.join("");
+};
+
+// public method for decoding
+exports.decode = function(input) {
+ var chr1, chr2, chr3;
+ var enc1, enc2, enc3, enc4;
+ var i = 0, resultIndex = 0;
+
+ var dataUrlPrefix = "data:";
+
+ if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) {
+ // This is a common error: people give a data url
+ // (data:image/png;base64,iVBOR...) with a {base64: true} and
+ // wonders why things don't work.
+ // We can detect that the string input looks like a data url but we
+ // *can't* be sure it is one: removing everything up to the comma would
+ // be too dangerous.
+ throw new Error("Invalid base64 input, it looks like a data url.");
+ }
+
+ input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
+
+ var totalLength = input.length * 3 / 4;
+ if(input.charAt(input.length - 1) === _keyStr.charAt(64)) {
+ totalLength--;
+ }
+ if(input.charAt(input.length - 2) === _keyStr.charAt(64)) {
+ totalLength--;
+ }
+ if (totalLength % 1 !== 0) {
+ // totalLength is not an integer, the length does not match a valid
+ // base64 content. That can happen if:
+ // - the input is not a base64 content
+ // - the input is *almost* a base64 content, with a extra chars at the
+ // beginning or at the end
+ // - the input uses a base64 variant (base64url for example)
+ throw new Error("Invalid base64 input, bad content length.");
+ }
+ var output;
+ if (support.uint8array) {
+ output = new Uint8Array(totalLength|0);
+ } else {
+ output = new Array(totalLength|0);
+ }
+
+ while (i < input.length) {
+
+ enc1 = _keyStr.indexOf(input.charAt(i++));
+ enc2 = _keyStr.indexOf(input.charAt(i++));
+ enc3 = _keyStr.indexOf(input.charAt(i++));
+ enc4 = _keyStr.indexOf(input.charAt(i++));
+
+ chr1 = (enc1 << 2) | (enc2 >> 4);
+ chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
+ chr3 = ((enc3 & 3) << 6) | enc4;
+
+ output[resultIndex++] = chr1;
+
+ if (enc3 !== 64) {
+ output[resultIndex++] = chr2;
+ }
+ if (enc4 !== 64) {
+ output[resultIndex++] = chr3;
+ }
+
+ }
+
+ return output;
+};
+
+
+/***/ }),
+/* 106 */
+/***/ (function(module, exports) {
+
+var core = module.exports = {version: '2.3.0'};
+if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
+
+/***/ }),
+/* 107 */
+/***/ (function(module, exports, __webpack_require__) {
+
+// optional / simple context binding
+var aFunction = __webpack_require__(144);
+module.exports = function(fn, that, length){
+ aFunction(fn);
+ if(that === undefined)return fn;
+ switch(length){
+ case 1: return function(a){
+ return fn.call(that, a);
+ };
+ case 2: return function(a, b){
+ return fn.call(that, a, b);
+ };
+ case 3: return function(a, b, c){
+ return fn.call(that, a, b, c);
+ };
+ }
+ return function(/* ...args */){
+ return fn.apply(that, arguments);
+ };
+};
+
+/***/ }),
+/* 108 */
+/***/ (function(module, exports) {
+
+module.exports = function(exec){
+ try {
+ return !!exec();
+ } catch(e){
+ return true;
+ }
+};
+
+/***/ }),
+/* 109 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var isObject = __webpack_require__(93)
+ , document = __webpack_require__(89).document
+ // in old IE typeof document.createElement is 'object'
+ , is = isObject(document) && isObject(document.createElement);
+module.exports = function(it){
+ return is ? document.createElement(it) : {};
+};
+
+/***/ }),
+/* 110 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(Buffer) {
+
+var utils = __webpack_require__(76);
+var ConvertWorker = __webpack_require__(157);
+var GenericWorker = __webpack_require__(77);
+var base64 = __webpack_require__(105);
+var support = __webpack_require__(78);
+var external = __webpack_require__(85);
+
+var NodejsStreamOutputAdapter = null;
+if (support.nodestream) {
+ try {
+ NodejsStreamOutputAdapter = __webpack_require__(158);
+ } catch(e) {}
+}
+
+/**
+ * Apply the final transformation of the data. If the user wants a Blob for
+ * example, it's easier to work with an U8intArray and finally do the
+ * ArrayBuffer/Blob conversion.
+ * @param {String} type the name of the final type
+ * @param {String|Uint8Array|Buffer} content the content to transform
+ * @param {String} mimeType the mime type of the content, if applicable.
+ * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format.
+ */
+function transformZipOutput(type, content, mimeType) {
+ switch(type) {
+ case "blob" :
+ return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType);
+ case "base64" :
+ return base64.encode(content);
+ default :
+ return utils.transformTo(type, content);
+ }
+}
+
+/**
+ * Concatenate an array of data of the given type.
+ * @param {String} type the type of the data in the given array.
+ * @param {Array} dataArray the array containing the data chunks to concatenate
+ * @return {String|Uint8Array|Buffer} the concatenated data
+ * @throws Error if the asked type is unsupported
+ */
+function concat (type, dataArray) {
+ var i, index = 0, res = null, totalLength = 0;
+ for(i = 0; i < dataArray.length; i++) {
+ totalLength += dataArray[i].length;
+ }
+ switch(type) {
+ case "string":
+ return dataArray.join("");
+ case "array":
+ return Array.prototype.concat.apply([], dataArray);
+ case "uint8array":
+ res = new Uint8Array(totalLength);
+ for(i = 0; i < dataArray.length; i++) {
+ res.set(dataArray[i], index);
+ index += dataArray[i].length;
+ }
+ return res;
+ case "nodebuffer":
+ return Buffer.concat(dataArray);
+ default:
+ throw new Error("concat : unsupported type '" + type + "'");
+ }
+}
+
+/**
+ * Listen a StreamHelper, accumulate its content and concatenate it into a
+ * complete block.
+ * @param {StreamHelper} helper the helper to use.
+ * @param {Function} updateCallback a callback called on each update. Called
+ * with one arg :
+ * - the metadata linked to the update received.
+ * @return Promise the promise for the accumulation.
+ */
+function accumulate(helper, updateCallback) {
+ return new external.Promise(function (resolve, reject){
+ var dataArray = [];
+ var chunkType = helper._internalType,
+ resultType = helper._outputType,
+ mimeType = helper._mimeType;
+ helper
+ .on('data', function (data, meta) {
+ dataArray.push(data);
+ if(updateCallback) {
+ updateCallback(meta);
+ }
+ })
+ .on('error', function(err) {
+ dataArray = [];
+ reject(err);
+ })
+ .on('end', function (){
+ try {
+ var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType);
+ resolve(result);
+ } catch (e) {
+ reject(e);
+ }
+ dataArray = [];
+ })
+ .resume();
+ });
+}
+
+/**
+ * An helper to easily use workers outside of JSZip.
+ * @constructor
+ * @param {Worker} worker the worker to wrap
+ * @param {String} outputType the type of data expected by the use
+ * @param {String} mimeType the mime type of the content, if applicable.
+ */
+function StreamHelper(worker, outputType, mimeType) {
+ var internalType = outputType;
+ switch(outputType) {
+ case "blob":
+ case "arraybuffer":
+ internalType = "uint8array";
+ break;
+ case "base64":
+ internalType = "string";
+ break;
+ }
+
+ try {
+ // the type used internally
+ this._internalType = internalType;
+ // the type used to output results
+ this._outputType = outputType;
+ // the mime type
+ this._mimeType = mimeType;
+ utils.checkSupport(internalType);
+ this._worker = worker.pipe(new ConvertWorker(internalType));
+ // the last workers can be rewired without issues but we need to
+ // prevent any updates on previous workers.
+ worker.lock();
+ } catch(e) {
+ this._worker = new GenericWorker("error");
+ this._worker.error(e);
+ }
+}
+
+StreamHelper.prototype = {
+ /**
+ * Listen a StreamHelper, accumulate its content and concatenate it into a
+ * complete block.
+ * @param {Function} updateCb the update callback.
+ * @return Promise the promise for the accumulation.
+ */
+ accumulate : function (updateCb) {
+ return accumulate(this, updateCb);
+ },
+ /**
+ * Add a listener on an event triggered on a stream.
+ * @param {String} evt the name of the event
+ * @param {Function} fn the listener
+ * @return {StreamHelper} the current helper.
+ */
+ on : function (evt, fn) {
+ var self = this;
+
+ if(evt === "data") {
+ this._worker.on(evt, function (chunk) {
+ fn.call(self, chunk.data, chunk.meta);
+ });
+ } else {
+ this._worker.on(evt, function () {
+ utils.delay(fn, arguments, self);
+ });
+ }
+ return this;
+ },
+ /**
+ * Resume the flow of chunks.
+ * @return {StreamHelper} the current helper.
+ */
+ resume : function () {
+ utils.delay(this._worker.resume, [], this._worker);
+ return this;
+ },
+ /**
+ * Pause the flow of chunks.
+ * @return {StreamHelper} the current helper.
+ */
+ pause : function () {
+ this._worker.pause();
+ return this;
+ },
+ /**
+ * Return a nodejs stream for this helper.
+ * @param {Function} updateCb the update callback.
+ * @return {NodejsStreamOutputAdapter} the nodejs stream.
+ */
+ toNodejsStream : function (updateCb) {
+ utils.checkSupport("nodestream");
+ if (this._outputType !== "nodebuffer") {
+ // an object stream containing blob/arraybuffer/uint8array/string
+ // is strange and I don't know if it would be useful.
+ // I you find this comment and have a good usecase, please open a
+ // bug report !
+ throw new Error(this._outputType + " is not supported by this method");
+ }
+
+ return new NodejsStreamOutputAdapter(this, {
+ objectMode : this._outputType !== "nodebuffer"
+ }, updateCb);
+ }
+};
+
+
+module.exports = StreamHelper;
+
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(83).Buffer))
+
+/***/ }),
+/* 111 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+exports.base64 = false;
+exports.binary = false;
+exports.dir = false;
+exports.createFolders = true;
+exports.date = null;
+exports.compression = null;
+exports.compressionOptions = null;
+exports.comment = null;
+exports.unixPermissions = null;
+exports.dosPermissions = null;
+
+
+/***/ }),
+/* 112 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(76);
+var GenericWorker = __webpack_require__(77);
+
+// the size of the generated chunks
+// TODO expose this as a public variable
+var DEFAULT_BLOCK_SIZE = 16 * 1024;
+
+/**
+ * A worker that reads a content and emits chunks.
+ * @constructor
+ * @param {Promise} dataP the promise of the data to split
+ */
+function DataWorker(dataP) {
+ GenericWorker.call(this, "DataWorker");
+ var self = this;
+ this.dataIsReady = false;
+ this.index = 0;
+ this.max = 0;
+ this.data = null;
+ this.type = "";
+
+ this._tickScheduled = false;
+
+ dataP.then(function (data) {
+ self.dataIsReady = true;
+ self.data = data;
+ self.max = data && data.length || 0;
+ self.type = utils.getTypeOf(data);
+ if(!self.isPaused) {
+ self._tickAndRepeat();
+ }
+ }, function (e) {
+ self.error(e);
+ });
+}
+
+utils.inherits(DataWorker, GenericWorker);
+
+/**
+ * @see GenericWorker.cleanUp
+ */
+DataWorker.prototype.cleanUp = function () {
+ GenericWorker.prototype.cleanUp.call(this);
+ this.data = null;
+};
+
+/**
+ * @see GenericWorker.resume
+ */
+DataWorker.prototype.resume = function () {
+ if(!GenericWorker.prototype.resume.call(this)) {
+ return false;
+ }
+
+ if (!this._tickScheduled && this.dataIsReady) {
+ this._tickScheduled = true;
+ utils.delay(this._tickAndRepeat, [], this);
+ }
+ return true;
+};
+
+/**
+ * Trigger a tick a schedule an other call to this function.
+ */
+DataWorker.prototype._tickAndRepeat = function() {
+ this._tickScheduled = false;
+ if(this.isPaused || this.isFinished) {
+ return;
+ }
+ this._tick();
+ if(!this.isFinished) {
+ utils.delay(this._tickAndRepeat, [], this);
+ this._tickScheduled = true;
+ }
+};
+
+/**
+ * Read and push a chunk.
+ */
+DataWorker.prototype._tick = function() {
+
+ if(this.isPaused || this.isFinished) {
+ return false;
+ }
+
+ var size = DEFAULT_BLOCK_SIZE;
+ var data = null, nextIndex = Math.min(this.max, this.index + size);
+ if (this.index >= this.max) {
+ // EOF
+ return this.end();
+ } else {
+ switch(this.type) {
+ case "string":
+ data = this.data.substring(this.index, nextIndex);
+ break;
+ case "uint8array":
+ data = this.data.subarray(this.index, nextIndex);
+ break;
+ case "array":
+ case "nodebuffer":
+ data = this.data.slice(this.index, nextIndex);
+ break;
+ }
+ this.index = nextIndex;
+ return this.push({
+ data : data,
+ meta : {
+ percent : this.max ? this.index / this.max * 100 : 0
+ }
+ });
+ }
+};
+
+module.exports = DataWorker;
+
+
+/***/ }),
+/* 113 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(76);
+var GenericWorker = __webpack_require__(77);
+
+/**
+ * A worker which calculate the total length of the data flowing through.
+ * @constructor
+ * @param {String} propName the name used to expose the length
+ */
+function DataLengthProbe(propName) {
+ GenericWorker.call(this, "DataLengthProbe for " + propName);
+ this.propName = propName;
+ this.withStreamInfo(propName, 0);
+}
+utils.inherits(DataLengthProbe, GenericWorker);
+
+/**
+ * @see GenericWorker.processChunk
+ */
+DataLengthProbe.prototype.processChunk = function (chunk) {
+ if(chunk) {
+ var length = this.streamInfo[this.propName] || 0;
+ this.streamInfo[this.propName] = length + chunk.data.length;
+ }
+ GenericWorker.prototype.processChunk.call(this, chunk);
+};
+module.exports = DataLengthProbe;
+
+
+
+/***/ }),
+/* 114 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var GenericWorker = __webpack_require__(77);
+var crc32 = __webpack_require__(96);
+var utils = __webpack_require__(76);
+
+/**
+ * A worker which calculate the crc32 of the data flowing through.
+ * @constructor
+ */
+function Crc32Probe() {
+ GenericWorker.call(this, "Crc32Probe");
+ this.withStreamInfo("crc32", 0);
+}
+utils.inherits(Crc32Probe, GenericWorker);
+
+/**
+ * @see GenericWorker.processChunk
+ */
+Crc32Probe.prototype.processChunk = function (chunk) {
+ this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0);
+ this.push(chunk);
+};
+module.exports = Crc32Probe;
+
+
+/***/ }),
+/* 115 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var GenericWorker = __webpack_require__(77);
+
+exports.STORE = {
+ magic: "\x00\x00",
+ compressWorker : function (compressionOptions) {
+ return new GenericWorker("STORE compression");
+ },
+ uncompressWorker : function () {
+ return new GenericWorker("STORE decompression");
+ }
+};
+exports.DEFLATE = __webpack_require__(161);
+
+
+/***/ }),
+/* 116 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+// Note: adler32 takes 12% for level 0 and 2% for level 6.
+// It isn't worth it to make additional optimizations as in original.
+// Small size is preferable.
+
+// (C) 1995-2013 Jean-loup Gailly and Mark Adler
+// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+function adler32(adler, buf, len, pos) {
+ var s1 = (adler & 0xffff) |0,
+ s2 = ((adler >>> 16) & 0xffff) |0,
+ n = 0;
+
+ while (len !== 0) {
+ // Set limit ~ twice less than 5552, to keep
+ // s2 in 31-bits, because we force signed ints.
+ // in other case %= will fail.
+ n = len > 2000 ? 2000 : len;
+ len -= n;
+
+ do {
+ s1 = (s1 + buf[pos++]) |0;
+ s2 = (s2 + s1) |0;
+ } while (--n);
+
+ s1 %= 65521;
+ s2 %= 65521;
+ }
+
+ return (s1 | (s2 << 16)) |0;
+}
+
+
+module.exports = adler32;
+
+
+/***/ }),
+/* 117 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+// Note: we can't get significant speed boost here.
+// So write code to minimize size - no pregenerated tables
+// and array tools dependencies.
+
+// (C) 1995-2013 Jean-loup Gailly and Mark Adler
+// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+// Use ordinary array, since untyped makes no boost here
+function makeTable() {
+ var c, table = [];
+
+ for (var n = 0; n < 256; n++) {
+ c = n;
+ for (var k = 0; k < 8; k++) {
+ c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
+ }
+ table[n] = c;
+ }
+
+ return table;
+}
+
+// Create table on load. Just 255 signed longs. Not a problem.
+var crcTable = makeTable();
+
+
+function crc32(crc, buf, len, pos) {
+ var t = crcTable,
+ end = pos + len;
+
+ crc ^= -1;
+
+ for (var i = pos; i < end; i++) {
+ crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
+ }
+
+ return (crc ^ (-1)); // >>> 0;
+}
+
+
+module.exports = crc32;
+
+
+/***/ }),
+/* 118 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// String encode/decode helpers
+
+
+
+var utils = __webpack_require__(79);
+
+
+// Quick check if we can use fast array to bin string conversion
+//
+// - apply(Array) can fail on Android 2.2
+// - apply(Uint8Array) can fail on iOS 5.1 Safari
+//
+var STR_APPLY_OK = true;
+var STR_APPLY_UIA_OK = true;
+
+try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }
+try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }
+
+
+// Table with utf8 lengths (calculated by first byte of sequence)
+// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
+// because max possible codepoint is 0x10ffff
+var _utf8len = new utils.Buf8(256);
+for (var q = 0; q < 256; q++) {
+ _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
+}
+_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start
+
+
+// convert string to array (typed, when possible)
+exports.string2buf = function (str) {
+ var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;
+
+ // count binary size
+ for (m_pos = 0; m_pos < str_len; m_pos++) {
+ c = str.charCodeAt(m_pos);
+ if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
+ c2 = str.charCodeAt(m_pos + 1);
+ if ((c2 & 0xfc00) === 0xdc00) {
+ c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
+ m_pos++;
+ }
+ }
+ buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
+ }
+
+ // allocate buffer
+ buf = new utils.Buf8(buf_len);
+
+ // convert
+ for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
+ c = str.charCodeAt(m_pos);
+ if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
+ c2 = str.charCodeAt(m_pos + 1);
+ if ((c2 & 0xfc00) === 0xdc00) {
+ c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
+ m_pos++;
+ }
+ }
+ if (c < 0x80) {
+ /* one byte */
+ buf[i++] = c;
+ } else if (c < 0x800) {
+ /* two bytes */
+ buf[i++] = 0xC0 | (c >>> 6);
+ buf[i++] = 0x80 | (c & 0x3f);
+ } else if (c < 0x10000) {
+ /* three bytes */
+ buf[i++] = 0xE0 | (c >>> 12);
+ buf[i++] = 0x80 | (c >>> 6 & 0x3f);
+ buf[i++] = 0x80 | (c & 0x3f);
+ } else {
+ /* four bytes */
+ buf[i++] = 0xf0 | (c >>> 18);
+ buf[i++] = 0x80 | (c >>> 12 & 0x3f);
+ buf[i++] = 0x80 | (c >>> 6 & 0x3f);
+ buf[i++] = 0x80 | (c & 0x3f);
+ }
+ }
+
+ return buf;
+};
+
+// Helper (used in 2 places)
+function buf2binstring(buf, len) {
+ // use fallback for big arrays to avoid stack overflow
+ if (len < 65537) {
+ if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
+ return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
+ }
+ }
+
+ var result = '';
+ for (var i = 0; i < len; i++) {
+ result += String.fromCharCode(buf[i]);
+ }
+ return result;
+}
+
+
+// Convert byte array to binary string
+exports.buf2binstring = function (buf) {
+ return buf2binstring(buf, buf.length);
+};
+
+
+// Convert binary string (typed, when possible)
+exports.binstring2buf = function (str) {
+ var buf = new utils.Buf8(str.length);
+ for (var i = 0, len = buf.length; i < len; i++) {
+ buf[i] = str.charCodeAt(i);
+ }
+ return buf;
+};
+
+
+// convert array to string
+exports.buf2string = function (buf, max) {
+ var i, out, c, c_len;
+ var len = max || buf.length;
+
+ // Reserve max possible length (2 words per char)
+ // NB: by unknown reasons, Array is significantly faster for
+ // String.fromCharCode.apply than Uint16Array.
+ var utf16buf = new Array(len * 2);
+
+ for (out = 0, i = 0; i < len;) {
+ c = buf[i++];
+ // quick process ascii
+ if (c < 0x80) { utf16buf[out++] = c; continue; }
+
+ c_len = _utf8len[c];
+ // skip 5 & 6 byte codes
+ if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }
+
+ // apply mask on first byte
+ c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;
+ // join the rest
+ while (c_len > 1 && i < len) {
+ c = (c << 6) | (buf[i++] & 0x3f);
+ c_len--;
+ }
+
+ // terminated by end of string?
+ if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }
+
+ if (c < 0x10000) {
+ utf16buf[out++] = c;
+ } else {
+ c -= 0x10000;
+ utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);
+ utf16buf[out++] = 0xdc00 | (c & 0x3ff);
+ }
+ }
+
+ return buf2binstring(utf16buf, out);
+};
+
+
+// Calculate max possible position in utf8 buffer,
+// that will not break sequence. If that's not possible
+// - (very small limits) return max size as is.
+//
+// buf[] - utf8 bytes array
+// max - length limit (mandatory);
+exports.utf8border = function (buf, max) {
+ var pos;
+
+ max = max || buf.length;
+ if (max > buf.length) { max = buf.length; }
+
+ // go back from last position, until start of sequence found
+ pos = max - 1;
+ while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }
+
+ // Very small and broken sequence,
+ // return max, because we should return something anyway.
+ if (pos < 0) { return max; }
+
+ // If we came to start of buffer - that means buffer is too small,
+ // return max too.
+ if (pos === 0) { return max; }
+
+ return (pos + _utf8len[buf[pos]] > max) ? pos : max;
+};
+
+
+/***/ }),
+/* 119 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+// (C) 1995-2013 Jean-loup Gailly and Mark Adler
+// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+function ZStream() {
+ /* next input byte */
+ this.input = null; // JS specific, because we have no pointers
+ this.next_in = 0;
+ /* number of bytes available at input */
+ this.avail_in = 0;
+ /* total number of input bytes read so far */
+ this.total_in = 0;
+ /* next output byte should be put there */
+ this.output = null; // JS specific, because we have no pointers
+ this.next_out = 0;
+ /* remaining free space at output */
+ this.avail_out = 0;
+ /* total number of bytes output so far */
+ this.total_out = 0;
+ /* last error message, NULL if no error */
+ this.msg = ''/*Z_NULL*/;
+ /* not visible by applications */
+ this.state = null;
+ /* best guess about the data type: binary or text */
+ this.data_type = 2/*Z_UNKNOWN*/;
+ /* adler32 value of the uncompressed data */
+ this.adler = 0;
+}
+
+module.exports = ZStream;
+
+
+/***/ }),
+/* 120 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+// (C) 1995-2013 Jean-loup Gailly and Mark Adler
+// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+module.exports = {
+
+ /* Allowed flush values; see deflate() and inflate() below for details */
+ Z_NO_FLUSH: 0,
+ Z_PARTIAL_FLUSH: 1,
+ Z_SYNC_FLUSH: 2,
+ Z_FULL_FLUSH: 3,
+ Z_FINISH: 4,
+ Z_BLOCK: 5,
+ Z_TREES: 6,
+
+ /* Return codes for the compression/decompression functions. Negative values
+ * are errors, positive values are used for special but normal events.
+ */
+ Z_OK: 0,
+ Z_STREAM_END: 1,
+ Z_NEED_DICT: 2,
+ Z_ERRNO: -1,
+ Z_STREAM_ERROR: -2,
+ Z_DATA_ERROR: -3,
+ //Z_MEM_ERROR: -4,
+ Z_BUF_ERROR: -5,
+ //Z_VERSION_ERROR: -6,
+
+ /* compression levels */
+ Z_NO_COMPRESSION: 0,
+ Z_BEST_SPEED: 1,
+ Z_BEST_COMPRESSION: 9,
+ Z_DEFAULT_COMPRESSION: -1,
+
+
+ Z_FILTERED: 1,
+ Z_HUFFMAN_ONLY: 2,
+ Z_RLE: 3,
+ Z_FIXED: 4,
+ Z_DEFAULT_STRATEGY: 0,
+
+ /* Possible values of the data_type field (though see inflate()) */
+ Z_BINARY: 0,
+ Z_TEXT: 1,
+ //Z_ASCII: 1, // = Z_TEXT (deprecated)
+ Z_UNKNOWN: 2,
+
+ /* The deflate compression method */
+ Z_DEFLATED: 8
+ //Z_NULL: null // Use -1 or null inline, depending on var type
+};
+
+
+/***/ }),
+/* 121 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+exports.LOCAL_FILE_HEADER = "PK\x03\x04";
+exports.CENTRAL_FILE_HEADER = "PK\x01\x02";
+exports.CENTRAL_DIRECTORY_END = "PK\x05\x06";
+exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07";
+exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06";
+exports.DATA_DESCRIPTOR = "PK\x07\x08";
+
+
+/***/ }),
+/* 122 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var utils = __webpack_require__(76);
+var support = __webpack_require__(78);
+var ArrayReader = __webpack_require__(123);
+var StringReader = __webpack_require__(175);
+var NodeBufferReader = __webpack_require__(176);
+var Uint8ArrayReader = __webpack_require__(125);
+
+/**
+ * Create a reader adapted to the data.
+ * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read.
+ * @return {DataReader} the data reader.
+ */
+module.exports = function (data) {
+ var type = utils.getTypeOf(data);
+ utils.checkSupport(type);
+ if (type === "string" && !support.uint8array) {
+ return new StringReader(data);
+ }
+ if (type === "nodebuffer") {
+ return new NodeBufferReader(data);
+ }
+ if (support.uint8array) {
+ return new Uint8ArrayReader(utils.transformTo("uint8array", data));
+ }
+ return new ArrayReader(utils.transformTo("array", data));
+};
+
+
+/***/ }),
+/* 123 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+var DataReader = __webpack_require__(124);
+var utils = __webpack_require__(76);
+
+function ArrayReader(data) {
+ DataReader.call(this, data);
+ for(var i = 0; i < this.data.length; i++) {
+ data[i] = data[i] & 0xFF;
+ }
+}
+utils.inherits(ArrayReader, DataReader);
+/**
+ * @see DataReader.byteAt
+ */
+ArrayReader.prototype.byteAt = function(i) {
+ return this.data[this.zero + i];
+};
+/**
+ * @see DataReader.lastIndexOfSignature
+ */
+ArrayReader.prototype.lastIndexOfSignature = function(sig) {
+ var sig0 = sig.charCodeAt(0),
+ sig1 = sig.charCodeAt(1),
+ sig2 = sig.charCodeAt(2),
+ sig3 = sig.charCodeAt(3);
+ for (var i = this.length - 4; i >= 0; --i) {
+ if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) {
+ return i - this.zero;
+ }
+ }
+
+ return -1;
+};
+/**
+ * @see DataReader.readAndCheckSignature
+ */
+ArrayReader.prototype.readAndCheckSignature = function (sig) {
+ var sig0 = sig.charCodeAt(0),
+ sig1 = sig.charCodeAt(1),
+ sig2 = sig.charCodeAt(2),
+ sig3 = sig.charCodeAt(3),
+ data = this.readData(4);
+ return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3];
+};
+/**
+ * @see DataReader.readData
+ */
+ArrayReader.prototype.readData = function(size) {
+ this.checkOffset(size);
+ if(size === 0) {
+ return [];
+ }
+ var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
+ this.index += size;
+ return result;
+};
+module.exports = ArrayReader;
+
+
+/***/ }),
+/* 124 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+var utils = __webpack_require__(76);
+
+function DataReader(data) {
+ this.data = data; // type : see implementation
+ this.length = data.length;
+ this.index = 0;
+ this.zero = 0;
+}
+DataReader.prototype = {
+ /**
+ * Check that the offset will not go too far.
+ * @param {string} offset the additional offset to check.
+ * @throws {Error} an Error if the offset is out of bounds.
+ */
+ checkOffset: function(offset) {
+ this.checkIndex(this.index + offset);
+ },
+ /**
+ * Check that the specified index will not be too far.
+ * @param {string} newIndex the index to check.
+ * @throws {Error} an Error if the index is out of bounds.
+ */
+ checkIndex: function(newIndex) {
+ if (this.length < this.zero + newIndex || newIndex < 0) {
+ throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?");
+ }
+ },
+ /**
+ * Change the index.
+ * @param {number} newIndex The new index.
+ * @throws {Error} if the new index is out of the data.
+ */
+ setIndex: function(newIndex) {
+ this.checkIndex(newIndex);
+ this.index = newIndex;
+ },
+ /**
+ * Skip the next n bytes.
+ * @param {number} n the number of bytes to skip.
+ * @throws {Error} if the new index is out of the data.
+ */
+ skip: function(n) {
+ this.setIndex(this.index + n);
+ },
+ /**
+ * Get the byte at the specified index.
+ * @param {number} i the index to use.
+ * @return {number} a byte.
+ */
+ byteAt: function(i) {
+ // see implementations
+ },
+ /**
+ * Get the next number with a given byte size.
+ * @param {number} size the number of bytes to read.
+ * @return {number} the corresponding number.
+ */
+ readInt: function(size) {
+ var result = 0,
+ i;
+ this.checkOffset(size);
+ for (i = this.index + size - 1; i >= this.index; i--) {
+ result = (result << 8) + this.byteAt(i);
+ }
+ this.index += size;
+ return result;
+ },
+ /**
+ * Get the next string with a given byte size.
+ * @param {number} size the number of bytes to read.
+ * @return {string} the corresponding string.
+ */
+ readString: function(size) {
+ return utils.transformTo("string", this.readData(size));
+ },
+ /**
+ * Get raw data without conversion, bytes.
+ * @param {number} size the number of bytes to read.
+ * @return {Object} the raw data, implementation specific.
+ */
+ readData: function(size) {
+ // see implementations
+ },
+ /**
+ * Find the last occurence of a zip signature (4 bytes).
+ * @param {string} sig the signature to find.
+ * @return {number} the index of the last occurence, -1 if not found.
+ */
+ lastIndexOfSignature: function(sig) {
+ // see implementations
+ },
+ /**
+ * Read the signature (4 bytes) at the current position and compare it with sig.
+ * @param {string} sig the expected signature
+ * @return {boolean} true if the signature matches, false otherwise.
+ */
+ readAndCheckSignature: function(sig) {
+ // see implementations
+ },
+ /**
+ * Get the next date.
+ * @return {Date} the date.
+ */
+ readDate: function() {
+ var dostime = this.readInt(4);
+ return new Date(Date.UTC(
+ ((dostime >> 25) & 0x7f) + 1980, // year
+ ((dostime >> 21) & 0x0f) - 1, // month
+ (dostime >> 16) & 0x1f, // day
+ (dostime >> 11) & 0x1f, // hour
+ (dostime >> 5) & 0x3f, // minute
+ (dostime & 0x1f) << 1)); // second
+ }
+};
+module.exports = DataReader;
+
+
+/***/ }),
+/* 125 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayReader = __webpack_require__(123);
+var utils = __webpack_require__(76);
+
+function Uint8ArrayReader(data) {
+ ArrayReader.call(this, data);
+}
+utils.inherits(Uint8ArrayReader, ArrayReader);
+/**
+ * @see DataReader.readData
+ */
+Uint8ArrayReader.prototype.readData = function(size) {
+ this.checkOffset(size);
+ if(size === 0) {
+ // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of [].
+ return new Uint8Array(0);
+ }
+ var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);
+ this.index += size;
+ return result;
+};
+module.exports = Uint8ArrayReader;
+
+
+/***/ }),
+/* 126 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return TerminalHelpText; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HelpTexts; });
+/* HelpText.js */
+let TerminalHelpText =
+ "Type 'help name' to learn more about the command 'name'
" +
+ 'alias [-g] [name="value"] Create or display Terminal aliases ' +
+ "analyze Get information about the current machine " +
+ "buy [-l/program] Purchase a program through the Dark Web " +
+ "cat [file] Display a .msg, .lit, or .txt file " +
+ "check [script] [args...] Print a script's logs to Terminal " +
+ "clear Clear all text on the terminal " +
+ "cls See 'clear' command " +
+ "connect [ip/hostname] Connects to a remote server " +
+ "download [script/text file] Downloads scripts or text files to your computer " +
+ "free Check the machine's memory (RAM) usage " +
+ "hack Hack the current machine " +
+ "help [command] Display this help text, or the help text for a command " +
+ "home Connect to home computer " +
+ "hostname Displays the hostname of the machine " +
+ "ifconfig Displays the IP address of the machine " +
+ "kill [script] [args...] Stops the specified script on the current server " +
+ "killall Stops all running scripts on the current machine " +
+ "ls [| grep pattern] Displays all files on the machine " +
+ "lscpu Displays the number of CPU cores on the machine " +
+ "mem [script] [-t] [n] Displays the amount of RAM required to run the script " +
+ "nano [file] Text editor - Open up and edit a script or text file " +
+ "ps Display all scripts that are currently running " +
+ "rm [file] Delete a file from the server " +
+ "run [name] [-t] [n] [args...] Execute a program or script " +
+ "scan Prints all immediately-available network connections " +
+ "scan-analyze [d] [-a] Prints info for all servers up to d nodes away " +
+ "scp [file] [server] Copies a file to a destination server " +
+ "sudov Shows whether you have root access on this computer " +
+ "tail [script] [args...] Displays dynamic logs for the specified script " +
+ "theme [preset] | bg txt hlgt Change the color scheme of the UI " +
+ "top Displays all running scripts and their RAM usage " +
+ 'unalias "[alias name]" Deletes the specified alias ';
+
+let HelpTexts = {
+ alias: 'alias [-g] [name="value"] ' +
+ "Create or display aliases. An alias enables a replacement of a word with another string. " +
+ "It can be used to abbreviate a commonly used command, or commonly used parts of a command. The NAME " +
+ "of an alias defines the word that will be replaced, while the VALUE defines what it will be replaced by. For example, " +
+ "you could create the alias 'nuke' for the Terminal command 'run NUKE.exe' using the following:
" +
+ 'alias nuke="run NUKE.exe"
' +
+ "Then, to run the NUKE.exe program you would just have to enter 'nuke' in Terminal rather than the full command. " +
+ "It is important to note that 'default' aliases will only be substituted for the first word of a Terminal command. For " +
+ "example, if the following alias was set:
" +
+ 'alias worm="HTTPWorm.exe"
' +
+ "and then you tried to run the following terminal command:
" +
+ "run worm
" +
+ "This would fail because the worm alias is not the first word of a Terminal command. To allow an alias to be substituted " +
+ "anywhere in a Terminal command, rather than just the first word, you must set it to be a global alias using the -g flag:
" +
+ 'alias -g worm="HTTPWorm.exe"
' +
+ "Now, the 'worm' alias will be substituted anytime it shows up as an individual word in a Terminal command.
" +
+ "Entering just the command 'alias' without any arguments prints the list of all defined aliases in the reusable form " +
+ "'alias NAME=VALUE' on the Terminal.
" +
+ "The 'unalias' command can be used to remove aliases.
",
+ analyze: "analze " +
+ "Prints details and statistics about the current server. The information that is printed includes basic " +
+ "server details such as the hostname, whether the player has root access, what ports are opened/closed, and also " +
+ "hacking-related information such as an estimated chance to successfully hack, an estimate of how much money is " +
+ "available on the server, etc.",
+ buy: "buy [-l / program] " +
+ "Purchase a program through the Dark Web. Requires a TOR router to use.
" +
+ "If this command is ran with the '-l' flag, it will display a list of all programs that can be bought through the " +
+ "dark web to the Terminal, as well as their costs.
" +
+ "Otherwise, the name of the program must be passed in as a parameter. This is name is NOT case-sensitive.",
+ cat: "cat [file] " +
+ "Display message (.msg), literature (.lit), or text (.txt) files. Examples:
" +
+ "cat j1.msg " +
+ "cat foo.lit " +
+ "cat servers.txt",
+ check: "check [script name] [args...] " +
+ "Print the logs of the script specified by the script name and arguments to the Terminal. Each argument must be separated by " +
+ "a space. Remember that a running script is uniquely " +
+ "identified both by its name and the arguments that are used to start it. So, if a script was ran with the following arguments:
" +
+ "run foo.script 1 2 foodnstuff
" +
+ "Then to run the 'check' command on this script you would have to pass the same arguments in:
" +
+ "check foo.script 1 2 foodnstuff",
+ clear: "clear " +
+ "Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up " +
+ "and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'cls' command",
+ cls: "cls " +
+ "Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up " +
+ "and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'clear' command",
+ connect: "connect [hostname/ip] " +
+ "Connect to a remote server. The hostname or IP address of the remote server must be given as the argument " +
+ "to this command. Note that only servers that are immediately adjacent to the current server in the network can be connected to. To " +
+ "see which servers can be connected to, use the 'scan' command.",
+ download: "download [script/text file] " +
+ "Downloads a script or text file to your computer (like your real life computer). " +
+ "You can also download all of your scripts/text files as a zip file using the following Terminal commands:
" +
+ "Download all scripts and text files: download * " +
+ "Download all scripts: download *.script " +
+ "Download all text files: download *.txt ",
+ free: "free " +
+ "Display's the memory usage on the current machine. Print the amount of RAM that is available on the current server as well as " +
+ "how much of it is being used.",
+ hack: "hack " +
+ "Attempt to hack the current server. Requires root access in order to be run. See the wiki page for hacking mechanics ",
+ help: "help [command] " +
+ "Display Terminal help information. Without arguments, 'help' prints a list of all valid Terminal commands and a brief " +
+ "description of their functionality. You can also pass the name of a Terminal command as an argument to 'help' to print " +
+ "more detailed information about the Terminal command. Examples:
" +
+ "help alias " +
+ "help scan-analyze",
+ home: "home " +
+ "Connect to your home computer. This will work no matter what server you are currently connected to.",
+ hostname: "hostname " +
+ "Prints the hostname of the current server",
+ ifconfig: "ipconfig " +
+ "Prints the IP address of the current server",
+ kill: "kill [script name] [args...] " +
+ "Kill the script specified by the script name and arguments. Each argument must be separated by " +
+ "a space. Remember that a running script is uniquely identified by " +
+ "both its name and the arguments that are used to start it. So, if a script was ran with the following arguments:
" +
+ "run foo.script 1 sigma-cosmetics
" +
+ "Then to kill this script the same arguments would have to be used:
" +
+ "kill foo.script 1 sigma-cosmetics
" +
+ "Note that after issuing the 'kill' command for a script, it may take a while for the script to actually stop running. " +
+ "This will happen if the script is in the middle of a command such as grow() or weaken() that takes time to execute. " +
+ "The script will not be stopped/killed until after that time has elapsed.",
+ killall: "killall " +
+ "Kills all scripts on the current server. " +
+ "Note that after the 'kill' command is issued for a script, it may take a while for the script to actually stop running. " +
+ "This will happen if the script is in the middle of a command such as grow() or weaken() that takes time to execute. " +
+ "The script will not be stopped/killed until after that time has elapsed.",
+ ls: "ls [| grep pattern] " +
+ "The ls command, with no arguments, prints all files on the current server to the Terminal screen. " +
+ "This includes all scripts, programs, and message files. " +
+ "The files will be displayed in alphabetical order.
" +
+ "The '| grep pattern' optional parameter can be used to only display files whose filenames match the specified pattern. " +
+ "For example, if you wanted to only display files with the .script extension, you could use:
" +
+ "ls | grep .script
" +
+ "Alternatively, if you wanted to display all files with the word purchase in the filename, you could use:
" +
+ "ls | grep purchase",
+ mem: "mem [script name] [-t] [num threads] " +
+ "Displays the amount of RAM needed to run the specified script with a single thread. The command can also be used to print " +
+ "the amount of RAM needed to run a script with multiple threads using the '-t' flag. If the '-t' flag is specified, then " +
+ "an argument for the number of threads must be passed in afterwards. Examples:
" +
+ "mem foo.script " +
+ "mem foo.script -t 50 " +
+ "The first example above will print the amount of RAM needed to run 'foo.script' with a single thread. The second example " +
+ "above will print the amount of RAM needed to run 'foo.script' with 50 threads.",
+ nano: "nano [file name] " +
+ "Opens up the specified file in the Text Editor. Only scripts (.script) or text files (.txt) can be " +
+ "edited using the Text Editor. If the file does not already exist, then a new, empty one " +
+ "will be created",
+ ps: "ps " +
+ "Prints all scripts that are running on the current server",
+ rm: "rm [file] " +
+ "Removes the specified file from the current server. A file can be a script, a program, or a message file.
" +
+ "WARNING: This is permanent and cannot be undone",
+ run: "run [file name] [-t] [num threads] [args...] " +
+ "Execute a program or a script.
" +
+ "The '[-t]', '[num threads]', and '[args...]' arguments are only valid when running a script. The '-t' flag is used " +
+ "to indicate that the script should be run with the specified number of threads. If the flag is omitted, " +
+ "then the script will be run with a single thread by default. " +
+ "If the '-t' flag is used, then it MUST come immediately " +
+ "after the script name, and the [num threads] argument MUST come immediately afterwards.
" +
+ "[args...] represents a variable number of arguments that will be passed into the script. See the documentation " +
+ "about script arguments. Each specified argument must be separated by a space.
",
+ scan: "scan " +
+ "Prints all immediately-available network connection. This will print a list of all servers that you can currently connect " +
+ "to using the 'connect' Terminal command.",
+ "scan-analyze": "scan-analyze [depth] [-a] " +
+ "Prints detailed information about all servers up to [depth] nodes away on the network. Calling " +
+ "'scan-analyze 1' will display information for the same servers that are shown by the 'scan' Terminal " +
+ "command. This command also shows the relative paths to reach each server.
" +
+ "By default, the maximum depth that can be specified for 'scan-analyze' is 3. However, once you have " +
+ "the DeepscanV1.exe and DeepscanV2.exe programs, you can execute 'scan-analyze' with a depth up to " +
+ "5 and 10, respectively.
" +
+ "The information 'scan-analyze' displays about each server includes whether or not you have root access to it, " +
+ "its required hacking level, the number of open ports required to run NUKE.exe on it, and how much RAM " +
+ "it has.
" +
+ "By default, this command will not display servers that you have purchased. However, you can pass in the " +
+ "-a flag at the end of the command if you would like to enable that.",
+ scp: "scp [filename] [target server] " +
+ "Copies the specified file from the current server to the target server. " +
+ "This command only works for script files (.script extension), literature files (.lit extension), " +
+ "and text files (.txt extension). " +
+ "The second argument passed in must be the hostname or IP of the target server.",
+ sudov: "sudov " +
+ "Prints whether or not you have root access to the current machine",
+ tail: "tail [script name] [args...] " +
+ "Displays dynamic logs for the script specified by the script name and arguments. Each argument must be separated " +
+ "by a space. Remember that a running script is uniquely identified by both its name and the arguments that were used " +
+ "to run it. So, if a script was ran with the following arguments:
" +
+ "run foo.script 10 50000
" +
+ "Then in order to check its logs with 'tail' the same arguments must be used:
" +
+ "tail foo.script 10 50000",
+ theme: "theme [preset] | [#background #text #highlight] " +
+ "Change the color of the game's user interface
" +
+ "This command can be called with a preset theme. Currently, the supported presets are 'default', 'muted', and 'solarized'. " +
+ "However, you can also specify your own color scheme using hex values. To do so, you must specify three hex color values " +
+ "for the background color, the text color, and the highlight color. These hex values must be preceded by a pound sign (#) and " +
+ "must be either 3 or 6 digits. Example:
" +
+ "theme #ffffff #385 #235012
" +
+ "A color picker such as " +
+ "Google's " +
+ "can be used to get your desired hex color values
" +
+ "Themes are not saved, so when the game is closed and then re-opened or reloaded then it will revert back to the default theme.",
+ top: "top " +
+ "Prints a list of all scripts running on the current server as well as their thread count and how much " +
+ "RAM they are using in total.",
+ unalias: 'unalias "[alias name]" ' +
+ "Deletes the specified alias. Note that the double quotation marks are required.
" +
+ "As an example, if an alias was declared using:
" +
+ 'alias r="run"
' +
+ "Then it could be removed using:
" +
+ 'unalias "r"
' +
+ "It is not necessary to differentiate between global and non-global aliases when using 'unalias'",
+
+}
+
+
+
+
+/***/ }),
+/* 127 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/**
+ * Representation a of zip file in js
+ * @constructor
+ */
+function JSZip() {
+ // if this constructor is used without `new`, it adds `new` before itself:
+ if(!(this instanceof JSZip)) {
+ return new JSZip();
+ }
+
+ if(arguments.length) {
+ throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
+ }
+
+ // object containing the files :
+ // {
+ // "folder/" : {...},
+ // "folder/data.txt" : {...}
+ // }
+ this.files = {};
+
+ this.comment = null;
+
+ // Where we are in the hierarchy
+ this.root = "";
+ this.clone = function() {
+ var newObj = new JSZip();
+ for (var i in this) {
+ if (typeof this[i] !== "function") {
+ newObj[i] = this[i];
+ }
+ }
+ return newObj;
+ };
+}
+JSZip.prototype = __webpack_require__(128);
+JSZip.prototype.loadAsync = __webpack_require__(173);
+JSZip.support = __webpack_require__(78);
+JSZip.defaults = __webpack_require__(111);
+
+// TODO find a better way to handle this version,
+// a require('package.json').version doesn't work with webpack, see #327
+JSZip.version = "3.1.5";
+
+JSZip.loadAsync = function (content, options) {
+ return new JSZip().loadAsync(content, options);
+};
+
+JSZip.external = __webpack_require__(85);
+module.exports = JSZip;
+
+
+/***/ }),
+/* 128 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+var utf8 = __webpack_require__(81);
+var utils = __webpack_require__(76);
+var GenericWorker = __webpack_require__(77);
+var StreamHelper = __webpack_require__(110);
+var defaults = __webpack_require__(111);
+var CompressedObject = __webpack_require__(95);
+var ZipObject = __webpack_require__(159);
+var generate = __webpack_require__(160);
+var nodejsUtils = __webpack_require__(88);
+var NodejsStreamInputAdapter = __webpack_require__(172);
+
+
+/**
+ * Add a file in the current folder.
+ * @private
+ * @param {string} name the name of the file
+ * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file
+ * @param {Object} originalOptions the options of the file
+ * @return {Object} the new file.
+ */
+var fileAdd = function(name, data, originalOptions) {
+ // be sure sub folders exist
+ var dataType = utils.getTypeOf(data),
+ parent;
+
+
+ /*
+ * Correct options.
+ */
+
+ var o = utils.extend(originalOptions || {}, defaults);
+ o.date = o.date || new Date();
+ if (o.compression !== null) {
+ o.compression = o.compression.toUpperCase();
+ }
+
+ if (typeof o.unixPermissions === "string") {
+ o.unixPermissions = parseInt(o.unixPermissions, 8);
+ }
+
+ // UNX_IFDIR 0040000 see zipinfo.c
+ if (o.unixPermissions && (o.unixPermissions & 0x4000)) {
+ o.dir = true;
+ }
+ // Bit 4 Directory
+ if (o.dosPermissions && (o.dosPermissions & 0x0010)) {
+ o.dir = true;
+ }
+
+ if (o.dir) {
+ name = forceTrailingSlash(name);
+ }
+ if (o.createFolders && (parent = parentFolder(name))) {
+ folderAdd.call(this, parent, true);
+ }
+
+ var isUnicodeString = dataType === "string" && o.binary === false && o.base64 === false;
+ if (!originalOptions || typeof originalOptions.binary === "undefined") {
+ o.binary = !isUnicodeString;
+ }
+
+
+ var isCompressedEmpty = (data instanceof CompressedObject) && data.uncompressedSize === 0;
+
+ if (isCompressedEmpty || o.dir || !data || data.length === 0) {
+ o.base64 = false;
+ o.binary = true;
+ data = "";
+ o.compression = "STORE";
+ dataType = "string";
+ }
+
+ /*
+ * Convert content to fit.
+ */
+
+ var zipObjectContent = null;
+ if (data instanceof CompressedObject || data instanceof GenericWorker) {
+ zipObjectContent = data;
+ } else if (nodejsUtils.isNode && nodejsUtils.isStream(data)) {
+ zipObjectContent = new NodejsStreamInputAdapter(name, data);
+ } else {
+ zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64);
+ }
+
+ var object = new ZipObject(name, zipObjectContent, o);
+ this.files[name] = object;
+ /*
+ TODO: we can't throw an exception because we have async promises
+ (we can have a promise of a Date() for example) but returning a
+ promise is useless because file(name, data) returns the JSZip
+ object for chaining. Should we break that to allow the user
+ to catch the error ?
+
+ return external.Promise.resolve(zipObjectContent)
+ .then(function () {
+ return object;
+ });
+ */
+};
+
+/**
+ * Find the parent folder of the path.
+ * @private
+ * @param {string} path the path to use
+ * @return {string} the parent folder, or ""
+ */
+var parentFolder = function (path) {
+ if (path.slice(-1) === '/') {
+ path = path.substring(0, path.length - 1);
+ }
+ var lastSlash = path.lastIndexOf('/');
+ return (lastSlash > 0) ? path.substring(0, lastSlash) : "";
+};
+
+/**
+ * Returns the path with a slash at the end.
+ * @private
+ * @param {String} path the path to check.
+ * @return {String} the path with a trailing slash.
+ */
+var forceTrailingSlash = function(path) {
+ // Check the name ends with a /
+ if (path.slice(-1) !== "/") {
+ path += "/"; // IE doesn't like substr(-1)
+ }
+ return path;
+};
+
+/**
+ * Add a (sub) folder in the current folder.
+ * @private
+ * @param {string} name the folder's name
+ * @param {boolean=} [createFolders] If true, automatically create sub
+ * folders. Defaults to false.
+ * @return {Object} the new folder.
+ */
+var folderAdd = function(name, createFolders) {
+ createFolders = (typeof createFolders !== 'undefined') ? createFolders : defaults.createFolders;
+
+ name = forceTrailingSlash(name);
+
+ // Does this folder already exist?
+ if (!this.files[name]) {
+ fileAdd.call(this, name, null, {
+ dir: true,
+ createFolders: createFolders
+ });
+ }
+ return this.files[name];
+};
+
+/**
+* Cross-window, cross-Node-context regular expression detection
+* @param {Object} object Anything
+* @return {Boolean} true if the object is a regular expression,
+* false otherwise
+*/
+function isRegExp(object) {
+ return Object.prototype.toString.call(object) === "[object RegExp]";
+}
+
+// return the actual prototype of JSZip
+var out = {
+ /**
+ * @see loadAsync
+ */
+ load: function() {
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
+ },
+
+
+ /**
+ * Call a callback function for each entry at this folder level.
+ * @param {Function} cb the callback function:
+ * function (relativePath, file) {...}
+ * It takes 2 arguments : the relative path and the file.
+ */
+ forEach: function(cb) {
+ var filename, relativePath, file;
+ for (filename in this.files) {
+ if (!this.files.hasOwnProperty(filename)) {
+ continue;
+ }
+ file = this.files[filename];
+ relativePath = filename.slice(this.root.length, filename.length);
+ if (relativePath && filename.slice(0, this.root.length) === this.root) { // the file is in the current root
+ cb(relativePath, file); // TODO reverse the parameters ? need to be clean AND consistent with the filter search fn...
+ }
+ }
+ },
+
+ /**
+ * Filter nested files/folders with the specified function.
+ * @param {Function} search the predicate to use :
+ * function (relativePath, file) {...}
+ * It takes 2 arguments : the relative path and the file.
+ * @return {Array} An array of matching elements.
+ */
+ filter: function(search) {
+ var result = [];
+ this.forEach(function (relativePath, entry) {
+ if (search(relativePath, entry)) { // the file matches the function
+ result.push(entry);
+ }
+
+ });
+ return result;
+ },
+
+ /**
+ * Add a file to the zip file, or search a file.
+ * @param {string|RegExp} name The name of the file to add (if data is defined),
+ * the name of the file to find (if no data) or a regex to match files.
+ * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded
+ * @param {Object} o File options
+ * @return {JSZip|Object|Array} this JSZip object (when adding a file),
+ * a file (when searching by string) or an array of files (when searching by regex).
+ */
+ file: function(name, data, o) {
+ if (arguments.length === 1) {
+ if (isRegExp(name)) {
+ var regexp = name;
+ return this.filter(function(relativePath, file) {
+ return !file.dir && regexp.test(relativePath);
+ });
+ }
+ else { // text
+ var obj = this.files[this.root + name];
+ if (obj && !obj.dir) {
+ return obj;
+ } else {
+ return null;
+ }
+ }
+ }
+ else { // more than one argument : we have data !
+ name = this.root + name;
+ fileAdd.call(this, name, data, o);
+ }
+ return this;
+ },
+
+ /**
+ * Add a directory to the zip file, or search.
+ * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders.
+ * @return {JSZip} an object with the new directory as the root, or an array containing matching folders.
+ */
+ folder: function(arg) {
+ if (!arg) {
+ return this;
+ }
+
+ if (isRegExp(arg)) {
+ return this.filter(function(relativePath, file) {
+ return file.dir && arg.test(relativePath);
+ });
+ }
+
+ // else, name is a new folder
+ var name = this.root + arg;
+ var newFolder = folderAdd.call(this, name);
+
+ // Allow chaining by returning a new object with this folder as the root
+ var ret = this.clone();
+ ret.root = newFolder.name;
+ return ret;
+ },
+
+ /**
+ * Delete a file, or a directory and all sub-files, from the zip
+ * @param {string} name the name of the file to delete
+ * @return {JSZip} this JSZip object
+ */
+ remove: function(name) {
+ name = this.root + name;
+ var file = this.files[name];
+ if (!file) {
+ // Look for any folders
+ if (name.slice(-1) !== "/") {
+ name += "/";
+ }
+ file = this.files[name];
+ }
+
+ if (file && !file.dir) {
+ // file
+ delete this.files[name];
+ } else {
+ // maybe a folder, delete recursively
+ var kids = this.filter(function(relativePath, file) {
+ return file.name.slice(0, name.length) === name;
+ });
+ for (var i = 0; i < kids.length; i++) {
+ delete this.files[kids[i].name];
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Generate the complete zip file
+ * @param {Object} options the options to generate the zip file :
+ * - compression, "STORE" by default.
+ * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob.
+ * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file
+ */
+ generate: function(options) {
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
+ },
+
+ /**
+ * Generate the complete zip file as an internal stream.
+ * @param {Object} options the options to generate the zip file :
+ * - compression, "STORE" by default.
+ * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob.
+ * @return {StreamHelper} the streamed zip file.
+ */
+ generateInternalStream: function(options) {
+ var worker, opts = {};
+ try {
+ opts = utils.extend(options || {}, {
+ streamFiles: false,
+ compression: "STORE",
+ compressionOptions : null,
+ type: "",
+ platform: "DOS",
+ comment: null,
+ mimeType: 'application/zip',
+ encodeFileName: utf8.utf8encode
+ });
+
+ opts.type = opts.type.toLowerCase();
+ opts.compression = opts.compression.toUpperCase();
+
+ // "binarystring" is prefered but the internals use "string".
+ if(opts.type === "binarystring") {
+ opts.type = "string";
+ }
+
+ if (!opts.type) {
+ throw new Error("No output type specified.");
+ }
+
+ utils.checkSupport(opts.type);
+
+ // accept nodejs `process.platform`
+ if(
+ opts.platform === 'darwin' ||
+ opts.platform === 'freebsd' ||
+ opts.platform === 'linux' ||
+ opts.platform === 'sunos'
+ ) {
+ opts.platform = "UNIX";
+ }
+ if (opts.platform === 'win32') {
+ opts.platform = "DOS";
+ }
+
+ var comment = opts.comment || this.comment || "";
+ worker = generate.generateWorker(this, opts, comment);
+ } catch (e) {
+ worker = new GenericWorker("error");
+ worker.error(e);
+ }
+ return new StreamHelper(worker, opts.type || "string", opts.mimeType);
+ },
+ /**
+ * Generate the complete zip file asynchronously.
+ * @see generateInternalStream
+ */
+ generateAsync: function(options, onUpdate) {
+ return this.generateInternalStream(options).accumulate(onUpdate);
+ },
+ /**
+ * Generate the complete zip file asynchronously.
+ * @see generateInternalStream
+ */
+ generateNodeStream: function(options, onUpdate) {
+ options = options || {};
+ if (!options.type) {
+ options.type = "nodebuffer";
+ }
+ return this.generateInternalStream(options).toNodejsStream(onUpdate);
+ }
+};
+module.exports = out;
+
+
+/***/ }),
+/* 129 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+exports.byteLength = byteLength
+exports.toByteArray = toByteArray
+exports.fromByteArray = fromByteArray
+
+var lookup = []
+var revLookup = []
+var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
+
+var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
+for (var i = 0, len = code.length; i < len; ++i) {
+ lookup[i] = code[i]
+ revLookup[code.charCodeAt(i)] = i
+}
+
+// Support decoding URL-safe base64 strings, as Node.js does.
+// See: https://en.wikipedia.org/wiki/Base64#URL_applications
+revLookup['-'.charCodeAt(0)] = 62
+revLookup['_'.charCodeAt(0)] = 63
+
+function placeHoldersCount (b64) {
+ var len = b64.length
+ if (len % 4 > 0) {
+ throw new Error('Invalid string. Length must be a multiple of 4')
+ }
+
+ // the number of equal signs (place holders)
+ // if there are two placeholders, than the two characters before it
+ // represent one byte
+ // if there is only one, then the three characters before it represent 2 bytes
+ // this is just a cheap hack to not do indexOf twice
+ return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
+}
+
+function byteLength (b64) {
+ // base64 is 4/3 + up to two characters of the original data
+ return (b64.length * 3 / 4) - placeHoldersCount(b64)
+}
+
+function toByteArray (b64) {
+ var i, l, tmp, placeHolders, arr
+ var len = b64.length
+ placeHolders = placeHoldersCount(b64)
+
+ arr = new Arr((len * 3 / 4) - placeHolders)
+
+ // if there are placeholders, only get up to the last complete 4 chars
+ l = placeHolders > 0 ? len - 4 : len
+
+ var L = 0
+
+ for (i = 0; i < l; i += 4) {
+ tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
+ arr[L++] = (tmp >> 16) & 0xFF
+ arr[L++] = (tmp >> 8) & 0xFF
+ arr[L++] = tmp & 0xFF
+ }
+
+ if (placeHolders === 2) {
+ tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
+ arr[L++] = tmp & 0xFF
+ } else if (placeHolders === 1) {
+ tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
+ arr[L++] = (tmp >> 8) & 0xFF
+ arr[L++] = tmp & 0xFF
+ }
+
+ return arr
+}
+
+function tripletToBase64 (num) {
+ return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
+}
+
+function encodeChunk (uint8, start, end) {
+ var tmp
+ var output = []
+ for (var i = start; i < end; i += 3) {
+ tmp = ((uint8[i] << 16) & 0xFF0000) + ((uint8[i + 1] << 8) & 0xFF00) + (uint8[i + 2] & 0xFF)
+ output.push(tripletToBase64(tmp))
+ }
+ return output.join('')
+}
+
+function fromByteArray (uint8) {
+ var tmp
+ var len = uint8.length
+ var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
+ var output = ''
+ var parts = []
+ var maxChunkLength = 16383 // must be multiple of 3
+
+ // go through the array every three bytes, we'll deal with trailing stuff later
+ for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
+ parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
+ }
+
+ // pad the end with zeros, but make sure to not forget the extra bytes
+ if (extraBytes === 1) {
+ tmp = uint8[len - 1]
+ output += lookup[tmp >> 2]
+ output += lookup[(tmp << 4) & 0x3F]
+ output += '=='
+ } else if (extraBytes === 2) {
+ tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
+ output += lookup[tmp >> 10]
+ output += lookup[(tmp >> 4) & 0x3F]
+ output += lookup[(tmp << 2) & 0x3F]
+ output += '='
+ }
+
+ parts.push(output)
+
+ return parts.join('')
+}
+
+
+/***/ }),
+/* 130 */
+/***/ (function(module, exports) {
+
+exports.read = function (buffer, offset, isLE, mLen, nBytes) {
+ var e, m
+ var eLen = nBytes * 8 - mLen - 1
+ var eMax = (1 << eLen) - 1
+ var eBias = eMax >> 1
+ var nBits = -7
+ var i = isLE ? (nBytes - 1) : 0
+ var d = isLE ? -1 : 1
+ var s = buffer[offset + i]
+
+ i += d
+
+ e = s & ((1 << (-nBits)) - 1)
+ s >>= (-nBits)
+ nBits += eLen
+ for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
+
+ m = e & ((1 << (-nBits)) - 1)
+ e >>= (-nBits)
+ nBits += mLen
+ for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
+
+ if (e === 0) {
+ e = 1 - eBias
+ } else if (e === eMax) {
+ return m ? NaN : ((s ? -1 : 1) * Infinity)
+ } else {
+ m = m + Math.pow(2, mLen)
+ e = e - eBias
+ }
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
+}
+
+exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
+ var e, m, c
+ var eLen = nBytes * 8 - mLen - 1
+ var eMax = (1 << eLen) - 1
+ var eBias = eMax >> 1
+ var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
+ var i = isLE ? 0 : (nBytes - 1)
+ var d = isLE ? 1 : -1
+ var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
+
+ value = Math.abs(value)
+
+ if (isNaN(value) || value === Infinity) {
+ m = isNaN(value) ? 1 : 0
+ e = eMax
+ } else {
+ e = Math.floor(Math.log(value) / Math.LN2)
+ if (value * (c = Math.pow(2, -e)) < 1) {
+ e--
+ c *= 2
+ }
+ if (e + eBias >= 1) {
+ value += rt / c
+ } else {
+ value += rt * Math.pow(2, 1 - eBias)
+ }
+ if (value * c >= 2) {
+ e++
+ c /= 2
+ }
+
+ if (e + eBias >= eMax) {
+ m = 0
+ e = eMax
+ } else if (e + eBias >= 1) {
+ m = (value * c - 1) * Math.pow(2, mLen)
+ e = e + eBias
+ } else {
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
+ e = 0
+ }
+ }
+
+ for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
+
+ e = (e << mLen) | m
+ eLen += mLen
+ for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
+
+ buffer[offset + i - d] |= s * 128
+}
+
+
+/***/ }),
+/* 131 */
+/***/ (function(module, exports, __webpack_require__) {
+
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+module.exports = Stream;
+
+var EE = __webpack_require__(90).EventEmitter;
+var inherits = __webpack_require__(82);
+
+inherits(Stream, EE);
+Stream.Readable = __webpack_require__(91);
+Stream.Writable = __webpack_require__(137);
+Stream.Duplex = __webpack_require__(138);
+Stream.Transform = __webpack_require__(139);
+Stream.PassThrough = __webpack_require__(140);
+
+// Backwards-compat with node 0.4.x
+Stream.Stream = Stream;
+
+
+
+// old-style streams. Note that the pipe method (the only relevant
+// part of this class) is overridden in the Readable class.
+
+function Stream() {
+ EE.call(this);
+}
+
+Stream.prototype.pipe = function(dest, options) {
+ var source = this;
+
+ function ondata(chunk) {
+ if (dest.writable) {
+ if (false === dest.write(chunk) && source.pause) {
+ source.pause();
+ }
+ }
+ }
+
+ source.on('data', ondata);
+
+ function ondrain() {
+ if (source.readable && source.resume) {
+ source.resume();
+ }
+ }
+
+ dest.on('drain', ondrain);
+
+ // If the 'end' option is not supplied, dest.end() will be called when
+ // source gets the 'end' or 'close' events. Only dest.end() once.
+ if (!dest._isStdio && (!options || options.end !== false)) {
+ source.on('end', onend);
+ source.on('close', onclose);
+ }
+
+ var didOnEnd = false;
+ function onend() {
+ if (didOnEnd) return;
+ didOnEnd = true;
+
+ dest.end();
+ }
+
+
+ function onclose() {
+ if (didOnEnd) return;
+ didOnEnd = true;
+
+ if (typeof dest.destroy === 'function') dest.destroy();
+ }
+
+ // don't leave dangling pipes when there are errors.
+ function onerror(er) {
+ cleanup();
+ if (EE.listenerCount(this, 'error') === 0) {
+ throw er; // Unhandled stream error in pipe.
+ }
+ }
+
+ source.on('error', onerror);
+ dest.on('error', onerror);
+
+ // remove all the event listeners that were added.
+ function cleanup() {
+ source.removeListener('data', ondata);
+ dest.removeListener('drain', ondrain);
+
+ source.removeListener('end', onend);
+ source.removeListener('close', onclose);
+
+ source.removeListener('error', onerror);
+ dest.removeListener('error', onerror);
+
+ source.removeListener('end', cleanup);
+ source.removeListener('close', cleanup);
+
+ dest.removeListener('close', cleanup);
+ }
+
+ source.on('end', cleanup);
+ source.on('close', cleanup);
+
+ dest.on('close', cleanup);
+
+ dest.emit('pipe', source);
+
+ // Allow for unix-like usage: A.pipe(B).pipe(C)
+ return dest;
+};
+
+
+/***/ }),
+/* 132 */
+/***/ (function(module, exports) {
+
+/* (ignored) */
+
+/***/ }),
+/* 133 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var Buffer = __webpack_require__(87).Buffer;
+var util = __webpack_require__(134);
+
+function copyBuffer(src, target, offset) {
+ src.copy(target, offset);
+}
+
+module.exports = function () {
+ function BufferList() {
+ _classCallCheck(this, BufferList);
+
+ this.head = null;
+ this.tail = null;
+ this.length = 0;
+ }
+
+ BufferList.prototype.push = function push(v) {
+ var entry = { data: v, next: null };
+ if (this.length > 0) this.tail.next = entry;else this.head = entry;
+ this.tail = entry;
+ ++this.length;
+ };
+
+ BufferList.prototype.unshift = function unshift(v) {
+ var entry = { data: v, next: this.head };
+ if (this.length === 0) this.tail = entry;
+ this.head = entry;
+ ++this.length;
+ };
+
+ BufferList.prototype.shift = function shift() {
+ if (this.length === 0) return;
+ var ret = this.head.data;
+ if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
+ --this.length;
+ return ret;
+ };
+
+ BufferList.prototype.clear = function clear() {
+ this.head = this.tail = null;
+ this.length = 0;
+ };
+
+ BufferList.prototype.join = function join(s) {
+ if (this.length === 0) return '';
+ var p = this.head;
+ var ret = '' + p.data;
+ while (p = p.next) {
+ ret += s + p.data;
+ }return ret;
+ };
+
+ BufferList.prototype.concat = function concat(n) {
+ if (this.length === 0) return Buffer.alloc(0);
+ if (this.length === 1) return this.head.data;
+ var ret = Buffer.allocUnsafe(n >>> 0);
+ var p = this.head;
+ var i = 0;
+ while (p) {
+ copyBuffer(p.data, ret, i);
+ i += p.data.length;
+ p = p.next;
+ }
+ return ret;
+ };
+
+ return BufferList;
+}();
+
+if (util && util.inspect && util.inspect.custom) {
+ module.exports.prototype[util.inspect.custom] = function () {
+ var obj = util.inspect({ length: this.length });
+ return this.constructor.name + ' ' + obj;
+ };
+}
+
+/***/ }),
+/* 134 */
+/***/ (function(module, exports) {
+
+/* (ignored) */
+
+/***/ }),
+/* 135 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/* WEBPACK VAR INJECTION */(function(global) {
+/**
+ * Module exports.
+ */
+
+module.exports = deprecate;
+
+/**
+ * Mark that a method should not be used.
+ * Returns a modified function which warns once by default.
+ *
+ * If `localStorage.noDeprecation = true` is set, then it is a no-op.
+ *
+ * If `localStorage.throwDeprecation = true` is set, then deprecated functions
+ * will throw an Error when invoked.
+ *
+ * If `localStorage.traceDeprecation = true` is set, then deprecated functions
+ * will invoke `console.trace()` instead of `console.error()`.
+ *
+ * @param {Function} fn - the function to deprecate
+ * @param {String} msg - the string to print to the console when `fn` is invoked
+ * @returns {Function} a new "deprecated" version of `fn`
+ * @api public
+ */
+
+function deprecate (fn, msg) {
+ if (config('noDeprecation')) {
+ return fn;
+ }
+
+ var warned = false;
+ function deprecated() {
+ if (!warned) {
+ if (config('throwDeprecation')) {
+ throw new Error(msg);
+ } else if (config('traceDeprecation')) {
+ console.trace(msg);
+ } else {
+ console.warn(msg);
+ }
+ warned = true;
+ }
+ return fn.apply(this, arguments);
+ }
+
+ return deprecated;
+}
+
+/**
+ * Checks `localStorage` for boolean values for the given `name`.
+ *
+ * @param {String} name
+ * @returns {Boolean}
+ * @api private
+ */
+
+function config (name) {
+ // accessing global.localStorage can trigger a DOMException in sandboxed iframes
+ try {
+ if (!global.localStorage) return false;
+ } catch (_) {
+ return false;
+ }
+ var val = global.localStorage[name];
+ if (null == val) return false;
+ return String(val).toLowerCase() === 'true';
+}
+
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(40)))
+
+/***/ }),
+/* 136 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// a passthrough stream.
+// basically just the most minimal sort of Transform stream.
+// Every written chunk gets output as-is.
+
+
+
+module.exports = PassThrough;
+
+var Transform = __webpack_require__(104);
+
+/**/
+var util = __webpack_require__(84);
+util.inherits = __webpack_require__(82);
+/**/
+
+util.inherits(PassThrough, Transform);
+
+function PassThrough(options) {
+ if (!(this instanceof PassThrough)) return new PassThrough(options);
+
+ Transform.call(this, options);
+}
+
+PassThrough.prototype._transform = function (chunk, encoding, cb) {
+ cb(null, chunk);
+};
+
+/***/ }),
+/* 137 */
+/***/ (function(module, exports, __webpack_require__) {
+
+module.exports = __webpack_require__(92);
+
+
+/***/ }),
+/* 138 */
+/***/ (function(module, exports, __webpack_require__) {
+
+module.exports = __webpack_require__(80);
+
+
+/***/ }),
+/* 139 */
+/***/ (function(module, exports, __webpack_require__) {
+
+module.exports = __webpack_require__(91).Transform
+
+
+/***/ }),
+/* 140 */
+/***/ (function(module, exports, __webpack_require__) {
+
+module.exports = __webpack_require__(91).PassThrough
+
+
+/***/ }),
+/* 141 */
+/***/ (function(module, exports, __webpack_require__) {
+
+__webpack_require__(142);
+module.exports = __webpack_require__(106).setImmediate;
+
+/***/ }),
+/* 142 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var $export = __webpack_require__(143)
+ , $task = __webpack_require__(151);
+$export($export.G + $export.B, {
+ setImmediate: $task.set,
+ clearImmediate: $task.clear
+});
+
+/***/ }),
+/* 143 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var global = __webpack_require__(89)
+ , core = __webpack_require__(106)
+ , ctx = __webpack_require__(107)
+ , hide = __webpack_require__(145)
+ , PROTOTYPE = 'prototype';
+
+var $export = function(type, name, source){
+ var IS_FORCED = type & $export.F
+ , IS_GLOBAL = type & $export.G
+ , IS_STATIC = type & $export.S
+ , IS_PROTO = type & $export.P
+ , IS_BIND = type & $export.B
+ , IS_WRAP = type & $export.W
+ , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
+ , expProto = exports[PROTOTYPE]
+ , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
+ , key, own, out;
+ if(IS_GLOBAL)source = name;
+ for(key in source){
+ // contains in native
+ own = !IS_FORCED && target && target[key] !== undefined;
+ if(own && key in exports)continue;
+ // export native or passed
+ out = own ? target[key] : source[key];
+ // prevent global pollution for namespaces
+ exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
+ // bind timers to global for call from export context
+ : IS_BIND && own ? ctx(out, global)
+ // wrap global constructors for prevent change them in library
+ : IS_WRAP && target[key] == out ? (function(C){
+ var F = function(a, b, c){
+ if(this instanceof C){
+ switch(arguments.length){
+ case 0: return new C;
+ case 1: return new C(a);
+ case 2: return new C(a, b);
+ } return new C(a, b, c);
+ } return C.apply(this, arguments);
+ };
+ F[PROTOTYPE] = C[PROTOTYPE];
+ return F;
+ // make static versions for prototype methods
+ })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
+ // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
+ if(IS_PROTO){
+ (exports.virtual || (exports.virtual = {}))[key] = out;
+ // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
+ if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
+ }
+ }
+};
+// type bitmap
+$export.F = 1; // forced
+$export.G = 2; // global
+$export.S = 4; // static
+$export.P = 8; // proto
+$export.B = 16; // bind
+$export.W = 32; // wrap
+$export.U = 64; // safe
+$export.R = 128; // real proto method for `library`
+module.exports = $export;
+
+/***/ }),
+/* 144 */
+/***/ (function(module, exports) {
+
+module.exports = function(it){
+ if(typeof it != 'function')throw TypeError(it + ' is not a function!');
+ return it;
+};
+
+/***/ }),
+/* 145 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var dP = __webpack_require__(146)
+ , createDesc = __webpack_require__(150);
+module.exports = __webpack_require__(94) ? function(object, key, value){
+ return dP.f(object, key, createDesc(1, value));
+} : function(object, key, value){
+ object[key] = value;
+ return object;
+};
+
+/***/ }),
+/* 146 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var anObject = __webpack_require__(147)
+ , IE8_DOM_DEFINE = __webpack_require__(148)
+ , toPrimitive = __webpack_require__(149)
+ , dP = Object.defineProperty;
+
+exports.f = __webpack_require__(94) ? Object.defineProperty : function defineProperty(O, P, Attributes){
+ anObject(O);
+ P = toPrimitive(P, true);
+ anObject(Attributes);
+ if(IE8_DOM_DEFINE)try {
+ return dP(O, P, Attributes);
+ } catch(e){ /* empty */ }
+ if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
+ if('value' in Attributes)O[P] = Attributes.value;
+ return O;
+};
+
+/***/ }),
+/* 147 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var isObject = __webpack_require__(93);
+module.exports = function(it){
+ if(!isObject(it))throw TypeError(it + ' is not an object!');
+ return it;
+};
+
+/***/ }),
+/* 148 */
+/***/ (function(module, exports, __webpack_require__) {
+
+module.exports = !__webpack_require__(94) && !__webpack_require__(108)(function(){
+ return Object.defineProperty(__webpack_require__(109)('div'), 'a', {get: function(){ return 7; }}).a != 7;
+});
+
+/***/ }),
+/* 149 */
+/***/ (function(module, exports, __webpack_require__) {
+
+// 7.1.1 ToPrimitive(input [, PreferredType])
+var isObject = __webpack_require__(93);
+// instead of the ES6 spec version, we didn't implement @@toPrimitive case
+// and the second argument - flag - preferred type is a string
+module.exports = function(it, S){
+ if(!isObject(it))return it;
+ var fn, val;
+ if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
+ if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
+ if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
+ throw TypeError("Can't convert object to primitive value");
+};
+
+/***/ }),
+/* 150 */
+/***/ (function(module, exports) {
+
+module.exports = function(bitmap, value){
+ return {
+ enumerable : !(bitmap & 1),
+ configurable: !(bitmap & 2),
+ writable : !(bitmap & 4),
+ value : value
+ };
+};
+
+/***/ }),
+/* 151 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var ctx = __webpack_require__(107)
+ , invoke = __webpack_require__(152)
+ , html = __webpack_require__(153)
+ , cel = __webpack_require__(109)
+ , global = __webpack_require__(89)
+ , process = global.process
+ , setTask = global.setImmediate
+ , clearTask = global.clearImmediate
+ , MessageChannel = global.MessageChannel
+ , counter = 0
+ , queue = {}
+ , ONREADYSTATECHANGE = 'onreadystatechange'
+ , defer, channel, port;
+var run = function(){
+ var id = +this;
+ if(queue.hasOwnProperty(id)){
+ var fn = queue[id];
+ delete queue[id];
+ fn();
+ }
+};
+var listener = function(event){
+ run.call(event.data);
+};
+// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
+if(!setTask || !clearTask){
+ setTask = function setImmediate(fn){
+ var args = [], i = 1;
+ while(arguments.length > i)args.push(arguments[i++]);
+ queue[++counter] = function(){
+ invoke(typeof fn == 'function' ? fn : Function(fn), args);
+ };
+ defer(counter);
+ return counter;
+ };
+ clearTask = function clearImmediate(id){
+ delete queue[id];
+ };
+ // Node.js 0.8-
+ if(__webpack_require__(154)(process) == 'process'){
+ defer = function(id){
+ process.nextTick(ctx(run, id, 1));
+ };
+ // Browsers with MessageChannel, includes WebWorkers
+ } else if(MessageChannel){
+ channel = new MessageChannel;
+ port = channel.port2;
+ channel.port1.onmessage = listener;
+ defer = ctx(port.postMessage, port, 1);
+ // Browsers with postMessage, skip WebWorkers
+ // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
+ } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){
+ defer = function(id){
+ global.postMessage(id + '', '*');
+ };
+ global.addEventListener('message', listener, false);
+ // IE8-
+ } else if(ONREADYSTATECHANGE in cel('script')){
+ defer = function(id){
+ html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
+ html.removeChild(this);
+ run.call(id);
+ };
+ };
+ // Rest old browsers
+ } else {
+ defer = function(id){
+ setTimeout(ctx(run, id, 1), 0);
+ };
+ }
+}
+module.exports = {
+ set: setTask,
+ clear: clearTask
+};
+
+/***/ }),
+/* 152 */
+/***/ (function(module, exports) {
+
+// fast apply, http://jsperf.lnkit.com/fast-apply/5
+module.exports = function(fn, args, that){
+ var un = that === undefined;
+ switch(args.length){
+ case 0: return un ? fn()
+ : fn.call(that);
+ case 1: return un ? fn(args[0])
+ : fn.call(that, args[0]);
+ case 2: return un ? fn(args[0], args[1])
+ : fn.call(that, args[0], args[1]);
+ case 3: return un ? fn(args[0], args[1], args[2])
+ : fn.call(that, args[0], args[1], args[2]);
+ case 4: return un ? fn(args[0], args[1], args[2], args[3])
+ : fn.call(that, args[0], args[1], args[2], args[3]);
+ } return fn.apply(that, args);
+};
+
+/***/ }),
+/* 153 */
+/***/ (function(module, exports, __webpack_require__) {
+
+module.exports = __webpack_require__(89).document && document.documentElement;
+
+/***/ }),
+/* 154 */
+/***/ (function(module, exports) {
+
+var toString = {}.toString;
+
+module.exports = function(it){
+ return toString.call(it).slice(8, -1);
+};
+
+/***/ }),
+/* 155 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+var immediate = __webpack_require__(156);
+
+/* istanbul ignore next */
+function INTERNAL() {}
+
+var handlers = {};
+
+var REJECTED = ['REJECTED'];
+var FULFILLED = ['FULFILLED'];
+var PENDING = ['PENDING'];
+
+module.exports = Promise;
+
+function Promise(resolver) {
+ if (typeof resolver !== 'function') {
+ throw new TypeError('resolver must be a function');
+ }
+ this.state = PENDING;
+ this.queue = [];
+ this.outcome = void 0;
+ if (resolver !== INTERNAL) {
+ safelyResolveThenable(this, resolver);
+ }
+}
+
+Promise.prototype["catch"] = function (onRejected) {
+ return this.then(null, onRejected);
+};
+Promise.prototype.then = function (onFulfilled, onRejected) {
+ if (typeof onFulfilled !== 'function' && this.state === FULFILLED ||
+ typeof onRejected !== 'function' && this.state === REJECTED) {
+ return this;
+ }
+ var promise = new this.constructor(INTERNAL);
+ if (this.state !== PENDING) {
+ var resolver = this.state === FULFILLED ? onFulfilled : onRejected;
+ unwrap(promise, resolver, this.outcome);
+ } else {
+ this.queue.push(new QueueItem(promise, onFulfilled, onRejected));
+ }
+
+ return promise;
+};
+function QueueItem(promise, onFulfilled, onRejected) {
+ this.promise = promise;
+ if (typeof onFulfilled === 'function') {
+ this.onFulfilled = onFulfilled;
+ this.callFulfilled = this.otherCallFulfilled;
+ }
+ if (typeof onRejected === 'function') {
+ this.onRejected = onRejected;
+ this.callRejected = this.otherCallRejected;
+ }
+}
+QueueItem.prototype.callFulfilled = function (value) {
+ handlers.resolve(this.promise, value);
+};
+QueueItem.prototype.otherCallFulfilled = function (value) {
+ unwrap(this.promise, this.onFulfilled, value);
+};
+QueueItem.prototype.callRejected = function (value) {
+ handlers.reject(this.promise, value);
+};
+QueueItem.prototype.otherCallRejected = function (value) {
+ unwrap(this.promise, this.onRejected, value);
+};
+
+function unwrap(promise, func, value) {
+ immediate(function () {
+ var returnValue;
+ try {
+ returnValue = func(value);
+ } catch (e) {
+ return handlers.reject(promise, e);
+ }
+ if (returnValue === promise) {
+ handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));
+ } else {
+ handlers.resolve(promise, returnValue);
+ }
+ });
+}
+
+handlers.resolve = function (self, value) {
+ var result = tryCatch(getThen, value);
+ if (result.status === 'error') {
+ return handlers.reject(self, result.value);
+ }
+ var thenable = result.value;
+
+ if (thenable) {
+ safelyResolveThenable(self, thenable);
+ } else {
+ self.state = FULFILLED;
+ self.outcome = value;
+ var i = -1;
+ var len = self.queue.length;
+ while (++i < len) {
+ self.queue[i].callFulfilled(value);
+ }
+ }
+ return self;
+};
+handlers.reject = function (self, error) {
+ self.state = REJECTED;
+ self.outcome = error;
+ var i = -1;
+ var len = self.queue.length;
+ while (++i < len) {
+ self.queue[i].callRejected(error);
+ }
+ return self;
+};
+
+function getThen(obj) {
+ // Make sure we only access the accessor once as required by the spec
+ var then = obj && obj.then;
+ if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') {
+ return function appyThen() {
+ then.apply(obj, arguments);
+ };
+ }
+}
+
+function safelyResolveThenable(self, thenable) {
+ // Either fulfill, reject or reject with error
+ var called = false;
+ function onError(value) {
+ if (called) {
+ return;
+ }
+ called = true;
+ handlers.reject(self, value);
+ }
+
+ function onSuccess(value) {
+ if (called) {
+ return;
+ }
+ called = true;
+ handlers.resolve(self, value);
+ }
+
+ function tryToUnwrap() {
+ thenable(onSuccess, onError);
+ }
+
+ var result = tryCatch(tryToUnwrap);
+ if (result.status === 'error') {
+ onError(result.value);
+ }
+}
+
+function tryCatch(func, value) {
+ var out = {};
+ try {
+ out.value = func(value);
+ out.status = 'success';
+ } catch (e) {
+ out.status = 'error';
+ out.value = e;
+ }
+ return out;
+}
+
+Promise.resolve = resolve;
+function resolve(value) {
+ if (value instanceof this) {
+ return value;
+ }
+ return handlers.resolve(new this(INTERNAL), value);
+}
+
+Promise.reject = reject;
+function reject(reason) {
+ var promise = new this(INTERNAL);
+ return handlers.reject(promise, reason);
+}
+
+Promise.all = all;
+function all(iterable) {
+ var self = this;
+ if (Object.prototype.toString.call(iterable) !== '[object Array]') {
+ return this.reject(new TypeError('must be an array'));
+ }
+
+ var len = iterable.length;
+ var called = false;
+ if (!len) {
+ return this.resolve([]);
+ }
+
+ var values = new Array(len);
+ var resolved = 0;
+ var i = -1;
+ var promise = new this(INTERNAL);
+
+ while (++i < len) {
+ allResolver(iterable[i], i);
+ }
+ return promise;
+ function allResolver(value, i) {
+ self.resolve(value).then(resolveFromAll, function (error) {
+ if (!called) {
+ called = true;
+ handlers.reject(promise, error);
+ }
+ });
+ function resolveFromAll(outValue) {
+ values[i] = outValue;
+ if (++resolved === len && !called) {
+ called = true;
+ handlers.resolve(promise, values);
+ }
+ }
+ }
+}
+
+Promise.race = race;
+function race(iterable) {
+ var self = this;
+ if (Object.prototype.toString.call(iterable) !== '[object Array]') {
+ return this.reject(new TypeError('must be an array'));
+ }
+
+ var len = iterable.length;
+ var called = false;
+ if (!len) {
+ return this.resolve([]);
+ }
+
+ var i = -1;
+ var promise = new this(INTERNAL);
+
+ while (++i < len) {
+ resolver(iterable[i]);
+ }
+ return promise;
+ function resolver(value) {
+ self.resolve(value).then(function (response) {
+ if (!called) {
+ called = true;
+ handlers.resolve(promise, response);
+ }
+ }, function (error) {
+ if (!called) {
+ called = true;
+ handlers.reject(promise, error);
+ }
+ });
+ }
+}
+
+
+/***/ }),
+/* 156 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(global) {
+var Mutation = global.MutationObserver || global.WebKitMutationObserver;
+
+var scheduleDrain;
+
+{
+ if (Mutation) {
+ var called = 0;
+ var observer = new Mutation(nextTick);
+ var element = global.document.createTextNode('');
+ observer.observe(element, {
+ characterData: true
+ });
+ scheduleDrain = function () {
+ element.data = (called = ++called % 2);
+ };
+ } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {
+ var channel = new global.MessageChannel();
+ channel.port1.onmessage = nextTick;
+ scheduleDrain = function () {
+ channel.port2.postMessage(0);
+ };
+ } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {
+ scheduleDrain = function () {
+
+ // Create a
+
@@ -34,6 +35,8 @@
In Netscript you can import functions that are declared in other scripts.
+The script will incur the RAM usage of all imported functions.
+There are two ways of doing this:
These shortcuts were implemented to better emulate a bash shell. They must be enabled
+in your Terminal's .fconf file. This can be done be entering the Terminal command:
+
nano.fconf
+
+
+
and then setting the ENABLE_BASH_HOTKEYS option to 1.
+
Note that these Bash shortcuts override any other shortcuts defined in the game (unless otherwise noted),
+as well as your browser's shortcuts
+
Also note that more Bash-like shortcuts will be implemented in the future
+
+
+
+
+
+
+
Shortcut
+
Action
+
+
+
+
Ctrl + c
+
Clears current Terminal input (does NOT override default Ctrl + c command)
+
+
Ctrl + p
+
Same as Up Arrow
+
+
Ctrl + n
+
Same as Down Arrow
+
+
Ctrl + a
+
Move cursor to beginning of line (same as 'Home' key)
+
+
+
+
+
\ No newline at end of file
diff --git a/doc/source/index.rst b/doc/source/index.rst
index de1170212..dc38b3252 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -20,7 +20,7 @@ secrets that you've been searching for.
:caption: Contents:
Netscript
-
+ Keyboard Shortcuts
Indices and tables
diff --git a/doc/source/netscriptmisc.rst b/doc/source/netscriptmisc.rst
index 7c595762b..ad32469b2 100644
--- a/doc/source/netscriptmisc.rst
+++ b/doc/source/netscriptmisc.rst
@@ -142,6 +142,68 @@ Comments are not evaluated as code, and can be used to document and/or explain c
* comment */
print("This code will actually get executed");
+Importing Functions
+-------------------
+
+In Netscript you can import functions that are declared in other scripts.
+The script will incur the RAM usage of all imported functions.
+There are two ways of doing this::
+
+ import * as namespace from "script filename"; //Import all functions from script
+ import {fn1, fn2, ...} from "script filename"; //Import specific functions from script
+
+Suppose you have a library script called *testlibrary.script*::
+
+ function foo1(args) {
+ //function definition...
+ }
+
+ function foo2(args) {
+ //function definition...
+ }
+
+ function foo3(args) {
+ //function definition...
+ }
+
+ function foo4(args) {
+ //function definition...
+ }
+
+Then, if you wanted to use these functions in another script, you can import them like so::
+
+ import * as testlib from "testlibrary.script";
+
+ values = [1,2,3];
+
+ //The imported functions must be specified using the namespace
+ someVal1 = testlib.foo3(values);
+ someVal2 = testlib.foo1(values);
+ if (someVal1 > someVal2) {
+ //...
+ } else {
+ //...
+ }
+
+If you only wanted to import certain functions, you can do so without needing
+to specify a namespace for the import::
+
+ import {foo1, foo3} from "testlibrary.script"; //Saves RAM since not all functions are imported!
+
+ values = [1,2,3];
+
+ //No namespace needed
+ someVal1 = foo3(values);
+ someVal2 = foo1(values);
+ if (someVal1 > someVal2) {
+ //...
+ } else {
+ //...
+ }
+
+Note that exporting functions is not required.
+
+
Javascript Math Module
----------------------
diff --git a/doc/source/shortcuts.rst b/doc/source/shortcuts.rst
new file mode 100644
index 000000000..f9ebeac84
--- /dev/null
+++ b/doc/source/shortcuts.rst
@@ -0,0 +1,99 @@
+Keyboard Shortcuts
+==================
+This page documents the various keyboard shortcuts that can be used in the game.
+
+Game Navigation
+---------------
+These are used to switch between the different menus/tabs in the game.
+These shortcuts are almost always available. Exceptions include:
+
+* Working at a company or for a faction
+* Creating a program
+* Taking a university class
+* Training at a gym
+* Active Mission (aka Hacking Mission)
+
+========== ===========================================================================
+Shortcut Action
+========== ===========================================================================
+Alt + t Switch to Terminal
+Alt + c Switch to 'Stats' page
+Alt + e Switch to Script Editor. Will open up the last-edited file or a new file
+Alt + s Switch to 'Active Scripts' page
+Alt + h Switch to 'Hacknet Nodes' page
+Alt + w Switch to 'City' page
+Alt + j Go to the company where you are employed ('Job' page on navigation menu)
+Alt + r Go to Travel Agency in current City ('Travel' page on navigation menu)
+Alt + p Switch to 'Create Program' page
+Alt + f Switch to 'Factions' page
+Alt + a Switch to 'Augmentations' page
+Alt + u Switch to 'Tutorial' page
+Alt + o Switch to 'Options' page
+========== ===========================================================================
+
+Script Editor
+-------------
+These shortcuts are available only in the Script Editor
+
+============= ===========================================================================
+Shortcut Action
+============= ===========================================================================
+Ctrl + b Save script and return to Terminal
+Ctrl + space Function autocompletion
+============= ===========================================================================
+
+In the Script Editor you can configure your key binding mode to three preset options:
+
+* `Ace `_
+* Vim
+* Emacs
+
+Terminal Shortcuts
+------------------
+These shortcuts are available only in the Terminal
+
+============= ===========================================================================
+Shortcut Action
+============= ===========================================================================
+Up/Down arrow Cycle through previous commands
+Ctrl + c Cancel a hack/analyze action
+Ctrl + l Clear screen
+Tab Autocomplete command
+============= ===========================================================================
+
+Terminal Bash Shortcuts
+-----------------------
+These shortcuts were implemented to better emulate a bash shell. They must be enabled
+in your Terminal's *.fconf* file. This can be done be entering the Terminal command::
+
+ nano .fconf
+
+and then setting the *ENABLE_BASH_HOTKEYS* option to 1.
+
+**Note that these Bash shortcuts override any other shortcuts defined in the game (unless otherwise noted),
+as well as your browser's shortcuts**
+
+**Also note that more Bash-like shortcuts will be implemented in the future**
+
+============= ===========================================================================
+Shortcut Action
+============= ===========================================================================
+Ctrl + c Clears current Terminal input (does NOT override default Ctrl + c command)
+Ctrl + p Same as Up Arrow
+Ctrl + m Same as Down Arrow
+Ctrl + a Move cursor to beginning of line (same as 'Home' key)
+Ctrl + e Move cursor to end of line (same as 'End' key)
+Ctrl + b Move cursor to previous character
+Alt + b Move cursor to previous word
+Ctrl + f Move cursor to next character
+Alt + f Move cursor to next word
+Ctrl + h/d Delete previous character ('Backspace')
+============= ===========================================================================
+
+Misc Shortcuts
+--------------
+============= ===========================================================================
+Shortcut Action
+============= ===========================================================================
+Esc Close a script's log window
+============= ===========================================================================
diff --git a/index.html b/index.html
index f1a2097ed..2ba0972fb 100644
--- a/index.html
+++ b/index.html
@@ -578,6 +578,7 @@
" +
+ RealEstate: "Develop and manage real estate properties.
" +
"Starting cost: " + numeral(IndustryStartingCosts.RealEstate).format("$0.000a") + " " +
"Recommended starting Industry: NO",
}
@@ -552,11 +553,11 @@ var ProductRatingWeights = {
var IndustryUpgrades = {
"0": [0, 500e3, 1, 1.05,
"Coffee", "Provide your employees with coffee, increasing their energy by 5%."],
- "1": [1, 1e9, 1.03, 1.03,
+ "1": [1, 1e9, 1.05, 1.03,
"AdVert.Inc", "Hire AdVert.Inc to advertise your company. Each level of " +
"this upgrade grants your company a static increase of 4 and 1 to its awareness and " +
"popularity, respectively. It will then increase your company's awareness by 1%, and its popularity " +
- "by a random percentage between 3% and 6%. These effects are increased by other upgrades " +
+ "by a random percentage between 2% and 4%. These effects are increased by other upgrades " +
"that increase the power of your advertising."]
}
@@ -786,8 +787,8 @@ Industry.prototype.init = function() {
this.makesProducts = true;
break;
case Industries.Software:
- this.sciFac = 0.7;
- this.advFac = 0.18;
+ this.sciFac = 0.65;
+ this.advFac = 0.16;
this.hwFac = 0.25;
this.reFac = 0.1;
this.aiFac = 0.1;
@@ -871,20 +872,26 @@ Industry.prototype.getProductDescriptionText = function() {
//Calculates the values that factor into the production and properties of
//materials/products (such as quality, etc.)
-Industry.prototype.calculateProductionFactors = function(city) {
- var warehouse = this.warehouses[city];
- if (!(warehouse instanceof Warehouse)) {
- this.prodMult = 0;
- return;
+Industry.prototype.calculateProductionFactors = function() {
+ var multSum = 0;
+ for (var i = 0; i < Cities.length; ++i) {
+ var city = Cities[i];
+ var warehouse = this.warehouses[city];
+ if (!(warehouse instanceof Warehouse)) {
+ continue;
+ }
+
+ var materials = warehouse.materials,
+ office = this.offices[city];
+
+ var cityMult = Math.pow(0.002 * materials.RealEstate.qty+1, this.reFac) *
+ Math.pow(0.002 * materials.Hardware.qty+1, this.hwFac) *
+ Math.pow(0.002 * materials.Robots.qty+1, this.robFac) *
+ Math.pow(0.002 * materials.AICores.qty+1, this.aiFac);
+ multSum += Math.pow(cityMult, 0.73);
}
- var materials = warehouse.materials,
- office = this.offices[city];
- //Production is multiplied by this
- this.prodMult = Math.pow(0.002 * materials.RealEstate.qty+1, this.reFac) *
- Math.pow(0.002 * materials.Hardware.qty+1, this.hwFac) *
- Math.pow(0.002 * materials.Robots.qty+1, this.robFac) *
- Math.pow(0.002 * materials.AICores.qty+1, this.aiFac);
- if (this.prodMult < 1) {this.prodMult = 1;}
+
+ multSum < 1 ? this.prodMult = 1 : this.prodMult = multSum;
}
Industry.prototype.updateWarehouseSizeUsed = function(warehouse) {
@@ -897,6 +904,9 @@ Industry.prototype.updateWarehouseSizeUsed = function(warehouse) {
if (this.products.hasOwnProperty(prodName)) {
var prod = this.products[prodName];
warehouse.sizeUsed += (prod.data[warehouse.loc][0] * prod.siz);
+ if (prod.data[warehouse.loc][0] > 0 && warehouse.loc === currentCityUi) {
+ industryWarehouseStorageBreakdownText += (prodName + ": " + formatNumber(prod.data[warehouse.loc][0] * prod.siz, 0) + " ");
+ }
}
}
}
@@ -1017,12 +1027,12 @@ Industry.prototype.processProductMarket = function(marketCycles=1) {
//Process production, purchase, and import/export of materials
Industry.prototype.processMaterials = function(marketCycles=1, company) {
- var revenue = 0, expenses = 0;
+ var revenue = 0, expenses = 0, industry = this;
+ this.calculateProductionFactors();
for (var i = 0; i < Cities.length; ++i) {
var city = Cities[i], office = this.offices[city];
if (this.warehouses[city] instanceof Warehouse) {
- this.calculateProductionFactors(city);
var warehouse = this.warehouses[city];
switch(this.state) {
@@ -1031,9 +1041,17 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
/* Process purchase of materials */
for (var matName in warehouse.materials) {
if (warehouse.materials.hasOwnProperty(matName)) {
- (function(matName) {
+ (function(matName, ind) {
var mat = warehouse.materials[matName];
- var buyAmt = (mat.buy * SecsPerMarketCycle * marketCycles), maxAmt
+ var buyAmt, maxAmt;
+ if (warehouse.smartSupplyEnabled && Object.keys(ind.reqMats).includes(matName)) {
+ //Smart supply tracker is stored as per second rate
+ mat.buy = ind.reqMats[matName] * warehouse.smartSupplyStore;
+ buyAmt = mat.buy * SecsPerMarketCycle * marketCycles;
+ } else {
+ buyAmt = (mat.buy * SecsPerMarketCycle * marketCycles);
+ }
+
if (matName == "RealEstate") {
maxAmt = buyAmt;
} else {
@@ -1044,13 +1062,15 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
mat.qty += buyAmt;
expenses += (buyAmt * mat.bCost);
}
- })(matName);
+ })(matName, industry);
this.updateWarehouseSizeUsed(warehouse);
}
} //End process purchase of materials
break;
case "PRODUCTION":
+ warehouse.smartSupplyStore = 0; //Reset smart supply amount
+
/* Process production of materials */
if (this.prodMats.length > 0) {
var mat = warehouse.materials[this.prodMats[0]];
@@ -1083,6 +1103,9 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
prod = Math.min(maxAmt, prod);
}
+ //Keep track of production for smart supply (/s)
+ warehouse.smartSupplyStore += (prod / (SecsPerMarketCycle * marketCycles));
+
//Make sure we have enough resource to make our materials
var producableFrac = 1;
for (var reqMatName in this.reqMats) {
@@ -1220,10 +1243,10 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
var expIndustry = company.divisions[foo];
var expWarehouse = expIndustry.warehouses[exp.city];
if (!(expWarehouse instanceof Warehouse)) {
- console.log("ERROR: Invalid export!");
+ console.log("ERROR: Invalid export! " + expIndustry.name + " " + exp.city);
break;
}
- expWarehouse.materials[mat.name].qty += amt;
+ expWarehouse.materials[matName].qty += amt;
mat.qty -= amt;
break;
}
@@ -1275,7 +1298,7 @@ Industry.prototype.processProducts = function(marketCycles=1, corporation) {
office.employeeProd[EmployeePositions.Operations] / total +
office.employeeProd[EmployeePositions.Management] / total;
}
- prod.createProduct(marketCycles, ratio * Math.pow(total, 0.3));
+ prod.createProduct(marketCycles, ratio * Math.pow(total, 0.29));
if (prod.prog >= 100) {
prod.finishProduct(office.employeeProd, this);
}
@@ -1334,6 +1357,8 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio
prod = Math.min(maxAmt, prod);
}
+ warehouse.smartSupplyStore += (prod / (SecsPerMarketCycle * marketCycles));
+
//Make sure we have enough resources to make our Products
var producableFrac = 1;
for (var reqMatName in product.reqMats) {
@@ -1384,8 +1409,8 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio
var businessFactor = this.getBusinessFactor(office); //Business employee productivity
var advertisingFactor = this.getAdvertisingFactors()[0]; //Awareness + popularity
var marketFactor = this.getMarketFactor(product); //Competition + demand
- var maxSell = Math.pow(product.rat, 0.9) * marketFactor * corporation.getSalesMultiplier() *
- markup * businessFactor * advertisingFactor;
+ var maxSell = 0.5 * Math.pow(product.rat, 0.65) * marketFactor * corporation.getSalesMultiplier() *
+ Math.pow(markup, 2) * businessFactor * advertisingFactor;
var sellAmt;
if (product.sllman[city][0] && product.sllman[city][1] > 0) {
//Sell amount is manually limited
@@ -1448,7 +1473,7 @@ Industry.prototype.upgrade = function(upgrade, refs) {
this.awareness += (4 * advMult);
this.popularity += (1 * advMult);
this.awareness *= (1.01 * advMult);
- this.popularity *= ((1 + getRandomInt(3, 6) / 100) * advMult);
+ this.popularity *= ((1 + getRandomInt(2, 4) / 100) * advMult);
break;
default:
console.log("ERROR: Un-implemented function index: " + upgN);
@@ -1492,7 +1517,7 @@ Industry.prototype.getAdvertisingFactors = function() {
var awarenessFac = Math.pow(this.awareness + 1, this.advFac);
var popularityFac = Math.pow(this.popularity + 1, this.advFac);
var ratioFac = (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01));
- var totalFac = awarenessFac * popularityFac * ratioFac;
+ var totalFac = Math.pow(awarenessFac * popularityFac * ratioFac, 0.85);
return [totalFac, awarenessFac, popularityFac, ratioFac];
}
@@ -1960,8 +1985,13 @@ function Warehouse(params={}) {
this.loc = params.loc ? params.loc : "";
this.size = params.size ? params.size : 0;
this.level = 0;
-
this.sizeUsed = 0;
+ this.smartSupplyEnabled = false; //Whether or not smart supply is enabled
+
+ //Stores the amount of product to be produced. Used for Smart Supply unlock.
+ //The production tracked by smart supply is always based on the previous cycle,
+ //so it will always trail the "true" production by 1 cycle
+ this.smartSupplyStore = 0;
this.materials = {
Water: new Material({name: "Water"}),
@@ -1980,11 +2010,15 @@ function Warehouse(params={}) {
Warehouse.prototype.updateMaterialSizeUsed = function() {
this.sizeUsed = 0;
+ if (this.loc === currentCityUi) {industryWarehouseStorageBreakdownText = ""; }
for (var matName in this.materials) {
if (this.materials.hasOwnProperty(matName)) {
var mat = this.materials[matName];
if (MaterialSizes.hasOwnProperty(matName)) {
this.sizeUsed += (mat.qty * MaterialSizes[matName]);
+ if (mat.qty > 0 && this.loc === currentCityUi) {
+ industryWarehouseStorageBreakdownText += (matName + ": " + formatNumber(mat.qty * MaterialSizes[matName], 0) + " ");
+ }
}
}
}
@@ -2009,18 +2043,15 @@ Warehouse.prototype.createUI = function(parentRefs) {
}
var company = parentRefs.company, industry = parentRefs.industry;
removeChildrenFromElement(industryWarehousePanel);
- var storageText = "Storage: " +
- (this.sizedUsed >= this.size ? formatNumber(this.sizeUsed, 3) : formatNumber(this.sizeUsed, 3)) +
- "/" + formatNumber(this.size, 3);
- industryWarehousePanel.appendChild(createElement("p", {
- innerHTML: storageText,
- display:"inline-block",
+ industryWarehouseStorageText = createElement("p", {
+ display:"inline-block", class:"tooltip",
color: this.sizeUsed >= this.size ? "red" : "white",
- }));
+ });
+ industryWarehousePanel.appendChild(industryWarehouseStorageText);
//Upgrade warehouse size button
var upgradeCost = WarehouseUpgradeBaseCost * Math.pow(1.07, Math.round(this.size / 100) - 1);
- industryWarehousePanel.appendChild(createElement("a", {
+ industryWarehouseUpgradeSizeButton = createElement("a", {
innerText:"Upgrade Warehouse Size - " + numeral(upgradeCost).format('$0.000a'),
display:"inline-block",
class: company.funds.lt(upgradeCost) ? "a-link-button-inactive" : "a-link-button",
@@ -2036,7 +2067,8 @@ Warehouse.prototype.createUI = function(parentRefs) {
this.createUI(parentRefs);
return;
}
- }));
+ });
+ industryWarehousePanel.appendChild(industryWarehouseUpgradeSizeButton);
//Material requirement text
var reqText = "This Industry uses [" + Object.keys(industry.reqMats).join(", ") +
@@ -2050,28 +2082,7 @@ Warehouse.prototype.createUI = function(parentRefs) {
reqText += industry.getProductDescriptionText();
}
reqText += "
To get started with production, purchase your required " +
- "materials or import them from another of your company's divisions.
" +
- "Current state: ";
- switch(industry.state) {
- case "START":
- reqText += "Preparing...";
- break;
- case "PURCHASE":
- reqText += "Purchasing materials...";
- break;
- case "PRODUCTION":
- reqText += "Producing materials and/or products...";
- break;
- case "SALE":
- reqText += "Selling materials and/or products...";
- break;
- case "EXPORT":
- reqText += "Exporting materials and/or products...";
- break;
- default:
- console.log("ERROR: Invalid state: " + industry.state);
- break;
- }
+ "materials or import them from another of your company's divisions.
";
//Material ratio text for tooltip
var reqRatioText = "The exact requirements for production are: ";
@@ -2094,28 +2105,116 @@ Warehouse.prototype.createUI = function(parentRefs) {
innerHTML:reqText, tooltipleft:reqRatioText
}));
+ //Current state
+ industryWarehouseStateText = createElement("p");
+ industryWarehousePanel.appendChild(industryWarehouseStateText);
+
+ //Smart Supply Enable/Disable
+ if (company.unlockUpgrades[1]) {
+ if (this.smartSupplyEnabled == null) {this.smartSupplyEnabled = false;}
+ var smartSupplyCheckboxId = "cmpy-mgmt-smart-supply-checkbox";
+ industryWarehousePanel.appendChild(createElement("label", {
+ for:smartSupplyCheckboxId, innerText:"Enable Smart Supply",
+ color:"white"
+ }));
+ industrySmartSupplyCheckbox = createElement("input", {
+ type:"checkbox", id:smartSupplyCheckboxId, margin:"3px",
+ changeListener:()=>{
+ this.smartSupplyEnabled = industrySmartSupplyCheckbox.checked;
+ }
+ });
+ industrySmartSupplyCheckbox.checked = this.smartSupplyEnabled;
+ industryWarehousePanel.appendChild(industrySmartSupplyCheckbox);
+ }
+
//Materials
industryWarehousePanel.appendChild(createElement("p", {
innerHTML: " Materials: ",
}));
+ industryWarehouseMaterials = createElement("ul");
+ industryWarehousePanel.appendChild(industryWarehouseMaterials);
+
+ //Products
+ if (industry.makesProducts && Object.keys(industry.products).length > 0) {
+ industryWarehousePanel.appendChild(createElement("p", {
+ innerHTML: " Products: ",
+ }));
+ industryWarehouseProducts = createElement("ul");
+ industryWarehousePanel.appendChild(industryWarehouseProducts);
+ }
+
+ this.updateUI(parentRefs);
+}
+
+Warehouse.prototype.updateUI = function(parentRefs) {
+ if (parentRefs.company == null || parentRefs.industry == null) {
+ console.log("ERROR: Warehouse.updateUI called without parentRefs.company or parentRefs.industry");
+ return;
+ }
+ var company = parentRefs.company, industry = parentRefs.industry;
+
+ //Storage text
+ var storageText = "Storage: " +
+ (this.sizedUsed >= this.size ? formatNumber(this.sizeUsed, 3) : formatNumber(this.sizeUsed, 3)) +
+ "/" + formatNumber(this.size, 3);
+ if (industryWarehouseStorageBreakdownText != null &&
+ industryWarehouseStorageBreakdownText != "") {
+ storageText += ("" +
+ industryWarehouseStorageBreakdownText + "");
+ }
+ industryWarehouseStorageText.innerHTML = storageText;
+
+ //Upgrade warehouse size button
+ var upgradeCost = WarehouseUpgradeBaseCost * Math.pow(1.07, Math.round(this.size / 100) - 1);
+ if (company.funds.lt(upgradeCost)) {
+ industryWarehouseUpgradeSizeButton.className = "a-link-button-inactive";
+ } else {
+ industryWarehouseUpgradeSizeButton.className = "a-link-button";
+ }
+
+ //Current state
+ var stateText = "Current state: ";
+ switch(industry.state) {
+ case "START":
+ stateText += "Preparing...";
+ break;
+ case "PURCHASE":
+ stateText += "Purchasing materials...";
+ break;
+ case "PRODUCTION":
+ stateText += "Producing materials and/or products...";
+ break;
+ case "SALE":
+ stateText += "Selling materials and/or products...";
+ break;
+ case "EXPORT":
+ stateText += "Exporting materials and/or products...";
+ break;
+ default:
+ console.log("ERROR: Invalid state: " + industry.state);
+ break;
+ }
+ industryWarehouseStateText.innerText = stateText;
+
+ //Materials
+ removeChildrenFromElement(industryWarehouseMaterials);
for (var matName in this.materials) {
if (this.materials.hasOwnProperty(matName) && this.materials[matName] instanceof Material) {
if (Object.keys(industry.reqMats).includes(matName) || industry.prodMats.includes(matName) ||
matName === "Hardware" || matName === "Robots" || matName === "AICores" ||
matName === "RealEstate") {
- this.createMaterialUI(this.materials[matName], matName, parentRefs);
+ industryWarehouseMaterials.appendChild(this.createMaterialUI(this.materials[matName], matName, parentRefs));
}
}
}
//Products
- if (!(industry.makesProducts && Object.keys(industry.products).length > 0)) {return;}
- industryWarehousePanel.appendChild(createElement("p", {
- innerHTML: " Products: ",
- }));
- for (var productName in industry.products) {
- if (industry.products.hasOwnProperty(productName) && industry.products[productName] instanceof Product) {
- this.createProductUI(industry.products[productName], parentRefs);
+ if (industry.makesProducts && Object.keys(industry.products).length > 0) {
+ removeChildrenFromElement(industryWarehouseProducts);
+ for (var productName in industry.products) {
+ if (industry.products.hasOwnProperty(productName) && industry.products[productName] instanceof Product) {
+ industryWarehouseProducts.appendChild(this.createProductUI(industry.products[productName], parentRefs));
+ }
}
}
}
@@ -2185,9 +2284,7 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
type:"number", value:mat.buy ? mat.buy : null, placeholder: "Purchase amount",
onkeyup:(e)=>{
e.preventDefault();
- if (e.keyCode === 13) {
- confirmBtn.click();
- }
+ if (e.keyCode === 13) {confirmBtn.click();}
}
});
confirmBtn = createElement("a", {
@@ -2239,28 +2336,30 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
});
//Select industry and city to export to
- var industrySelector = createElement("select", {}),
- citySelector = createElement("select", {});
+ var citySelector = createElement("select");
+ var industrySelector = createElement("select", {
+ changeListener:()=>{
+ var industryName = industrySelector.options[industrySelector.selectedIndex].value;
+ for (var foo = 0; foo < company.divisions.length; ++foo) {
+ if (company.divisions[foo].name == industryName) {
+ clearSelector(citySelector);
+ var selectedIndustry = company.divisions[foo];
+ for (var cityName in company.divisions[foo].warehouses) {
+ if (company.divisions[foo].warehouses[cityName] instanceof Warehouse) {
+ citySelector.add(createElement("option", {
+ value:cityName, text:cityName,
+ }));
+ }
+ }
+ return;
+ }
+ }
+ }
+ });
+
for (var i = 0; i < company.divisions.length; ++i) {
industrySelector.add(createElement("option", {
text:company.divisions[i].name, value:company.divisions[i].name,
- changeListener:()=>{
- var industryName = industrySelector.options[industrySelector.selectedIndex].value;
- for (var foo = 0; foo < company.divisions.length; ++foo) {
- if (company.divisions[foo].name == industryName) {
- clearSelector(citySelector);
- var selectedIndustry = company.divisions[foo];
- for (var cityName in company.divisions[foo].warehouses) {
- if (company.divisions[foo].warehouses[cityName] instanceof Warehouse) {
- citySelector.add(createElement("option", {
- value:cityName, text:cityName,
- }));
- }
- }
- return;
- }
- }
- }
})); //End create element option
} //End for
@@ -2471,7 +2570,7 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
}
}));
- industryWarehousePanel.appendChild(div);
+ return div;
}
Warehouse.prototype.createProductUI = function(product, parentRefs) {
@@ -2487,8 +2586,7 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) {
innerHTML: "Designing " + product.name + "... " +
formatNumber(product.prog, 2) + "% complete",
}));
- industryWarehousePanel.appendChild(div);
- return;
+ return div;
}
//Completed products
@@ -2517,7 +2615,10 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) {
"An estimate of how much it costs to produce one unit of this product. " +
"If your sell price exceeds this by too much, people won't buy your product. The better your " +
"product is, the higher you can mark up its price. " +
- "Size: " + formatNumber(product.siz, 3),
+ "
Est. Market Price: " + numeral(product.pCost + product.rat / product.mku).format("$0.000a") +
+ "An estimate of how much consumers are willing to pay for this product. " +
+ "Setting the sale price above this may result in less sales. Setting the sale price below this may result " +
+ "in more sales.
"
}));
var buttonPanel = createElement("div", {
display:"inline-block",
@@ -2688,7 +2789,7 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) {
createPopup(popupId, [txt, confirmBtn, cancelBtn]);
}
}));
- industryWarehousePanel.appendChild(div);
+ return div;
}
Warehouse.prototype.toJSON = function() {
@@ -2711,7 +2812,7 @@ var CorporationUnlockUpgrades = {
"This allows you to move materials around between different divisions and cities."],
//Lets you buy exactly however many required materials you need for production
- "1": [1, 999999e9, "Smart Supply", "NOT YET IMPLEMENTED!!!!!! - Use advanced AI to anticipate your supply needs. " +
+ "1": [1, 50e9, "Smart Supply", "Use advanced AI to anticipate your supply needs. " +
"This allows you to purchase exactly however many materials you need for production."],
//Displays each material/product's demand
@@ -2754,10 +2855,10 @@ var CorporationUpgrades = {
"20 seconds."],
//Makes advertising more effective
- "3": [3, 4e9, 1.12, 0.01,
+ "3": [3, 4e9, 1.12, 0.005,
"Wilson Analytics", "Purchase data and analysis from Wilson, a marketing research " +
"firm. Each level of this upgrades increases the effectiveness of your " +
- "advertising by 1% (additive)."],
+ "advertising by 0.5% (additive)."],
//Augmentation for employees, increases cre
"4": [4, 1e9, 1.06, 0.1,
@@ -2825,12 +2926,15 @@ Corporation.prototype.getState = function() {
return this.state.getState();
}
-var numMarketCyclesPersist = 1;
-Corporation.prototype.process = function(numCycles=1) {
- var corp = this;
+Corporation.prototype.storeCycles = function(numCycles=1) {
this.storedCycles += numCycles;
+}
+
+Corporation.prototype.process = function() {
+ var corp = this;
if (this.storedCycles >= CyclesPerIndustryStateCycle) {
- var state = this.getState();
+ var state = this.getState(), marketCycles=1;
+ this.storedCycles -= (marketCycles * CyclesPerIndustryStateCycle);
//At the start of a new cycle, calculate profits from previous cycle
if (state === "START") {
@@ -2841,7 +2945,7 @@ Corporation.prototype.process = function(numCycles=1) {
this.expenses = this.expenses.plus(ind.lastCycleExpenses);
});
var profit = this.revenue.minus(this.expenses);
- var cycleProfit = profit.times(numMarketCyclesPersist * SecsPerMarketCycle);
+ var cycleProfit = profit.times(marketCycles * SecsPerMarketCycle);
if (isNaN(this.funds)) {
dialogBoxCreate("There was an error calculating your Corporations funds and they got reset to 0. " +
"This is a bug. Please report to game developer.
" +
@@ -2852,19 +2956,6 @@ Corporation.prototype.process = function(numCycles=1) {
this.updateSharePrice();
}
- //Determine number of market cycles at the START state
- if (state === "START") {
- if (this.storedCycles >= 2*CyclesPerMarketCycle) {
- //Enough cycles stored for 2+ market cycles
- //Capped out at 3 to prevent weird behavior
- numMarketCyclesPersist = Math.max(3, Math.floor(this.storedCycles / CyclesPerMarketCycle));
- } else {
- numMarketCyclesPersist = 1;
- }
- }
- var marketCycles = numMarketCyclesPersist;
-
- this.storedCycles -= (marketCycles * CyclesPerIndustryStateCycle);
this.divisions.forEach(function(ind) {
ind.process(marketCycles, state, corp);
});
@@ -2948,12 +3039,17 @@ Corporation.prototype.goPublic = function() {
"your company's stock price in the future.
" +
"You have a total of " + numeral(this.numShares).format("0.000a") + " of shares that you can issue.",
});
+ var yesBtn;
var input = createElement("input", {
type:"number",
placeholder: "Shares to issue",
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {yesBtn.click();}
+ }
});
var br = createElement("br", {});
- var yesBtn = createElement("a", {
+ yesBtn = createElement("a", {
class:"a-link-button",
innerText:"Go Public",
clickListener:()=>{
@@ -3099,11 +3195,20 @@ Corporation.prototype.getScientificResearchMultiplier = function() {
var companyManagementDiv, companyManagementHeaderTabs, companyManagementPanel,
currentCityUi,
corporationUnlockUpgrades, corporationUpgrades,
+
+ //Industry Overview Panel
industryOverviewPanel, industryOverviewText,
+
+ //Industry Employee Panel
industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeAutohireButton,
industryEmployeeManagementUI, industryEmployeeInfo, industryIndividualEmployeeInfo,
industryOfficeUpgradeSizeButton,
- industryWarehousePanel,
+
+ //Industry Warehouse Panel
+ industryWarehousePanel, industrySmartSupplyCheckbox, industryWarehouseStorageText,
+ industryWarehouseStorageBreakdownText,
+ industryWarehouseUpgradeSizeButton, industryWarehouseStateText,
+ industryWarehouseMaterials, industryWarehouseProducts,
headerTabs, cityTabs;
Corporation.prototype.createUI = function() {
companyManagementDiv = createElement("div", {
@@ -3163,28 +3268,33 @@ Corporation.prototype.updateUIHeaderTabs = function() {
var container = createElement("div", {
class:"popup-box-container",
id:"cmpy-mgmt-expand-industry-popup",
- }),
- content = createElement("div", {class:"popup-box-content"}),
- txt = createElement("p", {
+ });
+ var content = createElement("div", {class:"popup-box-content"});
+ var txt = createElement("p", {
innerHTML: "Create a new division to expand into a new industry:",
- }),
- selector = createElement("select", {
+ });
+ var selector = createElement("select", {
class:"cmpy-mgmt-industry-select"
- }),
- industryDescription = createElement("p", {}),
- nameInput = createElement("input", {
+ });
+ var industryDescription = createElement("p", {});
+ var yesBtn;
+ var nameInput = createElement("input", {
type:"text",
id:"cmpy-mgmt-expand-industry-name-input",
color:"white",
backgroundColor:"black",
display:"block",
maxLength: 30,
- pattern:"[a-zA-Z0-9-_]"
- }),
- nameLabel = createElement("label", {
+ pattern:"[a-zA-Z0-9-_]",
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {yesBtn.click();}
+ }
+ });
+ var nameLabel = createElement("label", {
for:"cmpy-mgmt-expand-industry-name-input",
innerText:"Division name: "
- }),
+ });
yesBtn = createElement("span", {
class:"popup-box-button",
innerText:"Create Division",
@@ -3216,8 +3326,8 @@ Corporation.prototype.updateUIHeaderTabs = function() {
}
return false;
}
- }),
- noBtn = createElement("span", {
+ });
+ var noBtn = createElement("span", {
class:"popup-box-button",
innerText:"Cancel",
clickListener: function() {
@@ -4054,7 +4164,8 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
division.products[product.name] = product;
removeElementById(popupId);
}
- this.updateUIContent();
+ //this.updateUIContent();
+ this.displayDivisionContent(division, city);
return false;
}
})
@@ -4129,16 +4240,42 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
tooltip:"Upgrade the office's size so that it can hold more employees!",
clickListener:()=>{
var popupId = "cmpy-mgmt-upgrade-office-size-popup";
- var upgradeCost = OfficeInitialCost * Math.pow(1.07, Math.round(office.size / OfficeInitialSize));
+ var initialPriceMult = Math.round(office.size / OfficeInitialSize);
+ var upgradeCost = OfficeInitialCost * Math.pow(1.07, initialPriceMult);
+
+ //Calculate cost to upgrade size by 15 employees
+ var mult = 0;
+ for (var i = 0; i < 5; ++i) {
+ mult += (Math.pow(1.07, initialPriceMult + i));
+ }
+ var upgradeCost15 = OfficeInitialCost * mult;
+
+ //Calculate max upgrade size and cost
+ var maxMult = (this.funds.dividedBy(OfficeInitialCost)).toNumber();
+ var maxNum = 1;
+ mult = Math.pow(1.07, initialPriceMult);
+ while(maxNum < 50) { //Hard cap of 50x (extra 150 employees)
+ if (mult >= maxMult) {break;}
+ var multIncrease = Math.pow(1.07, initialPriceMult + maxNum);
+ if (mult + multIncrease > maxMult) {
+ break;
+ } else {
+ mult += multIncrease;
+ }
+ ++maxNum;
+ }
+
+ var upgradeCostMax = OfficeInitialCost * mult;
+
var text = createElement("p", {
- innerHTML:"Increase the size of your office space to fit " + OfficeInitialSize +
- " more employees. This will cost " + numeral(upgradeCost).format('$0.000a'),
+ innerText:"Increase the size of your office space to fit additional employees!"
});
+ var text2 = createElement("p", {innerText: "Upgrade size: "});
+
var confirmBtn = createElement("a", {
- class:"a-link-button",
- display:"inline-block",
- margin:"8px",
- innerText:"Upgrade Office Size",
+ class: this.funds.lt(upgradeCost) ? "a-link-button-inactive" : "a-link-button",
+ display:"inline-block", margin:"4px", innerText:"by 3",
+ tooltip:numeral(upgradeCost).format("$0.000a"),
clickListener:()=>{
if (this.funds.lt(upgradeCost)) {
dialogBoxCreate("You don't have enough company funds to purchase this upgrade!");
@@ -4152,17 +4289,48 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
return false;
}
});
+ var confirmBtn15 = createElement("a", {
+ class: this.funds.lt(upgradeCost15) ? "a-link-button-inactive" : "a-link-button",
+ display:"inline-block", margin:"4px", innerText:"by 15",
+ tooltip:numeral(upgradeCost15).format("$0.000a"),
+ clickListener:()=>{
+ if (this.funds.lt(upgradeCost15)) {
+ dialogBoxCreate("You don't have enough company funds to purchase this upgrade!");
+ } else {
+ office.size += (OfficeInitialSize * 5);
+ this.funds = this.funds.minus(upgradeCost15);
+ dialogBoxCreate("Office space increased! It can now hold " + office.size + " employees");
+ this.updateUIContent();
+ }
+ removeElementById(popupId);
+ return false;
+ }
+ });
+ var confirmBtnMax = createElement("a", {
+ class:this.funds.lt(upgradeCostMax) ? "a-link-button-inactive" : "a-link-button",
+ display:"inline-block", margin:"4px", innerText:"by MAX (" + maxNum*OfficeInitialSize + ")",
+ tooltip:numeral(upgradeCostMax).format("$0.000a"),
+ clickListener:()=>{
+ if (this.funds.lt(upgradeCostMax)) {
+ dialogBoxCreate("You don't have enough company funds to purchase this upgrade!");
+ } else {
+ office.size += (OfficeInitialSize * maxNum);
+ this.funds = this.funds.minus(upgradeCostMax);
+ dialogBoxCreate("Office space increased! It can now hold " + office.size + " employees");
+ this.updateUIContent();
+ }
+ removeElementById(popupId);
+ return false;
+ }
+ });
var cancelBtn = createElement("a", {
- class:"a-link-button",
- innerText:"Cancel",
- display:"inline-block",
- margin:"8px",
+ class:"a-link-button", innerText:"Cancel", display:"inline-block", margin:"4px",
clickListener:()=>{
removeElementById(popupId);
return false;
}
})
- createPopup(popupId, [text, confirmBtn, cancelBtn]);
+ createPopup(popupId, [text, text2, confirmBtn, confirmBtn15, confirmBtnMax, cancelBtn]);
return false;
}
});
@@ -4182,6 +4350,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
var totalCostTxt = createElement("p", {
innerText:"Throwing this party will cost a total of $0"
});
+ var confirmBtn;
var input = createElement("input", {
type:"number", margin:"5px", placeholder:"$ / employee",
inputListener:()=>{
@@ -4191,9 +4360,13 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
var totalCost = input.value * office.employees.length;
totalCostTxt.innerText = "Throwing this party will cost a total of " + numeral(totalCost).format('$0.000a');
}
+ },
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {confirmBtn.click();}
}
});
- var confirmBtn = createElement("a", {
+ confirmBtn = createElement("a", {
class:"a-link-button",
display:"inline-block",
innerText:"Throw Party",
@@ -4383,7 +4556,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
size:WarehouseInitialSize,
});
this.funds = this.funds.minus(WarehouseInitialCost);
- this.updateDivisionContent(division);
+ this.displayDivisionContent(division, currentCityUi);
}
return false;
}
@@ -4411,23 +4584,51 @@ Corporation.prototype.updateDivisionContent = function(division) {
advertisingInfo =
"
Advertising Multiplier: x" + formatNumber(totalAdvertisingFac, 3) +
"Total multiplier for this industry's sales due to its awareness and popularity " +
- "Awareness Bonus: x" + formatNumber(awarenessFac, 3) + " " +
- "Popularity Bonus: x" + formatNumber(popularityFac, 3) + " " +
- "Ratio Multiplier: x" + formatNumber(ratioFac, 3) + "
Production Multiplier: " + formatNumber(division.prodMult, 2) +
- "Production gain from owning production-boosting materials " +
- "such as hardware, Robots, AI Cores, and Real Estate
"
+ }));
+ industryOverviewText.appendChild(createElement("p", {
+ marginTop:"2px",
+ innerText:"Production Multiplier: " + formatNumber(division.prodMult, 2),
+ tooltip:"Production gain from owning production-boosting materials " +
+ "such as hardware, Robots, AI Cores, and Real Estate"
+ }));
+ industryOverviewText.appendChild(createElement("div", {
+ innerText:"?", class:"help-tip",
+ clickListener:()=>{
+ dialogBoxCreate("Owning Hardware, Robots, AI Cores, and Real Estate " +
+ "can boost your Industry's production. The effect these " +
+ "materials have on your production varies between Industries. " +
+ "For example, Real Estate may be very effective for some Industries, " +
+ "but ineffective for others.
" +
+ "This division's production multiplier is calculated by summing " +
+ "the individual production multiplier of each of its office locations. " +
+ "This production multiplier is applied to each office. Therefore, it is " +
+ "beneficial to expand into new cities as this can greatly increase the " +
+ "production multiplier of your entire Division."
+ )
+ }
+ }));
+ industryOverviewText.appendChild(createElement("br"));
+ industryOverviewText.appendChild(createElement("p", {
+ display:"inline-block",
+ innerText:"Scientific Research: " + formatNumber(division.sciResearch.qty, 3),
+ tooltip:"Scientific Research increases the quality of the materials and " +
+ "products that you produce."
+ }));
//Office and Employee List
var office = division.offices[currentCityUi];
@@ -4491,7 +4692,7 @@ Corporation.prototype.updateDivisionContent = function(division) {
//Warehouse
var warehouse = division.warehouses[currentCityUi];
if (warehouse instanceof Warehouse) {
- warehouse.createUI({industry:division, company:this});
+ warehouse.updateUI({industry:division, company:this});
}
}
@@ -4545,7 +4746,13 @@ Corporation.prototype.clearUI = function() {
industryOfficeUpgradeSizeButton = null;
- industryWarehousePanel = null;
+ industryWarehousePanel = null;
+ industrySmartSupplyCheckbox = null;
+ industryWarehouseStorageText = null;
+ industryWarehouseUpgradeSizeButton = null;
+ industryWarehouseStateText = null;
+ industryWarehouseMaterials = null;
+ industryWarehouseProducts = null;
companyManagementHeaderTabs = null;
headerTabs = null;
diff --git a/src/Constants.js b/src/Constants.js
index e92584698..cfbe43bb9 100644
--- a/src/Constants.js
+++ b/src/Constants.js
@@ -1,5 +1,5 @@
let CONSTANTS = {
- Version: "0.35.0",
+ Version: "0.35.1",
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@@ -1138,39 +1138,28 @@ let CONSTANTS = {
"World Stock Exchange account and TIX API Access ",
LatestUpdate:
- "v0.35.0 " +
- "-Minor rebalancing of BitNodes due to the fact that Corporations provide a (relatively) new method of " +
- "progressing " +
- "-Corporation Management Changes: " +
- "---Once your Corporation gets big/powerful enough, you can now bribe Factions for reputation using company funds an/or stock shares " +
- "---You can now only create one Division for every Industry type " +
- "---Added several new UI/UX elements " +
- "---Wilson Analytics multiplier was significantly reduced to 1% per level (additive). " +
- "---Reduced the effect of Advert Inc upgrade. Advert Inc. upgrade price increases faster " +
- "---Materials can now be marked up at higher prices " +
- "-Added Javascript's built-in Number object to Netscript " +
- "-Added getCharacterInformation(), getCompanyFavor(), and getFactionFavor() Netscript Singularity functions " +
- "-Rebalanced Singularity Function RAM Costs. They now cost x8 as much when outside of BN-4 (rather than x10). Also, " +
- "many of the functions now use significantly less RAM " +
- "-Refactored Netscript Ports. You can now get a handle for a Netscript port using the " +
- "getPortHandle() Netscript function. This allows you to access a port's underlying queue (which is just an array) and also " +
- "makes several new functions available such as tryWrite(), full(), and empty(). " +
- "-Number of Netscript Ports increased from 10 to 20 " +
- "-Netscript assignments should now return proper values. i.e. i = 5 should return 5. " +
- "-Added throw statements to Netscript. It's not super useful since 'catch' isn't implemented, but it can be used " +
- "to generate custom runtime error messages. " +
- "-Added import declaration to Netscript. With this, you are able to import functions (and only functions) from " +
- "other files. Using export declarations is not necessary " +
- "-Most Netscript Runtime errors (the ones that cause your script to crash) should now include the line number where the error occured " +
- "-When working for a company, your current company reputation is now displayed " +
- "-Whenever you get a Faction Invite it will be immediately appended to your 'invited factions' list. " +
- "Therefore the checkFactionInvitations() Singularity Function should now be properly useable since you no longer " +
- "need to decline a Faction Invitation before it shows up in the result. " +
- "-Bug Fix: When purchasing servers, whitespace should now automatically be removed from the hostname " +
- "-Bug Fix: Can no longer have whitespace in the filename of text files created using write() " +
- "-Bug Fix: In Netscript, you can no longer assign a Hacknet Node handle (hacknetnodes[i]) to another value " +
- "-Bug Fix: If you are in the Factions tab when you accept an invitation from a Faction, the page will now properly 'refresh' " +
- "-Bug Fix: Scripts that run recursive functions should now be killed properly "
+ "v0.35.1 " +
+ "* You can now easily download all of your scripts/text files as zip folders. Use the 'help download' Terminal command for details " +
+ "* Scripts are now downloaded with the .script.js extension at the end of their filename " +
+ "* Corporation Management Changes: " +
+ "*** Implemented Smart Supply unlock " +
+ "*** Changed the way a division's Production Multiplier is calculated. It is now the sum of the individual Production Multiplier " +
+ "for every city. Therefore, it is now beneficial to open offices in different cities" +
+ "*** Several small UI/UX improvements " +
+ "*** Numerous balance changes. The significant ones are listed below. " +
+ "*** Product descriptions will now display their estimated market price " +
+ "*** The sale price of Products can no longer be marked up as high as before " +
+ "*** Scientific Research now affects the rating of Products " +
+ "*** In general, the maximum amount of product you are able to sell is reduced " +
+ "*** Sale bonus from advertising (popularity/awareness) now has diminishing returns rather than scaling linearly " +
+ "* Experience gained during Infiltration now scales linearly based on the clearance level you reach. Compared to before, " +
+ "the experience gained will be much less at lower clearance levels, but much more at higher clearance levels " +
+ "* The editor can now be used to edit both scripts and text files " +
+ "* New Terminal config file that can be edited using the command 'nano .fconf'. Right now there is only one option, but there " +
+ "will be more in the future. " +
+ "* You can now enable Bash-style Terminal hotkeys using the .fconf file referenced above " +
+ "* Bug Fix: Fixed an issue with the UI elements of Gang Management persisting across different instances of BitNode-2"
}
export {CONSTANTS};
diff --git a/src/Fconf.js b/src/Fconf.js
new file mode 100644
index 000000000..a76be8f74
--- /dev/null
+++ b/src/Fconf.js
@@ -0,0 +1,117 @@
+import {parse, Node} from "../utils/acorn.js";
+
+var FconfSettings = {
+ ENABLE_BASH_HOTKEYS: false
+}
+
+var FconfComments = {
+ ENABLE_BASH_HOTKEYS: "Improved Bash emulation mode. Setting this to 1 enables several\n" +
+ "new Terminal shortcuts and features that more closely resemble\n" +
+ "a real Bash-style shell. Note that when this mode is enabled,\n" +
+ "the default browser shortcuts are overriden by the new Bash\n" +
+ "shortcuts.\n\n" +
+ "To see a full list of the Terminal shortcuts that this enables, see:\n",
+}
+
+//Parse Fconf settings from the config text
+//Throws an exception if parsing fails
+function parseFconfSettings(config) {
+ var ast = parse(config, {sourceType:"module"});
+ var queue = [];
+ queue.push(ast);
+ while (queue.length != 0) {
+ var exp = queue.shift();
+ switch (exp.type) {
+ case "BlockStatement":
+ case "Program":
+ for (var i = 0; i < exp.body.length; ++i) {
+ if (exp.body[i] instanceof Node) {
+ queue.push(exp.body[i]);
+ }
+ }
+ break;
+ case "AssignmentExpression":
+ var setting, value;
+ if (exp.left != null && exp.left.name != null) {
+ setting = exp.left.name;
+ } else {
+ break;
+ }
+ if (exp.right != null && exp.right.raw != null) {
+ value = exp.right.raw;
+ } else {
+ break;
+ }
+ parseFconfSetting(setting, value);
+ break;
+ default:
+ break;
+ }
+
+ for (var prop in exp) {
+ if (exp.hasOwnProperty(prop)) {
+ if (exp[prop] instanceof Node) {
+ queue.push(exp[prop]);
+ }
+ }
+ }
+ }
+}
+
+function parseFconfSetting(setting, value) {
+ setting = String(setting);
+ value = String(value);
+ if (setting == null || value == null || FconfSettings[setting] == null) {
+ console.log("WARNING: Invalid .fconf setting: " + setting);
+ return;
+ }
+
+ //Needed to convert entered value to boolean/strings accordingly
+ switch(setting) {
+ case "ENABLE_BASH_HOTKEYS":
+ var value = value.toLowerCase();
+ if (value === "1" || value === "true" || value === "y") {
+ value = true;
+ } else {
+ value = false;
+ }
+ FconfSettings[setting] = value;
+ break;
+ default:
+ break;
+ }
+ return;
+}
+
+//Create the .fconf file text from the settings
+function createFconf() {
+ var res = "";
+ for (var setting in FconfSettings) {
+ if (FconfSettings.hasOwnProperty(setting)) {
+ //Setting comments (description)
+ var comment = FconfComments[setting];
+ if (comment == null) {continue;}
+ var comment = comment.split("\n");
+ for (var i = 0; i < comment.length; ++i) {
+ res += ("//" + comment[i] + "\n");
+ }
+
+ var value = 0;
+ if (FconfSettings[setting] === true) {
+ value = "1";
+ } else if (FconfSettings[setting] === false) {
+ value = "0";
+ } else {
+ value = String(FconfSettings[setting]);
+ }
+ res += (setting + "=" + value + "\n");
+ }
+ }
+ return res;
+}
+
+function loadFconf(saveString) {
+ FconfSettings = JSON.parse(saveString);
+}
+
+export {FconfSettings, createFconf, parseFconfSettings, loadFconf}
diff --git a/src/Gang.js b/src/Gang.js
index 33a78ccdb..752b4267a 100644
--- a/src/Gang.js
+++ b/src/Gang.js
@@ -1,7 +1,6 @@
import {CONSTANTS} from "./Constants.js";
import {Engine} from "./engine.js";
import {Faction, Factions} from "./Faction.js";
-import {Locations} from "./Location.js";
import {Player} from "./Player.js";
import {dialogBoxCreate} from "../utils/DialogBox.js";
import {Reviver, Generic_toJSON,
@@ -53,8 +52,6 @@ $(document).mousedown(function(event) {
let GangNames = ["Slum Snakes", "Tetrads", "The Syndicate", "The Dark Army", "Speakers for the Dead",
"NiteSec", "The Black Hand"];
-let GangLocations = [Locations.Aevum, Locations.Chongqing, Locations.Sector12, Locations.NewTokyo,
- Locations.Ishima, Locations.Volhaven];
let AllGangs = {
"Slum Snakes" : {
power: 1,
@@ -1406,5 +1403,35 @@ function setGangMemberTaskDescription(memberObj, taskName) {
}
}
+function deleteGangDisplayContent() {
+ if (gangContainer != null) {removeElementById(gangContainer.id);}
+
+ gangContentCreated = false;
+ gangContainer = null;
+ managementButton = null;
+ territoryButton = null;
+
+ //Subpages
+ gangManagementSubpage = null;
+ gangTerritorySubpage = null;
+
+ //Gang Management Elements
+ gangDesc = null;
+ gangInfo = null;
+ gangRecruitMemberButton = null;
+ gangRecruitRequirementText = null;
+ gangExpandAllButton = null;
+ gangCollapseAllButton = null;
+ gangMemberFilter = null;
+ gangManageEquipmentButton = null;
+ gangMemberList = null;
+
+ //Gang Equipment Upgrade Elements
+ gangMemberUpgradeBox = null;
+ gangMemberUpgradeBoxContent = null;
+ gangMemberUpgradeBoxFilter = null;
+ gangMemberUpgradeBoxElements = null;
+}
+
export {Gang, displayGangContent, updateGangContent, loadAllGangs, AllGangs,
- resetGangs};
+ resetGangs, deleteGangDisplayContent};
diff --git a/src/HelpText.js b/src/HelpText.js
index fdc03aef9..bccf5ac7f 100644
--- a/src/HelpText.js
+++ b/src/HelpText.js
@@ -9,7 +9,7 @@ let TerminalHelpText =
"clear Clear all text on the terminal " +
"cls See 'clear' command " +
"connect [ip/hostname] Connects to a remote server " +
- "download [script/text file] Downloads a script or text file to your computer " +
+ "download [script/text file] Downloads scripts or text files to your computer " +
"free Check the machine's memory (RAM) usage " +
"hack Hack the current machine " +
"help [command] Display this help text, or the help text for a command " +
@@ -21,7 +21,7 @@ let TerminalHelpText =
"ls [| grep pattern] Displays all files on the machine " +
"lscpu Displays the number of CPU cores on the machine " +
"mem [script] [-t] [n] Displays the amount of RAM required to run the script " +
- "nano [script] Script editor - Open up and edit a script " +
+ "nano [file] Text editor - Open up and edit a script or text file " +
"ps Display all scripts that are currently running " +
"rm [file] Delete a file from the server " +
"run [name] [-t] [n] [args...] Execute a program or script " +
@@ -87,7 +87,11 @@ let HelpTexts = {
"to this command. Note that only servers that are immediately adjacent to the current server in the network can be connected to. To " +
"see which servers can be connected to, use the 'scan' command.",
download: "download [script/text file] " +
- "Downloads a script or text file to your computer (like your real life computer).",
+ "Downloads a script or text file to your computer (like your real life computer). " +
+ "You can also download all of your scripts/text files as a zip file using the following Terminal commands:
" +
+ "Download all scripts and text files: download * " +
+ "Download all scripts: download *.script " +
+ "Download all text files: download *.txt ",
free: "free " +
"Display's the memory usage on the current machine. Print the amount of RAM that is available on the current server as well as " +
"how much of it is being used.",
@@ -137,8 +141,9 @@ let HelpTexts = {
"mem foo.script -t 50 " +
"The first example above will print the amount of RAM needed to run 'foo.script' with a single thread. The second example " +
"above will print the amount of RAM needed to run 'foo.script' with 50 threads.",
- nano: "nano [script name] " +
- "Opens up the specified script in the Script Editor. If the script does not already exist, then a new, empty script " +
+ nano: "nano [file name] " +
+ "Opens up the specified file in the Text Editor. Only scripts (.script) or text files (.txt) can be " +
+ "edited using the Text Editor. If the file does not already exist, then a new, empty one " +
"will be created",
ps: "ps " +
"Prints all scripts that are running on the current server",
diff --git a/src/Infiltration.js b/src/Infiltration.js
index f2919ec7d..3e0c32692 100644
--- a/src/Infiltration.js
+++ b/src/Infiltration.js
@@ -453,18 +453,20 @@ function updateInfiltrationLevelText(inst) {
totalMoneyValue += inst.secretsStolen[i] * CONSTANTS.InfiltrationMoneyValue *
BitNodeMultipliers.InfiltrationMoney;
}
+
+ var expMultiplier = 2 * inst.clearanceLevel / inst.maxClearanceLevel;
document.getElementById("infiltration-level-text").innerHTML =
"Facility name: " + inst.companyName + " " +
"Clearance Level: " + inst.clearanceLevel + " " +
"Security Level: " + formatNumber(inst.securityLevel, 3) + "
" +
"Total reputation value of secrets stolen: " + formatNumber(totalValue, 3) + " " +
"Total monetary value of secrets stolen: $" + formatNumber(totalMoneyValue, 2) + "
" +
- "Hack exp gained: " + formatNumber(inst.hackingExpGained, 3) + " " +
- "Str exp gained: " + formatNumber(inst.strExpGained, 3) + " " +
- "Def exp gained: " + formatNumber(inst.defExpGained, 3) + " " +
- "Dex exp gained: " + formatNumber(inst.dexExpGained, 3) + " " +
- "Agi exp gained: " + formatNumber(inst.agiExpGained, 3) + " " +
- "Cha exp gained: " + formatNumber(inst.chaExpGained, 3);
+ "Hack exp gained: " + formatNumber(inst.hackingExpGained * expMultiplier, 3) + " " +
+ "Str exp gained: " + formatNumber(inst.strExpGained * expMultiplier, 3) + " " +
+ "Def exp gained: " + formatNumber(inst.defExpGained * expMultiplier, 3) + " " +
+ "Dex exp gained: " + formatNumber(inst.dexExpGained * expMultiplier, 3) + " " +
+ "Agi exp gained: " + formatNumber(inst.agiExpGained * expMultiplier, 3) + " " +
+ "Cha exp gained: " + formatNumber(inst.chaExpGained * expMultiplier, 3);
}
function updateInfiltrationButtons(inst, scenario) {
diff --git a/src/Prestige.js b/src/Prestige.js
index 7957603ba..4cd296a9a 100644
--- a/src/Prestige.js
+++ b/src/Prestige.js
@@ -7,12 +7,14 @@ import {Programs} from "./CreateProgram.js";
import {Engine} from "./engine.js";
import {Factions, Faction, initFactions,
joinFaction} from "./Faction.js";
+import {deleteGangDisplayContent} from "./Gang.js";
import {Locations} from "./Location.js";
import {initMessages, Messages, Message} from "./Message.js";
import {initSingularitySFFlags, hasWallStreetSF}from "./NetscriptFunctions.js";
import {WorkerScript, workerScripts,
prestigeWorkerScripts} from "./NetscriptWorker.js";
import {Player} from "./Player.js";
+
import {AllServers, AddToAllServers,
initForeignServers, Server,
prestigeAllServers,
@@ -239,13 +241,16 @@ function prestigeSourceFile() {
}
Player.gang = null;
+ deleteGangDisplayContent();
Player.corporation = null;
//BitNode 3: Corporatocracy
- if (Player.bitNodeN === 3) {Player.money = new Decimal(150e9);}
- homeComp.messages.push("corporation-management-handbook.lit");
- dialogBoxCreate("You received a copy of the Corporation Management Handbook on your home computer. " +
- "Read it if you need help getting started with Corporations!");
+ if (Player.bitNodeN === 3) {
+ Player.money = new Decimal(150e9);
+ homeComp.messages.push("corporation-management-handbook.lit");
+ dialogBoxCreate("You received a copy of the Corporation Management Handbook on your home computer. " +
+ "Read it if you need help getting started with Corporations!");
+ }
//Gain int exp
Player.gainIntelligenceExp(5);
diff --git a/src/SaveObject.js b/src/SaveObject.js
index a3f1bc419..d5e707d8c 100644
--- a/src/SaveObject.js
+++ b/src/SaveObject.js
@@ -6,6 +6,7 @@ import {CONSTANTS} from "./Constants.js";
import {Engine} from "./engine.js";
import {loadFactions, Factions,
processPassiveFactionRepGain} from "./Faction.js";
+import {FconfSettings, loadFconf} from "./Fconf.js";
import {loadAllGangs, AllGangs} from "./Gang.js";
import {processAllHacknetNodeEarnings} from "./HacknetNode.js";
import {loadMessages, initMessages, Messages} from "./Message.js";
@@ -40,6 +41,7 @@ function BitburnerSaveObject() {
this.MessagesSave = "";
this.StockMarketSave = "";
this.SettingsSave = "";
+ this.FconfSettingsSave = "";
this.VersionSave = "";
this.AllGangsSave = "";
}
@@ -68,6 +70,7 @@ BitburnerSaveObject.prototype.saveGame = function(db) {
this.MessagesSave = JSON.stringify(Messages);
this.StockMarketSave = JSON.stringify(StockMarket);
this.SettingsSave = JSON.stringify(Settings);
+ this.FconfSettingsSave = JSON.stringify(FconfSettings);
this.VersionSave = JSON.stringify(CONSTANTS.Version);
if (Player.bitNodeN == 2 && Player.inGang()) {
this.AllGangsSave = JSON.stringify(AllGangs);
@@ -170,6 +173,13 @@ function loadGame(saveString) {
} else {
initSettings();
}
+ if (saveObj.hasOwnProperty("FconfSettingsSave")) {
+ try {
+ loadFconf(saveObj.FconfSettingsSave);
+ } catch(e) {
+ console.log("ERROR: Failed to parse .fconf Settings.");
+ }
+ }
if (saveObj.hasOwnProperty("VersionSave")) {
try {
var ver = JSON.parse(saveObj.VersionSave, Reviver);
@@ -378,6 +388,13 @@ function loadImportedGame(saveObj, saveString) {
} else {
initSettings();
}
+ if (saveObj.hasOwnProperty("FconfSettingsSave")) {
+ try {
+ loadFconf(saveObj.FconfSettingsSave);
+ } catch(e) {
+ console.log("ERROR: Failed to load .fconf settings when importing");
+ }
+ }
if (saveObj.hasOwnProperty("VersionSave")) {
try {
var ver = JSON.parse(saveObj.VersionSave, Reviver);
diff --git a/src/Script.js b/src/Script.js
index eff060dd0..e7a38019c 100644
--- a/src/Script.js
+++ b/src/Script.js
@@ -15,6 +15,7 @@ require("brace/ext/language_tools");
import {CONSTANTS} from "./Constants.js";
import {Engine} from "./engine.js";
+import {parseFconfSettings} from "./Fconf.js";
import {iTutorialSteps, iTutorialNextStep,
iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial.js";
import {evaluateImport} from "./NetscriptEvaluator.js";
@@ -25,6 +26,7 @@ import {Player} from "./Player.js";
import {AllServers, processSingleServerGrowth} from "./Server.js";
import {Settings} from "./Settings.js";
import {post} from "./Terminal.js";
+import {TextFile} from "./TextFile.js";
import {parse, Node} from "../utils/acorn.js";
import {dialogBoxCreate} from "../utils/DialogBox.js";
@@ -206,7 +208,8 @@ function scriptEditorInit() {
//Updates RAM usage in script
function updateScriptEditorContent() {
- if (scriptEditorRamCheck == null || !scriptEditorRamCheck.checked) {
+ var filename = document.getElementById("script-editor-filename").value;
+ if (scriptEditorRamCheck == null || !scriptEditorRamCheck.checked || !filename.endsWith(".script")) {
scriptEditorRamText.innerText = "N/A";
return;
}
@@ -234,13 +237,13 @@ $(document).keydown(function(e) {
function saveAndCloseScriptEditor() {
var filename = document.getElementById("script-editor-filename").value;
+ var editor = ace.edit('javascript-editor');
+ var code = editor.getValue();
if (iTutorialIsRunning && currITutorialStep == iTutorialSteps.TerminalTypeScript) {
- if (filename != "foodnstuff") {
+ if (filename != "foodnstuff.script") {
dialogBoxCreate("Leave the script name as 'foodnstuff'!");
return;
}
- var editor = ace.edit('javascript-editor');
- var code = editor.getValue();
code = code.replace(/\s/g, "");
if (code.indexOf("while(true){hack('foodnstuff');}") == -1) {
dialogBoxCreate("Please copy and paste the code from the tutorial!");
@@ -259,28 +262,50 @@ function saveAndCloseScriptEditor() {
return;
}
- filename += ".script";
-
- //If the current script already exists on the server, overwrite it
- for (var i = 0; i < Player.getCurrentServer().scripts.length; i++) {
- if (filename == Player.getCurrentServer().scripts[i].filename) {
- Player.getCurrentServer().scripts[i].saveScript();
- Engine.loadTerminalContent();
+ var s = Player.getCurrentServer();
+ if (filename === ".fconf") {
+ try {
+ parseFconfSettings(code);
+ } catch(e) {
+ dialogBoxCreate("Invalid .fconf file");
return;
}
- }
+ } else if (filename.endsWith(".script")) {
+ //If the current script already exists on the server, overwrite it
+ for (var i = 0; i < s.scripts.length; i++) {
+ if (filename == s.scripts[i].filename) {
+ s.scripts[i].saveScript();
+ Engine.loadTerminalContent();
+ return;
+ }
+ }
- //If the current script does NOT exist, create a new one
- var script = new Script();
- script.saveScript();
- Player.getCurrentServer().scripts.push(script);
+ //If the current script does NOT exist, create a new one
+ var script = new Script();
+ script.saveScript();
+ s.scripts.push(script);
+ } else if (filename.endsWith(".txt")) {
+ for (var i = 0; i < s.textFiles.length; ++i) {
+ if (s.textFiles[i].fn === filename) {
+ s.textFiles[i].write(code);
+ Engine.loadTerminalContent();
+ return;
+ }
+ }
+ var textFile = new TextFile(filename, code);
+ s.textFiles.push(textFile);
+ } else {
+ dialogBoxCreate("Invalid filename. Must be either a script (.script) or " +
+ " or text file (.txt)")
+ return;
+ }
Engine.loadTerminalContent();
}
//Checks that the string contains only valid characters for a filename, which are alphanumeric,
-// underscores and hyphens
+// underscores, hyphens, and dots
function checkValidFilename(filename) {
- var regex = /^[a-zA-Z0-9_-]+$/;
+ var regex = /^[.a-zA-Z0-9_-]+$/;
if (filename.match(regex)) {
return true;
@@ -303,7 +328,7 @@ Script.prototype.saveScript = function() {
var code = editor.getValue();
this.code = code.replace(/^\s+|\s+$/g, '');
- var filename = document.getElementById("script-editor-filename").value + ".script";
+ var filename = document.getElementById("script-editor-filename").value;
this.filename = filename;
//Server
@@ -417,7 +442,7 @@ function calculateRamUsage(codeCopy) {
}
Script.prototype.download = function() {
- var filename = this.filename;
+ var filename = this.filename + ".js";
var file = new Blob([this.code], {type: 'text/plain'});
if (window.navigator.msSaveOrOpenBlob) {// IE10+
window.navigator.msSaveOrOpenBlob(file, filename);
@@ -425,7 +450,7 @@ Script.prototype.download = function() {
var a = document.createElement("a"),
url = URL.createObjectURL(file);
a.href = url;
- a.download = this.filename;
+ a.download = filename;
document.body.appendChild(a);
a.click();
setTimeout(function() {
@@ -675,18 +700,6 @@ function AllServersMap(arr=false, filterOwned=false) {
}
}
-AllServersMap.prototype.printConsole = function() {
- for (var ip in this) {
- if (this.hasOwnProperty(ip)) {
- var serv = AllServers[ip];
- if (serv == null) {
- console.log("Warning null server encountered with ip: " + ip);
- continue;
- }
- }
- }
-}
-
AllServersMap.prototype.toJSON = function() {
return Generic_toJSON("AllServersMap", this);
}
diff --git a/src/Terminal.js b/src/Terminal.js
index 30d004fe3..0fd3fdca5 100644
--- a/src/Terminal.js
+++ b/src/Terminal.js
@@ -7,6 +7,8 @@ import {Programs} from "./CreateProgram.js";
import {executeDarkwebTerminalCommand,
checkIfConnectedToDarkweb} from "./DarkWeb.js";
import {Engine} from "./engine.js";
+import {FconfSettings, parseFconfSettings,
+ createFconf} from "./Fconf.js";
import {TerminalHelpText, HelpTexts} from "./HelpText.js";
import {iTutorialNextStep, iTutorialSteps,
iTutorialIsRunning,
@@ -37,6 +39,9 @@ import {yesNoBoxCreate,
yesNoBoxGetYesButton,
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox.js";
+import * as JSZip from 'jszip';
+import * as FileSaver from 'file-saver';
+
/* Write text to terminal */
//If replace is true then spaces are replaced with " "
function post(input) {
@@ -65,6 +70,30 @@ function postNetburnerText() {
post("Bitburner v" + CONSTANTS.Version);
}
+
+//Key Codes
+let KEY = {
+ TAB: 9,
+ ENTER: 13,
+ CTRL: 17,
+ UPARROW: 38,
+ DOWNARROW: 40,
+ A: 65,
+ B: 66,
+ C: 67,
+ D: 68,
+ E: 69,
+ F: 70,
+ H: 72,
+ K: 75,
+ L: 76,
+ M: 77,
+ N: 78,
+ P: 80,
+ U: 85,
+ W: 87,
+}
+
//Defines key commands in terminal
$(document).keydown(function(event) {
//Terminal
@@ -72,8 +101,7 @@ $(document).keydown(function(event) {
var terminalInput = document.getElementById("terminal-input-text-box");
if (terminalInput != null && !event.ctrlKey && !event.shiftKey) {terminalInput.focus();}
- //Enter
- if (event.keyCode == 13) {
+ if (event.keyCode === KEY.ENTER) {
event.preventDefault(); //Prevent newline from being entered in Script Editor
var command = $('input[class=terminal-input]').val();
if (command.length > 0) {
@@ -84,15 +112,30 @@ $(document).keydown(function(event) {
}
}
- //Ctrl + c when an "Action" is in progress
- if (event.keyCode == 67 && event.ctrlKey && Engine._actionInProgress) {
- post("Cancelling...");
- Engine._actionInProgress = false;
- Terminal.finishAction(true);
+ if (event.keyCode === KEY.C && event.ctrlKey) {
+ if (Engine._actionInProgress) {
+ //Cancel action
+ post("Cancelling...");
+ Engine._actionInProgress = false;
+ Terminal.finishAction(true);
+ } else if (FconfSettings.ENABLE_BASH_HOTKEYS) {
+ //Dont prevent default so it still copies
+ Terminal.resetTerminalInput(); //Clear Terminal
+ }
}
- //Up key to cycle through past commands
- if (event.keyCode == 38) {
+ if (event.keyCode === KEY.L && event.ctrlKey) {
+ event.preventDefault();
+ Terminal.executeCommand("clear"); //Clear screen
+ }
+
+ //Ctrl p same as up arrow
+ //Ctrl n same as down arrow
+
+ if (event.keyCode === KEY.UPARROW ||
+ (FconfSettings.ENABLE_BASH_HOTKEYS && event.keyCode === KEY.P && event.ctrlKey)) {
+ if (FconfSettings.ENABLE_BASH_HOTKEYS) {event.preventDefault();}
+ //Cycle through past commands
if (terminalInput == null) {return;}
var i = Terminal.commandHistoryIndex;
var len = Terminal.commandHistory.length;
@@ -110,8 +153,10 @@ $(document).keydown(function(event) {
setTimeout(function(){terminalInput.selectionStart = terminalInput.selectionEnd = 10000; }, 0);
}
- //Down key
- if (event.keyCode == 40) {
+ if (event.keyCode === KEY.DOWNARROW ||
+ (FconfSettings.ENABLE_BASH_HOTKEYS && event.keyCode === KEY.M && event.ctrlKey)) {
+ if (FconfSettings.ENABLE_BASH_HOTKEYS) {event.preventDefault();}
+ //Cycle through past commands
if (terminalInput == null) {return;}
var i = Terminal.commandHistoryIndex;
var len = Terminal.commandHistory.length;
@@ -132,8 +177,8 @@ $(document).keydown(function(event) {
}
}
- //Tab (autocomplete)
- if (event.keyCode == 9) {
+ if (event.keyCode === KEY.TAB) {
+ //Autocomplete
if (terminalInput == null) {return;}
var input = terminalInput.value;
if (input == "") {return;}
@@ -163,6 +208,52 @@ $(document).keydown(function(event) {
tabCompletion(command, arg, allPos);
}
+
+ //Extra Bash Emulation Hotkeys, must be enabled through .fconf
+ if (FconfSettings.ENABLE_BASH_HOTKEYS) {
+ if (event.keyCode === KEY.A && event.ctrlKey) {
+ event.preventDefault();
+ Terminal.moveTextCursor("home");
+ }
+
+ if (event.keyCode === KEY.E && event.ctrlKey) {
+ event.preventDefault();
+ Terminal.moveTextCursor("end");
+ }
+
+ if (event.keyCode === KEY.B && event.ctrlKey) {
+ event.preventDefault();
+ Terminal.moveTextCursor("prevchar");
+ }
+
+ if (event.keyCode === KEY.B && event.altKey) {
+ event.preventDefault();
+ Terminal.moveTextCursor("prevword");
+ }
+
+ if (event.keyCode === KEY.F && event.ctrlKey) {
+ event.preventDefault();
+ Terminal.moveTextCursor("nextchar");
+ }
+
+ if (event.keyCode === KEY.F && event.altKey) {
+ event.preventDefault();
+ Terminal.moveTextCursor("nextword");
+ }
+
+
+ if ((event.keyCode === KEY.H || event.keyCode === KEY.D) && event.ctrlKey) {
+ Terminal.modifyInput("backspace");
+ event.preventDefault();
+ }
+
+ //TODO AFTER THIS:
+
+ //alt + d deletes word after cursor
+ //^w deletes word before cursor
+ //^k clears line after cursor
+ //^u clears line before cursor
+ }
}
});
@@ -344,8 +435,7 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) {
return allPos;
}
- if (input.startsWith("kill ") || input.startsWith("nano ") ||
- input.startsWith("tail ") ||
+ if (input.startsWith("kill ") || input.startsWith("tail ") ||
input.startsWith("mem ") || input.startsWith("check ")) {
//All Scripts
for (var i = 0; i < currServ.scripts.length; ++i) {
@@ -354,6 +444,18 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) {
return allPos;
}
+ if (input.startsWith("nano ")) {
+ //Scripts and text files and .fconf
+ for (var i = 0; i < currServ.scripts.length; ++i) {
+ allPos.push(currServ.scripts[i].filename);
+ }
+ for (var i = 0; i < currServ.textFiles.length; ++i) {
+ allPos.push(currServ.textFiles[i].fn);
+ }
+ allPos.push(".fconf");
+ return allPos;
+ }
+
if (input.startsWith("rm ")) {
for (var i = 0; i < currServ.scripts.length; ++i) {
allPos.push(currServ.scripts[i].filename);
@@ -420,23 +522,113 @@ let Terminal = {
commandHistory: [],
commandHistoryIndex: 0,
- finishAction: function(cancelled = false) {
- if (Terminal.hackFlag) {
- Terminal.finishHack(cancelled);
- } else if (Terminal.analyzeFlag) {
- Terminal.finishAnalyze(cancelled);
- }
- },
-
resetTerminalInput: function() {
document.getElementById("terminal-input-td").innerHTML =
"