From c93a398fbf130f11e88d74ea7ef3230deced756d Mon Sep 17 00:00:00 2001
From: danielyxie <danielyxie@gmail.com>
Date: Thu, 21 Sep 2017 16:27:31 -0500
Subject: [PATCH 1/6] Continue statement, began work on missions

---
 css/missions.css          |    90 +
 css/workinprogress.css    |     6 +-
 dist/bundle.js            | 15974 +++++++++++++++++++++++++++++++++++-
 index.html                |    12 +
 src/ActiveScriptsUI.js    |    69 +-
 src/Constants.js          |     8 +-
 src/Faction.js            |    42 +
 src/Missions.js           |   611 ++
 src/NetscriptEvaluator.js |    34 +-
 src/NetscriptFunctions.js |     6 +
 src/Script.js             |     2 -
 src/engine.js             |    11 +
 utils/HelperFunctions.js  |    10 +-
 13 files changed, 16497 insertions(+), 378 deletions(-)
 create mode 100644 css/missions.css
 create mode 100644 src/Missions.js

diff --git a/css/missions.css b/css/missions.css
new file mode 100644
index 000000000..5b1377185
--- /dev/null
+++ b/css/missions.css
@@ -0,0 +1,90 @@
+/* css for Missions */
+
+/* Hacking missions */
+
+.hack-mission-grid {
+    display: grid;
+    grid-template-columns: 7% 7% 7% 7% 7% 7% 7% 7%;
+    grid-template-rows: 7% 7% 7% 7% 7% 7% 7% 7%;
+    grid-gap: 3%;
+    height: 100%;
+    position:fixed;
+    width: 100%;
+}
+
+.hack-mission-node {
+    color:gray;
+    z-index:5;
+    background-color:gray;
+    align-self: center;
+    justify-self: center;
+}
+
+.hack-mission-node p {
+    color:white;
+    font-size:12px;
+    margin-top: 8px;
+    text-align:center;
+}
+
+.hack-mission-player-node {
+    color:blue;
+    background-color:blue;
+}
+
+.hack-mission-player-node:hover,
+.hack-mission-player-node-active {
+    border: 2px solid white;
+    color: #6666ff;
+    background-color: #6666ff;
+}
+
+.hack-mission-enemy-node {
+    color:red;
+    background-color:red;
+}
+
+.hack-mission-cpu-node {
+    width:100%;
+    height:100%;
+    -moz-border-radius: 50%;
+    -webkit-border-radius: 50%;
+    border-radius: 50%;
+}
+
+.hack-mission-firewall-node {
+    width:100%;
+    height:75%;
+}
+
+.hack-mission-database-node {
+    width: 100%;
+	height: 75%;
+	-webkit-transform: skew(20deg);
+	-moz-transform: skew(20deg);
+	-o-transform: skew(20deg);
+}
+
+.hack-mission-database-node p {
+    -webkit-transform: skew(-20deg);
+	-moz-transform: skew(-20deg);
+	-o-transform: skew(-20deg);
+}
+
+.hack-mission-spam-node,
+.hack-mission-transfer-node,
+.hack-mission-shield-node {
+    height:100%;
+    width: 100%;
+}
+
+/* Non-map related DOM elements */
+
+/* Element at the top of the Hacking Mission page (intro page, start button, guide buttons, etc.) */
+.hack-mission-header-element {
+    margin: 6px;
+}
+
+.hack-mission-action-buttons-container {
+    border: 2px solid white;
+}
diff --git a/css/workinprogress.css b/css/workinprogress.css
index ad3f94467..f4b6ed772 100644
--- a/css/workinprogress.css
+++ b/css/workinprogress.css
@@ -1,10 +1,6 @@
 /* Both Work in progress and BitNode stuff */
-#generic-fullscreen-container {
+.generic-fullscreen-container {
     color: var(--my-font-color);
-	padding-top: 10px;
-	padding-left: 10px;
-    margin: 10px;
-	height: 100%;
     width: 99%;
 }
 
diff --git a/dist/bundle.js b/dist/bundle.js
index 38b9db6ba..da06765b8 100644
--- a/dist/bundle.js
+++ b/dist/bundle.js
@@ -60,7 +60,7 @@
 /******/ 	__webpack_require__.p = "";
 /******/
 /******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(__webpack_require__.s = 4);
+/******/ 	return __webpack_require__(__webpack_require__.s = 5);
 /******/ })
 /************************************************************************/
 /******/ ([
@@ -76,7 +76,7 @@
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(14);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Crimes_js__ = __webpack_require__(37);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__engine_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Gang_js__ = __webpack_require__(30);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Location_js__ = __webpack_require__(12);
@@ -89,7 +89,7 @@
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_IPAddress_js__ = __webpack_require__(16);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 
 
 
@@ -2429,6 +2429,7 @@ function dialogBoxCreate(txt) {
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return compareArrays; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return printArray; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return powerOfTwo; });
+/* unused harmony export clearEventListenersEl */
 //General helper functions
 
 //Returns the size (number of keys) of an object
@@ -2461,6 +2462,14 @@ function clearEventListeners(elemId) {
     return newElem;
 }
 
+//Same as clearEventListeners except it takes a DOM element object rather than an ID
+function clearEventListenersEl(el) {
+    if (el == null) {console.log("ERR: element passed into clearEventListenersEl is null"); return null;}
+    var newElem = el.cloneNode(true);
+    el.parentNode.replaceChild(newElem, el);
+    return newElem;
+}
+
 function getRandomInt(min, max) {
     if (min > max) {return getRandomInt(max, min);}
     return Math.floor(Math.random() * (max - min + 1)) + min;
@@ -2624,6 +2633,7 @@ let CONSTANTS = {
     //Hacking Missions
     HackingMissionRepToDiffConversion: 5000, //Faction rep is divided by this to get mission difficulty
     HackingMissionRepToRewardConversion: 20, //Faction rep divided byt his to get mission rep reward
+    HackingMissionHowToPlay: "Hacking missions are a minigame that, if won, will reward you with factin reputation",
 
     //Gang constants
     GangRespectToReputationRatio: 2, //Respect is divided by this to get rep gain
@@ -3052,8 +3062,8 @@ let CONSTANTS = {
                            "<i>serverExists(hostname/ip)</i><br>Returns a boolean denoting whether or not the specified server exists. The argument " +
                            "must be a string with the hostname or IP of the target server.<br><br>" +
                            "<i>fileExists(filename, [hostname/ip])</i><br> Returns a boolean (true or false) indicating whether the specified file exists on a server. " +
-                           "The first argument must be a string with the name of the file. A file can either be a script or a program. A script name is case-sensitive, but a " +
-                           "program is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe. <br><br> " +
+                           "The first argument must be a string with the name of the file. A file can either be a script, program, or literature file. A script name is case-sensitive, but a " +
+                           "program/literature file is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe. <br><br> " +
                            "The second argument is a string with the hostname or IP of the server on which to search for the program. This second argument is optional. " +
                            "If it is omitted, then the function will search through the current server (the server running the script that calls this function) for the file. <br> " +
                            "Example: fileExists('foo.script', 'foodnstuff');<br>" +
@@ -3457,6 +3467,9 @@ let CONSTANTS = {
                                "World Stock Exchange account and TIX API Access<br>",
 
     LatestUpdate:
+    "v0.29.1<br>" +
+    "-Added continue statement for for/while loops<br>" +
+    "-fileExists() function now works on literature files<br><br>" +
     "v0.29.0<br>" +
     "-Added BitNode-5: Artificial Intelligence<br>" +
     "-Added getIp(), getIntelligence(), getHackingMultipliers(), and getBitNodeMultipliers() Netscript functions (requires Source-File 5)<br>" +
@@ -3480,6 +3493,166 @@ let CONSTANTS = {
 /* 4 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
+"use strict";
+/* unused harmony export getIndicesOf */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return convertTimeMsToTimeElapsedString; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return longestCommonStart; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isString; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isPositiveNumber; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return containsAllStrings; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return formatNumber; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return numOccurrences; });
+/* unused harmony export numNetscriptOperators */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isHTML; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__DialogBox_js__ = __webpack_require__(1);
+
+
+//Netburner String helper functions
+
+//Searches for every occurence of searchStr within str and returns an array of the indices of
+//all these occurences
+function getIndicesOf(searchStr, str, caseSensitive) {
+    var searchStrLen = searchStr.length;
+    if (searchStrLen == 0) {
+        return [];
+    }
+    var startIndex = 0, index, indices = [];
+    if (!caseSensitive) {
+        str = str.toLowerCase();
+        searchStr = searchStr.toLowerCase();
+    }
+    while ((index = str.indexOf(searchStr, startIndex)) > -1) {
+        indices.push(index);
+        startIndex = index + searchStrLen;
+    }
+    return indices;
+}
+
+//Replaces the character at an index with a new character
+String.prototype.replaceAt=function(index, character) {
+    return this.substr(0, index) + character + this.substr(index+character.length);
+}
+
+//Converts a date representing time in milliseconds to a string with the format
+//      H hours M minutes and S seconds
+// e.g. 10000 -> "0 hours 0 minutes and 10 seconds"
+//      120000 -> "0 0 hours 2 minutes and 0 seconds"
+function convertTimeMsToTimeElapsedString(time) {
+    //Convert ms to seconds, since we only have second-level precision
+    time = Math.floor(time / 1000);
+
+    var days = Math.floor(time / 86400);
+    time %= 86400;
+
+    var hours = Math.floor(time / 3600);
+    time %= 3600;
+
+    var minutes = Math.floor(time / 60);
+    time %= 60;
+
+    var seconds = time;
+
+    var res = "";
+    if (days) {res += days + " days ";}
+    if (hours) {res += hours + " hours ";}
+    if (minutes) {res += minutes + " minutes ";}
+    res += seconds + " seconds ";
+    return res;
+}
+
+//Finds the longest common starting substring in a set of strings
+function longestCommonStart(strings) {
+    if (!containsAllStrings(strings)) {return;}
+    if (strings.length == 0) {return;}
+
+    var A = strings.concat().sort(),
+    a1= A[0], a2= A[A.length-1], L= a1.length, i= 0;
+    while(i<L && a1.charAt(i).toLowerCase() === a2.charAt(i).toLowerCase()) i++;
+    return a1.substring(0, i);
+}
+
+
+//Returns whether a variable is a string
+function isString(str) {
+    return (typeof str === 'string' || str instanceof String);
+}
+
+//Returns true if string contains only digits (meaning it would be a positive number)
+function isPositiveNumber(str) {
+    return /^\d+$/.test(str);
+}
+
+//Returns whether an array contains entirely of string objects
+function containsAllStrings(arr) {
+    return arr.every(isString);
+}
+
+//Formats a number with commas and a specific number of decimal digits
+function formatNumber(num, numFractionDigits) {
+    return num.toLocaleString(undefined, {
+        minimumFractionDigits: numFractionDigits,
+        maximumFractionDigits: numFractionDigits
+    });
+}
+
+//Count the number of times a substring occurs in a string
+function numOccurrences(string, subString) {
+    string += "";
+    subString += "";
+    if (subString.length <= 0) return (string.length + 1);
+
+    var n = 0, pos = 0, step = subString.length;
+
+    while (true) {
+        pos = string.indexOf(subString, pos);
+        if (pos >= 0) {
+            ++n;
+            pos += step;
+        } else break;
+    }
+    return n;
+}
+
+//Counters the number of Netscript operators in a string
+function numNetscriptOperators(string) {
+    var total = 0;
+    total += numOccurrences(string, "+");
+    total += numOccurrences(string, "-");
+    total += numOccurrences(string, "*");
+    total += numOccurrences(string, "/");
+    total += numOccurrences(string, "%");
+    total += numOccurrences(string, "&&");
+    total += numOccurrences(string, "||");
+    total += numOccurrences(string, "<");
+    total += numOccurrences(string, ">");
+    total += numOccurrences(string, "<=");
+    total += numOccurrences(string, ">=");
+    total += numOccurrences(string, "==");
+    total += numOccurrences(string, "!=");
+    if (isNaN(total)) {
+        Object(__WEBPACK_IMPORTED_MODULE_0__DialogBox_js__["a" /* dialogBoxCreate */])("ERROR in counting number of operators in script. This is a bug, please report to game developer");
+        total = 0;
+    }
+    return total;
+}
+
+//Checks if a string contains HTML elements
+function isHTML(str) {
+    var a = document.createElement('div');
+    a.innerHTML = str;
+    for (var c = a.childNodes, i = c.length; i--; ) {
+        if (c[i].nodeType == 1) return true;
+    }
+    return false;
+}
+
+
+
+
+/***/ }),
+/* 5 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
 "use strict";
 Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
 /* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Engine", function() { return Engine; });
@@ -3488,7 +3661,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__ = __webpack_require__(36);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(27);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__ = __webpack_require__(23);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__ = __webpack_require__(17);
@@ -3508,7 +3681,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__Prestige_js__ = __webpack_require__(32);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__RedPill_js__ = __webpack_require__(43);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__SaveObject_js__ = __webpack_require__(66);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__SaveObject_js__ = __webpack_require__(68);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__Script_js__ = __webpack_require__(19);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__Settings_js__ = __webpack_require__(13);
@@ -3676,6 +3849,7 @@ let Engine = {
         locationContent:                null,
         workInProgressContent:          null,
         redPillContent:                 null,
+        missionContent:                 null,
 
         //Character info
         characterInfo:                  null,
@@ -3700,6 +3874,7 @@ let Engine = {
         Infiltration:       "Infiltration",
         StockMarket:        "StockMarket",
         Gang:               "Gang",
+        Mission:            "Mission",
     },
     currentPage:    null,
 
@@ -3883,7 +4058,13 @@ let Engine = {
             Engine.loadTerminalContent();
             Engine.currentPage = Engine.Page.Terminal;
         }
+    },
 
+    loadMissionContent: function() {
+        Engine.hideAllContent();
+        document.getElementById("mainmenu-container").style.visibility = "hidden";
+        document.getElementById("character-overview-wrapper").style.visibility = "hidden";
+        Engine.Display.missionContent.style.visibility = "visible";
     },
 
     //Helper function that hides all content
@@ -3905,6 +4086,7 @@ let Engine = {
         Engine.Display.redPillContent.style.visibility = "hidden";
         Engine.Display.infiltrationContent.style.visibility = "hidden";
         Engine.Display.stockMarketContent.style.visibility = "hidden";
+        Engine.Display.missionContent.style.visibility = "hidden";
         if (document.getElementById("gang-container")) {
             document.getElementById("gang-container").style.visibility = "hidden";
         }
@@ -4776,6 +4958,8 @@ let Engine = {
         Engine.Display.stockMarketContent = document.getElementById("stock-market-container");
         Engine.Display.stockMarketContent.style.visibility = "hidden";
 
+        Engine.Display.missionContent = document.getElementById("mission-container");
+        Engine.Display.missionContent.style.visibility = "hidden";
 
         //Character info
         Engine.Display.characterInfo = document.getElementById("character-info");
@@ -5145,166 +5329,6 @@ window.onload = function() {
 
 /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
 
-/***/ }),
-/* 5 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* unused harmony export getIndicesOf */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return convertTimeMsToTimeElapsedString; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return longestCommonStart; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isString; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isPositiveNumber; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return containsAllStrings; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return formatNumber; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return numOccurrences; });
-/* unused harmony export numNetscriptOperators */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isHTML; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__DialogBox_js__ = __webpack_require__(1);
-
-
-//Netburner String helper functions
-
-//Searches for every occurence of searchStr within str and returns an array of the indices of
-//all these occurences
-function getIndicesOf(searchStr, str, caseSensitive) {
-    var searchStrLen = searchStr.length;
-    if (searchStrLen == 0) {
-        return [];
-    }
-    var startIndex = 0, index, indices = [];
-    if (!caseSensitive) {
-        str = str.toLowerCase();
-        searchStr = searchStr.toLowerCase();
-    }
-    while ((index = str.indexOf(searchStr, startIndex)) > -1) {
-        indices.push(index);
-        startIndex = index + searchStrLen;
-    }
-    return indices;
-}
-
-//Replaces the character at an index with a new character
-String.prototype.replaceAt=function(index, character) {
-    return this.substr(0, index) + character + this.substr(index+character.length);
-}
-
-//Converts a date representing time in milliseconds to a string with the format
-//      H hours M minutes and S seconds
-// e.g. 10000 -> "0 hours 0 minutes and 10 seconds"
-//      120000 -> "0 0 hours 2 minutes and 0 seconds"
-function convertTimeMsToTimeElapsedString(time) {
-    //Convert ms to seconds, since we only have second-level precision
-    time = Math.floor(time / 1000);
-
-    var days = Math.floor(time / 86400);
-    time %= 86400;
-
-    var hours = Math.floor(time / 3600);
-    time %= 3600;
-
-    var minutes = Math.floor(time / 60);
-    time %= 60;
-
-    var seconds = time;
-
-    var res = "";
-    if (days) {res += days + " days ";}
-    if (hours) {res += hours + " hours ";}
-    if (minutes) {res += minutes + " minutes ";}
-    res += seconds + " seconds ";
-    return res;
-}
-
-//Finds the longest common starting substring in a set of strings
-function longestCommonStart(strings) {
-    if (!containsAllStrings(strings)) {return;}
-    if (strings.length == 0) {return;}
-
-    var A = strings.concat().sort(),
-    a1= A[0], a2= A[A.length-1], L= a1.length, i= 0;
-    while(i<L && a1.charAt(i).toLowerCase() === a2.charAt(i).toLowerCase()) i++;
-    return a1.substring(0, i);
-}
-
-
-//Returns whether a variable is a string
-function isString(str) {
-    return (typeof str === 'string' || str instanceof String);
-}
-
-//Returns true if string contains only digits (meaning it would be a positive number)
-function isPositiveNumber(str) {
-    return /^\d+$/.test(str);
-}
-
-//Returns whether an array contains entirely of string objects
-function containsAllStrings(arr) {
-    return arr.every(isString);
-}
-
-//Formats a number with commas and a specific number of decimal digits
-function formatNumber(num, numFractionDigits) {
-    return num.toLocaleString(undefined, {
-        minimumFractionDigits: numFractionDigits,
-        maximumFractionDigits: numFractionDigits
-    });
-}
-
-//Count the number of times a substring occurs in a string
-function numOccurrences(string, subString) {
-    string += "";
-    subString += "";
-    if (subString.length <= 0) return (string.length + 1);
-
-    var n = 0, pos = 0, step = subString.length;
-
-    while (true) {
-        pos = string.indexOf(subString, pos);
-        if (pos >= 0) {
-            ++n;
-            pos += step;
-        } else break;
-    }
-    return n;
-}
-
-//Counters the number of Netscript operators in a string
-function numNetscriptOperators(string) {
-    var total = 0;
-    total += numOccurrences(string, "+");
-    total += numOccurrences(string, "-");
-    total += numOccurrences(string, "*");
-    total += numOccurrences(string, "/");
-    total += numOccurrences(string, "%");
-    total += numOccurrences(string, "&&");
-    total += numOccurrences(string, "||");
-    total += numOccurrences(string, "<");
-    total += numOccurrences(string, ">");
-    total += numOccurrences(string, "<=");
-    total += numOccurrences(string, ">=");
-    total += numOccurrences(string, "==");
-    total += numOccurrences(string, "!=");
-    if (isNaN(total)) {
-        Object(__WEBPACK_IMPORTED_MODULE_0__DialogBox_js__["a" /* dialogBoxCreate */])("ERROR in counting number of operators in script. This is a bug, please report to game developer");
-        total = 0;
-    }
-    return total;
-}
-
-//Checks if a string contains HTML elements
-function isHTML(str) {
-    var a = document.createElement('div');
-    a.innerHTML = str;
-    for (var c = a.childNodes, i = c.length; i--; ) {
-        if (c[i].nodeType == 1) return true;
-    }
-    return false;
-}
-
-
-
-
 /***/ }),
 /* 6 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -16657,17 +16681,19 @@ function initBitNodeMultipliers() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(17);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__BitNode_js__ = __webpack_require__(9);
 /* 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_3__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__FactionInfo_js__ = __webpack_require__(46);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Location_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Settings_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_FactionInvitationBox_js__ = __webpack_require__(47);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__ = __webpack_require__(21);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Missions_js__ = __webpack_require__(47);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Settings_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_FactionInvitationBox_js__ = __webpack_require__(49);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_JSONReviver_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__ = __webpack_require__(21);
+
 
 
 
@@ -16690,10 +16716,10 @@ function factionInit() {
     $('#faction-donate-input').on('input', function() {
         if (__WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].Page.Faction) {
             var val = document.getElementById("faction-donate-input").value;
-            if (Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["e" /* isPositiveNumber */])(val)) {
+            if (Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["e" /* isPositiveNumber */])(val)) {
                 var numMoneyDonate = Number(val);
                 document.getElementById("faction-donate-rep-gain").innerHTML =
-                    "This donation will result in " + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(numMoneyDonate/1000000 * __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].faction_rep_mult, 3) + " reputation gain";
+                    "This donation will result in " + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(numMoneyDonate/1000000 * __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].faction_rep_mult, 3) + " reputation gain";
             } else {
                 document.getElementById("faction-donate-rep-gain").innerHTML =
                     "This donation will result in 0 reputation gain";
@@ -16774,20 +16800,20 @@ Faction.prototype.addAllAugmentations = function() {
 }
 
 Faction.prototype.toJSON = function() {
-	return Object(__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Faction", this);
+	return Object(__WEBPACK_IMPORTED_MODULE_12__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Faction", this);
 }
 
 Faction.fromJSON = function(value) {
-	return Object(__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Faction, value.data);
+	return Object(__WEBPACK_IMPORTED_MODULE_12__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Faction, value.data);
 }
 
-__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["c" /* Reviver */].constructors.Faction = Faction;
+__WEBPACK_IMPORTED_MODULE_12__utils_JSONReviver_js__["c" /* Reviver */].constructors.Faction = Faction;
 
 //Map of factions indexed by faction name
 let Factions = {}
 
 function loadFactions(saveString) {
-    Factions = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["c" /* Reviver */]);
+    Factions = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_12__utils_JSONReviver_js__["c" /* Reviver */]);
 }
 
 function AddToFactions(faction) {
@@ -17060,17 +17086,17 @@ function initFactions() {
 }
 
 function inviteToFaction(faction) {
-    if (__WEBPACK_IMPORTED_MODULE_7__Settings_js__["a" /* Settings */].SuppressFactionInvites) {
+    if (__WEBPACK_IMPORTED_MODULE_8__Settings_js__["a" /* Settings */].SuppressFactionInvites) {
         faction.alreadyInvited = true;
-        __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].factionInvitations.push(faction.name);
+        __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].factionInvitations.push(faction.name);
     } else {
-        Object(__WEBPACK_IMPORTED_MODULE_9__utils_FactionInvitationBox_js__["a" /* factionInvitationBoxCreate */])(faction);
+        Object(__WEBPACK_IMPORTED_MODULE_10__utils_FactionInvitationBox_js__["a" /* factionInvitationBoxCreate */])(faction);
     }
 }
 
 function joinFaction(faction) {
 	faction.isMember = true;
-    __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].factions.push(faction.name);
+    __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].factions.push(faction.name);
 
     //Determine what factions you are banned from now that you have joined this faction
     if (faction.name == "Chongqing") {
@@ -17112,68 +17138,78 @@ function displayFactionContent(factionName) {
     var repGain = faction.getFavorGain();
     if (repGain.length != 2) {repGain = 0;}
     repGain = repGain[0];
-    document.getElementById("faction-reputation").innerHTML = "Reputation: " + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(faction.playerReputation, 4) +
+    document.getElementById("faction-reputation").innerHTML = "Reputation: " + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(faction.playerReputation, 4) +
                                                               "<span class='tooltiptext'>You will earn " +
-                                                              Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(repGain, 4) +
+                                                              Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(repGain, 4) +
                                                               " faction favor upon resetting after installing an Augmentation</span>";
-    document.getElementById("faction-favor").innerHTML = "Faction Favor: " + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(faction.favor, 4) +
+    document.getElementById("faction-favor").innerHTML = "Faction Favor: " + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(faction.favor, 4) +
                                                          "<span class='tooltiptext'>Faction favor increases the rate at which " +
                                                          "you earn reputation for this faction by 1% per favor. Faction favor " +
                                                          "is gained whenever you reset after installing an Augmentation. The amount of " +
                                                          "favor you gain depends on how much reputation you have with the faction</span>";
 
+    var hackMissionDiv      = document.getElementById("faction-hack-mission-div");
 	var hackDiv 			= document.getElementById("faction-hack-div");
 	var fieldWorkDiv 		= document.getElementById("faction-fieldwork-div");
 	var securityWorkDiv 	= document.getElementById("faction-securitywork-div");
     var donateDiv           = document.getElementById("faction-donate-div");
     var gangDiv             = document.getElementById("faction-gang-div");
 
-    var newHackButton = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-hack-button");
-    var newFieldWorkButton = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-fieldwork-button");
-    var newSecurityWorkButton = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-securitywork-button");
-    var newDonateWorkButton = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-donate-button");
+    var newHackMissionButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-hack-mission-button");
+    var newHackButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-hack-button");
+    var newFieldWorkButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-fieldwork-button");
+    var newSecurityWorkButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-securitywork-button");
+    var newDonateWorkButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-donate-button");
+    newHackMissionButton.addEventListener("click", function() {
+        __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadMissionContent();
+        var mission = new __WEBPACK_IMPORTED_MODULE_6__Missions_js__["a" /* HackingMission */](faction.playerReputation, faction);
+        Object(__WEBPACK_IMPORTED_MODULE_6__Missions_js__["b" /* setInMission */])(true); //Sets inMission flag to true
+        mission.init();
+        return false;
+    });
+
     newHackButton.addEventListener("click", function() {
-        __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startFactionHackWork(faction);
+        __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].startFactionHackWork(faction);
         return false;
     });
 
     newFieldWorkButton.addEventListener("click", function() {
-        __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startFactionFieldWork(faction);
+        __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].startFactionFieldWork(faction);
         return false;
     });
 
     newSecurityWorkButton.addEventListener("click", function() {
-        __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startFactionSecurityWork(faction);
+        __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].startFactionSecurityWork(faction);
         return false;
     });
 
     newDonateWorkButton.addEventListener("click", function() {
         var donateAmountVal = document.getElementById("faction-donate-input").value;
-        if (Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["e" /* isPositiveNumber */])(donateAmountVal)) {
+        if (Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["e" /* isPositiveNumber */])(donateAmountVal)) {
             var numMoneyDonate = Number(donateAmountVal);
-            if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].money.lt(numMoneyDonate)) {
-                Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You cannot afford to donate this much money!");
+            if (__WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].money.lt(numMoneyDonate)) {
+                Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You cannot afford to donate this much money!");
                 return;
             }
-            __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].loseMoney(numMoneyDonate);
-            var repGain = numMoneyDonate / 1000000 * __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].faction_rep_mult;
+            __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].loseMoney(numMoneyDonate);
+            var repGain = numMoneyDonate / 1000000 * __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].faction_rep_mult;
             faction.playerReputation += repGain;
-            Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You just donated $" + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(numMoneyDonate, 2) + " to " +
-                            faction.name + " to gain " + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(repGain, 3) + " reputation");
+            Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You just donated $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(numMoneyDonate, 2) + " to " +
+                            faction.name + " to gain " + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(repGain, 3) + " reputation");
             displayFactionContent(factionName);
         } else {
-            Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid amount entered!");
+            Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid amount entered!");
         }
         return false;
     });
 
 
-    var newPurchaseAugmentationsButton = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-purchase-augmentations");
+    var newPurchaseAugmentationsButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-purchase-augmentations");
     newPurchaseAugmentationsButton.addEventListener("click", function() {
         __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].hideAllContent();
         __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].Display.factionAugmentationsContent.style.visibility = "visible";
 
-        var newBackButton = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-augmentations-back-button");
+        var newBackButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-augmentations-back-button");
         newBackButton.addEventListener("click", function() {
             __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadFactionContent();
             displayFactionContent(factionName);
@@ -17183,7 +17219,7 @@ function displayFactionContent(factionName) {
         return false;
     });
 
-    if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].bitNodeN == 2 && (factionName == "Slum Snakes" || factionName == "Tetrads" ||
+    if (__WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].bitNodeN == 2 && (factionName == "Slum Snakes" || factionName == "Tetrads" ||
         factionName == "The Syndicate" || factionName == "The Dark Army" || factionName == "Speakers for the Dead" ||
         factionName == "NiteSec" || factionName == "The Black Hand")) {
         //Set everything else to invisible
@@ -17194,7 +17230,7 @@ function displayFactionContent(factionName) {
 
         var gangDiv = document.getElementById("faction-gang-div");
 
-        if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].inGang() && __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].gang.facName != factionName) {
+        if (__WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].inGang() && __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].gang.facName != factionName) {
             //If the player has a gang but its not for this faction
             if (gangDiv) {
                 gangDiv.style.display = "none";
@@ -17223,29 +17259,29 @@ function displayFactionContent(factionName) {
                 descText.parentNode.insertBefore(gangDiv, descText.nextSibling);
             } else {
                 console.log("ERROR: faciton-work-description-text not found");
-                Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Error loading this page. This is a bug please report to game developer");
+                Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Error loading this page. This is a bug please report to game developer");
                 return;
             }
         }
         gangDiv.style.display = "inline";
 
-        var gangButton = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-gang-button");
+        var gangButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-gang-button");
         gangButton.addEventListener("click", function() {
-            if (!__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].inGang()) {
-                var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
+            if (!__WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].inGang()) {
+                var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
                 yesBtn.innerHTML = "Create Gang";
                 noBtn.innerHTML = "Cancel";
                 yesBtn.addEventListener("click", () => {
                     var hacking = false;
                     if (factionName === "NiteSec" || factionName === "The Black Hand") {hacking = true;}
-                    __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startGang(factionName, hacking);
+                    __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].startGang(factionName, hacking);
                     __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadGangContent();
-                    Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+                    Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
                 });
                 noBtn.addEventListener("click", () => {
-                    Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+                    Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
                 });
-                Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("Would you like to create a new Gang with " + factionName + "?<br><br>" +
+                Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("Would you like to create a new Gang with " + factionName + "?<br><br>" +
                                "Note that this will prevent you from creating a Gang with any other Faction until " +
                                "this BitNode is destroyed. There are NO differences between the Factions you can " +
                                "create a Gang with and each of these Factions have all Augmentations available");
@@ -17269,156 +17305,187 @@ function displayFactionContent(factionName) {
 
 		switch(faction.name) {
 			case "Illuminati":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "Daedalus":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "The Covenant":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "ECorp":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "MegaCorp":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Bachman & Associates":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Blade Industries":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "NWO":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Clarke Incorporated":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "OmniTek Incorporated":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Four Sigma":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "KuaiGong International":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
             case "Fulcrum Secret Technologies":
+                hackMissionDiv.style.display = "inline";
                 hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "none";
 				securityWorkDiv.style.display = "inline";
                 break;
 			case "BitRunners":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "none";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "The Black Hand":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "NiteSec":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "none";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "Chongqing":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Sector-12":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "New Tokyo":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Aevum":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Ishima":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Volhaven":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Speakers for the Dead":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "The Dark Army":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "The Syndicate":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
             case "Silhouette":
+                hackMissionDiv.style.display = "inline";
                 hackDiv.style.display = "inline";
                 fieldWorkDiv.style.display = "inline";
                 securityWorkDiv.style.display = "none";
                 break;
             case "Tetrads":
+                hackMissionDiv.style.display = "none";
                 hackDiv.style.display = "none";
                 fieldWorkDiv.style.display = "inline";
                 securityWorkDiv.style.display = "inline";
                 break;
             case "Slum Snakes":
+                hackMissionDiv.style.display = "none";
                 hackDiv.style.display = "none";
                 fieldWorkDiv.style.display = "inline";
                 securityWorkDiv.style.display = "inline";
                 break;
             case "Netburners":
+                hackMissionDiv.style.display = "inline";
                 hackDiv.style.display = "inline";
                 fieldWorkDiv.style.display = "none";
                 securityWorkDiv.style.display = "none";
                 break;
 			case "Tian Di Hui":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "none";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "CyberSec":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "none";
 				securityWorkDiv.style.display = "none";
@@ -17452,13 +17519,13 @@ function displayFactionAugmentations(factionName) {
                 return;
             }
             var owned = false;
-            for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].queuedAugmentations.length; ++j) {
-                if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].queuedAugmentations[j].name == aug.name) {
+            for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].queuedAugmentations.length; ++j) {
+                if (__WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].queuedAugmentations[j].name == aug.name) {
                     owned = true;
                 }
             }
-            for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].augmentations.length; ++j) {
-                if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].augmentations[j].name == aug.name) {
+            for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].augmentations.length; ++j) {
+                if (__WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].augmentations[j].name == aug.name) {
                     owned = true;
                 }
             }
@@ -17475,10 +17542,10 @@ function displayFactionAugmentations(factionName) {
                 pElem.innerHTML = "ALREADY OWNED";
             } else if (faction.playerReputation >= req) {
                 aElem.setAttribute("class", "a-link-button");
-                pElem.innerHTML = "UNLOCKED - $" + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(aug.baseCost * faction.augmentationPriceMult, 2);
+                pElem.innerHTML = "UNLOCKED - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(aug.baseCost * faction.augmentationPriceMult, 2);
             } else {
                 aElem.setAttribute("class", "a-link-button-inactive");
-                pElem.innerHTML = "LOCKED (Requires " + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(req, 1) + " faction reputation) - $" + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(aug.baseCost * faction.augmentationPriceMult, 2);
+                pElem.innerHTML = "LOCKED (Requires " + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(req, 1) + " faction reputation) - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(aug.baseCost * faction.augmentationPriceMult, 2);
                 pElem.style.color = "red";
             }
             aElem.style.display = "inline";
@@ -17509,77 +17576,77 @@ function displayFactionAugmentations(factionName) {
 }
 
 function purchaseAugmentationBoxCreate(aug, fac) {
-    var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
+    var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
     yesBtn.innerHTML = "Purchase";
     noBtn.innerHTML = "Cancel";
     yesBtn.addEventListener("click", function() {
         purchaseAugmentation(aug, fac);
     });
     noBtn.addEventListener("click", function() {
-        Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+        Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
     });
 
-    Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("<h2>" + aug.name + "</h2><br>" +
+    Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("<h2>" + aug.name + "</h2><br>" +
                    aug.info + "<br><br>" +
                    "<br>Would you like to purchase the " + aug.name + " Augmentation for $" +
-                   Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(aug.baseCost * fac.augmentationPriceMult, 2)  + "?");
+                   Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(aug.baseCost * fac.augmentationPriceMult, 2)  + "?");
 }
 
 function purchaseAugmentation(aug, fac, sing=false) {
     if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].Targeting2 &&
         __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].Targeting1].owned == false) {
         var txt = "You must first install Augmented Targeting I before you can upgrade it to Augmented Targeting II";
-        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
     } else if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].Targeting3 &&
                __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].Targeting2].owned == false) {
         var txt = "You must first install Augmented Targeting II before you can upgrade it to Augmented Targeting III";
-        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
     } else if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].CombatRib2 &&
                __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].CombatRib1].owned == false) {
         var txt = "You must first install Combat Rib I before you can upgrade it to Combat Rib II";
-        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
     } else if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].CombatRib3 &&
                __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].CombatRib2].owned == false) {
         var txt = "You must first install Combat Rib II before you can upgrade it to Combat Rib III";
-        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
     } else if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].GrapheneBionicSpine &&
                __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].BionicSpine].owned == false) {
         var txt = "You must first install a Bionic Spine before you can upgrade it to a Graphene Bionic Spine";
-        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
     } else if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].GrapheneBionicLegs &&
                __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].BionicLegs].owned == false) {
         var txt = "You must first install Bionic Legs before you can upgrade it to Graphene Bionic Legs";
-        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
     } else if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].ENMCoreV2 &&
                __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].ENMCore].owned == false) {
         var txt = "You must first install Embedded Netburner Module Core Implant before you can upgrade it to V2";
-        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
     } else if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].ENMCoreV3 &&
                __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].ENMCoreV2].owned == false) {
         var txt = "You must first install Embedded Netburner Module Core V2 Upgrade before you can upgrade it to V3";
-        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
     } else if ((aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].ENMCore ||
                aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].ENMAnalyzeEngine ||
                aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].ENMDMA) &&
                __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].ENM].owned == false) {
        var txt = "You must first install the Embedded Netburner Module before installing any upgrades to it";
-       if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+       if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
     } else if ((aug.name ==  __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].PCDNIOptimizer ||
                aug.name ==  __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].PCDNINeuralNetwork) &&
                __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].PCDNI].owned == false) {
         var txt = "You must first install the Pc Direct-Neural Interface before installing this upgrade";
-        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
     } else if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].GrapheneBrachiBlades &&
                __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].BrachiBlades].owned == false) {
         var txt = "You must first install the Brachi Blades augmentation before installing this upgrade";
-        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
     } else if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].GrapheneBionicArms &&
                __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].BionicArms].owned == false) {
         var txt = "You must first install the Bionic Arms augmentation before installing this upgrade";
-        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
-    } else if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].money.gte(aug.baseCost * fac.augmentationPriceMult)) {
-        if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].firstAugPurchased === false) {
-            __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].firstAugPurchased = true;
+        if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+    } else if (__WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].money.gte(aug.baseCost * fac.augmentationPriceMult)) {
+        if (__WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].firstAugPurchased === false) {
+            __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].firstAugPurchased = true;
             document.getElementById("augmentations-tab").style.display = "list-item";
             document.getElementById("character-menu-header").click();
             document.getElementById("character-menu-header").click();
@@ -17589,9 +17656,9 @@ function purchaseAugmentation(aug, fac, sing=false) {
         if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
             queuedAugmentation.level = getNextNeurofluxLevel();
         }
-        __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].queuedAugmentations.push(queuedAugmentation);
+        __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].queuedAugmentations.push(queuedAugmentation);
 
-        __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].loseMoney((aug.baseCost * fac.augmentationPriceMult));
+        __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].loseMoney((aug.baseCost * fac.augmentationPriceMult));
 
         //If you just purchased Neuroflux Governor, recalculate the cost
         if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
@@ -17600,7 +17667,7 @@ function purchaseAugmentation(aug, fac, sing=false) {
             var mult = Math.pow(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].NeuroFluxGovernorLevelMult, nextLevel);
             aug.setRequirements(500 * mult, 750000 * mult);
 
-            for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].queuedAugmentations.length-1; ++i) {
+            for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].queuedAugmentations.length-1; ++i) {
                 aug.baseCost *= __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MultipleAugMultiplier;
             }
         }
@@ -17614,7 +17681,7 @@ function purchaseAugmentation(aug, fac, sing=false) {
         if (sing) {
             return "You purchased " + aug.name;
         } else {
-            Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You purchased "  + aug.name + ". It's enhancements will not take " +
+            Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You purchased "  + aug.name + ". It's enhancements will not take " +
                             "effect until they are installed. To install your augmentations, go to the " +
                             "'Augmentations' tab on the left-hand navigation menu. Purchasing additional " +
                             "augmentations will now be more expensive.");
@@ -17625,18 +17692,18 @@ function purchaseAugmentation(aug, fac, sing=false) {
         if (sing) {
             return "You don't have enough money to purchase " + aug.name;
         } else {
-            Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough money to purchase this Augmentation!");
+            Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough money to purchase this Augmentation!");
         }
     }
-    Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+    Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
 }
 
 function getNextNeurofluxLevel() {
     var aug = __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor];
     if (aug == null) {
-        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].augmentations.length; ++i) {
-            if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].augmentations[i].name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
-                aug = __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].augmentations[i];
+        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].augmentations.length; ++i) {
+            if (__WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].augmentations[i].name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
+                aug = __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].augmentations[i];
             }
         }
         if (aug == null) {
@@ -17645,8 +17712,8 @@ function getNextNeurofluxLevel() {
         }
     }
     var nextLevel = aug.level + 1;
-    for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].queuedAugmentations.length; ++i) {
-        if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].queuedAugmentations[i].name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
+    for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].queuedAugmentations.length; ++i) {
+        if (__WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].queuedAugmentations[i].name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
             ++nextLevel;
         }
     }
@@ -17654,7 +17721,7 @@ function getNextNeurofluxLevel() {
 }
 
 function processPassiveFactionRepGain(numCycles) {
-    var numTimesGain = (numCycles / 600) * __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].faction_rep_mult;
+    var numTimesGain = (numCycles / 600) * __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].faction_rep_mult;
     for (var name in Factions) {
 		if (Factions.hasOwnProperty(name)) {
 			var faction = Factions[name];
@@ -17744,16 +17811,16 @@ function initSpecialServerIps() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Company_js__ = __webpack_require__(18);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Crimes_js__ = __webpack_require__(37);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Infiltration_js__ = __webpack_require__(44);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__ServerPurchases_js__ = __webpack_require__(63);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__ServerPurchases_js__ = __webpack_require__(65);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__SpecialServerIps_js__ = __webpack_require__(11);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(1);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_IPAddress_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__ = __webpack_require__(21);
 
 
@@ -20089,12 +20156,12 @@ function initCreateProgramButtons() {
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return prestigeWorkerScripts; });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(23);
 /* 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_2__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(28);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(33);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__ = __webpack_require__(65);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__ = __webpack_require__(67);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__ = __webpack_require__(1);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(2);
@@ -23508,7 +23575,7 @@ function getJobRequirementText(company, pos, tooltiptext=false) {
 /* 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 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_1__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__InteractiveTutorial_js__ = __webpack_require__(24);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptWorker_js__ = __webpack_require__(15);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Player_js__ = __webpack_require__(0);
@@ -23517,10 +23584,8 @@ function getJobRequirementText(company, pos, tooltiptext=false) {
 /* 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__(7);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-var ace = __webpack_require__(48);
-__webpack_require__(51);
-__webpack_require__(52);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+var ace = __webpack_require__(50);
 __webpack_require__(53);
 __webpack_require__(54);
 __webpack_require__(55);
@@ -23531,8 +23596,8 @@ __webpack_require__(59);
 __webpack_require__(60);
 __webpack_require__(61);
 __webpack_require__(62);
-
-
+__webpack_require__(63);
+__webpack_require__(64);
 
 
 
@@ -24137,8 +24202,8 @@ __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].construct
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__ = __webpack_require__(14);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__ = __webpack_require__(41);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__HelpText_js__ = __webpack_require__(64);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__HelpText_js__ = __webpack_require__(66);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__ = __webpack_require__(24);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Literature_js__ = __webpack_require__(42);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(22);
@@ -24149,7 +24214,7 @@ __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].construct
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Script_js__ = __webpack_require__(19);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_LogBox_js__ = __webpack_require__(27);
 
@@ -26143,7 +26208,7 @@ function initMessages()  {
 /* 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);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_LogBox_js__ = __webpack_require__(27);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 
 
 
@@ -26344,45 +26409,26 @@ function updateActiveScriptsItemContent(workerscript) {
     var itemName = itemNameArray.join("-");
     var itemContent = document.getElementById(itemName + "-content")
 
-    //Clear the item
-    while (itemContent.firstChild) {
-        itemContent.removeChild(itemContent.firstChild);
-    }
-
     //Add the updated text back. Returns the total online production rate
-    return createActiveScriptsText(workerscript, itemContent);
+    return updateActiveScriptsText(workerscript, itemContent);
 }
 
 function createActiveScriptsText(workerscript, item) {
-    var itemText = document.createElement("p");
+    var itemTextHeader = document.createElement("p");
+    var itemTextStats = document.createElement("p");
+    var itemId = item.id;
+    itemTextStats.setAttribute("id", itemId + "-stats");
 
     //Server ip/hostname
     var threads = "Threads: " + workerscript.scriptRef.threads;
     var args = "Args: " + Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["f" /* printArray */])(workerscript.args);
 
-    //Online
-    var onlineTotalMoneyMade = "Total online production: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineMoneyMade, 2);
-    var onlineTotalExpEarned = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
+    itemTextHeader.innerHTML = threads + "<br>" + args + "<br>";
 
-    var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
-    var onlineMpsText = "Online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineMps, 2) + "/second";
-    var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
-    var onlineEpsText = (Array(25).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineEps, 4) + " hacking exp/second").replace( / /g, "&nbsp;");
+    item.appendChild(itemTextHeader);
+    item.appendChild(itemTextStats);
 
-    //Offline
-    var offlineTotalMoneyMade = "Total offline production: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineMoneyMade, 2);
-    var offlineTotalExpEarned = (Array(27).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
-
-    var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
-    var offlineMpsText = "Offline production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineMps, 2) + "/second";
-    var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
-    var offlineEpsText = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineEps, 4) +  " hacking exp/second").replace( / /g, "&nbsp;");
-
-    itemText.innerHTML = threads + "<br>" + args + "<br>" + onlineTotalMoneyMade + "<br>" + onlineTotalExpEarned + "<br>" +
-                         onlineMpsText + "<br>" + onlineEpsText + "<br>" + offlineTotalMoneyMade + "<br>" + offlineTotalExpEarned + "<br>" +
-                         offlineMpsText + "<br>" + offlineEpsText + "<br>";
-
-    item.appendChild(itemText);
+    var onlineMps = updateActiveScriptsText(workerscript, item, itemTextStats);
 
     var logButton = document.createElement("span");
     logButton.innerHTML = "Log";
@@ -26406,6 +26452,38 @@ function createActiveScriptsText(workerscript, item) {
     return onlineMps;
 }
 
+function updateActiveScriptsText(workerscript, item, statsEl=null) {
+    var itemId = item.id
+    var itemTextStats = document.getElementById(itemId + "-stats");
+    if (itemTextStats === null || itemTextStats === undefined) {
+        itemTextStats = statsEl;
+    }
+
+    //Updates statistics only
+    //Online
+    var onlineTotalMoneyMade = "Total online production: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineMoneyMade, 2);
+    var onlineTotalExpEarned = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
+
+    var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
+    var onlineMpsText = "Online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineMps, 2) + "/second";
+    var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
+    var onlineEpsText = (Array(25).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineEps, 4) + " hacking exp/second").replace( / /g, "&nbsp;");
+
+    //Offline
+    var offlineTotalMoneyMade = "Total offline production: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineMoneyMade, 2);
+    var offlineTotalExpEarned = (Array(27).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
+
+    var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
+    var offlineMpsText = "Offline production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineMps, 2) + "/second";
+    var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
+    var offlineEpsText = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineEps, 4) +  " hacking exp/second").replace( / /g, "&nbsp;");
+
+    itemTextStats.innerHTML = onlineTotalMoneyMade + "<br>" + onlineTotalExpEarned + "<br>" +
+                              onlineMpsText + "<br>" + onlineEpsText + "<br>" + offlineTotalMoneyMade + "<br>" + offlineTotalExpEarned + "<br>" +
+                              offlineMpsText + "<br>" + offlineEpsText + "<br>";
+    return onlineMps;
+}
+
 
 
 
@@ -26420,7 +26498,7 @@ function createActiveScriptsText(workerscript, item) {
 /* 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_0__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__ = __webpack_require__(1);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(2);
 
@@ -31925,13 +32003,13 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v7.2.3 https://github.com/MikeM
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return loadStockMarket; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return setStockMarketContentCreated; });
 /* 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_1__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Location_js__ = __webpack_require__(12);
 /* 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_JSONReviver_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 
 
 
@@ -32735,7 +32813,7 @@ Environment.prototype = {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__ = __webpack_require__(14);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__ = __webpack_require__(41);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__engine_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__HacknetNode_js__ = __webpack_require__(34);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Location_js__ = __webpack_require__(12);
@@ -32755,7 +32833,7 @@ Environment.prototype = {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__utils_DialogBox_js__ = __webpack_require__(1);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__utils_IPAddress_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 
 
 
@@ -33513,6 +33591,12 @@ function NetscriptFunctions(workerScript) {
                     return true;
                 }
             }
+            for (var i = 0; i < server.messages.length; ++i) {
+                if (!(server.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_11__Message_js__["a" /* Message */]) &&
+                    filename.toLowerCase() === server.messages[i]) {
+                    return true;
+                }
+            }
             return false;
         },
         isRunning : function(filename,ip){
@@ -34702,7 +34786,7 @@ function NetscriptFunctions(workerScript) {
 /* 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_1__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Location_js__ = __webpack_require__(12);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Player_js__ = __webpack_require__(0);
@@ -34711,7 +34795,7 @@ function NetscriptFunctions(workerScript) {
 /* 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__(36);
 /* 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_9__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__ = __webpack_require__(21);
 
 
@@ -36166,7 +36250,7 @@ function applySourceFile(srcFile) {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__BitNode_js__ = __webpack_require__(9);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(18);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Location_js__ = __webpack_require__(12);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(22);
@@ -36428,7 +36512,7 @@ function prestigeSourceFile() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Script_js__ = __webpack_require__(19);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_IPAddress_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 
 
 
@@ -36631,6 +36715,9 @@ function evaluate(exp, workerScript) {
             case "BreakStatement":
                 reject("BREAKSTATEMENT");
                 break;
+            case "ContinueStatement":
+                reject("CONTINUESTATEMENT");
+                break;
             case "IfStatement":
                 evaluateIf(exp, workerScript).then(function(forLoopRes) {
                     resolve("forLoopDone");
@@ -36954,7 +37041,23 @@ function evaluateFor(exp, workerScript) {
 						reject(e);
 					});
 				}, function(e) {
-					reject(e);
+                    if (e == "CONTINUESTATEMENT" ||
+                       (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "CONTINUESTATEMENT")) {
+                        //Continue statement, recurse to next iteration
+                        var pUpdate = evaluate(exp.update, workerScript);
+       					pUpdate.then(function(resPostloop) {
+       						var recursiveCall = evaluateFor(exp, workerScript);
+       						recursiveCall.then(function(foo) {
+       							resolve("endForLoop");
+       						}, function(e) {
+       							reject(e);
+       						});
+       					}, function(e) {
+       						reject(e);
+       					});
+                    } else {
+                        reject(e);
+                    }
 				});
 			} else {
 				resolve("endForLoop");	//Doesn't need to resolve to any particular value
@@ -36991,7 +37094,18 @@ function evaluateWhile(exp, workerScript) {
 						evaluatePromise.then(function(resCode) {
 							resolve(resCode);
 						}, function(e) {
-                            reject(e);
+                            if (e == "CONTINUESTATEMENT" ||
+                               (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "CONTINUESTATEMENT")) {
+                                //Continue statement, recurse
+                                var recursiveCall = evaluateWhile(exp, workerScript);
+            					recursiveCall.then(function(foo) {
+            						resolve("endWhileLoop");
+            					}, function(e) {
+            						reject(e);
+            					});
+                            } else {
+                                reject(e);
+                            }
 						});
 					}, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].CodeInstructionRunTime);
 				});
@@ -37233,13 +37347,13 @@ function scriptCalculateWeakenTime(server) {
 /* unused harmony export getHacknetNode */
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(9);
 /* 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_2__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__InteractiveTutorial_js__ = __webpack_require__(24);
 /* 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);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 
 
 
@@ -38228,7 +38342,7 @@ function substituteAliases(origCommand) {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__ = __webpack_require__(11);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Terminal_js__ = __webpack_require__(20);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 
 
 
@@ -38769,7 +38883,7 @@ function initLiterature() {
 /* 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__(9);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(32);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(31);
@@ -39107,12 +39221,12 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) {
 "use strict";
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return beginInfiltration; });
 /* 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_1__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
 /* 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_InfiltrationBox_js__ = __webpack_require__(45);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 
 
 
@@ -39939,7 +40053,7 @@ function getInfiltrationEscapeChance(inst) {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DialogBox_js__ = __webpack_require__(1);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__ = __webpack_require__(4);
 
 
 
@@ -40194,6 +40308,15190 @@ let FactionInfo = {
 /* 47 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HackingMission; });
+/* unused harmony export inMission */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return setInMission; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
+/* 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);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_jsplumb__ = __webpack_require__(48);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_jsplumb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_jsplumb__);
+
+
+
+
+
+
+
+let inMission = false; //Flag to denote whether a mission is running
+function setInMission(bool) {
+    inMission = bool;
+}
+/* Hacking Missions */
+
+/*You start with N CPU nodes dependent on home computer cores
+
+Three main stats:
+    Attack - Specific to a node. Affected by hacking skill, RAM (for home comp)
+    Defense - Universal defense - summed from all nodes
+    HP - Specific to a node. Affected by hacking skill, RAM (for home comp)
+
+Enemy has the following nodes:
+    Firewall Nodes - Essentially shields. Weak attack but large def
+    CPU Nodes - Defeating and capturing these will give you new nodes to use
+    Database Node - Main Target
+
+Misc Nodes (initially not owned by player or enemy):
+    Spam nodes - Increases time limit
+    Transfer Nodes - Slightly increases attack for all of your CPUs
+    Shield Node - Increases your defense
+
+Shapes for nodes:
+    Firewall - Rectangle
+    CPU - Circle
+    Database - Parralelogram
+    Spam - Diamond
+    Transfer - Cone
+    Shield - Shield shape
+
+*/
+let NodeTypes = {
+    Core: "CPU Core Node",      //All actions available
+    Firewall: "Firewall Node",  //No actions available
+    Database: "Database Node",  //No actions available
+    Spam: "Spam Node",          //No actions Available
+    Transfer: "Transfer Node",  //Can Soften, Scan, and Overflow
+    Shield: "Shield Node"       //Can Fortify
+}
+
+let NodeActions = {
+    Attack: "Attack", //Damaged based on attack stat + hacking level + opp def
+    Scan: "Scan", //-Def for target, affected by hacking level
+    Soften: "Soften", //-Attack for target, affected by hacking level
+    Fortify: "Fortify", //+Defense for Node, affected by hacking level
+    Overflow: "Overflow", //+Attack but -Defense for Node, affected by hacking level
+}
+
+function Node(type, stats) {
+    this.type = type;
+    this.atk = stats.atk ? stats.atk : 0;
+    this.def = stats.def ? stats.def : 0;
+    this.hp = stats.hp ? stats.hp : 0;
+    this.maxhp = this.hp;
+    this.plyrCtrl = false;
+    this.enmyCtrl = false;
+    this.pos = [0, 0]; //x, y
+    this.el = null; //Holds the Node's DOM element
+    this.action = null;
+}
+
+Node.prototype.setPosition = function(x, y) {
+    this.pos = [x, y];
+}
+
+Node.prototype.setControlledByPlayer = function() {
+    this.plyrCtrl = true;
+    this.enmyCtrl = false;
+    if (this.el) {
+        this.classList.remove("hack-mission-enemy-node");
+        this.classList.add("hack-mission-player-node");
+    }
+}
+
+Node.prototype.setControlledByEnemy = function() {
+    this.plyrCtrl = false;
+    this.enmyCtrl = true;
+    if (this.el) {
+        this.classList.remove("hack-mission-player-node");
+        this.classList.add("hack-mission-enemy-node");
+    }
+}
+
+//Sets this node to be the active node
+Node.prototype.select = function(actionButtons) {
+    if (this.enmyCtrl) {return;}
+    this.el.classList.add("hack-mission-player-node-active");
+
+    //Make all buttons inactive
+    for (var i = 0; i < actionButtons.length; ++i) {
+        actionButtons[i].classList.remove("a-link-button");
+        actionButtons[i].classList.add("a-link-button-inactive");
+    }
+
+    switch(this.type) {
+        case NodeTypes.Core:
+            //All buttons active
+            for (var i = 0; i < actionButtons.length; ++i) {
+                actionButtons[i].classList.remove("a-link-button-inactive");
+                actionButtons[i].classList.add("a-link-button");
+            }
+            break;
+        case NodeTypes.Transfer:
+            actionButtons[1].classList.remove("a-link-button-inactive");
+            actionButtons[1].classList.add("a-link-button");
+            actionButtons[2].classList.remove("a-link-button-inactive");
+            actionButtons[2].classList.add("a-link-button");
+            actionButtons[4].classList.remove("a-link-button-inactive");
+            actionButtons[4].classList.add("a-link-button");
+            break;
+        default:
+            break;
+    }
+}
+
+Node.prototype.deselect = function(actionButtons) {
+    this.el.classList.remove("active");
+    for (var i = 0; i < actionButtons.length; ++i) {
+        actionButtons[i].classList.remove("a-link-button");
+        actionButtons[i].classList.add("a-link-button-inactive");
+    }
+}
+
+//Hacking mission instance
+//Takes in the reputation of the Faction for which the mission is
+//being conducted
+function HackingMission(rep, fac) {
+    this.faction = fac;
+
+    this.playerCores = [];
+    this.playerNodes = []; //Non-core nodes
+    this.playerDef = 0;
+
+    this.enemyCores = [];
+    this.enemyDatabases = [];
+    this.enemyNodes = []; //Non-core nodes
+    this.enemyDef = 0;
+
+    this.miscNodes = [];
+
+    this.selectedNode = null; //Which of the player's nodes is currently selected
+
+    this.actionButtons = []; //DOM buttons for actions
+
+    this.availablePositions = [];
+    for (var r = 0; r < 8; ++r) {
+        for (var c = 0; c < 8; ++c) {
+            this.availablePositions.push([r, c]);
+        }
+    }
+
+    //this.map = Array(8).fill(Array(8).fill(null)); //8x8 2d array of references to Nodes
+    this.map = [];
+    for (var i = 0; i < 8; ++i) {
+        this.map.push([null, null, null, null, null, null, null, null]);
+    }
+
+    //difficulty capped at 16
+    this.difficulty = Math.min(16, Math.round(rep / __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToDiffConversion) + 1);
+    console.log("difficulty: " + this.difficulty);
+    this.reward = 200 + (rep / __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToRewardConversion);
+}
+
+HackingMission.prototype.init = function() {
+    //Create Header DOM
+    this.createPageDom();
+
+    //Create player starting nodes
+    var home = __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].getHomeComputer()
+    for (var i = 0; i < home.cpuCores; ++i) {
+        var stats = {
+            atk: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 10) * (home.maxRam / 8),
+            def: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 20) * (home.maxRam / 2),
+            hp: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 5) * (home.maxRam / 4),
+        };
+        this.playerCores.push(new Node(NodeTypes.Core, stats));
+        this.playerCores[i].setControlledByPlayer();
+        this.setNodePosition(this.playerCores[i], 0, i);
+        this.removeAvailablePosition(0, i);
+    }
+
+    //Randomly generate enemy nodes (CPU and Firewall) based on difficulty
+    var numNodes = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 2);
+    var numFirewalls = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 5);
+    var numDatabases = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 1);
+    var totalNodes = numNodes + numFirewalls + numDatabases;
+    var xlimit = 7 - Math.floor(totalNodes / 8);
+    console.log("numNodes: " + numNodes);
+    console.log("numFirewalls: " + numFirewalls);
+    console.log("numDatabases: " + numDatabases);
+    console.log("totalNodes: " + totalNodes);
+    console.log("xlimit: " + xlimit);
+    var randMult = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
+    for (var i = 0; i < numNodes; ++i) {
+        var stats = {
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(400, 750),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(400, 750),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(800, 1200)
+        }
+        this.enemyCores.push(new Node(NodeTypes.Core, stats));
+        this.enemyCores[i].setControlledByEnemy();
+        this.setNodeRandomPosition(this.enemyCores[i], xlimit);
+    }
+    for (var i = 0; i < numFirewalls; ++i) {
+        var stats = {
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(100, 400),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 2500),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 2000)
+        }
+        this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));
+        this.enemyNodes[i].setControlledByEnemy();
+        this.setNodeRandomPosition(this.enemyNodes[i], xlimit);
+    }
+    for (var i = 0; i < numDatabases; ++i) {
+        var stats = {
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(100, 200),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 1500),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 2000)
+        }
+        var node = new Node(NodeTypes.Database, stats);
+        node.setControlledByEnemy();
+        this.setNodeRandomPosition(node, xlimit);
+        this.enemyDatabases.push(node);
+    }
+    this.calculateDefenses();
+    this.createMap();
+}
+
+HackingMission.prototype.createPageDom = function() {
+    var container = document.getElementById("mission-container");
+
+    var headerText = document.createElement("p");
+    headerText.innerHTML = "You are about to start a hacking mission! For more information " +
+                    "about how hacking missions work, click one of the guide links " +
+                    "below (one opens up an in-game guide and the other opens up " +
+                    "the guide from the wiki). Click the 'Start' button to begin.";
+    headerText.style.display = "block";
+    headerText.classList.add("hack-mission-header-element");
+    headerText.style.width = "80%";
+
+    var inGameGuideBtn = document.createElement("a");
+    inGameGuideBtn.innerText = "How to Play";
+    inGameGuideBtn.classList.add("a-link-button");
+    inGameGuideBtn.style.display = "inline-block";
+    inGameGuideBtn.classList.add("hack-mission-header-element");
+    inGameGuideBtn.addEventListener("click", function() {
+        Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionHowToPlay);
+        return false;
+    });
+
+    var wikiGuideBtn = document.createElement("a");
+    wikiGuideBtn.innerText = "Wiki Guide";
+    wikiGuideBtn.classList.add("a-link-button");
+    wikiGuideBtn.style.display = "inline-block";
+    wikiGuideBtn.classList.add("hack-mission-header-element");
+    wikiGuideBtn.target = "_blank";
+    //TODO Add link to wiki page     wikiGuideBtn.href =
+
+
+    //Start button will get replaced with forfeit when game is started
+    var startBtn = document.createElement("a");
+    startBtn.classList.add("hack-mission-header-element");
+    startBtn.style.display = "block";
+
+    //Create Action Buttons (Attack/Scan/Soften/ etc...)
+    var actionsContainer = document.createElement("span");
+    actionsContainer.classList.add("hack-mission-action-buttons-container");
+    for (var i = 0; i < 5; ++i) {
+        this.actionButtons.push(document.createElement("a"));
+        this.actionButtons[i].style.display = "inline-block";
+        this.actionButtons[i].classList.add("a-link-button-inactive"); //Disabled at start
+        this.actionButtons[i].classList.add("tooltip"); //Disabled at start
+        this.actionButtons[i].classList.add("hack-mission-header-element");
+        actionsContainer.appendChild(this.actionButtons[i]);
+    }
+    this.actionButtons[0].innerText = "Attack(1)";
+    var atkTooltip = document.createElement("span");
+    atkTooltip.classList.add("tooltiptext");
+    atkTooltip.innerText = "Lowers the targeted node's HP. The effectiveness of this depends on " +
+                           "this node's Attack level, your hacking level, and the opponents defense level.";
+    this.actionButtons[0].appendChild(atkTooltip);
+    this.actionButtons[1].innerText = "Scan(2)";
+    var scanTooltip = document.createElement("span");
+    scanTooltip.classList.add("tooltiptext");
+    scanTooltip.innerText = "Lowers the targeted node's defense. The effectiveness of this depends on " +
+                            "this node's Attack level and your hacking level";
+    this.actionButtons[1].appendChild(scanTooltip);
+    this.actionButtons[2].innerText = "Soften(3)";
+    var softenTooltip = document.createElement("span");
+    softenTooltip.classList.add("tooltiptext");
+    softenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
+                              "this node's Attack level and your hacking level";
+    this.actionButtons[2].appendChild(softenTooltip);
+    this.actionButtons[3].innerText = "Fortify(4)";
+    var fortifyTooltip = document.createElement("span");
+    fortifyTooltip.classList.add("tooltiptext");
+    fortifyTooltip.innerText = "Raises this node's Defense level. The effectiveness of this depends on " +
+                               "your hacking level";
+    this.actionButtons[3].appendChild(fortifyTooltip);
+    this.actionButtons[4].innerText = "Overflow(5)";
+    var overflowTooltip = document.createElement("span");
+    overflowTooltip.classList.add("tooltiptext");
+    overflowTooltip.innerText = "Raises this node's Attack level but lowers its Defense level. The effectiveness " +
+                                "of this depends on your hacking level.";
+    this.actionButtons[4].appendChild(overflowTooltip);
+
+    var timeDisplay = document.createElement("p");
+
+    container.appendChild(headerText);
+    container.appendChild(inGameGuideBtn);
+    container.appendChild(wikiGuideBtn);
+    container.appendChild(startBtn);
+    container.appendChild(actionsContainer);
+    container.appendChild(timeDisplay);
+}
+
+//Should only be used at the start
+HackingMission.prototype.calculateDefenses = function() {
+    var total = 0;
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        total += this.playerCores[i].def;
+    }
+    for (var i = 0; i < this.playerNodes.length; ++i) {
+        total += this.playerNodes[i].def;
+    }
+    console.log("player defenses calculated to be: " + total);
+    this.playerDef = total;
+    total = 0;
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        total += this.enemyCores[i].def;
+    }
+    for (var i = 0; i < this.enemyDatabases.length; ++i) {
+        total += this.enemyDatabases[i].def;
+    }
+    for (var i = 0; i < this.enemyNodes.length; ++i) {
+        total += this.enemyNodes[i].def;
+    }
+    console.log("enemy defenses calculated to be: " + total);
+    this.enemyDef = total;
+}
+
+HackingMission.prototype.removeAvailablePosition = function(x, y) {
+    for (var i = 0; i < this.availablePositions.length; ++i) {
+        if (this.availablePositions[i][0] === x &&
+            this.availablePositions[i][1] === y) {
+            this.availablePositions.splice(i, 1);
+            return;
+        }
+    }
+    console.log("WARNING: removeAvailablePosition() did not remove " + x + ", " + y);
+}
+
+HackingMission.prototype.setNodePosition = function(nodeObj, x, y) {
+    if (!(nodeObj instanceof Node)) {
+        console.log("WARNING: Non-Node object passed into setNodePOsition");
+        return;
+    }
+    if (isNaN(x) || isNaN(y)) {
+        console.log("ERR: Invalid values passed as x and y for setNodePosition");
+        console.log(x);
+        console.log(y);
+        return;
+    }
+    nodeObj.pos = [x, y];
+    this.map[x][y] = nodeObj;
+}
+
+HackingMission.prototype.setNodeRandomPosition = function(nodeObj, xlimit=0) {
+    var i = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.availablePositions.length - 1);
+    var pos = this.availablePositions.splice(i, 1);
+    pos = pos[0];
+    this.setNodePosition(nodeObj, pos[0], pos[1]);
+}
+
+HackingMission.prototype.createMap = function() {
+    //Use a grid
+    var map = document.createElement("div");
+    map.classList.add("hack-mission-grid");
+    map.setAttribute("id", "hacking-mission-map");
+    document.getElementById("mission-container").appendChild(map);
+
+    //Create random Nodes for every space in the map that
+    //hasn't been filled yet
+    for (var x = 0; x < 8; ++x) {
+        for (var y = 0; y < 8; ++y) {
+            if (!(this.map[x][y] instanceof Node)) {
+                var node, type = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, 2);
+                var randMult = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
+                switch (type) {
+                    case 0: //Spam
+                        var stats = {
+                            atk: 0,
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(400, 800),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000)
+                        }
+                        node = new Node(NodeTypes.Spam, stats);
+                        break;
+                    case 1: //Transfer
+                        var stats = {
+                            atk: 0,
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(600, 1100)
+                        }
+                        node = new Node(NodeTypes.Transfer, stats);
+                        break;
+                    case 2: //Shield
+                    default:
+                        var stats = {
+                            atk: 0,
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(750, 1000),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(700, 1000)
+                        }
+                        node = new Node(NodeTypes.Shield, stats);
+                        break;
+                }
+                this.setNodePosition(node, x, y);
+                this.removeAvailablePosition(x, y);
+                this.miscNodes.push(node);
+            }
+        }
+    }
+
+    //Create DOM elements in order
+    for (var r = 0; r < 8; ++r) {
+        for (var c = 0; c < 8; ++c) {
+            this.createNodeDomElement(this.map[r][c]);
+        }
+    }
+
+    //Configure all Player CPUS
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        console.log("Configuring Player Node: " + this.playerCores[i].el.id);
+        this.configurePlayerNodeElement(this.playerCores[i].el);
+    }
+
+    console.log(this.map);
+    this.initJsPlumb();
+}
+
+HackingMission.prototype.createNodeDomElement = function(nodeObj) {
+    var nodeDiv = document.createElement("a");
+    nodeObj.el = nodeDiv;
+    document.getElementById("hacking-mission-map").appendChild(nodeDiv);
+
+    //Set the node element's id based on its coordinates
+    nodeDiv.setAttribute("id", "hacking-mission-node-" +
+                                nodeObj.pos[0] + "-" +
+                                nodeObj.pos[1]);
+
+    //Set node classes for owner
+    nodeDiv.classList.add("hack-mission-node");
+    if (nodeObj.plyrCtrl) {
+        nodeDiv.classList.add("hack-mission-player-node");
+    } else if (nodeObj.enmyCtrl) {
+        nodeDiv.classList.add("hack-mission-enemy-node");
+    }
+
+    //Set node classes based on type
+    switch (nodeObj.type) {
+        case NodeTypes.Core:
+            nodeDiv.innerHTML = "<p>CPU Core<br>" + "HP: " +
+                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-cpu-node");
+            break;
+        case NodeTypes.Firewall:
+            nodeDiv.innerHTML = "<p>Firewall<br>" + "HP: " +
+                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-firewall-node");
+            break;
+        case NodeTypes.Database:
+            nodeDiv.innerHTML = "<p>Database<br>" + "HP: " +
+                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-database-node");
+            break;
+        case NodeTypes.Spam:
+            nodeDiv.innerHTML = "<p>Spam<br>" + "HP: " +
+                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-spam-node");
+            break;
+        case NodeTypes.Transfer:
+            nodeDiv.innerHTML = "<p>Transfer<br>" + "HP: " +
+                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-transfer-node");
+            break;
+        case NodeTypes.Shield:
+        default:
+            nodeDiv.innerHTML = "<p>Shield<br>" + "HP: " +
+                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-shield-node");
+            break;
+    }
+}
+
+//Gets a Node DOM element's corresponding Node object using its
+//element id
+HackingMission.prototype.getNodeFromElement = function(el) {
+    var id = el.id;
+    id = id.replace("hacking-mission-node-", "");
+    var res = id.split('-');
+    if (res.length != 2) {
+        console.log("ERROR Parsing Hacking Mission Node Id. Could not find coordinates");
+        return null;
+    }
+    var x = res[0], y = res[1];
+    if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) {
+        console.log("ERROR: Unexpected values for x and y: " + x + ", " + y);
+        return null;
+    }
+    return this.map[x][y];
+}
+
+//Configures a DOM element representing a player-owned node to
+//be selectable and actionable
+//Note: Does NOT change its css class. This is handled by Node.setControlledBy...
+HackingMission.prototype.configurePlayerNodeElement = function(el) {
+    var nodeObj = this.getNodeFromElement(el);
+    if (nodeObj === null) {console.log("Error getting Node object");}
+
+    //Add event listener
+    el.addEventListener("click", ()=>{
+        if (this.selectedNode instanceof Node) {
+            this.selectedNode.deselect(this.actionButtons);
+            this.selectedNode = null;
+        }
+        console.log("Selecting node :" + el.id);
+        nodeObj.select(this.actionButtons);
+        this.selectedNode = nodeObj;
+    });
+}
+
+//Configures a DOM element representing an enemy-node by removing
+//any event listeners
+HackingMission.prototype.configureEnemyNodeElement = function(el) {
+    //Deselect node if it was the selected node
+    var nodeObj = this.getNodeFromElement(el);
+    if (this.selectedNode == nodeObj) {
+        nodeObj.deselect(this.actionButtons);
+    }
+}
+
+HackingMission.prototype.initJsPlumb = function() {
+    var instance = jsPlumb.getInstance({
+        DragOptions:{cursor:"pointer", zIndex:2000},
+        PaintStyle: {
+            gradient: { stops: [
+                [ 0, "#FFFFFF" ],
+                [ 1, "#FFFFFF" ]
+            ] },
+            stroke: "#FFFFFF",
+            strokeWidth: 10
+        },
+    });
+
+    //All player cores are sources
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        instance.makeSource(this.playerCores[i].el, {
+            deleteEndpointsOnEmpty:true,
+            maxConnections:1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+
+    //Everything else is a target
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        instance.makeTarget(this.enemyCores[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+    for (var i = 0; i < this.enemyDatabases.length; ++i) {
+        instance.makeTarget(this.enemyDatabases[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:["Straight"]
+        });
+    }
+    for (var i = 0; i < this.enemyNodes.length; ++i) {
+        instance.makeTarget(this.enemyNodes[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+    for (var i = 0; i < this.miscNodes.length; ++i) {
+        instance.makeTarget(this.miscNodes[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+
+    //Clicking a connection drops it
+    instance.bind("click", function(conn, originalEvent) {
+        console.log("test");
+        var endpoints = conn.endpoints;
+        endpoints[0].detachFrom(endpoints[1]);
+    });
+}
+
+
+
+
+/***/ }),
+/* 48 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * jsBezier
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * licensed under the MIT license.
+ *
+ * a set of Bezier curve functions that deal with Beziers, used by jsPlumb, and perhaps useful for other people.  These functions work with Bezier
+ * curves of arbitrary degree.
+ *
+ * - functions are all in the 'jsBezier' namespace.
+ *
+ * - all input points should be in the format {x:.., y:..}. all output points are in this format too.
+ *
+ * - all input curves should be in the format [ {x:.., y:..}, {x:.., y:..}, {x:.., y:..}, {x:.., y:..} ]
+ *
+ * - 'location' as used as an input here refers to a decimal in the range 0-1 inclusive, which indicates a point some proportion along the length
+ * of the curve.  location as output has the same format and meaning.
+ *
+ *
+ * Function List:
+ * --------------
+ *
+ * distanceFromCurve(point, curve)
+ *
+ * 	Calculates the distance that the given point lies from the given Bezier.  Note that it is computed relative to the center of the Bezier,
+ * so if you have stroked the curve with a wide pen you may wish to take that into account!  The distance returned is relative to the values
+ * of the curve and the point - it will most likely be pixels.
+ *
+ * gradientAtPoint(curve, location)
+ *
+ * 	Calculates the gradient to the curve at the given location, as a decimal between 0 and 1 inclusive.
+ *
+ * gradientAtPointAlongCurveFrom (curve, location)
+ *
+ *	Calculates the gradient at the point on the given curve that is 'distance' units from location.
+ *
+ * nearestPointOnCurve(point, curve)
+ *
+ *	Calculates the nearest point to the given point on the given curve.  The return value of this is a JS object literal, containing both the
+ *point's coordinates and also the 'location' of the point (see above), for example:  { point:{x:551,y:150}, location:0.263365 }.
+ *
+ * pointOnCurve(curve, location)
+ *
+ * 	Calculates the coordinates of the point on the given Bezier curve at the given location.
+ *
+ * pointAlongCurveFrom(curve, location, distance)
+ *
+ * 	Calculates the coordinates of the point on the given curve that is 'distance' units from location.  'distance' should be in the same coordinate
+ * space as that used to construct the Bezier curve.  For an HTML Canvas usage, for example, distance would be a measure of pixels.
+ *
+ * locationAlongCurveFrom(curve, location, distance)
+ *
+ * 	Calculates the location on the given curve that is 'distance' units from location.  'distance' should be in the same coordinate
+ * space as that used to construct the Bezier curve.  For an HTML Canvas usage, for example, distance would be a measure of pixels.
+ *
+ * perpendicularToCurveAt(curve, location, length, distance)
+ *
+ * 	Calculates the perpendicular to the given curve at the given location.  length is the length of the line you wish for (it will be centered
+ * on the point at 'location'). distance is optional, and allows you to specify a point along the path from the given location as the center of
+ * the perpendicular returned.  The return value of this is an array of two points: [ {x:...,y:...}, {x:...,y:...} ].
+ *
+ *
+ */
+
+(function() {
+
+    var root = this;
+
+    if(typeof Math.sgn == "undefined") {
+        Math.sgn = function(x) { return x == 0 ? 0 : x > 0 ? 1 :-1; };
+    }
+
+    var Vectors = {
+            subtract 	: 	function(v1, v2) { return {x:v1.x - v2.x, y:v1.y - v2.y }; },
+            dotProduct	: 	function(v1, v2) { return (v1.x * v2.x)  + (v1.y * v2.y); },
+            square		:	function(v) { return Math.sqrt((v.x * v.x) + (v.y * v.y)); },
+            scale		:	function(v, s) { return {x:v.x * s, y:v.y * s }; }
+        },
+
+        maxRecursion = 64,
+        flatnessTolerance = Math.pow(2.0,-maxRecursion-1);
+
+    /**
+     * Calculates the distance that the point lies from the curve.
+     *
+     * @param point a point in the form {x:567, y:3342}
+     * @param curve a Bezier curve in the form [{x:..., y:...}, {x:..., y:...}, {x:..., y:...}, {x:..., y:...}].  note that this is currently
+     * hardcoded to assume cubiz beziers, but would be better off supporting any degree.
+     * @return a JS object literal containing location and distance, for example: {location:0.35, distance:10}.  Location is analogous to the location
+     * argument you pass to the pointOnPath function: it is a ratio of distance travelled along the curve.  Distance is the distance in pixels from
+     * the point to the curve.
+     */
+    var _distanceFromCurve = function(point, curve) {
+        var candidates = [],
+            w = _convertToBezier(point, curve),
+            degree = curve.length - 1, higherDegree = (2 * degree) - 1,
+            numSolutions = _findRoots(w, higherDegree, candidates, 0),
+            v = Vectors.subtract(point, curve[0]), dist = Vectors.square(v), t = 0.0;
+
+        for (var i = 0; i < numSolutions; i++) {
+            v = Vectors.subtract(point, _bezier(curve, degree, candidates[i], null, null));
+            var newDist = Vectors.square(v);
+            if (newDist < dist) {
+                dist = newDist;
+                t = candidates[i];
+            }
+        }
+        v = Vectors.subtract(point, curve[degree]);
+        newDist = Vectors.square(v);
+        if (newDist < dist) {
+            dist = newDist;
+            t = 1.0;
+        }
+        return {location:t, distance:dist};
+    };
+    /**
+     * finds the nearest point on the curve to the given point.
+     */
+    var _nearestPointOnCurve = function(point, curve) {
+        var td = _distanceFromCurve(point, curve);
+        return {point:_bezier(curve, curve.length - 1, td.location, null, null), location:td.location};
+    };
+    var _convertToBezier = function(point, curve) {
+        var degree = curve.length - 1, higherDegree = (2 * degree) - 1,
+            c = [], d = [], cdTable = [], w = [],
+            z = [ [1.0, 0.6, 0.3, 0.1], [0.4, 0.6, 0.6, 0.4], [0.1, 0.3, 0.6, 1.0] ];
+
+        for (var i = 0; i <= degree; i++) c[i] = Vectors.subtract(curve[i], point);
+        for (var i = 0; i <= degree - 1; i++) {
+            d[i] = Vectors.subtract(curve[i+1], curve[i]);
+            d[i] = Vectors.scale(d[i], 3.0);
+        }
+        for (var row = 0; row <= degree - 1; row++) {
+            for (var column = 0; column <= degree; column++) {
+                if (!cdTable[row]) cdTable[row] = [];
+                cdTable[row][column] = Vectors.dotProduct(d[row], c[column]);
+            }
+        }
+        for (i = 0; i <= higherDegree; i++) {
+            if (!w[i]) w[i] = [];
+            w[i].y = 0.0;
+            w[i].x = parseFloat(i) / higherDegree;
+        }
+        var n = degree, m = degree-1;
+        for (var k = 0; k <= n + m; k++) {
+            var lb = Math.max(0, k - m),
+                ub = Math.min(k, n);
+            for (i = lb; i <= ub; i++) {
+                j = k - i;
+                w[i+j].y += cdTable[j][i] * z[j][i];
+            }
+        }
+        return w;
+    };
+    /**
+     * counts how many roots there are.
+     */
+    var _findRoots = function(w, degree, t, depth) {
+        var left = [], right = [],
+            left_count, right_count,
+            left_t = [], right_t = [];
+
+        switch (_getCrossingCount(w, degree)) {
+            case 0 : {
+                return 0;
+            }
+            case 1 : {
+                if (depth >= maxRecursion) {
+                    t[0] = (w[0].x + w[degree].x) / 2.0;
+                    return 1;
+                }
+                if (_isFlatEnough(w, degree)) {
+                    t[0] = _computeXIntercept(w, degree);
+                    return 1;
+                }
+                break;
+            }
+        }
+        _bezier(w, degree, 0.5, left, right);
+        left_count  = _findRoots(left,  degree, left_t, depth+1);
+        right_count = _findRoots(right, degree, right_t, depth+1);
+        for (var i = 0; i < left_count; i++) t[i] = left_t[i];
+        for (var i = 0; i < right_count; i++) t[i+left_count] = right_t[i];
+        return (left_count+right_count);
+    };
+    var _getCrossingCount = function(curve, degree) {
+        var n_crossings = 0, sign, old_sign;
+        sign = old_sign = Math.sgn(curve[0].y);
+        for (var i = 1; i <= degree; i++) {
+            sign = Math.sgn(curve[i].y);
+            if (sign != old_sign) n_crossings++;
+            old_sign = sign;
+        }
+        return n_crossings;
+    };
+    var _isFlatEnough = function(curve, degree) {
+        var  error,
+            intercept_1, intercept_2, left_intercept, right_intercept,
+            a, b, c, det, dInv, a1, b1, c1, a2, b2, c2;
+        a = curve[0].y - curve[degree].y;
+        b = curve[degree].x - curve[0].x;
+        c = curve[0].x * curve[degree].y - curve[degree].x * curve[0].y;
+
+        var max_distance_above = max_distance_below = 0.0;
+
+        for (var i = 1; i < degree; i++) {
+            var value = a * curve[i].x + b * curve[i].y + c;
+            if (value > max_distance_above)
+                max_distance_above = value;
+            else if (value < max_distance_below)
+                max_distance_below = value;
+        }
+
+        a1 = 0.0; b1 = 1.0; c1 = 0.0; a2 = a; b2 = b;
+        c2 = c - max_distance_above;
+        det = a1 * b2 - a2 * b1;
+        dInv = 1.0/det;
+        intercept_1 = (b1 * c2 - b2 * c1) * dInv;
+        a2 = a; b2 = b; c2 = c - max_distance_below;
+        det = a1 * b2 - a2 * b1;
+        dInv = 1.0/det;
+        intercept_2 = (b1 * c2 - b2 * c1) * dInv;
+        left_intercept = Math.min(intercept_1, intercept_2);
+        right_intercept = Math.max(intercept_1, intercept_2);
+        error = right_intercept - left_intercept;
+        return (error < flatnessTolerance)? 1 : 0;
+    };
+    var _computeXIntercept = function(curve, degree) {
+        var XLK = 1.0, YLK = 0.0,
+            XNM = curve[degree].x - curve[0].x, YNM = curve[degree].y - curve[0].y,
+            XMK = curve[0].x - 0.0, YMK = curve[0].y - 0.0,
+            det = XNM*YLK - YNM*XLK, detInv = 1.0/det,
+            S = (XNM*YMK - YNM*XMK) * detInv;
+        return 0.0 + XLK * S;
+    };
+    var _bezier = function(curve, degree, t, left, right) {
+        var temp = [[]];
+        for (var j =0; j <= degree; j++) temp[0][j] = curve[j];
+        for (var i = 1; i <= degree; i++) {
+            for (var j =0 ; j <= degree - i; j++) {
+                if (!temp[i]) temp[i] = [];
+                if (!temp[i][j]) temp[i][j] = {};
+                temp[i][j].x = (1.0 - t) * temp[i-1][j].x + t * temp[i-1][j+1].x;
+                temp[i][j].y = (1.0 - t) * temp[i-1][j].y + t * temp[i-1][j+1].y;
+            }
+        }
+        if (left != null)
+            for (j = 0; j <= degree; j++) left[j]  = temp[j][0];
+        if (right != null)
+            for (j = 0; j <= degree; j++) right[j] = temp[degree-j][j];
+
+        return (temp[degree][0]);
+    };
+
+    var _curveFunctionCache = {};
+    var _getCurveFunctions = function(order) {
+        var fns = _curveFunctionCache[order];
+        if (!fns) {
+            fns = [];
+            var f_term = function() { return function(t) { return Math.pow(t, order); }; },
+                l_term = function() { return function(t) { return Math.pow((1-t), order); }; },
+                c_term = function(c) { return function(t) { return c; }; },
+                t_term = function() { return function(t) { return t; }; },
+                one_minus_t_term = function() { return function(t) { return 1-t; }; },
+                _termFunc = function(terms) {
+                    return function(t) {
+                        var p = 1;
+                        for (var i = 0; i < terms.length; i++) p = p * terms[i](t);
+                        return p;
+                    };
+                };
+
+            fns.push(new f_term());  // first is t to the power of the curve order
+            for (var i = 1; i < order; i++) {
+                var terms = [new c_term(order)];
+                for (var j = 0 ; j < (order - i); j++) terms.push(new t_term());
+                for (var j = 0 ; j < i; j++) terms.push(new one_minus_t_term());
+                fns.push(new _termFunc(terms));
+            }
+            fns.push(new l_term());  // last is (1-t) to the power of the curve order
+
+            _curveFunctionCache[order] = fns;
+        }
+
+        return fns;
+    };
+
+
+    /**
+     * calculates a point on the curve, for a Bezier of arbitrary order.
+     * @param curve an array of control points, eg [{x:10,y:20}, {x:50,y:50}, {x:100,y:100}, {x:120,y:100}].  For a cubic bezier this should have four points.
+     * @param location a decimal indicating the distance along the curve the point should be located at.  this is the distance along the curve as it travels, taking the way it bends into account.  should be a number from 0 to 1, inclusive.
+     */
+    var _pointOnPath = function(curve, location) {
+        var cc = _getCurveFunctions(curve.length - 1),
+            _x = 0, _y = 0;
+        for (var i = 0; i < curve.length ; i++) {
+            _x = _x + (curve[i].x * cc[i](location));
+            _y = _y + (curve[i].y * cc[i](location));
+        }
+
+        return {x:_x, y:_y};
+    };
+
+    var _dist = function(p1,p2) {
+        return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
+    };
+
+    var _isPoint = function(curve) {
+        return curve[0].x == curve[1].x && curve[0].y == curve[1].y;
+    };
+
+    /**
+     * finds the point that is 'distance' along the path from 'location'.  this method returns both the x,y location of the point and also
+     * its 'location' (proportion of travel along the path); the method below - _pointAlongPathFrom - calls this method and just returns the
+     * point.
+     */
+    var _pointAlongPath = function(curve, location, distance) {
+
+        if (_isPoint(curve)) {
+            return {
+                point:curve[0],
+                location:location
+            };
+        }
+
+        var prev = _pointOnPath(curve, location),
+            tally = 0,
+            curLoc = location,
+            direction = distance > 0 ? 1 : -1,
+            cur = null;
+
+        while (tally < Math.abs(distance)) {
+            curLoc += (0.005 * direction);
+            cur = _pointOnPath(curve, curLoc);
+            tally += _dist(cur, prev);
+            prev = cur;
+        }
+        return {point:cur, location:curLoc};
+    };
+
+    var _length = function(curve) {
+        if (_isPoint(curve)) return 0;
+
+        var prev = _pointOnPath(curve, 0),
+            tally = 0,
+            curLoc = 0,
+            direction = 1,
+            cur = null;
+
+        while (curLoc < 1) {
+            curLoc += (0.005 * direction);
+            cur = _pointOnPath(curve, curLoc);
+            tally += _dist(cur, prev);
+            prev = cur;
+        }
+        return tally;
+    };
+
+    /**
+     * finds the point that is 'distance' along the path from 'location'.
+     */
+    var _pointAlongPathFrom = function(curve, location, distance) {
+        return _pointAlongPath(curve, location, distance).point;
+    };
+
+    /**
+     * finds the location that is 'distance' along the path from 'location'.
+     */
+    var _locationAlongPathFrom = function(curve, location, distance) {
+        return _pointAlongPath(curve, location, distance).location;
+    };
+
+    /**
+     * returns the gradient of the curve at the given location, which is a decimal between 0 and 1 inclusive.
+     *
+     * thanks // http://bimixual.org/AnimationLibrary/beziertangents.html
+     */
+    var _gradientAtPoint = function(curve, location) {
+        var p1 = _pointOnPath(curve, location),
+            p2 = _pointOnPath(curve.slice(0, curve.length - 1), location),
+            dy = p2.y - p1.y, dx = p2.x - p1.x;
+        return dy == 0 ? Infinity : Math.atan(dy / dx);
+    };
+
+    /**
+     returns the gradient of the curve at the point which is 'distance' from the given location.
+     if this point is greater than location 1, the gradient at location 1 is returned.
+     if this point is less than location 0, the gradient at location 0 is returned.
+     */
+    var _gradientAtPointAlongPathFrom = function(curve, location, distance) {
+        var p = _pointAlongPath(curve, location, distance);
+        if (p.location > 1) p.location = 1;
+        if (p.location < 0) p.location = 0;
+        return _gradientAtPoint(curve, p.location);
+    };
+
+    /**
+     * calculates a line that is 'length' pixels long, perpendicular to, and centered on, the path at 'distance' pixels from the given location.
+     * if distance is not supplied, the perpendicular for the given location is computed (ie. we set distance to zero).
+     */
+    var _perpendicularToPathAt = function(curve, location, length, distance) {
+        distance = distance == null ? 0 : distance;
+        var p = _pointAlongPath(curve, location, distance),
+            m = _gradientAtPoint(curve, p.location),
+            _theta2 = Math.atan(-1 / m),
+            y =  length / 2 * Math.sin(_theta2),
+            x =  length / 2 * Math.cos(_theta2);
+        return [{x:p.point.x + x, y:p.point.y + y}, {x:p.point.x - x, y:p.point.y - y}];
+    };
+
+    var jsBezier = this.jsBezier = {
+        distanceFromCurve : _distanceFromCurve,
+        gradientAtPoint : _gradientAtPoint,
+        gradientAtPointAlongCurveFrom : _gradientAtPointAlongPathFrom,
+        nearestPointOnCurve : _nearestPointOnCurve,
+        pointOnCurve : _pointOnPath,
+        pointAlongCurveFrom : _pointAlongPathFrom,
+        perpendicularToCurveAt : _perpendicularToPathAt,
+        locationAlongCurveFrom:_locationAlongPathFrom,
+        getLength:_length,
+        version:"0.9.0"
+    };
+
+    if (true) {
+        exports.jsBezier = jsBezier;
+    }
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+/**
+ * Biltong v0.4.0
+ *
+ * Various geometry functions written as part of jsPlumb and perhaps useful for others.
+ *
+ * Copyright (c) 2017 jsPlumb
+ * https://jsplumbtoolkit.com
+ *
+ * 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() {
+
+    "use strict";
+    var root = this;
+
+    var Biltong = root.Biltong = {
+        version:"0.4.0"
+    };
+
+    if (true) {
+        exports.Biltong = Biltong;
+    }
+
+    var _isa = function(a) { return Object.prototype.toString.call(a) === "[object Array]"; },
+        _pointHelper = function(p1, p2, fn) {
+            p1 = _isa(p1) ? p1 : [p1.x, p1.y];
+            p2 = _isa(p2) ? p2 : [p2.x, p2.y];
+            return fn(p1, p2);
+        },
+        /**
+         * @name Biltong.gradient
+         * @function
+         * @desc Calculates the gradient of a line between the two points.
+         * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+         * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+         * @return {Float} The gradient of a line between the two points.
+         */
+        _gradient = Biltong.gradient = function(p1, p2) {
+            return _pointHelper(p1, p2, function(_p1, _p2) {
+                if (_p2[0] == _p1[0])
+                    return _p2[1] > _p1[1] ? Infinity : -Infinity;
+                else if (_p2[1] == _p1[1])
+                    return _p2[0] > _p1[0] ? 0 : -0;
+                else
+                    return (_p2[1] - _p1[1]) / (_p2[0] - _p1[0]);
+            });
+        },
+        /**
+         * @name Biltong.normal
+         * @function
+         * @desc Calculates the gradient of a normal to a line between the two points.
+         * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+         * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+         * @return {Float} The gradient of a normal to a line between the two points.
+         */
+        _normal = Biltong.normal = function(p1, p2) {
+            return -1 / _gradient(p1, p2);
+        },
+        /**
+         * @name Biltong.lineLength
+         * @function
+         * @desc Calculates the length of a line between the two points.
+         * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+         * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+         * @return {Float} The length of a line between the two points.
+         */
+        _lineLength = Biltong.lineLength = function(p1, p2) {
+            return _pointHelper(p1, p2, function(_p1, _p2) {
+                return Math.sqrt(Math.pow(_p2[1] - _p1[1], 2) + Math.pow(_p2[0] - _p1[0], 2));
+            });
+        },
+        /**
+         * @name Biltong.quadrant
+         * @function
+         * @desc Calculates the quadrant in which the angle between the two points lies.
+         * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+         * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+         * @return {Integer} The quadrant - 1 for upper right, 2 for lower right, 3 for lower left, 4 for upper left.
+         */
+        _quadrant = Biltong.quadrant = function(p1, p2) {
+            return _pointHelper(p1, p2, function(_p1, _p2) {
+                if (_p2[0] > _p1[0]) {
+                    return (_p2[1] > _p1[1]) ? 2 : 1;
+                }
+                else if (_p2[0] == _p1[0]) {
+                    return _p2[1] > _p1[1] ? 2 : 1;
+                }
+                else {
+                    return (_p2[1] > _p1[1]) ? 3 : 4;
+                }
+            });
+        },
+        /**
+         * @name Biltong.theta
+         * @function
+         * @desc Calculates the angle between the two points.
+         * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+         * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+         * @return {Float} The angle between the two points.
+         */
+        _theta = Biltong.theta = function(p1, p2) {
+            return _pointHelper(p1, p2, function(_p1, _p2) {
+                var m = _gradient(_p1, _p2),
+                    t = Math.atan(m),
+                    s = _quadrant(_p1, _p2);
+                if ((s == 4 || s== 3)) t += Math.PI;
+                if (t < 0) t += (2 * Math.PI);
+
+                return t;
+            });
+        },
+        /**
+         * @name Biltong.intersects
+         * @function
+         * @desc Calculates whether or not the two rectangles intersect.
+         * @param {Rectangle} r1 First rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
+         * @param {Rectangle} r2 Second rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
+         * @return {Boolean} True if the rectangles intersect, false otherwise.
+         */
+        _intersects = Biltong.intersects = function(r1, r2) {
+            var x1 = r1.x, x2 = r1.x + r1.w, y1 = r1.y, y2 = r1.y + r1.h,
+                a1 = r2.x, a2 = r2.x + r2.w, b1 = r2.y, b2 = r2.y + r2.h;
+
+            return  ( (x1 <= a1 && a1 <= x2) && (y1 <= b1 && b1 <= y2) ) ||
+                ( (x1 <= a2 && a2 <= x2) && (y1 <= b1 && b1 <= y2) ) ||
+                ( (x1 <= a1 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) ||
+                ( (x1 <= a2 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) ||
+                ( (a1 <= x1 && x1 <= a2) && (b1 <= y1 && y1 <= b2) ) ||
+                ( (a1 <= x2 && x2 <= a2) && (b1 <= y1 && y1 <= b2) ) ||
+                ( (a1 <= x1 && x1 <= a2) && (b1 <= y2 && y2 <= b2) ) ||
+                ( (a1 <= x2 && x1 <= a2) && (b1 <= y2 && y2 <= b2) );
+        },
+        /**
+         * @name Biltong.encloses
+         * @function
+         * @desc Calculates whether or not r2 is completely enclosed by r1.
+         * @param {Rectangle} r1 First rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
+         * @param {Rectangle} r2 Second rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
+         * @param {Boolean} [allowSharedEdges=false] If true, the concept of enclosure allows for one or more edges to be shared by the two rectangles.
+         * @return {Boolean} True if r1 encloses r2, false otherwise.
+         */
+        _encloses = Biltong.encloses = function(r1, r2, allowSharedEdges) {
+            var x1 = r1.x, x2 = r1.x + r1.w, y1 = r1.y, y2 = r1.y + r1.h,
+                a1 = r2.x, a2 = r2.x + r2.w, b1 = r2.y, b2 = r2.y + r2.h,
+                c = function(v1, v2, v3, v4) { return allowSharedEdges ? v1 <= v2 && v3>= v4 : v1 < v2 && v3 > v4; };
+
+            return c(x1,a1,x2,a2) && c(y1,b1,y2,b2);
+        },
+        _segmentMultipliers = [null, [1, -1], [1, 1], [-1, 1], [-1, -1] ],
+        _inverseSegmentMultipliers = [null, [-1, -1], [-1, 1], [1, 1], [1, -1] ],
+        /**
+         * @name Biltong.pointOnLine
+         * @function
+         * @desc Calculates a point on the line from `fromPoint` to `toPoint` that is `distance` units along the length of the line.
+         * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+         * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+         * @return {Point} Point on the line, in the form `{ x:..., y:... }`.
+         */
+        _pointOnLine = Biltong.pointOnLine = function(fromPoint, toPoint, distance) {
+            var m = _gradient(fromPoint, toPoint),
+                s = _quadrant(fromPoint, toPoint),
+                segmentMultiplier = distance > 0 ? _segmentMultipliers[s] : _inverseSegmentMultipliers[s],
+                theta = Math.atan(m),
+                y = Math.abs(distance * Math.sin(theta)) * segmentMultiplier[1],
+                x =  Math.abs(distance * Math.cos(theta)) * segmentMultiplier[0];
+            return { x:fromPoint.x + x, y:fromPoint.y + y };
+        },
+        /**
+         * @name Biltong.perpendicularLineTo
+         * @function
+         * @desc Calculates a line of length `length` that is perpendicular to the line from `fromPoint` to `toPoint` and passes through `toPoint`.
+         * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+         * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+         * @return {Line} Perpendicular line, in the form `[ { x:..., y:... }, { x:..., y:... } ]`.
+         */
+        _perpendicularLineTo = Biltong.perpendicularLineTo = function(fromPoint, toPoint, length) {
+            var m = _gradient(fromPoint, toPoint),
+                theta2 = Math.atan(-1 / m),
+                y =  length / 2 * Math.sin(theta2),
+                x =  length / 2 * Math.cos(theta2);
+            return [{x:toPoint.x + x, y:toPoint.y + y}, {x:toPoint.x - x, y:toPoint.y - y}];
+        };
+}).call(typeof window !== 'undefined' ? window : this);
+;
+(function () {
+
+    "use strict";
+
+    var root = this,
+        Sniff = {
+            android: navigator.userAgent.toLowerCase().indexOf("android") > -1
+        },
+        matchesSelector = function (el, selector, ctx) {
+            ctx = ctx || el.parentNode;
+            var possibles = ctx.querySelectorAll(selector);
+            for (var i = 0; i < possibles.length; i++) {
+                if (possibles[i] === el) {
+                    return true;
+                }
+            }
+            return false;
+        },
+        _gel = function (el) {
+            return (typeof el == "string" || el.constructor === String) ? document.getElementById(el) : el;
+        },
+        _t = function (e) {
+            return e.srcElement || e.target;
+        },
+    //
+    // gets path info for the given event - the path from target to obj, in the event's bubble chain. if doCompute
+    // is false we just return target for the path.
+    //
+        _pi = function(e, target, obj, doCompute) {
+            if (!doCompute) return { path:[target], end:1 };
+            else if (typeof e.path !== "undefined" && e.path.indexOf) {
+                return { path: e.path, end: e.path.indexOf(obj) };
+            } else {
+                var out = { path:[], end:-1 }, _one = function(el) {
+                    out.path.push(el);
+                    if (el === obj) {
+                        out.end = out.path.length - 1;
+                    }
+                    else if (el.parentNode != null) {
+                        _one(el.parentNode)
+                    }
+                };
+                _one(target);
+                return out;
+            }
+        },
+        _d = function (l, fn) {
+            for (var i = 0, j = l.length; i < j; i++) {
+                if (l[i] == fn) break;
+            }
+            if (i < l.length) l.splice(i, 1);
+        },
+        guid = 1,
+    //
+    // this function generates a guid for every handler, sets it on the handler, then adds
+    // it to the associated object's map of handlers for the given event. this is what enables us
+    // to unbind all events of some type, or all events (the second of which can be requested by the user,
+    // but it also used by Mottle when an element is removed.)
+        _store = function (obj, event, fn) {
+            var g = guid++;
+            obj.__ta = obj.__ta || {};
+            obj.__ta[event] = obj.__ta[event] || {};
+            // store each handler with a unique guid.
+            obj.__ta[event][g] = fn;
+            // set the guid on the handler.
+            fn.__tauid = g;
+            return g;
+        },
+        _unstore = function (obj, event, fn) {
+            obj.__ta && obj.__ta[event] && delete obj.__ta[event][fn.__tauid];
+            // a handler might have attached extra functions, so we unbind those too.
+            if (fn.__taExtra) {
+                for (var i = 0; i < fn.__taExtra.length; i++) {
+                    _unbind(obj, fn.__taExtra[i][0], fn.__taExtra[i][1]);
+                }
+                fn.__taExtra.length = 0;
+            }
+            // a handler might have attached an unstore callback
+            fn.__taUnstore && fn.__taUnstore();
+        },
+        _curryChildFilter = function (children, obj, fn, evt) {
+            if (children == null) return fn;
+            else {
+                var c = children.split(","),
+                    _fn = function (e) {
+                        _fn.__tauid = fn.__tauid;
+                        var t = _t(e), target = t;  // t is the target element on which the event occurred. it is the
+                        // element we will wish to pass to any callbacks.
+                        var pathInfo = _pi(e, t, obj, children != null)
+                        if (pathInfo.end != -1) {
+                            for (var p = 0; p < pathInfo.end; p++) {
+                                target = pathInfo.path[p];
+                                for (var i = 0; i < c.length; i++) {
+                                    if (matchesSelector(target, c[i], obj)) {
+                                        fn.apply(target, arguments);
+                                    }
+                                }
+                            }
+                        }
+                    };
+                registerExtraFunction(fn, evt, _fn);
+                return _fn;
+            }
+        },
+    //
+    // registers an 'extra' function on some event listener function we were given - a function that we
+    // created and bound to the element as part of our housekeeping, and which we want to unbind and remove
+    // whenever the given function is unbound.
+        registerExtraFunction = function (fn, evt, newFn) {
+            fn.__taExtra = fn.__taExtra || [];
+            fn.__taExtra.push([evt, newFn]);
+        },
+        DefaultHandler = function (obj, evt, fn, children) {
+            if (isTouchDevice && touchMap[evt]) {
+                var tfn = _curryChildFilter(children, obj, fn, touchMap[evt]);
+                _bind(obj, touchMap[evt], tfn , fn);
+            }
+            if (evt === "focus" && obj.getAttribute("tabindex") == null) {
+                obj.setAttribute("tabindex", "1");
+            }
+            _bind(obj, evt, _curryChildFilter(children, obj, fn, evt), fn);
+        },
+        SmartClickHandler = function (obj, evt, fn, children) {
+            if (obj.__taSmartClicks == null) {
+                var down = function (e) {
+                        obj.__tad = _pageLocation(e);
+                    },
+                    up = function (e) {
+                        obj.__tau = _pageLocation(e);
+                    },
+                    click = function (e) {
+                        if (obj.__tad && obj.__tau && obj.__tad[0] === obj.__tau[0] && obj.__tad[1] === obj.__tau[1]) {
+                            for (var i = 0; i < obj.__taSmartClicks.length; i++)
+                                obj.__taSmartClicks[i].apply(_t(e), [ e ]);
+                        }
+                    };
+                DefaultHandler(obj, "mousedown", down, children);
+                DefaultHandler(obj, "mouseup", up, children);
+                DefaultHandler(obj, "click", click, children);
+                obj.__taSmartClicks = [];
+            }
+
+            // store in the list of callbacks
+            obj.__taSmartClicks.push(fn);
+            // the unstore function removes this function from the object's listener list for this type.
+            fn.__taUnstore = function () {
+                _d(obj.__taSmartClicks, fn);
+            };
+        },
+        _tapProfiles = {
+            "tap": {touches: 1, taps: 1},
+            "dbltap": {touches: 1, taps: 2},
+            "contextmenu": {touches: 2, taps: 1}
+        },
+        TapHandler = function (clickThreshold, dblClickThreshold) {
+            return function (obj, evt, fn, children) {
+                // if event is contextmenu, for devices which are mouse only, we want to
+                // use the default bind.
+                if (evt == "contextmenu" && isMouseDevice)
+                    DefaultHandler(obj, evt, fn, children);
+                else {
+                    // the issue here is that this down handler gets registered only for the
+                    // child nodes in the first registration. in fact it should be registered with
+                    // no child selector and then on down we should cycle through the registered
+                    // functions to see if one of them matches. on mouseup we should execute ALL of
+                    // the functions whose children are either null or match the element.
+                    if (obj.__taTapHandler == null) {
+                        var tt = obj.__taTapHandler = {
+                            tap: [],
+                            dbltap: [],
+                            contextmenu: [],
+                            down: false,
+                            taps: 0,
+                            downSelectors: []
+                        };
+                        var down = function (e) {
+                                var target = _t(e), pathInfo = _pi(e, target, obj, children != null), finished = false;
+                                for (var p = 0; p < pathInfo.end; p++) {
+                                    if (finished) return;
+                                    target = pathInfo.path[p];
+                                    for (var i = 0; i < tt.downSelectors.length; i++) {
+                                        if (tt.downSelectors[i] == null || matchesSelector(target, tt.downSelectors[i], obj)) {
+                                            tt.down = true;
+                                            setTimeout(clearSingle, clickThreshold);
+                                            setTimeout(clearDouble, dblClickThreshold);
+                                            finished = true;
+                                            break; // we only need one match on mousedown
+                                        }
+                                    }
+                                }
+                            },
+                            up = function (e) {
+                                if (tt.down) {
+                                    var target = _t(e), currentTarget, pathInfo;
+                                    tt.taps++;
+                                    var tc = _touchCount(e);
+                                    for (var eventId in _tapProfiles) {
+                                        if (_tapProfiles.hasOwnProperty(eventId)) {
+                                            var p = _tapProfiles[eventId];
+                                            if (p.touches === tc && (p.taps === 1 || p.taps === tt.taps)) {
+                                                for (var i = 0; i < tt[eventId].length; i++) {
+                                                    pathInfo = _pi(e, target, obj, tt[eventId][i][1] != null);
+                                                    for (var pLoop = 0; pLoop < pathInfo.end; pLoop++) {
+                                                        currentTarget = pathInfo.path[pLoop];
+                                                        // this is a single event registration handler.
+                                                        if (tt[eventId][i][1] == null || matchesSelector(currentTarget, tt[eventId][i][1], obj)) {
+                                                            tt[eventId][i][0].apply(currentTarget, [ e ]);
+                                                            break;
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            },
+                            clearSingle = function () {
+                                tt.down = false;
+                            },
+                            clearDouble = function () {
+                                tt.taps = 0;
+                            };
+
+                        DefaultHandler(obj, "mousedown", down);
+                        DefaultHandler(obj, "mouseup", up);
+                    }
+                    // add this child selector (it can be null, that's fine).
+                    obj.__taTapHandler.downSelectors.push(children);
+
+                    obj.__taTapHandler[evt].push([fn, children]);
+                    // the unstore function removes this function from the object's listener list for this type.
+                    fn.__taUnstore = function () {
+                        _d(obj.__taTapHandler[evt], fn);
+                    };
+                }
+            };
+        },
+        meeHelper = function (type, evt, obj, target) {
+            for (var i in obj.__tamee[type]) {
+                if (obj.__tamee[type].hasOwnProperty(i)) {
+                    obj.__tamee[type][i].apply(target, [ evt ]);
+                }
+            }
+        },
+        MouseEnterExitHandler = function () {
+            var activeElements = [];
+            return function (obj, evt, fn, children) {
+                if (!obj.__tamee) {
+                    // __tamee holds a flag saying whether the mouse is currently "in" the element, and a list of
+                    // both mouseenter and mouseexit functions.
+                    obj.__tamee = { over: false, mouseenter: [], mouseexit: [] };
+                    // register over and out functions
+                    var over = function (e) {
+                            var t = _t(e);
+                            if ((children == null && (t == obj && !obj.__tamee.over)) || (matchesSelector(t, children, obj) && (t.__tamee == null || !t.__tamee.over))) {
+                                meeHelper("mouseenter", e, obj, t);
+                                t.__tamee = t.__tamee || {};
+                                t.__tamee.over = true;
+                                activeElements.push(t);
+                            }
+                        },
+                        out = function (e) {
+                            var t = _t(e);
+                            // is the current target one of the activeElements? and is the
+                            // related target NOT a descendant of it?
+                            for (var i = 0; i < activeElements.length; i++) {
+                                if (t == activeElements[i] && !matchesSelector((e.relatedTarget || e.toElement), "*", t)) {
+                                    t.__tamee.over = false;
+                                    activeElements.splice(i, 1);
+                                    meeHelper("mouseexit", e, obj, t);
+                                }
+                            }
+                        };
+
+                    _bind(obj, "mouseover", _curryChildFilter(children, obj, over, "mouseover"), over);
+                    _bind(obj, "mouseout", _curryChildFilter(children, obj, out, "mouseout"), out);
+                }
+
+                fn.__taUnstore = function () {
+                    delete obj.__tamee[evt][fn.__tauid];
+                };
+
+                _store(obj, evt, fn);
+                obj.__tamee[evt][fn.__tauid] = fn;
+            };
+        },
+        isTouchDevice = "ontouchstart" in document.documentElement,
+        isMouseDevice = "onmousedown" in document.documentElement,
+        touchMap = { "mousedown": "touchstart", "mouseup": "touchend", "mousemove": "touchmove" },
+        touchstart = "touchstart", touchend = "touchend", touchmove = "touchmove",
+        iev = (function () {
+            var rv = -1;
+            if (navigator.appName == 'Microsoft Internet Explorer') {
+                var ua = navigator.userAgent,
+                    re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
+                if (re.exec(ua) != null)
+                    rv = parseFloat(RegExp.$1);
+            }
+            return rv;
+        })(),
+        isIELT9 = iev > -1 && iev < 9,
+        _genLoc = function (e, prefix) {
+            if (e == null) return [ 0, 0 ];
+            var ts = _touches(e), t = _getTouch(ts, 0);
+            return [t[prefix + "X"], t[prefix + "Y"]];
+        },
+        _pageLocation = function (e) {
+            if (e == null) return [ 0, 0 ];
+            if (isIELT9) {
+                return [ e.clientX + document.documentElement.scrollLeft, e.clientY + document.documentElement.scrollTop ];
+            }
+            else {
+                return _genLoc(e, "page");
+            }
+        },
+        _screenLocation = function (e) {
+            return _genLoc(e, "screen");
+        },
+        _clientLocation = function (e) {
+            return _genLoc(e, "client");
+        },
+        _getTouch = function (touches, idx) {
+            return touches.item ? touches.item(idx) : touches[idx];
+        },
+        _touches = function (e) {
+            return e.touches && e.touches.length > 0 ? e.touches :
+                    e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches :
+                    e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches :
+                [ e ];
+        },
+        _touchCount = function (e) {
+            return _touches(e).length;
+        },
+    //http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
+        _bind = function (obj, type, fn, originalFn) {
+            _store(obj, type, fn);
+            originalFn.__tauid = fn.__tauid;
+            if (obj.addEventListener)
+                obj.addEventListener(type, fn, false);
+            else if (obj.attachEvent) {
+                var key = type + fn.__tauid;
+                obj["e" + key] = fn;
+                // TODO look at replacing with .call(..)
+                obj[key] = function () {
+                    obj["e" + key] && obj["e" + key](window.event);
+                };
+                obj.attachEvent("on" + type, obj[key]);
+            }
+        },
+        _unbind = function (obj, type, fn) {
+            if (fn == null) return;
+            _each(obj, function () {
+                var _el = _gel(this);
+                _unstore(_el, type, fn);
+                // it has been bound if there is a tauid. otherwise it was not bound and we can ignore it.
+                if (fn.__tauid != null) {
+                    if (_el.removeEventListener) {
+                        _el.removeEventListener(type, fn, false);
+                        if (isTouchDevice && touchMap[type]) _el.removeEventListener(touchMap[type], fn, false);
+                    }
+                    else if (this.detachEvent) {
+                        var key = type + fn.__tauid;
+                        _el[key] && _el.detachEvent("on" + type, _el[key]);
+                        _el[key] = null;
+                        _el["e" + key] = null;
+                    }
+                }
+
+                // if a touch event was also registered, deregister now.
+                if (fn.__taTouchProxy) {
+                    _unbind(obj, fn.__taTouchProxy[1], fn.__taTouchProxy[0]);
+                }
+            });
+        },
+        _each = function (obj, fn) {
+            if (obj == null) return;
+            // if a list (or list-like), use it. if a string, get a list
+            // by running the string through querySelectorAll. else, assume
+            // it's an Element.
+            // obj.top is "unknown" in IE8.
+            obj = (typeof Window !== "undefined" && (typeof obj.top !== "unknown" && obj == obj.top)) ? [ obj ] :
+                    (typeof obj !== "string") && (obj.tagName == null && obj.length != null) ? obj :
+                    typeof obj === "string" ? document.querySelectorAll(obj)
+                : [ obj ];
+
+            for (var i = 0; i < obj.length; i++)
+                fn.apply(obj[i]);
+        };
+
+    /**
+     * Mottle offers support for abstracting out the differences
+     * between touch and mouse devices, plus "smart click" functionality
+     * (don't fire click if the mouse has moved between mousedown and mouseup),
+     * and synthesized click/tap events.
+     * @class Mottle
+     * @constructor
+     * @param {Object} params Constructor params
+     * @param {Number} [params.clickThreshold=250] Threshold, in milliseconds beyond which a touchstart followed by a touchend is not considered to be a click.
+     * @param {Number} [params.dblClickThreshold=450] Threshold, in milliseconds beyond which two successive tap events are not considered to be a click.
+     * @param {Boolean} [params.smartClicks=false] If true, won't fire click events if the mouse has moved between mousedown and mouseup. Note that this functionality
+     * requires that Mottle consume the mousedown event, and so may not be viable in all use cases.
+     */
+    root.Mottle = function (params) {
+        params = params || {};
+        var clickThreshold = params.clickThreshold || 250,
+            dblClickThreshold = params.dblClickThreshold || 450,
+            mouseEnterExitHandler = new MouseEnterExitHandler(),
+            tapHandler = new TapHandler(clickThreshold, dblClickThreshold),
+            _smartClicks = params.smartClicks,
+            _doBind = function (obj, evt, fn, children) {
+                if (fn == null) return;
+                _each(obj, function () {
+                    var _el = _gel(this);
+                    if (_smartClicks && evt === "click")
+                        SmartClickHandler(_el, evt, fn, children);
+                    else if (evt === "tap" || evt === "dbltap" || evt === "contextmenu") {
+                        tapHandler(_el, evt, fn, children);
+                    }
+                    else if (evt === "mouseenter" || evt == "mouseexit")
+                        mouseEnterExitHandler(_el, evt, fn, children);
+                    else
+                        DefaultHandler(_el, evt, fn, children);
+                });
+            };
+
+        /**
+         * Removes an element from the DOM, and deregisters all event handlers for it. You should use this
+         * to ensure you don't leak memory.
+         * @method remove
+         * @param {String|Element} el Element, or id of the element, to remove.
+         * @return {Mottle} The current Mottle instance; you can chain this method.
+         */
+        this.remove = function (el) {
+            _each(el, function () {
+                var _el = _gel(this);
+                if (_el.__ta) {
+                    for (var evt in _el.__ta) {
+                        if (_el.__ta.hasOwnProperty(evt)) {
+                            for (var h in _el.__ta[evt]) {
+                                if (_el.__ta[evt].hasOwnProperty(h))
+                                    _unbind(_el, evt, _el.__ta[evt][h]);
+                            }
+                        }
+                    }
+                }
+                _el.parentNode && _el.parentNode.removeChild(_el);
+            });
+            return this;
+        };
+
+        /**
+         * Register an event handler, optionally as a delegate for some set of descendant elements. Note
+         * that this method takes either 3 or 4 arguments - if you supply 3 arguments it is assumed you have
+         * omitted the `children` parameter, and that the event handler should be bound directly to the given element.
+         * @method on
+         * @param {Element[]|Element|String} el Either an Element, or a CSS spec for a list of elements, or an array of Elements.
+         * @param {String} [children] Comma-delimited list of selectors identifying allowed children.
+         * @param {String} event Event ID.
+         * @param {Function} fn Event handler function.
+         * @return {Mottle} The current Mottle instance; you can chain this method.
+         */
+        this.on = function (el, event, children, fn) {
+            var _el = arguments[0],
+                _c = arguments.length == 4 ? arguments[2] : null,
+                _e = arguments[1],
+                _f = arguments[arguments.length - 1];
+
+            _doBind(_el, _e, _f, _c);
+            return this;
+        };
+
+        /**
+         * Cancel delegate event handling for the given function. Note that unlike with 'on' you do not supply
+         * a list of child selectors here: it removes event delegation from all of the child selectors for which the
+         * given function was registered (if any).
+         * @method off
+         * @param {Element[]|Element|String} el Element - or ID of element - from which to remove event listener.
+         * @param {String} event Event ID.
+         * @param {Function} fn Event handler function.
+         * @return {Mottle} The current Mottle instance; you can chain this method.
+         */
+        this.off = function (el, event, fn) {
+            _unbind(el, event, fn);
+            return this;
+        };
+
+        /**
+         * Triggers some event for a given element.
+         * @method trigger
+         * @param {Element} el Element for which to trigger the event.
+         * @param {String} event Event ID.
+         * @param {Event} originalEvent The original event. Should be optional of course, but currently is not, due
+         * to the jsPlumb use case that caused this method to be added.
+         * @param {Object} [payload] Optional object to set as `payload` on the generated event; useful for message passing.
+         * @return {Mottle} The current Mottle instance; you can chain this method.
+         */
+        this.trigger = function (el, event, originalEvent, payload) {
+            // MouseEvent undefined in old IE; that's how we know it's a mouse event.  A fine Microsoft paradox.
+            var originalIsMouse = isMouseDevice && (typeof MouseEvent === "undefined" || originalEvent == null || originalEvent.constructor === MouseEvent);
+
+            var eventToBind = (isTouchDevice && !isMouseDevice && touchMap[event]) ? touchMap[event] : event,
+                bindingAMouseEvent = !(isTouchDevice && !isMouseDevice && touchMap[event]);
+
+            var pl = _pageLocation(originalEvent), sl = _screenLocation(originalEvent), cl = _clientLocation(originalEvent);
+            _each(el, function () {
+                var _el = _gel(this), evt;
+                originalEvent = originalEvent || {
+                    screenX: sl[0],
+                    screenY: sl[1],
+                    clientX: cl[0],
+                    clientY: cl[1]
+                };
+
+                var _decorate = function (_evt) {
+                    if (payload) _evt.payload = payload;
+                };
+
+                var eventGenerators = {
+                    "TouchEvent": function (evt) {
+                        var touch = document.createTouch(window, _el, 0, pl[0], pl[1],
+                            sl[0], sl[1],
+                            cl[0], cl[1],
+                            0, 0, 0, 0);
+
+                        // https://gist.github.com/sstephenson/448808
+                        var touches = document.createTouchList(touch);
+                        var targetTouches = document.createTouchList(touch);
+                        var changedTouches = document.createTouchList(touch);
+                        evt.initTouchEvent(eventToBind, true, true, window, null, sl[0], sl[1],
+                            cl[0], cl[1], false, false, false, false,
+                            touches, targetTouches, changedTouches, 1, 0);
+                    },
+                    "MouseEvents": function (evt) {
+                        evt.initMouseEvent(eventToBind, true, true, window, 0,
+                            sl[0], sl[1],
+                            cl[0], cl[1],
+                            false, false, false, false, 1, _el);
+
+                        if (Sniff.android) {
+                            // Android's touch events are not standard.
+                            var t = document.createTouch(window, _el, 0, pl[0], pl[1],
+                                sl[0], sl[1],
+                                cl[0], cl[1],
+                                0, 0, 0, 0);
+
+                            evt.touches = evt.targetTouches = evt.changedTouches = document.createTouchList(t);
+                        }
+                    }
+                };
+
+                if (document.createEvent) {
+
+                    var ite = !bindingAMouseEvent && !originalIsMouse && (isTouchDevice && touchMap[event] && !Sniff.android),
+                        evtName = ite ? "TouchEvent" : "MouseEvents";
+
+                    evt = document.createEvent(evtName);
+                    eventGenerators[evtName](evt);
+                    _decorate(evt);
+                    _el.dispatchEvent(evt);
+                }
+                else if (document.createEventObject) {
+                    evt = document.createEventObject();
+                    evt.eventType = evt.eventName = eventToBind;
+                    evt.screenX = sl[0];
+                    evt.screenY = sl[1];
+                    evt.clientX = cl[0];
+                    evt.clientY = cl[1];
+                    _decorate(evt);
+                    _el.fireEvent('on' + eventToBind, evt);
+                }
+            });
+            return this;
+        }
+    };
+
+    /**
+     * Static method to assist in 'consuming' an element: uses `stopPropagation` where available, or sets
+     * `e.returnValue=false` where it is not.
+     * @method Mottle.consume
+     * @param {Event} e Event to consume
+     * @param {Boolean} [doNotPreventDefault=false] If true, does not call `preventDefault()` on the event.
+     */
+    root.Mottle.consume = function (e, doNotPreventDefault) {
+        if (e.stopPropagation)
+            e.stopPropagation();
+        else
+            e.returnValue = false;
+
+        if (!doNotPreventDefault && e.preventDefault)
+            e.preventDefault();
+    };
+
+    /**
+     * Gets the page location corresponding to the given event. For touch events this means get the page location of the first touch.
+     * @method Mottle.pageLocation
+     * @param {Event} e Event to get page location for.
+     * @return {Number[]} [left, top] for the given event.
+     */
+    root.Mottle.pageLocation = _pageLocation;
+
+    /**
+     * Forces touch events to be turned "on". Useful for testing: even if you don't have a touch device, you can still
+     * trigger a touch event when this is switched on and it will be captured and acted on.
+     * @method setForceTouchEvents
+     * @param {Boolean} value If true, force touch events to be on.
+     */
+    root.Mottle.setForceTouchEvents = function (value) {
+        isTouchDevice = value;
+    };
+
+    /**
+     * Forces mouse events to be turned "on". Useful for testing: even if you don't have a mouse, you can still
+     * trigger a mouse event when this is switched on and it will be captured and acted on.
+     * @method setForceMouseEvents
+     * @param {Boolean} value If true, force mouse events to be on.
+     */
+    root.Mottle.setForceMouseEvents = function (value) {
+        isMouseDevice = value;
+    };
+
+    root.Mottle.version = "0.8.0";
+
+    if (true) {
+        exports.Mottle = root.Mottle;
+    }
+
+}).call(typeof window === "undefined" ? this : window);
+
+/**
+ drag/drop functionality for use with jsPlumb but with
+ no knowledge of jsPlumb. supports multiple scopes (separated by whitespace), dragging
+ multiple elements, constrain to parent, drop filters, drag start filters, custom
+ css classes.
+
+ a lot of the functionality of this script is expected to be plugged in:
+
+ addClass
+ removeClass
+
+ addEvent
+ removeEvent
+
+ getPosition
+ setPosition
+ getSize
+
+ indexOf
+ intersects
+
+ the name came from here:
+
+ http://mrsharpoblunto.github.io/foswig.js/
+
+ copyright 2016 jsPlumb
+ */
+
+;(function() {
+
+    "use strict";
+    var root = this;
+
+    var _suggest = function(list, item, head) {
+        if (list.indexOf(item) === -1) {
+            head ? list.unshift(item) : list.push(item);
+            return true;
+        }
+        return false;
+    };
+
+    var _vanquish = function(list, item) {
+        var idx = list.indexOf(item);
+        if (idx != -1) list.splice(idx, 1);
+    };
+
+    var _difference = function(l1, l2) {
+        var d = [];
+        for (var i = 0; i < l1.length; i++) {
+            if (l2.indexOf(l1[i]) == -1)
+                d.push(l1[i]);
+        }
+        return d;
+    };
+
+    var _isString = function(f) {
+        return f == null ? false : (typeof f === "string" || f.constructor == String);
+    };
+
+    var getOffsetRect = function (elem) {
+        // (1)
+        var box = elem.getBoundingClientRect(),
+            body = document.body,
+            docElem = document.documentElement,
+        // (2)
+            scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop,
+            scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft,
+        // (3)
+            clientTop = docElem.clientTop || body.clientTop || 0,
+            clientLeft = docElem.clientLeft || body.clientLeft || 0,
+        // (4)
+            top  = box.top +  scrollTop - clientTop,
+            left = box.left + scrollLeft - clientLeft;
+
+        return { top: Math.round(top), left: Math.round(left) };
+    };
+
+    var matchesSelector = function(el, selector, ctx) {
+        ctx = ctx || el.parentNode;
+        var possibles = ctx.querySelectorAll(selector);
+        for (var i = 0; i < possibles.length; i++) {
+            if (possibles[i] === el)
+                return true;
+        }
+        return false;
+    };
+
+    var iev = (function() {
+            var rv = -1;
+            if (navigator.appName == 'Microsoft Internet Explorer') {
+                var ua = navigator.userAgent,
+                    re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
+                if (re.exec(ua) != null)
+                    rv = parseFloat(RegExp.$1);
+            }
+            return rv;
+        })(),
+        DEFAULT_GRID_X = 50,
+        DEFAULT_GRID_Y = 50,
+        isIELT9 = iev > -1 && iev < 9,
+        isIE9 = iev == 9,
+        _pl = function(e) {
+            if (isIELT9) {
+                return [ e.clientX + document.documentElement.scrollLeft, e.clientY + document.documentElement.scrollTop ];
+            }
+            else {
+                var ts = _touches(e), t = _getTouch(ts, 0);
+                // for IE9 pageX might be null if the event was synthesized. We try for pageX/pageY first,
+                // falling back to clientX/clientY if necessary. In every other browser we want to use pageX/pageY.
+                return isIE9 ? [t.pageX || t.clientX, t.pageY || t.clientY] : [t.pageX, t.pageY];
+            }
+        },
+        _getTouch = function(touches, idx) { return touches.item ? touches.item(idx) : touches[idx]; },
+        _touches = function(e) {
+            return e.touches && e.touches.length > 0 ? e.touches :
+                    e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches :
+                    e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches :
+                [ e ];
+        },
+        _classes = {
+            draggable:"katavorio-draggable",    // draggable elements
+            droppable:"katavorio-droppable",    // droppable elements
+            drag : "katavorio-drag",            // elements currently being dragged
+            selected:"katavorio-drag-selected", // elements in current drag selection
+            active : "katavorio-drag-active",   // droppables that are targets of a currently dragged element
+            hover : "katavorio-drag-hover",     // droppables over which a matching drag element is hovering
+            noSelect : "katavorio-drag-no-select", // added to the body to provide a hook to suppress text selection
+            ghostProxy:"katavorio-ghost-proxy"  // added to a ghost proxy element in use when a drag has exited the bounds of its parent.
+        },
+        _defaultScope = "katavorio-drag-scope",
+        _events = [ "stop", "start", "drag", "drop", "over", "out", "beforeStart" ],
+        _devNull = function() {},
+        _true = function() { return true; },
+        _foreach = function(l, fn, from) {
+            for (var i = 0; i < l.length; i++) {
+                if (l[i] != from)
+                    fn(l[i]);
+            }
+        },
+        _setDroppablesActive = function(dd, val, andHover, drag) {
+            _foreach(dd, function(e) {
+                e.setActive(val);
+                if (val) e.updatePosition();
+                if (andHover) e.setHover(drag, val);
+            });
+        },
+        _each = function(obj, fn) {
+            if (obj == null) return;
+            obj = !_isString(obj) && (obj.tagName == null && obj.length != null) ? obj : [ obj ];
+            for (var i = 0; i < obj.length; i++)
+                fn.apply(obj[i], [ obj[i] ]);
+        },
+        _consume = function(e) {
+            if (e.stopPropagation) {
+                e.stopPropagation();
+                e.preventDefault();
+            }
+            else {
+                e.returnValue = false;
+            }
+        },
+        _defaultInputFilterSelector = "input,textarea,select,button,option",
+    //
+    // filters out events on all input elements, like textarea, checkbox, input, select.
+        _inputFilter = function(e, el, _katavorio) {
+            var t = e.srcElement || e.target;
+            return !matchesSelector(t, _katavorio.getInputFilterSelector(), el);
+        };
+
+    var Super = function(el, params, css, scope) {
+        this.params = params || {};
+        this.el = el;
+        this.params.addClass(this.el, this._class);
+        this.uuid = _uuid();
+        var enabled = true;
+        this.setEnabled = function(e) { enabled = e; };
+        this.isEnabled = function() { return enabled; };
+        this.toggleEnabled = function() { enabled = !enabled; };
+        this.setScope = function(scopes) {
+            this.scopes = scopes ? scopes.split(/\s+/) : [ scope ];
+        };
+        this.addScope = function(scopes) {
+            var m = {};
+            _each(this.scopes, function(s) { m[s] = true;});
+            _each(scopes ? scopes.split(/\s+/) : [], function(s) { m[s] = true;});
+            this.scopes = [];
+            for (var i in m) this.scopes.push(i);
+        };
+        this.removeScope = function(scopes) {
+            var m = {};
+            _each(this.scopes, function(s) { m[s] = true;});
+            _each(scopes ? scopes.split(/\s+/) : [], function(s) { delete m[s];});
+            this.scopes = [];
+            for (var i in m) this.scopes.push(i);
+        };
+        this.toggleScope = function(scopes) {
+            var m = {};
+            _each(this.scopes, function(s) { m[s] = true;});
+            _each(scopes ? scopes.split(/\s+/) : [], function(s) {
+                if (m[s]) delete m[s];
+                else m[s] = true;
+            });
+            this.scopes = [];
+            for (var i in m) this.scopes.push(i);
+        };
+        this.setScope(params.scope);
+        this.k = params.katavorio;
+        return params.katavorio;
+    };
+
+    var TRUE = function() { return true; };
+    var FALSE = function() { return false; };
+
+    var Drag = function(el, params, css, scope) {
+        this._class = css.draggable;
+        var k = Super.apply(this, arguments);
+        this.rightButtonCanDrag = this.params.rightButtonCanDrag;
+        var downAt = [0,0], posAtDown = null, pagePosAtDown = null, pageDelta = [0,0], moving = false,
+            consumeStartEvent = this.params.consumeStartEvent !== false,
+            dragEl = this.el,
+            clone = this.params.clone,
+            scroll = this.params.scroll,
+            _multipleDrop = params.multipleDrop !== false,
+            isConstrained = false,
+            useGhostProxy = params.ghostProxy === true ? TRUE : params.ghostProxy && typeof params.ghostProxy === "function" ? params.ghostProxy : FALSE,
+            ghostProxy = function(el) { return el.cloneNode(true); };
+
+        var snapThreshold = params.snapThreshold || 5,
+            _snap = function(pos, x, y, thresholdX, thresholdY) {
+                thresholdX = thresholdX || snapThreshold;
+                thresholdY = thresholdY || snapThreshold;
+                var _dx = Math.floor(pos[0] / x),
+                    _dxl = x * _dx,
+                    _dxt = _dxl + x,
+                    _x = Math.abs(pos[0] - _dxl) <= thresholdX ? _dxl : Math.abs(_dxt - pos[0]) <= thresholdX ? _dxt : pos[0];
+
+                var _dy = Math.floor(pos[1] / y),
+                    _dyl = y * _dy,
+                    _dyt = _dyl + y,
+                    _y = Math.abs(pos[1] - _dyl) <= thresholdY ? _dyl : Math.abs(_dyt - pos[1]) <= thresholdY ? _dyt : pos[1];
+
+                return [ _x, _y];
+            };
+
+        this.posses = [];
+        this.posseRoles = {};
+
+        this.toGrid = function(pos) {
+            if (this.params.grid == null) {
+                return pos;
+            }
+            else {
+                return _snap(pos, this.params.grid[0], this.params.grid[1]);
+            }
+        };
+
+        this.snap = function(x, y) {
+            if (dragEl == null) return;
+            x = x || (this.params.grid ? this.params.grid[0] : DEFAULT_GRID_X);
+            y = y || (this.params.grid ? this.params.grid[1] : DEFAULT_GRID_Y);
+            var p = this.params.getPosition(dragEl);
+            this.params.setPosition(dragEl, _snap(p, x, y, x, y));
+        };
+
+        this.setUseGhostProxy = function(val) {
+            useGhostProxy = val ? TRUE : FALSE;
+        };
+
+        var constrain;
+        var negativeFilter = function(pos) {
+            return (params.allowNegative === false) ? [ Math.max (0, pos[0]), Math.max(0, pos[1]) ] : pos;
+        };
+
+        var _setConstrain = function(value) {
+            constrain = typeof value === "function" ? value : value ? function(pos) {
+                return negativeFilter([
+                    Math.max(0, Math.min(constrainRect.w - this.size[0], pos[0])),
+                    Math.max(0, Math.min(constrainRect.h - this.size[1], pos[1]))
+                ]);
+            }.bind(this) : function(pos) { return negativeFilter(pos); };
+        }.bind(this);
+
+        _setConstrain(typeof this.params.constrain === "function" ? this.params.constrain  : (this.params.constrain || this.params.containment));
+
+
+        /**
+         * Sets whether or not the Drag is constrained. A value of 'true' means constrain to parent bounds; a function
+         * will be executed and returns true if the position is allowed.
+         * @param value
+         */
+        this.setConstrain = function(value) {
+            _setConstrain(value);
+        };
+
+        var revertFunction;
+        /**
+         * Sets a function to call on drag stop, which, if it returns true, indicates that the given element should
+         * revert to its position before the previous drag.
+         * @param fn
+         */
+        this.setRevert = function(fn) {
+            revertFunction = fn;
+        };
+
+        var _assignId = function(obj) {
+                if (typeof obj == "function") {
+                    obj._katavorioId = _uuid();
+                    return obj._katavorioId;
+                } else {
+                    return obj;
+                }
+            },
+        // a map of { spec -> [ fn, exclusion ] } entries.
+            _filters = {},
+            _testFilter = function(e) {
+                for (var key in _filters) {
+                    var f = _filters[key];
+                    var rv = f[0](e);
+                    if (f[1]) rv = !rv;
+                    if (!rv) return false;
+                }
+                return true;
+            },
+            _setFilter = this.setFilter = function(f, _exclude) {
+                if (f) {
+                    var key = _assignId(f);
+                    _filters[key] = [
+                        function(e) {
+                            var t = e.srcElement || e.target, m;
+                            if (_isString(f)) {
+                                m = matchesSelector(t, f, el);
+                            }
+                            else if (typeof f === "function") {
+                                m = f(e, el);
+                            }
+                            return m;
+                        },
+                            _exclude !== false
+                    ];
+
+                }
+            },
+            _addFilter = this.addFilter = _setFilter,
+            _removeFilter = this.removeFilter = function(f) {
+                var key = typeof f == "function" ? f._katavorioId : f;
+                delete _filters[key];
+            };
+
+        this.clearAllFilters = function() {
+            _filters = {};
+        };
+
+        this.canDrag = this.params.canDrag || _true;
+
+        var constrainRect,
+            matchingDroppables = [], intersectingDroppables = [];
+
+        this.downListener = function(e) {
+            var isNotRightClick = this.rightButtonCanDrag || (e.which !== 3 && e.button !== 2);
+            if (isNotRightClick && this.isEnabled() && this.canDrag()) {
+                var _f =  _testFilter(e) && _inputFilter(e, this.el, this.k);
+                if (_f) {
+                    if (!clone)
+                        dragEl = this.el;
+                    else {
+                        dragEl = this.el.cloneNode(true);
+                        dragEl.setAttribute("id", null);
+                        dragEl.style.position = "absolute";
+                        // the clone node is added to the body; getOffsetRect gives us a value
+                        // relative to the body.
+                        var b = getOffsetRect(this.el);
+                        dragEl.style.left = b.left + "px";
+                        dragEl.style.top = b.top + "px";
+                        document.body.appendChild(dragEl);
+                    }
+                    consumeStartEvent && _consume(e);
+                    downAt = _pl(e);
+                    //
+                    this.params.bind(document, "mousemove", this.moveListener);
+                    this.params.bind(document, "mouseup", this.upListener);
+                    k.markSelection(this);
+                    k.markPosses(this);
+                    this.params.addClass(document.body, css.noSelect);
+                    _dispatch("beforeStart", {el:this.el, pos:posAtDown, e:e, drag:this});
+                }
+                else if (this.params.consumeFilteredEvents) {
+                    _consume(e);
+                }
+            }
+        }.bind(this);
+
+        this.moveListener = function(e) {
+            if (downAt) {
+                if (!moving) {
+                    var _continue = _dispatch("start", {el:this.el, pos:posAtDown, e:e, drag:this});
+                    if (_continue !== false) {
+                        if (!downAt) return;
+                        this.mark(true);
+                        moving = true;
+                    }
+                }
+
+                // it is possible that the start event caused the drag to be aborted. So we check
+                // again that we are currently dragging.
+                if (downAt) {
+                    intersectingDroppables.length = 0;
+                    var pos = _pl(e), dx = pos[0] - downAt[0], dy = pos[1] - downAt[1],
+                        z = this.params.ignoreZoom ? 1 : k.getZoom();
+                    dx /= z;
+                    dy /= z;
+                    this.moveBy(dx, dy, e);
+                    k.updateSelection(dx, dy, this);
+                    k.updatePosses(dx, dy, this);
+                }
+            }
+        }.bind(this);
+
+        this.upListener = function(e) {
+            if (downAt) {
+                downAt = null;
+                this.params.unbind(document, "mousemove", this.moveListener);
+                this.params.unbind(document, "mouseup", this.upListener);
+                this.params.removeClass(document.body, css.noSelect);
+                this.unmark(e);
+                k.unmarkSelection(this, e);
+                k.unmarkPosses(this, e);
+                this.stop(e);
+                k.notifySelectionDragStop(this, e);
+                k.notifyPosseDragStop(this, e);
+                moving = false;
+                if (clone) {
+                    dragEl && dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
+                    dragEl = null;
+                }
+
+                intersectingDroppables.length = 0;
+
+                if (revertFunction && revertFunction(this.el, this.params.getPosition(this.el)) === true) {
+                    this.params.setPosition(this.el, posAtDown);
+                    _dispatch("revert", this.el);
+                }
+            }
+        }.bind(this);
+
+        this.getFilters = function() { return _filters; };
+
+        this.abort = function() {
+            if (downAt != null)
+                this.upListener();
+        };
+
+        this.getDragElement = function() {
+            return dragEl || this.el;
+        };
+
+        var listeners = {"start":[], "drag":[], "stop":[], "over":[], "out":[], "beforeStart":[], "revert":[] };
+        if (params.events.start) listeners.start.push(params.events.start);
+        if (params.events.beforeStart) listeners.beforeStart.push(params.events.beforeStart);
+        if (params.events.stop) listeners.stop.push(params.events.stop);
+        if (params.events.drag) listeners.drag.push(params.events.drag);
+        if (params.events.revert) listeners.revert.push(params.events.revert);
+
+        this.on = function(evt, fn) {
+            if (listeners[evt]) listeners[evt].push(fn);
+        };
+
+        this.off = function(evt, fn) {
+            if (listeners[evt]) {
+                var l = [];
+                for (var i = 0; i < listeners[evt].length; i++) {
+                    if (listeners[evt][i] !== fn) l.push(listeners[evt][i]);
+                }
+                listeners[evt] = l;
+            }
+        };
+
+        var _dispatch = function(evt, value) {
+            if (listeners[evt]) {
+                for (var i = 0; i < listeners[evt].length; i++) {
+                    try {
+                        listeners[evt][i](value);
+                    }
+                    catch (e) { }
+                }
+            }
+        };
+
+        this.notifyStart = function(e) {
+            _dispatch("start", {el:this.el, pos:this.params.getPosition(dragEl), e:e, drag:this});
+        };
+
+        this.stop = function(e, force) {
+            if (force || moving) {
+                var positions = [],
+                    sel = k.getSelection(),
+                    dPos = this.params.getPosition(dragEl);
+
+                if (sel.length > 1) {
+                    for (var i = 0; i < sel.length; i++) {
+                        var p = this.params.getPosition(sel[i].el);
+                        positions.push([ sel[i].el, { left: p[0], top: p[1] }, sel[i] ]);
+                    }
+                }
+                else {
+                    positions.push([ dragEl, {left:dPos[0], top:dPos[1]}, this ]);
+                }
+
+                _dispatch("stop", {
+                    el: dragEl,
+                    pos: ghostProxyOffsets || dPos,
+                    finalPos:dPos,
+                    e: e,
+                    drag: this,
+                    selection:positions
+                });
+            }
+        };
+
+        this.mark = function(andNotify) {
+            posAtDown = this.params.getPosition(dragEl);
+            pagePosAtDown = this.params.getPosition(dragEl, true);
+            pageDelta = [pagePosAtDown[0] - posAtDown[0], pagePosAtDown[1] - posAtDown[1]];
+            this.size = this.params.getSize(dragEl);
+            matchingDroppables = k.getMatchingDroppables(this);
+            _setDroppablesActive(matchingDroppables, true, false, this);
+            this.params.addClass(dragEl, this.params.dragClass || css.drag);
+            //if (this.params.constrain || this.params.containment) {
+            var cs = this.params.getSize(dragEl.parentNode);
+            constrainRect = { w:cs[0], h:cs[1] };
+            //}
+            if (andNotify) {
+                k.notifySelectionDragStart(this);
+            }
+        };
+        var ghostProxyOffsets;
+        this.unmark = function(e, doNotCheckDroppables) {
+            _setDroppablesActive(matchingDroppables, false, true, this);
+
+
+            if (isConstrained && useGhostProxy(this.el)) {
+                ghostProxyOffsets = [dragEl.offsetLeft, dragEl.offsetTop];
+                this.el.parentNode.removeChild(dragEl);
+                dragEl = this.el;
+            }
+            else {
+                ghostProxyOffsets = null;
+            }
+
+            this.params.removeClass(dragEl, this.params.dragClass || css.drag);
+            matchingDroppables.length = 0;
+            isConstrained = false;
+            if (!doNotCheckDroppables) {
+                if (intersectingDroppables.length > 0 && ghostProxyOffsets) {
+                    params.setPosition(this.el, ghostProxyOffsets);
+                }
+                intersectingDroppables.sort(_rankSort);
+                for (var i = 0; i < intersectingDroppables.length; i++) {
+                    var retVal = intersectingDroppables[i].drop(this, e);
+                    if (retVal === true) break;
+                }
+            }
+        };
+        this.moveBy = function(dx, dy, e) {
+            intersectingDroppables.length = 0;
+            var desiredLoc = this.toGrid([posAtDown[0] + dx, posAtDown[1] + dy]),
+                cPos = constrain(desiredLoc, dragEl);
+
+            if (useGhostProxy(this.el)) {
+                if (desiredLoc[0] != cPos[0] || desiredLoc[1] != cPos[1]) {
+                    if (!isConstrained) {
+                        var gp = ghostProxy(this.el);
+                        params.addClass(gp, _classes.ghostProxy);
+                        this.el.parentNode.appendChild(gp);
+                        dragEl = gp;
+                        isConstrained = true;
+                    }
+                    cPos = desiredLoc;
+                }
+                else {
+                    if (isConstrained) {
+                        this.el.parentNode.removeChild(dragEl);
+                        dragEl = this.el;
+                        isConstrained = false;
+                    }
+                }
+            }
+
+            var rect = { x:cPos[0], y:cPos[1], w:this.size[0], h:this.size[1]},
+                pageRect = { x:rect.x + pageDelta[0], y:rect.y + pageDelta[1], w:rect.w, h:rect.h},
+                focusDropElement = null;
+
+
+
+            this.params.setPosition(dragEl, cPos);
+            for (var i = 0; i < matchingDroppables.length; i++) {
+                var r2 = { x:matchingDroppables[i].pagePosition[0], y:matchingDroppables[i].pagePosition[1], w:matchingDroppables[i].size[0], h:matchingDroppables[i].size[1]};
+                if (this.params.intersects(pageRect, r2) && (_multipleDrop || focusDropElement == null || focusDropElement == matchingDroppables[i].el) && matchingDroppables[i].canDrop(this)) {
+                    if (!focusDropElement) focusDropElement = matchingDroppables[i].el;
+                    intersectingDroppables.push(matchingDroppables[i]);
+                    matchingDroppables[i].setHover(this, true, e);
+                }
+                else if (matchingDroppables[i].isHover()) {
+                    matchingDroppables[i].setHover(this, false, e);
+                }
+            }
+
+            _dispatch("drag", {el:this.el, pos:cPos, e:e, drag:this});
+
+            /* test to see if the parent needs to be scrolled (future)
+             if (scroll) {
+             var pnsl = dragEl.parentNode.scrollLeft, pnst = dragEl.parentNode.scrollTop;
+             console.log("scroll!", pnsl, pnst);
+             }*/
+        };
+        this.destroy = function() {
+            this.params.unbind(this.el, "mousedown", this.downListener);
+            this.params.unbind(document, "mousemove", this.moveListener);
+            this.params.unbind(document, "mouseup", this.upListener);
+            this.downListener = null;
+            this.upListener = null;
+            this.moveListener = null;
+        };
+
+        // init:register mousedown, and perhaps set a filter
+        this.params.bind(this.el, "mousedown", this.downListener);
+
+        // if handle provded, use that.  otherwise, try to set a filter.
+        // note that a `handle` selector always results in filterExclude being set to false, ie.
+        // the selector defines the handle element(s).
+        if (this.params.handle)
+            _setFilter(this.params.handle, false);
+        else
+            _setFilter(this.params.filter, this.params.filterExclude);
+    };
+
+    var Drop = function(el, params, css, scope) {
+        this._class = css.droppable;
+        this.params = params || {};
+        this.rank = params.rank || 0;
+        this._activeClass = this.params.activeClass || css.active;
+        this._hoverClass = this.params.hoverClass || css.hover;
+        Super.apply(this, arguments);
+        var hover = false;
+        this.allowLoopback = this.params.allowLoopback !== false;
+
+        this.setActive = function(val) {
+            this.params[val ? "addClass" : "removeClass"](this.el, this._activeClass);
+        };
+
+        this.updatePosition = function() {
+            this.position = this.params.getPosition(this.el);
+            this.pagePosition = this.params.getPosition(this.el, true);
+            this.size = this.params.getSize(this.el);
+        };
+
+        this.canDrop = this.params.canDrop || function(drag) {
+            return true;
+        };
+
+        this.isHover = function() { return hover; };
+
+        this.setHover = function(drag, val, e) {
+            // if turning off hover but this was not the drag that caused the hover, ignore.
+            if (val || this.el._katavorioDragHover == null || this.el._katavorioDragHover == drag.el._katavorio) {
+                this.params[val ? "addClass" : "removeClass"](this.el, this._hoverClass);
+                //this.el._katavorioDragHover = val ? drag.el._katavorio : null;
+                this.el._katavorioDragHover = val ? drag.el._katavorio : null;
+                if (hover !== val)
+                    this.params.events[val ? "over" : "out"]({el:this.el, e:e, drag:drag, drop:this});
+                hover = val;
+            }
+        };
+
+        this.drop = function(drag, event) {
+            return this.params.events["drop"]({ drag:drag, e:event, drop:this });
+        };
+
+        this.destroy = function() {
+            this._class = null;
+            this._activeClass = null;
+            this._hoverClass = null;
+            //this.params = null;
+            hover = null;
+            //this.el = null;
+        };
+    };
+
+    var _uuid = function() {
+        return ('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
+            var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
+            return v.toString(16);
+        }));
+    };
+
+    var _rankSort = function(a,b) {
+        return a.rank < b.rank ? 1 : a.rank > b.rank ? -1 : 0;
+    };
+
+    var _gel = function(el) {
+        if (el == null) return null;
+        el = (typeof el === "string" || el.constructor == String)  ? document.getElementById(el) : el;
+        if (el == null) return null;
+        el._katavorio = el._katavorio || _uuid();
+        return el;
+    };
+
+    root.Katavorio = function(katavorioParams) {
+
+        var _selection = [],
+            _selectionMap = {};
+
+        this._dragsByScope = {};
+        this._dropsByScope = {};
+        var _zoom = 1,
+            _reg = function(obj, map) {
+                _each(obj, function(_obj) {
+                    for(var i = 0; i < _obj.scopes.length; i++) {
+                        map[_obj.scopes[i]] = map[_obj.scopes[i]] || [];
+                        map[_obj.scopes[i]].push(_obj);
+                    }
+                });
+            },
+            _unreg = function(obj, map) {
+                var c = 0;
+                _each(obj, function(_obj) {
+                    for(var i = 0; i < _obj.scopes.length; i++) {
+                        if (map[_obj.scopes[i]]) {
+                            var idx = katavorioParams.indexOf(map[_obj.scopes[i]], _obj);
+                            if (idx != -1) {
+                                map[_obj.scopes[i]].splice(idx, 1);
+                                c++;
+                            }
+                        }
+                    }
+                });
+
+                return c > 0 ;
+            },
+            _getMatchingDroppables = this.getMatchingDroppables = function(drag) {
+                var dd = [], _m = {};
+                for (var i = 0; i < drag.scopes.length; i++) {
+                    var _dd = this._dropsByScope[drag.scopes[i]];
+                    if (_dd) {
+                        for (var j = 0; j < _dd.length; j++) {
+                            if (_dd[j].canDrop(drag) &&  !_m[_dd[j].uuid] && (_dd[j].allowLoopback || _dd[j].el !== drag.el)) {
+                                _m[_dd[j].uuid] = true;
+                                dd.push(_dd[j]);
+                            }
+                        }
+                    }
+                }
+                dd.sort(_rankSort);
+                return dd;
+            },
+            _prepareParams = function(p) {
+                p = p || {};
+                var _p = {
+                    events:{}
+                }, i;
+                for (i in katavorioParams) _p[i] = katavorioParams[i];
+                for (i in p) _p[i] = p[i];
+                // events
+
+                for (i = 0; i < _events.length; i++) {
+                    _p.events[_events[i]] = p[_events[i]] || _devNull;
+                }
+                _p.katavorio = this;
+                return _p;
+            }.bind(this),
+            _mistletoe = function(existingDrag, params) {
+                for (var i = 0; i < _events.length; i++) {
+                    if (params[_events[i]]) {
+                        existingDrag.on(_events[i], params[_events[i]]);
+                    }
+                }
+            }.bind(this),
+            _css = {},
+            overrideCss = katavorioParams.css || {},
+            _scope = katavorioParams.scope || _defaultScope;
+
+        // prepare map of css classes based on defaults frst, then optional overrides
+        for (var i in _classes) _css[i] = _classes[i];
+        for (var i in overrideCss) _css[i] = overrideCss[i];
+
+        var inputFilterSelector = katavorioParams.inputFilterSelector || _defaultInputFilterSelector;
+        /**
+         * Gets the selector identifying which input elements to filter from drag events.
+         * @method getInputFilterSelector
+         * @return {String} Current input filter selector.
+         */
+        this.getInputFilterSelector = function() { return inputFilterSelector; };
+
+        /**
+         * Sets the selector identifying which input elements to filter from drag events.
+         * @method setInputFilterSelector
+         * @param {String} selector Input filter selector to set.
+         * @return {Katavorio} Current instance; method may be chained.
+         */
+        this.setInputFilterSelector = function(selector) {
+            inputFilterSelector = selector;
+            return this;
+        };
+
+        this.draggable = function(el, params) {
+            var o = [];
+            _each(el, function(_el) {
+                _el = _gel(_el);
+                if (_el != null) {
+                    if (_el._katavorioDrag == null) {
+                        var p = _prepareParams(params);
+                        _el._katavorioDrag = new Drag(_el, p, _css, _scope);
+                        _reg(_el._katavorioDrag, this._dragsByScope);
+                        o.push(_el._katavorioDrag);
+                        katavorioParams.addClass(_el, _css.draggable);
+                    }
+                    else {
+                        _mistletoe(_el._katavorioDrag, params);
+                    }
+                }
+            }.bind(this));
+            return o;
+
+        };
+
+        this.droppable = function(el, params) {
+            var o = [];
+            _each(el, function(_el) {
+                _el = _gel(_el);
+                if (_el != null) {
+                    var drop = new Drop(_el, _prepareParams(params), _css, _scope);
+                    _el._katavorioDrop = _el._katavorioDrop || [];
+                    _el._katavorioDrop.push(drop);
+                    _reg(drop, this._dropsByScope);
+                    o.push(drop);
+                    katavorioParams.addClass(_el, _css.droppable);
+                }
+            }.bind(this));
+            return o;
+        };
+
+        /**
+         * @name Katavorio#select
+         * @function
+         * @desc Adds an element to the current selection (for multiple node drag)
+         * @param {Element|String} DOM element - or id of the element - to add.
+         */
+        this.select = function(el) {
+            _each(el, function() {
+                var _el = _gel(this);
+                if (_el && _el._katavorioDrag) {
+                    if (!_selectionMap[_el._katavorio]) {
+                        _selection.push(_el._katavorioDrag);
+                        _selectionMap[_el._katavorio] = [ _el, _selection.length - 1 ];
+                        katavorioParams.addClass(_el, _css.selected);
+                    }
+                }
+            });
+            return this;
+        };
+
+        /**
+         * @name Katavorio#deselect
+         * @function
+         * @desc Removes an element from the current selection (for multiple node drag)
+         * @param {Element|String} DOM element - or id of the element - to remove.
+         */
+        this.deselect = function(el) {
+            _each(el, function() {
+                var _el = _gel(this);
+                if (_el && _el._katavorio) {
+                    var e = _selectionMap[_el._katavorio];
+                    if (e) {
+                        var _s = [];
+                        for (var i = 0; i < _selection.length; i++)
+                            if (_selection[i].el !== _el) _s.push(_selection[i]);
+                        _selection = _s;
+                        delete _selectionMap[_el._katavorio];
+                        katavorioParams.removeClass(_el, _css.selected);
+                    }
+                }
+            });
+            return this;
+        };
+
+        this.deselectAll = function() {
+            for (var i in _selectionMap) {
+                var d = _selectionMap[i];
+                katavorioParams.removeClass(d[0], _css.selected);
+            }
+
+            _selection.length = 0;
+            _selectionMap = {};
+        };
+
+        this.markSelection = function(drag) {
+            _foreach(_selection, function(e) { e.mark(); }, drag);
+        };
+
+        this.markPosses = function(drag) {
+            if (drag.posses) {
+                _each(drag.posses, function(p) {
+                    if (drag.posseRoles[p] && _posses[p]) {
+                        _foreach(_posses[p].members, function (d) {
+                            d.mark();
+                        }, drag);
+                    }
+                })
+            }
+        };
+
+        this.unmarkSelection = function(drag, event) {
+            _foreach(_selection, function(e) { e.unmark(event); }, drag);
+        };
+
+        this.unmarkPosses = function(drag, event) {
+            if (drag.posses) {
+                _each(drag.posses, function(p) {
+                    if (drag.posseRoles[p] && _posses[p]) {
+                        _foreach(_posses[p].members, function (d) {
+                            d.unmark(event, true);
+                        }, drag);
+                    }
+                });
+            }
+        };
+
+        this.getSelection = function() { return _selection.slice(0); };
+
+        this.updateSelection = function(dx, dy, drag) {
+            _foreach(_selection, function(e) { e.moveBy(dx, dy); }, drag);
+        };
+
+        var _posseAction = function(fn, drag) {
+            if (drag.posses) {
+                _each(drag.posses, function(p) {
+                    if (drag.posseRoles[p] && _posses[p]) {
+                        _foreach(_posses[p].members, function (e) {
+                            fn(e);
+                        }, drag);
+                    }
+                });
+            }
+        };
+
+        this.updatePosses = function(dx, dy, drag) {
+            _posseAction(function(e) { e.moveBy(dx, dy); }, drag);
+        };
+
+        this.notifyPosseDragStop = function(drag, evt) {
+            _posseAction(function(e) { e.stop(evt, true); }, drag);
+        };
+
+        this.notifySelectionDragStop = function(drag, evt) {
+            _foreach(_selection, function(e) { e.stop(evt, true); }, drag);
+        };
+
+        this.notifySelectionDragStart = function(drag, evt) {
+            _foreach(_selection, function(e) { e.notifyStart(evt);}, drag);
+        };
+
+        this.setZoom = function(z) { _zoom = z; };
+        this.getZoom = function() { return _zoom; };
+
+        // does the work of changing scopes
+        var _scopeManip = function(kObj, scopes, map, fn) {
+            _each(kObj, function(_kObj) {
+                _unreg(_kObj, map);  // deregister existing scopes
+                _kObj[fn](scopes); // set scopes
+                _reg(_kObj, map); // register new ones
+            });
+        };
+
+        _each([ "set", "add", "remove", "toggle"], function(v) {
+            this[v + "Scope"] = function(el, scopes) {
+                _scopeManip(el._katavorioDrag, scopes, this._dragsByScope, v + "Scope");
+                _scopeManip(el._katavorioDrop, scopes, this._dropsByScope, v + "Scope");
+            }.bind(this);
+            this[v + "DragScope"] = function(el, scopes) {
+                _scopeManip(el.constructor === Drag ? el : el._katavorioDrag, scopes, this._dragsByScope, v + "Scope");
+            }.bind(this);
+            this[v + "DropScope"] = function(el, scopes) {
+                _scopeManip(el.constructor === Drop ? el : el._katavorioDrop, scopes, this._dropsByScope, v + "Scope");
+            }.bind(this);
+        }.bind(this));
+
+        this.snapToGrid = function(x, y) {
+            for (var s in this._dragsByScope) {
+                _foreach(this._dragsByScope[s], function(d) { d.snap(x, y); });
+            }
+        };
+
+        this.getDragsForScope = function(s) { return this._dragsByScope[s]; };
+        this.getDropsForScope = function(s) { return this._dropsByScope[s]; };
+
+        var _destroy = function(el, type, map) {
+            el = _gel(el);
+            if (el[type]) {
+
+                // remove from selection, if present.
+                var selIdx = _selection.indexOf(el[type]);
+                if (selIdx >= 0) {
+                    _selection.splice(selIdx, 1);
+                }
+
+                if (_unreg(el[type], map)) {
+                    _each(el[type], function(kObj) { kObj.destroy() });
+                }
+
+                delete el[type];
+            }
+        };
+
+        this.elementRemoved = function(el) {
+            this.destroyDraggable(el);
+            this.destroyDroppable(el);
+        };
+
+        this.destroyDraggable = function(el) {
+            _destroy(el, "_katavorioDrag", this._dragsByScope);
+        };
+
+        this.destroyDroppable = function(el) {
+            _destroy(el, "_katavorioDrop", this._dropsByScope);
+        };
+
+        this.reset = function() {
+            this._dragsByScope = {};
+            this._dropsByScope = {};
+            _selection = [];
+            _selectionMap = {};
+            _posses = {};
+        };
+
+        // ----- groups
+        var _posses = {};
+
+        var _processOneSpec = function(el, _spec, dontAddExisting) {
+            var posseId = _isString(_spec) ? _spec : _spec.id;
+            var active = _isString(_spec) ? true : _spec.active !== false;
+            var posse = _posses[posseId] || (function() {
+                var g = {name:posseId, members:[]};
+                _posses[posseId] = g;
+                return g;
+            })();
+            _each(el, function(_el) {
+                if (_el._katavorioDrag) {
+
+                    if (dontAddExisting && _el._katavorioDrag.posseRoles[posse.name] != null) return;
+
+                    _suggest(posse.members, _el._katavorioDrag);
+                    _suggest(_el._katavorioDrag.posses, posse.name);
+                    _el._katavorioDrag.posseRoles[posse.name] = active;
+                }
+            });
+            return posse;
+        };
+
+        /**
+         * Add the given element to the posse with the given id, creating the group if it at first does not exist.
+         * @method addToPosse
+         * @param {Element} el Element to add.
+         * @param {String...|Object...} spec Variable args parameters. Each argument can be a either a String, indicating
+         * the ID of a Posse to which the element should be added as an active participant, or an Object containing
+         * `{ id:"posseId", active:false/true}`. In the latter case, if `active` is not provided it is assumed to be
+         * true.
+         * @returns {Posse|Posse[]} The Posse(s) to which the element(s) was/were added.
+         */
+        this.addToPosse = function(el, spec) {
+
+            var posses = [];
+
+            for (var i = 1; i < arguments.length; i++) {
+                posses.push(_processOneSpec(el, arguments[i]));
+            }
+
+            return posses.length == 1 ? posses[0] : posses;
+        };
+
+        /**
+         * Sets the posse(s) for the element with the given id, creating those that do not yet exist, and removing from
+         * the element any current Posses that are not specified by this method call. This method will not change the
+         * active/passive state if it is given a posse in which the element is already a member.
+         * @method setPosse
+         * @param {Element} el Element to set posse(s) on.
+         * @param {String...|Object...} spec Variable args parameters. Each argument can be a either a String, indicating
+         * the ID of a Posse to which the element should be added as an active participant, or an Object containing
+         * `{ id:"posseId", active:false/true}`. In the latter case, if `active` is not provided it is assumed to be
+         * true.
+         * @returns {Posse|Posse[]} The Posse(s) to which the element(s) now belongs.
+         */
+        this.setPosse = function(el, spec) {
+
+            var posses = [];
+
+            for (var i = 1; i < arguments.length; i++) {
+                posses.push(_processOneSpec(el, arguments[i], true).name);
+            }
+
+            _each(el, function(_el) {
+                if (_el._katavorioDrag) {
+                    var diff = _difference(_el._katavorioDrag.posses, posses);
+                    var p = [];
+                    Array.prototype.push.apply(p, _el._katavorioDrag.posses);
+                    for (var i = 0; i < diff.length; i++) {
+                        this.removeFromPosse(_el, diff[i]);
+                    }
+                }
+            }.bind(this));
+
+            return posses.length == 1 ? posses[0] : posses;
+        };
+
+        /**
+         * Remove the given element from the given posse(s).
+         * @method removeFromPosse
+         * @param {Element} el Element to remove.
+         * @param {String...} posseId Varargs parameter: one value for each posse to remove the element from.
+         */
+        this.removeFromPosse = function(el, posseId) {
+            if (arguments.length < 2) throw new TypeError("No posse id provided for remove operation");
+            for(var i = 1; i < arguments.length; i++) {
+                posseId = arguments[i];
+                _each(el, function (_el) {
+                    if (_el._katavorioDrag && _el._katavorioDrag.posses) {
+                        var d = _el._katavorioDrag;
+                        _each(posseId, function (p) {
+                            _vanquish(_posses[p].members, d);
+                            _vanquish(d.posses, p);
+                            delete d.posseRoles[p];
+                        });
+                    }
+                });
+            }
+        };
+
+        /**
+         * Remove the given element from all Posses to which it belongs.
+         * @method removeFromAllPosses
+         * @param {Element|Element[]} el Element to remove from Posses.
+         */
+        this.removeFromAllPosses = function(el) {
+            _each(el, function(_el) {
+                if (_el._katavorioDrag && _el._katavorioDrag.posses) {
+                    var d = _el._katavorioDrag;
+                    _each(d.posses, function(p) {
+                        _vanquish(_posses[p].members, d);
+                    });
+                    d.posses.length = 0;
+                    d.posseRoles = {};
+                }
+            });
+        };
+
+        /**
+         * Changes the participation state for the element in the Posse with the given ID.
+         * @param {Element|Element[]} el Element(s) to change state for.
+         * @param {String} posseId ID of the Posse to change element state for.
+         * @param {Boolean} state True to make active, false to make passive.
+         */
+        this.setPosseState = function(el, posseId, state) {
+            var posse = _posses[posseId];
+            if (posse) {
+                _each(el, function(_el) {
+                    if (_el._katavorioDrag && _el._katavorioDrag.posses) {
+                        _el._katavorioDrag.posseRoles[posse.name] = state;
+                    }
+                });
+            }
+        };
+
+    };
+
+    root.Katavorio.version = "0.19.2";
+
+    if (true) {
+        exports.Katavorio = root.Katavorio;
+    }
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb
+ *
+ * Title:jsPlumb 2.3.0
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains utility functions that run in both browsers and headless.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * http://jsplumbtoolkit.com
+ * http://github.com/sporritt/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+
+;
+(function () {
+
+    var _isa = function (a) {
+            return Object.prototype.toString.call(a) === "[object Array]";
+        },
+        _isnum = function (n) {
+            return Object.prototype.toString.call(n) === "[object Number]";
+        },
+        _iss = function (s) {
+            return typeof s === "string";
+        },
+        _isb = function (s) {
+            return typeof s === "boolean";
+        },
+        _isnull = function (s) {
+            return s == null;
+        },
+        _iso = function (o) {
+            return o == null ? false : Object.prototype.toString.call(o) === "[object Object]";
+        },
+        _isd = function (o) {
+            return Object.prototype.toString.call(o) === "[object Date]";
+        },
+        _isf = function (o) {
+            return Object.prototype.toString.call(o) === "[object Function]";
+        },
+        _isNamedFunction = function(o) {
+            return _isf(o) && o.name != null && o.name.length > 0;
+        },
+        _ise = function (o) {
+            for (var i in o) {
+                if (o.hasOwnProperty(i)) {
+                    return false;
+                }
+            }
+            return true;
+        };
+
+    var root = this;
+    root.jsPlumbUtil = {
+        isArray: _isa,
+        isString: _iss,
+        isBoolean: _isb,
+        isNull: _isnull,
+        isObject: _iso,
+        isDate: _isd,
+        isFunction: _isf,
+        isEmpty: _ise,
+        isNumber: _isnum,
+        clone: function (a) {
+            if (_iss(a)) {
+                return "" + a;
+            }
+            else if (_isb(a)) {
+                return !!a;
+            }
+            else if (_isd(a)) {
+                return new Date(a.getTime());
+            }
+            else if (_isf(a)) {
+                return a;
+            }
+            else if (_isa(a)) {
+                var b = [];
+                for (var i = 0; i < a.length; i++) {
+                    b.push(this.clone(a[i]));
+                }
+                return b;
+            }
+            else if (_iso(a)) {
+                var c = {};
+                for (var j in a) {
+                    c[j] = this.clone(a[j]);
+                }
+                return c;
+            }
+            else {
+                return a;
+            }
+        },
+        merge: function (a, b, collations) {
+            // first change the collations array - if present - into a lookup table, because its faster.
+            var cMap = {}, ar, i;
+            collations = collations || [];
+            for (i = 0; i < collations.length; i++) {
+                cMap[collations[i]] = true;
+            }
+
+            var c = this.clone(a);
+            for (i in b) {
+                if (c[i] == null) {
+                    c[i] = b[i];
+                }
+                else if (_iss(b[i]) || _isb(b[i])) {
+                    if (!cMap[i]) {
+                        c[i] = b[i]; // if we dont want to collate, just copy it in.
+                    }
+                    else {
+                        ar = [];
+                        // if c's object is also an array we can keep its values.
+                        ar.push.apply(ar, _isa(c[i]) ? c[i] : [ c[i] ]);
+                        ar.push.apply(ar, _isa(b[i]) ? b[i] : [ b[i] ]);
+                        c[i] = ar;
+                    }
+                }
+                else {
+                    if (_isa(b[i])) {
+                        ar = [];
+                        // if c's object is also an array we can keep its values.
+                        if (_isa(c[i])) {
+                            ar.push.apply(ar, c[i]);
+                        }
+                        ar.push.apply(ar, b[i]);
+                        c[i] = ar;
+                    }
+                    else if (_iso(b[i])) {
+                        // overwite c's value with an object if it is not already one.
+                        if (!_iso(c[i])) {
+                            c[i] = {};
+                        }
+                        for (var j in b[i]) {
+                            c[i][j] = b[i][j];
+                        }
+                    }
+                }
+
+            }
+            return c;
+        },
+        replace: function (inObj, path, value) {
+            if (inObj == null) {
+                return;
+            }
+            var q = inObj, t = q;
+            path.replace(/([^\.])+/g, function (term, lc, pos, str) {
+                var array = term.match(/([^\[0-9]+){1}(\[)([0-9+])/),
+                    last = pos + term.length >= str.length,
+                    _getArray = function () {
+                        return t[array[1]] || (function () {
+                            t[array[1]] = [];
+                            return t[array[1]];
+                        })();
+                    };
+
+                if (last) {
+                    // set term = value on current t, creating term as array if necessary.
+                    if (array) {
+                        _getArray()[array[3]] = value;
+                    }
+                    else {
+                        t[term] = value;
+                    }
+                }
+                else {
+                    // set to current t[term], creating t[term] if necessary.
+                    if (array) {
+                        var a = _getArray();
+                        t = a[array[3]] || (function () {
+                            a[array[3]] = {};
+                            return a[array[3]];
+                        })();
+                    }
+                    else {
+                        t = t[term] || (function () {
+                            t[term] = {};
+                            return t[term];
+                        })();
+                    }
+                }
+            });
+
+            return inObj;
+        },
+        //
+        // chain a list of functions, supplied by [ object, method name, args ], and return on the first
+        // one that returns the failValue. if none return the failValue, return the successValue.
+        //
+        functionChain: function (successValue, failValue, fns) {
+            for (var i = 0; i < fns.length; i++) {
+                var o = fns[i][0][fns[i][1]].apply(fns[i][0], fns[i][2]);
+                if (o === failValue) {
+                    return o;
+                }
+            }
+            return successValue;
+        },
+        // take the given model and expand out any parameters.
+        // 'functionPrefix' is optional, and if present, helps jsplumb figure out what to do if a value is a Function.
+        // if you do not provide it, jsplumb will run the given values through any functions it finds, and use the function's
+        // output as the value in the result. if you do provide the prefix, only functions that are named and have this prefix
+        // will be executed; other functions will be passed as values to the output.
+        populate: function (model, values, functionPrefix) {
+            // for a string, see if it has parameter matches, and if so, try to make the substitutions.
+            var getValue = function (fromString) {
+                    var matches = fromString.match(/(\${.*?})/g);
+                    if (matches != null) {
+                        for (var i = 0; i < matches.length; i++) {
+                            var val = values[matches[i].substring(2, matches[i].length - 1)] || "";
+                            if (val != null) {
+                                fromString = fromString.replace(matches[i], val);
+                            }
+                        }
+                    }
+                    return fromString;
+                },
+            // process one entry.
+                _one = function (d) {
+                    if (d != null) {
+                        if (_iss(d)) {
+                            return getValue(d);
+                        }
+                        else if (_isf(d) && (functionPrefix == null || (d.name || "").indexOf(functionPrefix) === 0)) {
+                            return d(values);
+                        }
+                        else if (_isa(d)) {
+                            var r = [];
+                            for (var i = 0; i < d.length; i++) {
+                                r.push(_one(d[i]));
+                            }
+                            return r;
+                        }
+                        else if (_iso(d)) {
+                            var s = {};
+                            for (var j in d) {
+                                s[j] = _one(d[j]);
+                            }
+                            return s;
+                        }
+                        else {
+                            return d;
+                        }
+                    }
+                };
+
+            return _one(model);
+        },
+        findWithFunction: function (a, f) {
+            if (a) {
+                for (var i = 0; i < a.length; i++) {
+                    if (f(a[i])) {
+                        return i;
+                    }
+                }
+            }
+            return -1;
+        },
+        removeWithFunction: function (a, f) {
+            var idx = root.jsPlumbUtil.findWithFunction(a, f);
+            if (idx > -1) {
+                a.splice(idx, 1);
+            }
+            return idx !== -1;
+        },
+        remove: function (l, v) {
+            var idx = l.indexOf(v);
+            if (idx > -1) {
+                l.splice(idx, 1);
+            }
+            return idx !== -1;
+        },
+        // TODO support insert index
+        addWithFunction: function (list, item, hashFunction) {
+            if (root.jsPlumbUtil.findWithFunction(list, hashFunction) === -1) {
+                list.push(item);
+            }
+        },
+        addToList: function (map, key, value, insertAtStart) {
+            var l = map[key];
+            if (l == null) {
+                l = [];
+                map[key] = l;
+            }
+            l[insertAtStart ? "unshift" : "push"](value);
+            return l;
+        },
+        suggest : function(list, item, insertAtHead) {
+            if (list.indexOf(item) === -1) {
+                if (insertAtHead) {
+                    list.unshift(item);
+                } else {
+                    list.push(item);
+                }
+                return true;
+            }
+            return false;
+        },
+        //
+        // extends the given obj (which can be an array) with the given constructor function, prototype functions, and
+        // class members, any of which may be null.
+        //
+        extend: function (child, parent, _protoFn) {
+            var i;
+            parent = _isa(parent) ? parent : [ parent ];
+
+            for (i = 0; i < parent.length; i++) {
+                for (var j in parent[i].prototype) {
+                    if (parent[i].prototype.hasOwnProperty(j)) {
+                        child.prototype[j] = parent[i].prototype[j];
+                    }
+                }
+            }
+
+            var _makeFn = function (name, protoFn) {
+                return function () {
+                    for (i = 0; i < parent.length; i++) {
+                        if (parent[i].prototype[name]) {
+                            parent[i].prototype[name].apply(this, arguments);
+                        }
+                    }
+                    return protoFn.apply(this, arguments);
+                };
+            };
+
+            var _oneSet = function (fns) {
+                for (var k in fns) {
+                    child.prototype[k] = _makeFn(k, fns[k]);
+                }
+            };
+
+            if (arguments.length > 2) {
+                for (i = 2; i < arguments.length; i++) {
+                    _oneSet(arguments[i]);
+                }
+            }
+
+            return child;
+        },
+        uuid: function () {
+            return ('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
+                var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
+                return v.toString(16);
+            }));
+        },
+        logEnabled: true,
+        log: function () {
+            if (root.jsPlumbUtil.logEnabled && typeof console !== "undefined") {
+                try {
+                    var msg = arguments[arguments.length - 1];
+                    console.log(msg);
+                }
+                catch (e) {
+                }
+            }
+        },
+
+        /**
+         * Wraps one function with another, creating a placeholder for the
+         * wrapped function if it was null. this is used to wrap the various
+         * drag/drop event functions - to allow jsPlumb to be notified of
+         * important lifecycle events without imposing itself on the user's
+         * drag/drop functionality.
+         * @method jsPlumbUtil.wrap
+         * @param {Function} wrappedFunction original function to wrap; may be null.
+         * @param {Function} newFunction function to wrap the original with.
+         * @param {Object} [returnOnThisValue] Optional. Indicates that the wrappedFunction should
+         * not be executed if the newFunction returns a value matching 'returnOnThisValue'.
+         * note that this is a simple comparison and only works for primitives right now.
+         */
+        wrap: function (wrappedFunction, newFunction, returnOnThisValue) {
+            wrappedFunction = wrappedFunction || function () {
+            };
+            newFunction = newFunction || function () {
+            };
+            return function () {
+                var r = null;
+                try {
+                    r = newFunction.apply(this, arguments);
+                } catch (e) {
+                    root.jsPlumbUtil.log("jsPlumb function failed : " + e);
+                }
+                if (returnOnThisValue == null || (r !== returnOnThisValue)) {
+                    try {
+                        r = wrappedFunction.apply(this, arguments);
+                    } catch (e) {
+                        root.jsPlumbUtil.log("wrapped function failed : " + e);
+                    }
+                }
+                return r;
+            };
+        }
+    };
+
+    root.jsPlumbUtil.EventGenerator = function () {
+        var _listeners = {},
+            eventsSuspended = false,
+            tick = false,
+        // this is a list of events that should re-throw any errors that occur during their dispatch. it is current private.
+            eventsToDieOn = { "ready": true },
+            queue = [];
+
+        this.bind = function (event, listener, insertAtStart) {
+            var _one = function(evt) {
+                root.jsPlumbUtil.addToList(_listeners, evt, listener, insertAtStart);
+                listener.__jsPlumb = listener.__jsPlumb || {};
+                listener.__jsPlumb[root.jsPlumbUtil.uuid()] = evt;
+            };
+
+            if (typeof event === "string") {
+                _one(event);
+            }
+            else if (event.length != null) {
+                for (var i = 0; i < event.length; i++) {
+                    _one(event[i]);
+                }
+            }
+
+            return this;
+        };
+
+        this.fire = function (event, value, originalEvent) {
+            if (!tick) {
+                tick = true;
+                if (!eventsSuspended && _listeners[event]) {
+                    var l = _listeners[event].length, i = 0, _gone = false, ret = null;
+                    if (!this.shouldFireEvent || this.shouldFireEvent(event, value, originalEvent)) {
+                        while (!_gone && i < l && ret !== false) {
+                            // doing it this way rather than catching and then possibly re-throwing means that an error propagated by this
+                            // method will have the whole call stack available in the debugger.
+                            if (eventsToDieOn[event]) {
+                                _listeners[event][i].apply(this, [value, originalEvent]);
+                            }
+                            else {
+                                try {
+                                    ret = _listeners[event][i].apply(this, [value, originalEvent]);
+                                } catch (e) {
+                                    root.jsPlumbUtil.log("jsPlumb: fire failed for event " + event + " : " + e);
+                                }
+                            }
+                            i++;
+                            if (_listeners == null || _listeners[event] == null) {
+                                _gone = true;
+                            }
+                        }
+                    }
+                }
+                tick = false;
+                _drain();
+            } else {
+                queue.unshift(arguments);
+            }
+            return this;
+        };
+
+        var _drain = function() {
+            var n = queue.pop();
+            if (n) {
+                this.fire.apply(this, n);
+            }
+        }.bind(this);
+
+        this.unbind = function (eventOrListener, listener) {
+
+            if (arguments.length === 0) {
+                _listeners = {};
+            }
+            else if (arguments.length === 1) {
+                if (typeof eventOrListener === "string") {
+                    delete _listeners[eventOrListener];
+                }
+                else if (eventOrListener.__jsPlumb) {
+                    var evt;
+                    for (var i in eventOrListener.__jsPlumb) {
+                        evt = eventOrListener.__jsPlumb[i];
+                        root.jsPlumbUtil.remove(_listeners[evt] || [], eventOrListener);
+                    }
+                }
+            }
+            else if (arguments.length === 2) {
+                root.jsPlumbUtil.remove(_listeners[eventOrListener] || [], listener);
+            }
+
+            return this;
+        };
+
+        this.getListener = function (forEvent) {
+            return _listeners[forEvent];
+        };
+        this.setSuspendEvents = function (val) {
+            eventsSuspended = val;
+        };
+        this.isSuspendEvents = function () {
+            return eventsSuspended;
+        };
+        this.silently = function(fn) {
+            this.setSuspendEvents(true);
+            try {
+                fn();
+            }
+            catch (e) {
+                root.jsPlumbUtil.log("Cannot execute silent function " + e);
+            }
+            this.setSuspendEvents(false);
+        };
+        this.cleanupListeners = function () {
+            for (var i in _listeners) {
+                _listeners[i] = null;
+            }
+        };
+    };
+
+    root.jsPlumbUtil.EventGenerator.prototype = {
+        cleanup: function () {
+            this.cleanupListeners();
+        }
+    };
+
+    if (true) {
+        exports.jsPlumbUtil = root.jsPlumbUtil;
+    }
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains utility functions that run in browsers only.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+ ;(function() {
+
+  "use strict";
+
+   var root = this;
+
+    root.jsPlumbUtil.matchesSelector = function(el, selector, ctx) {
+       ctx = ctx || el.parentNode;
+       var possibles = ctx.querySelectorAll(selector);
+       for (var i = 0; i < possibles.length; i++) {
+           if (possibles[i] === el) {
+               return true;
+           }
+       }
+       return false;
+   };
+
+    root.jsPlumbUtil.consume = function(e, doNotPreventDefault) {
+       if (e.stopPropagation) {
+           e.stopPropagation();
+       }
+       else {
+           e.returnValue = false;
+       }
+
+       if (!doNotPreventDefault && e.preventDefault){
+           e.preventDefault();
+       }
+   };
+
+   /*
+    * Function: sizeElement
+    * Helper to size and position an element. You would typically use
+    * this when writing your own Connector or Endpoint implementation.
+    *
+    * Parameters:
+    *  x - [int] x position for the element origin
+    *  y - [int] y position for the element origin
+    *  w - [int] width of the element
+    *  h - [int] height of the element
+    *
+    */
+    root.jsPlumbUtil.sizeElement = function(el, x, y, w, h) {
+       if (el) {
+           el.style.height = h + "px";
+           el.height = h;
+           el.style.width = w + "px";
+           el.width = w;
+           el.style.left = x + "px";
+           el.style.top = y + "px";
+       }
+   };
+
+ }).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb
+ * 
+ * Title:jsPlumb 2.3.0
+ * 
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ * 
+ * This file contains the core code.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ * 
+ * http://jsplumbtoolkit.com
+ * http://github.com/sporritt/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+(function () {
+
+    "use strict";
+
+    var root = this;
+    var connectorTypes = [], rendererTypes;
+
+    var _ju = root.jsPlumbUtil,
+
+        /**
+         * creates a timestamp, using milliseconds since 1970, but as a string.
+         */
+        _timestamp = function () {
+            return "" + (new Date()).getTime();
+        },
+
+    // helper method to update the hover style whenever it, or paintStyle, changes.
+    // we use paintStyle as the foundation and merge hoverPaintStyle over the
+    // top.
+        _updateHoverStyle = function (component) {
+            if (component._jsPlumb.paintStyle && component._jsPlumb.hoverPaintStyle) {
+                var mergedHoverStyle = {};
+                jsPlumb.extend(mergedHoverStyle, component._jsPlumb.paintStyle);
+                jsPlumb.extend(mergedHoverStyle, component._jsPlumb.hoverPaintStyle);
+                delete component._jsPlumb.hoverPaintStyle;
+                // we want the fill of paintStyle to override a gradient, if possible.
+                if (mergedHoverStyle.gradient && component._jsPlumb.paintStyle.fill) {
+                    delete mergedHoverStyle.gradient;
+                }
+                component._jsPlumb.hoverPaintStyle = mergedHoverStyle;
+            }
+        },
+        events = ["tap", "dbltap", "click", "dblclick", "mouseover", "mouseout", "mousemove", "mousedown", "mouseup", "contextmenu" ],
+        eventFilters = { "mouseout": "mouseleave", "mouseexit": "mouseleave" },
+        _updateAttachedElements = function (component, state, timestamp, sourceElement) {
+            var affectedElements = component.getAttachedElements();
+            if (affectedElements) {
+                for (var i = 0, j = affectedElements.length; i < j; i++) {
+                    if (!sourceElement || sourceElement !== affectedElements[i]) {
+                        affectedElements[i].setHover(state, true, timestamp);			// tell the attached elements not to inform their own attached elements.
+                    }
+                }
+            }
+        },
+        _splitType = function (t) {
+            return t == null ? null : t.split(" ");
+        },
+        _mapType = function(map, obj, typeId) {
+            for (var i in obj) {
+                map[i] = typeId;
+            }
+        },
+        _each = function(fn, obj) {
+            obj = _ju.isArray(obj) || (obj.length != null && !_ju.isString(obj)) ? obj : [ obj ];
+            for (var i = 0; i < obj.length; i++) {
+                try {
+                    fn.apply(obj[i], [ obj[i] ]);
+                }
+                catch (e) {
+                    _ju.log(".each iteration failed : " + e);
+                }
+            }
+        },
+        _applyTypes = function (component, params, doNotRepaint) {
+            if (component.getDefaultType) {
+                var td = component.getTypeDescriptor(), map = {};
+                var defType = component.getDefaultType();
+                var o = _ju.merge({}, defType);
+                _mapType(map, defType, "__default");
+                for (var i = 0, j = component._jsPlumb.types.length; i < j; i++) {
+                    var tid = component._jsPlumb.types[i];
+                    if (tid !== "__default") {
+                        var _t = component._jsPlumb.instance.getType(tid, td);
+                        if (_t != null) {
+                            o = _ju.merge(o, _t, [ "cssClass" ]);
+                            _mapType(map, _t, tid);
+                        }
+                    }
+                }
+
+                if (params) {
+                    o = _ju.populate(o, params, "_");
+                }
+
+                component.applyType(o, doNotRepaint, map);
+                if (!doNotRepaint) {
+                    component.repaint();
+                }
+            }
+        },
+
+// ------------------------------ BEGIN jsPlumbUIComponent --------------------------------------------
+
+        jsPlumbUIComponent = root.jsPlumbUIComponent = function (params) {
+
+            _ju.EventGenerator.apply(this, arguments);
+
+            var self = this,
+                a = arguments,
+                idPrefix = self.idPrefix,
+                id = idPrefix + (new Date()).getTime();
+
+            this._jsPlumb = {
+                instance: params._jsPlumb,
+                parameters: params.parameters || {},
+                paintStyle: null,
+                hoverPaintStyle: null,
+                paintStyleInUse: null,
+                hover: false,
+                beforeDetach: params.beforeDetach,
+                beforeDrop: params.beforeDrop,
+                overlayPlacements: [],
+                hoverClass: params.hoverClass || params._jsPlumb.Defaults.HoverClass,
+                types: [],
+                typeCache:{}
+            };
+
+            this.cacheTypeItem = function(key, item, typeId) {
+                this._jsPlumb.typeCache[typeId] = this._jsPlumb.typeCache[typeId] || {};
+                this._jsPlumb.typeCache[typeId][key] = item;
+            };
+            this.getCachedTypeItem = function(key, typeId) {
+                return this._jsPlumb.typeCache[typeId] ? this._jsPlumb.typeCache[typeId][key] : null;
+            };
+
+            this.getId = function () {
+                return id;
+            };
+
+// ----------------------------- default type --------------------------------------------
+
+
+            var o = params.overlays || [], oo = {};
+            if (this.defaultOverlayKeys) {
+                for (var i = 0; i < this.defaultOverlayKeys.length; i++) {
+                    Array.prototype.push.apply(o, this._jsPlumb.instance.Defaults[this.defaultOverlayKeys[i]] || []);
+                }
+
+                for (i = 0; i < o.length; i++) {
+                    // if a string, convert to object representation so that we can store the typeid on it.
+                    // also assign an id.
+                    var fo = jsPlumb.convertToFullOverlaySpec(o[i]);
+                    oo[fo[1].id] = fo;
+                }
+            }
+
+            var _defaultType = {
+                overlays:oo,
+                parameters: params.parameters || {},
+                scope: params.scope || this._jsPlumb.instance.getDefaultScope()
+            };
+            this.getDefaultType = function() {
+                return _defaultType;
+            };
+            this.appendToDefaultType = function(obj) {
+                for (var i in obj) {
+                    _defaultType[i] = obj[i];
+                }
+            };
+
+// ----------------------------- end default type --------------------------------------------
+
+            // all components can generate events
+
+            if (params.events) {
+                for (var evtName in params.events) {
+                    self.bind(evtName, params.events[evtName]);
+                }
+            }
+
+            // all components get this clone function.
+            // TODO issue 116 showed a problem with this - it seems 'a' that is in
+            // the clone function's scope is shared by all invocations of it, the classic
+            // JS closure problem.  for now, jsPlumb does a version of this inline where
+            // it used to call clone.  but it would be nice to find some time to look
+            // further at this.
+            this.clone = function () {
+                var o = Object.create(this.constructor.prototype);
+                this.constructor.apply(o, a);
+                return o;
+            }.bind(this);
+
+            // user can supply a beforeDetach callback, which will be executed before a detach
+            // is performed; returning false prevents the detach.
+            this.isDetachAllowed = function (connection) {
+                var r = true;
+                if (this._jsPlumb.beforeDetach) {
+                    try {
+                        r = this._jsPlumb.beforeDetach(connection);
+                    }
+                    catch (e) {
+                        _ju.log("jsPlumb: beforeDetach callback failed", e);
+                    }
+                }
+                return r;
+            };
+
+            // user can supply a beforeDrop callback, which will be executed before a dropped
+            // connection is confirmed. user can return false to reject connection.
+            this.isDropAllowed = function (sourceId, targetId, scope, connection, dropEndpoint, source, target) {
+                var r = this._jsPlumb.instance.checkCondition("beforeDrop", {
+                    sourceId: sourceId,
+                    targetId: targetId,
+                    scope: scope,
+                    connection: connection,
+                    dropEndpoint: dropEndpoint,
+                    source: source, target: target
+                });
+                if (this._jsPlumb.beforeDrop) {
+                    try {
+                        r = this._jsPlumb.beforeDrop({
+                            sourceId: sourceId,
+                            targetId: targetId,
+                            scope: scope,
+                            connection: connection,
+                            dropEndpoint: dropEndpoint,
+                            source: source, target: target
+                        });
+                    }
+                    catch (e) {
+                        _ju.log("jsPlumb: beforeDrop callback failed", e);
+                    }
+                }
+                return r;
+            };
+
+            var domListeners = [];
+
+            // sets the component associated with listener events. for instance, an overlay delegates
+            // its events back to a connector. but if the connector is swapped on the underlying connection,
+            // then this component must be changed. This is called by setConnector in the Connection class.
+            this.setListenerComponent = function (c) {
+                for (var i = 0; i < domListeners.length; i++) {
+                    domListeners[i][3] = c;
+                }
+            };
+
+
+        };
+
+    var _removeTypeCssHelper = function (component, typeIndex) {
+        var typeId = component._jsPlumb.types[typeIndex],
+            type = component._jsPlumb.instance.getType(typeId, component.getTypeDescriptor());
+
+        if (type != null && type.cssClass && component.canvas) {
+            component._jsPlumb.instance.removeClass(component.canvas, type.cssClass);
+        }
+    };
+
+    _ju.extend(root.jsPlumbUIComponent, _ju.EventGenerator, {
+
+        getParameter: function (name) {
+            return this._jsPlumb.parameters[name];
+        },
+
+        setParameter: function (name, value) {
+            this._jsPlumb.parameters[name] = value;
+        },
+
+        getParameters: function () {
+            return this._jsPlumb.parameters;
+        },
+
+        setParameters: function (p) {
+            this._jsPlumb.parameters = p;
+        },
+
+        getClass:function() {
+            return jsPlumb.getClass(this.canvas);
+        },
+
+        hasClass:function(clazz) {
+            return jsPlumb.hasClass(this.canvas, clazz);
+        },
+
+        addClass: function (clazz) {
+            jsPlumb.addClass(this.canvas, clazz);
+        },
+
+        removeClass: function (clazz) {
+            jsPlumb.removeClass(this.canvas, clazz);
+        },
+
+        updateClasses: function (classesToAdd, classesToRemove) {
+            jsPlumb.updateClasses(this.canvas, classesToAdd, classesToRemove);
+        },
+
+        setType: function (typeId, params, doNotRepaint) {
+            this.clearTypes();
+            this._jsPlumb.types = _splitType(typeId) || [];
+            _applyTypes(this, params, doNotRepaint);
+        },
+
+        getType: function () {
+            return this._jsPlumb.types;
+        },
+
+        reapplyTypes: function (params, doNotRepaint) {
+            _applyTypes(this, params, doNotRepaint);
+        },
+
+        hasType: function (typeId) {
+            return this._jsPlumb.types.indexOf(typeId) !== -1;
+        },
+
+        addType: function (typeId, params, doNotRepaint) {
+            var t = _splitType(typeId), _cont = false;
+            if (t != null) {
+                for (var i = 0, j = t.length; i < j; i++) {
+                    if (!this.hasType(t[i])) {
+                        this._jsPlumb.types.push(t[i]);
+                        _cont = true;
+                    }
+                }
+                if (_cont) {
+                    _applyTypes(this, params, doNotRepaint);
+                }
+            }
+        },
+
+        removeType: function (typeId, params, doNotRepaint) {
+            var t = _splitType(typeId), _cont = false, _one = function (tt) {
+                var idx = this._jsPlumb.types.indexOf(tt);
+                if (idx !== -1) {
+                    // remove css class if necessary
+                    _removeTypeCssHelper(this, idx);
+                    this._jsPlumb.types.splice(idx, 1);
+                    return true;
+                }
+                return false;
+            }.bind(this);
+
+            if (t != null) {
+                for (var i = 0, j = t.length; i < j; i++) {
+                    _cont = _one(t[i]) || _cont;
+                }
+                if (_cont) {
+                    _applyTypes(this, params, doNotRepaint);
+                }
+            }
+        },
+        clearTypes: function (params, doNotRepaint) {
+            var i = this._jsPlumb.types.length;
+            for (var j = 0; j < i; j++) {
+                _removeTypeCssHelper(this, 0);
+                this._jsPlumb.types.splice(0, 1);
+            }
+            _applyTypes(this, params, doNotRepaint);
+        },
+
+        toggleType: function (typeId, params, doNotRepaint) {
+            var t = _splitType(typeId);
+            if (t != null) {
+                for (var i = 0, j = t.length; i < j; i++) {
+                    var idx = this._jsPlumb.types.indexOf(t[i]);
+                    if (idx !== -1) {
+                        _removeTypeCssHelper(this, idx);
+                        this._jsPlumb.types.splice(idx, 1);
+                    }
+                    else {
+                        this._jsPlumb.types.push(t[i]);
+                    }
+                }
+
+                _applyTypes(this, params, doNotRepaint);
+            }
+        },
+        applyType: function (t, doNotRepaint) {
+            this.setPaintStyle(t.paintStyle, doNotRepaint);
+            this.setHoverPaintStyle(t.hoverPaintStyle, doNotRepaint);
+            if (t.parameters) {
+                for (var i in t.parameters) {
+                    this.setParameter(i, t.parameters[i]);
+                }
+            }
+            this._jsPlumb.paintStyleInUse = this.getPaintStyle();
+        },
+        setPaintStyle: function (style, doNotRepaint) {
+            // this._jsPlumb.paintStyle = jsPlumb.extend({}, style);
+            // TODO figure out if we want components to clone paintStyle so as not to share it.
+            this._jsPlumb.paintStyle = style;
+            this._jsPlumb.paintStyleInUse = this._jsPlumb.paintStyle;
+            _updateHoverStyle(this);
+            if (!doNotRepaint) {
+                this.repaint();
+            }
+        },
+        getPaintStyle: function () {
+            return this._jsPlumb.paintStyle;
+        },
+        setHoverPaintStyle: function (style, doNotRepaint) {
+            //this._jsPlumb.hoverPaintStyle = jsPlumb.extend({}, style);
+            // TODO figure out if we want components to clone paintStyle so as not to share it.
+            this._jsPlumb.hoverPaintStyle = style;
+            _updateHoverStyle(this);
+            if (!doNotRepaint) {
+                this.repaint();
+            }
+        },
+        getHoverPaintStyle: function () {
+            return this._jsPlumb.hoverPaintStyle;
+        },
+        destroy: function (force) {
+            if (force || this.typeId == null) {
+                this.cleanupListeners(); // this is on EventGenerator
+                this.clone = null;
+                this._jsPlumb = null;
+            }
+        },
+
+        isHover: function () {
+            return this._jsPlumb.hover;
+        },
+
+        setHover: function (hover, ignoreAttachedElements, timestamp) {
+            // while dragging, we ignore these events.  this keeps the UI from flashing and
+            // swishing and whatevering.
+            if (this._jsPlumb && !this._jsPlumb.instance.currentlyDragging && !this._jsPlumb.instance.isHoverSuspended()) {
+
+                this._jsPlumb.hover = hover;
+                var method = hover ? "addClass" : "removeClass";
+
+                if (this.canvas != null) {
+                    if (this._jsPlumb.instance.hoverClass != null) {
+                        this._jsPlumb.instance[method](this.canvas, this._jsPlumb.instance.hoverClass);
+                    }
+                    if (this._jsPlumb.hoverClass != null) {
+                        this._jsPlumb.instance[method](this.canvas, this._jsPlumb.hoverClass);
+                    }
+                }
+                if (this._jsPlumb.hoverPaintStyle != null) {
+                    this._jsPlumb.paintStyleInUse = hover ? this._jsPlumb.hoverPaintStyle : this._jsPlumb.paintStyle;
+                    if (!this._jsPlumb.instance.isSuspendDrawing()) {
+                        timestamp = timestamp || _timestamp();
+                        this.repaint({timestamp: timestamp, recalc: false});
+                    }
+                }
+                // get the list of other affected elements, if supported by this component.
+                // for a connection, its the endpoints.  for an endpoint, its the connections! surprise.
+                if (this.getAttachedElements && !ignoreAttachedElements) {
+                    _updateAttachedElements(this, hover, _timestamp(), this);
+                }
+            }
+        }
+    });
+
+// ------------------------------ END jsPlumbUIComponent --------------------------------------------
+
+    var _jsPlumbInstanceIndex = 0,
+        getInstanceIndex = function () {
+            var i = _jsPlumbInstanceIndex + 1;
+            _jsPlumbInstanceIndex++;
+            return i;
+        };
+
+    var jsPlumbInstance = root.jsPlumbInstance = function (_defaults) {
+
+        this.version = "2.5.1";
+
+        if (_defaults) {
+            jsPlumb.extend(this.Defaults, _defaults);
+        }
+
+        this.logEnabled = this.Defaults.LogEnabled;
+        this._connectionTypes = {};
+        this._endpointTypes = {};
+
+        _ju.EventGenerator.apply(this);
+
+        var _currentInstance = this,
+            _instanceIndex = getInstanceIndex(),
+            _bb = _currentInstance.bind,
+            _initialDefaults = {},
+            _zoom = 1,
+            _info = function (el) {
+                if (el == null) {
+                    return null;
+                }
+                else if (el.nodeType === 3 || el.nodeType === 8) {
+                    return { el:el, text:true };
+                }
+                else {
+                    var _el = _currentInstance.getElement(el);
+                    return { el: _el, id: (_ju.isString(el) && _el == null) ? el : _getId(_el) };
+                }
+            };
+
+        this.getInstanceIndex = function () {
+            return _instanceIndex;
+        };
+
+        this.setZoom = function (z, repaintEverything) {
+            _zoom = z;
+            _currentInstance.fire("zoom", _zoom);
+            if (repaintEverything) {
+                _currentInstance.repaintEverything();
+            }
+            return true;
+        };
+        this.getZoom = function () {
+            return _zoom;
+        };
+
+        for (var i in this.Defaults) {
+            _initialDefaults[i] = this.Defaults[i];
+        }
+
+        var _container, _containerDelegations = [];
+        this.unbindContainer = function() {
+            if (_container != null && _containerDelegations.length > 0) {
+                for (var i = 0; i < _containerDelegations.length; i++) {
+                    _currentInstance.off(_container, _containerDelegations[i][0], _containerDelegations[i][1]);
+                }
+            }
+        };
+        this.setContainer = function (c) {
+
+            this.unbindContainer();
+
+            // get container as dom element.
+            c = this.getElement(c);
+            // move existing connections and endpoints, if any.
+            this.select().each(function (conn) {
+                conn.moveParent(c);
+            });
+            this.selectEndpoints().each(function (ep) {
+                ep.moveParent(c);
+            });
+
+            // set container.
+            var previousContainer = _container;
+            _container = c;
+            _containerDelegations.length = 0;
+            var eventAliases = {
+                "endpointclick":"endpointClick",
+                "endpointdblclick":"endpointDblClick"
+            };
+
+            var _oneDelegateHandler = function (id, e, componentType) {
+                var t = e.srcElement || e.target,
+                    jp = (t && t.parentNode ? t.parentNode._jsPlumb : null) || (t ? t._jsPlumb : null) || (t && t.parentNode && t.parentNode.parentNode ? t.parentNode.parentNode._jsPlumb : null);
+                if (jp) {
+                    jp.fire(id, jp, e);
+                    var alias = componentType ? eventAliases[componentType + id] || id : id;
+                    // jsplumb also fires every event coming from components/overlays. That's what the test for `jp.component` is for.
+                    _currentInstance.fire(alias, jp.component || jp, e);
+                }
+            };
+
+            var _addOneDelegate = function(eventId, selector, fn) {
+                _containerDelegations.push([eventId, fn]);
+                _currentInstance.on(_container, eventId, selector, fn);
+            };
+
+            // delegate one event on the container to jsplumb elements. it might be possible to
+            // abstract this out: each of endpoint, connection and overlay could register themselves with
+            // jsplumb as "component types" or whatever, and provide a suitable selector. this would be
+            // done by the renderer (although admittedly from 2.0 onwards we're not supporting vml anymore)
+            var _oneDelegate = function (id) {
+                // connections.
+                _addOneDelegate(id, ".jtk-connector", function (e) {
+                    _oneDelegateHandler(id, e);
+                });
+                // endpoints. note they can have an enclosing div, or not.
+                _addOneDelegate(id, ".jtk-endpoint", function (e) {
+                    _oneDelegateHandler(id, e, "endpoint");
+                });
+                // overlays
+                _addOneDelegate(id, ".jtk-overlay", function (e) {
+                    _oneDelegateHandler(id, e);
+                });
+            };
+
+            for (var i = 0; i < events.length; i++) {
+                _oneDelegate(events[i]);
+            }
+
+            // managed elements
+            for (var elId in managedElements) {
+                var el = managedElements[elId].el;
+                if (el.parentNode === previousContainer) {
+                    previousContainer.removeChild(el);
+                    _container.appendChild(el);
+                }
+            }
+
+        };
+        this.getContainer = function () {
+            return _container;
+        };
+
+        this.bind = function (event, fn) {
+            if ("ready" === event && initialized) {
+                fn();
+            }
+            else {
+                _bb.apply(_currentInstance, [event, fn]);
+            }
+        };
+
+        _currentInstance.importDefaults = function (d) {
+            for (var i in d) {
+                _currentInstance.Defaults[i] = d[i];
+            }
+            if (d.Container) {
+                _currentInstance.setContainer(d.Container);
+            }
+
+            return _currentInstance;
+        };
+
+        _currentInstance.restoreDefaults = function () {
+            _currentInstance.Defaults = jsPlumb.extend({}, _initialDefaults);
+            return _currentInstance;
+        };
+
+        var log = null,
+            initialized = false,
+        // TODO remove from window scope
+            connections = [],
+        // map of element id -> endpoint lists. an element can have an arbitrary
+        // number of endpoints on it, and not all of them have to be connected
+        // to anything.
+            endpointsByElement = {},
+            endpointsByUUID = {},
+            managedElements = {},
+            offsets = {},
+            offsetTimestamps = {},
+            draggableStates = {},
+            connectionBeingDragged = false,
+            sizes = [],
+            _suspendDrawing = false,
+            _suspendedAt = null,
+            DEFAULT_SCOPE = this.Defaults.Scope,
+            _curIdStamp = 1,
+            _idstamp = function () {
+                return "" + _curIdStamp++;
+            },
+
+        //
+        // appends an element to some other element, which is calculated as follows:
+        //
+        // 1. if Container exists, use that element.
+        // 2. if the 'parent' parameter exists, use that.
+        // 3. otherwise just use the root element.
+        //
+        //
+            _appendElement = function (el, parent) {
+                if (_container) {
+                    _container.appendChild(el);
+                }
+                else if (!parent) {
+                    this.appendToRoot(el);
+                }
+                else {
+                    this.getElement(parent).appendChild(el);
+                }
+            }.bind(this),
+
+        //
+        // Draws an endpoint and its connections. this is the main entry point into drawing connections as well
+        // as endpoints, since jsPlumb is endpoint-centric under the hood.
+        //
+        // @param element element to draw (of type library specific element object)
+        // @param ui UI object from current library's event system. optional.
+        // @param timestamp timestamp for this paint cycle. used to speed things up a little by cutting down the amount of offset calculations we do.
+        // @param clearEdits defaults to false; indicates that mouse edits for connectors should be cleared
+        ///
+            _draw = function (element, ui, timestamp, clearEdits) {
+
+                if (!_suspendDrawing) {
+                    var id = _getId(element),
+                        repaintEls,
+                        dm = _currentInstance.getDragManager();
+
+                    if (dm) {
+                        repaintEls = dm.getElementsForDraggable(id);
+                    }
+
+                    if (timestamp == null) {
+                        timestamp = _timestamp();
+                    }
+
+                    // update the offset of everything _before_ we try to draw anything.
+                    var o = _updateOffset({ elId: id, offset: ui, recalc: false, timestamp: timestamp });
+
+                    if (repaintEls && o && o.o) {
+                        for (var i in repaintEls) {
+                            _updateOffset({
+                                elId: repaintEls[i].id,
+                                offset: {
+                                    left: o.o.left + repaintEls[i].offset.left,
+                                    top: o.o.top + repaintEls[i].offset.top
+                                },
+                                recalc: false,
+                                timestamp: timestamp
+                            });
+                        }
+                    }
+
+                    _currentInstance.anchorManager.redraw(id, ui, timestamp, null, clearEdits);
+
+                    if (repaintEls) {
+                        for (var j in repaintEls) {
+                            _currentInstance.anchorManager.redraw(repaintEls[j].id, ui, timestamp, repaintEls[j].offset, clearEdits, true);
+                        }
+                    }
+                }
+            },
+
+        //
+        // gets an Endpoint by uuid.
+        //
+            _getEndpoint = function (uuid) {
+                return endpointsByUUID[uuid];
+            },
+
+            /**
+             * inits a draggable if it's not already initialised.
+             * TODO: somehow abstract this to the adapter, because the concept of "draggable" has no
+             * place on the server.
+             */
+            _initDraggableIfNecessary = function (element, isDraggable, dragOptions, id, fireEvent) {
+                // move to DragManager?
+                if (!jsPlumb.headless) {
+                    var _draggable = isDraggable == null ? false : isDraggable;
+                    if (_draggable) {
+                        if (jsPlumb.isDragSupported(element, _currentInstance)) {
+                            var options = dragOptions || _currentInstance.Defaults.DragOptions;
+                            options = jsPlumb.extend({}, options); // make a copy.
+                            if (!jsPlumb.isAlreadyDraggable(element, _currentInstance)) {
+                                var dragEvent = jsPlumb.dragEvents.drag,
+                                    stopEvent = jsPlumb.dragEvents.stop,
+                                    startEvent = jsPlumb.dragEvents.start,
+                                    _started = false;
+
+                                _manage(id, element);
+
+                                options[startEvent] = _ju.wrap(options[startEvent], function () {
+                                    _currentInstance.setHoverSuspended(true);
+                                    _currentInstance.select({source: element}).addClass(_currentInstance.elementDraggingClass + " " + _currentInstance.sourceElementDraggingClass, true);
+                                    _currentInstance.select({target: element}).addClass(_currentInstance.elementDraggingClass + " " + _currentInstance.targetElementDraggingClass, true);
+                                    _currentInstance.setConnectionBeingDragged(true);
+                                    if (options.canDrag) {
+                                        return dragOptions.canDrag();
+                                    }
+                                }, false);
+
+                                options[dragEvent] = _ju.wrap(options[dragEvent], function () {
+                                    // TODO: here we could actually use getDragObject, and then compute it ourselves,
+                                    // since every adapter does the same thing. but i'm not sure why YUI's getDragObject
+                                    // differs from getUIPosition so much
+                                    var ui = _currentInstance.getUIPosition(arguments, _currentInstance.getZoom());
+                                    if (ui != null) {
+                                        _draw(element, ui, null, true);
+                                        if (_started) {
+                                            _currentInstance.addClass(element, "jtk-dragged");
+                                        }
+                                        _started = true;
+                                    }
+                                });
+                                options[stopEvent] = _ju.wrap(options[stopEvent], function () {
+                                    var elements = arguments[0].selection, uip;
+
+                                    var _one = function (_e) {
+                                        if (_e[1] != null) {
+                                            // run the reported offset through the code that takes parent containers
+                                            // into account, to adjust if necessary (issue 554)
+                                            uip = _currentInstance.getUIPosition([{
+                                                el:_e[2].el,
+                                                pos:[_e[1].left, _e[1].top]
+                                            }]);
+                                            _draw(_e[2].el, uip);
+                                        }
+                                        _currentInstance.removeClass(_e[0], "jtk-dragged");
+                                        _currentInstance.select({source: _e[2].el}).removeClass(_currentInstance.elementDraggingClass + " " + _currentInstance.sourceElementDraggingClass, true);
+                                        _currentInstance.select({target: _e[2].el}).removeClass(_currentInstance.elementDraggingClass + " " + _currentInstance.targetElementDraggingClass, true);
+                                        _currentInstance.getDragManager().dragEnded(_e[2].el);
+                                    };
+
+                                    for (var i = 0; i < elements.length; i++) {
+                                        _one(elements[i]);
+                                    }
+
+                                    _started = false;
+                                    _currentInstance.setHoverSuspended(false);
+                                    _currentInstance.setConnectionBeingDragged(false);
+                                });
+                                var elId = _getId(element); // need ID
+                                draggableStates[elId] = true;
+                                var draggable = draggableStates[elId];
+                                options.disabled = draggable == null ? false : !draggable;
+                                _currentInstance.initDraggable(element, options);
+                                _currentInstance.getDragManager().register(element);
+                                if (fireEvent) {
+                                    _currentInstance.fire("elementDraggable", {el:element, options:options});
+                                }
+                            }
+                            else {
+                                // already draggable. attach any start, drag or stop listeners to the current Drag.
+                                if (dragOptions.force) {
+                                    _currentInstance.initDraggable(element, options);
+                                }
+                            }
+                        }
+                    }
+                }
+            },
+
+            _scopeMatch = function (e1, e2) {
+                var s1 = e1.scope.split(/\s/), s2 = e2.scope.split(/\s/);
+                for (var i = 0; i < s1.length; i++) {
+                    for (var j = 0; j < s2.length; j++) {
+                        if (s2[j] === s1[i]) {
+                            return true;
+                        }
+                    }
+                }
+
+                return false;
+            },
+
+            _mergeOverrides = function (def, values) {
+                var m = jsPlumb.extend({}, def);
+                for (var i in values) {
+                    if (values[i]) {
+                        m[i] = values[i];
+                    }
+                }
+                return m;
+            },
+
+        /*
+         * prepares a final params object that can be passed to _newConnection, taking into account defaults, events, etc.
+         */
+            _prepareConnectionParams = function (params, referenceParams) {
+                var _p = jsPlumb.extend({ }, params);
+                if (referenceParams) {
+                    jsPlumb.extend(_p, referenceParams);
+                }
+
+                // hotwire endpoints passed as source or target to sourceEndpoint/targetEndpoint, respectively.
+                if (_p.source) {
+                    if (_p.source.endpoint) {
+                        _p.sourceEndpoint = _p.source;
+                    }
+                    else {
+                        _p.source = _currentInstance.getElement(_p.source);
+                    }
+                }
+                if (_p.target) {
+                    if (_p.target.endpoint) {
+                        _p.targetEndpoint = _p.target;
+                    }
+                    else {
+                        _p.target = _currentInstance.getElement(_p.target);
+                    }
+                }
+
+                // test for endpoint uuids to connect
+                if (params.uuids) {
+                    _p.sourceEndpoint = _getEndpoint(params.uuids[0]);
+                    _p.targetEndpoint = _getEndpoint(params.uuids[1]);
+                }
+
+                // now ensure that if we do have Endpoints already, they're not full.
+                // source:
+                if (_p.sourceEndpoint && _p.sourceEndpoint.isFull()) {
+                    _ju.log(_currentInstance, "could not add connection; source endpoint is full");
+                    return;
+                }
+
+                // target:
+                if (_p.targetEndpoint && _p.targetEndpoint.isFull()) {
+                    _ju.log(_currentInstance, "could not add connection; target endpoint is full");
+                    return;
+                }
+
+                // if source endpoint mandates connection type and nothing specified in our params, use it.
+                if (!_p.type && _p.sourceEndpoint) {
+                    _p.type = _p.sourceEndpoint.connectionType;
+                }
+
+                // copy in any connectorOverlays that were specified on the source endpoint.
+                // it doesnt copy target endpoint overlays.  i'm not sure if we want it to or not.
+                if (_p.sourceEndpoint && _p.sourceEndpoint.connectorOverlays) {
+                    _p.overlays = _p.overlays || [];
+                    for (var i = 0, j = _p.sourceEndpoint.connectorOverlays.length; i < j; i++) {
+                        _p.overlays.push(_p.sourceEndpoint.connectorOverlays[i]);
+                    }
+                }
+
+                // scope
+                if (_p.sourceEndpoint && _p.sourceEndpoint.scope) {
+                    _p.scope = _p.sourceEndpoint.scope;
+                }
+
+                // pointer events
+                if (!_p["pointer-events"] && _p.sourceEndpoint && _p.sourceEndpoint.connectorPointerEvents) {
+                    _p["pointer-events"] = _p.sourceEndpoint.connectorPointerEvents;
+                }
+
+
+                var _addEndpoint = function (el, def, idx) {
+                    return _currentInstance.addEndpoint(el, _mergeOverrides(def, {
+                        anchor: _p.anchors ? _p.anchors[idx] : _p.anchor,
+                        endpoint: _p.endpoints ? _p.endpoints[idx] : _p.endpoint,
+                        paintStyle: _p.endpointStyles ? _p.endpointStyles[idx] : _p.endpointStyle,
+                        hoverPaintStyle: _p.endpointHoverStyles ? _p.endpointHoverStyles[idx] : _p.endpointHoverStyle
+                    }));
+                };
+
+                // check for makeSource/makeTarget specs.
+
+                var _oneElementDef = function (type, idx, defs, matchType) {
+                    if (_p[type] && !_p[type].endpoint && !_p[type + "Endpoint"] && !_p.newConnection) {
+                        var tid = _getId(_p[type]), tep = defs[tid];
+
+                        tep = tep ? tep[matchType] : null;
+
+                        if (tep) {
+                            // if not enabled, return.
+                            if (!tep.enabled) {
+                                return false;
+                            }
+                            var newEndpoint = tep.endpoint != null && tep.endpoint._jsPlumb ? tep.endpoint : _addEndpoint(_p[type], tep.def, idx);
+                            if (newEndpoint.isFull()) {
+                                return false;
+                            }
+                            _p[type + "Endpoint"] = newEndpoint;
+                            if (!_p.scope && tep.def.scope) {
+                                _p.scope = tep.def.scope;
+                            } // provide scope if not already provided and endpoint def has one.
+                            if (tep.uniqueEndpoint) {
+                                if (!tep.endpoint) {
+                                    tep.endpoint = newEndpoint;
+                                    newEndpoint.setDeleteOnEmpty(false);
+                                }
+                                else {
+                                    newEndpoint.finalEndpoint = tep.endpoint;
+                                }
+                            } else {
+                                newEndpoint.setDeleteOnEmpty(true);
+                            }
+                        }
+                    }
+                };
+
+                if (_oneElementDef("source", 0, this.sourceEndpointDefinitions, _p.type || "default") === false) {
+                    return;
+                }
+                if (_oneElementDef("target", 1, this.targetEndpointDefinitions, _p.type || "default") === false) {
+                    return;
+                }
+
+                // last, ensure scopes match
+                if (_p.sourceEndpoint && _p.targetEndpoint) {
+                    if (!_scopeMatch(_p.sourceEndpoint, _p.targetEndpoint)) {
+                        _p = null;
+                    }
+                }
+
+                return _p;
+            }.bind(_currentInstance),
+
+            _newConnection = function (params) {
+                var connectionFunc = _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType();
+
+                params._jsPlumb = _currentInstance;
+                params.newConnection = _newConnection;
+                params.newEndpoint = _newEndpoint;
+                params.endpointsByUUID = endpointsByUUID;
+                params.endpointsByElement = endpointsByElement;
+                params.finaliseConnection = _finaliseConnection;
+                params.id = "con_" + _idstamp();
+                var con = new connectionFunc(params);
+
+                // if the connection is draggable, then maybe we need to tell the target endpoint to init the
+                // dragging code. it won't run again if it already configured to be draggable.
+                if (con.isDetachable()) {
+                    con.endpoints[0].initDraggable("_jsPlumbSource");
+                    con.endpoints[1].initDraggable("_jsPlumbTarget");
+                }
+
+                return con;
+            },
+
+        //
+        // adds the connection to the backing model, fires an event if necessary and then redraws
+        //
+            _finaliseConnection = _currentInstance.finaliseConnection = function (jpc, params, originalEvent, doInformAnchorManager) {
+                params = params || {};
+                // add to list of connections (by scope).
+                if (!jpc.suspendedEndpoint) {
+                    connections.push(jpc);
+                }
+
+                jpc.pending = null;
+
+                // turn off isTemporarySource on the source endpoint (only viable on first draw)
+                jpc.endpoints[0].isTemporarySource = false;
+
+                // always inform the anchor manager
+                // except that if jpc has a suspended endpoint it's not true to say the
+                // connection is new; it has just (possibly) moved. the question is whether
+                // to make that call here or in the anchor manager.  i think perhaps here.
+                if (doInformAnchorManager !== false) {
+                    _currentInstance.anchorManager.newConnection(jpc);
+                }
+
+                // force a paint
+                _draw(jpc.source);
+
+                // fire an event
+                if (!params.doNotFireConnectionEvent && params.fireEvent !== false) {
+
+                    var eventArgs = {
+                        connection: jpc,
+                        source: jpc.source, target: jpc.target,
+                        sourceId: jpc.sourceId, targetId: jpc.targetId,
+                        sourceEndpoint: jpc.endpoints[0], targetEndpoint: jpc.endpoints[1]
+                    };
+
+                    _currentInstance.fire("connection", eventArgs, originalEvent);
+                }
+            },
+
+        /*
+         factory method to prepare a new endpoint.  this should always be used instead of creating Endpoints
+         manually, since this method attaches event listeners and an id.
+         */
+            _newEndpoint = function (params, id) {
+                var endpointFunc = _currentInstance.Defaults.EndpointType || jsPlumb.Endpoint;
+                var _p = jsPlumb.extend({}, params);
+                _p._jsPlumb = _currentInstance;
+                _p.newConnection = _newConnection;
+                _p.newEndpoint = _newEndpoint;
+                _p.endpointsByUUID = endpointsByUUID;
+                _p.endpointsByElement = endpointsByElement;
+                _p.fireDetachEvent = fireDetachEvent;
+                _p.elementId = id || _getId(_p.source);
+                var ep = new endpointFunc(_p);
+                ep.id = "ep_" + _idstamp();
+                _manage(_p.elementId, _p.source);
+
+                if (!jsPlumb.headless) {
+                    _currentInstance.getDragManager().endpointAdded(_p.source, id);
+                }
+
+                return ep;
+            },
+
+        /*
+         * performs the given function operation on all the connections found
+         * for the given element id; this means we find all the endpoints for
+         * the given element, and then for each endpoint find the connectors
+         * connected to it. then we pass each connection in to the given
+         * function.
+         */
+            _operation = function (elId, func, endpointFunc) {
+                var endpoints = endpointsByElement[elId];
+                if (endpoints && endpoints.length) {
+                    for (var i = 0, ii = endpoints.length; i < ii; i++) {
+                        for (var j = 0, jj = endpoints[i].connections.length; j < jj; j++) {
+                            var retVal = func(endpoints[i].connections[j]);
+                            // if the function passed in returns true, we exit.
+                            // most functions return false.
+                            if (retVal) {
+                                return;
+                            }
+                        }
+                        if (endpointFunc) {
+                            endpointFunc(endpoints[i]);
+                        }
+                    }
+                }
+            },
+
+            _setDraggable = function (element, draggable) {
+                return jsPlumb.each(element, function (el) {
+                    if (_currentInstance.isDragSupported(el)) {
+                        draggableStates[_currentInstance.getAttribute(el, "id")] = draggable;
+                        _currentInstance.setElementDraggable(el, draggable);
+                    }
+                });
+            },
+        /*
+         * private method to do the business of hiding/showing.
+         *
+         * @param el
+         *            either Id of the element in question or a library specific
+         *            object for the element.
+         * @param state
+         *            String specifying a value for the css 'display' property
+         *            ('block' or 'none').
+         */
+            _setVisible = function (el, state, alsoChangeEndpoints) {
+                state = state === "block";
+                var endpointFunc = null;
+                if (alsoChangeEndpoints) {
+                    endpointFunc = function (ep) {
+                        ep.setVisible(state, true, true);
+                    };
+                }
+                var info = _info(el);
+                _operation(info.id, function (jpc) {
+                    if (state && alsoChangeEndpoints) {
+                        // this test is necessary because this functionality is new, and i wanted to maintain backwards compatibility.
+                        // this block will only set a connection to be visible if the other endpoint in the connection is also visible.
+                        var oidx = jpc.sourceId === info.id ? 1 : 0;
+                        if (jpc.endpoints[oidx].isVisible()) {
+                            jpc.setVisible(true);
+                        }
+                    }
+                    else { // the default behaviour for show, and what always happens for hide, is to just set the visibility without getting clever.
+                        jpc.setVisible(state);
+                    }
+                }, endpointFunc);
+            },
+        /*
+         * toggles the draggable state of the given element(s).
+         * el is either an id, or an element object, or a list of ids/element objects.
+         */
+            _toggleDraggable = function (el) {
+                var state;
+                jsPlumb.each(el, function (el) {
+                    var elId = _currentInstance.getAttribute(el, "id");
+                    state = draggableStates[elId] == null ? false : draggableStates[elId];
+                    state = !state;
+                    draggableStates[elId] = state;
+                    _currentInstance.setDraggable(el, state);
+                    return state;
+                }.bind(this));
+                return state;
+            },
+            /**
+             * private method to do the business of toggling hiding/showing.
+             */
+            _toggleVisible = function (elId, changeEndpoints) {
+                var endpointFunc = null;
+                if (changeEndpoints) {
+                    endpointFunc = function (ep) {
+                        var state = ep.isVisible();
+                        ep.setVisible(!state);
+                    };
+                }
+                _operation(elId, function (jpc) {
+                    var state = jpc.isVisible();
+                    jpc.setVisible(!state);
+                }, endpointFunc);
+            },
+
+        // TODO comparison performance
+            _getCachedData = function (elId) {
+                var o = offsets[elId];
+                if (!o) {
+                    return _updateOffset({elId: elId});
+                }
+                else {
+                    return {o: o, s: sizes[elId]};
+                }
+            },
+
+            /**
+             * gets an id for the given element, creating and setting one if
+             * necessary.  the id is of the form
+             *
+             *    jsPlumb_<instance index>_<index in instance>
+             *
+             * where "index in instance" is a monotonically increasing integer that starts at 0,
+             * for each instance.  this method is used not only to assign ids to elements that do not
+             * have them but also to connections and endpoints.
+             */
+            _getId = function (element, uuid, doNotCreateIfNotFound) {
+                if (_ju.isString(element)) {
+                    return element;
+                }
+                if (element == null) {
+                    return null;
+                }
+                var id = _currentInstance.getAttribute(element, "id");
+                if (!id || id === "undefined") {
+                    // check if fixed uuid parameter is given
+                    if (arguments.length === 2 && arguments[1] !== undefined) {
+                        id = uuid;
+                    }
+                    else if (arguments.length === 1 || (arguments.length === 3 && !arguments[2])) {
+                        id = "jsPlumb_" + _instanceIndex + "_" + _idstamp();
+                    }
+
+                    if (!doNotCreateIfNotFound) {
+                        _currentInstance.setAttribute(element, "id", id);
+                    }
+                }
+                return id;
+            };
+
+        this.setConnectionBeingDragged = function (v) {
+            connectionBeingDragged = v;
+        };
+        this.isConnectionBeingDragged = function () {
+            return connectionBeingDragged;
+        };
+
+        /**
+         * Returns a map of all the elements this jsPlumbInstance is currently managing.
+         * @returns {Object} Map of [id-> {el, endpoint[], connection, position}] information.
+         */
+        this.getManagedElements = function() {
+            return managedElements;
+        };
+
+        this.connectorClass = "jtk-connector";
+        this.connectorOutlineClass = "jtk-connector-outline";
+        this.editableConnectorClass = "jtk-connector-editable";
+        this.connectedClass = "jtk-connected";
+        this.hoverClass = "jtk-hover";
+        this.endpointClass = "jtk-endpoint";
+        this.endpointConnectedClass = "jtk-endpoint-connected";
+        this.endpointFullClass = "jtk-endpoint-full";
+        this.endpointDropAllowedClass = "jtk-endpoint-drop-allowed";
+        this.endpointDropForbiddenClass = "jtk-endpoint-drop-forbidden";
+        this.overlayClass = "jtk-overlay";
+        this.draggingClass = "jtk-dragging";
+        this.elementDraggingClass = "jtk-element-dragging";
+        this.sourceElementDraggingClass = "jtk-source-element-dragging";
+        this.targetElementDraggingClass = "jtk-target-element-dragging";
+        this.endpointAnchorClassPrefix = "jtk-endpoint-anchor";
+        this.hoverSourceClass = "jtk-source-hover";
+        this.hoverTargetClass = "jtk-target-hover";
+        this.dragSelectClass = "jtk-drag-select";
+
+        this.Anchors = {};
+        this.Connectors = {  "svg": {} };
+        this.Endpoints = { "svg": {} };
+        this.Overlays = { "svg": {} } ;
+        this.ConnectorRenderers = {};
+        this.SVG = "svg";
+
+// --------------------------- jsPlumbInstance public API ---------------------------------------------------------
+
+
+        this.addEndpoint = function (el, params, referenceParams) {
+            referenceParams = referenceParams || {};
+            var p = jsPlumb.extend({}, referenceParams);
+            jsPlumb.extend(p, params);
+            p.endpoint = p.endpoint || _currentInstance.Defaults.Endpoint;
+            p.paintStyle = p.paintStyle || _currentInstance.Defaults.EndpointStyle;
+
+            var results = [],
+                inputs = (_ju.isArray(el) || (el.length != null && !_ju.isString(el))) ? el : [ el ];
+
+            for (var i = 0, j = inputs.length; i < j; i++) {
+                p.source = _currentInstance.getElement(inputs[i]);
+                _ensureContainer(p.source);
+
+                var id = _getId(p.source), e = _newEndpoint(p, id);
+
+                // ensure element is managed.
+                var myOffset = _manage(id, p.source).info.o;
+                _ju.addToList(endpointsByElement, id, e);
+
+                if (!_suspendDrawing) {
+                    e.paint({
+                        anchorLoc: e.anchor.compute({ xy: [ myOffset.left, myOffset.top ], wh: sizes[id], element: e, timestamp: _suspendedAt }),
+                        timestamp: _suspendedAt
+                    });
+                }
+
+                results.push(e);
+            }
+
+            return results.length === 1 ? results[0] : results;
+        };
+
+        this.addEndpoints = function (el, endpoints, referenceParams) {
+            var results = [];
+            for (var i = 0, j = endpoints.length; i < j; i++) {
+                var e = _currentInstance.addEndpoint(el, endpoints[i], referenceParams);
+                if (_ju.isArray(e)) {
+                    Array.prototype.push.apply(results, e);
+                }
+                else {
+                    results.push(e);
+                }
+            }
+            return results;
+        };
+
+        this.animate = function (el, properties, options) {
+            if (!this.animationSupported) {
+                return false;
+            }
+
+            options = options || {};
+            var del = _currentInstance.getElement(el),
+                id = _getId(del),
+                stepFunction = jsPlumb.animEvents.step,
+                completeFunction = jsPlumb.animEvents.complete;
+
+            options[stepFunction] = _ju.wrap(options[stepFunction], function () {
+                _currentInstance.revalidate(id);
+            });
+
+            // onComplete repaints, just to make sure everything looks good at the end of the animation.
+            options[completeFunction] = _ju.wrap(options[completeFunction], function () {
+                _currentInstance.revalidate(id);
+            });
+
+            _currentInstance.doAnimate(del, properties, options);
+        };
+
+        /**
+         * checks for a listener for the given condition, executing it if found, passing in the given value.
+         * condition listeners would have been attached using "bind" (which is, you could argue, now overloaded, since
+         * firing click events etc is a bit different to what this does).  i thought about adding a "bindCondition"
+         * or something, but decided against it, for the sake of simplicity. jsPlumb will never fire one of these
+         * condition events anyway.
+         */
+        this.checkCondition = function (conditionName, args) {
+            var l = _currentInstance.getListener(conditionName),
+                r = true;
+
+            if (l && l.length > 0) {
+                var values = Array.prototype.slice.call(arguments, 1);
+                try {
+                    for (var i = 0, j = l.length; i < j; i++) {
+                        r = r && l[i].apply(l[i], values);
+                    }
+                }
+                catch (e) {
+                    _ju.log(_currentInstance, "cannot check condition [" + conditionName + "]" + e);
+                }
+            }
+            return r;
+        };
+
+        this.connect = function (params, referenceParams) {
+            // prepare a final set of parameters to create connection with
+            var _p = _prepareConnectionParams(params, referenceParams), jpc;
+            // TODO probably a nicer return value if the connection was not made.  _prepareConnectionParams
+            // will return null (and log something) if either endpoint was full.  what would be nicer is to
+            // create a dedicated 'error' object.
+            if (_p) {
+                if (_p.source == null && _p.sourceEndpoint == null) {
+                    _ju.log("Cannot establish connection - source does not exist");
+                    return;
+                }
+                if (_p.target == null && _p.targetEndpoint == null) {
+                    _ju.log("Cannot establish connection - target does not exist");
+                    return;
+                }
+                _ensureContainer(_p.source);
+                // create the connection.  it is not yet registered
+                jpc = _newConnection(_p);
+                // now add it the model, fire an event, and redraw
+                _finaliseConnection(jpc, _p);
+            }
+            return jpc;
+        };
+
+        var stTypes = [
+            { el: "source", elId: "sourceId", epDefs: "sourceEndpointDefinitions" },
+            { el: "target", elId: "targetId", epDefs: "targetEndpointDefinitions" }
+        ];
+
+        var _set = function (c, el, idx, doNotRepaint) {
+            var ep, _st = stTypes[idx], cId = c[_st.elId], cEl = c[_st.el], sid, sep,
+                oldEndpoint = c.endpoints[idx];
+
+            var evtParams = {
+                index: idx,
+                originalSourceId: idx === 0 ? cId : c.sourceId,
+                newSourceId: c.sourceId,
+                originalTargetId: idx === 1 ? cId : c.targetId,
+                newTargetId: c.targetId,
+                connection: c
+            };
+
+            if (el.constructor === jsPlumb.Endpoint) {
+                ep = el;
+                ep.addConnection(c);
+                el = ep.element;
+            }
+            else {
+                sid = _getId(el);
+                sep = this[_st.epDefs][sid];
+
+                if (sid === c[_st.elId]) {
+                    ep = null; // dont change source/target if the element is already the one given.
+                }
+                else if (sep) {
+                    for (var t in sep) {
+                        if (!sep[t].enabled) {
+                            return;
+                        }
+                        ep = sep[t].endpoint != null && sep[t].endpoint._jsPlumb ? sep[t].endpoint : this.addEndpoint(el, sep[t].def);
+                        if (sep[t].uniqueEndpoint) {
+                            sep[t].endpoint = ep;
+                        }
+                        ep.addConnection(c);
+                    }
+                }
+                else {
+                    ep = c.makeEndpoint(idx === 0, el, sid);
+                }
+            }
+
+            if (ep != null) {
+                oldEndpoint.detachFromConnection(c);
+                c.endpoints[idx] = ep;
+                c[_st.el] = ep.element;
+                c[_st.elId] = ep.elementId;
+                evtParams[idx === 0 ? "newSourceId" : "newTargetId"] = ep.elementId;
+
+                fireMoveEvent(evtParams);
+
+                if (!doNotRepaint) {
+                    c.repaint();
+                }
+            }
+
+            evtParams.element = el;
+            return evtParams;
+
+        }.bind(this);
+
+        this.setSource = function (connection, el, doNotRepaint) {
+            var p = _set(connection, el, 0, doNotRepaint);
+            this.anchorManager.sourceChanged(p.originalSourceId, p.newSourceId, connection, p.el);
+        };
+        this.setTarget = function (connection, el, doNotRepaint) {
+            var p = _set(connection, el, 1, doNotRepaint);
+            this.anchorManager.updateOtherEndpoint(p.originalSourceId, p.originalTargetId, p.newTargetId, connection);
+        };
+
+        this.deleteEndpoint = function (object, dontUpdateHover, deleteAttachedObjects) {
+            var endpoint = (typeof object === "string") ? endpointsByUUID[object] : object;
+            if (endpoint) {
+                _currentInstance.deleteObject({ endpoint: endpoint, dontUpdateHover: dontUpdateHover, deleteAttachedObjects:deleteAttachedObjects });
+            }
+            return _currentInstance;
+        };
+
+        this.deleteEveryEndpoint = function () {
+            var _is = _currentInstance.setSuspendDrawing(true);
+            for (var id in endpointsByElement) {
+                var endpoints = endpointsByElement[id];
+                if (endpoints && endpoints.length) {
+                    for (var i = 0, j = endpoints.length; i < j; i++) {
+                        _currentInstance.deleteEndpoint(endpoints[i], true);
+                    }
+                }
+            }
+            endpointsByElement = {};
+            managedElements = {};
+            endpointsByUUID = {};
+            offsets = {};
+            offsetTimestamps = {};
+            _currentInstance.anchorManager.reset();
+            var dm = _currentInstance.getDragManager();
+            if (dm) {
+                dm.reset();
+            }
+            if (!_is) {
+                _currentInstance.setSuspendDrawing(false);
+            }
+            return _currentInstance;
+        };
+
+        var fireDetachEvent = function (jpc, doFireEvent, originalEvent) {
+            // may have been given a connection, or in special cases, an object
+            var connType = _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType(),
+                argIsConnection = jpc.constructor === connType,
+                params = argIsConnection ? {
+                    connection: jpc,
+                    source: jpc.source, target: jpc.target,
+                    sourceId: jpc.sourceId, targetId: jpc.targetId,
+                    sourceEndpoint: jpc.endpoints[0], targetEndpoint: jpc.endpoints[1]
+                } : jpc;
+
+            if (doFireEvent) {
+                _currentInstance.fire("connectionDetached", params, originalEvent);
+            }
+
+            // always fire this. used by internal jsplumb stuff.
+            _currentInstance.fire("internal.connectionDetached", params, originalEvent);
+
+            _currentInstance.anchorManager.connectionDetached(params);
+        };
+
+        var fireMoveEvent = _currentInstance.fireMoveEvent = function (params, evt) {
+            _currentInstance.fire("connectionMoved", params, evt);
+        };
+
+        this.unregisterEndpoint = function (endpoint) {
+            if (endpoint._jsPlumb.uuid) {
+                endpointsByUUID[endpoint._jsPlumb.uuid] = null;
+            }
+            _currentInstance.anchorManager.deleteEndpoint(endpoint);
+            // TODO at least replace this with a removeWithFunction call.
+            for (var e in endpointsByElement) {
+                var endpoints = endpointsByElement[e];
+                if (endpoints) {
+                    var newEndpoints = [];
+                    for (var i = 0, j = endpoints.length; i < j; i++) {
+                        if (endpoints[i] !== endpoint) {
+                            newEndpoints.push(endpoints[i]);
+                        }
+                    }
+
+                    endpointsByElement[e] = newEndpoints;
+                }
+                if (endpointsByElement[e].length < 1) {
+                    delete endpointsByElement[e];
+                }
+            }
+        };
+
+        var IS_DETACH_ALLOWED = "isDetachAllowed";
+        var BEFORE_DETACH = "beforeDetach";
+        var CHECK_CONDITION = "checkCondition";
+
+        /**
+         * Deletes a Connection.
+         * @method deleteConnection
+         * @param connection Connection to delete
+         * @param {Object} [params] Optional delete parameters
+         * @param {Boolean} [params.doNotFireEvent=false] If true, a connection detached event will not be fired. Otherwise one will.
+         * @param {Boolean} [params.force=false] If true, the connection will be deleted even if a beforeDetach interceptor tries to stop the deletion.
+         * @returns {Boolean} True if the connection was deleted, false otherwise.
+         */
+        this.deleteConnection = function(connection, params) {
+
+            if (connection != null) {
+                params = params || {};
+
+                if (params.force || _ju.functionChain(true, false, [
+                    [ connection.endpoints[0], IS_DETACH_ALLOWED, [ connection ] ],
+                    [ connection.endpoints[1], IS_DETACH_ALLOWED, [ connection ] ],
+                    [ connection, IS_DETACH_ALLOWED, [ connection ] ],
+                    [ _currentInstance, CHECK_CONDITION, [ BEFORE_DETACH, connection ] ]
+                ])) {
+
+                    connection.setHover(false);
+                    fireDetachEvent(connection, !connection.pending && params.fireEvent !== false, params.originalEvent);
+
+                    connection.endpoints[0].detachFromConnection(connection);
+                    connection.endpoints[1].detachFromConnection(connection);
+                    _ju.removeWithFunction(connections, function (_c) {
+                        return connection.id === _c.id;
+                    });
+
+                    connection.cleanup();
+                    connection.destroy();
+                    return true;
+                }
+            }
+            return false;
+        };
+
+        /**
+         * Remove all Connections from all elements, but leaves Endpoints in place ((unless a connection is set to auto delete its Endpoints).
+         * @method deleteEveryConnection
+         * @param {Object} [params] optional params object for the call
+         * @param {Boolean} [params.fireEvent=true] Whether or not to fire detach events
+         * @param {Boolean} [params.forceDetach=false] If true, this call will ignore any `beforeDetach` interceptors.
+         * @returns {Number} The number of connections that were deleted.
+         */
+        this.deleteEveryConnection = function (params) {
+            params = params || {};
+            var count = connections.length, deletedCount = 0;
+            _currentInstance.batch(function () {
+                for (var i = 0; i < count; i++) {
+                    deletedCount += _currentInstance.deleteConnection(connections[0], params) ? 1 : 0;
+                }
+            });
+            return deletedCount;
+        };
+
+        /**
+         * Removes all an element's Connections.
+         * @method deleteConnectionsForElement
+         * @param {Object} el Either the id of the element, or a selector for the element.
+         * @param {Object} [params] Optional parameters.
+         * @param {Boolean} [params.fireEvent=true] Whether or not to fire the detach event.
+         * @param {Boolean} [params.forceDetach=false] If true, this call will ignore any `beforeDetach` interceptors.
+         * @return {jsPlumbInstance} The current jsPlumb instance.
+         */
+        this.deleteConnectionsForElement = function (el, params) {
+            params = params || {};
+            el = _currentInstance.getElement(el);
+            var id = _getId(el), endpoints = endpointsByElement[id];
+            if (endpoints && endpoints.length) {
+                for (var i = 0, j = endpoints.length; i < j; i++) {
+                    endpoints[i].deleteEveryConnection(params);
+                }
+            }
+            return _currentInstance;
+        };
+
+        /// not public.  but of course its exposed. how to change this.
+        this.deleteObject = function (params) {
+            var result = {
+                    endpoints: {},
+                    connections: {},
+                    endpointCount: 0,
+                    connectionCount: 0
+                },
+                deleteAttachedObjects = params.deleteAttachedObjects !== false;
+
+            var unravelConnection = function (connection) {
+                if (connection != null && result.connections[connection.id] == null) {
+                    if (!params.dontUpdateHover && connection._jsPlumb != null) {
+                        connection.setHover(false);
+                    }
+                    result.connections[connection.id] = connection;
+                    result.connectionCount++;
+                }
+            };
+            var unravelEndpoint = function (endpoint) {
+                if (endpoint != null && result.endpoints[endpoint.id] == null) {
+                    if (!params.dontUpdateHover && endpoint._jsPlumb != null) {
+                        endpoint.setHover(false);
+                    }
+                    result.endpoints[endpoint.id] = endpoint;
+                    result.endpointCount++;
+
+                    if (deleteAttachedObjects) {
+                        for (var i = 0; i < endpoint.connections.length; i++) {
+                            var c = endpoint.connections[i];
+                            unravelConnection(c);
+                        }
+                    }
+                }
+            };
+
+            if (params.connection) {
+                unravelConnection(params.connection);
+            }
+            else {
+                unravelEndpoint(params.endpoint);
+            }
+
+            // loop through connections
+            for (var i in result.connections) {
+                var c = result.connections[i];
+                if (c._jsPlumb) {
+                    _ju.removeWithFunction(connections, function (_c) {
+                        return c.id === _c.id;
+                    });
+
+                    fireDetachEvent(c, params.fireEvent === false ? false : !c.pending, params.originalEvent);
+                    var doNotCleanup = params.deleteAttachedObjects == null ? null : !params.deleteAttachedObjects;
+
+                    c.endpoints[0].detachFromConnection(c, null, doNotCleanup);
+                    c.endpoints[1].detachFromConnection(c, null, doNotCleanup);
+
+                    c.cleanup(true);
+                    c.destroy(true);
+                }
+            }
+
+            // loop through endpoints
+            for (var j in result.endpoints) {
+                var e = result.endpoints[j];
+                if (e._jsPlumb) {
+                    _currentInstance.unregisterEndpoint(e);
+                    // FIRE some endpoint deleted event?
+                    e.cleanup(true);
+                    e.destroy(true);
+                }
+            }
+
+            return result;
+        };
+
+        this.draggable = function (el, options) {
+            var info;
+            _each(function(_el) {
+                 info = _info(_el);
+                if (info.el) {
+                    _initDraggableIfNecessary(info.el, true, options, info.id, true);
+                }
+            }, el);
+            return _currentInstance;
+        };
+
+        this.droppable = function(el, options) {
+            var info;
+            options = options || {};
+            options.allowLoopback = false;
+            _each(function(_el) {
+                info = _info(_el);
+                if (info.el) {
+                    _currentInstance.initDroppable(info.el, options);
+                }
+            }, el);
+            return _currentInstance;
+        };
+
+        // helpers for select/selectEndpoints
+        var _setOperation = function (list, func, args, selector) {
+                for (var i = 0, j = list.length; i < j; i++) {
+                    list[i][func].apply(list[i], args);
+                }
+                return selector(list);
+            },
+            _getOperation = function (list, func, args) {
+                var out = [];
+                for (var i = 0, j = list.length; i < j; i++) {
+                    out.push([ list[i][func].apply(list[i], args), list[i] ]);
+                }
+                return out;
+            },
+            setter = function (list, func, selector) {
+                return function () {
+                    return _setOperation(list, func, arguments, selector);
+                };
+            },
+            getter = function (list, func) {
+                return function () {
+                    return _getOperation(list, func, arguments);
+                };
+            },
+            prepareList = function (input, doNotGetIds) {
+                var r = [];
+                if (input) {
+                    if (typeof input === 'string') {
+                        if (input === "*") {
+                            return input;
+                        }
+                        r.push(input);
+                    }
+                    else {
+                        if (doNotGetIds) {
+                            r = input;
+                        }
+                        else {
+                            if (input.length) {
+                                for (var i = 0, j = input.length; i < j; i++) {
+                                    r.push(_info(input[i]).id);
+                                }
+                            }
+                            else {
+                                r.push(_info(input).id);
+                            }
+                        }
+                    }
+                }
+                return r;
+            },
+            filterList = function (list, value, missingIsFalse) {
+                if (list === "*") {
+                    return true;
+                }
+                return list.length > 0 ? list.indexOf(value) !== -1 : !missingIsFalse;
+            };
+
+        // get some connections, specifying source/target/scope
+        this.getConnections = function (options, flat) {
+            if (!options) {
+                options = {};
+            } else if (options.constructor === String) {
+                options = { "scope": options };
+            }
+            var scope = options.scope || _currentInstance.getDefaultScope(),
+                scopes = prepareList(scope, true),
+                sources = prepareList(options.source),
+                targets = prepareList(options.target),
+                results = (!flat && scopes.length > 1) ? {} : [],
+                _addOne = function (scope, obj) {
+                    if (!flat && scopes.length > 1) {
+                        var ss = results[scope];
+                        if (ss == null) {
+                            ss = results[scope] = [];
+                        }
+                        ss.push(obj);
+                    } else {
+                        results.push(obj);
+                    }
+                };
+
+            for (var j = 0, jj = connections.length; j < jj; j++) {
+                var c = connections[j],
+                    sourceId = c.proxies && c.proxies[0] ? c.proxies[0].originalEp.elementId : c.sourceId,
+                    targetId = c.proxies && c.proxies[1] ? c.proxies[1].originalEp.elementId : c.targetId;
+
+                if (filterList(scopes, c.scope) && filterList(sources, sourceId) && filterList(targets, targetId)) {
+                    _addOne(c.scope, c);
+                }
+            }
+
+            return results;
+        };
+
+        var _curryEach = function (list, executor) {
+                return function (f) {
+                    for (var i = 0, ii = list.length; i < ii; i++) {
+                        f(list[i]);
+                    }
+                    return executor(list);
+                };
+            },
+            _curryGet = function (list) {
+                return function (idx) {
+                    return list[idx];
+                };
+            };
+
+        var _makeCommonSelectHandler = function (list, executor) {
+            var out = {
+                    length: list.length,
+                    each: _curryEach(list, executor),
+                    get: _curryGet(list)
+                },
+                setters = ["setHover", "removeAllOverlays", "setLabel", "addClass", "addOverlay", "removeOverlay",
+                    "removeOverlays", "showOverlay", "hideOverlay", "showOverlays", "hideOverlays", "setPaintStyle",
+                    "setHoverPaintStyle", "setSuspendEvents", "setParameter", "setParameters", "setVisible",
+                    "repaint", "addType", "toggleType", "removeType", "removeClass", "setType", "bind", "unbind" ],
+
+                getters = ["getLabel", "getOverlay", "isHover", "getParameter", "getParameters", "getPaintStyle",
+                    "getHoverPaintStyle", "isVisible", "hasType", "getType", "isSuspendEvents" ],
+                i, ii;
+
+            for (i = 0, ii = setters.length; i < ii; i++) {
+                out[setters[i]] = setter(list, setters[i], executor);
+            }
+
+            for (i = 0, ii = getters.length; i < ii; i++) {
+                out[getters[i]] = getter(list, getters[i]);
+            }
+
+            return out;
+        };
+
+        var _makeConnectionSelectHandler = function (list) {
+            var common = _makeCommonSelectHandler(list, _makeConnectionSelectHandler);
+            return jsPlumb.extend(common, {
+                // setters
+                setDetachable: setter(list, "setDetachable", _makeConnectionSelectHandler),
+                setReattach: setter(list, "setReattach", _makeConnectionSelectHandler),
+                setConnector: setter(list, "setConnector", _makeConnectionSelectHandler),
+                delete: function () {
+                    for (var i = 0, ii = list.length; i < ii; i++) {
+                        _currentInstance.deleteConnection(list[i]);
+                    }
+                },
+                // getters
+                isDetachable: getter(list, "isDetachable"),
+                isReattach: getter(list, "isReattach")
+            });
+        };
+
+        var _makeEndpointSelectHandler = function (list) {
+            var common = _makeCommonSelectHandler(list, _makeEndpointSelectHandler);
+            return jsPlumb.extend(common, {
+                setEnabled: setter(list, "setEnabled", _makeEndpointSelectHandler),
+                setAnchor: setter(list, "setAnchor", _makeEndpointSelectHandler),
+                isEnabled: getter(list, "isEnabled"),
+                deleteEveryConnection: function () {
+                    for (var i = 0, ii = list.length; i < ii; i++) {
+                        list[i].deleteEveryConnection();
+                    }
+                },
+                "delete": function () {
+                    for (var i = 0, ii = list.length; i < ii; i++) {
+                        _currentInstance.deleteEndpoint(list[i]);
+                    }
+                }
+            });
+        };
+
+        this.select = function (params) {
+            params = params || {};
+            params.scope = params.scope || "*";
+            return _makeConnectionSelectHandler(params.connections || _currentInstance.getConnections(params, true));
+        };
+
+        this.selectEndpoints = function (params) {
+            params = params || {};
+            params.scope = params.scope || "*";
+            var noElementFilters = !params.element && !params.source && !params.target,
+                elements = noElementFilters ? "*" : prepareList(params.element),
+                sources = noElementFilters ? "*" : prepareList(params.source),
+                targets = noElementFilters ? "*" : prepareList(params.target),
+                scopes = prepareList(params.scope, true);
+
+            var ep = [];
+
+            for (var el in endpointsByElement) {
+                var either = filterList(elements, el, true),
+                    source = filterList(sources, el, true),
+                    sourceMatchExact = sources !== "*",
+                    target = filterList(targets, el, true),
+                    targetMatchExact = targets !== "*";
+
+                // if they requested 'either' then just match scope. otherwise if they requested 'source' (not as a wildcard) then we have to match only endpoints that have isSource set to to true, and the same thing with isTarget.
+                if (either || source || target) {
+                    inner:
+                        for (var i = 0, ii = endpointsByElement[el].length; i < ii; i++) {
+                            var _ep = endpointsByElement[el][i];
+                            if (filterList(scopes, _ep.scope, true)) {
+
+                                var noMatchSource = (sourceMatchExact && sources.length > 0 && !_ep.isSource),
+                                    noMatchTarget = (targetMatchExact && targets.length > 0 && !_ep.isTarget);
+
+                                if (noMatchSource || noMatchTarget) {
+                                    continue inner;
+                                }
+
+                                ep.push(_ep);
+                            }
+                        }
+                }
+            }
+
+            return _makeEndpointSelectHandler(ep);
+        };
+
+        // get all connections managed by the instance of jsplumb.
+        this.getAllConnections = function () {
+            return connections;
+        };
+        this.getDefaultScope = function () {
+            return DEFAULT_SCOPE;
+        };
+        // get an endpoint by uuid.
+        this.getEndpoint = _getEndpoint;
+        /**
+         * Gets the list of Endpoints for a given element.
+         * @method getEndpoints
+         * @param {String|Element|Selector} el The element to get endpoints for.
+         * @return {Endpoint[]} An array of Endpoints for the specified element.
+         */
+        this.getEndpoints = function (el) {
+            return endpointsByElement[_info(el).id] || [];
+        };
+        // gets the default endpoint type. used when subclassing. see wiki.
+        this.getDefaultEndpointType = function () {
+            return jsPlumb.Endpoint;
+        };
+        // gets the default connection type. used when subclassing.  see wiki.
+        this.getDefaultConnectionType = function () {
+            return jsPlumb.Connection;
+        };
+        /*
+         * Gets an element's id, creating one if necessary. really only exposed
+         * for the lib-specific functionality to access; would be better to pass
+         * the current instance into the lib-specific code (even though this is
+         * a static call. i just don't want to expose it to the public API).
+         */
+        this.getId = _getId;
+
+        this.appendElement = _appendElement;
+
+        var _hoverSuspended = false;
+        this.isHoverSuspended = function () {
+            return _hoverSuspended;
+        };
+        this.setHoverSuspended = function (s) {
+            _hoverSuspended = s;
+        };
+
+        // set an element's connections to be hidden
+        this.hide = function (el, changeEndpoints) {
+            _setVisible(el, "none", changeEndpoints);
+            return _currentInstance;
+        };
+
+        // exposed for other objects to use to get a unique id.
+        this.idstamp = _idstamp;
+
+        this.connectorsInitialized = false;
+        this.registerConnectorType = function (connector, name) {
+            connectorTypes.push([connector, name]);
+        };
+
+        // ensure that, if the current container exists, it is a DOM element and not a selector.
+        // if it does not exist and `candidate` is supplied, the offset parent of that element will be set as the Container.
+        // this is used to do a better default behaviour for the case that the user has not set a container:
+        // addEndpoint, makeSource, makeTarget and connect all call this method with the offsetParent of the
+        // element in question (for connect it is the source element). So if no container is set, it is inferred
+        // to be the offsetParent of the first element the user tries to connect.
+        var _ensureContainer = function (candidate) {
+            if (!_container && candidate) {
+                var can = _currentInstance.getElement(candidate);
+                if (can.offsetParent) {
+                    _currentInstance.setContainer(can.offsetParent);
+                }
+            }
+        };
+
+        var _getContainerFromDefaults = function () {
+            if (_currentInstance.Defaults.Container) {
+                _currentInstance.setContainer(_currentInstance.Defaults.Container);
+            }
+        };
+
+        // check if a given element is managed or not. if not, add to our map. if drawing is not suspended then
+        // we'll also stash its dimensions; otherwise we'll do this in a lazy way through updateOffset.
+        var _manage = _currentInstance.manage = function (id, element, _transient) {
+            if (!managedElements[id]) {
+                managedElements[id] = {
+                    el: element,
+                    endpoints: [],
+                    connections: []
+                };
+
+                managedElements[id].info = _updateOffset({ elId: id, timestamp: _suspendedAt });
+                if (!_transient) {
+                    _currentInstance.fire("manageElement", { id:id, info:managedElements[id].info, el:element });
+                }
+            }
+
+            return managedElements[id];
+        };
+
+        var _unmanage = function(id) {
+            if (managedElements[id]) {
+                delete managedElements[id];
+                _currentInstance.fire("unmanageElement", id);
+            }
+        };
+
+        /**
+         * updates the offset and size for a given element, and stores the
+         * values. if 'offset' is not null we use that (it would have been
+         * passed in from a drag call) because it's faster; but if it is null,
+         * or if 'recalc' is true in order to force a recalculation, we get the current values.
+         */
+        var _updateOffset = this.updateOffset = function (params) {
+
+            var timestamp = params.timestamp, recalc = params.recalc, offset = params.offset, elId = params.elId, s;
+            if (_suspendDrawing && !timestamp) {
+                timestamp = _suspendedAt;
+            }
+            if (!recalc) {
+                if (timestamp && timestamp === offsetTimestamps[elId]) {
+                    return {o: params.offset || offsets[elId], s: sizes[elId]};
+                }
+            }
+            if (recalc || (!offset && offsets[elId] == null)) { // if forced repaint or no offset available, we recalculate.
+
+                // get the current size and offset, and store them
+                s = managedElements[elId] ? managedElements[elId].el : null;
+                if (s != null) {
+                    sizes[elId] = _currentInstance.getSize(s);
+                    offsets[elId] = _currentInstance.getOffset(s);
+                    offsetTimestamps[elId] = timestamp;
+                }
+            } else {
+                offsets[elId] = offset || offsets[elId];
+                if (sizes[elId] == null) {
+                    s = managedElements[elId].el;
+                    if (s != null) {
+                        sizes[elId] = _currentInstance.getSize(s);
+                    }
+                }
+                offsetTimestamps[elId] = timestamp;
+            }
+
+            if (offsets[elId] && !offsets[elId].right) {
+                offsets[elId].right = offsets[elId].left + sizes[elId][0];
+                offsets[elId].bottom = offsets[elId].top + sizes[elId][1];
+                offsets[elId].width = sizes[elId][0];
+                offsets[elId].height = sizes[elId][1];
+                offsets[elId].centerx = offsets[elId].left + (offsets[elId].width / 2);
+                offsets[elId].centery = offsets[elId].top + (offsets[elId].height / 2);
+            }
+
+            return {o: offsets[elId], s: sizes[elId]};
+        };
+
+        /**
+         * callback from the current library to tell us to prepare ourselves (attach
+         * mouse listeners etc; can't do that until the library has provided a bind method)
+         */
+        this.init = function () {
+            rendererTypes = root.jsPlumb.getRenderModes();
+
+            var _oneType = function (renderer, name, fn) {
+                root.jsPlumb.Connectors[renderer][name] = function () {
+                    fn.apply(this, arguments);
+                    root.jsPlumb.ConnectorRenderers[renderer].apply(this, arguments);
+                };
+                _ju.extend(root.jsPlumb.Connectors[renderer][name], [ fn, root.jsPlumb.ConnectorRenderers[renderer]]);
+            };
+
+            if (!root.jsPlumb.connectorsInitialized) {
+                for (var i = 0; i < connectorTypes.length; i++) {
+                    for (var j = 0; j < rendererTypes.length; j++) {
+                        _oneType(rendererTypes[j], connectorTypes[i][1], connectorTypes[i][0]);
+                    }
+
+                }
+                root.jsPlumb.connectorsInitialized = true;
+            }
+
+            if (!initialized) {
+                _getContainerFromDefaults();
+                _currentInstance.anchorManager = new root.jsPlumb.AnchorManager({jsPlumbInstance: _currentInstance});
+                initialized = true;
+                _currentInstance.fire("ready", _currentInstance);
+            }
+        }.bind(this);
+
+        this.log = log;
+        this.jsPlumbUIComponent = jsPlumbUIComponent;
+
+        /*
+         * Creates an anchor with the given params.
+         *
+         *
+         * Returns: The newly created Anchor.
+         * Throws: an error if a named anchor was not found.
+         */
+        this.makeAnchor = function () {
+            var pp, _a = function (t, p) {
+                if (root.jsPlumb.Anchors[t]) {
+                    return new root.jsPlumb.Anchors[t](p);
+                }
+                if (!_currentInstance.Defaults.DoNotThrowErrors) {
+                    throw { msg: "jsPlumb: unknown anchor type '" + t + "'" };
+                }
+            };
+            if (arguments.length === 0) {
+                return null;
+            }
+            var specimen = arguments[0], elementId = arguments[1], jsPlumbInstance = arguments[2], newAnchor = null;
+            // if it appears to be an anchor already...
+            if (specimen.compute && specimen.getOrientation) {
+                return specimen;
+            }  //TODO hazy here about whether it should be added or is already added somehow.
+            // is it the name of an anchor type?
+            else if (typeof specimen === "string") {
+                newAnchor = _a(arguments[0], {elementId: elementId, jsPlumbInstance: _currentInstance});
+            }
+            // is it an array? it will be one of:
+            // an array of [spec, params] - this defines a single anchor, which may be dynamic, but has parameters.
+            // an array of arrays - this defines some dynamic anchors
+            // an array of numbers - this defines a single anchor.
+            else if (_ju.isArray(specimen)) {
+                if (_ju.isArray(specimen[0]) || _ju.isString(specimen[0])) {
+                    // if [spec, params] format
+                    if (specimen.length === 2 && _ju.isObject(specimen[1])) {
+                        // if first arg is a string, its a named anchor with params
+                        if (_ju.isString(specimen[0])) {
+                            pp = root.jsPlumb.extend({elementId: elementId, jsPlumbInstance: _currentInstance}, specimen[1]);
+                            newAnchor = _a(specimen[0], pp);
+                        }
+                        // otherwise first arg is array, second is params. we treat as a dynamic anchor, which is fine
+                        // even if the first arg has only one entry. you could argue all anchors should be implicitly dynamic in fact.
+                        else {
+                            pp = root.jsPlumb.extend({elementId: elementId, jsPlumbInstance: _currentInstance, anchors: specimen[0]}, specimen[1]);
+                            newAnchor = new root.jsPlumb.DynamicAnchor(pp);
+                        }
+                    }
+                    else {
+                        newAnchor = new jsPlumb.DynamicAnchor({anchors: specimen, selector: null, elementId: elementId, jsPlumbInstance: _currentInstance});
+                    }
+
+                }
+                else {
+                    var anchorParams = {
+                        x: specimen[0], y: specimen[1],
+                        orientation: (specimen.length >= 4) ? [ specimen[2], specimen[3] ] : [0, 0],
+                        offsets: (specimen.length >= 6) ? [ specimen[4], specimen[5] ] : [ 0, 0 ],
+                        elementId: elementId,
+                        jsPlumbInstance: _currentInstance,
+                        cssClass: specimen.length === 7 ? specimen[6] : null
+                    };
+                    newAnchor = new root.jsPlumb.Anchor(anchorParams);
+                    newAnchor.clone = function () {
+                        return new root.jsPlumb.Anchor(anchorParams);
+                    };
+                }
+            }
+
+            if (!newAnchor.id) {
+                newAnchor.id = "anchor_" + _idstamp();
+            }
+            return newAnchor;
+        };
+
+        /**
+         * makes a list of anchors from the given list of types or coords, eg
+         * ["TopCenter", "RightMiddle", "BottomCenter", [0, 1, -1, -1] ]
+         */
+        this.makeAnchors = function (types, elementId, jsPlumbInstance) {
+            var r = [];
+            for (var i = 0, ii = types.length; i < ii; i++) {
+                if (typeof types[i] === "string") {
+                    r.push(root.jsPlumb.Anchors[types[i]]({elementId: elementId, jsPlumbInstance: jsPlumbInstance}));
+                }
+                else if (_ju.isArray(types[i])) {
+                    r.push(_currentInstance.makeAnchor(types[i], elementId, jsPlumbInstance));
+                }
+            }
+            return r;
+        };
+
+        /**
+         * Makes a dynamic anchor from the given list of anchors (which may be in shorthand notation as strings or dimension arrays, or Anchor
+         * objects themselves) and the given, optional, anchorSelector function (jsPlumb uses a default if this is not provided; most people will
+         * not need to provide this - i think).
+         */
+        this.makeDynamicAnchor = function (anchors, anchorSelector) {
+            return new root.jsPlumb.DynamicAnchor({anchors: anchors, selector: anchorSelector, elementId: null, jsPlumbInstance: _currentInstance});
+        };
+
+// --------------------- makeSource/makeTarget ---------------------------------------------- 
+
+        this.targetEndpointDefinitions = {};
+        this.sourceEndpointDefinitions = {};
+
+        var selectorFilter = function (evt, _el, selector, _instance, negate) {
+            var t = evt.target || evt.srcElement, ok = false,
+                sel = _instance.getSelector(_el, selector);
+            for (var j = 0; j < sel.length; j++) {
+                if (sel[j] === t) {
+                    ok = true;
+                    break;
+                }
+            }
+            return negate ? !ok : ok;
+        };
+
+        var _makeElementDropHandler = function (elInfo, p, dropOptions, isSource, isTarget) {
+            var proxyComponent = new jsPlumbUIComponent(p);
+            var _drop = p._jsPlumb.EndpointDropHandler({
+                jsPlumb: _currentInstance,
+                enabled: function () {
+                    return elInfo.def.enabled;
+                },
+                isFull: function () {
+                    var targetCount = _currentInstance.select({target: elInfo.id}).length;
+                    return elInfo.def.maxConnections > 0 && targetCount >= elInfo.def.maxConnections;
+                },
+                element: elInfo.el,
+                elementId: elInfo.id,
+                isSource: isSource,
+                isTarget: isTarget,
+                addClass: function (clazz) {
+                    _currentInstance.addClass(elInfo.el, clazz);
+                },
+                removeClass: function (clazz) {
+                    _currentInstance.removeClass(elInfo.el, clazz);
+                },
+                onDrop: function (jpc) {
+                    var source = jpc.endpoints[0];
+                    source.anchor.locked = false;
+                },
+                isDropAllowed: function () {
+                    return proxyComponent.isDropAllowed.apply(proxyComponent, arguments);
+                },
+                isRedrop:function(jpc) {
+                    return (jpc.suspendedElement != null && jpc.suspendedEndpoint != null && jpc.suspendedEndpoint.element === elInfo.el);
+                },
+                getEndpoint: function (jpc) {
+
+                    // make a new Endpoint for the target, or get it from the cache if uniqueEndpoint
+                    // is set. if its a redrop the new endpoint will be immediately cleaned up.
+
+                    var newEndpoint = elInfo.def.endpoint;
+
+                    // if no cached endpoint, or there was one but it has been cleaned up
+                    // (ie. detached), create a new one
+                    if (newEndpoint == null || newEndpoint._jsPlumb == null) {
+                        var eps = _currentInstance.deriveEndpointAndAnchorSpec(jpc.getType().join(" "), true);
+                        var pp = eps.endpoints ? root.jsPlumb.extend(p, {
+                            endpoint:elInfo.def.def.endpoint || eps.endpoints[1]
+                        }) :p;
+                        if (eps.anchors) {
+                            pp = root.jsPlumb.extend(pp, {
+                                anchor:elInfo.def.def.anchor || eps.anchors[1]
+                            });
+                        }
+                        newEndpoint = _currentInstance.addEndpoint(elInfo.el, pp);
+                        newEndpoint._mtNew = true;
+                    }
+
+                    if (p.uniqueEndpoint) {
+                        elInfo.def.endpoint = newEndpoint;
+                    }
+
+                    newEndpoint.setDeleteOnEmpty(true);
+
+                    // if connection is detachable, init the new endpoint to be draggable, to support that happening.
+                    if (jpc.isDetachable()) {
+                        newEndpoint.initDraggable();
+                    }
+
+                    // if the anchor has a 'positionFinder' set, then delegate to that function to find
+                    // out where to locate the anchor.
+                    if (newEndpoint.anchor.positionFinder != null) {
+                        var dropPosition = _currentInstance.getUIPosition(arguments, _currentInstance.getZoom()),
+                            elPosition = _currentInstance.getOffset(elInfo.el),
+                            elSize = _currentInstance.getSize(elInfo.el),
+                            ap = dropPosition == null ? [0,0] : newEndpoint.anchor.positionFinder(dropPosition, elPosition, elSize, newEndpoint.anchor.constructorParams);
+
+                        newEndpoint.anchor.x = ap[0];
+                        newEndpoint.anchor.y = ap[1];
+                        // now figure an orientation for it..kind of hard to know what to do actually. probably the best thing i can do is to
+                        // support specifying an orientation in the anchor's spec. if one is not supplied then i will make the orientation
+                        // be what will cause the most natural link to the source: it will be pointing at the source, but it needs to be
+                        // specified in one axis only, and so how to make that choice? i think i will use whichever axis is the one in which
+                        // the target is furthest away from the source.
+                    }
+
+                    return newEndpoint;
+                },
+                maybeCleanup: function (ep) {
+                    if (ep._mtNew && ep.connections.length === 0) {
+                        _currentInstance.deleteObject({endpoint: ep});
+                    }
+                    else {
+                        delete ep._mtNew;
+                    }
+                }
+            });
+
+            // wrap drop events as needed and initialise droppable
+            var dropEvent = root.jsPlumb.dragEvents.drop;
+            dropOptions.scope = dropOptions.scope || (p.scope || _currentInstance.Defaults.Scope);
+            dropOptions[dropEvent] = _ju.wrap(dropOptions[dropEvent], _drop, true);
+
+            // if target, return true from the over event. this will cause katavorio to stop setting drops to hover
+            // if multipleDrop is set to false.
+            if (isTarget) {
+                dropOptions[root.jsPlumb.dragEvents.over] = function () { return true; };
+            }
+
+            // vanilla jsplumb only
+            if (p.allowLoopback === false) {
+                dropOptions.canDrop = function (_drag) {
+                    var de = _drag.getDragElement()._jsPlumbRelatedElement;
+                    return de !== elInfo.el;
+                };
+            }
+            _currentInstance.initDroppable(elInfo.el, dropOptions, "internal");
+
+            return _drop;
+
+        };
+
+        // see API docs
+        this.makeTarget = function (el, params, referenceParams) {
+
+            // put jsplumb ref into params without altering the params passed in
+            var p = root.jsPlumb.extend({_jsPlumb: this}, referenceParams);
+            root.jsPlumb.extend(p, params);
+
+            var maxConnections = p.maxConnections || -1,
+
+                _doOne = function (el) {
+
+                    // get the element's id and store the endpoint definition for it.  jsPlumb.connect calls will look for one of these,
+                    // and use the endpoint definition if found.
+                    // decode the info for this element (id and element)
+                    var elInfo = _info(el),
+                        elid = elInfo.id,
+                        dropOptions = root.jsPlumb.extend({}, p.dropOptions || {}),
+                        type = p.connectionType || "default";
+
+                    this.targetEndpointDefinitions[elid] = this.targetEndpointDefinitions[elid] || {};
+
+                    _ensureContainer(elid);
+
+                    // if this is a group and the user has not mandated a rank, set to -1 so that Nodes takes
+                    // precedence.
+                    if (elInfo.el._isJsPlumbGroup && dropOptions.rank == null) {
+                        dropOptions.rank = -1;
+                    }
+
+                    // store the definition
+                    var _def = {
+                        def: root.jsPlumb.extend({}, p),
+                        uniqueEndpoint: p.uniqueEndpoint,
+                        maxConnections: maxConnections,
+                        enabled: true
+                    };
+
+                    if (p.createEndpoint) {
+                        _def.uniqueEndpoint = true;
+                        _def.endpoint = _currentInstance.addEndpoint(el, _def.def);
+                        _def.endpoint.setDeleteOnEmpty(false);
+                    }
+
+                    elInfo.def = _def;
+                    this.targetEndpointDefinitions[elid][type] = _def;
+                    _makeElementDropHandler(elInfo, p, dropOptions, p.isSource === true, true);
+                    // stash the definition on the drop
+                    elInfo.el._katavorioDrop[elInfo.el._katavorioDrop.length - 1].targetDef = _def;
+
+                }.bind(this);
+
+            // make an array if only given one element
+            var inputs = el.length && el.constructor !== String ? el : [ el ];
+
+            // register each one in the list.
+            for (var i = 0, ii = inputs.length; i < ii; i++) {
+                _doOne(inputs[i]);
+            }
+
+            return this;
+        };
+
+        // see api docs
+        this.unmakeTarget = function (el, doNotClearArrays) {
+            var info = _info(el);
+            _currentInstance.destroyDroppable(info.el, "internal");
+            if (!doNotClearArrays) {
+                delete this.targetEndpointDefinitions[info.id];
+            }
+
+            return this;
+        };
+
+        // see api docs
+        this.makeSource = function (el, params, referenceParams) {
+            var p = root.jsPlumb.extend({_jsPlumb: this}, referenceParams);
+            root.jsPlumb.extend(p, params);
+            var type = p.connectionType || "default";
+            var aae = _currentInstance.deriveEndpointAndAnchorSpec(type);
+            p.endpoint = p.endpoint || aae.endpoints[0];
+            p.anchor = p.anchor || aae.anchors[0];
+            var maxConnections = p.maxConnections || -1,
+                onMaxConnections = p.onMaxConnections,
+                _doOne = function (elInfo) {
+                    // get the element's id and store the endpoint definition for it.  jsPlumb.connect calls will look for one of these,
+                    // and use the endpoint definition if found.
+                    var elid = elInfo.id,
+                        _del = this.getElement(elInfo.el);
+
+                    this.sourceEndpointDefinitions[elid] = this.sourceEndpointDefinitions[elid] || {};
+                    _ensureContainer(elid);
+
+                    var _def = {
+                        def:root.jsPlumb.extend({}, p),
+                        uniqueEndpoint: p.uniqueEndpoint,
+                        maxConnections: maxConnections,
+                        enabled: true
+                    };
+
+                    if (p.createEndpoint) {
+                        _def.uniqueEndpoint = true;
+                        _def.endpoint = _currentInstance.addEndpoint(el, _def.def);
+                        _def.endpoint.setDeleteOnEmpty(false);
+                    }
+
+                    this.sourceEndpointDefinitions[elid][type] = _def;
+                    elInfo.def = _def;
+
+                    var stopEvent = root.jsPlumb.dragEvents.stop,
+                        dragEvent = root.jsPlumb.dragEvents.drag,
+                        dragOptions = root.jsPlumb.extend({ }, p.dragOptions || {}),
+                        existingDrag = dragOptions.drag,
+                        existingStop = dragOptions.stop,
+                        ep = null,
+                        endpointAddedButNoDragYet = false;
+
+                    // set scope if its not set in dragOptions but was passed in in params
+                    dragOptions.scope = dragOptions.scope || p.scope;
+
+                    dragOptions[dragEvent] = _ju.wrap(dragOptions[dragEvent], function () {
+                        if (existingDrag) {
+                            existingDrag.apply(this, arguments);
+                        }
+                        endpointAddedButNoDragYet = false;
+                    });
+
+                    dragOptions[stopEvent] = _ju.wrap(dragOptions[stopEvent], function () {
+
+                        if (existingStop) {
+                            existingStop.apply(this, arguments);
+                        }
+                        this.currentlyDragging = false;
+                        if (ep._jsPlumb != null) { // if not cleaned up...
+
+                            // reset the anchor to the anchor that was initially provided. the one we were using to drag
+                            // the connection was just a placeholder that was located at the place the user pressed the
+                            // mouse button to initiate the drag.
+                            var anchorDef = p.anchor || this.Defaults.Anchor,
+                                oldAnchor = ep.anchor,
+                                oldConnection = ep.connections[0];
+
+                            var    newAnchor = this.makeAnchor(anchorDef, elid, this),
+                                _el = ep.element;
+
+                            // if the anchor has a 'positionFinder' set, then delegate to that function to find
+                            // out where to locate the anchor. issue 117.
+                            if (newAnchor.positionFinder != null) {
+                                var elPosition = _currentInstance.getOffset(_el),
+                                    elSize = this.getSize(_el),
+                                    dropPosition = { left: elPosition.left + (oldAnchor.x * elSize[0]), top: elPosition.top + (oldAnchor.y * elSize[1]) },
+                                    ap = newAnchor.positionFinder(dropPosition, elPosition, elSize, newAnchor.constructorParams);
+
+                                newAnchor.x = ap[0];
+                                newAnchor.y = ap[1];
+                            }
+
+                            ep.setAnchor(newAnchor, true);
+                            ep.repaint();
+                            this.repaint(ep.elementId);
+                            if (oldConnection != null) {
+                                this.repaint(oldConnection.targetId);
+                            }
+                        }
+                    }.bind(this));
+
+                    // when the user presses the mouse, add an Endpoint, if we are enabled.
+                    var mouseDownListener = function (e) {
+                        // on right mouse button, abort.
+                        if (e.which === 3 || e.button === 2) {
+                            return;
+                        }
+
+                        // TODO store def on element.
+                        var def = this.sourceEndpointDefinitions[elid][type];
+
+                        // if disabled, return.
+                        if (!def.enabled) {
+                            return;
+                        }
+
+                        elid = this.getId(this.getElement(elInfo.el)); // elid might have changed since this method was called to configure the element.
+
+                        // if a filter was given, run it, and return if it says no.
+                        if (p.filter) {
+                            var r = _ju.isString(p.filter) ? selectorFilter(e, elInfo.el, p.filter, this, p.filterExclude) : p.filter(e, elInfo.el);
+                            if (r === false) {
+                                return;
+                            }
+                        }
+
+                        // if maxConnections reached
+                        var sourceCount = this.select({source: elid}).length;
+                        if (def.maxConnections >= 0 && (sourceCount >= def.maxConnections)) {
+                            if (onMaxConnections) {
+                                onMaxConnections({
+                                    element: elInfo.el,
+                                    maxConnections: maxConnections
+                                }, e);
+                            }
+                            return false;
+                        }
+
+                        // find the position on the element at which the mouse was pressed; this is where the endpoint
+                        // will be located.
+                        var elxy = root.jsPlumb.getPositionOnElement(e, _del, _zoom);
+
+                        // we need to override the anchor in here, and force 'isSource', but we don't want to mess with
+                        // the params passed in, because after a connection is established we're going to reset the endpoint
+                        // to have the anchor we were given.
+                        var tempEndpointParams = {};
+                        root.jsPlumb.extend(tempEndpointParams, p);
+                        tempEndpointParams.isTemporarySource = true;
+                        tempEndpointParams.anchor = [ elxy[0], elxy[1] , 0, 0];
+                        tempEndpointParams.dragOptions = dragOptions;
+
+                        if (def.def.scope) {
+                            tempEndpointParams.scope = def.def.scope;
+                        }
+
+                        ep = this.addEndpoint(elid, tempEndpointParams);
+                        endpointAddedButNoDragYet = true;
+                        ep.setDeleteOnEmpty(true);
+
+                        // if unique endpoint and it's already been created, push it onto the endpoint we create. at the end
+                        // of a successful connection we'll switch to that endpoint.
+                        // TODO this is the same code as the programmatic endpoints create on line 1050 ish
+                        if (def.uniqueEndpoint) {
+                            if (!def.endpoint) {
+                                def.endpoint = ep;
+                                ep.setDeleteOnEmpty(false);
+                            }
+                            else {
+                                ep.finalEndpoint = def.endpoint;
+                            }
+                        }
+
+                        var _delTempEndpoint = function () {
+                            // this mouseup event is fired only if no dragging occurred, by jquery and yui, but for mootools
+                            // it is fired even if dragging has occurred, in which case we would blow away a perfectly
+                            // legitimate endpoint, were it not for this check.  the flag is set after adding an
+                            // endpoint and cleared in a drag listener we set in the dragOptions above.
+                            _currentInstance.off(ep.canvas, "mouseup", _delTempEndpoint);
+                            _currentInstance.off(elInfo.el, "mouseup", _delTempEndpoint);
+                            if (endpointAddedButNoDragYet) {
+                                endpointAddedButNoDragYet = false;
+                                _currentInstance.deleteEndpoint(ep);
+                            }
+                        };
+
+                        _currentInstance.on(ep.canvas, "mouseup", _delTempEndpoint);
+                        _currentInstance.on(elInfo.el, "mouseup", _delTempEndpoint);
+
+                        // optionally check for attributes to extract from the source element
+                        var payload = {};
+                        if (def.def.extract) {
+                            for (var att in def.def.extract) {
+                                var v = (e.srcElement || e.target).getAttribute(att);
+                                if (v) {
+                                    payload[def.def.extract[att]] = v;
+                                }
+                            }
+                        }
+
+                        // and then trigger its mousedown event, which will kick off a drag, which will start dragging
+                        // a new connection from this endpoint.
+                        _currentInstance.trigger(ep.canvas, "mousedown", e, payload);
+
+                        _ju.consume(e);
+
+                    }.bind(this);
+
+                    this.on(elInfo.el, "mousedown", mouseDownListener);
+                    _def.trigger = mouseDownListener;
+
+                    // if a filter was provided, set it as a dragFilter on the element,
+                    // to prevent the element drag function from kicking in when we want to
+                    // drag a new connection
+                    if (p.filter && (_ju.isString(p.filter) || _ju.isFunction(p.filter))) {
+                        _currentInstance.setDragFilter(elInfo.el, p.filter);
+                    }
+
+                    var dropOptions = root.jsPlumb.extend({}, p.dropOptions || {});
+
+                    _makeElementDropHandler(elInfo, p, dropOptions, true, p.isTarget === true);
+
+                }.bind(this);
+
+            var inputs = el.length && el.constructor !== String ? el : [ el ];
+            for (var i = 0, ii = inputs.length; i < ii; i++) {
+                _doOne(_info(inputs[i]));
+            }
+
+            return this;
+        };
+
+        // see api docs
+        this.unmakeSource = function (el, connectionType, doNotClearArrays) {
+            var info = _info(el);
+            _currentInstance.destroyDroppable(info.el, "internal");
+            var eldefs = this.sourceEndpointDefinitions[info.id];
+            if (eldefs) {
+                for (var def in eldefs) {
+                    if (connectionType == null || connectionType === def) {
+                        var mouseDownListener = eldefs[def].trigger;
+                        if (mouseDownListener) {
+                            _currentInstance.off(info.el, "mousedown", mouseDownListener);
+                        }
+                        if (!doNotClearArrays) {
+                            delete this.sourceEndpointDefinitions[info.id][def];
+                        }
+                    }
+                }
+            }
+
+            return this;
+        };
+
+        // see api docs
+        this.unmakeEverySource = function () {
+            for (var i in this.sourceEndpointDefinitions) {
+                _currentInstance.unmakeSource(i, null, true);
+            }
+
+            this.sourceEndpointDefinitions = {};
+            return this;
+        };
+
+        var _getScope = function (el, types, connectionType) {
+            types = _ju.isArray(types) ? types : [ types ];
+            var id = _getId(el);
+            connectionType = connectionType || "default";
+            for (var i = 0; i < types.length; i++) {
+                var eldefs = this[types[i]][id];
+                if (eldefs && eldefs[connectionType]) {
+                    return eldefs[connectionType].def.scope || this.Defaults.Scope;
+                }
+            }
+        }.bind(this);
+
+        var _setScope = function (el, scope, types, connectionType) {
+            types = _ju.isArray(types) ? types : [ types ];
+            var id = _getId(el);
+            connectionType = connectionType || "default";
+            for (var i = 0; i < types.length; i++) {
+                var eldefs = this[types[i]][id];
+                if (eldefs && eldefs[connectionType]) {
+                    eldefs[connectionType].def.scope = scope;
+                }
+            }
+
+        }.bind(this);
+
+        this.getScope = function (el, scope) {
+            return _getScope(el, [ "sourceEndpointDefinitions", "targetEndpointDefinitions" ]);
+        };
+        this.getSourceScope = function (el) {
+            return _getScope(el, "sourceEndpointDefinitions");
+        };
+        this.getTargetScope = function (el) {
+            return _getScope(el, "targetEndpointDefinitions");
+        };
+        this.setScope = function (el, scope, connectionType) {
+            this.setSourceScope(el, scope, connectionType);
+            this.setTargetScope(el, scope, connectionType);
+        };
+        this.setSourceScope = function (el, scope, connectionType) {
+            _setScope(el, scope, "sourceEndpointDefinitions", connectionType);
+            // we get the source scope during the mousedown event, but we also want to set this.
+            this.setDragScope(el, scope);
+        };
+        this.setTargetScope = function (el, scope, connectionType) {
+            _setScope(el, scope, "targetEndpointDefinitions", connectionType);
+            this.setDropScope(el, scope);
+        };
+
+        // see api docs
+        this.unmakeEveryTarget = function () {
+            for (var i in this.targetEndpointDefinitions) {
+                _currentInstance.unmakeTarget(i, true);
+            }
+
+            this.targetEndpointDefinitions = {};
+            return this;
+        };
+
+        // does the work of setting a source enabled or disabled.
+        var _setEnabled = function (type, el, state, toggle, connectionType) {
+            var a = type === "source" ? this.sourceEndpointDefinitions : this.targetEndpointDefinitions,
+                originalState, info, newState;
+
+            connectionType = connectionType || "default";
+
+            // a selector or an array
+            if (el.length && !_ju.isString(el)) {
+                originalState = [];
+                for (var i = 0, ii = el.length; i < ii; i++) {
+                    info = _info(el[i]);
+                    if (a[info.id] && a[info.id][connectionType]) {
+                        originalState[i] = a[info.id][connectionType].enabled;
+                        newState = toggle ? !originalState[i] : state;
+                        a[info.id][connectionType].enabled = newState;
+                        _currentInstance[newState ? "removeClass" : "addClass"](info.el, "jtk-" + type + "-disabled");
+                    }
+                }
+            }
+            // otherwise a DOM element or a String ID.
+            else {
+                info = _info(el);
+                var id = info.id;
+                if (a[id] && a[id][connectionType]) {
+                    originalState = a[id][connectionType].enabled;
+                    newState = toggle ? !originalState : state;
+                    a[id][connectionType].enabled = newState;
+                    _currentInstance[newState ? "removeClass" : "addClass"](info.el, "jtk-" + type + "-disabled");
+                }
+            }
+            return originalState;
+        }.bind(this);
+
+        var _first = function (el, fn) {
+            if (_ju.isString(el) || !el.length) {
+                return fn.apply(this, [ el ]);
+            }
+            else if (el.length) {
+                return fn.apply(this, [ el[0] ]);
+            }
+
+        }.bind(this);
+
+        this.toggleSourceEnabled = function (el, connectionType) {
+            _setEnabled("source", el, null, true, connectionType);
+            return this.isSourceEnabled(el, connectionType);
+        };
+
+        this.setSourceEnabled = function (el, state, connectionType) {
+            return _setEnabled("source", el, state, null, connectionType);
+        };
+        this.isSource = function (el, connectionType) {
+            connectionType = connectionType || "default";
+            return _first(el, function (_el) {
+                var eldefs = this.sourceEndpointDefinitions[_info(_el).id];
+                return eldefs != null && eldefs[connectionType] != null;
+            }.bind(this));
+        };
+        this.isSourceEnabled = function (el, connectionType) {
+            connectionType = connectionType || "default";
+            return _first(el, function (_el) {
+                var sep = this.sourceEndpointDefinitions[_info(_el).id];
+                return sep && sep[connectionType] && sep[connectionType].enabled === true;
+            }.bind(this));
+        };
+
+        this.toggleTargetEnabled = function (el, connectionType) {
+            _setEnabled("target", el, null, true, connectionType);
+            return this.isTargetEnabled(el, connectionType);
+        };
+
+        this.isTarget = function (el, connectionType) {
+            connectionType = connectionType || "default";
+            return _first(el, function (_el) {
+                var eldefs = this.targetEndpointDefinitions[_info(_el).id];
+                return eldefs != null && eldefs[connectionType] != null;
+            }.bind(this));
+        };
+        this.isTargetEnabled = function (el, connectionType) {
+            connectionType = connectionType || "default";
+            return _first(el, function (_el) {
+                var tep = this.targetEndpointDefinitions[_info(_el).id];
+                return tep && tep[connectionType] && tep[connectionType].enabled === true;
+            }.bind(this));
+        };
+        this.setTargetEnabled = function (el, state, connectionType) {
+            return _setEnabled("target", el, state, null, connectionType);
+        };
+
+// --------------------- end makeSource/makeTarget ----------------------------------------------
+
+        this.ready = function (fn) {
+            _currentInstance.bind("ready", fn);
+        };
+
+        var _elEach = function(el, fn) {
+            // support both lists...
+            if (typeof el === 'object' && el.length) {
+                for (var i = 0, ii = el.length; i < ii; i++) {
+                    fn(el[i]);
+                }
+            }
+            else {// ...and single strings or elements.
+                fn(el);
+            }
+
+            return _currentInstance;
+        };
+
+        // repaint some element's endpoints and connections
+        this.repaint = function (el, ui, timestamp) {
+            return _elEach(el, function(_el) {
+                _draw(_el, ui, timestamp);
+            });
+        };
+
+        this.revalidate = function (el, timestamp, isIdAlready) {
+            return _elEach(el, function(_el) {
+                var elId = isIdAlready ? _el : _currentInstance.getId(_el);
+                _currentInstance.updateOffset({ elId: elId, recalc: true, timestamp:timestamp });
+                var dm = _currentInstance.getDragManager();
+                if (dm) {
+                    dm.updateOffsets(elId);
+                }
+                _currentInstance.repaint(_el);
+            });
+        };
+
+        // repaint every endpoint and connection.
+        this.repaintEverything = function () {
+            // TODO this timestamp causes continuous anchors to not repaint properly.
+            // fix this. do not just take out the timestamp. it runs a lot faster with
+            // the timestamp included.
+            var timestamp = _timestamp(), elId;
+
+            for (elId in endpointsByElement) {
+                _currentInstance.updateOffset({ elId: elId, recalc: true, timestamp: timestamp });
+            }
+
+            for (elId in endpointsByElement) {
+                _draw(elId, null, timestamp);
+            }
+
+            return this;
+        };
+
+        this.removeAllEndpoints = function (el, recurse, affectedElements) {
+            affectedElements = affectedElements || [];
+            var _one = function (_el) {
+                var info = _info(_el),
+                    ebe = endpointsByElement[info.id],
+                    i, ii;
+
+                if (ebe) {
+                    affectedElements.push(info);
+                    for (i = 0, ii = ebe.length; i < ii; i++) {
+                        _currentInstance.deleteEndpoint(ebe[i], false);
+                    }
+                }
+                delete endpointsByElement[info.id];
+
+                if (recurse) {
+                    if (info.el && info.el.nodeType !== 3 && info.el.nodeType !== 8) {
+                        for (i = 0, ii = info.el.childNodes.length; i < ii; i++) {
+                            _one(info.el.childNodes[i]);
+                        }
+                    }
+                }
+
+            };
+            _one(el);
+            return this;
+        };
+
+        var _doRemove = function(info, affectedElements) {
+            _currentInstance.removeAllEndpoints(info.id, true, affectedElements);
+            var dm = _currentInstance.getDragManager();
+            var _one = function(_info) {
+
+                if (dm) {
+                    dm.elementRemoved(_info.id);
+                }
+                _currentInstance.anchorManager.clearFor(_info.id);
+                _currentInstance.anchorManager.removeFloatingConnection(_info.id);
+
+                if (_currentInstance.isSource(_info.el)) {
+                    _currentInstance.unmakeSource(_info.el);
+                }
+                if (_currentInstance.isTarget(_info.el)) {
+                    _currentInstance.unmakeTarget(_info.el);
+                }
+                _currentInstance.destroyDraggable(_info.el);
+                _currentInstance.destroyDroppable(_info.el);
+
+
+                delete _currentInstance.floatingConnections[_info.id];
+                delete managedElements[_info.id];
+                delete offsets[_info.id];
+                if (_info.el) {
+                    _currentInstance.removeElement(_info.el);
+                    _info.el._jsPlumb = null;
+                }
+            };
+
+            // remove all affected child elements
+            for (var ae = 1; ae < affectedElements.length; ae++) {
+                _one(affectedElements[ae]);
+            }
+            // and always remove the requested one from the dom.
+            _one(info);
+        };
+
+        /**
+         * Remove the given element, including cleaning up all endpoints registered for it.
+         * This is exposed in the public API but also used internally by jsPlumb when removing the
+         * element associated with a connection drag.
+         */
+        this.remove = function (el, doNotRepaint) {
+            var info = _info(el), affectedElements = [];
+            if (info.text) {
+                info.el.parentNode.removeChild(info.el);
+            }
+            else if (info.id) {
+                _currentInstance.batch(function () {
+                    _doRemove(info, affectedElements);
+                }, doNotRepaint === false);
+            }
+            return _currentInstance;
+        };
+
+        this.empty = function (el, doNotRepaint) {
+            var affectedElements = [];
+            var _one = function(el, dontRemoveFocus) {
+                var info = _info(el);
+                if (info.text) {
+                    info.el.parentNode.removeChild(info.el);
+                }
+                else if (info.el) {
+                    while(info.el.childNodes.length > 0) {
+                        _one(info.el.childNodes[0]);
+                    }
+                    if (!dontRemoveFocus) {
+                        _doRemove(info, affectedElements);
+                    }
+                }
+            };
+
+            _currentInstance.batch(function() {
+                _one(el, true);
+            }, doNotRepaint === false);
+
+            return _currentInstance;
+        };
+
+        this.reset = function () {
+            _currentInstance.silently(function() {
+                _hoverSuspended = false;
+                _currentInstance.removeAllGroups();
+                _currentInstance.removeGroupManager();
+                _currentInstance.deleteEveryEndpoint();
+                _currentInstance.unbind();
+                this.targetEndpointDefinitions = {};
+                this.sourceEndpointDefinitions = {};
+                connections.length = 0;
+                if (this.doReset) {
+                    this.doReset();
+                }
+            }.bind(this));
+        };
+
+        var _clearObject = function (obj) {
+            if (obj.canvas && obj.canvas.parentNode) {
+                obj.canvas.parentNode.removeChild(obj.canvas);
+            }
+            obj.cleanup();
+            obj.destroy();
+        };
+
+        this.clear = function () {
+            _currentInstance.select().each(_clearObject);
+            _currentInstance.selectEndpoints().each(_clearObject);
+
+            endpointsByElement = {};
+            endpointsByUUID = {};
+        };
+
+        this.setDefaultScope = function (scope) {
+            DEFAULT_SCOPE = scope;
+            return _currentInstance;
+        };
+
+        // sets whether or not some element should be currently draggable.
+        this.setDraggable = _setDraggable;
+
+        this.deriveEndpointAndAnchorSpec = function(type, dontPrependDefault) {
+            var bits = ((dontPrependDefault ? "" : "default ") + type).split(/[\s]/), eps = null, ep = null, a = null, as = null;
+            for (var i = 0; i < bits.length; i++) {
+                var _t = _currentInstance.getType(bits[i], "connection");
+                if (_t) {
+                    if (_t.endpoints) {
+                        eps = _t.endpoints;
+                    }
+                    if (_t.endpoint) {
+                        ep = _t.endpoint;
+                    }
+                    if (_t.anchors) {
+                        as = _t.anchors;
+                    }
+                    if (_t.anchor) {
+                        a = _t.anchor;
+                    }
+                }
+            }
+            return { endpoints: eps ? eps : [ ep, ep ], anchors: as ? as : [a, a ]};
+        };
+
+        // sets the id of some element, changing whatever we need to to keep track.
+        this.setId = function (el, newId, doNotSetAttribute) {
+            //
+            var id;
+
+            if (_ju.isString(el)) {
+                id = el;
+            }
+            else {
+                el = this.getElement(el);
+                id = this.getId(el);
+            }
+
+            var sConns = this.getConnections({source: id, scope: '*'}, true),
+                tConns = this.getConnections({target: id, scope: '*'}, true);
+
+            newId = "" + newId;
+
+            if (!doNotSetAttribute) {
+                el = this.getElement(id);
+                this.setAttribute(el, "id", newId);
+            }
+            else {
+                el = this.getElement(newId);
+            }
+
+            endpointsByElement[newId] = endpointsByElement[id] || [];
+            for (var i = 0, ii = endpointsByElement[newId].length; i < ii; i++) {
+                endpointsByElement[newId][i].setElementId(newId);
+                endpointsByElement[newId][i].setReferenceElement(el);
+            }
+            delete endpointsByElement[id];
+
+            this.sourceEndpointDefinitions[newId] = this.sourceEndpointDefinitions[id];
+            delete this.sourceEndpointDefinitions[id];
+            this.targetEndpointDefinitions[newId] = this.targetEndpointDefinitions[id];
+            delete this.targetEndpointDefinitions[id];
+
+            this.anchorManager.changeId(id, newId);
+            var dm = this.getDragManager();
+            if (dm) {
+                dm.changeId(id, newId);
+            }
+            managedElements[newId] = managedElements[id];
+            delete managedElements[id];
+
+            var _conns = function (list, epIdx, type) {
+                for (var i = 0, ii = list.length; i < ii; i++) {
+                    list[i].endpoints[epIdx].setElementId(newId);
+                    list[i].endpoints[epIdx].setReferenceElement(el);
+                    list[i][type + "Id"] = newId;
+                    list[i][type] = el;
+                }
+            };
+            _conns(sConns, 0, "source");
+            _conns(tConns, 1, "target");
+
+            this.repaint(newId);
+        };
+
+        this.setDebugLog = function (debugLog) {
+            log = debugLog;
+        };
+
+        this.setSuspendDrawing = function (val, repaintAfterwards) {
+            var curVal = _suspendDrawing;
+            _suspendDrawing = val;
+            if (val) {
+                _suspendedAt = new Date().getTime();
+            } else {
+                _suspendedAt = null;
+            }
+            if (repaintAfterwards) {
+                this.repaintEverything();
+            }
+            return curVal;
+        };
+
+        // returns whether or not drawing is currently suspended.
+        this.isSuspendDrawing = function () {
+            return _suspendDrawing;
+        };
+
+        // return timestamp for when drawing was suspended.
+        this.getSuspendedAt = function () {
+            return _suspendedAt;
+        };
+
+        this.batch = function (fn, doNotRepaintAfterwards) {
+            var _wasSuspended = this.isSuspendDrawing();
+            if (!_wasSuspended) {
+                this.setSuspendDrawing(true);
+            }
+            try {
+                fn();
+            }
+            catch (e) {
+                _ju.log("Function run while suspended failed", e);
+            }
+            if (!_wasSuspended) {
+                this.setSuspendDrawing(false, !doNotRepaintAfterwards);
+            }
+        };
+
+        this.doWhileSuspended = this.batch;
+
+        this.getCachedData = _getCachedData;
+        this.timestamp = _timestamp;
+        this.show = function (el, changeEndpoints) {
+            _setVisible(el, "block", changeEndpoints);
+            return _currentInstance;
+        };
+
+        // TODO: update this method to return the current state.
+        this.toggleVisible = _toggleVisible;
+        this.toggleDraggable = _toggleDraggable;
+        this.addListener = this.bind;
+    };
+
+    _ju.extend(root.jsPlumbInstance, _ju.EventGenerator, {
+        setAttribute: function (el, a, v) {
+            this.setAttribute(el, a, v);
+        },
+        getAttribute: function (el, a) {
+            return this.getAttribute(root.jsPlumb.getElement(el), a);
+        },
+        convertToFullOverlaySpec: function(spec) {
+            if (_ju.isString(spec)) {
+                spec = [ spec, { } ];
+            }
+            spec[1].id = spec[1].id || _ju.uuid();
+            return spec;
+        },
+        registerConnectionType: function (id, type) {
+            this._connectionTypes[id] = root.jsPlumb.extend({}, type);
+            if (type.overlays) {
+                var to = {};
+                for (var i = 0; i < type.overlays.length; i++) {
+                    // if a string, convert to object representation so that we can store the typeid on it.
+                    // also assign an id.
+                    var fo = this.convertToFullOverlaySpec(type.overlays[i]);
+                    to[fo[1].id] = fo;
+                }
+                this._connectionTypes[id].overlays = to;
+            }
+        },
+        registerConnectionTypes: function (types) {
+            for (var i in types) {
+                this.registerConnectionType(i, types[i]);
+            }
+        },
+        registerEndpointType: function (id, type) {
+            this._endpointTypes[id] = root.jsPlumb.extend({}, type);
+            if (type.overlays) {
+                var to = {};
+                for (var i = 0; i < type.overlays.length; i++) {
+                    // if a string, convert to object representation so that we can store the typeid on it.
+                    // also assign an id.
+                    var fo = this.convertToFullOverlaySpec(type.overlays[i]);
+                    to[fo[1].id] = fo;
+                }
+                this._endpointTypes[id].overlays = to;
+            }
+        },
+        registerEndpointTypes: function (types) {
+            for (var i in types) {
+                this.registerEndpointType(i, types[i]);
+            }
+        },
+        getType: function (id, typeDescriptor) {
+            return typeDescriptor === "connection" ? this._connectionTypes[id] : this._endpointTypes[id];
+        },
+        setIdChanged: function (oldId, newId) {
+            this.setId(oldId, newId, true);
+        },
+        // set parent: change the parent for some node and update all the registrations we need to.
+        setParent: function (el, newParent) {
+            var _dom = this.getElement(el),
+                _id = this.getId(_dom),
+                _pdom = this.getElement(newParent),
+                _pid = this.getId(_pdom),
+                dm = this.getDragManager();
+
+            _dom.parentNode.removeChild(_dom);
+            _pdom.appendChild(_dom);
+            if (dm) {
+                dm.setParent(_dom, _id, _pdom, _pid);
+            }
+        },
+        extend: function (o1, o2, names) {
+            var i;
+            if (names) {
+                for (i = 0; i < names.length; i++) {
+                    o1[names[i]] = o2[names[i]];
+                }
+            }
+            else {
+                for (i in o2) {
+                    o1[i] = o2[i];
+                }
+            }
+
+            return o1;
+        },
+        floatingConnections: {},
+        getFloatingAnchorIndex: function (jpc) {
+            return jpc.endpoints[0].isFloating() ? 0 : jpc.endpoints[1].isFloating() ? 1 : -1;
+        }
+    });
+
+    jsPlumbInstance.prototype.Defaults = {
+        Anchor: "Bottom",
+        Anchors: [ null, null ],
+        ConnectionsDetachable: true,
+        ConnectionOverlays: [ ],
+        Connector: "Bezier",
+        Container: null,
+        DoNotThrowErrors: false,
+        DragOptions: { },
+        DropOptions: { },
+        Endpoint: "Dot",
+        EndpointOverlays: [ ],
+        Endpoints: [ null, null ],
+        EndpointStyle: { fill: "#456" },
+        EndpointStyles: [ null, null ],
+        EndpointHoverStyle: null,
+        EndpointHoverStyles: [ null, null ],
+        HoverPaintStyle: null,
+        LabelStyle: { color: "black" },
+        LogEnabled: false,
+        Overlays: [ ],
+        MaxConnections: 1,
+        PaintStyle: { "stroke-width": 4, stroke: "#456" },
+        ReattachConnections: false,
+        RenderMode: "svg",
+        Scope: "jsPlumb_DefaultScope"
+    };
+
+// --------------------- static instance + module registration -------------------------------------------
+
+// create static instance and assign to window if window exists.	
+    var jsPlumb = new jsPlumbInstance();
+    // register on 'root' (lets us run on server or browser)
+    root.jsPlumb = jsPlumb;
+    // add 'getInstance' method to static instance
+    jsPlumb.getInstance = function (_defaults, overrideFns) {
+        var j = new jsPlumbInstance(_defaults);
+        if (overrideFns) {
+            for (var ovf in overrideFns) {
+                j[ovf] = overrideFns[ovf];
+            }
+        }
+        j.init();
+        return j;
+    };
+    jsPlumb.each = function (spec, fn) {
+        if (spec == null) {
+            return;
+        }
+        if (typeof spec === "string") {
+            fn(jsPlumb.getElement(spec));
+        }
+        else if (spec.length != null) {
+            for (var i = 0; i < spec.length; i++) {
+                fn(jsPlumb.getElement(spec[i]));
+            }
+        }
+        else {
+            fn(spec);
+        } // assume it's an element.
+    };
+
+    // CommonJS
+    if (true) {
+        exports.jsPlumb = jsPlumb;
+    }
+
+// --------------------- end static instance + AMD registration -------------------------------------------		
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the base functionality for DOM type adapters.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+    var root = this, _ju = root.jsPlumbUtil;
+
+    var _genLoc = function (prefix, e) {
+            if (e == null) {
+                return [ 0, 0 ];
+            }
+            var ts = _touches(e), t = _getTouch(ts, 0);
+            return [t[prefix + "X"], t[prefix + "Y"]];
+        },
+        _pageLocation = _genLoc.bind(this, "page"),
+        _screenLocation = _genLoc.bind(this, "screen"),
+        _clientLocation = _genLoc.bind(this, "client"),
+        _getTouch = function (touches, idx) {
+            return touches.item ? touches.item(idx) : touches[idx];
+        },
+        _touches = function (e) {
+            return e.touches && e.touches.length > 0 ? e.touches :
+                    e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches :
+                    e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches :
+                [ e ];
+        };
+
+    /**
+     Manages dragging for some instance of jsPlumb.
+
+     TODO instead of this being accessed directly, it should subscribe to events on the jsPlumb instance: every method
+     in here is called directly by jsPlumb. But what should happen is that we have unpublished events that this listens
+     to.  The only trick is getting one of these instantiated with every jsPlumb instance: it needs to have a hook somehow.
+     Basically the general idea is to pull ALL the drag code out (prototype method registrations plus this) into a
+     dedicated drag script), that does not necessarily need to be included.
+
+
+     */
+    var DragManager = function (_currentInstance) {
+        var _draggables = {}, _dlist = [], _delements = {}, _elementsWithEndpoints = {},
+        // elementids mapped to the draggable to which they belong.
+            _draggablesForElements = {};
+
+        /**
+         register some element as draggable.  right now the drag init stuff is done elsewhere, and it is
+         possible that will continue to be the case.
+         */
+        this.register = function (el) {
+            var id = _currentInstance.getId(el),
+                parentOffset = _currentInstance.getOffset(el);
+
+            if (!_draggables[id]) {
+                _draggables[id] = el;
+                _dlist.push(el);
+                _delements[id] = {};
+            }
+
+            // look for child elements that have endpoints and register them against this draggable.
+            var _oneLevel = function (p) {
+                if (p) {
+                    for (var i = 0; i < p.childNodes.length; i++) {
+                        if (p.childNodes[i].nodeType !== 3 && p.childNodes[i].nodeType !== 8) {
+                            var cEl = jsPlumb.getElement(p.childNodes[i]),
+                                cid = _currentInstance.getId(p.childNodes[i], null, true);
+                            if (cid && _elementsWithEndpoints[cid] && _elementsWithEndpoints[cid] > 0) {
+                                var cOff = _currentInstance.getOffset(cEl);
+                                _delements[id][cid] = {
+                                    id: cid,
+                                    offset: {
+                                        left: cOff.left - parentOffset.left,
+                                        top: cOff.top - parentOffset.top
+                                    }
+                                };
+                                _draggablesForElements[cid] = id;
+                            }
+                            _oneLevel(p.childNodes[i]);
+                        }
+                    }
+                }
+            };
+
+            _oneLevel(el);
+        };
+
+        // refresh the offsets for child elements of this element.
+        this.updateOffsets = function (elId, childOffsetOverrides) {
+            if (elId != null) {
+                childOffsetOverrides = childOffsetOverrides || {};
+                var domEl = jsPlumb.getElement(elId),
+                    id = _currentInstance.getId(domEl),
+                    children = _delements[id],
+                    parentOffset = _currentInstance.getOffset(domEl);
+
+                if (children) {
+                    for (var i in children) {
+                        if (children.hasOwnProperty(i)) {
+                            var cel = jsPlumb.getElement(i),
+                                cOff = childOffsetOverrides[i] || _currentInstance.getOffset(cel);
+
+                            // do not update if we have a value already and we'd just be writing 0,0
+                            if (cel.offsetParent == null && _delements[id][i] != null) {
+                                continue;
+                            }
+
+                            _delements[id][i] = {
+                                id: i,
+                                offset: {
+                                    left: cOff.left - parentOffset.left,
+                                    top: cOff.top - parentOffset.top
+                                }
+                            };
+                            _draggablesForElements[i] = id;
+                        }
+                    }
+                }
+            }
+        };
+
+        /**
+         notification that an endpoint was added to the given el.  we go up from that el's parent
+         node, looking for a parent that has been registered as a draggable. if we find one, we add this
+         el to that parent's list of elements to update on drag (if it is not there already)
+         */
+        this.endpointAdded = function (el, id) {
+
+            id = id || _currentInstance.getId(el);
+
+            var b = document.body,
+                p = el.parentNode;
+
+            _elementsWithEndpoints[id] = _elementsWithEndpoints[id] ? _elementsWithEndpoints[id] + 1 : 1;
+
+            while (p != null && p !== b) {
+                var pid = _currentInstance.getId(p, null, true);
+                if (pid && _draggables[pid]) {
+                    var pLoc = _currentInstance.getOffset(p);
+
+                    if (_delements[pid][id] == null) {
+                        var cLoc = _currentInstance.getOffset(el);
+                        _delements[pid][id] = {
+                            id: id,
+                            offset: {
+                                left: cLoc.left - pLoc.left,
+                                top: cLoc.top - pLoc.top
+                            }
+                        };
+                        _draggablesForElements[id] = pid;
+                    }
+                    break;
+                }
+                p = p.parentNode;
+            }
+        };
+
+        this.endpointDeleted = function (endpoint) {
+            if (_elementsWithEndpoints[endpoint.elementId]) {
+                _elementsWithEndpoints[endpoint.elementId]--;
+                if (_elementsWithEndpoints[endpoint.elementId] <= 0) {
+                    for (var i in _delements) {
+                        if (_delements.hasOwnProperty(i) && _delements[i]) {
+                            delete _delements[i][endpoint.elementId];
+                            delete _draggablesForElements[endpoint.elementId];
+                        }
+                    }
+                }
+            }
+        };
+
+        this.changeId = function (oldId, newId) {
+            _delements[newId] = _delements[oldId];
+            _delements[oldId] = {};
+            _draggablesForElements[newId] = _draggablesForElements[oldId];
+            _draggablesForElements[oldId] = null;
+        };
+
+        this.getElementsForDraggable = function (id) {
+            return _delements[id];
+        };
+
+        this.elementRemoved = function (elementId) {
+            var elId = _draggablesForElements[elementId];
+            if (elId) {
+                delete _delements[elId][elementId];
+                delete _draggablesForElements[elementId];
+            }
+        };
+
+        this.reset = function () {
+            _draggables = {};
+            _dlist = [];
+            _delements = {};
+            _elementsWithEndpoints = {};
+        };
+
+        //
+        // notification drag ended. We check automatically if need to update some
+        // ancestor's offsets.
+        //
+        this.dragEnded = function (el) {
+            if (el.offsetParent != null) {
+                var id = _currentInstance.getId(el),
+                    ancestor = _draggablesForElements[id];
+
+                if (ancestor) {
+                    this.updateOffsets(ancestor);
+                }
+            }
+        };
+
+        this.setParent = function (el, elId, p, pId, currentChildLocation) {
+            var current = _draggablesForElements[elId];
+            if (!_delements[pId]) {
+                _delements[pId] = {};
+            }
+            var pLoc = _currentInstance.getOffset(p),
+                cLoc = currentChildLocation || _currentInstance.getOffset(el);
+
+            if (current && _delements[current]) {
+                delete _delements[current][elId];
+            }
+
+            _delements[pId][elId] = {
+                id:elId,
+                offset : {
+                    left: cLoc.left - pLoc.left,
+                    top: cLoc.top - pLoc.top
+                }
+            };
+            _draggablesForElements[elId] = pId;
+        };
+
+        this.clearParent = function(el, elId) {
+            var current = _draggablesForElements[elId];
+            if (current) {
+                delete _delements[current][elId];
+                delete _draggablesForElements[elId];
+            }
+        };
+
+        this.revalidateParent = function(el, elId, childOffset) {
+            var current = _draggablesForElements[elId];
+            if (current) {
+                var co = {};
+                co[elId] = childOffset;
+                this.updateOffsets(current, co);
+                _currentInstance.revalidate(current);
+            }
+        };
+
+        this.getDragAncestor = function (el) {
+            var de = jsPlumb.getElement(el),
+                id = _currentInstance.getId(de),
+                aid = _draggablesForElements[id];
+
+            if (aid) {
+                return jsPlumb.getElement(aid);
+            }
+            else {
+                return null;
+            }
+        };
+
+    };
+
+    var trim = function (str) {
+            return str == null ? null : (str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''));
+        },
+        _setClassName = function (el, cn) {
+            cn = trim(cn);
+            if (typeof el.className.baseVal !== "undefined") {
+                el.className.baseVal = cn;
+            }
+            else {
+                el.className = cn;
+            }
+        },
+        _getClassName = function (el) {
+            return (typeof el.className.baseVal === "undefined") ? el.className : el.className.baseVal;
+        },
+        _classManip = function (el, classesToAdd, classesToRemove) {
+            classesToAdd = classesToAdd == null ? [] : _ju.isArray(classesToAdd) ? classesToAdd : classesToAdd.split(/\s+/);
+            classesToRemove = classesToRemove == null ? [] : _ju.isArray(classesToRemove) ? classesToRemove : classesToRemove.split(/\s+/);
+
+            var className = _getClassName(el),
+                curClasses = className.split(/\s+/);
+
+            var _oneSet = function (add, classes) {
+                for (var i = 0; i < classes.length; i++) {
+                    if (add) {
+                        if (curClasses.indexOf(classes[i]) === -1) {
+                            curClasses.push(classes[i]);
+                        }
+                    }
+                    else {
+                        var idx = curClasses.indexOf(classes[i]);
+                        if (idx !== -1) {
+                            curClasses.splice(idx, 1);
+                        }
+                    }
+                }
+            };
+
+            _oneSet(true, classesToAdd);
+            _oneSet(false, classesToRemove);
+
+            _setClassName(el, curClasses.join(" "));
+        };
+
+    root.jsPlumb.extend(root.jsPlumbInstance.prototype, {
+
+        headless: false,
+
+        pageLocation: _pageLocation,
+        screenLocation: _screenLocation,
+        clientLocation: _clientLocation,
+
+        getDragManager:function() {
+            if (this.dragManager == null) {
+                this.dragManager = new DragManager(this);
+            }
+
+            return this.dragManager;
+        },
+
+        recalculateOffsets:function(elId) {
+            this.getDragManager().updateOffsets(elId);
+        },
+
+        createElement:function(tag, style, clazz, atts) {
+            return this.createElementNS(null, tag, style, clazz, atts);
+        },
+
+        createElementNS:function(ns, tag, style, clazz, atts) {
+            var e = ns == null ? document.createElement(tag) : document.createElementNS(ns, tag);
+            var i;
+            style = style || {};
+            for (i in style) {
+                e.style[i] = style[i];
+            }
+
+            if (clazz) {
+                e.className = clazz;
+            }
+
+            atts = atts || {};
+            for (i in atts) {
+                e.setAttribute(i, "" + atts[i]);
+            }
+
+            return e;
+        },
+
+        getAttribute: function (el, attName) {
+            return el.getAttribute != null ? el.getAttribute(attName) : null;
+        },
+
+        setAttribute: function (el, a, v) {
+            if (el.setAttribute != null) {
+                el.setAttribute(a, v);
+            }
+        },
+
+        setAttributes: function (el, atts) {
+            for (var i in atts) {
+                if (atts.hasOwnProperty(i)) {
+                    el.setAttribute(i, atts[i]);
+                }
+            }
+        },
+        appendToRoot: function (node) {
+            document.body.appendChild(node);
+        },
+        getRenderModes: function () {
+            return [ "svg"  ];
+        },
+        getClass:_getClassName,
+        addClass: function (el, clazz) {
+            jsPlumb.each(el, function (e) {
+                _classManip(e, clazz);
+            });
+        },
+        hasClass: function (el, clazz) {
+            el = jsPlumb.getElement(el);
+            if (el.classList) {
+                return el.classList.contains(clazz);
+            }
+            else {
+                return _getClassName(el).indexOf(clazz) !== -1;
+            }
+        },
+        removeClass: function (el, clazz) {
+            jsPlumb.each(el, function (e) {
+                _classManip(e, null, clazz);
+            });
+        },
+        updateClasses: function (el, toAdd, toRemove) {
+            jsPlumb.each(el, function (e) {
+                _classManip(e, toAdd, toRemove);
+            });
+        },
+        setClass: function (el, clazz) {
+            jsPlumb.each(el, function (e) {
+                _setClassName(e, clazz);
+            });
+        },
+        setPosition: function (el, p) {
+            el.style.left = p.left + "px";
+            el.style.top = p.top + "px";
+        },
+        getPosition: function (el) {
+            var _one = function (prop) {
+                var v = el.style[prop];
+                return v ? v.substring(0, v.length - 2) : 0;
+            };
+            return {
+                left: _one("left"),
+                top: _one("top")
+            };
+        },
+        getStyle:function(el, prop) {
+            if (typeof window.getComputedStyle !== 'undefined') {
+                return getComputedStyle(el, null).getPropertyValue(prop);
+            } else {
+                return el.currentStyle[prop];
+            }
+        },
+        getSelector: function (ctx, spec) {
+            var sel = null;
+            if (arguments.length === 1) {
+                sel = ctx.nodeType != null ? ctx : document.querySelectorAll(ctx);
+            }
+            else {
+                sel = ctx.querySelectorAll(spec);
+            }
+
+            return sel;
+        },
+        getOffset:function(el, relativeToRoot, container) {
+            el = jsPlumb.getElement(el);
+            container = container || this.getContainer();
+            var out = {
+                    left: el.offsetLeft,
+                    top: el.offsetTop
+                },
+                op = (relativeToRoot  || (container != null && (el !== container && el.offsetParent !== container))) ?  el.offsetParent : null,
+                _maybeAdjustScroll = function(offsetParent) {
+                    if (offsetParent != null && offsetParent !== document.body && (offsetParent.scrollTop > 0 || offsetParent.scrollLeft > 0)) {
+                        out.left -= offsetParent.scrollLeft;
+                        out.top -= offsetParent.scrollTop;
+                    }
+                }.bind(this);
+
+            while (op != null) {
+                out.left += op.offsetLeft;
+                out.top += op.offsetTop;
+                _maybeAdjustScroll(op);
+                op = relativeToRoot ? op.offsetParent :
+                        op.offsetParent === container ? null : op.offsetParent;
+            }
+
+            // if container is scrolled and the element (or its offset parent) is not absolute or fixed, adjust accordingly.
+            if (container != null && !relativeToRoot && (container.scrollTop > 0 || container.scrollLeft > 0)) {
+                var pp = el.offsetParent != null ? this.getStyle(el.offsetParent, "position") : "static",
+                    p = this.getStyle(el, "position");
+                if (p !== "absolute" && p !== "fixed" && pp !== "absolute" && pp !== "fixed") {
+                    out.left -= container.scrollLeft;
+                    out.top -= container.scrollTop;
+                }
+            }
+            return out;
+        },
+        //
+        // return x+y proportion of the given element's size corresponding to the location of the given event.
+        //
+        getPositionOnElement: function (evt, el, zoom) {
+            var box = typeof el.getBoundingClientRect !== "undefined" ? el.getBoundingClientRect() : { left: 0, top: 0, width: 0, height: 0 },
+                body = document.body,
+                docElem = document.documentElement,
+                scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop,
+                scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft,
+                clientTop = docElem.clientTop || body.clientTop || 0,
+                clientLeft = docElem.clientLeft || body.clientLeft || 0,
+                pst = 0,
+                psl = 0,
+                top = box.top + scrollTop - clientTop + (pst * zoom),
+                left = box.left + scrollLeft - clientLeft + (psl * zoom),
+                cl = jsPlumb.pageLocation(evt),
+                w = box.width || (el.offsetWidth * zoom),
+                h = box.height || (el.offsetHeight * zoom),
+                x = (cl[0] - left) / w,
+                y = (cl[1] - top) / h;
+
+            return [ x, y ];
+        },
+
+        /**
+         * Gets the absolute position of some element as read from the left/top properties in its style.
+         * @method getAbsolutePosition
+         * @param {Element} el The element to retrieve the absolute coordinates from. **Note** this is a DOM element, not a selector from the underlying library.
+         * @return {Number[]} [left, top] pixel values.
+         */
+        getAbsolutePosition: function (el) {
+            var _one = function (s) {
+                var ss = el.style[s];
+                if (ss) {
+                    return parseFloat(ss.substring(0, ss.length - 2));
+                }
+            };
+            return [ _one("left"), _one("top") ];
+        },
+
+        /**
+         * Sets the absolute position of some element by setting the left/top properties in its style.
+         * @method setAbsolutePosition
+         * @param {Element} el The element to set the absolute coordinates on. **Note** this is a DOM element, not a selector from the underlying library.
+         * @param {Number[]} xy x and y coordinates
+         * @param {Number[]} [animateFrom] Optional previous xy to animate from.
+         * @param {Object} [animateOptions] Options for the animation.
+         */
+        setAbsolutePosition: function (el, xy, animateFrom, animateOptions) {
+            if (animateFrom) {
+                this.animate(el, {
+                    left: "+=" + (xy[0] - animateFrom[0]),
+                    top: "+=" + (xy[1] - animateFrom[1])
+                }, animateOptions);
+            }
+            else {
+                el.style.left = xy[0] + "px";
+                el.style.top = xy[1] + "px";
+            }
+        },
+        /**
+         * gets the size for the element, in an array : [ width, height ].
+         */
+        getSize: function (el) {
+            return [ el.offsetWidth, el.offsetHeight ];
+        },
+        getWidth: function (el) {
+            return el.offsetWidth;
+        },
+        getHeight: function (el) {
+            return el.offsetHeight;
+        },
+        getRenderMode : function() { return "svg"; }
+
+    });
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains code for components that support overlays.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;(function() {
+
+    "use strict";
+    var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+
+    // ------------------------------ BEGIN OverlayCapablejsPlumbUIComponent --------------------------------------------
+
+    var _internalLabelOverlayId = "__label",
+    // this is a shortcut helper method to let people add a label as
+    // overlay.
+        _makeLabelOverlay = function (component, params) {
+
+            var _params = {
+                    cssClass: params.cssClass,
+                    labelStyle: component.labelStyle,
+                    id: _internalLabelOverlayId,
+                    component: component,
+                    _jsPlumb: component._jsPlumb.instance  // TODO not necessary, since the instance can be accessed through the component.
+                },
+                mergedParams = _jp.extend(_params, params);
+
+            return new _jp.Overlays[component._jsPlumb.instance.getRenderMode()].Label(mergedParams);
+        },
+        _processOverlay = function (component, o) {
+            var _newOverlay = null;
+            if (_ju.isArray(o)) {	// this is for the shorthand ["Arrow", { width:50 }] syntax
+                // there's also a three arg version:
+                // ["Arrow", { width:50 }, {location:0.7}]
+                // which merges the 3rd arg into the 2nd.
+                var type = o[0],
+                // make a copy of the object so as not to mess up anyone else's reference...
+                    p = _jp.extend({component: component, _jsPlumb: component._jsPlumb.instance}, o[1]);
+                if (o.length === 3) {
+                    _jp.extend(p, o[2]);
+                }
+                _newOverlay = new _jp.Overlays[component._jsPlumb.instance.getRenderMode()][type](p);
+            } else if (o.constructor === String) {
+                _newOverlay = new _jp.Overlays[component._jsPlumb.instance.getRenderMode()][o]({component: component, _jsPlumb: component._jsPlumb.instance});
+            } else {
+                _newOverlay = o;
+            }
+
+            _newOverlay.id = _newOverlay.id || _ju.uuid();
+            component.cacheTypeItem("overlay", _newOverlay, _newOverlay.id);
+            component._jsPlumb.overlays[_newOverlay.id] = _newOverlay;
+
+            return _newOverlay;
+        };
+
+    _jp.OverlayCapableJsPlumbUIComponent = function (params) {
+
+        root.jsPlumbUIComponent.apply(this, arguments);
+        this._jsPlumb.overlays = {};
+        this._jsPlumb.overlayPositions = {};
+
+        if (params.label) {
+            this.getDefaultType().overlays[_internalLabelOverlayId] = ["Label", {
+                label: params.label,
+                location: params.labelLocation || this.defaultLabelLocation || 0.5,
+                labelStyle: params.labelStyle || this._jsPlumb.instance.Defaults.LabelStyle,
+                id:_internalLabelOverlayId
+            }];
+        }
+
+        this.setListenerComponent = function (c) {
+            if (this._jsPlumb) {
+                for (var i in this._jsPlumb.overlays) {
+                    this._jsPlumb.overlays[i].setListenerComponent(c);
+                }
+            }
+        };
+    };
+
+    _jp.OverlayCapableJsPlumbUIComponent.applyType = function (component, t) {
+        if (t.overlays) {
+            // loop through the ones in the type. if already present on the component,
+            // dont remove or re-add.
+            var keep = {}, i;
+
+            for (i in t.overlays) {
+
+                var existing = component._jsPlumb.overlays[t.overlays[i][1].id];
+                if (existing) {
+                    // maybe update from data, if there were parameterised values for instance.
+                    existing.updateFrom(t.overlays[i][1]);
+                    keep[t.overlays[i][1].id] = true;
+                }
+                else {
+                    var c = component.getCachedTypeItem("overlay", t.overlays[i][1].id);
+                    if (c != null) {
+                        c.reattach(component._jsPlumb.instance, component);
+                        c.setVisible(true);
+                        // maybe update from data, if there were parameterised values for instance.
+                        c.updateFrom(t.overlays[i][1]);
+                        component._jsPlumb.overlays[c.id] = c;
+                    }
+                    else {
+                        c = component.addOverlay(t.overlays[i], true);
+                    }
+                    keep[c.id] = true;
+                }
+            }
+
+            // now loop through the full overlays and remove those that we dont want to keep
+            for (i in component._jsPlumb.overlays) {
+                if (keep[component._jsPlumb.overlays[i].id] == null) {
+                    component.removeOverlay(component._jsPlumb.overlays[i].id, true); // remove overlay but dont clean it up.
+                    // that would remove event listeners etc; overlays are never discarded by the types stuff, they are
+                    // just detached/reattached.
+                }
+            }
+        }
+    };
+
+    _ju.extend(_jp.OverlayCapableJsPlumbUIComponent, root.jsPlumbUIComponent, {
+
+        setHover: function (hover, ignoreAttachedElements) {
+            if (this._jsPlumb && !this._jsPlumb.instance.isConnectionBeingDragged()) {
+                for (var i in this._jsPlumb.overlays) {
+                    this._jsPlumb.overlays[i][hover ? "addClass" : "removeClass"](this._jsPlumb.instance.hoverClass);
+                }
+            }
+        },
+        addOverlay: function (overlay, doNotRepaint) {
+            var o = _processOverlay(this, overlay);
+            if (!doNotRepaint) {
+                this.repaint();
+            }
+            return o;
+        },
+        getOverlay: function (id) {
+            return this._jsPlumb.overlays[id];
+        },
+        getOverlays: function () {
+            return this._jsPlumb.overlays;
+        },
+        hideOverlay: function (id) {
+            var o = this.getOverlay(id);
+            if (o) {
+                o.hide();
+            }
+        },
+        hideOverlays: function () {
+            for (var i in this._jsPlumb.overlays) {
+                this._jsPlumb.overlays[i].hide();
+            }
+        },
+        showOverlay: function (id) {
+            var o = this.getOverlay(id);
+            if (o) {
+                o.show();
+            }
+        },
+        showOverlays: function () {
+            for (var i in this._jsPlumb.overlays) {
+                this._jsPlumb.overlays[i].show();
+            }
+        },
+        removeAllOverlays: function (doNotRepaint) {
+            for (var i in this._jsPlumb.overlays) {
+                if (this._jsPlumb.overlays[i].cleanup) {
+                    this._jsPlumb.overlays[i].cleanup();
+                }
+            }
+
+            this._jsPlumb.overlays = {};
+            this._jsPlumb.overlayPositions = null;
+            if (!doNotRepaint) {
+                this.repaint();
+            }
+        },
+        removeOverlay: function (overlayId, dontCleanup) {
+            var o = this._jsPlumb.overlays[overlayId];
+            if (o) {
+                o.setVisible(false);
+                if (!dontCleanup && o.cleanup) {
+                    o.cleanup();
+                }
+                delete this._jsPlumb.overlays[overlayId];
+                if (this._jsPlumb.overlayPositions) {
+                    delete this._jsPlumb.overlayPositions[overlayId];
+                }
+            }
+        },
+        removeOverlays: function () {
+            for (var i = 0, j = arguments.length; i < j; i++) {
+                this.removeOverlay(arguments[i]);
+            }
+        },
+        moveParent: function (newParent) {
+            if (this.bgCanvas) {
+                this.bgCanvas.parentNode.removeChild(this.bgCanvas);
+                newParent.appendChild(this.bgCanvas);
+            }
+
+            if (this.canvas && this.canvas.parentNode) {
+                this.canvas.parentNode.removeChild(this.canvas);
+                newParent.appendChild(this.canvas);
+
+                for (var i in this._jsPlumb.overlays) {
+                    if (this._jsPlumb.overlays[i].isAppendedAtTopLevel) {
+                        var el = this._jsPlumb.overlays[i].getElement();
+                        el.parentNode.removeChild(el);
+                        newParent.appendChild(el);
+                    }
+                }
+            }
+        },
+        getLabel: function () {
+            var lo = this.getOverlay(_internalLabelOverlayId);
+            return lo != null ? lo.getLabel() : null;
+        },
+        getLabelOverlay: function () {
+            return this.getOverlay(_internalLabelOverlayId);
+        },
+        setLabel: function (l) {
+            var lo = this.getOverlay(_internalLabelOverlayId);
+            if (!lo) {
+                var params = l.constructor === String || l.constructor === Function ? { label: l } : l;
+                lo = _makeLabelOverlay(this, params);
+                this._jsPlumb.overlays[_internalLabelOverlayId] = lo;
+            }
+            else {
+                if (l.constructor === String || l.constructor === Function) {
+                    lo.setLabel(l);
+                }
+                else {
+                    if (l.label) {
+                        lo.setLabel(l.label);
+                    }
+                    if (l.location) {
+                        lo.setLocation(l.location);
+                    }
+                }
+            }
+
+            if (!this._jsPlumb.instance.isSuspendDrawing()) {
+                this.repaint();
+            }
+        },
+        cleanup: function (force) {
+            for (var i in this._jsPlumb.overlays) {
+                this._jsPlumb.overlays[i].cleanup(force);
+                this._jsPlumb.overlays[i].destroy(force);
+            }
+            if (force) {
+                this._jsPlumb.overlays = {};
+                this._jsPlumb.overlayPositions = null;
+            }
+        },
+        setVisible: function (v) {
+            this[v ? "showOverlays" : "hideOverlays"]();
+        },
+        setAbsoluteOverlayPosition: function (overlay, xy) {
+            this._jsPlumb.overlayPositions[overlay.id] = xy;
+        },
+        getAbsoluteOverlayPosition: function (overlay) {
+            return this._jsPlumb.overlayPositions ? this._jsPlumb.overlayPositions[overlay.id] : null;
+        },
+        _clazzManip:function(action, clazz, dontUpdateOverlays) {
+            if (!dontUpdateOverlays) {
+                for (var i in this._jsPlumb.overlays) {
+                    this._jsPlumb.overlays[i][action + "Class"](clazz);
+                }
+            }
+        },
+        addClass:function(clazz, dontUpdateOverlays) {
+            this._clazzManip("add", clazz, dontUpdateOverlays);
+        },
+        removeClass:function(clazz, dontUpdateOverlays) {
+            this._clazzManip("remove", clazz, dontUpdateOverlays);
+        }
+    });
+
+// ------------------------------ END OverlayCapablejsPlumbUIComponent --------------------------------------------
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb Community Edition
+ * 
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ * 
+ * This file contains the code for Endpoints.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ * 
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+(function () {
+
+    "use strict";
+    var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+
+    // create the drag handler for a connection
+    var _makeConnectionDragHandler = function (endpoint, placeholder, _jsPlumb) {
+        var stopped = false;
+        return {
+            drag: function () {
+                if (stopped) {
+                    stopped = false;
+                    return true;
+                }
+
+                if (placeholder.element) {
+                    var _ui = _jsPlumb.getUIPosition(arguments, _jsPlumb.getZoom());
+                    if (_ui != null) {
+                        _jsPlumb.setPosition(placeholder.element, _ui);
+                    }
+                    _jsPlumb.repaint(placeholder.element, _ui);
+                    // always repaint the source endpoint, because only continuous/dynamic anchors cause the endpoint
+                    // to be repainted, so static anchors need to be told (or the endpoint gets dragged around)
+                    endpoint.paint({anchorPoint:endpoint.anchor.getCurrentLocation({element:endpoint})});
+                }
+            },
+            stopDrag: function () {
+                stopped = true;
+            }
+        };
+    };
+
+    // creates a placeholder div for dragging purposes, adds it, and pre-computes its offset.
+    var _makeDraggablePlaceholder = function (placeholder, _jsPlumb, ipco, ips) {
+        var n = _jsPlumb.createElement("div", { position : "absolute" });
+        _jsPlumb.appendElement(n);
+        var id = _jsPlumb.getId(n);
+        _jsPlumb.setPosition(n, ipco);
+        n.style.width = ips[0] + "px";
+        n.style.height = ips[1] + "px";
+        _jsPlumb.manage(id, n, true); // TRANSIENT MANAGE
+        // create and assign an id, and initialize the offset.
+        placeholder.id = id;
+        placeholder.element = n;
+    };
+
+    // create a floating endpoint (for drag connections)
+    var _makeFloatingEndpoint = function (paintStyle, referenceAnchor, endpoint, referenceCanvas, sourceElement, _jsPlumb, _newEndpoint, scope) {
+        var floatingAnchor = new _jp.FloatingAnchor({ reference: referenceAnchor, referenceCanvas: referenceCanvas, jsPlumbInstance: _jsPlumb });
+        //setting the scope here should not be the way to fix that mootools issue.  it should be fixed by not
+        // adding the floating endpoint as a droppable.  that makes more sense anyway!
+        // TRANSIENT MANAGE
+        return _newEndpoint({
+            paintStyle: paintStyle,
+            endpoint: endpoint,
+            anchor: floatingAnchor,
+            source: sourceElement,
+            scope: scope
+        });
+    };
+
+    var typeParameters = [ "connectorStyle", "connectorHoverStyle", "connectorOverlays",
+        "connector", "connectionType", "connectorClass", "connectorHoverClass" ];
+
+    // a helper function that tries to find a connection to the given element, and returns it if so. if elementWithPrecedence is null,
+    // or no connection to it is found, we return the first connection in our list.
+    var findConnectionToUseForDynamicAnchor = function (ep, elementWithPrecedence) {
+        var idx = 0;
+        if (elementWithPrecedence != null) {
+            for (var i = 0; i < ep.connections.length; i++) {
+                if (ep.connections[i].sourceId === elementWithPrecedence || ep.connections[i].targetId === elementWithPrecedence) {
+                    idx = i;
+                    break;
+                }
+            }
+        }
+
+        return ep.connections[idx];
+    };
+
+    _jp.Endpoint = function (params) {
+        var _jsPlumb = params._jsPlumb,
+            _newConnection = params.newConnection,
+            _newEndpoint = params.newEndpoint;
+
+        this.idPrefix = "_jsplumb_e_";
+        this.defaultLabelLocation = [ 0.5, 0.5 ];
+        this.defaultOverlayKeys = ["Overlays", "EndpointOverlays"];
+        _jp.OverlayCapableJsPlumbUIComponent.apply(this, arguments);
+
+// TYPE
+
+        this.appendToDefaultType({
+            connectionType:params.connectionType,
+            maxConnections: params.maxConnections == null ? this._jsPlumb.instance.Defaults.MaxConnections : params.maxConnections, // maximum number of connections this endpoint can be the source of.,
+            paintStyle: params.endpointStyle || params.paintStyle || params.style || this._jsPlumb.instance.Defaults.EndpointStyle || _jp.Defaults.EndpointStyle,
+            hoverPaintStyle: params.endpointHoverStyle || params.hoverPaintStyle || this._jsPlumb.instance.Defaults.EndpointHoverStyle || _jp.Defaults.EndpointHoverStyle,
+            connectorStyle: params.connectorStyle,
+            connectorHoverStyle: params.connectorHoverStyle,
+            connectorClass: params.connectorClass,
+            connectorHoverClass: params.connectorHoverClass,
+            connectorOverlays: params.connectorOverlays,
+            connector: params.connector,
+            connectorTooltip: params.connectorTooltip
+        });
+
+// END TYPE
+
+        this._jsPlumb.enabled = !(params.enabled === false);
+        this._jsPlumb.visible = true;
+        this.element = _jp.getElement(params.source);
+        this._jsPlumb.uuid = params.uuid;
+        this._jsPlumb.floatingEndpoint = null;
+        var inPlaceCopy = null;
+        if (this._jsPlumb.uuid) {
+            params.endpointsByUUID[this._jsPlumb.uuid] = this;
+        }
+        this.elementId = params.elementId;
+        this.dragProxy = params.dragProxy;
+
+        this._jsPlumb.connectionCost = params.connectionCost;
+        this._jsPlumb.connectionsDirected = params.connectionsDirected;
+        this._jsPlumb.currentAnchorClass = "";
+        this._jsPlumb.events = {};
+
+        var deleteOnEmpty = params.deleteOnEmpty === true;
+        this.setDeleteOnEmpty = function(d) {
+            deleteOnEmpty = d;
+        };
+
+        var _updateAnchorClass = function () {
+            // stash old, get new
+            var oldAnchorClass = _jsPlumb.endpointAnchorClassPrefix + "-" + this._jsPlumb.currentAnchorClass;
+            this._jsPlumb.currentAnchorClass = this.anchor.getCssClass();
+            var anchorClass = _jsPlumb.endpointAnchorClassPrefix + (this._jsPlumb.currentAnchorClass ? "-" + this._jsPlumb.currentAnchorClass : "");
+
+            this.removeClass(oldAnchorClass);
+            this.addClass(anchorClass);
+            // add and remove at the same time to reduce the number of reflows.
+            _jp.updateClasses(this.element, anchorClass, oldAnchorClass);
+        }.bind(this);
+
+        this.prepareAnchor = function(anchorParams) {
+            var a = this._jsPlumb.instance.makeAnchor(anchorParams, this.elementId, _jsPlumb);
+            a.bind("anchorChanged", function (currentAnchor) {
+                this.fire("anchorChanged", {endpoint: this, anchor: currentAnchor});
+                _updateAnchorClass();
+            }.bind(this));
+            return a;
+        };
+
+        this.setPreparedAnchor = function(anchor, doNotRepaint) {
+            this._jsPlumb.instance.continuousAnchorFactory.clear(this.elementId);
+            this.anchor = anchor;
+            _updateAnchorClass();
+
+            if (!doNotRepaint) {
+                this._jsPlumb.instance.repaint(this.elementId);
+            }
+
+            return this;
+        };
+
+        this.setAnchor = function (anchorParams, doNotRepaint) {
+            var a = this.prepareAnchor(anchorParams);
+            this.setPreparedAnchor(a, doNotRepaint);
+            return this;
+        };
+
+        var internalHover = function (state) {
+            if (this.connections.length > 0) {
+                for (var i = 0; i < this.connections.length; i++) {
+                    this.connections[i].setHover(state, false);
+                }
+            }
+            else {
+                this.setHover(state);
+            }
+        }.bind(this);
+
+        this.bind("mouseover", function () {
+            internalHover(true);
+        });
+        this.bind("mouseout", function () {
+            internalHover(false);
+        });
+
+        // ANCHOR MANAGER
+        if (!params._transient) { // in place copies, for example, are transient.  they will never need to be retrieved during a paint cycle, because they dont move, and then they are deleted.
+            this._jsPlumb.instance.anchorManager.add(this, this.elementId);
+        }
+
+        this.prepareEndpoint = function(ep, typeId) {
+            var _e = function (t, p) {
+                var rm = _jsPlumb.getRenderMode();
+                if (_jp.Endpoints[rm][t]) {
+                    return new _jp.Endpoints[rm][t](p);
+                }
+                if (!_jsPlumb.Defaults.DoNotThrowErrors) {
+                    throw { msg: "jsPlumb: unknown endpoint type '" + t + "'" };
+                }
+            };
+
+            var endpointArgs = {
+                _jsPlumb: this._jsPlumb.instance,
+                cssClass: params.cssClass,
+                container: params.container,
+                tooltip: params.tooltip,
+                connectorTooltip: params.connectorTooltip,
+                endpoint: this
+            };
+
+            var endpoint;
+
+            if (_ju.isString(ep)) {
+                endpoint = _e(ep, endpointArgs);
+            }
+            else if (_ju.isArray(ep)) {
+                endpointArgs = _ju.merge(ep[1], endpointArgs);
+                endpoint = _e(ep[0], endpointArgs);
+            }
+            else {
+                endpoint = ep.clone();
+            }
+
+            // assign a clone function using a copy of endpointArgs. this is used when a drag starts: the endpoint that was dragged is cloned,
+            // and the clone is left in its place while the original one goes off on a magical journey.
+            // the copy is to get around a closure problem, in which endpointArgs ends up getting shared by
+            // the whole world.
+            //var argsForClone = jsPlumb.extend({}, endpointArgs);
+            endpoint.clone = function () {
+                // TODO this, and the code above, can be refactored to be more dry.
+                if (_ju.isString(ep)) {
+                    return _e(ep, endpointArgs);
+                }
+                else if (_ju.isArray(ep)) {
+                    endpointArgs = _ju.merge(ep[1], endpointArgs);
+                    return _e(ep[0], endpointArgs);
+                }
+            }.bind(this);
+
+            endpoint.typeId = typeId;
+            return endpoint;
+        };
+
+        this.setEndpoint = function(ep, doNotRepaint) {
+            var _ep = this.prepareEndpoint(ep);
+            this.setPreparedEndpoint(_ep, true);
+        };
+
+        this.setPreparedEndpoint = function (ep, doNotRepaint) {
+            if (this.endpoint != null) {
+                this.endpoint.cleanup();
+                this.endpoint.destroy();
+            }
+            this.endpoint = ep;
+            this.type = this.endpoint.type;
+            this.canvas = this.endpoint.canvas;
+        };
+
+        _jp.extend(this, params, typeParameters);
+
+        this.isSource = params.isSource || false;
+        this.isTemporarySource = params.isTemporarySource || false;
+        this.isTarget = params.isTarget || false;
+
+        this.connections = params.connections || [];
+        this.connectorPointerEvents = params["connector-pointer-events"];
+
+        this.scope = params.scope || _jsPlumb.getDefaultScope();
+        this.timestamp = null;
+        this.reattachConnections = params.reattach || _jsPlumb.Defaults.ReattachConnections;
+        this.connectionsDetachable = _jsPlumb.Defaults.ConnectionsDetachable;
+        if (params.connectionsDetachable === false || params.detachable === false) {
+            this.connectionsDetachable = false;
+        }
+        this.dragAllowedWhenFull = params.dragAllowedWhenFull !== false;
+
+        if (params.onMaxConnections) {
+            this.bind("maxConnections", params.onMaxConnections);
+        }
+
+        //
+        // add a connection. not part of public API.
+        //
+        this.addConnection = function (connection) {
+            this.connections.push(connection);
+            this[(this.connections.length > 0 ? "add" : "remove") + "Class"](_jsPlumb.endpointConnectedClass);
+            this[(this.isFull() ? "add" : "remove") + "Class"](_jsPlumb.endpointFullClass);
+        };
+
+        this.detachFromConnection = function (connection, idx, doNotCleanup) {
+            idx = idx == null ? this.connections.indexOf(connection) : idx;
+            if (idx >= 0) {
+                this.connections.splice(idx, 1);
+                this[(this.connections.length > 0 ? "add" : "remove") + "Class"](_jsPlumb.endpointConnectedClass);
+                this[(this.isFull() ? "add" : "remove") + "Class"](_jsPlumb.endpointFullClass);
+            }
+
+            if (!doNotCleanup && deleteOnEmpty && this.connections.length === 0) {
+                _jsPlumb.deleteObject({
+                    endpoint: this,
+                    fireEvent: false,
+                    deleteAttachedObjects: doNotCleanup !== true
+                });
+            }
+        };
+
+        this.deleteEveryConnection = function(params) {
+            var c = this.connections.length;
+            for (var i = 0; i < c; i++) {
+                _jsPlumb.deleteConnection(this.connections[0], params);
+            }
+        };
+
+        this.detachFrom = function (targetEndpoint, fireEvent, originalEvent) {
+            var c = [];
+            for (var i = 0; i < this.connections.length; i++) {
+                if (this.connections[i].endpoints[1] === targetEndpoint || this.connections[i].endpoints[0] === targetEndpoint) {
+                    c.push(this.connections[i]);
+                }
+            }
+            for (var j = 0, count = c.length; j < count; j++) {
+                _jsPlumb.deleteConnection(c[0]);
+            }
+            return this;
+        };
+
+        this.getElement = function () {
+            return this.element;
+        };
+
+        this.setElement = function (el) {
+            var parentId = this._jsPlumb.instance.getId(el),
+                curId = this.elementId;
+            // remove the endpoint from the list for the current endpoint's element
+            _ju.removeWithFunction(params.endpointsByElement[this.elementId], function (e) {
+                return e.id === this.id;
+            }.bind(this));
+            this.element = _jp.getElement(el);
+            this.elementId = _jsPlumb.getId(this.element);
+            _jsPlumb.anchorManager.rehomeEndpoint(this, curId, this.element);
+            _jsPlumb.dragManager.endpointAdded(this.element);
+            _ju.addToList(params.endpointsByElement, parentId, this);
+            return this;
+        };
+
+        /**
+         * private but must be exposed.
+         */
+        this.makeInPlaceCopy = function () {
+            var loc = this.anchor.getCurrentLocation({element: this}),
+                o = this.anchor.getOrientation(this),
+                acc = this.anchor.getCssClass(),
+                inPlaceAnchor = {
+                    bind: function () {
+                    },
+                    compute: function () {
+                        return [ loc[0], loc[1] ];
+                    },
+                    getCurrentLocation: function () {
+                        return [ loc[0], loc[1] ];
+                    },
+                    getOrientation: function () {
+                        return o;
+                    },
+                    getCssClass: function () {
+                        return acc;
+                    }
+                };
+
+            return _newEndpoint({
+                dropOptions: params.dropOptions,
+                anchor: inPlaceAnchor,
+                source: this.element,
+                paintStyle: this.getPaintStyle(),
+                endpoint: params.hideOnDrag ? "Blank" : this.endpoint,
+                _transient: true,
+                scope: this.scope,
+                reference:this
+            });
+        };
+
+        /**
+         * returns a connection from the pool; used when dragging starts.  just gets the head of the array if it can.
+         */
+        this.connectorSelector = function () {
+            var candidate = this.connections[0];
+            if (candidate) {
+                return candidate;
+            }
+            else {
+                return (this.connections.length < this._jsPlumb.maxConnections) || this._jsPlumb.maxConnections === -1 ? null : candidate;
+            }
+        };
+
+        this.setStyle = this.setPaintStyle;
+
+        this.paint = function (params) {
+            params = params || {};
+            var timestamp = params.timestamp, recalc = !(params.recalc === false);
+            if (!timestamp || this.timestamp !== timestamp) {
+
+                var info = _jsPlumb.updateOffset({ elId: this.elementId, timestamp: timestamp });
+
+                var xy = params.offset ? params.offset.o : info.o;
+                if (xy != null) {
+                    var ap = params.anchorPoint, connectorPaintStyle = params.connectorPaintStyle;
+                    if (ap == null) {
+                        var wh = params.dimensions || info.s,
+                            anchorParams = { xy: [ xy.left, xy.top ], wh: wh, element: this, timestamp: timestamp };
+                        if (recalc && this.anchor.isDynamic && this.connections.length > 0) {
+                            var c = findConnectionToUseForDynamicAnchor(this, params.elementWithPrecedence),
+                                oIdx = c.endpoints[0] === this ? 1 : 0,
+                                oId = oIdx === 0 ? c.sourceId : c.targetId,
+                                oInfo = _jsPlumb.getCachedData(oId),
+                                oOffset = oInfo.o, oWH = oInfo.s;
+                            anchorParams.txy = [ oOffset.left, oOffset.top ];
+                            anchorParams.twh = oWH;
+                            anchorParams.tElement = c.endpoints[oIdx];
+                        }
+                        ap = this.anchor.compute(anchorParams);
+                    }
+
+                    this.endpoint.compute(ap, this.anchor.getOrientation(this), this._jsPlumb.paintStyleInUse, connectorPaintStyle || this.paintStyleInUse);
+                    this.endpoint.paint(this._jsPlumb.paintStyleInUse, this.anchor);
+                    this.timestamp = timestamp;
+
+                    // paint overlays
+                    for (var i in this._jsPlumb.overlays) {
+                        if (this._jsPlumb.overlays.hasOwnProperty(i)) {
+                            var o = this._jsPlumb.overlays[i];
+                            if (o.isVisible()) {
+                                this._jsPlumb.overlayPlacements[i] = o.draw(this.endpoint, this._jsPlumb.paintStyleInUse);
+                                o.paint(this._jsPlumb.overlayPlacements[i]);
+                            }
+                        }
+                    }
+                }
+            }
+        };
+
+        this.getTypeDescriptor = function () {
+            return "endpoint";
+        };
+        this.isVisible = function () {
+            return this._jsPlumb.visible;
+        };
+
+        this.repaint = this.paint;
+
+        var draggingInitialised = false;
+        this.initDraggable = function () {
+
+            // is this a connection source? we make it draggable and have the
+            // drag listener maintain a connection with a floating endpoint.
+            if (!draggingInitialised && _jp.isDragSupported(this.element)) {
+                var placeholderInfo = { id: null, element: null },
+                    jpc = null,
+                    existingJpc = false,
+                    existingJpcParams = null,
+                    _dragHandler = _makeConnectionDragHandler(this, placeholderInfo, _jsPlumb),
+                    dragOptions = params.dragOptions || {},
+                    defaultOpts = {},
+                    startEvent = _jp.dragEvents.start,
+                    stopEvent = _jp.dragEvents.stop,
+                    dragEvent = _jp.dragEvents.drag,
+                    beforeStartEvent = _jp.dragEvents.beforeStart,
+                    payload;
+
+                // respond to beforeStart from katavorio; this will have, optionally, a payload of attribute values
+                // that were placed there by the makeSource mousedown listener.
+                var beforeStart = function(beforeStartParams) {
+                    payload = beforeStartParams.e.payload || {};
+                };
+
+                var start = function (startParams) {
+
+// -------------   first, get a connection to drag. this may be null, in which case we are dragging a new one.
+
+                    jpc = this.connectorSelector();
+
+// -------------------------------- now a bunch of tests about whether or not to proceed -------------------------
+
+                    var _continue = true;
+                    // if not enabled, return
+                    if (!this.isEnabled()) {
+                        _continue = false;
+                    }
+                    // if no connection and we're not a source - or temporarily a source, as is the case with makeSource - return.
+                    if (jpc == null && !this.isSource && !this.isTemporarySource) {
+                        _continue = false;
+                    }
+                    // otherwise if we're full and not allowed to drag, also return false.
+                    if (this.isSource && this.isFull() && !(jpc != null && this.dragAllowedWhenFull)) {
+                        _continue = false;
+                    }
+                    // if the connection was setup as not detachable or one of its endpoints
+                    // was setup as connectionsDetachable = false, or Defaults.ConnectionsDetachable
+                    // is set to false...
+                    if (jpc != null && !jpc.isDetachable(this)) {
+                        _continue = false;
+                    }
+
+                    var beforeDrag = _jsPlumb.checkCondition(jpc == null ? "beforeDrag" : "beforeStartDetach", {
+                        endpoint:this,
+                        source:this.element,
+                        sourceId:this.elementId,
+                        connection:jpc
+                    });
+                    if (beforeDrag === false) {
+                        _continue = false;
+                    }
+                    // else we might have been given some data. we'll pass it in to a new connection as 'data'.
+                    // here we also merge in the optional payload we were given on mousedown.
+                    else if (typeof beforeDrag === "object") {
+                        _jp.extend(beforeDrag, payload || {});
+                    }
+                    else {
+                        // or if no beforeDrag data, maybe use the payload on its own.
+                        beforeDrag = payload || {};
+                    }
+
+                    if (_continue === false) {
+                        // this is for mootools and yui. returning false from this causes jquery to stop drag.
+                        // the events are wrapped in both mootools and yui anyway, but i don't think returning
+                        // false from the start callback would stop a drag.
+                        if (_jsPlumb.stopDrag) {
+                            _jsPlumb.stopDrag(this.canvas);
+                        }
+                        _dragHandler.stopDrag();
+                        return false;
+                    }
+
+// ---------------------------------------------------------------------------------------------------------------------
+
+                    // ok to proceed.
+
+                    // clear hover for all connections for this endpoint before continuing.
+                    for (var i = 0; i < this.connections.length; i++) {
+                        this.connections[i].setHover(false);
+                    }
+
+                    this.addClass("endpointDrag");
+                    _jsPlumb.setConnectionBeingDragged(true);
+
+                    // if we're not full but there was a connection, make it null. we'll create a new one.
+                    if (jpc && !this.isFull() && this.isSource) {
+                        jpc = null;
+                    }
+
+                    _jsPlumb.updateOffset({ elId: this.elementId });
+
+// ----------------    make the element we will drag around, and position it -----------------------------
+
+                    var ipco = this._jsPlumb.instance.getOffset(this.canvas),
+                        canvasElement = this.canvas,
+                        ips = this._jsPlumb.instance.getSize(this.canvas);
+
+                    _makeDraggablePlaceholder(placeholderInfo, _jsPlumb, ipco, ips);
+
+                    // store the id of the dragging div and the source element. the drop function will pick these up.                   
+                    _jsPlumb.setAttributes(this.canvas, {
+                        "dragId": placeholderInfo.id,
+                        "elId": this.elementId
+                    });
+
+// ------------------- create an endpoint that will be our floating endpoint ------------------------------------
+
+                    var endpointToFloat = this.dragProxy || this.endpoint;
+                    if (this.dragProxy == null && this.connectionType != null) {
+                        var aae = this._jsPlumb.instance.deriveEndpointAndAnchorSpec(this.connectionType);
+                        if (aae.endpoints[1]) {
+                            endpointToFloat = aae.endpoints[1];
+                        }
+                    }
+                    var centerAnchor = this._jsPlumb.instance.makeAnchor("Center");
+                    centerAnchor.isFloating = true;
+                    this._jsPlumb.floatingEndpoint = _makeFloatingEndpoint(this.getPaintStyle(), centerAnchor, endpointToFloat, this.canvas, placeholderInfo.element, _jsPlumb, _newEndpoint, this.scope);
+                    var _savedAnchor = this._jsPlumb.floatingEndpoint.anchor;
+
+
+                    if (jpc == null) {
+
+                        this.setHover(false, false);
+                        // create a connection. one end is this endpoint, the other is a floating endpoint.                    
+                        jpc = _newConnection({
+                            sourceEndpoint: this,
+                            targetEndpoint: this._jsPlumb.floatingEndpoint,
+                            source: this.element,  // for makeSource with parent option.  ensure source element is represented correctly.
+                            target: placeholderInfo.element,
+                            anchors: [ this.anchor, this._jsPlumb.floatingEndpoint.anchor ],
+                            paintStyle: params.connectorStyle, // this can be null. Connection will use the default.
+                            hoverPaintStyle: params.connectorHoverStyle,
+                            connector: params.connector, // this can also be null. Connection will use the default.
+                            overlays: params.connectorOverlays,
+                            type: this.connectionType,
+                            cssClass: this.connectorClass,
+                            hoverClass: this.connectorHoverClass,
+                            scope:params.scope,
+                            data:beforeDrag
+                        });
+                        jpc.pending = true;
+                        jpc.addClass(_jsPlumb.draggingClass);
+                        this._jsPlumb.floatingEndpoint.addClass(_jsPlumb.draggingClass);
+                        this._jsPlumb.floatingEndpoint.anchor = _savedAnchor;
+                        // fire an event that informs that a connection is being dragged
+                        _jsPlumb.fire("connectionDrag", jpc);
+
+                        // register the new connection on the drag manager. This connection, at this point, is 'pending',
+                        // and has as its target a temporary element (the 'placeholder'). If the connection subsequently
+                        // becomes established, the anchor manager is informed that the target of the connection has
+                        // changed.
+
+                        _jsPlumb.anchorManager.newConnection(jpc);
+
+                    } else {
+                        existingJpc = true;
+                        jpc.setHover(false);
+                        // new anchor idx
+                        var anchorIdx = jpc.endpoints[0].id === this.id ? 0 : 1;
+                        this.detachFromConnection(jpc, null, true);                         // detach from the connection while dragging is occurring. but dont cleanup automatically.
+
+                        // store the original scope (issue 57)
+                        var dragScope = _jsPlumb.getDragScope(canvasElement);
+                        _jsPlumb.setAttribute(this.canvas, "originalScope", dragScope);
+
+                        // fire an event that informs that a connection is being dragged. we do this before
+                        // replacing the original target with the floating element info.
+                        _jsPlumb.fire("connectionDrag", jpc);
+
+                        // now we replace ourselves with the temporary div we created above:
+                        if (anchorIdx === 0) {
+                            existingJpcParams = [ jpc.source, jpc.sourceId, canvasElement, dragScope ];
+                            _jsPlumb.anchorManager.sourceChanged(jpc.endpoints[anchorIdx].elementId, placeholderInfo.id, jpc, placeholderInfo.element);
+
+                        } else {
+                            existingJpcParams = [ jpc.target, jpc.targetId, canvasElement, dragScope ];
+                            jpc.target = placeholderInfo.element;
+                            jpc.targetId = placeholderInfo.id;
+
+                            _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.endpoints[anchorIdx].elementId, jpc.targetId, jpc);
+                        }
+
+                        // store the original endpoint and assign the new floating endpoint for the drag.
+                        jpc.suspendedEndpoint = jpc.endpoints[anchorIdx];
+
+                        // PROVIDE THE SUSPENDED ELEMENT, BE IT A SOURCE OR TARGET (ISSUE 39)
+                        jpc.suspendedElement = jpc.endpoints[anchorIdx].getElement();
+                        jpc.suspendedElementId = jpc.endpoints[anchorIdx].elementId;
+                        jpc.suspendedElementType = anchorIdx === 0 ? "source" : "target";
+
+                        jpc.suspendedEndpoint.setHover(false);
+                        this._jsPlumb.floatingEndpoint.referenceEndpoint = jpc.suspendedEndpoint;
+                        jpc.endpoints[anchorIdx] = this._jsPlumb.floatingEndpoint;
+
+                        jpc.addClass(_jsPlumb.draggingClass);
+                        this._jsPlumb.floatingEndpoint.addClass(_jsPlumb.draggingClass);
+                    }
+
+                    // register it and register connection on it.
+                    _jsPlumb.floatingConnections[placeholderInfo.id] = jpc;
+                    // only register for the target endpoint; we will not be dragging the source at any time
+                    // before this connection is either discarded or made into a permanent connection.
+                    _ju.addToList(params.endpointsByElement, placeholderInfo.id, this._jsPlumb.floatingEndpoint);
+                    // tell jsplumb about it
+                    _jsPlumb.currentlyDragging = true;
+                }.bind(this);
+
+                var stop = function () {
+                    _jsPlumb.setConnectionBeingDragged(false);
+
+                    if (jpc && jpc.endpoints != null) {
+                        // get the actual drop event (decode from library args to stop function)
+                        var originalEvent = _jsPlumb.getDropEvent(arguments);
+                        // unlock the other endpoint (if it is dynamic, it would have been locked at drag start)
+                        var idx = _jsPlumb.getFloatingAnchorIndex(jpc);
+                        jpc.endpoints[idx === 0 ? 1 : 0].anchor.locked = false;
+                        // TODO: Dont want to know about css classes inside jsplumb, ideally.
+                        jpc.removeClass(_jsPlumb.draggingClass);
+
+                        // if we have the floating endpoint then the connection has not been dropped
+                        // on another endpoint.  If it is a new connection we throw it away. If it is an
+                        // existing connection we check to see if we should reattach it, throwing it away
+                        // if not.
+                        if (this._jsPlumb && (jpc.deleteConnectionNow || jpc.endpoints[idx] === this._jsPlumb.floatingEndpoint)) {
+                            // 6a. if the connection was an existing one...
+                            if (existingJpc && jpc.suspendedEndpoint) {
+                                // fix for issue35, thanks Sylvain Gizard: when firing the detach event make sure the
+                                // floating endpoint has been replaced.
+                                if (idx === 0) {
+                                    jpc.floatingElement = jpc.source;
+                                    jpc.floatingId = jpc.sourceId;
+                                    jpc.floatingEndpoint = jpc.endpoints[0];
+                                    jpc.floatingIndex = 0;
+                                    jpc.source = existingJpcParams[0];
+                                    jpc.sourceId = existingJpcParams[1];
+                                } else {
+                                    // keep a copy of the floating element; the anchor manager will want to clean up.
+                                    jpc.floatingElement = jpc.target;
+                                    jpc.floatingId = jpc.targetId;
+                                    jpc.floatingEndpoint = jpc.endpoints[1];
+                                    jpc.floatingIndex = 1;
+                                    jpc.target = existingJpcParams[0];
+                                    jpc.targetId = existingJpcParams[1];
+                                }
+
+                                var fe = this._jsPlumb.floatingEndpoint; // store for later removal.
+                                // restore the original scope (issue 57)
+                                _jsPlumb.setDragScope(existingJpcParams[2], existingJpcParams[3]);
+                                jpc.endpoints[idx] = jpc.suspendedEndpoint;
+                                // IF the connection should be reattached, or the other endpoint refuses detach, then
+                                // reset the connection to its original state
+                                //if (jpc.isReattach() || jpc._forceReattach || jpc._forceDetach || !jpc.endpoints[idx === 0 ? 1 : 0].detach({connection:jpc, ignoreTarget:false, forceDetach:false, fireEvent:true, originalEvent:originalEvent, endpointBeingDeleted:true})) {
+                                if (jpc.isReattach() || jpc._forceReattach || jpc._forceDetach || !_jsPlumb.deleteConnection(jpc)) {
+
+                                    jpc.setHover(false);
+                                    jpc._forceDetach = null;
+                                    jpc._forceReattach = null;
+                                    this._jsPlumb.floatingEndpoint.detachFromConnection(jpc);
+                                    jpc.suspendedEndpoint.addConnection(jpc);
+
+                                    // TODO this code is duplicated in lots of places...and there is nothing external
+                                    // in the code; it all refers to the connection itself. we could add a
+                                    // `checkSanity(connection)` method to anchorManager that did this.
+                                    if (idx === 1) {
+                                        _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.floatingId, jpc.targetId, jpc);
+                                    }
+                                    else {
+                                        _jsPlumb.anchorManager.sourceChanged(jpc.floatingId, jpc.sourceId, jpc, jpc.source);
+                                    }
+
+                                    _jsPlumb.repaint(existingJpcParams[1]);
+                                }
+                                else {
+                                    _jsPlumb.deleteObject({endpoint: fe});
+                                }
+                            }
+                        }
+
+                        // makeTargets sets this flag, to tell us we have been replaced and should delete this object.
+                        if (this.deleteAfterDragStop) {
+                            _jsPlumb.deleteObject({endpoint: this});
+                        }
+                        else {
+                            if (this._jsPlumb) {
+                                 this.paint({recalc: false});
+                            }
+                        }
+
+                        // although the connection is no longer valid, there are use cases where this is useful.
+                        _jsPlumb.fire("connectionDragStop", jpc, originalEvent);
+                        // fire this event to give people more fine-grained control (connectionDragStop fires a lot)
+                        if (jpc.pending) {
+                            _jsPlumb.fire("connectionAborted", jpc, originalEvent);
+                        }
+                        // tell jsplumb that dragging is finished.
+                        _jsPlumb.currentlyDragging = false;
+                        jpc.suspendedElement = null;
+                        jpc.suspendedEndpoint = null;
+                        jpc = null;
+                    }
+
+                    // if no endpoints, jpc already cleaned up. but still we want to ensure we're reset properly.
+                    // remove the element associated with the floating endpoint
+                    // (and its associated floating endpoint and visual artefacts)
+                    if (placeholderInfo && placeholderInfo.element) {
+                        _jsPlumb.remove(placeholderInfo.element, false, false);
+                    }
+                    // remove the inplace copy
+                    if (inPlaceCopy) {
+                        _jsPlumb.deleteObject({endpoint: inPlaceCopy});
+                    }
+
+                    if (this._jsPlumb) {
+                        // make our canvas visible (TODO: hand off to library; we should not know about DOM)
+                        this.canvas.style.visibility = "visible";
+                        // unlock our anchor
+                        this.anchor.locked = false;
+                        // clear floating anchor.
+                        this._jsPlumb.floatingEndpoint = null;
+                    }
+
+                }.bind(this);
+
+                dragOptions = _jp.extend(defaultOpts, dragOptions);
+                dragOptions.scope = this.scope || dragOptions.scope;
+                dragOptions[beforeStartEvent] = _ju.wrap(dragOptions[beforeStartEvent], beforeStart, false);
+                dragOptions[startEvent] = _ju.wrap(dragOptions[startEvent], start, false);
+                // extracted drag handler function so can be used by makeSource
+                dragOptions[dragEvent] = _ju.wrap(dragOptions[dragEvent], _dragHandler.drag);
+                dragOptions[stopEvent] = _ju.wrap(dragOptions[stopEvent], stop);
+                dragOptions.multipleDrop = false;
+
+                dragOptions.canDrag = function () {
+                    return this.isSource || this.isTemporarySource || /*(this.isTarget && */this.connections.length > 0/*)*/;
+                }.bind(this);
+
+                _jsPlumb.initDraggable(this.canvas, dragOptions, "internal");
+
+                this.canvas._jsPlumbRelatedElement = this.element;
+
+                draggingInitialised = true;
+            }
+        };
+
+        var ep = params.endpoint || this._jsPlumb.instance.Defaults.Endpoint || _jp.Defaults.Endpoint;
+        this.setEndpoint(ep, true);
+        var anchorParamsToUse = params.anchor ? params.anchor : params.anchors ? params.anchors : (_jsPlumb.Defaults.Anchor || "Top");
+        this.setAnchor(anchorParamsToUse, true);
+
+        // finally, set type if it was provided
+        var type = [ "default", (params.type || "")].join(" ");
+        this.addType(type, params.data, true);
+        this.canvas = this.endpoint.canvas;
+        this.canvas._jsPlumb = this;
+
+        this.initDraggable();
+
+        // pulled this out into a function so we can reuse it for the inPlaceCopy canvas; you can now drop detached connections
+        // back onto the endpoint you detached it from.
+        var _initDropTarget = function (canvas, isTransient, endpoint, referenceEndpoint) {
+
+            if (_jp.isDropSupported(this.element)) {
+                var dropOptions = params.dropOptions || _jsPlumb.Defaults.DropOptions || _jp.Defaults.DropOptions;
+                dropOptions = _jp.extend({}, dropOptions);
+                dropOptions.scope = dropOptions.scope || this.scope;
+                var dropEvent = _jp.dragEvents.drop,
+                    overEvent = _jp.dragEvents.over,
+                    outEvent = _jp.dragEvents.out,
+                    _ep = this,
+                    drop = _jsPlumb.EndpointDropHandler({
+                        getEndpoint: function () {
+                            return _ep;
+                        },
+                        jsPlumb: _jsPlumb,
+                        enabled: function () {
+                            return endpoint != null ? endpoint.isEnabled() : true;
+                        },
+                        isFull: function () {
+                            return endpoint.isFull();
+                        },
+                        element: this.element,
+                        elementId: this.elementId,
+                        isSource: this.isSource,
+                        isTarget: this.isTarget,
+                        addClass: function (clazz) {
+                            _ep.addClass(clazz);
+                        },
+                        removeClass: function (clazz) {
+                            _ep.removeClass(clazz);
+                        },
+                        isDropAllowed: function () {
+                            return _ep.isDropAllowed.apply(_ep, arguments);
+                        },
+                        reference:referenceEndpoint,
+                        isRedrop:function(jpc, dhParams) {
+                            return jpc.suspendedEndpoint && dhParams.reference && (jpc.suspendedEndpoint.id === dhParams.reference.id);
+                        }
+                    });
+
+                dropOptions[dropEvent] = _ju.wrap(dropOptions[dropEvent], drop, true);
+                dropOptions[overEvent] = _ju.wrap(dropOptions[overEvent], function () {
+                    var draggable = _jp.getDragObject(arguments),
+                        id = _jsPlumb.getAttribute(_jp.getElement(draggable), "dragId"),
+                        _jpc = _jsPlumb.floatingConnections[id];
+
+                    if (_jpc != null) {
+                        var idx = _jsPlumb.getFloatingAnchorIndex(_jpc);
+                        // here we should fire the 'over' event if we are a target and this is a new connection,
+                        // or we are the same as the floating endpoint.
+                        var _cont = (this.isTarget && idx !== 0) || (_jpc.suspendedEndpoint && this.referenceEndpoint && this.referenceEndpoint.id === _jpc.suspendedEndpoint.id);
+                        if (_cont) {
+                            var bb = _jsPlumb.checkCondition("checkDropAllowed", {
+                                sourceEndpoint: _jpc.endpoints[idx],
+                                targetEndpoint: this,
+                                connection: _jpc
+                            });
+                            this[(bb ? "add" : "remove") + "Class"](_jsPlumb.endpointDropAllowedClass);
+                            this[(bb ? "remove" : "add") + "Class"](_jsPlumb.endpointDropForbiddenClass);
+                            _jpc.endpoints[idx].anchor.over(this.anchor, this);
+                        }
+                    }
+                }.bind(this));
+
+                dropOptions[outEvent] = _ju.wrap(dropOptions[outEvent], function () {
+                    var draggable = _jp.getDragObject(arguments),
+                        id = draggable == null ? null : _jsPlumb.getAttribute(_jp.getElement(draggable), "dragId"),
+                        _jpc = id ? _jsPlumb.floatingConnections[id] : null;
+
+                    if (_jpc != null) {
+                        var idx = _jsPlumb.getFloatingAnchorIndex(_jpc);
+                        var _cont = (this.isTarget && idx !== 0) || (_jpc.suspendedEndpoint && this.referenceEndpoint && this.referenceEndpoint.id === _jpc.suspendedEndpoint.id);
+                        if (_cont) {
+                            this.removeClass(_jsPlumb.endpointDropAllowedClass);
+                            this.removeClass(_jsPlumb.endpointDropForbiddenClass);
+                            _jpc.endpoints[idx].anchor.out();
+                        }
+                    }
+                }.bind(this));
+
+                _jsPlumb.initDroppable(canvas, dropOptions, "internal", isTransient);
+            }
+        }.bind(this);
+
+        // Initialise the endpoint's canvas as a drop target. The drop handler will take care of the logic of whether
+        // something can actually be dropped.
+        if (!this.anchor.isFloating) {
+            _initDropTarget(this.canvas, !(params._transient || this.anchor.isFloating), this, params.reference);
+        }
+
+        return this;
+    };
+
+    _ju.extend(_jp.Endpoint, _jp.OverlayCapableJsPlumbUIComponent, {
+
+        setVisible: function (v, doNotChangeConnections, doNotNotifyOtherEndpoint) {
+            this._jsPlumb.visible = v;
+            if (this.canvas) {
+                this.canvas.style.display = v ? "block" : "none";
+            }
+            this[v ? "showOverlays" : "hideOverlays"]();
+            if (!doNotChangeConnections) {
+                for (var i = 0; i < this.connections.length; i++) {
+                    this.connections[i].setVisible(v);
+                    if (!doNotNotifyOtherEndpoint) {
+                        var oIdx = this === this.connections[i].endpoints[0] ? 1 : 0;
+                        // only change the other endpoint if this is its only connection.
+                        if (this.connections[i].endpoints[oIdx].connections.length === 1) {
+                            this.connections[i].endpoints[oIdx].setVisible(v, true, true);
+                        }
+                    }
+                }
+            }
+        },
+        getAttachedElements: function () {
+            return this.connections;
+        },
+        applyType: function (t, doNotRepaint) {
+            this.setPaintStyle(t.endpointStyle || t.paintStyle, doNotRepaint);
+            this.setHoverPaintStyle(t.endpointHoverStyle || t.hoverPaintStyle, doNotRepaint);
+            if (t.maxConnections != null) {
+                this._jsPlumb.maxConnections = t.maxConnections;
+            }
+            if (t.scope) {
+                this.scope = t.scope;
+            }
+            _jp.extend(this, t, typeParameters);
+            if (t.cssClass != null && this.canvas) {
+                this._jsPlumb.instance.addClass(this.canvas, t.cssClass);
+            }
+            _jp.OverlayCapableJsPlumbUIComponent.applyType(this, t);
+        },
+        isEnabled: function () {
+            return this._jsPlumb.enabled;
+        },
+        setEnabled: function (e) {
+            this._jsPlumb.enabled = e;
+        },
+        cleanup: function () {
+            var anchorClass = this._jsPlumb.instance.endpointAnchorClassPrefix + (this._jsPlumb.currentAnchorClass ? "-" + this._jsPlumb.currentAnchorClass : "");
+            _jp.removeClass(this.element, anchorClass);
+            this.anchor = null;
+            this.endpoint.cleanup(true);
+            this.endpoint.destroy();
+            this.endpoint = null;
+            // drag/drop
+            this._jsPlumb.instance.destroyDraggable(this.canvas, "internal");
+            this._jsPlumb.instance.destroyDroppable(this.canvas, "internal");
+        },
+        setHover: function (h) {
+            if (this.endpoint && this._jsPlumb && !this._jsPlumb.instance.isConnectionBeingDragged()) {
+                this.endpoint.setHover(h);
+            }
+        },
+        isFull: function () {
+            return this._jsPlumb.maxConnections === 0 ? true : !(this.isFloating() || this._jsPlumb.maxConnections < 0 || this.connections.length < this._jsPlumb.maxConnections);
+        },
+        /**
+         * private but needs to be exposed.
+         */
+        isFloating: function () {
+            return this.anchor != null && this.anchor.isFloating;
+        },
+        isConnectedTo: function (endpoint) {
+            var found = false;
+            if (endpoint) {
+                for (var i = 0; i < this.connections.length; i++) {
+                    if (this.connections[i].endpoints[1] === endpoint || this.connections[i].endpoints[0] === endpoint) {
+                        found = true;
+                        break;
+                    }
+                }
+            }
+            return found;
+        },
+        getConnectionCost: function () {
+            return this._jsPlumb.connectionCost;
+        },
+        setConnectionCost: function (c) {
+            this._jsPlumb.connectionCost = c;
+        },
+        areConnectionsDirected: function () {
+            return this._jsPlumb.connectionsDirected;
+        },
+        setConnectionsDirected: function (b) {
+            this._jsPlumb.connectionsDirected = b;
+        },
+        setElementId: function (_elId) {
+            this.elementId = _elId;
+            this.anchor.elementId = _elId;
+        },
+        setReferenceElement: function (_el) {
+            this.element = _jp.getElement(_el);
+        },
+        setDragAllowedWhenFull: function (allowed) {
+            this.dragAllowedWhenFull = allowed;
+        },
+        equals: function (endpoint) {
+            return this.anchor.equals(endpoint.anchor);
+        },
+        getUuid: function () {
+            return this._jsPlumb.uuid;
+        },
+        computeAnchor: function (params) {
+            return this.anchor.compute(params);
+        }
+    });
+
+    root.jsPlumbInstance.prototype.EndpointDropHandler = function (dhParams) {
+        return function (e) {
+
+            var _jsPlumb = dhParams.jsPlumb;
+
+            // remove the classes that are added dynamically. drop is neither forbidden nor allowed now that
+            // the drop is finishing.
+            dhParams.removeClass(_jsPlumb.endpointDropAllowedClass);
+            dhParams.removeClass(_jsPlumb.endpointDropForbiddenClass);
+
+            var originalEvent = _jsPlumb.getDropEvent(arguments),
+                draggable = _jsPlumb.getDragObject(arguments),
+                id = _jsPlumb.getAttribute(draggable, "dragId"),
+                elId = _jsPlumb.getAttribute(draggable, "elId"),
+                scope = _jsPlumb.getAttribute(draggable, "originalScope"),
+                jpc = _jsPlumb.floatingConnections[id];
+
+            // if no active connection, bail.
+            if (jpc == null) {
+                return;
+            }
+
+            // calculate if this is an existing connection.
+            var existingConnection = jpc.suspendedEndpoint != null;
+
+            // if suspended endpoint exists but has been cleaned up, bail. This means it's an existing connection
+            // that has been detached and will shortly be discarded.
+            if (existingConnection && jpc.suspendedEndpoint._jsPlumb == null) {
+                return;
+            }
+
+            // get the drop endpoint. for a normal connection this is just the one that would replace the currently
+            // floating endpoint. for a makeTarget this is a new endpoint that is created on drop. But we leave that to
+            // the handler to figure out.
+            var _ep = dhParams.getEndpoint(jpc);
+
+            // If we're not given an endpoint to use, bail.
+            if (_ep == null) {
+                return;
+            }
+
+            // if this is a drop back where the connection came from, mark it force reattach and
+            // return; the stop handler will reattach. without firing an event.
+            if (dhParams.isRedrop(jpc, dhParams)) {
+                jpc._forceReattach = true;
+                jpc.setHover(false);
+                if (dhParams.maybeCleanup) {
+                    dhParams.maybeCleanup(_ep);
+                }
+                return;
+            }
+
+            // ensure we dont bother trying to drop sources on non-source eps, and same for target.
+            var idx = _jsPlumb.getFloatingAnchorIndex(jpc);
+            if ((idx === 0 && !dhParams.isSource)|| (idx === 1 && !dhParams.isTarget)){
+                if (dhParams.maybeCleanup) {
+                    dhParams.maybeCleanup(_ep);
+                }
+                return;
+            }
+
+            if (dhParams.onDrop) {
+                dhParams.onDrop(jpc);
+            }
+
+            // restore the original scope if necessary (issue 57)
+            if (scope) {
+                _jsPlumb.setDragScope(draggable, scope);
+            }
+
+            // if the target of the drop is full, fire an event (we abort below)
+            // makeTarget: keep.
+            var isFull = dhParams.isFull(e);
+            if (isFull) {
+                _ep.fire("maxConnections", {
+                    endpoint: this,
+                    connection: jpc,
+                    maxConnections: _ep._jsPlumb.maxConnections
+                }, originalEvent);
+            }
+            //
+            // if endpoint enabled, not full, and matches the index of the floating endpoint...
+            if (!isFull &&  dhParams.enabled()) {
+                var _doContinue = true;
+
+                // before testing for beforeDrop, reset the connection's source/target to be the actual DOM elements
+                // involved (that is, stash any temporary stuff used for dragging. but we need to keep it around in
+                // order that the anchor manager can clean things up properly).
+                if (idx === 0) {
+                    jpc.floatingElement = jpc.source;
+                    jpc.floatingId = jpc.sourceId;
+                    jpc.floatingEndpoint = jpc.endpoints[0];
+                    jpc.floatingIndex = 0;
+                    jpc.source = dhParams.element;
+                    jpc.sourceId = dhParams.elementId;
+                } else {
+                    jpc.floatingElement = jpc.target;
+                    jpc.floatingId = jpc.targetId;
+                    jpc.floatingEndpoint = jpc.endpoints[1];
+                    jpc.floatingIndex = 1;
+                    jpc.target = dhParams.element;
+                    jpc.targetId = dhParams.elementId;
+                }
+
+                // if this is an existing connection and detach is not allowed we won't continue. The connection's
+                // endpoints have been reinstated; everything is back to how it was.
+                if (existingConnection && jpc.suspendedEndpoint.id !== _ep.id) {
+                    if (!jpc.isDetachAllowed(jpc) || !jpc.endpoints[idx].isDetachAllowed(jpc) || !jpc.suspendedEndpoint.isDetachAllowed(jpc) || !_jsPlumb.checkCondition("beforeDetach", jpc)) {
+                        _doContinue = false;
+                    }
+                }
+
+// ------------ wrap the execution path in a function so we can support asynchronous beforeDrop
+
+                var continueFunction = function (optionalData) {
+                    // remove this jpc from the current endpoint, which is a floating endpoint that we will
+                    // subsequently discard.
+                    jpc.endpoints[idx].detachFromConnection(jpc);
+
+                    // if there's a suspended endpoint, detach it from the connection.
+                    if (jpc.suspendedEndpoint) {
+                        jpc.suspendedEndpoint.detachFromConnection(jpc);
+                    }
+
+                    jpc.endpoints[idx] = _ep;
+                    _ep.addConnection(jpc);
+
+                    // copy our parameters in to the connection:
+                    var params = _ep.getParameters();
+                    for (var aParam in params) {
+                        jpc.setParameter(aParam, params[aParam]);
+                    }
+
+                    if (!existingConnection) {
+                        // if not an existing connection and
+                        if (params.draggable) {
+                            _jsPlumb.initDraggable(this.element, dhParams.dragOptions, "internal", _jsPlumb);
+                        }
+                    }
+                    else {
+                        var suspendedElementId = jpc.suspendedEndpoint.elementId;
+                        _jsPlumb.fireMoveEvent({
+                            index: idx,
+                            originalSourceId: idx === 0 ? suspendedElementId : jpc.sourceId,
+                            newSourceId: idx === 0 ? _ep.elementId : jpc.sourceId,
+                            originalTargetId: idx === 1 ? suspendedElementId : jpc.targetId,
+                            newTargetId: idx === 1 ? _ep.elementId : jpc.targetId,
+                            originalSourceEndpoint: idx === 0 ? jpc.suspendedEndpoint : jpc.endpoints[0],
+                            newSourceEndpoint: idx === 0 ? _ep : jpc.endpoints[0],
+                            originalTargetEndpoint: idx === 1 ? jpc.suspendedEndpoint : jpc.endpoints[1],
+                            newTargetEndpoint: idx === 1 ? _ep : jpc.endpoints[1],
+                            connection: jpc
+                        }, originalEvent);
+                    }
+
+                    if (idx === 1) {
+                        _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.floatingId, jpc.targetId, jpc);
+                    }
+                    else {
+                        _jsPlumb.anchorManager.sourceChanged(jpc.floatingId, jpc.sourceId, jpc, jpc.source);
+                    }
+
+                    // when makeSource has uniqueEndpoint:true, we want to create connections with new endpoints
+                    // that are subsequently deleted. So makeSource sets `finalEndpoint`, which is the Endpoint to
+                    // which the connection should be attached. The `detachFromConnection` call below results in the
+                    // temporary endpoint being cleaned up.
+                    if (jpc.endpoints[0].finalEndpoint) {
+                        var _toDelete = jpc.endpoints[0];
+                        _toDelete.detachFromConnection(jpc);
+                        jpc.endpoints[0] = jpc.endpoints[0].finalEndpoint;
+                        jpc.endpoints[0].addConnection(jpc);
+                    }
+
+                    // if optionalData was given, merge it onto the connection's data.
+                    if (_ju.isObject(optionalData)) {
+                        jpc.mergeData(optionalData);
+                    }
+                    // finalise will inform the anchor manager and also add to
+                    // connectionsByScope if necessary.
+                    _jsPlumb.finaliseConnection(jpc, null, originalEvent, false);
+                    jpc.setHover(false);
+
+                }.bind(this);
+
+                var dontContinueFunction = function () {
+                    // otherwise just put it back on the endpoint it was on before the drag.
+                    if (jpc.suspendedEndpoint) {
+                        jpc.endpoints[idx] = jpc.suspendedEndpoint;
+                        jpc.setHover(false);
+                        jpc._forceDetach = true;
+                        if (idx === 0) {
+                            jpc.source = jpc.suspendedEndpoint.element;
+                            jpc.sourceId = jpc.suspendedEndpoint.elementId;
+                        } else {
+                            jpc.target = jpc.suspendedEndpoint.element;
+                            jpc.targetId = jpc.suspendedEndpoint.elementId;
+                        }
+                        jpc.suspendedEndpoint.addConnection(jpc);
+
+                        // TODO checkSanity
+                        if (idx === 1) {
+                            _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.floatingId, jpc.targetId, jpc);
+                        }
+                        else {
+                            _jsPlumb.anchorManager.sourceChanged(jpc.floatingId, jpc.sourceId, jpc, jpc.source);
+                        }
+
+                        _jsPlumb.repaint(jpc.sourceId);
+                        jpc._forceDetach = false;
+                    }
+                };
+
+// --------------------------------------
+                // now check beforeDrop.  this will be available only on Endpoints that are setup to
+                // have a beforeDrop condition (although, secretly, under the hood all Endpoints and
+                // the Connection have them, because they are on jsPlumbUIComponent.  shhh!), because
+                // it only makes sense to have it on a target endpoint.
+                _doContinue = _doContinue && dhParams.isDropAllowed(jpc.sourceId, jpc.targetId, jpc.scope, jpc, _ep);// && jpc.pending;
+
+                if (_doContinue) {
+                    continueFunction(_doContinue);
+                    return true;
+                }
+                else {
+                    dontContinueFunction();
+                }
+            }
+
+            if (dhParams.maybeCleanup) {
+                dhParams.maybeCleanup(_ep);
+            }
+
+            _jsPlumb.currentlyDragging = false;
+        };
+    };
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb Community Edition
+ * 
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ * 
+ * This file contains the code for Connections.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ * 
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+    "use strict";
+    var root = this,
+        _jp = root.jsPlumb,
+        _ju = root.jsPlumbUtil;
+
+    var makeConnector = function (_jsPlumb, renderMode, connectorName, connectorArgs, forComponent) {
+            if (!_jsPlumb.Defaults.DoNotThrowErrors && _jp.Connectors[renderMode][connectorName] == null) {
+                throw { msg: "jsPlumb: unknown connector type '" + connectorName + "'" };
+            }
+
+            return new _jp.Connectors[renderMode][connectorName](connectorArgs, forComponent);
+        },
+        _makeAnchor = function (anchorParams, elementId, _jsPlumb) {
+            return (anchorParams) ? _jsPlumb.makeAnchor(anchorParams, elementId, _jsPlumb) : null;
+        },
+        _updateConnectedClass = function (conn, element, _jsPlumb, remove) {
+            if (element != null) {
+                element._jsPlumbConnections = element._jsPlumbConnections || {};
+                if (remove) {
+                    delete element._jsPlumbConnections[conn.id];
+                }
+                else {
+                    element._jsPlumbConnections[conn.id] = true;
+                }
+
+                if (_ju.isEmpty(element._jsPlumbConnections)) {
+                    _jsPlumb.removeClass(element, _jsPlumb.connectedClass);
+                }
+                else {
+                    _jsPlumb.addClass(element, _jsPlumb.connectedClass);
+                }
+            }
+        };
+
+    _jp.Connection = function (params) {
+        var _newEndpoint = params.newEndpoint;
+
+        this.id = params.id;
+        this.connector = null;
+        this.idPrefix = "_jsplumb_c_";
+        this.defaultLabelLocation = 0.5;
+        this.defaultOverlayKeys = ["Overlays", "ConnectionOverlays"];
+        // if a new connection is the result of moving some existing connection, params.previousConnection
+        // will have that Connection in it. listeners for the jsPlumbConnection event can look for that
+        // member and take action if they need to.
+        this.previousConnection = params.previousConnection;
+        this.source = _jp.getElement(params.source);
+        this.target = _jp.getElement(params.target);
+        // sourceEndpoint and targetEndpoint override source/target, if they are present. but 
+        // source is not overridden if the Endpoint has declared it is not the final target of a connection;
+        // instead we use the source that the Endpoint declares will be the final source element.
+        if (params.sourceEndpoint) {
+            this.source = params.sourceEndpoint.getElement();
+        }
+        if (params.targetEndpoint) {
+            this.target = params.targetEndpoint.getElement();
+        }
+
+        _jp.OverlayCapableJsPlumbUIComponent.apply(this, arguments);
+
+        this.sourceId = this._jsPlumb.instance.getId(this.source);
+        this.targetId = this._jsPlumb.instance.getId(this.target);
+        this.scope = params.scope; // scope may have been passed in to the connect call. if it wasn't, we will pull it from the source endpoint, after having initialised the endpoints.            
+        this.endpoints = [];
+        this.endpointStyles = [];
+
+        var _jsPlumb = this._jsPlumb.instance;
+
+        _jsPlumb.manage(this.sourceId, this.source);
+        _jsPlumb.manage(this.targetId, this.target);
+
+        this._jsPlumb.visible = true;
+        this._jsPlumb.editable = params.editable === true;
+        this._jsPlumb.params = {
+            cssClass: params.cssClass,
+            container: params.container,
+            "pointer-events": params["pointer-events"],
+            editorParams: params.editorParams,
+            overlays: params.overlays
+        };
+        this._jsPlumb.lastPaintedAt = null;
+
+        // listen to mouseover and mouseout events passed from the container delegate.
+        this.bind("mouseover", function () {
+            this.setHover(true);
+        }.bind(this));
+        this.bind("mouseout", function () {
+            this.setHover(false);
+        }.bind(this));
+
+        this.editableRequested = params.editable !== false;
+        this.setEditable = function(e) {
+            return this.connector ? this.connector.setEditable(e) : false;
+        };
+        this.isEditable = function() { return this.connector ? this.connector.isEditable() : false; };
+        this.isEditing = function() { return this.connector ? this.connector.isEditing() : false; };
+
+// INITIALISATION CODE
+
+        this.makeEndpoint = function (isSource, el, elId, ep) {
+            elId = elId || this._jsPlumb.instance.getId(el);
+            return this.prepareEndpoint(_jsPlumb, _newEndpoint, this, ep, isSource ? 0 : 1, params, el, elId);
+        };
+
+        // if type given, get the endpoint definitions mapping to that type from the jsplumb instance, and use those.
+        // we apply types at the end of this constructor but endpoints are only honoured in a type definition at
+        // create time.
+        if (params.type) {
+            params.endpoints = params.endpoints || this._jsPlumb.instance.deriveEndpointAndAnchorSpec(params.type).endpoints;
+        }
+
+        var eS = this.makeEndpoint(true, this.source, this.sourceId, params.sourceEndpoint),
+            eT = this.makeEndpoint(false, this.target, this.targetId, params.targetEndpoint);
+
+        if (eS) {
+            _ju.addToList(params.endpointsByElement, this.sourceId, eS);
+        }
+        if (eT) {
+            _ju.addToList(params.endpointsByElement, this.targetId, eT);
+        }
+        // if scope not set, set it to be the scope for the source endpoint.
+        if (!this.scope) {
+            this.scope = this.endpoints[0].scope;
+        }
+
+        // if explicitly told to (or not to) delete endpoints when empty, override endpoint's preferences
+        if (params.deleteEndpointsOnEmpty != null) {
+            this.endpoints[0].setDeleteOnEmpty(params.deleteEndpointsOnEmpty);
+            this.endpoints[1].setDeleteOnEmpty(params.deleteEndpointsOnEmpty);
+        }
+//        else {
+//            // otherwise, unless the endpoints say otherwise, mark them for deletion.
+//            if (!this.endpoints[0]._doNotDeleteOnDetach) this.endpoints[0]._deleteOnDetach = true;
+//            if (!this.endpoints[1]._doNotDeleteOnDetach) this.endpoints[1]._deleteOnDetach = true;
+//        }
+
+// -------------------------- DEFAULT TYPE ---------------------------------------------
+
+        // DETACHABLE
+        var _detachable = _jsPlumb.Defaults.ConnectionsDetachable;
+        if (params.detachable === false) {
+            _detachable = false;
+        }
+        if (this.endpoints[0].connectionsDetachable === false) {
+            _detachable = false;
+        }
+        if (this.endpoints[1].connectionsDetachable === false) {
+            _detachable = false;
+        }
+        // REATTACH
+        var _reattach = params.reattach || this.endpoints[0].reattachConnections || this.endpoints[1].reattachConnections || _jsPlumb.Defaults.ReattachConnections;
+
+        this.appendToDefaultType({
+            detachable: _detachable,
+            reattach: _reattach,
+            paintStyle:this.endpoints[0].connectorStyle || this.endpoints[1].connectorStyle || params.paintStyle || _jsPlumb.Defaults.PaintStyle || _jp.Defaults.PaintStyle,
+            hoverPaintStyle:this.endpoints[0].connectorHoverStyle || this.endpoints[1].connectorHoverStyle || params.hoverPaintStyle || _jsPlumb.Defaults.HoverPaintStyle || _jp.Defaults.HoverPaintStyle
+        });
+
+        var _suspendedAt = _jsPlumb.getSuspendedAt();
+        if (!_jsPlumb.isSuspendDrawing()) {
+            // paint the endpoints
+            var myInfo = _jsPlumb.getCachedData(this.sourceId),
+                myOffset = myInfo.o, myWH = myInfo.s,
+                otherInfo = _jsPlumb.getCachedData(this.targetId),
+                otherOffset = otherInfo.o,
+                otherWH = otherInfo.s,
+                initialTimestamp = _suspendedAt || _jsPlumb.timestamp(),
+                anchorLoc = this.endpoints[0].anchor.compute({
+                    xy: [ myOffset.left, myOffset.top ], wh: myWH, element: this.endpoints[0],
+                    elementId: this.endpoints[0].elementId,
+                    txy: [ otherOffset.left, otherOffset.top ], twh: otherWH, tElement: this.endpoints[1],
+                    timestamp: initialTimestamp
+                });
+
+            this.endpoints[0].paint({ anchorLoc: anchorLoc, timestamp: initialTimestamp });
+
+            anchorLoc = this.endpoints[1].anchor.compute({
+                xy: [ otherOffset.left, otherOffset.top ], wh: otherWH, element: this.endpoints[1],
+                elementId: this.endpoints[1].elementId,
+                txy: [ myOffset.left, myOffset.top ], twh: myWH, tElement: this.endpoints[0],
+                timestamp: initialTimestamp
+            });
+            this.endpoints[1].paint({ anchorLoc: anchorLoc, timestamp: initialTimestamp });
+        }
+
+        this.getTypeDescriptor = function () {
+            return "connection";
+        };
+        this.getAttachedElements = function () {
+            return this.endpoints;
+        };
+
+        this.isDetachable = function () {
+            return this._jsPlumb.detachable === true;
+        };
+        this.setDetachable = function (detachable) {
+            this._jsPlumb.detachable = detachable === true;
+        };
+        this.isReattach = function () {
+            return this._jsPlumb.reattach === true || this.endpoints[0].reattachConnections === true || this.endpoints[1].reattachConnections === true;
+        };
+        this.setReattach = function (reattach) {
+            this._jsPlumb.reattach = reattach === true;
+        };
+
+//        this["delete"] = function() {
+//            this.endpoints[0].detachFromConnection(this);
+//            this.endpoints[1].detachFromConnection(this);
+//            params.deleteConnection(this);
+//        };
+
+// END INITIALISATION CODE
+
+
+// COST + DIRECTIONALITY
+        // if cost not supplied, try to inherit from source endpoint
+        this._jsPlumb.cost = params.cost || this.endpoints[0].getConnectionCost();
+        this._jsPlumb.directed = params.directed;
+        // inherit directed flag if set no source endpoint
+        if (params.directed == null) {
+            this._jsPlumb.directed = this.endpoints[0].areConnectionsDirected();
+        }
+// END COST + DIRECTIONALITY
+
+// PARAMETERS
+        // merge all the parameters objects into the connection.  parameters set
+        // on the connection take precedence; then source endpoint params, then
+        // finally target endpoint params.
+        var _p = _jp.extend({}, this.endpoints[1].getParameters());
+        _jp.extend(_p, this.endpoints[0].getParameters());
+        _jp.extend(_p, this.getParameters());
+        this.setParameters(_p);
+// END PARAMETERS
+
+// PAINTING
+
+        this.setConnector(this.endpoints[0].connector || this.endpoints[1].connector || params.connector || _jsPlumb.Defaults.Connector || _jp.Defaults.Connector, true);
+        if (params.geometry) {
+            this.connector.setGeometry(params.geometry);
+        }
+        var data = params.data == null || !_ju.isObject(params.data) ? {} : params.data;
+        this.getData = function() { return data; };
+        this.setData = function(d) { data = d || {}; };
+        this.mergeData = function(d) { data = _jp.extend(data, d); };
+
+        // the very last thing we do is apply types, if there are any.
+        var _types = [ "default", this.endpoints[0].connectionType, this.endpoints[1].connectionType,  params.type ].join(" ");
+        if (/[^\s]/.test(_types)) {
+            this.addType(_types, params.data, true);
+        }
+
+        this.updateConnectedClass();
+
+// END PAINTING    
+    };
+
+    _ju.extend(_jp.Connection, _jp.OverlayCapableJsPlumbUIComponent, {
+        applyType: function (t, doNotRepaint, typeMap) {
+
+            // none of these things result in the creation of objects so can be ignored.
+            if (t.detachable != null) {
+                this.setDetachable(t.detachable);
+            }
+            if (t.reattach != null) {
+                this.setReattach(t.reattach);
+            }
+            if (t.scope) {
+                this.scope = t.scope;
+            }
+
+            if (t.cssClass != null && this.canvas) {
+                this._jsPlumb.instance.addClass(this.canvas, t.cssClass);
+            }
+
+            var _anchors = null;
+            // this also results in the creation of objects.
+            if (t.anchor) {
+                // note that even if the param was anchor, we store `anchors`.
+                _anchors = this.getCachedTypeItem("anchors", typeMap.anchor);
+                if (_anchors == null) {
+                    _anchors = [ this._jsPlumb.instance.makeAnchor(t.anchor), this._jsPlumb.instance.makeAnchor(t.anchor) ];
+                    this.cacheTypeItem("anchors", _anchors, typeMap.anchor);
+                }
+            }
+            else if (t.anchors) {
+                _anchors = this.getCachedTypeItem("anchors", typeMap.anchors);
+                if (_anchors == null) {
+                    _anchors = [
+                        this._jsPlumb.instance.makeAnchor(t.anchors[0]),
+                        this._jsPlumb.instance.makeAnchor(t.anchors[1])
+                    ];
+                    this.cacheTypeItem("anchors", _anchors, typeMap.anchors);
+                }
+            }
+            if (_anchors != null) {
+                this.endpoints[0].anchor = _anchors[0];
+                this.endpoints[1].anchor = _anchors[1];
+                if (this.endpoints[1].anchor.isDynamic) {
+                    this._jsPlumb.instance.repaint(this.endpoints[1].elementId);
+                }
+            }
+
+            _jp.OverlayCapableJsPlumbUIComponent.applyType(this, t);
+        },
+        addClass: function (c, informEndpoints) {
+            if (informEndpoints) {
+                this.endpoints[0].addClass(c);
+                this.endpoints[1].addClass(c);
+                if (this.suspendedEndpoint) {
+                    this.suspendedEndpoint.addClass(c);
+                }
+            }
+            if (this.connector) {
+                this.connector.addClass(c);
+            }
+        },
+        removeClass: function (c, informEndpoints) {
+            if (informEndpoints) {
+                this.endpoints[0].removeClass(c);
+                this.endpoints[1].removeClass(c);
+                if (this.suspendedEndpoint) {
+                    this.suspendedEndpoint.removeClass(c);
+                }
+            }
+            if (this.connector) {
+                this.connector.removeClass(c);
+            }
+        },
+        isVisible: function () {
+            return this._jsPlumb.visible;
+        },
+        setVisible: function (v) {
+            this._jsPlumb.visible = v;
+            if (this.connector) {
+                this.connector.setVisible(v);
+            }
+            this.repaint();
+        },
+        cleanup: function () {
+            this.updateConnectedClass(true);
+            this.endpoints = null;
+            this.source = null;
+            this.target = null;
+            if (this.connector != null) {
+                this.connector.cleanup(true);
+                this.connector.destroy(true);
+            }
+            this.connector = null;
+        },
+        updateConnectedClass:function(remove) {
+            if (this._jsPlumb) {
+                _updateConnectedClass(this, this.source, this._jsPlumb.instance, remove);
+                _updateConnectedClass(this, this.target, this._jsPlumb.instance, remove);
+            }
+        },
+        setHover: function (state) {
+            if (this.connector && this._jsPlumb && !this._jsPlumb.instance.isConnectionBeingDragged()) {
+                this.connector.setHover(state);
+                root.jsPlumb[state ? "addClass" : "removeClass"](this.source, this._jsPlumb.instance.hoverSourceClass);
+                root.jsPlumb[state ? "addClass" : "removeClass"](this.target, this._jsPlumb.instance.hoverTargetClass);
+            }
+        },
+        getUuids:function() {
+            return [ this.endpoints[0].getUuid(), this.endpoints[1].getUuid() ];
+        },
+        getCost: function () {
+            return this._jsPlumb ? this._jsPlumb.cost : -Infinity;
+        },
+        setCost: function (c) {
+            this._jsPlumb.cost = c;
+        },
+        isDirected: function () {
+            return this._jsPlumb.directed === true;
+        },
+        getConnector: function () {
+            return this.connector;
+        },
+        getGeometry : function() {
+            return this.connector ? this.connector.getGeometry() : null;
+        },
+        setGeometry : function(g) {
+            if (this.connector) {
+                this.connector.setGeometry(g);
+            }
+        },
+        prepareConnector:function(connectorSpec, typeId) {
+            var connectorArgs = {
+                    _jsPlumb: this._jsPlumb.instance,
+                    cssClass: (this._jsPlumb.params.cssClass || "") + (this.isEditable() ? this._jsPlumb.instance.editableConnectorClass : ""),
+                    container: this._jsPlumb.params.container,
+                    "pointer-events": this._jsPlumb.params["pointer-events"],
+                    editable:this.editableRequested
+                },
+                renderMode = this._jsPlumb.instance.getRenderMode(),
+                connector;
+
+            if (_ju.isString(connectorSpec)) {
+                connector = makeConnector(this._jsPlumb.instance, renderMode, connectorSpec, connectorArgs, this);
+            } // lets you use a string as shorthand.
+            else if (_ju.isArray(connectorSpec)) {
+                if (connectorSpec.length === 1) {
+                    connector = makeConnector(this._jsPlumb.instance, renderMode, connectorSpec[0], connectorArgs, this);
+                }
+                else {
+                    connector = makeConnector(this._jsPlumb.instance, renderMode, connectorSpec[0], _ju.merge(connectorSpec[1], connectorArgs), this);
+                }
+            }
+            if (typeId != null) {
+                connector.typeId = typeId;
+            }
+            return connector;
+        },
+        setPreparedConnector: function(connector, doNotRepaint, doNotChangeListenerComponent, typeId) {
+
+            var previous, previousClasses = "";
+            // the connector will not be cleaned up if it was set as part of a type, because `typeId` will be set on it
+            // and we havent passed in `true` for "force" here.
+            if (this.connector != null) {
+                previous = this.connector;
+                previousClasses = previous.getClass();
+                this.connector.cleanup();
+                this.connector.destroy();
+            }
+
+            this.connector = connector;
+            if (typeId) {
+                this.cacheTypeItem("connector", connector, typeId);
+            }
+
+            this.canvas = this.connector.canvas;
+            this.bgCanvas = this.connector.bgCanvas;
+
+            // put classes from prior connector onto the canvas
+            this.addClass(previousClasses);
+
+            // new: instead of binding listeners per connector, we now just have one delegate on the container.
+            // so for that handler we set the connection as the '_jsPlumb' member of the canvas element, and
+            // bgCanvas, if it exists, which it does right now in the VML renderer, so it won't from v 2.0.0 onwards.
+            if (this.canvas) {
+                this.canvas._jsPlumb = this;
+            }
+            if (this.bgCanvas) {
+                this.bgCanvas._jsPlumb = this;
+            }
+
+            if (previous != null) {
+                var o = this.getOverlays();
+                for (var i = 0; i < o.length; i++) {
+                    if (o[i].transfer) {
+                        o[i].transfer(this.connector);
+                    }
+                }
+            }
+
+            if (!doNotChangeListenerComponent) {
+                this.setListenerComponent(this.connector);
+            }
+            if (!doNotRepaint) {
+                this.repaint();
+            }
+        },
+        setConnector: function (connectorSpec, doNotRepaint, doNotChangeListenerComponent, typeId) {
+            var connector = this.prepareConnector(connectorSpec, typeId);
+            this.setPreparedConnector(connector, doNotRepaint, doNotChangeListenerComponent, typeId);
+        },
+        paint: function (params) {
+
+            if (!this._jsPlumb.instance.isSuspendDrawing() && this._jsPlumb.visible) {
+                params = params || {};
+                var timestamp = params.timestamp,
+                // if the moving object is not the source we must transpose the two references.
+                    swap = false,
+                    tId = swap ? this.sourceId : this.targetId, sId = swap ? this.targetId : this.sourceId,
+                    tIdx = swap ? 0 : 1, sIdx = swap ? 1 : 0;
+
+                if (timestamp == null || timestamp !== this._jsPlumb.lastPaintedAt) {
+                    var sourceInfo = this._jsPlumb.instance.updateOffset({elId:sId}).o,
+                        targetInfo = this._jsPlumb.instance.updateOffset({elId:tId}).o,
+                        sE = this.endpoints[sIdx], tE = this.endpoints[tIdx];
+
+                    var sAnchorP = sE.anchor.getCurrentLocation({xy: [sourceInfo.left, sourceInfo.top], wh: [sourceInfo.width, sourceInfo.height], element: sE, timestamp: timestamp}),
+                        tAnchorP = tE.anchor.getCurrentLocation({xy: [targetInfo.left, targetInfo.top], wh: [targetInfo.width, targetInfo.height], element: tE, timestamp: timestamp});
+
+                    this.connector.resetBounds();
+
+                    this.connector.compute({
+                        sourcePos: sAnchorP,
+                        targetPos: tAnchorP,
+                        sourceEndpoint: this.endpoints[sIdx],
+                        targetEndpoint: this.endpoints[tIdx],
+                        "stroke-width": this._jsPlumb.paintStyleInUse.strokeWidth,
+                        sourceInfo: sourceInfo,
+                        targetInfo: targetInfo
+                    });
+
+                    var overlayExtents = { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity };
+
+                    // compute overlays. we do this first so we can get their placements, and adjust the
+                    // container if needs be (if an overlay would be clipped)
+                    for (var i in this._jsPlumb.overlays) {
+                        if (this._jsPlumb.overlays.hasOwnProperty(i)) {
+                            var o = this._jsPlumb.overlays[i];
+                            if (o.isVisible()) {
+                                this._jsPlumb.overlayPlacements[i] = o.draw(this.connector, this._jsPlumb.paintStyleInUse, this.getAbsoluteOverlayPosition(o));
+                                overlayExtents.minX = Math.min(overlayExtents.minX, this._jsPlumb.overlayPlacements[i].minX);
+                                overlayExtents.maxX = Math.max(overlayExtents.maxX, this._jsPlumb.overlayPlacements[i].maxX);
+                                overlayExtents.minY = Math.min(overlayExtents.minY, this._jsPlumb.overlayPlacements[i].minY);
+                                overlayExtents.maxY = Math.max(overlayExtents.maxY, this._jsPlumb.overlayPlacements[i].maxY);
+                            }
+                        }
+                    }
+
+                    var lineWidth = parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth || 1) / 2,
+                        outlineWidth = parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth || 0),
+                        extents = {
+                            xmin: Math.min(this.connector.bounds.minX - (lineWidth + outlineWidth), overlayExtents.minX),
+                            ymin: Math.min(this.connector.bounds.minY - (lineWidth + outlineWidth), overlayExtents.minY),
+                            xmax: Math.max(this.connector.bounds.maxX + (lineWidth + outlineWidth), overlayExtents.maxX),
+                            ymax: Math.max(this.connector.bounds.maxY + (lineWidth + outlineWidth), overlayExtents.maxY)
+                        };
+                    // paint the connector.
+                    this.connector.paint(this._jsPlumb.paintStyleInUse, null, extents);
+                    // and then the overlays
+                    for (var j in this._jsPlumb.overlays) {
+                        if (this._jsPlumb.overlays.hasOwnProperty(j)) {
+                            var p = this._jsPlumb.overlays[j];
+                            if (p.isVisible()) {
+                                p.paint(this._jsPlumb.overlayPlacements[j], extents);
+                            }
+                        }
+                    }
+                }
+                this._jsPlumb.lastPaintedAt = timestamp;
+            }
+        },
+        repaint: function (params) {
+            params = params || {};
+            this.paint({ elId: this.sourceId, recalc: !(params.recalc === false), timestamp: params.timestamp});
+        },
+        prepareEndpoint: function (_jsPlumb, _newEndpoint, conn, existing, index, params, element, elementId) {
+            var e;
+            if (existing) {
+                conn.endpoints[index] = existing;
+                existing.addConnection(conn);
+            } else {
+                if (!params.endpoints) {
+                    params.endpoints = [ null, null ];
+                }
+                var ep = params.endpoints[index] || params.endpoint || _jsPlumb.Defaults.Endpoints[index] || _jp.Defaults.Endpoints[index] || _jsPlumb.Defaults.Endpoint || _jp.Defaults.Endpoint;
+                if (!params.endpointStyles) {
+                    params.endpointStyles = [ null, null ];
+                }
+                if (!params.endpointHoverStyles) {
+                    params.endpointHoverStyles = [ null, null ];
+                }
+                var es = params.endpointStyles[index] || params.endpointStyle || _jsPlumb.Defaults.EndpointStyles[index] || _jp.Defaults.EndpointStyles[index] || _jsPlumb.Defaults.EndpointStyle || _jp.Defaults.EndpointStyle;
+                // Endpoints derive their fill from the connector's stroke, if no fill was specified.
+                if (es.fill == null && params.paintStyle != null) {
+                    es.fill = params.paintStyle.stroke;
+                }
+
+                if (es.outlineStroke == null && params.paintStyle != null) {
+                    es.outlineStroke = params.paintStyle.outlineStroke;
+                }
+                if (es.outlineWidth == null && params.paintStyle != null) {
+                    es.outlineWidth = params.paintStyle.outlineWidth;
+                }
+
+                var ehs = params.endpointHoverStyles[index] || params.endpointHoverStyle || _jsPlumb.Defaults.EndpointHoverStyles[index] || _jp.Defaults.EndpointHoverStyles[index] || _jsPlumb.Defaults.EndpointHoverStyle || _jp.Defaults.EndpointHoverStyle;
+                // endpoint hover fill style is derived from connector's hover stroke style
+                if (params.hoverPaintStyle != null) {
+                    if (ehs == null) {
+                        ehs = {};
+                    }
+                    if (ehs.fill == null) {
+                        ehs.fill = params.hoverPaintStyle.stroke;
+                    }
+                }
+                var a = params.anchors ? params.anchors[index] :
+                        params.anchor ? params.anchor :
+                            _makeAnchor(_jsPlumb.Defaults.Anchors[index], elementId, _jsPlumb) ||
+                            _makeAnchor(_jp.Defaults.Anchors[index], elementId, _jsPlumb) ||
+                            _makeAnchor(_jsPlumb.Defaults.Anchor, elementId, _jsPlumb) ||
+                            _makeAnchor(_jp.Defaults.Anchor, elementId, _jsPlumb),
+                    u = params.uuids ? params.uuids[index] : null;
+
+                e = _newEndpoint({
+                    paintStyle: es, hoverPaintStyle: ehs, endpoint: ep, connections: [ conn ],
+                    uuid: u, anchor: a, source: element, scope: params.scope,
+                    reattach: params.reattach || _jsPlumb.Defaults.ReattachConnections,
+                    detachable: params.detachable || _jsPlumb.Defaults.ConnectionsDetachable
+                });
+                if (existing == null) {
+                    e.setDeleteOnEmpty(true);
+                }
+                conn.endpoints[index] = e;
+
+                if (params.drawEndpoints === false) {
+                    e.setVisible(false, true, true);
+                }
+
+            }
+            return e;
+        }
+
+    }); // END Connection class            
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb Community Edition
+ * 
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ * 
+ * This file contains the code for creating and manipulating anchors.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ * 
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+    "use strict";
+
+    var root = this,
+        _ju = root.jsPlumbUtil,
+        _jp = root.jsPlumb;
+
+    //
+    // manages anchors for all elements.
+    //
+    _jp.AnchorManager = function (params) {
+        var _amEndpoints = {},
+            continuousAnchorLocations = {},
+            userDefinedContinuousAnchorLocations = {},
+            continuousAnchorOrientations = {},
+            Orientation = { HORIZONTAL: "horizontal", VERTICAL: "vertical", DIAGONAL: "diagonal", IDENTITY: "identity" },
+            axes = ["left", "top", "right", "bottom"],
+            connectionsByElementId = {},
+            self = this,
+            anchorLists = {},
+            jsPlumbInstance = params.jsPlumbInstance,
+            floatingConnections = {},
+            calculateOrientation = function (sourceId, targetId, sd, td, sourceAnchor, targetAnchor) {
+
+                if (sourceId === targetId) {
+                    return {
+                        orientation: Orientation.IDENTITY,
+                        a: ["top", "top"]
+                    };
+                }
+
+                var theta = Math.atan2((td.centery - sd.centery), (td.centerx - sd.centerx)),
+                    theta2 = Math.atan2((sd.centery - td.centery), (sd.centerx - td.centerx));
+
+// --------------------------------------------------------------------------------------
+
+                // improved face calculation. get midpoints of each face for source and target, then put in an array with all combinations of
+                // source/target faces. sort this array by distance between midpoints. the entry at index 0 is our preferred option. we can
+                // go through the array one by one until we find an entry in which each requested face is supported.
+                var candidates = [], midpoints = { };
+                (function (types, dim) {
+                    for (var i = 0; i < types.length; i++) {
+                        midpoints[types[i]] = {
+                            "left": [ dim[i].left, dim[i].centery ],
+                            "right": [ dim[i].right, dim[i].centery ],
+                            "top": [ dim[i].centerx, dim[i].top ],
+                            "bottom": [ dim[i].centerx , dim[i].bottom]
+                        };
+                    }
+                })([ "source", "target" ], [ sd, td ]);
+
+                for (var sf = 0; sf < axes.length; sf++) {
+                    for (var tf = 0; tf < axes.length; tf++) {
+                        candidates.push({
+                            source: axes[sf],
+                            target: axes[tf],
+                            dist: Biltong.lineLength(midpoints.source[axes[sf]], midpoints.target[axes[tf]])
+                        });
+                    }
+                }
+
+                candidates.sort(function (a, b) {
+                    return a.dist < b.dist ? -1 : a.dist > b.dist ? 1 : 0;
+                });
+
+                // now go through this list and try to get an entry that satisfies both (there will be one, unless one of the anchors
+                // declares no available faces)
+                var sourceEdge = candidates[0].source, targetEdge = candidates[0].target;
+                for (var i = 0; i < candidates.length; i++) {
+
+                    if (!sourceAnchor.isContinuous || sourceAnchor.isEdgeSupported(candidates[i].source)) {
+                        sourceEdge = candidates[i].source;
+                    }
+                    else {
+                        sourceEdge = null;
+                    }
+
+                    if (!targetAnchor.isContinuous || targetAnchor.isEdgeSupported(candidates[i].target)) {
+                        targetEdge = candidates[i].target;
+                    }
+                    else {
+                        targetEdge = null;
+                    }
+
+                    if (sourceEdge != null && targetEdge != null) {
+                        break;
+                    }
+                }
+
+// --------------------------------------------------------------------------------------
+
+                return {
+                    a: [ sourceEdge, targetEdge ],
+                    theta: theta,
+                    theta2: theta2
+                };
+            },
+        // used by placeAnchors function
+            placeAnchorsOnLine = function (desc, elementDimensions, elementPosition, connections, horizontal, otherMultiplier, reverse) {
+                var a = [], step = elementDimensions[horizontal ? 0 : 1] / (connections.length + 1);
+
+                for (var i = 0; i < connections.length; i++) {
+                    var val = (i + 1) * step, other = otherMultiplier * elementDimensions[horizontal ? 1 : 0];
+                    if (reverse) {
+                        val = elementDimensions[horizontal ? 0 : 1] - val;
+                    }
+
+                    var dx = (horizontal ? val : other), x = elementPosition[0] + dx, xp = dx / elementDimensions[0],
+                        dy = (horizontal ? other : val), y = elementPosition[1] + dy, yp = dy / elementDimensions[1];
+
+                    a.push([ x, y, xp, yp, connections[i][1], connections[i][2] ]);
+                }
+
+                return a;
+            },
+        // used by edgeSortFunctions
+            currySort = function (reverseAngles) {
+                return function (a, b) {
+                    var r = true;
+                    if (reverseAngles) {
+                        r = a[0][0] < b[0][0];
+                    }
+                    else {
+                        r = a[0][0] > b[0][0];
+                    }
+                    return r === false ? -1 : 1;
+                };
+            },
+        // used by edgeSortFunctions
+            leftSort = function (a, b) {
+                // first get adjusted values
+                var p1 = a[0][0] < 0 ? -Math.PI - a[0][0] : Math.PI - a[0][0],
+                    p2 = b[0][0] < 0 ? -Math.PI - b[0][0] : Math.PI - b[0][0];
+                if (p1 > p2) {
+                    return 1;
+                }
+                else {
+                    return -1;
+                }
+            },
+        // used by placeAnchors
+            edgeSortFunctions = {
+                "top": function (a, b) {
+                    return a[0] > b[0] ? 1 : -1;
+                },
+                "right": currySort(true),
+                "bottom": currySort(true),
+                "left": leftSort
+            },
+        // used by placeAnchors
+            _sortHelper = function (_array, _fn) {
+                return _array.sort(_fn);
+            },
+        // used by AnchorManager.redraw
+            placeAnchors = function (elementId, _anchorLists) {
+                var cd = jsPlumbInstance.getCachedData(elementId), sS = cd.s, sO = cd.o,
+                    placeSomeAnchors = function (desc, elementDimensions, elementPosition, unsortedConnections, isHorizontal, otherMultiplier, orientation) {
+                        if (unsortedConnections.length > 0) {
+                            var sc = _sortHelper(unsortedConnections, edgeSortFunctions[desc]), // puts them in order based on the target element's pos on screen
+                                reverse = desc === "right" || desc === "top",
+                                anchors = placeAnchorsOnLine(desc, elementDimensions,
+                                    elementPosition, sc,
+                                    isHorizontal, otherMultiplier, reverse);
+
+                            // takes a computed anchor position and adjusts it for parent offset and scroll, then stores it.
+                            var _setAnchorLocation = function (endpoint, anchorPos) {
+                                continuousAnchorLocations[endpoint.id] = [ anchorPos[0], anchorPos[1], anchorPos[2], anchorPos[3] ];
+                                continuousAnchorOrientations[endpoint.id] = orientation;
+                            };
+
+                            for (var i = 0; i < anchors.length; i++) {
+                                var c = anchors[i][4], weAreSource = c.endpoints[0].elementId === elementId, weAreTarget = c.endpoints[1].elementId === elementId;
+                                if (weAreSource) {
+                                    _setAnchorLocation(c.endpoints[0], anchors[i]);
+                                }
+                                if (weAreTarget) {
+                                    _setAnchorLocation(c.endpoints[1], anchors[i]);
+                                }
+                            }
+                        }
+                    };
+
+                placeSomeAnchors("bottom", sS, [sO.left, sO.top], _anchorLists.bottom, true, 1, [0, 1]);
+                placeSomeAnchors("top", sS, [sO.left, sO.top], _anchorLists.top, true, 0, [0, -1]);
+                placeSomeAnchors("left", sS, [sO.left, sO.top], _anchorLists.left, false, 0, [-1, 0]);
+                placeSomeAnchors("right", sS, [sO.left, sO.top], _anchorLists.right, false, 1, [1, 0]);
+            };
+
+        this.reset = function () {
+            _amEndpoints = {};
+            connectionsByElementId = {};
+            anchorLists = {};
+        };
+        this.addFloatingConnection = function (key, conn) {
+            floatingConnections[key] = conn;
+        };
+        this.removeFloatingConnection = function (key) {
+            delete floatingConnections[key];
+        };
+        this.newConnection = function (conn) {
+            var sourceId = conn.sourceId, targetId = conn.targetId,
+                ep = conn.endpoints,
+                doRegisterTarget = true,
+                registerConnection = function (otherIndex, otherEndpoint, otherAnchor, elId, c) {
+                    if ((sourceId === targetId) && otherAnchor.isContinuous) {
+                        // remove the target endpoint's canvas.  we dont need it.
+                        conn._jsPlumb.instance.removeElement(ep[1].canvas);
+                        doRegisterTarget = false;
+                    }
+                    _ju.addToList(connectionsByElementId, elId, [c, otherEndpoint, otherAnchor.constructor === _jp.DynamicAnchor]);
+                };
+
+            registerConnection(0, ep[0], ep[0].anchor, targetId, conn);
+            if (doRegisterTarget) {
+                registerConnection(1, ep[1], ep[1].anchor, sourceId, conn);
+            }
+        };
+        var removeEndpointFromAnchorLists = function (endpoint) {
+            (function (list, eId) {
+                if (list) {  // transient anchors dont get entries in this list.
+                    var f = function (e) {
+                        return e[4] === eId;
+                    };
+                    _ju.removeWithFunction(list.top, f);
+                    _ju.removeWithFunction(list.left, f);
+                    _ju.removeWithFunction(list.bottom, f);
+                    _ju.removeWithFunction(list.right, f);
+                }
+            })(anchorLists[endpoint.elementId], endpoint.id);
+        };
+        this.connectionDetached = function (connInfo, doNotRedraw) {
+            var connection = connInfo.connection || connInfo,
+                sourceId = connInfo.sourceId,
+                targetId = connInfo.targetId,
+                ep = connection.endpoints,
+                removeConnection = function (otherIndex, otherEndpoint, otherAnchor, elId, c) {
+                   _ju.removeWithFunction(connectionsByElementId[elId], function (_c) {
+                        return _c[0].id === c.id;
+                    });
+                };
+
+            removeConnection(1, ep[1], ep[1].anchor, sourceId, connection);
+            removeConnection(0, ep[0], ep[0].anchor, targetId, connection);
+            if (connection.floatingId) {
+                removeConnection(connection.floatingIndex, connection.floatingEndpoint, connection.floatingEndpoint.anchor, connection.floatingId, connection);
+                removeEndpointFromAnchorLists(connection.floatingEndpoint);
+            }
+
+            // remove from anchorLists            
+            removeEndpointFromAnchorLists(connection.endpoints[0]);
+            removeEndpointFromAnchorLists(connection.endpoints[1]);
+
+            if (!doNotRedraw) {
+                self.redraw(connection.sourceId);
+                if (connection.targetId !== connection.sourceId) {
+                    self.redraw(connection.targetId);
+                }
+            }
+        };
+        this.add = function (endpoint, elementId) {
+            _ju.addToList(_amEndpoints, elementId, endpoint);
+        };
+        this.changeId = function (oldId, newId) {
+            connectionsByElementId[newId] = connectionsByElementId[oldId];
+            _amEndpoints[newId] = _amEndpoints[oldId];
+            delete connectionsByElementId[oldId];
+            delete _amEndpoints[oldId];
+        };
+        this.getConnectionsFor = function (elementId) {
+            return connectionsByElementId[elementId] || [];
+        };
+        this.getEndpointsFor = function (elementId) {
+            return _amEndpoints[elementId] || [];
+        };
+        this.deleteEndpoint = function (endpoint) {
+            _ju.removeWithFunction(_amEndpoints[endpoint.elementId], function (e) {
+                return e.id === endpoint.id;
+            });
+            removeEndpointFromAnchorLists(endpoint);
+        };
+        this.clearFor = function (elementId) {
+            delete _amEndpoints[elementId];
+            _amEndpoints[elementId] = [];
+        };
+        // updates the given anchor list by either updating an existing anchor's info, or adding it. this function
+        // also removes the anchor from its previous list, if the edge it is on has changed.
+        // all connections found along the way (those that are connected to one of the faces this function
+        // operates on) are added to the connsToPaint list, as are their endpoints. in this way we know to repaint
+        // them wthout having to calculate anything else about them.
+        var _updateAnchorList = function (lists, theta, order, conn, aBoolean, otherElId, idx, reverse, edgeId, elId, connsToPaint, endpointsToPaint) {
+            // first try to find the exact match, but keep track of the first index of a matching element id along the way.s
+            var exactIdx = -1,
+                firstMatchingElIdx = -1,
+                endpoint = conn.endpoints[idx],
+                endpointId = endpoint.id,
+                oIdx = [1, 0][idx],
+                values = [
+                    [ theta, order ],
+                    conn,
+                    aBoolean,
+                    otherElId,
+                    endpointId
+                ],
+                listToAddTo = lists[edgeId],
+                listToRemoveFrom = endpoint._continuousAnchorEdge ? lists[endpoint._continuousAnchorEdge] : null,
+                i,
+                candidate;
+
+            if (listToRemoveFrom) {
+                var rIdx = _ju.findWithFunction(listToRemoveFrom, function (e) {
+                    return e[4] === endpointId;
+                });
+                if (rIdx !== -1) {
+                    listToRemoveFrom.splice(rIdx, 1);
+                    // get all connections from this list
+                    for (i = 0; i < listToRemoveFrom.length; i++) {
+                        candidate = listToRemoveFrom[i][1];
+                        _ju.addWithFunction(connsToPaint, candidate, function (c) {
+                            return c.id === candidate.id;
+                        });
+                        _ju.addWithFunction(endpointsToPaint, listToRemoveFrom[i][1].endpoints[idx], function (e) {
+                            return e.id === candidate.endpoints[idx].id;
+                        });
+                        _ju.addWithFunction(endpointsToPaint, listToRemoveFrom[i][1].endpoints[oIdx], function (e) {
+                            return e.id === candidate.endpoints[oIdx].id;
+                        });
+                    }
+                }
+            }
+
+            for (i = 0; i < listToAddTo.length; i++) {
+                candidate = listToAddTo[i][1];
+                if (params.idx === 1 && listToAddTo[i][3] === otherElId && firstMatchingElIdx === -1) {
+                    firstMatchingElIdx = i;
+                }
+                _ju.addWithFunction(connsToPaint, candidate, function (c) {
+                    return c.id === candidate.id;
+                });
+                _ju.addWithFunction(endpointsToPaint, listToAddTo[i][1].endpoints[idx], function (e) {
+                    return e.id === candidate.endpoints[idx].id;
+                });
+                _ju.addWithFunction(endpointsToPaint, listToAddTo[i][1].endpoints[oIdx], function (e) {
+                    return e.id === candidate.endpoints[oIdx].id;
+                });
+            }
+            if (exactIdx !== -1) {
+                listToAddTo[exactIdx] = values;
+            }
+            else {
+                var insertIdx = reverse ? firstMatchingElIdx !== -1 ? firstMatchingElIdx : 0 : listToAddTo.length; // of course we will get this from having looked through the array shortly.
+                listToAddTo.splice(insertIdx, 0, values);
+            }
+
+            // store this for next time.
+            endpoint._continuousAnchorEdge = edgeId;
+        };
+
+        //
+        // find the entry in an endpoint's list for this connection and update its target endpoint
+        // with the current target in the connection.
+        // This method and sourceChanged need to be folder into one.
+        //
+        this.updateOtherEndpoint = function (sourceElId, oldTargetId, newTargetId, connection) {
+            var sIndex = _ju.findWithFunction(connectionsByElementId[sourceElId], function (i) {
+                    return i[0].id === connection.id;
+                }),
+                tIndex = _ju.findWithFunction(connectionsByElementId[oldTargetId], function (i) {
+                    return i[0].id === connection.id;
+                });
+
+            // update or add data for source
+            if (sIndex !== -1) {
+                connectionsByElementId[sourceElId][sIndex][0] = connection;
+                connectionsByElementId[sourceElId][sIndex][1] = connection.endpoints[1];
+                connectionsByElementId[sourceElId][sIndex][2] = connection.endpoints[1].anchor.constructor === _jp.DynamicAnchor;
+            }
+
+            // remove entry for previous target (if there)
+            if (tIndex > -1) {
+                connectionsByElementId[oldTargetId].splice(tIndex, 1);
+                // add entry for new target
+                _ju.addToList(connectionsByElementId, newTargetId, [connection, connection.endpoints[0], connection.endpoints[0].anchor.constructor === _jp.DynamicAnchor]);
+            }
+
+            connection.updateConnectedClass();
+        };
+
+        //
+        // notification that the connection given has changed source from the originalId to the newId.
+        // This involves:
+        // 1. removing the connection from the list of connections stored for the originalId
+        // 2. updating the source information for the target of the connection
+        // 3. re-registering the connection in connectionsByElementId with the newId
+        //
+        this.sourceChanged = function (originalId, newId, connection, newElement) {
+            if (originalId !== newId) {
+
+                connection.sourceId = newId;
+                connection.source = newElement;
+
+                // remove the entry that points from the old source to the target
+                _ju.removeWithFunction(connectionsByElementId[originalId], function (info) {
+                    return info[0].id === connection.id;
+                });
+                // find entry for target and update it
+                var tIdx = _ju.findWithFunction(connectionsByElementId[connection.targetId], function (i) {
+                    return i[0].id === connection.id;
+                });
+                if (tIdx > -1) {
+                    connectionsByElementId[connection.targetId][tIdx][0] = connection;
+                    connectionsByElementId[connection.targetId][tIdx][1] = connection.endpoints[0];
+                    connectionsByElementId[connection.targetId][tIdx][2] = connection.endpoints[0].anchor.constructor === _jp.DynamicAnchor;
+                }
+                // add entry for new source
+                _ju.addToList(connectionsByElementId, newId, [connection, connection.endpoints[1], connection.endpoints[1].anchor.constructor === _jp.DynamicAnchor]);
+
+                // TODO SP not final on this yet. when a user drags an existing connection and it turns into a self
+                // loop, then this code hides the target endpoint (by removing it from the DOM) But I think this should
+                // occur only if the anchor is Continuous
+                if (connection.endpoints[1].anchor.isContinuous) {
+                    if (connection.source === connection.target) {
+                        connection._jsPlumb.instance.removeElement(connection.endpoints[1].canvas);
+                    }
+                    else {
+                        if (connection.endpoints[1].canvas.parentNode == null) {
+                            connection._jsPlumb.instance.appendElement(connection.endpoints[1].canvas);
+                        }
+                    }
+                }
+
+                connection.updateConnectedClass();
+            }
+        };
+
+        //
+        // moves the given endpoint from `currentId` to `element`.
+        // This involves:
+        //
+        // 1. changing the key in _amEndpoints under which the endpoint is stored
+        // 2. changing the source or target values in all of the endpoint's connections
+        // 3. changing the array in connectionsByElementId in which the endpoint's connections
+        //    are stored (done by either sourceChanged or updateOtherEndpoint)
+        //
+        this.rehomeEndpoint = function (ep, currentId, element) {
+            var eps = _amEndpoints[currentId] || [],
+                elementId = jsPlumbInstance.getId(element);
+
+            if (elementId !== currentId) {
+                var idx = eps.indexOf(ep);
+                if (idx > -1) {
+                    var _ep = eps.splice(idx, 1)[0];
+                    self.add(_ep, elementId);
+                }
+            }
+
+            for (var i = 0; i < ep.connections.length; i++) {
+                if (ep.connections[i].sourceId === currentId) {
+                    self.sourceChanged(currentId, ep.elementId, ep.connections[i], ep.element);
+                }
+                else if (ep.connections[i].targetId === currentId) {
+                    ep.connections[i].targetId = ep.elementId;
+                    ep.connections[i].target = ep.element;
+                    self.updateOtherEndpoint(ep.connections[i].sourceId, currentId, ep.elementId, ep.connections[i]);
+                }
+            }
+        };
+
+        this.redraw = function (elementId, ui, timestamp, offsetToUI, clearEdits, doNotRecalcEndpoint) {
+
+            if (!jsPlumbInstance.isSuspendDrawing()) {
+                // get all the endpoints for this element
+                var ep = _amEndpoints[elementId] || [],
+                    endpointConnections = connectionsByElementId[elementId] || [],
+                    connectionsToPaint = [],
+                    endpointsToPaint = [],
+                    anchorsToUpdate = [];
+
+                timestamp = timestamp || jsPlumbInstance.timestamp();
+                // offsetToUI are values that would have been calculated in the dragManager when registering
+                // an endpoint for an element that had a parent (somewhere in the hierarchy) that had been
+                // registered as draggable.
+                offsetToUI = offsetToUI || {left: 0, top: 0};
+                if (ui) {
+                    ui = {
+                        left: ui.left + offsetToUI.left,
+                        top: ui.top + offsetToUI.top
+                    };
+                }
+
+                // valid for one paint cycle.
+                var myOffset = jsPlumbInstance.updateOffset({ elId: elementId, offset: ui, recalc: false, timestamp: timestamp }),
+                    orientationCache = {};
+
+                // actually, first we should compute the orientation of this element to all other elements to which
+                // this element is connected with a continuous anchor (whether both ends of the connection have
+                // a continuous anchor or just one)
+
+                for (var i = 0; i < endpointConnections.length; i++) {
+                    var conn = endpointConnections[i][0],
+                        sourceId = conn.sourceId,
+                        targetId = conn.targetId,
+                        sourceContinuous = conn.endpoints[0].anchor.isContinuous,
+                        targetContinuous = conn.endpoints[1].anchor.isContinuous;
+
+                    if (sourceContinuous || targetContinuous) {
+                        var oKey = sourceId + "_" + targetId,
+                            o = orientationCache[oKey],
+                            oIdx = conn.sourceId === elementId ? 1 : 0;
+
+                        if (sourceContinuous && !anchorLists[sourceId]) {
+                            anchorLists[sourceId] = { top: [], right: [], bottom: [], left: [] };
+                        }
+                        if (targetContinuous && !anchorLists[targetId]) {
+                            anchorLists[targetId] = { top: [], right: [], bottom: [], left: [] };
+                        }
+
+                        if (elementId !== targetId) {
+                            jsPlumbInstance.updateOffset({ elId: targetId, timestamp: timestamp });
+                        }
+                        if (elementId !== sourceId) {
+                            jsPlumbInstance.updateOffset({ elId: sourceId, timestamp: timestamp });
+                        }
+
+                        var td = jsPlumbInstance.getCachedData(targetId),
+                            sd = jsPlumbInstance.getCachedData(sourceId);
+
+                        if (targetId === sourceId && (sourceContinuous || targetContinuous)) {
+                            // here we may want to improve this by somehow determining the face we'd like
+                            // to put the connector on.  ideally, when drawing, the face should be calculated
+                            // by determining which face is closest to the point at which the mouse button
+                            // was released.  for now, we're putting it on the top face.
+                            _updateAnchorList( anchorLists[sourceId], -Math.PI / 2, 0, conn, false, targetId, 0, false, "top", sourceId, connectionsToPaint, endpointsToPaint);
+                            _updateAnchorList( anchorLists[targetId], -Math.PI / 2, 0, conn, false, sourceId, 1, false, "top", targetId, connectionsToPaint, endpointsToPaint);
+                        }
+                        else {
+                            if (!o) {
+                                o = calculateOrientation(sourceId, targetId, sd.o, td.o, conn.endpoints[0].anchor, conn.endpoints[1].anchor);
+                                orientationCache[oKey] = o;
+                                // this would be a performance enhancement, but the computed angles need to be clamped to
+                                //the (-PI/2 -> PI/2) range in order for the sorting to work properly.
+                                /*  orientationCache[oKey2] = {
+                                 orientation:o.orientation,
+                                 a:[o.a[1], o.a[0]],
+                                 theta:o.theta + Math.PI,
+                                 theta2:o.theta2 + Math.PI
+                                 };*/
+                            }
+                            if (sourceContinuous) {
+                                _updateAnchorList(anchorLists[sourceId], o.theta, 0, conn, false, targetId, 0, false, o.a[0], sourceId, connectionsToPaint, endpointsToPaint);
+                            }
+                            if (targetContinuous) {
+                                _updateAnchorList(anchorLists[targetId], o.theta2, -1, conn, true, sourceId, 1, true, o.a[1], targetId, connectionsToPaint, endpointsToPaint);
+                            }
+                        }
+
+                        if (sourceContinuous) {
+                            _ju.addWithFunction(anchorsToUpdate, sourceId, function (a) {
+                                return a === sourceId;
+                            });
+                        }
+                        if (targetContinuous) {
+                            _ju.addWithFunction(anchorsToUpdate, targetId, function (a) {
+                                return a === targetId;
+                            });
+                        }
+                        _ju.addWithFunction(connectionsToPaint, conn, function (c) {
+                            return c.id === conn.id;
+                        });
+                        if ((sourceContinuous && oIdx === 0) || (targetContinuous && oIdx === 1)) {
+                            _ju.addWithFunction(endpointsToPaint, conn.endpoints[oIdx], function (e) {
+                                return e.id === conn.endpoints[oIdx].id;
+                            });
+                        }
+                    }
+                }
+
+                // place Endpoints whose anchors are continuous but have no Connections
+                for (i = 0; i < ep.length; i++) {
+                    if (ep[i].connections.length === 0 && ep[i].anchor.isContinuous) {
+                        if (!anchorLists[elementId]) {
+                            anchorLists[elementId] = { top: [], right: [], bottom: [], left: [] };
+                        }
+                        _updateAnchorList(anchorLists[elementId], -Math.PI / 2, 0, {endpoints: [ep[i], ep[i]], paint: function () {
+                        }}, false, elementId, 0, false, ep[i].anchor.getDefaultFace(), elementId, connectionsToPaint, endpointsToPaint);
+                        _ju.addWithFunction(anchorsToUpdate, elementId, function (a) {
+                            return a === elementId;
+                        });
+                    }
+                }
+
+                // now place all the continuous anchors we need to;
+                for (i = 0; i < anchorsToUpdate.length; i++) {
+                    placeAnchors(anchorsToUpdate[i], anchorLists[anchorsToUpdate[i]]);
+                }
+
+                // now that continuous anchors have been placed, paint all the endpoints for this element
+                // TODO performance: add the endpoint ids to a temp array, and then when iterating in the next
+                // loop, check that we didn't just paint that endpoint. we can probably shave off a few more milliseconds this way.
+                for (i = 0; i < ep.length; i++) {
+                    ep[i].paint({ timestamp: timestamp, offset: myOffset, dimensions: myOffset.s, recalc: doNotRecalcEndpoint !== true });
+                }
+
+                // ... and any other endpoints we came across as a result of the continuous anchors.
+                for (i = 0; i < endpointsToPaint.length; i++) {
+                    var cd = jsPlumbInstance.getCachedData(endpointsToPaint[i].elementId);
+                    endpointsToPaint[i].paint({ timestamp: timestamp, offset: cd, dimensions: cd.s });
+                }
+
+                // paint all the standard and "dynamic connections", which are connections whose other anchor is
+                // static and therefore does need to be recomputed; we make sure that happens only one time.
+
+                // TODO we could have compiled a list of these in the first pass through connections; might save some time.
+                for (i = 0; i < endpointConnections.length; i++) {
+                    var otherEndpoint = endpointConnections[i][1];
+                    if (otherEndpoint.anchor.constructor === _jp.DynamicAnchor) {
+                        otherEndpoint.paint({ elementWithPrecedence: elementId, timestamp: timestamp });
+                        _ju.addWithFunction(connectionsToPaint, endpointConnections[i][0], function (c) {
+                            return c.id === endpointConnections[i][0].id;
+                        });
+                        // all the connections for the other endpoint now need to be repainted
+                        for (var k = 0; k < otherEndpoint.connections.length; k++) {
+                            if (otherEndpoint.connections[k] !== endpointConnections[i][0]) {
+                                _ju.addWithFunction(connectionsToPaint, otherEndpoint.connections[k], function (c) {
+                                    return c.id === otherEndpoint.connections[k].id;
+                                });
+                            }
+                        }
+                    } else if (otherEndpoint.anchor.constructor === _jp.Anchor) {
+                        _ju.addWithFunction(connectionsToPaint, endpointConnections[i][0], function (c) {
+                            return c.id === endpointConnections[i][0].id;
+                        });
+                    }
+                }
+
+                // paint current floating connection for this element, if there is one.
+                var fc = floatingConnections[elementId];
+                if (fc) {
+                    fc.paint({timestamp: timestamp, recalc: false, elId: elementId});
+                }
+
+                // paint all the connections
+                for (i = 0; i < connectionsToPaint.length; i++) {
+                    connectionsToPaint[i].paint({elId: elementId, timestamp: timestamp, recalc: false, clearEdits: clearEdits});
+                }
+            }
+        };
+
+        var ContinuousAnchor = function (anchorParams) {
+            _ju.EventGenerator.apply(this);
+            this.type = "Continuous";
+            this.isDynamic = true;
+            this.isContinuous = true;
+            var faces = anchorParams.faces || ["top", "right", "bottom", "left"],
+                clockwise = !(anchorParams.clockwise === false),
+                availableFaces = { },
+                opposites = { "top": "bottom", "right": "left", "left": "right", "bottom": "top" },
+                clockwiseOptions = { "top": "right", "right": "bottom", "left": "top", "bottom": "left" },
+                antiClockwiseOptions = { "top": "left", "right": "top", "left": "bottom", "bottom": "right" },
+                secondBest = clockwise ? clockwiseOptions : antiClockwiseOptions,
+                lastChoice = clockwise ? antiClockwiseOptions : clockwiseOptions,
+                cssClass = anchorParams.cssClass || "";
+
+            for (var i = 0; i < faces.length; i++) {
+                availableFaces[faces[i]] = true;
+            }
+
+            this.getDefaultFace = function () {
+                return faces.length === 0 ? "top" : faces[0];
+            };
+
+            // if the given edge is supported, returns it. otherwise looks for a substitute that _is_
+            // supported. if none supported we also return the request edge.
+            this.verifyEdge = function (edge) {
+                if (availableFaces[edge]) {
+                    return edge;
+                }
+                else if (availableFaces[opposites[edge]]) {
+                    return opposites[edge];
+                }
+                else if (availableFaces[secondBest[edge]]) {
+                    return secondBest[edge];
+                }
+                else if (availableFaces[lastChoice[edge]]) {
+                    return lastChoice[edge];
+                }
+                return edge; // we have to give them something.
+            };
+
+            this.isEdgeSupported = function (edge) {
+                return availableFaces[edge] === true;
+            };
+
+            this.compute = function (params) {
+                return userDefinedContinuousAnchorLocations[params.element.id] || continuousAnchorLocations[params.element.id] || [0, 0];
+            };
+            this.getCurrentLocation = function (params) {
+                return userDefinedContinuousAnchorLocations[params.element.id] || continuousAnchorLocations[params.element.id] || [0, 0];
+            };
+            this.getOrientation = function (endpoint) {
+                return continuousAnchorOrientations[endpoint.id] || [0, 0];
+            };
+            this.clearUserDefinedLocation = function () {
+                delete userDefinedContinuousAnchorLocations[anchorParams.elementId];
+            };
+            this.setUserDefinedLocation = function (loc) {
+                userDefinedContinuousAnchorLocations[anchorParams.elementId] = loc;
+            };
+            this.getCssClass = function () {
+                return cssClass;
+            };
+        };
+
+        // continuous anchors
+        jsPlumbInstance.continuousAnchorFactory = {
+            get: function (params) {
+                return new ContinuousAnchor(params);
+            },
+            clear: function (elementId) {
+                delete userDefinedContinuousAnchorLocations[elementId];
+                delete continuousAnchorLocations[elementId];
+            }
+        };
+    };
+
+    /**
+     * Anchors model a position on some element at which an Endpoint may be located.  They began as a first class citizen of jsPlumb, ie. a user
+     * was required to create these themselves, but over time this has been replaced by the concept of referring to them either by name (eg. "TopMiddle"),
+     * or by an array describing their coordinates (eg. [ 0, 0.5, 0, -1 ], which is the same as "TopMiddle").  jsPlumb now handles all of the
+     * creation of Anchors without user intervention.
+     */
+    _jp.Anchor = function (params) {
+        this.x = params.x || 0;
+        this.y = params.y || 0;
+        this.elementId = params.elementId;
+        this.cssClass = params.cssClass || "";
+        this.userDefinedLocation = null;
+        this.orientation = params.orientation || [ 0, 0 ];
+        this.lastReturnValue = null;
+        this.offsets = params.offsets || [ 0, 0 ];
+        this.timestamp = null;
+
+        _ju.EventGenerator.apply(this);
+
+        this.compute = function (params) {
+
+            var xy = params.xy, wh = params.wh, timestamp = params.timestamp;
+
+            if (params.clearUserDefinedLocation) {
+                this.userDefinedLocation = null;
+            }
+
+            if (timestamp && timestamp === this.timestamp) {
+                return this.lastReturnValue;
+            }
+
+            if (this.userDefinedLocation != null) {
+                this.lastReturnValue = this.userDefinedLocation;
+            }
+            else {
+                this.lastReturnValue = [ xy[0] + (this.x * wh[0]) + this.offsets[0], xy[1] + (this.y * wh[1]) + this.offsets[1] ];
+            }
+
+            this.timestamp = timestamp;
+            return this.lastReturnValue;
+        };
+
+        this.getCurrentLocation = function (params) {
+            params = params || {};
+            return (this.lastReturnValue == null || (params.timestamp != null && this.timestamp !== params.timestamp)) ? this.compute(params) : this.lastReturnValue;
+        };
+    };
+    _ju.extend(_jp.Anchor, _ju.EventGenerator, {
+        equals: function (anchor) {
+            if (!anchor) {
+                return false;
+            }
+            var ao = anchor.getOrientation(),
+                o = this.getOrientation();
+            return this.x === anchor.x && this.y === anchor.y && this.offsets[0] === anchor.offsets[0] && this.offsets[1] === anchor.offsets[1] && o[0] === ao[0] && o[1] === ao[1];
+        },
+        getUserDefinedLocation: function () {
+            return this.userDefinedLocation;
+        },
+        setUserDefinedLocation: function (l) {
+            this.userDefinedLocation = l;
+        },
+        clearUserDefinedLocation: function () {
+            this.userDefinedLocation = null;
+        },
+        getOrientation: function () {
+            return this.orientation;
+        },
+        getCssClass: function () {
+            return this.cssClass;
+        }
+    });
+
+    /**
+     * An Anchor that floats. its orientation is computed dynamically from
+     * its position relative to the anchor it is floating relative to.  It is used when creating
+     * a connection through drag and drop.
+     *
+     * TODO FloatingAnchor could totally be refactored to extend Anchor just slightly.
+     */
+    _jp.FloatingAnchor = function (params) {
+
+        _jp.Anchor.apply(this, arguments);
+
+        // this is the anchor that this floating anchor is referenced to for
+        // purposes of calculating the orientation.
+        var ref = params.reference,
+            // the canvas this refers to.
+            refCanvas = params.referenceCanvas,
+            size = _jp.getSize(refCanvas),
+            // these are used to store the current relative position of our
+            // anchor wrt the reference anchor. they only indicate
+            // direction, so have a value of 1 or -1 (or, very rarely, 0). these
+            // values are written by the compute method, and read
+            // by the getOrientation method.
+            xDir = 0, yDir = 0,
+            // temporary member used to store an orientation when the floating
+            // anchor is hovering over another anchor.
+            orientation = null,
+            _lastResult = null;
+
+        // clear from parent. we want floating anchor orientation to always be computed.
+        this.orientation = null;
+
+        // set these to 0 each; they are used by certain types of connectors in the loopback case,
+        // when the connector is trying to clear the element it is on. but for floating anchor it's not
+        // very important.
+        this.x = 0;
+        this.y = 0;
+
+        this.isFloating = true;
+
+        this.compute = function (params) {
+            var xy = params.xy,
+                result = [ xy[0] + (size[0] / 2), xy[1] + (size[1] / 2) ]; // return origin of the element. we may wish to improve this so that any object can be the drag proxy.
+            _lastResult = result;
+            return result;
+        };
+
+        this.getOrientation = function (_endpoint) {
+            if (orientation) {
+                return orientation;
+            }
+            else {
+                var o = ref.getOrientation(_endpoint);
+                // here we take into account the orientation of the other
+                // anchor: if it declares zero for some direction, we declare zero too. this might not be the most awesome. perhaps we can come
+                // up with a better way. it's just so that the line we draw looks like it makes sense. maybe this wont make sense.
+                return [ Math.abs(o[0]) * xDir * -1,
+                        Math.abs(o[1]) * yDir * -1 ];
+            }
+        };
+
+        /**
+         * notification the endpoint associated with this anchor is hovering
+         * over another anchor; we want to assume that anchor's orientation
+         * for the duration of the hover.
+         */
+        this.over = function (anchor, endpoint) {
+            orientation = anchor.getOrientation(endpoint);
+        };
+
+        /**
+         * notification the endpoint associated with this anchor is no
+         * longer hovering over another anchor; we should resume calculating
+         * orientation as we normally do.
+         */
+        this.out = function () {
+            orientation = null;
+        };
+
+        this.getCurrentLocation = function (params) {
+            return _lastResult == null ? this.compute(params) : _lastResult;
+        };
+    };
+    _ju.extend(_jp.FloatingAnchor, _jp.Anchor);
+
+    var _convertAnchor = function (anchor, jsPlumbInstance, elementId) {
+        return anchor.constructor === _jp.Anchor ? anchor : jsPlumbInstance.makeAnchor(anchor, elementId, jsPlumbInstance);
+    };
+
+    /* 
+     * A DynamicAnchor is an Anchor that contains a list of other Anchors, which it cycles
+     * through at compute time to find the one that is located closest to
+     * the center of the target element, and returns that Anchor's compute
+     * method result. this causes endpoints to follow each other with
+     * respect to the orientation of their target elements, which is a useful
+     * feature for some applications.
+     * 
+     */
+    _jp.DynamicAnchor = function (params) {
+        _jp.Anchor.apply(this, arguments);
+
+        this.isDynamic = true;
+        this.anchors = [];
+        this.elementId = params.elementId;
+        this.jsPlumbInstance = params.jsPlumbInstance;
+
+        for (var i = 0; i < params.anchors.length; i++) {
+            this.anchors[i] = _convertAnchor(params.anchors[i], this.jsPlumbInstance, this.elementId);
+        }
+
+        this.getAnchors = function () {
+            return this.anchors;
+        };
+        this.locked = false;
+        var _curAnchor = this.anchors.length > 0 ? this.anchors[0] : null,
+            _lastAnchor = _curAnchor,
+            self = this,
+
+        // helper method to calculate the distance between the centers of the two elements.
+            _distance = function (anchor, cx, cy, xy, wh) {
+                var ax = xy[0] + (anchor.x * wh[0]), ay = xy[1] + (anchor.y * wh[1]),
+                    acx = xy[0] + (wh[0] / 2), acy = xy[1] + (wh[1] / 2);
+                return (Math.sqrt(Math.pow(cx - ax, 2) + Math.pow(cy - ay, 2)) +
+                    Math.sqrt(Math.pow(acx - ax, 2) + Math.pow(acy - ay, 2)));
+            },
+        // default method uses distance between element centers.  you can provide your own method in the dynamic anchor
+        // constructor (and also to jsPlumb.makeDynamicAnchor). the arguments to it are four arrays:
+        // xy - xy loc of the anchor's element
+        // wh - anchor's element's dimensions
+        // txy - xy loc of the element of the other anchor in the connection
+        // twh - dimensions of the element of the other anchor in the connection.
+        // anchors - the list of selectable anchors
+            _anchorSelector = params.selector || function (xy, wh, txy, twh, anchors) {
+                var cx = txy[0] + (twh[0] / 2), cy = txy[1] + (twh[1] / 2);
+                var minIdx = -1, minDist = Infinity;
+                for (var i = 0; i < anchors.length; i++) {
+                    var d = _distance(anchors[i], cx, cy, xy, wh);
+                    if (d < minDist) {
+                        minIdx = i + 0;
+                        minDist = d;
+                    }
+                }
+                return anchors[minIdx];
+            };
+
+        this.compute = function (params) {
+            var xy = params.xy, wh = params.wh, txy = params.txy, twh = params.twh;
+
+            this.timestamp = params.timestamp;
+
+            var udl = self.getUserDefinedLocation();
+            if (udl != null) {
+                return udl;
+            }
+
+            // if anchor is locked or an opposite element was not given, we
+            // maintain our state. anchor will be locked
+            // if it is the source of a drag and drop.
+            if (this.locked || txy == null || twh == null) {
+                return _curAnchor.compute(params);
+            }
+            else {
+                params.timestamp = null; // otherwise clear this, i think. we want the anchor to compute.
+            }
+
+            _curAnchor = _anchorSelector(xy, wh, txy, twh, this.anchors);
+            this.x = _curAnchor.x;
+            this.y = _curAnchor.y;
+
+            if (_curAnchor !== _lastAnchor) {
+                this.fire("anchorChanged", _curAnchor);
+            }
+
+            _lastAnchor = _curAnchor;
+
+            return _curAnchor.compute(params);
+        };
+
+        this.getCurrentLocation = function (params) {
+            return this.getUserDefinedLocation() || (_curAnchor != null ? _curAnchor.getCurrentLocation(params) : null);
+        };
+
+        this.getOrientation = function (_endpoint) {
+            return _curAnchor != null ? _curAnchor.getOrientation(_endpoint) : [ 0, 0 ];
+        };
+        this.over = function (anchor, endpoint) {
+            if (_curAnchor != null) {
+                _curAnchor.over(anchor, endpoint);
+            }
+        };
+        this.out = function () {
+            if (_curAnchor != null) {
+                _curAnchor.out();
+            }
+        };
+
+        this.getCssClass = function () {
+            return (_curAnchor && _curAnchor.getCssClass()) || "";
+        };
+    };
+    _ju.extend(_jp.DynamicAnchor, _jp.Anchor);
+
+// -------- basic anchors ------------------    
+    var _curryAnchor = function (x, y, ox, oy, type, fnInit) {
+        _jp.Anchors[type] = function (params) {
+            var a = params.jsPlumbInstance.makeAnchor([ x, y, ox, oy, 0, 0 ], params.elementId, params.jsPlumbInstance);
+            a.type = type;
+            if (fnInit) {
+                fnInit(a, params);
+            }
+            return a;
+        };
+    };
+
+    _curryAnchor(0.5, 0, 0, -1, "TopCenter");
+    _curryAnchor(0.5, 1, 0, 1, "BottomCenter");
+    _curryAnchor(0, 0.5, -1, 0, "LeftMiddle");
+    _curryAnchor(1, 0.5, 1, 0, "RightMiddle");
+
+    _curryAnchor(0.5, 0, 0, -1, "Top");
+    _curryAnchor(0.5, 1, 0, 1, "Bottom");
+    _curryAnchor(0, 0.5, -1, 0, "Left");
+    _curryAnchor(1, 0.5, 1, 0, "Right");
+    _curryAnchor(0.5, 0.5, 0, 0, "Center");
+    _curryAnchor(1, 0, 0, -1, "TopRight");
+    _curryAnchor(1, 1, 0, 1, "BottomRight");
+    _curryAnchor(0, 0, 0, -1, "TopLeft");
+    _curryAnchor(0, 1, 0, 1, "BottomLeft");
+
+// ------- dynamic anchors -------------------    
+
+    // default dynamic anchors chooses from Top, Right, Bottom, Left
+    _jp.Defaults.DynamicAnchors = function (params) {
+        return params.jsPlumbInstance.makeAnchors(["TopCenter", "RightMiddle", "BottomCenter", "LeftMiddle"], params.elementId, params.jsPlumbInstance);
+    };
+
+    // default dynamic anchors bound to name 'AutoDefault'
+    _jp.Anchors.AutoDefault = function (params) {
+        var a = params.jsPlumbInstance.makeDynamicAnchor(_jp.Defaults.DynamicAnchors(params));
+        a.type = "AutoDefault";
+        return a;
+    };
+
+// ------- continuous anchors -------------------    
+
+    var _curryContinuousAnchor = function (type, faces) {
+        _jp.Anchors[type] = function (params) {
+            var a = params.jsPlumbInstance.makeAnchor(["Continuous", { faces: faces }], params.elementId, params.jsPlumbInstance);
+            a.type = type;
+            return a;
+        };
+    };
+
+    _jp.Anchors.Continuous = function (params) {
+        return params.jsPlumbInstance.continuousAnchorFactory.get(params);
+    };
+
+    _curryContinuousAnchor("ContinuousLeft", ["left"]);
+    _curryContinuousAnchor("ContinuousTop", ["top"]);
+    _curryContinuousAnchor("ContinuousBottom", ["bottom"]);
+    _curryContinuousAnchor("ContinuousRight", ["right"]);
+
+// ------- position assign anchors -------------------    
+
+    // this anchor type lets you assign the position at connection time.
+    _curryAnchor(0, 0, 0, 0, "Assign", function (anchor, params) {
+        // find what to use as the "position finder". the user may have supplied a String which represents
+        // the id of a position finder in jsPlumb.AnchorPositionFinders, or the user may have supplied the
+        // position finder as a function.  we find out what to use and then set it on the anchor.
+        var pf = params.position || "Fixed";
+        anchor.positionFinder = pf.constructor === String ? params.jsPlumbInstance.AnchorPositionFinders[pf] : pf;
+        // always set the constructor params; the position finder might need them later (the Grid one does,
+        // for example)
+        anchor.constructorParams = params;
+    });
+
+    // these are the default anchor positions finders, which are used by the makeTarget function.  supplying
+    // a position finder argument to that function allows you to specify where the resulting anchor will
+    // be located
+    root.jsPlumbInstance.prototype.AnchorPositionFinders = {
+        "Fixed": function (dp, ep, es) {
+            return [ (dp.left - ep.left) / es[0], (dp.top - ep.top) / es[1] ];
+        },
+        "Grid": function (dp, ep, es, params) {
+            var dx = dp.left - ep.left, dy = dp.top - ep.top,
+                gx = es[0] / (params.grid[0]), gy = es[1] / (params.grid[1]),
+                mx = Math.floor(dx / gx), my = Math.floor(dy / gy);
+            return [ ((mx * gx) + (gx / 2)) / es[0], ((my * gy) + (gy / 2)) / es[1] ];
+        }
+    };
+
+// ------- perimeter anchors -------------------    
+
+    _jp.Anchors.Perimeter = function (params) {
+        params = params || {};
+        var anchorCount = params.anchorCount || 60,
+            shape = params.shape;
+
+        if (!shape) {
+            throw new Error("no shape supplied to Perimeter Anchor type");
+        }
+
+        var _circle = function () {
+                var r = 0.5, step = Math.PI * 2 / anchorCount, current = 0, a = [];
+                for (var i = 0; i < anchorCount; i++) {
+                    var x = r + (r * Math.sin(current)),
+                        y = r + (r * Math.cos(current));
+                    a.push([ x, y, 0, 0 ]);
+                    current += step;
+                }
+                return a;
+            },
+            _path = function (segments) {
+                var anchorsPerFace = anchorCount / segments.length, a = [],
+                    _computeFace = function (x1, y1, x2, y2, fractionalLength) {
+                        anchorsPerFace = anchorCount * fractionalLength;
+                        var dx = (x2 - x1) / anchorsPerFace, dy = (y2 - y1) / anchorsPerFace;
+                        for (var i = 0; i < anchorsPerFace; i++) {
+                            a.push([
+                                    x1 + (dx * i),
+                                    y1 + (dy * i),
+                                0,
+                                0
+                            ]);
+                        }
+                    };
+
+                for (var i = 0; i < segments.length; i++) {
+                    _computeFace.apply(null, segments[i]);
+                }
+
+                return a;
+            },
+            _shape = function (faces) {
+                var s = [];
+                for (var i = 0; i < faces.length; i++) {
+                    s.push([faces[i][0], faces[i][1], faces[i][2], faces[i][3], 1 / faces.length]);
+                }
+                return _path(s);
+            },
+            _rectangle = function () {
+                return _shape([
+                    [ 0, 0, 1, 0 ],
+                    [ 1, 0, 1, 1 ],
+                    [ 1, 1, 0, 1 ],
+                    [ 0, 1, 0, 0 ]
+                ]);
+            };
+
+        var _shapes = {
+                "Circle": _circle,
+                "Ellipse": _circle,
+                "Diamond": function () {
+                    return _shape([
+                        [ 0.5, 0, 1, 0.5 ],
+                        [ 1, 0.5, 0.5, 1 ],
+                        [ 0.5, 1, 0, 0.5 ],
+                        [ 0, 0.5, 0.5, 0 ]
+                    ]);
+                },
+                "Rectangle": _rectangle,
+                "Square": _rectangle,
+                "Triangle": function () {
+                    return _shape([
+                        [ 0.5, 0, 1, 1 ],
+                        [ 1, 1, 0, 1 ],
+                        [ 0, 1, 0.5, 0]
+                    ]);
+                },
+                "Path": function (params) {
+                    var points = params.points, p = [], tl = 0;
+                    for (var i = 0; i < points.length - 1; i++) {
+                        var l = Math.sqrt(Math.pow(points[i][2] - points[i][0]) + Math.pow(points[i][3] - points[i][1]));
+                        tl += l;
+                        p.push([points[i][0], points[i][1], points[i + 1][0], points[i + 1][1], l]);
+                    }
+                    for (var j = 0; j < p.length; j++) {
+                        p[j][4] = p[j][4] / tl;
+                    }
+                    return _path(p);
+                }
+            },
+            _rotate = function (points, amountInDegrees) {
+                var o = [], theta = amountInDegrees / 180 * Math.PI;
+                for (var i = 0; i < points.length; i++) {
+                    var _x = points[i][0] - 0.5,
+                        _y = points[i][1] - 0.5;
+
+                    o.push([
+                            0.5 + ((_x * Math.cos(theta)) - (_y * Math.sin(theta))),
+                            0.5 + ((_x * Math.sin(theta)) + (_y * Math.cos(theta))),
+                        points[i][2],
+                        points[i][3]
+                    ]);
+                }
+                return o;
+            };
+
+        if (!_shapes[shape]) {
+            throw new Error("Shape [" + shape + "] is unknown by Perimeter Anchor type");
+        }
+
+        var da = _shapes[shape](params);
+        if (params.rotation) {
+            da = _rotate(da, params.rotation);
+        }
+        var a = params.jsPlumbInstance.makeDynamicAnchor(da);
+        a.type = "Perimeter";
+        return a;
+    };
+}).call(typeof window !== 'undefined' ? window : this);
+/*
+ * jsPlumb Community Edition
+ * 
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ * 
+ * This file contains the default Connectors, Endpoint and Overlay definitions.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ * 
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+    "use strict";
+    var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil, _jg = root.Biltong;
+
+    _jp.Segments = {
+
+        /*
+         * Class: AbstractSegment
+         * A Connector is made up of 1..N Segments, each of which has a Type, such as 'Straight', 'Arc',
+         * 'Bezier'. This is new from 1.4.2, and gives us a lot more flexibility when drawing connections: things such
+         * as rounded corners for flowchart connectors, for example, or a straight line stub for Bezier connections, are
+         * much easier to do now.
+         *
+         * A Segment is responsible for providing coordinates for painting it, and also must be able to report its length.
+         * 
+         */
+        AbstractSegment: function (params) {
+            this.params = params;
+
+            /**
+             * Function: findClosestPointOnPath
+             * Finds the closest point on this segment to the given [x, y],
+             * returning both the x and y of the point plus its distance from
+             * the supplied point, and its location along the length of the
+             * path inscribed by the segment.  This implementation returns
+             * Infinity for distance and null values for everything else;
+             * subclasses are expected to override.
+             */
+            this.findClosestPointOnPath = function (x, y) {
+                return {
+                    d: Infinity,
+                    x: null,
+                    y: null,
+                    l: null
+                };
+            };
+
+            this.getBounds = function () {
+                return {
+                    minX: Math.min(params.x1, params.x2),
+                    minY: Math.min(params.y1, params.y2),
+                    maxX: Math.max(params.x1, params.x2),
+                    maxY: Math.max(params.y1, params.y2)
+                };
+            };
+        },
+        Straight: function (params) {
+            var _super = _jp.Segments.AbstractSegment.apply(this, arguments),
+                length, m, m2, x1, x2, y1, y2,
+                _recalc = function () {
+                    length = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
+                    m = _jg.gradient({x: x1, y: y1}, {x: x2, y: y2});
+                    m2 = -1 / m;
+                };
+
+            this.type = "Straight";
+
+            this.getLength = function () {
+                return length;
+            };
+            this.getGradient = function () {
+                return m;
+            };
+
+            this.getCoordinates = function () {
+                return { x1: x1, y1: y1, x2: x2, y2: y2 };
+            };
+            this.setCoordinates = function (coords) {
+                x1 = coords.x1;
+                y1 = coords.y1;
+                x2 = coords.x2;
+                y2 = coords.y2;
+                _recalc();
+            };
+            this.setCoordinates({x1: params.x1, y1: params.y1, x2: params.x2, y2: params.y2});
+
+            this.getBounds = function () {
+                return {
+                    minX: Math.min(x1, x2),
+                    minY: Math.min(y1, y2),
+                    maxX: Math.max(x1, x2),
+                    maxY: Math.max(y1, y2)
+                };
+            };
+
+            /**
+             * returns the point on the segment's path that is 'location' along the length of the path, where 'location' is a decimal from
+             * 0 to 1 inclusive. for the straight line segment this is simple maths.
+             */
+            this.pointOnPath = function (location, absolute) {
+                if (location === 0 && !absolute) {
+                    return { x: x1, y: y1 };
+                }
+                else if (location === 1 && !absolute) {
+                    return { x: x2, y: y2 };
+                }
+                else {
+                    var l = absolute ? location > 0 ? location : length + location : location * length;
+                    return _jg.pointOnLine({x: x1, y: y1}, {x: x2, y: y2}, l);
+                }
+            };
+
+            /**
+             * returns the gradient of the segment at the given point - which for us is constant.
+             */
+            this.gradientAtPoint = function (_) {
+                return m;
+            };
+
+            /**
+             * returns the point on the segment's path that is 'distance' along the length of the path from 'location', where
+             * 'location' is a decimal from 0 to 1 inclusive, and 'distance' is a number of pixels.
+             * this hands off to jsPlumbUtil to do the maths, supplying two points and the distance.
+             */
+            this.pointAlongPathFrom = function (location, distance, absolute) {
+                var p = this.pointOnPath(location, absolute),
+                    farAwayPoint = distance <= 0 ? {x: x1, y: y1} : {x: x2, y: y2 };
+
+                /*
+                 location == 1 ? {
+                 x:x1 + ((x2 - x1) * 10),
+                 y:y1 + ((y1 - y2) * 10)
+                 } :
+                 */
+
+                if (distance <= 0 && Math.abs(distance) > 1) {
+                    distance *= -1;
+                }
+
+                return _jg.pointOnLine(p, farAwayPoint, distance);
+            };
+
+            // is c between a and b?
+            var within = function (a, b, c) {
+                return c >= Math.min(a, b) && c <= Math.max(a, b);
+            };
+            // find which of a and b is closest to c
+            var closest = function (a, b, c) {
+                return Math.abs(c - a) < Math.abs(c - b) ? a : b;
+            };
+
+            /**
+             Function: findClosestPointOnPath
+             Finds the closest point on this segment to [x,y]. See
+             notes on this method in AbstractSegment.
+             */
+            this.findClosestPointOnPath = function (x, y) {
+                var out = {
+                    d: Infinity,
+                    x: null,
+                    y: null,
+                    l: null,
+                    x1: x1,
+                    x2: x2,
+                    y1: y1,
+                    y2: y2
+                };
+
+                if (m === 0) {
+                    out.y = y1;
+                    out.x = within(x1, x2, x) ? x : closest(x1, x2, x);
+                }
+                else if (m === Infinity || m === -Infinity) {
+                    out.x = x1;
+                    out.y = within(y1, y2, y) ? y : closest(y1, y2, y);
+                }
+                else {
+                    // closest point lies on normal from given point to this line.  
+                    var b = y1 - (m * x1),
+                        b2 = y - (m2 * x),
+                    // y1 = m.x1 + b and y1 = m2.x1 + b2
+                    // so m.x1 + b = m2.x1 + b2
+                    // x1(m - m2) = b2 - b
+                    // x1 = (b2 - b) / (m - m2)
+                        _x1 = (b2 - b) / (m - m2),
+                        _y1 = (m * _x1) + b;
+
+                    out.x = within(x1, x2, _x1) ? _x1 : closest(x1, x2, _x1);//_x1;
+                    out.y = within(y1, y2, _y1) ? _y1 : closest(y1, y2, _y1);//_y1;
+                }
+
+                var fractionInSegment = _jg.lineLength([ out.x, out.y ], [ x1, y1 ]);
+                out.d = _jg.lineLength([x, y], [out.x, out.y]);
+                out.l = fractionInSegment / length;
+                return out;
+            };
+        },
+
+        /*
+         Arc Segment. You need to supply:
+
+         r   -   radius
+         cx  -   center x for the arc
+         cy  -   center y for the arc
+         ac  -   whether the arc is anticlockwise or not. default is clockwise.
+
+         and then either:
+
+         startAngle  -   startAngle for the arc.
+         endAngle    -   endAngle for the arc.
+
+         or:
+
+         x1          -   x for start point
+         y1          -   y for start point
+         x2          -   x for end point
+         y2          -   y for end point
+
+         */
+        Arc: function (params) {
+            var _super = _jp.Segments.AbstractSegment.apply(this, arguments),
+                _calcAngle = function (_x, _y) {
+                    return _jg.theta([params.cx, params.cy], [_x, _y]);
+                },
+                _calcAngleForLocation = function (segment, location) {
+                    if (segment.anticlockwise) {
+                        var sa = segment.startAngle < segment.endAngle ? segment.startAngle + TWO_PI : segment.startAngle,
+                            s = Math.abs(sa - segment.endAngle);
+                        return sa - (s * location);
+                    }
+                    else {
+                        var ea = segment.endAngle < segment.startAngle ? segment.endAngle + TWO_PI : segment.endAngle,
+                            ss = Math.abs(ea - segment.startAngle);
+
+                        return segment.startAngle + (ss * location);
+                    }
+                },
+                TWO_PI = 2 * Math.PI;
+
+            this.radius = params.r;
+            this.anticlockwise = params.ac;
+            this.type = "Arc";
+
+            if (params.startAngle && params.endAngle) {
+                this.startAngle = params.startAngle;
+                this.endAngle = params.endAngle;
+                this.x1 = params.cx + (this.radius * Math.cos(params.startAngle));
+                this.y1 = params.cy + (this.radius * Math.sin(params.startAngle));
+                this.x2 = params.cx + (this.radius * Math.cos(params.endAngle));
+                this.y2 = params.cy + (this.radius * Math.sin(params.endAngle));
+            }
+            else {
+                this.startAngle = _calcAngle(params.x1, params.y1);
+                this.endAngle = _calcAngle(params.x2, params.y2);
+                this.x1 = params.x1;
+                this.y1 = params.y1;
+                this.x2 = params.x2;
+                this.y2 = params.y2;
+            }
+
+            if (this.endAngle < 0) {
+                this.endAngle += TWO_PI;
+            }
+            if (this.startAngle < 0) {
+                this.startAngle += TWO_PI;
+            }
+
+            // segment is used by vml     
+            //this.segment = _jg.quadrant([this.x1, this.y1], [this.x2, this.y2]);
+
+            // we now have startAngle and endAngle as positive numbers, meaning the
+            // absolute difference (|d|) between them is the sweep (s) of this arc, unless the
+            // arc is 'anticlockwise' in which case 's' is given by 2PI - |d|.
+
+            var ea = this.endAngle < this.startAngle ? this.endAngle + TWO_PI : this.endAngle;
+            this.sweep = Math.abs(ea - this.startAngle);
+            if (this.anticlockwise) {
+                this.sweep = TWO_PI - this.sweep;
+            }
+            var circumference = 2 * Math.PI * this.radius,
+                frac = this.sweep / TWO_PI,
+                length = circumference * frac;
+
+            this.getLength = function () {
+                return length;
+            };
+
+            this.getBounds = function () {
+                return {
+                    minX: params.cx - params.r,
+                    maxX: params.cx + params.r,
+                    minY: params.cy - params.r,
+                    maxY: params.cy + params.r
+                };
+            };
+
+            var VERY_SMALL_VALUE = 0.0000000001,
+                gentleRound = function (n) {
+                    var f = Math.floor(n), r = Math.ceil(n);
+                    if (n - f < VERY_SMALL_VALUE) {
+                        return f;
+                    }
+                    else if (r - n < VERY_SMALL_VALUE) {
+                        return r;
+                    }
+                    return n;
+                };
+
+            /**
+             * returns the point on the segment's path that is 'location' along the length of the path, where 'location' is a decimal from
+             * 0 to 1 inclusive.
+             */
+            this.pointOnPath = function (location, absolute) {
+
+                if (location === 0) {
+                    return { x: this.x1, y: this.y1, theta: this.startAngle };
+                }
+                else if (location === 1) {
+                    return { x: this.x2, y: this.y2, theta: this.endAngle };
+                }
+
+                if (absolute) {
+                    location = location / length;
+                }
+
+                var angle = _calcAngleForLocation(this, location),
+                    _x = params.cx + (params.r * Math.cos(angle)),
+                    _y = params.cy + (params.r * Math.sin(angle));
+
+                return { x: gentleRound(_x), y: gentleRound(_y), theta: angle };
+            };
+
+            /**
+             * returns the gradient of the segment at the given point.
+             */
+            this.gradientAtPoint = function (location, absolute) {
+                var p = this.pointOnPath(location, absolute);
+                var m = _jg.normal([ params.cx, params.cy ], [p.x, p.y ]);
+                if (!this.anticlockwise && (m === Infinity || m === -Infinity)) {
+                    m *= -1;
+                }
+                return m;
+            };
+
+            this.pointAlongPathFrom = function (location, distance, absolute) {
+                var p = this.pointOnPath(location, absolute),
+                    arcSpan = distance / circumference * 2 * Math.PI,
+                    dir = this.anticlockwise ? -1 : 1,
+                    startAngle = p.theta + (dir * arcSpan),
+                    startX = params.cx + (this.radius * Math.cos(startAngle)),
+                    startY = params.cy + (this.radius * Math.sin(startAngle));
+
+                return {x: startX, y: startY};
+            };
+        },
+
+        Bezier: function (params) {
+            this.curve = [
+                { x: params.x1, y: params.y1},
+                { x: params.cp1x, y: params.cp1y },
+                { x: params.cp2x, y: params.cp2y },
+                { x: params.x2, y: params.y2 }
+            ];
+
+            var _super = _jp.Segments.AbstractSegment.apply(this, arguments);
+            // although this is not a strictly rigorous determination of bounds
+            // of a bezier curve, it works for the types of curves that this segment
+            // type produces.
+            this.bounds = {
+                minX: Math.min(params.x1, params.x2, params.cp1x, params.cp2x),
+                minY: Math.min(params.y1, params.y2, params.cp1y, params.cp2y),
+                maxX: Math.max(params.x1, params.x2, params.cp1x, params.cp2x),
+                maxY: Math.max(params.y1, params.y2, params.cp1y, params.cp2y)
+            };
+
+            this.type = "Bezier";
+
+            var _translateLocation = function (_curve, location, absolute) {
+                if (absolute) {
+                    location = root.jsBezier.locationAlongCurveFrom(_curve, location > 0 ? 0 : 1, location);
+                }
+
+                return location;
+            };
+
+            /**
+             * returns the point on the segment's path that is 'location' along the length of the path, where 'location' is a decimal from
+             * 0 to 1 inclusive.
+             */
+            this.pointOnPath = function (location, absolute) {
+                location = _translateLocation(this.curve, location, absolute);
+                return root.jsBezier.pointOnCurve(this.curve, location);
+            };
+
+            /**
+             * returns the gradient of the segment at the given point.
+             */
+            this.gradientAtPoint = function (location, absolute) {
+                location = _translateLocation(this.curve, location, absolute);
+                return root.jsBezier.gradientAtPoint(this.curve, location);
+            };
+
+            this.pointAlongPathFrom = function (location, distance, absolute) {
+                location = _translateLocation(this.curve, location, absolute);
+                return root.jsBezier.pointAlongCurveFrom(this.curve, location, distance);
+            };
+
+            this.getLength = function () {
+                return root.jsBezier.getLength(this.curve);
+            };
+
+            this.getBounds = function () {
+                return this.bounds;
+            };
+        }
+    };
+
+    _jp.SegmentRenderer = {
+        getPath: function (segment) {
+            return ({
+                "Straight": function () {
+                    var d = segment.getCoordinates();
+                    return "M " + d.x1 + " " + d.y1 + " L " + d.x2 + " " + d.y2;
+                },
+                "Bezier": function () {
+                    var d = segment.params;
+                    return "M " + d.x1 + " " + d.y1 +
+                        " C " + d.cp1x + " " + d.cp1y + " " + d.cp2x + " " + d.cp2y + " " + d.x2 + " " + d.y2;
+                },
+                "Arc": function () {
+                    var d = segment.params,
+                        laf = segment.sweep > Math.PI ? 1 : 0,
+                        sf = segment.anticlockwise ? 0 : 1;
+
+                    return "M" + segment.x1 + " " + segment.y1 + " A " + segment.radius + " " + d.r + " 0 " + laf + "," + sf + " " + segment.x2 + " " + segment.y2;
+                }
+            })[segment.type]();
+        }
+    };
+
+    /*
+     Class: AbstractComponent
+     Superclass for AbstractConnector and AbstractEndpoint.
+     */
+    var AbstractComponent = function () {
+        this.resetBounds = function () {
+            this.bounds = { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity };
+        };
+        this.resetBounds();
+    };
+
+    /*
+     * Class: AbstractConnector
+     * Superclass for all Connectors; here is where Segments are managed.  This is exposed on jsPlumb just so it
+     * can be accessed from other files. You should not try to instantiate one of these directly.
+     *
+     * When this class is asked for a pointOnPath, or gradient etc, it must first figure out which segment to dispatch
+     * that request to. This is done by keeping track of the total connector length as segments are added, and also
+     * their cumulative ratios to the total length.  Then when the right segment is found it is a simple case of dispatching
+     * the request to it (and adjusting 'location' so that it is relative to the beginning of that segment.)
+     */
+    _jp.Connectors.AbstractConnector = function (params) {
+
+        AbstractComponent.apply(this, arguments);
+
+        var segments = [],
+            totalLength = 0,
+            segmentProportions = [],
+            segmentProportionalLengths = [],
+            stub = params.stub || 0,
+            sourceStub = _ju.isArray(stub) ? stub[0] : stub,
+            targetStub = _ju.isArray(stub) ? stub[1] : stub,
+            gap = params.gap || 0,
+            sourceGap = _ju.isArray(gap) ? gap[0] : gap,
+            targetGap = _ju.isArray(gap) ? gap[1] : gap,
+            userProvidedSegments = null,
+            edited = false,
+            paintInfo = null,
+            geometry = null,
+            editable = params.editable !== false && _jp.ConnectorEditors != null && _jp.ConnectorEditors[this.type] != null;
+
+        var _setGeometry = this.setGeometry = function(g, internallyComputed) {
+            edited = (!internallyComputed);
+            geometry = g;
+        };
+        var _getGeometry = this.getGeometry = function() {
+            return geometry;
+        };
+
+        this.getPathData = function() {
+            var p = "";
+            for (var i = 0; i < segments.length; i++) {
+                p += _jp.SegmentRenderer.getPath(segments[i]);
+                p += " ";
+            }
+            return p;
+        };
+
+        this.hasBeenEdited = function() { return edited; };
+        this.isEditing = function() { return this.editor != null && this.editor.isActive(); };
+        this.setEditable = function(e) {
+            // if this connector has an editor already, or
+            // if an editor for this connector's type is available, or
+            // if the child declares an overrideSetEditable and it does not return false, editable is true.
+            if (e && _jp.ConnectorEditors != null && _jp.ConnectorEditors[this.type] != null && (this.overrideSetEditable == null || this.overrideSetEditable())) {
+                editable = e;
+            } else {
+                editable = false;
+            }
+            return editable;
+        };
+        this.isEditable = function() { return editable; };
+
+        /**
+         * Function: findSegmentForPoint
+         * Returns the segment that is closest to the given [x,y],
+         * null if nothing found.  This function returns a JS
+         * object with:
+         *
+         *   d   -   distance from segment
+         *   l   -   proportional location in segment
+         *   x   -   x point on the segment
+         *   y   -   y point on the segment
+         *   s   -   the segment itself.
+         */
+        this.findSegmentForPoint = function (x, y) {
+            var out = { d: Infinity, s: null, x: null, y: null, l: null };
+            for (var i = 0; i < segments.length; i++) {
+                var _s = segments[i].findClosestPointOnPath(x, y);
+                if (_s.d < out.d) {
+                    out.d = _s.d;
+                    out.l = _s.l;
+                    out.x = _s.x;
+                    out.y = _s.y;
+                    out.s = segments[i];
+                    out.x1 = _s.x1;
+                    out.x2 = _s.x2;
+                    out.y1 = _s.y1;
+                    out.y2 = _s.y2;
+                    out.index = i;
+                }
+            }
+
+            return out;
+        };
+
+        var _updateSegmentProportions = function () {
+                var curLoc = 0;
+                for (var i = 0; i < segments.length; i++) {
+                    var sl = segments[i].getLength();
+                    segmentProportionalLengths[i] = sl / totalLength;
+                    segmentProportions[i] = [curLoc, (curLoc += (sl / totalLength)) ];
+                }
+            },
+
+            /**
+             * returns [segment, proportion of travel in segment, segment index] for the segment
+             * that contains the point which is 'location' distance along the entire path, where
+             * 'location' is a decimal between 0 and 1 inclusive. in this connector type, paths
+             * are made up of a list of segments, each of which contributes some fraction to
+             * the total length.
+             * From 1.3.10 this also supports the 'absolute' property, which lets us specify a location
+             * as the absolute distance in pixels, rather than a proportion of the total path.
+             */
+            _findSegmentForLocation = function (location, absolute) {
+                if (absolute) {
+                    location = location > 0 ? location / totalLength : (totalLength + location) / totalLength;
+                }
+                var idx = segmentProportions.length - 1, inSegmentProportion = 1;
+                for (var i = 0; i < segmentProportions.length; i++) {
+                    if (segmentProportions[i][1] >= location) {
+                        idx = i;
+                        // todo is this correct for all connector path types?
+                        inSegmentProportion = location === 1 ? 1 : location === 0 ? 0 : (location - segmentProportions[i][0]) / segmentProportionalLengths[i];
+                        break;
+                    }
+                }
+                return { segment: segments[idx], proportion: inSegmentProportion, index: idx };
+            },
+            _addSegment = function (conn, type, params) {
+                if (params.x1 === params.x2 && params.y1 === params.y2) {
+                    return;
+                }
+                var s = new _jp.Segments[type](params);
+                segments.push(s);
+                totalLength += s.getLength();
+                conn.updateBounds(s);
+            },
+            _clearSegments = function () {
+                totalLength = segments.length = segmentProportions.length = segmentProportionalLengths.length = 0;
+            };
+
+        this.setSegments = function (_segs) {
+            userProvidedSegments = [];
+            totalLength = 0;
+            for (var i = 0; i < _segs.length; i++) {
+                userProvidedSegments.push(_segs[i]);
+                totalLength += _segs[i].getLength();
+            }
+        };
+
+        this.getLength = function() {
+            return totalLength;
+        };
+
+        var _prepareCompute = function (params) {
+            this.strokeWidth = params.strokeWidth;
+            var segment = _jg.quadrant(params.sourcePos, params.targetPos),
+                swapX = params.targetPos[0] < params.sourcePos[0],
+                swapY = params.targetPos[1] < params.sourcePos[1],
+                lw = params.strokeWidth || 1,
+                so = params.sourceEndpoint.anchor.getOrientation(params.sourceEndpoint),
+                to = params.targetEndpoint.anchor.getOrientation(params.targetEndpoint),
+                x = swapX ? params.targetPos[0] : params.sourcePos[0],
+                y = swapY ? params.targetPos[1] : params.sourcePos[1],
+                w = Math.abs(params.targetPos[0] - params.sourcePos[0]),
+                h = Math.abs(params.targetPos[1] - params.sourcePos[1]);
+
+            // if either anchor does not have an orientation set, we derive one from their relative
+            // positions.  we fix the axis to be the one in which the two elements are further apart, and
+            // point each anchor at the other element.  this is also used when dragging a new connection.
+            if (so[0] === 0 && so[1] === 0 || to[0] === 0 && to[1] === 0) {
+                var index = w > h ? 0 : 1, oIndex = [1, 0][index];
+                so = [];
+                to = [];
+                so[index] = params.sourcePos[index] > params.targetPos[index] ? -1 : 1;
+                to[index] = params.sourcePos[index] > params.targetPos[index] ? 1 : -1;
+                so[oIndex] = 0;
+                to[oIndex] = 0;
+            }
+
+            var sx = swapX ? w + (sourceGap * so[0]) : sourceGap * so[0],
+                sy = swapY ? h + (sourceGap * so[1]) : sourceGap * so[1],
+                tx = swapX ? targetGap * to[0] : w + (targetGap * to[0]),
+                ty = swapY ? targetGap * to[1] : h + (targetGap * to[1]),
+                oProduct = ((so[0] * to[0]) + (so[1] * to[1]));
+
+            var result = {
+                sx: sx, sy: sy, tx: tx, ty: ty, lw: lw,
+                xSpan: Math.abs(tx - sx),
+                ySpan: Math.abs(ty - sy),
+                mx: (sx + tx) / 2,
+                my: (sy + ty) / 2,
+                so: so, to: to, x: x, y: y, w: w, h: h,
+                segment: segment,
+                startStubX: sx + (so[0] * sourceStub),
+                startStubY: sy + (so[1] * sourceStub),
+                endStubX: tx + (to[0] * targetStub),
+                endStubY: ty + (to[1] * targetStub),
+                isXGreaterThanStubTimes2: Math.abs(sx - tx) > (sourceStub + targetStub),
+                isYGreaterThanStubTimes2: Math.abs(sy - ty) > (sourceStub + targetStub),
+                opposite: oProduct === -1,
+                perpendicular: oProduct === 0,
+                orthogonal: oProduct === 1,
+                sourceAxis: so[0] === 0 ? "y" : "x",
+                points: [x, y, w, h, sx, sy, tx, ty ]
+            };
+            result.anchorOrientation = result.opposite ? "opposite" : result.orthogonal ? "orthogonal" : "perpendicular";
+            return result;
+        };
+
+        this.getSegments = function () {
+            return segments;
+        };
+
+        this.updateBounds = function (segment) {
+            var segBounds = segment.getBounds();
+            this.bounds.minX = Math.min(this.bounds.minX, segBounds.minX);
+            this.bounds.maxX = Math.max(this.bounds.maxX, segBounds.maxX);
+            this.bounds.minY = Math.min(this.bounds.minY, segBounds.minY);
+            this.bounds.maxY = Math.max(this.bounds.maxY, segBounds.maxY);
+        };
+
+        var dumpSegmentsToConsole = function () {
+            console.log("SEGMENTS:");
+            for (var i = 0; i < segments.length; i++) {
+                console.log(segments[i].type, segments[i].getLength(), segmentProportions[i]);
+            }
+        };
+
+        this.pointOnPath = function (location, absolute) {
+            var seg = _findSegmentForLocation(location, absolute);
+            return seg.segment && seg.segment.pointOnPath(seg.proportion, false) || [0, 0];
+        };
+
+        this.gradientAtPoint = function (location, absolute) {
+            var seg = _findSegmentForLocation(location, absolute);
+            return seg.segment && seg.segment.gradientAtPoint(seg.proportion, false) || 0;
+        };
+
+        this.pointAlongPathFrom = function (location, distance, absolute) {
+            var seg = _findSegmentForLocation(location, absolute);
+            // TODO what happens if this crosses to the next segment?
+            return seg.segment && seg.segment.pointAlongPathFrom(seg.proportion, distance, false) || [0, 0];
+        };
+
+        this.compute = function (params) {
+            paintInfo = _prepareCompute.call(this, params);
+
+            _clearSegments();
+            this._compute(paintInfo, params);
+            this.x = paintInfo.points[0];
+            this.y = paintInfo.points[1];
+            this.w = paintInfo.points[2];
+            this.h = paintInfo.points[3];
+            this.segment = paintInfo.segment;
+            _updateSegmentProportions();
+        };
+
+        return {
+            addSegment: _addSegment,
+            prepareCompute: _prepareCompute,
+            sourceStub: sourceStub,
+            targetStub: targetStub,
+            maxStub: Math.max(sourceStub, targetStub),
+            sourceGap: sourceGap,
+            targetGap: targetGap,
+            maxGap: Math.max(sourceGap, targetGap),
+            setGeometry:_setGeometry,
+            getGeometry:_getGeometry
+        };
+    };
+    _ju.extend(_jp.Connectors.AbstractConnector, AbstractComponent);
+
+
+    // ********************************* END OF CONNECTOR TYPES *******************************************************************
+
+    // ********************************* ENDPOINT TYPES *******************************************************************
+
+    _jp.Endpoints.AbstractEndpoint = function (params) {
+        AbstractComponent.apply(this, arguments);
+        var compute = this.compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
+            var out = this._compute.apply(this, arguments);
+            this.x = out[0];
+            this.y = out[1];
+            this.w = out[2];
+            this.h = out[3];
+            this.bounds.minX = this.x;
+            this.bounds.minY = this.y;
+            this.bounds.maxX = this.x + this.w;
+            this.bounds.maxY = this.y + this.h;
+            return out;
+        };
+        return {
+            compute: compute,
+            cssClass: params.cssClass
+        };
+    };
+    _ju.extend(_jp.Endpoints.AbstractEndpoint, AbstractComponent);
+
+    /**
+     * Class: Endpoints.Dot
+     * A round endpoint, with default radius 10 pixels.
+     */
+
+    /**
+     * Function: Constructor
+     *
+     * Parameters:
+     *
+     *    radius    -    radius of the endpoint.  defaults to 10 pixels.
+     */
+    _jp.Endpoints.Dot = function (params) {
+        this.type = "Dot";
+        var _super = _jp.Endpoints.AbstractEndpoint.apply(this, arguments);
+        params = params || {};
+        this.radius = params.radius || 10;
+        this.defaultOffset = 0.5 * this.radius;
+        this.defaultInnerRadius = this.radius / 3;
+
+        this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
+            this.radius = endpointStyle.radius || this.radius;
+            var x = anchorPoint[0] - this.radius,
+                y = anchorPoint[1] - this.radius,
+                w = this.radius * 2,
+                h = this.radius * 2;
+
+            if (endpointStyle.stroke) {
+                var lw = endpointStyle.strokeWidth || 1;
+                x -= lw;
+                y -= lw;
+                w += (lw * 2);
+                h += (lw * 2);
+            }
+            return [ x, y, w, h, this.radius ];
+        };
+    };
+    _ju.extend(_jp.Endpoints.Dot, _jp.Endpoints.AbstractEndpoint);
+
+    _jp.Endpoints.Rectangle = function (params) {
+        this.type = "Rectangle";
+        var _super = _jp.Endpoints.AbstractEndpoint.apply(this, arguments);
+        params = params || {};
+        this.width = params.width || 20;
+        this.height = params.height || 20;
+
+        this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
+            var width = endpointStyle.width || this.width,
+                height = endpointStyle.height || this.height,
+                x = anchorPoint[0] - (width / 2),
+                y = anchorPoint[1] - (height / 2);
+
+            return [ x, y, width, height];
+        };
+    };
+    _ju.extend(_jp.Endpoints.Rectangle, _jp.Endpoints.AbstractEndpoint);
+
+    var DOMElementEndpoint = function (params) {
+        _jp.jsPlumbUIComponent.apply(this, arguments);
+        this._jsPlumb.displayElements = [];
+    };
+    _ju.extend(DOMElementEndpoint, _jp.jsPlumbUIComponent, {
+        getDisplayElements: function () {
+            return this._jsPlumb.displayElements;
+        },
+        appendDisplayElement: function (el) {
+            this._jsPlumb.displayElements.push(el);
+        }
+    });
+
+    /**
+     * Class: Endpoints.Image
+     * Draws an image as the Endpoint.
+     */
+    /**
+     * Function: Constructor
+     *
+     * Parameters:
+     *
+     *    src    -    location of the image to use.
+
+     TODO: multiple references to self. not sure quite how to get rid of them entirely. perhaps self = null in the cleanup
+     function will suffice
+
+     TODO this class still might leak memory.
+
+     */
+    _jp.Endpoints.Image = function (params) {
+
+        this.type = "Image";
+        DOMElementEndpoint.apply(this, arguments);
+        _jp.Endpoints.AbstractEndpoint.apply(this, arguments);
+
+        var _onload = params.onload,
+            src = params.src || params.url,
+            clazz = params.cssClass ? " " + params.cssClass : "";
+
+        this._jsPlumb.img = new Image();
+        this._jsPlumb.ready = false;
+        this._jsPlumb.initialized = false;
+        this._jsPlumb.deleted = false;
+        this._jsPlumb.widthToUse = params.width;
+        this._jsPlumb.heightToUse = params.height;
+        this._jsPlumb.endpoint = params.endpoint;
+
+        this._jsPlumb.img.onload = function () {
+            if (this._jsPlumb != null) {
+                this._jsPlumb.ready = true;
+                this._jsPlumb.widthToUse = this._jsPlumb.widthToUse || this._jsPlumb.img.width;
+                this._jsPlumb.heightToUse = this._jsPlumb.heightToUse || this._jsPlumb.img.height;
+                if (_onload) {
+                    _onload(this);
+                }
+            }
+        }.bind(this);
+
+        /*
+         Function: setImage
+         Sets the Image to use in this Endpoint.
+
+         Parameters:
+         img         -   may be a URL or an Image object
+         onload      -   optional; a callback to execute once the image has loaded.
+         */
+        this._jsPlumb.endpoint.setImage = function (_img, onload) {
+            var s = _img.constructor === String ? _img : _img.src;
+            _onload = onload;
+            this._jsPlumb.img.src = s;
+
+            if (this.canvas != null) {
+                this.canvas.setAttribute("src", this._jsPlumb.img.src);
+            }
+        }.bind(this);
+
+        this._jsPlumb.endpoint.setImage(src, _onload);
+        this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
+            this.anchorPoint = anchorPoint;
+            if (this._jsPlumb.ready) {
+                return [anchorPoint[0] - this._jsPlumb.widthToUse / 2, anchorPoint[1] - this._jsPlumb.heightToUse / 2,
+                    this._jsPlumb.widthToUse, this._jsPlumb.heightToUse];
+            }
+            else {
+                return [0, 0, 0, 0];
+            }
+        };
+
+        this.canvas = _jp.createElement("img", {
+            position:"absolute",
+            margin:0,
+            padding:0,
+            outline:0
+        }, this._jsPlumb.instance.endpointClass + clazz);
+
+        if (this._jsPlumb.widthToUse) {
+            this.canvas.setAttribute("width", this._jsPlumb.widthToUse);
+        }
+        if (this._jsPlumb.heightToUse) {
+            this.canvas.setAttribute("height", this._jsPlumb.heightToUse);
+        }
+        this._jsPlumb.instance.appendElement(this.canvas);
+
+        this.actuallyPaint = function (d, style, anchor) {
+            if (!this._jsPlumb.deleted) {
+                if (!this._jsPlumb.initialized) {
+                    this.canvas.setAttribute("src", this._jsPlumb.img.src);
+                    this.appendDisplayElement(this.canvas);
+                    this._jsPlumb.initialized = true;
+                }
+                var x = this.anchorPoint[0] - (this._jsPlumb.widthToUse / 2),
+                    y = this.anchorPoint[1] - (this._jsPlumb.heightToUse / 2);
+                _ju.sizeElement(this.canvas, x, y, this._jsPlumb.widthToUse, this._jsPlumb.heightToUse);
+            }
+        };
+
+        this.paint = function (style, anchor) {
+            if (this._jsPlumb != null) {  // may have been deleted
+                if (this._jsPlumb.ready) {
+                    this.actuallyPaint(style, anchor);
+                }
+                else {
+                    root.setTimeout(function () {
+                        this.paint(style, anchor);
+                    }.bind(this), 200);
+                }
+            }
+        };
+    };
+    _ju.extend(_jp.Endpoints.Image, [ DOMElementEndpoint, _jp.Endpoints.AbstractEndpoint ], {
+        cleanup: function (force) {
+            if (force) {
+                this._jsPlumb.deleted = true;
+                if (this.canvas) {
+                    this.canvas.parentNode.removeChild(this.canvas);
+                }
+                this.canvas = null;
+            }
+        }
+    });
+
+    /*
+     * Class: Endpoints.Blank
+     * An Endpoint that paints nothing (visible) on the screen.  Supports cssClass and hoverClass parameters like all Endpoints.
+     */
+    _jp.Endpoints.Blank = function (params) {
+        var _super = _jp.Endpoints.AbstractEndpoint.apply(this, arguments);
+        this.type = "Blank";
+        DOMElementEndpoint.apply(this, arguments);
+        this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
+            return [anchorPoint[0], anchorPoint[1], 10, 0];
+        };
+
+        var clazz = params.cssClass ? " " + params.cssClass : "";
+
+        this.canvas = _jp.createElement("div", {
+            display: "block",
+            width: "1px",
+            height: "1px",
+            background: "transparent",
+            position: "absolute"
+        }, this._jsPlumb.instance.endpointClass + clazz);
+
+        this._jsPlumb.instance.appendElement(this.canvas);
+
+        this.paint = function (style, anchor) {
+            _ju.sizeElement(this.canvas, this.x, this.y, this.w, this.h);
+        };
+    };
+    _ju.extend(_jp.Endpoints.Blank, [_jp.Endpoints.AbstractEndpoint, DOMElementEndpoint], {
+        cleanup: function () {
+            if (this.canvas && this.canvas.parentNode) {
+                this.canvas.parentNode.removeChild(this.canvas);
+            }
+        }
+    });
+
+    /*
+     * Class: Endpoints.Triangle
+     * A triangular Endpoint.
+     */
+    /*
+     * Function: Constructor
+     *
+     * Parameters:
+     *
+     * width   width of the triangle's base.  defaults to 55 pixels.
+     * height  height of the triangle from base to apex.  defaults to 55 pixels.
+     */
+    _jp.Endpoints.Triangle = function (params) {
+        this.type = "Triangle";
+        _jp.Endpoints.AbstractEndpoint.apply(this, arguments);
+        var self = this;
+        params = params || {  };
+        params.width = params.width || 55;
+        params.height = params.height || 55;
+        this.width = params.width;
+        this.height = params.height;
+        this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
+            var width = endpointStyle.width || self.width,
+                height = endpointStyle.height || self.height,
+                x = anchorPoint[0] - (width / 2),
+                y = anchorPoint[1] - (height / 2);
+            return [ x, y, width, height ];
+        };
+    };
+// ********************************* END OF ENDPOINT TYPES *******************************************************************
+
+
+// ********************************* OVERLAY DEFINITIONS ***********************************************************************    
+
+    var AbstractOverlay = _jp.Overlays.AbstractOverlay = function (params) {
+        this.visible = true;
+        this.isAppendedAtTopLevel = true;
+        this.component = params.component;
+        this.loc = params.location == null ? 0.5 : params.location;
+        this.endpointLoc = params.endpointLocation == null ? [ 0.5, 0.5] : params.endpointLocation;
+        this.visible = params.visible !== false;
+    };
+    AbstractOverlay.prototype = {
+        cleanup: function (force) {
+            if (force) {
+                this.component = null;
+                this.canvas = null;
+                this.endpointLoc = null;
+            }
+        },
+        reattach:function(instance, component) { },
+        setVisible: function (val) {
+            this.visible = val;
+            this.component.repaint();
+        },
+        isVisible: function () {
+            return this.visible;
+        },
+        hide: function () {
+            this.setVisible(false);
+        },
+        show: function () {
+            this.setVisible(true);
+        },
+        incrementLocation: function (amount) {
+            this.loc += amount;
+            this.component.repaint();
+        },
+        setLocation: function (l) {
+            this.loc = l;
+            this.component.repaint();
+        },
+        getLocation: function () {
+            return this.loc;
+        },
+        updateFrom:function() { }
+    };
+
+
+    /*
+     * Class: Overlays.Arrow
+     *
+     * An arrow overlay, defined by four points: the head, the two sides of the tail, and a 'foldback' point at some distance along the length
+     * of the arrow that lines from each tail point converge into.  The foldback point is defined using a decimal that indicates some fraction
+     * of the length of the arrow and has a default value of 0.623.  A foldback point value of 1 would mean that the arrow had a straight line
+     * across the tail.
+     */
+    /*
+     * @constructor
+     *
+     * @param {Object} params Constructor params.
+     * @param {Number} [params.length] Distance in pixels from head to tail baseline. default 20.
+     * @param {Number} [params.width] Width in pixels of the tail baseline. default 20.
+     * @param {String} [params.fill] Style to use when filling the arrow.  defaults to "black".
+     * @param {String} [params.stroke] Style to use when stroking the arrow. defaults to null, which means the arrow is not stroked.
+     * @param {Number} [params.stroke-width] Line width to use when stroking the arrow. defaults to 1, but only used if stroke is not null.
+     * @param {Number} [params.foldback] Distance (as a decimal from 0 to 1 inclusive) along the length of the arrow marking the point the tail points should fold back to.  defaults to 0.623.
+     * @param {Number} [params.location] Distance (as a decimal from 0 to 1 inclusive) marking where the arrow should sit on the connector. defaults to 0.5.
+     * @param {NUmber} [params.direction] Indicates the direction the arrow points in. valid values are -1 and 1; 1 is default.
+     */
+    _jp.Overlays.Arrow = function (params) {
+        this.type = "Arrow";
+        AbstractOverlay.apply(this, arguments);
+        this.isAppendedAtTopLevel = false;
+        params = params || {};
+        var self = this;
+
+        this.length = params.length || 20;
+        this.width = params.width || 20;
+        this.id = params.id;
+        var direction = (params.direction || 1) < 0 ? -1 : 1,
+            paintStyle = params.paintStyle || { "stroke-width": 1 },
+        // how far along the arrow the lines folding back in come to. default is 62.3%.
+            foldback = params.foldback || 0.623;
+
+        this.computeMaxSize = function () {
+            return self.width * 1.5;
+        };
+
+        this.elementCreated = function(p, component) {
+            this.path = p;
+            if (params.events) {
+                for (var i in params.events) {
+                    _jp.on(p, i, params.events[i]);
+                }
+            }
+        };
+
+        this.draw = function (component, currentConnectionPaintStyle) {
+
+            var hxy, mid, txy, tail, cxy;
+            if (component.pointAlongPathFrom) {
+
+                if (_ju.isString(this.loc) || this.loc > 1 || this.loc < 0) {
+                    var l = parseInt(this.loc, 10),
+                        fromLoc = this.loc < 0 ? 1 : 0;
+                    hxy = component.pointAlongPathFrom(fromLoc, l, false);
+                    mid = component.pointAlongPathFrom(fromLoc, l - (direction * this.length / 2), false);
+                    txy = _jg.pointOnLine(hxy, mid, this.length);
+                }
+                else if (this.loc === 1) {
+                    hxy = component.pointOnPath(this.loc);
+                    mid = component.pointAlongPathFrom(this.loc, -(this.length));
+                    txy = _jg.pointOnLine(hxy, mid, this.length);
+
+                    if (direction === -1) {
+                        var _ = txy;
+                        txy = hxy;
+                        hxy = _;
+                    }
+                }
+                else if (this.loc === 0) {
+                    txy = component.pointOnPath(this.loc);
+                    mid = component.pointAlongPathFrom(this.loc, this.length);
+                    hxy = _jg.pointOnLine(txy, mid, this.length);
+                    if (direction === -1) {
+                        var __ = txy;
+                        txy = hxy;
+                        hxy = __;
+                    }
+                }
+                else {
+                    hxy = component.pointAlongPathFrom(this.loc, direction * this.length / 2);
+                    mid = component.pointOnPath(this.loc);
+                    txy = _jg.pointOnLine(hxy, mid, this.length);
+                }
+
+                tail = _jg.perpendicularLineTo(hxy, txy, this.width);
+                cxy = _jg.pointOnLine(hxy, txy, foldback * this.length);
+
+                var d = { hxy: hxy, tail: tail, cxy: cxy },
+                    stroke = paintStyle.stroke || currentConnectionPaintStyle.stroke,
+                    fill = paintStyle.fill || currentConnectionPaintStyle.stroke,
+                    lineWidth = paintStyle.strokeWidth || currentConnectionPaintStyle.strokeWidth;
+
+                return {
+                    component: component,
+                    d: d,
+                    "stroke-width": lineWidth,
+                    stroke: stroke,
+                    fill: fill,
+                    minX: Math.min(hxy.x, tail[0].x, tail[1].x),
+                    maxX: Math.max(hxy.x, tail[0].x, tail[1].x),
+                    minY: Math.min(hxy.y, tail[0].y, tail[1].y),
+                    maxY: Math.max(hxy.y, tail[0].y, tail[1].y)
+                };
+            }
+            else {
+                return {component: component, minX: 0, maxX: 0, minY: 0, maxY: 0};
+            }
+        };
+    };
+    _ju.extend(_jp.Overlays.Arrow, AbstractOverlay, {
+        updateFrom:function(d) {
+            this.length = d.length || this.length;
+            this.width = d.width|| this.width;
+            this.direction = d.direction != null ? d.direction : this.direction;
+            this.foldback = d.foldback|| this.foldback;
+        }
+    });
+
+    /*
+     * Class: Overlays.PlainArrow
+     *
+     * A basic arrow.  This is in fact just one instance of the more generic case in which the tail folds back on itself to some
+     * point along the length of the arrow: in this case, that foldback point is the full length of the arrow.  so it just does
+     * a 'call' to Arrow with foldback set appropriately.
+     */
+    /*
+     * Function: Constructor
+     * See <Overlays.Arrow> for allowed parameters for this overlay.
+     */
+    _jp.Overlays.PlainArrow = function (params) {
+        params = params || {};
+        var p = _jp.extend(params, {foldback: 1});
+        _jp.Overlays.Arrow.call(this, p);
+        this.type = "PlainArrow";
+    };
+    _ju.extend(_jp.Overlays.PlainArrow, _jp.Overlays.Arrow);
+
+    /*
+     * Class: Overlays.Diamond
+     * 
+     * A diamond. Like PlainArrow, this is a concrete case of the more generic case of the tail points converging on some point...it just
+     * happens that in this case, that point is greater than the length of the the arrow.
+     *
+     *      this could probably do with some help with positioning...due to the way it reuses the Arrow paint code, what Arrow thinks is the
+     *      center is actually 1/4 of the way along for this guy.  but we don't have any knowledge of pixels at this point, so we're kind of
+     *      stuck when it comes to helping out the Arrow class. possibly we could pass in a 'transpose' parameter or something. the value
+     *      would be -l/4 in this case - move along one quarter of the total length.
+     */
+    /*
+     * Function: Constructor
+     * See <Overlays.Arrow> for allowed parameters for this overlay.
+     */
+    _jp.Overlays.Diamond = function (params) {
+        params = params || {};
+        var l = params.length || 40,
+            p = _jp.extend(params, {length: l / 2, foldback: 2});
+        _jp.Overlays.Arrow.call(this, p);
+        this.type = "Diamond";
+    };
+    _ju.extend(_jp.Overlays.Diamond, _jp.Overlays.Arrow);
+
+    var _getDimensions = function (component, forceRefresh) {
+        if (component._jsPlumb.cachedDimensions == null || forceRefresh) {
+            component._jsPlumb.cachedDimensions = component.getDimensions();
+        }
+        return component._jsPlumb.cachedDimensions;
+    };
+
+    // abstract superclass for overlays that add an element to the DOM.
+    var AbstractDOMOverlay = function (params) {
+        _jp.jsPlumbUIComponent.apply(this, arguments);
+        AbstractOverlay.apply(this, arguments);
+
+        // hand off fired events to associated component.
+        var _f = this.fire;
+        this.fire = function () {
+            _f.apply(this, arguments);
+            if (this.component) {
+                this.component.fire.apply(this.component, arguments);
+            }
+        };
+
+        this.detached=false;
+        this.id = params.id;
+        this._jsPlumb.div = null;
+        this._jsPlumb.initialised = false;
+        this._jsPlumb.component = params.component;
+        this._jsPlumb.cachedDimensions = null;
+        this._jsPlumb.create = params.create;
+        this._jsPlumb.initiallyInvisible = params.visible === false;
+
+        this.getElement = function () {
+            if (this._jsPlumb.div == null) {
+                var div = this._jsPlumb.div = _jp.getElement(this._jsPlumb.create(this._jsPlumb.component));
+                div.style.position = "absolute";
+                div.className = this._jsPlumb.instance.overlayClass + " " +
+                    (this.cssClass ? this.cssClass :
+                        params.cssClass ? params.cssClass : "");
+                this._jsPlumb.instance.appendElement(div);
+                this._jsPlumb.instance.getId(div);
+                this.canvas = div;
+
+                // in IE the top left corner is what it placed at the desired location.  This will not
+                // be fixed. IE8 is not going to be supported for much longer.
+                var ts = "translate(-50%, -50%)";
+                div.style.webkitTransform = ts;
+                div.style.mozTransform = ts;
+                div.style.msTransform = ts;
+                div.style.oTransform = ts;
+                div.style.transform = ts;
+
+                // write the related component into the created element
+                div._jsPlumb = this;
+
+                if (params.visible === false) {
+                    div.style.display = "none";
+                }
+            }
+            return this._jsPlumb.div;
+        };
+
+        this.draw = function (component, currentConnectionPaintStyle, absolutePosition) {
+            var td = _getDimensions(this);
+            if (td != null && td.length === 2) {
+                var cxy = { x: 0, y: 0 };
+
+                // absolutePosition would have been set by a call to connection.setAbsoluteOverlayPosition.
+                if (absolutePosition) {
+                    cxy = { x: absolutePosition[0], y: absolutePosition[1] };
+                }
+                else if (component.pointOnPath) {
+                    var loc = this.loc, absolute = false;
+                    if (_ju.isString(this.loc) || this.loc < 0 || this.loc > 1) {
+                        loc = parseInt(this.loc, 10);
+                        absolute = true;
+                    }
+                    cxy = component.pointOnPath(loc, absolute);  // a connection
+                }
+                else {
+                    var locToUse = this.loc.constructor === Array ? this.loc : this.endpointLoc;
+                    cxy = { x: locToUse[0] * component.w,
+                        y: locToUse[1] * component.h };
+                }
+
+                var minx = cxy.x - (td[0] / 2),
+                    miny = cxy.y - (td[1] / 2);
+
+                return {
+                    component: component,
+                    d: { minx: minx, miny: miny, td: td, cxy: cxy },
+                    minX: minx,
+                    maxX: minx + td[0],
+                    minY: miny,
+                    maxY: miny + td[1]
+                };
+            }
+            else {
+                return {minX: 0, maxX: 0, minY: 0, maxY: 0};
+            }
+        };
+    };
+    _ju.extend(AbstractDOMOverlay, [_jp.jsPlumbUIComponent, AbstractOverlay], {
+        getDimensions: function () {
+            return [1,1];
+        },
+        setVisible: function (state) {
+            if (this._jsPlumb.div) {
+                this._jsPlumb.div.style.display = state ? "block" : "none";
+                // if initially invisible, dimensions are 0,0 and never get updated
+                if (state && this._jsPlumb.initiallyInvisible) {
+                    _getDimensions(this, true);
+                    this.component.repaint();
+                    this._jsPlumb.initiallyInvisible = false;
+                }
+            }
+        },
+        /*
+         * Function: clearCachedDimensions
+         * Clears the cached dimensions for the label. As a performance enhancement, label dimensions are
+         * cached from 1.3.12 onwards. The cache is cleared when you change the label text, of course, but
+         * there are other reasons why the text dimensions might change - if you make a change through CSS, for
+         * example, you might change the font size.  in that case you should explicitly call this method.
+         */
+        clearCachedDimensions: function () {
+            this._jsPlumb.cachedDimensions = null;
+        },
+        cleanup: function (force) {
+            if (force) {
+                if (this._jsPlumb.div != null) {
+                    this._jsPlumb.div._jsPlumb = null;
+                    this._jsPlumb.instance.removeElement(this._jsPlumb.div);
+                }
+            }
+            else {
+                // if not a forced cleanup, just detach child from parent for now.
+                if (this._jsPlumb && this._jsPlumb.div && this._jsPlumb.div.parentNode) {
+                    this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div);
+                }
+                this.detached = true;
+            }
+
+        },
+        reattach:function(instance, component) {
+            if (this._jsPlumb.div != null) {
+                instance.getContainer().appendChild(this._jsPlumb.div);
+            }
+            this.detached = false;
+        },
+        computeMaxSize: function () {
+            var td = _getDimensions(this);
+            return Math.max(td[0], td[1]);
+        },
+        paint: function (p, containerExtents) {
+            if (!this._jsPlumb.initialised) {
+                this.getElement();
+                p.component.appendDisplayElement(this._jsPlumb.div);
+                this._jsPlumb.initialised = true;
+                if (this.detached) {
+                    this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div);
+                }
+            }
+            this._jsPlumb.div.style.left = (p.component.x + p.d.minx) + "px";
+            this._jsPlumb.div.style.top = (p.component.y + p.d.miny) + "px";
+        }
+    });
+
+    /*
+     * Class: Overlays.Custom
+     * A Custom overlay. You supply a 'create' function which returns some DOM element, and jsPlumb positions it.
+     * The 'create' function is passed a Connection or Endpoint.
+     */
+    /*
+     * Function: Constructor
+     * 
+     * Parameters:
+     * create - function for jsPlumb to call that returns a DOM element.
+     * location - distance (as a decimal from 0 to 1 inclusive) marking where the label should sit on the connector. defaults to 0.5.
+     * id - optional id to use for later retrieval of this overlay.
+     *
+     */
+    _jp.Overlays.Custom = function (params) {
+        this.type = "Custom";
+        AbstractDOMOverlay.apply(this, arguments);
+    };
+    _ju.extend(_jp.Overlays.Custom, AbstractDOMOverlay);
+
+    _jp.Overlays.GuideLines = function () {
+        var self = this;
+        self.length = 50;
+        self.strokeWidth = 5;
+        this.type = "GuideLines";
+        AbstractOverlay.apply(this, arguments);
+        _jp.jsPlumbUIComponent.apply(this, arguments);
+        this.draw = function (connector, currentConnectionPaintStyle) {
+
+            var head = connector.pointAlongPathFrom(self.loc, self.length / 2),
+                mid = connector.pointOnPath(self.loc),
+                tail = _jg.pointOnLine(head, mid, self.length),
+                tailLine = _jg.perpendicularLineTo(head, tail, 40),
+                headLine = _jg.perpendicularLineTo(tail, head, 20);
+
+            return {
+                connector: connector,
+                head: head,
+                tail: tail,
+                headLine: headLine,
+                tailLine: tailLine,
+                minX: Math.min(head.x, tail.x, headLine[0].x, headLine[1].x),
+                minY: Math.min(head.y, tail.y, headLine[0].y, headLine[1].y),
+                maxX: Math.max(head.x, tail.x, headLine[0].x, headLine[1].x),
+                maxY: Math.max(head.y, tail.y, headLine[0].y, headLine[1].y)
+            };
+        };
+
+        // this.cleanup = function() { };  // nothing to clean up for GuideLines
+    };
+
+    /*
+     * Class: Overlays.Label
+
+     */
+    /*
+     * Function: Constructor
+     * 
+     * Parameters:
+     * cssClass - optional css class string to append to css class. This string is appended "as-is", so you can of course have multiple classes
+     *             defined.  This parameter is preferred to using labelStyle, borderWidth and borderStyle.
+     * label - the label to paint.  May be a string or a function that returns a string.  Nothing will be painted if your label is null or your
+     *         label function returns null.  empty strings _will_ be painted.
+     * location - distance (as a decimal from 0 to 1 inclusive) marking where the label should sit on the connector. defaults to 0.5.
+     * id - optional id to use for later retrieval of this overlay.
+     * 
+     *
+     */
+    _jp.Overlays.Label = function (params) {
+        this.labelStyle = params.labelStyle;
+
+        var labelWidth = null, labelHeight = null, labelText = null, labelPadding = null;
+        this.cssClass = this.labelStyle != null ? this.labelStyle.cssClass : null;
+        var p = _jp.extend({
+            create: function () {
+                return _jp.createElement("div");
+            }}, params);
+        _jp.Overlays.Custom.call(this, p);
+        this.type = "Label";
+        this.label = params.label || "";
+        this.labelText = null;
+        if (this.labelStyle) {
+            var el = this.getElement();
+            this.labelStyle.font = this.labelStyle.font || "12px sans-serif";
+            el.style.font = this.labelStyle.font;
+            el.style.color = this.labelStyle.color || "black";
+            if (this.labelStyle.fill) {
+                el.style.background = this.labelStyle.fill;
+            }
+            if (this.labelStyle.borderWidth > 0) {
+                var dStyle = this.labelStyle.borderStyle ? this.labelStyle.borderStyle : "black";
+                el.style.border = this.labelStyle.borderWidth + "px solid " + dStyle;
+            }
+            if (this.labelStyle.padding) {
+                el.style.padding = this.labelStyle.padding;
+            }
+        }
+
+    };
+    _ju.extend(_jp.Overlays.Label, _jp.Overlays.Custom, {
+        cleanup: function (force) {
+            if (force) {
+                this.div = null;
+                this.label = null;
+                this.labelText = null;
+                this.cssClass = null;
+                this.labelStyle = null;
+            }
+        },
+        getLabel: function () {
+            return this.label;
+        },
+        /*
+         * Function: setLabel
+         * sets the label's, um, label.  you would think i'd call this function
+         * 'setText', but you can pass either a Function or a String to this, so
+         * it makes more sense as 'setLabel'. This uses innerHTML on the label div, so keep
+         * that in mind if you need escaped HTML.
+         */
+        setLabel: function (l) {
+            this.label = l;
+            this.labelText = null;
+            this.clearCachedDimensions();
+            this.update();
+            this.component.repaint();
+        },
+        getDimensions: function () {
+            this.update();
+            return AbstractDOMOverlay.prototype.getDimensions.apply(this, arguments);
+        },
+        update: function () {
+            if (typeof this.label === "function") {
+                var lt = this.label(this);
+                this.getElement().innerHTML = lt.replace(/\r\n/g, "<br/>");
+            }
+            else {
+                if (this.labelText == null) {
+                    this.labelText = this.label;
+                    this.getElement().innerHTML = this.labelText.replace(/\r\n/g, "<br/>");
+                }
+            }
+        },
+        updateFrom:function(d) {
+            if(d.label != null){
+                this.setLabel(d.label);
+            }
+        }
+    });
+
+    // ********************************* END OF OVERLAY DEFINITIONS ***********************************************************************
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the base class for library adapters.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;(function() {
+    "use strict";
+    var root = this,
+        _jp = root.jsPlumb;
+
+    var _getEventManager = function(instance) {
+        var e = instance._mottle;
+        if (!e) {
+            e = instance._mottle = new root.Mottle();
+        }
+        return e;
+    };
+
+    _jp.extend(root.jsPlumbInstance.prototype, {
+        getEventManager:function() {
+            return _getEventManager(this);
+        },
+        on : function(el, event, callback) {
+            // TODO: here we would like to map the tap event if we know its
+            // an internal bind to a click. we have to know its internal because only
+            // then can we be sure that the UP event wont be consumed (tap is a synthesized
+            // event from a mousedown followed by a mouseup).
+            //event = { "click":"tap", "dblclick":"dbltap"}[event] || event;
+            this.getEventManager().on.apply(this, arguments);
+            return this;
+        },
+        off : function(el, event, callback) {
+            this.getEventManager().off.apply(this, arguments);
+            return this;
+        }
+    });
+
+
+}).call(typeof window !== 'undefined' ? window : this);
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the code for working with Groups.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;(function() {
+    "use strict";
+
+    var root = this,
+        _ju = root.jsPlumbUtil,
+        _jpi = root.jsPlumbInstance;
+
+    var GROUP_COLLAPSED_CLASS = "jtk-group-collapsed";
+    var GROUP_EXPANDED_CLASS = "jtk-group-expanded";
+    var GROUP_CONTAINER_SELECTOR = "[jtk-group-content]";
+    var ELEMENT_DRAGGABLE_EVENT = "elementDraggable";
+    var STOP = "stop";
+    var REVERT = "revert";
+    var GROUP_MANAGER = "_groupManager";
+    var GROUP = "_jsPlumbGroup";
+    var GROUP_DRAG_SCOPE = "_jsPlumbGroupDrag";
+    var EVT_CHILD_ADDED = "group:addMember";
+    var EVT_CHILD_REMOVED = "group:removeMember";
+    var EVT_GROUP_ADDED = "group:add";
+    var EVT_GROUP_REMOVED = "group:remove";
+    var EVT_EXPAND = "group:expand";
+    var EVT_COLLAPSE = "group:collapse";
+    var EVT_GROUP_DRAG_STOP = "groupDragStop";
+    var EVT_CONNECTION_MOVED = "connectionMoved";
+    var EVT_INTERNAL_CONNECTION_DETACHED = "internal.connectionDetached";
+
+    var CMD_REMOVE_ALL = "removeAll";
+    var CMD_ORPHAN_ALL = "orphanAll";
+    var CMD_SHOW = "show";
+    var CMD_HIDE = "hide";
+
+    var GroupManager = function(_jsPlumb) {
+        var _managedGroups = {}, _connectionSourceMap = {}, _connectionTargetMap = {}, self = this;
+
+        _jsPlumb.bind("connection", function(p) {
+            if (p.source[GROUP] != null && p.target[GROUP] != null && p.source[GROUP] === p.target[GROUP]) {
+                _connectionSourceMap[p.connection.id] = p.source[GROUP];
+                _connectionTargetMap[p.connection.id] = p.source[GROUP];
+            }
+            else {
+                if (p.source[GROUP] != null) {
+                    _ju.suggest(p.source[GROUP].connections.source, p.connection);
+                    _connectionSourceMap[p.connection.id] = p.source[GROUP];
+                }
+                if (p.target[GROUP] != null) {
+                    _ju.suggest(p.target[GROUP].connections.target, p.connection);
+                    _connectionTargetMap[p.connection.id] = p.target[GROUP];
+                }
+            }
+        });
+
+        function _cleanupDetachedConnection(conn) {
+            delete conn.proxies;
+            var group = _connectionSourceMap[conn.id], f;
+            if (group != null) {
+                f = function(c) { return c.id === conn.id; };
+                _ju.removeWithFunction(group.connections.source, f);
+                _ju.removeWithFunction(group.connections.target, f);
+                delete _connectionSourceMap[conn.id];
+            }
+
+            group = _connectionTargetMap[conn.id];
+            if (group != null) {
+                f = function(c) { return c.id === conn.id; };
+                _ju.removeWithFunction(group.connections.source, f);
+                _ju.removeWithFunction(group.connections.target, f);
+                delete _connectionTargetMap[conn.id];
+            }
+        }
+
+        _jsPlumb.bind(EVT_INTERNAL_CONNECTION_DETACHED, function(p) {
+            _cleanupDetachedConnection(p.connection);
+        });
+
+        _jsPlumb.bind(EVT_CONNECTION_MOVED, function(p) {
+            var connMap = p.index === 0 ? _connectionSourceMap : _connectionTargetMap;
+            var group = connMap[p.connection.id];
+            if (group) {
+                var list = group.connections[p.index === 0 ? "source" : "target"];
+                var idx = list.indexOf(p.connection);
+                if (idx !== -1) {
+                    list.splice(idx, 1);
+                }
+            }
+        });
+
+        this.addGroup = function(group) {
+            _jsPlumb.addClass(group.getEl(), GROUP_EXPANDED_CLASS);
+            _managedGroups[group.id] = group;
+            group.manager = this;
+            _updateConnectionsForGroup(group);
+            _jsPlumb.fire(EVT_GROUP_ADDED, { group:group });
+        };
+
+        this.addToGroup = function(group, el, doNotFireEvent) {
+            group = this.getGroup(group);
+            if (group) {
+                //group.add(el, doNotFireEvent);
+                var groupEl = group.getEl();
+
+                if (el._isJsPlumbGroup) {
+                    return;
+                }
+                var currentGroup = el._jsPlumbGroup;
+                // if already a member of this group, do nothing
+                if (currentGroup !== group) {
+                    var elpos = _jsPlumb.getOffset(el, true);
+                    var cpos = group.collapsed ? _jsPlumb.getOffset(groupEl, true) : _jsPlumb.getOffset(group.getDragArea(), true);
+
+                    // otherwise, transfer to this group.
+                    if (currentGroup != null) {
+                        currentGroup.remove(el, doNotFireEvent);
+                        self.updateConnectionsForGroup(currentGroup);
+                    }
+                    group.add(el, doNotFireEvent);
+
+                    var handleDroppedConnections = function (list, index) {
+                        var oidx = index === 0 ? 1 : 0;
+                        list.each(function (c) {
+                            c.setVisible(false);
+                            if (c.endpoints[oidx].element._jsPlumbGroup === group) {
+                                c.endpoints[oidx].setVisible(false);
+                                self.expandConnection(c, oidx, group);
+                            }
+                            else {
+                                c.endpoints[index].setVisible(false);
+                                self.collapseConnection(c, index, group);
+                            }
+                        });
+                    };
+
+                    if (group.collapsed) {
+                        handleDroppedConnections(_jsPlumb.select({source: el}), 0);
+                        handleDroppedConnections(_jsPlumb.select({target: el}), 1);
+                    }
+
+                    var elId = _jsPlumb.getId(el);
+                    _jsPlumb.dragManager.setParent(el, elId, groupEl, _jsPlumb.getId(groupEl), elpos);
+
+                    var newPosition = { left: elpos.left - cpos.left, top: elpos.top - cpos.top };
+
+                    _jsPlumb.setPosition(el, newPosition);
+
+                    _jsPlumb.dragManager.revalidateParent(el, elId, elpos);
+
+                    self.updateConnectionsForGroup(group);
+
+                    _jsPlumb.revalidate(elId);
+
+                    setTimeout(function () {
+                        _jsPlumb.fire(EVT_CHILD_ADDED, {group: group, el: el});
+                    }, 0);
+                }
+            }
+        };
+
+        this.removeFromGroup = function(group, el, doNotFireEvent) {
+            group = this.getGroup(group);
+            if (group) {
+                group.remove(el, null, doNotFireEvent);
+            }
+        };
+
+        this.getGroup = function(groupId) {
+            var group = groupId;
+            if (_ju.isString(groupId)) {
+                group = _managedGroups[groupId];
+                if (group == null) {
+                    throw new TypeError("No such group [" + groupId + "]");
+                }
+            }
+            return group;
+        };
+
+        this.getGroups = function() {
+            var o = [];
+            for (var g in _managedGroups) {
+                o.push(_managedGroups[g]);
+            }
+            return o;
+        };
+
+        this.removeGroup = function(group, deleteMembers, manipulateDOM, doNotFireEvent) {
+            group = this.getGroup(group);
+            this.expandGroup(group, true); // this reinstates any original connections and removes all proxies, but does not fire an event.
+            group[deleteMembers ? CMD_REMOVE_ALL : CMD_ORPHAN_ALL](manipulateDOM, doNotFireEvent);
+            _jsPlumb.remove(group.getEl());
+            delete _managedGroups[group.id];
+            delete _jsPlumb._groups[group.id];
+            _jsPlumb.fire(EVT_GROUP_REMOVED, { group:group });
+        };
+
+        this.removeAllGroups = function(deleteMembers, manipulateDOM, doNotFireEvent) {
+            for (var g in _managedGroups) {
+                this.removeGroup(_managedGroups[g], deleteMembers, manipulateDOM, doNotFireEvent);
+            }
+        };
+
+        function _setVisible(group, state) {
+            var m = group.getMembers();
+            for (var i = 0; i < m.length; i++) {
+                _jsPlumb[state ? CMD_SHOW : CMD_HIDE](m[i], true);
+            }
+        }
+
+        var _collapseConnection = this.collapseConnection = function(c, index, group) {
+
+            var proxyEp, groupEl = group.getEl(), groupElId = _jsPlumb.getId(groupEl),
+                originalElementId = c.endpoints[index].elementId;
+
+            var otherEl = c.endpoints[index === 0 ? 1 : 0].element;
+            if (otherEl[GROUP] && (!otherEl[GROUP].shouldProxy() && otherEl[GROUP].collapsed)) {
+                return;
+            }
+
+            c.proxies = c.proxies || [];
+            if(c.proxies[index]) {
+                proxyEp = c.proxies[index].ep;
+            }else {
+                proxyEp = _jsPlumb.addEndpoint(groupEl, {
+                    endpoint:group.getEndpoint(c, index),
+                    anchor:group.getAnchor(c, index),
+                    parameters:{
+                        isProxyEndpoint:true
+                    }
+                });
+            }
+            proxyEp.setDeleteOnEmpty(true);
+
+            // for this index, stash proxy info: the new EP, the original EP.
+            c.proxies[index] = { ep:proxyEp, originalEp: c.endpoints[index] };
+
+            // and advise the anchor manager
+            if (index === 0) {
+                // TODO why are there two differently named methods? Why is there not one method that says "some end of this
+                // connection changed (you give the index), and here's the new element and element id."
+                _jsPlumb.anchorManager.sourceChanged(originalElementId, groupElId, c, groupEl);
+            }
+            else {
+                _jsPlumb.anchorManager.updateOtherEndpoint(c.endpoints[0].elementId, originalElementId, groupElId, c);
+                c.target = groupEl;
+                c.targetId = groupElId;
+            }
+
+
+            // detach the original EP from the connection.
+            c.proxies[index].originalEp.detachFromConnection(c, null, true);
+
+            // set the proxy as the new ep
+            proxyEp.connections = [ c ];
+            c.endpoints[index] = proxyEp;
+
+            c.setVisible(true);
+        };
+
+        this.collapseGroup = function(group) {
+            group = this.getGroup(group);
+            if (group == null || group.collapsed) {
+                return;
+            }
+            var groupEl = group.getEl();
+
+            // todo remove old proxy endpoints first, just in case?
+            //group.proxies.length = 0;
+
+            // hide all connections
+            _setVisible(group, false);
+
+            if (group.shouldProxy()) {
+                // collapses all connections in a group.
+                var _collapseSet = function (conns, index) {
+                    for (var i = 0; i < conns.length; i++) {
+                        var c = conns[i];
+                        _collapseConnection(c, index, group);
+                    }
+                };
+
+                // setup proxies for sources and targets
+                _collapseSet(group.connections.source, 0);
+                _collapseSet(group.connections.target, 1);
+            }
+
+            group.collapsed = true;
+            _jsPlumb.removeClass(groupEl, GROUP_EXPANDED_CLASS);
+            _jsPlumb.addClass(groupEl, GROUP_COLLAPSED_CLASS);
+            _jsPlumb.revalidate(groupEl);
+            _jsPlumb.fire(EVT_COLLAPSE, { group:group  });
+        };
+
+        var _expandConnection = this.expandConnection = function(c, index, group) {
+
+            // if no proxies or none for this end of the connection, abort.
+            if (c.proxies == null || c.proxies[index] == null) {
+                return;
+            }
+
+            var groupElId = _jsPlumb.getId(group.getEl()),
+                originalElement = c.proxies[index].originalEp.element,
+                originalElementId = c.proxies[index].originalEp.elementId;
+
+            c.endpoints[index] = c.proxies[index].originalEp;
+            // and advise the anchor manager
+            if (index === 0) {
+                // TODO why are there two differently named methods? Why is there not one method that says "some end of this
+                // connection changed (you give the index), and here's the new element and element id."
+                _jsPlumb.anchorManager.sourceChanged(groupElId, originalElementId, c, originalElement);
+            }
+            else {
+                _jsPlumb.anchorManager.updateOtherEndpoint(c.endpoints[0].elementId, groupElId, originalElementId, c);
+                c.target = originalElement;
+                c.targetId = originalElementId;
+            }
+
+            // detach the proxy EP from the connection (which will cause it to be removed as we no longer need it)
+            c.proxies[index].ep.detachFromConnection(c, null);
+
+            c.proxies[index].originalEp.addConnection(c);
+
+            // cleanup
+            delete c.proxies[index];
+        };
+
+        this.expandGroup = function(group, doNotFireEvent) {
+
+            group = this.getGroup(group);
+
+            if (group == null || !group.collapsed) {
+                return;
+            }
+            var groupEl = group.getEl();
+
+            _setVisible(group, true);
+
+            if (group.shouldProxy()) {
+                // collapses all connections in a group.
+                var _expandSet = function (conns, index) {
+                    for (var i = 0; i < conns.length; i++) {
+                        var c = conns[i];
+                        _expandConnection(c, index, group);
+                    }
+                };
+
+                // setup proxies for sources and targets
+                _expandSet(group.connections.source, 0);
+                _expandSet(group.connections.target, 1);
+            }
+
+            group.collapsed = false;
+            _jsPlumb.addClass(groupEl, GROUP_EXPANDED_CLASS);
+            _jsPlumb.removeClass(groupEl, GROUP_COLLAPSED_CLASS);
+            _jsPlumb.revalidate(groupEl);
+            this.repaintGroup(group);
+            if (!doNotFireEvent) {
+                _jsPlumb.fire(EVT_EXPAND, { group: group});
+            }
+        };
+
+        this.repaintGroup = function(group) {
+            group = this.getGroup(group);
+            var m = group.getMembers();
+            for (var i = 0; i < m.length; i++) {
+                _jsPlumb.revalidate(m[i]);
+            }
+        };
+
+        // TODO refactor this with the code that responds to `connection` events.
+        function _updateConnectionsForGroup(group) {
+            var members = group.getMembers();
+            var c1 = _jsPlumb.getConnections({source:members}, true);
+            var c2 = _jsPlumb.getConnections({target:members}, true);
+            var processed = {};
+            group.connections.source.length = 0;
+            group.connections.target.length = 0;
+            var oneSet = function(c) {
+                for (var i = 0; i < c.length; i++) {
+                    if (processed[c[i].id]) {
+                        continue;
+                    }
+                    processed[c[i].id] = true;
+                    if (c[i].source._jsPlumbGroup === group) {
+                        if (c[i].target._jsPlumbGroup !== group) {
+                            group.connections.source.push(c[i]);
+                        }
+                        _connectionSourceMap[c[i].id] = group;
+                    }
+                    else if (c[i].target._jsPlumbGroup === group) {
+                        group.connections.target.push(c[i]);
+                        _connectionTargetMap[c[i].id] = group;
+                    }
+                }
+            };
+            oneSet(c1); oneSet(c2);
+        }
+
+        this.updateConnectionsForGroup = _updateConnectionsForGroup;
+        this.refreshAllGroups = function() {
+            for (var g in _managedGroups) {
+                _updateConnectionsForGroup(_managedGroups[g]);
+                _jsPlumb.dragManager.updateOffsets(_jsPlumb.getId(_managedGroups[g].getEl()));
+            }
+        };
+    };
+
+    /**
+     *
+     * @param {jsPlumbInstance} _jsPlumb Associated jsPlumb instance.
+     * @param {Object} params
+     * @param {Element} params.el The DOM element representing the Group.
+     * @param {String} [params.id] Optional ID for the Group. A UUID will be assigned as the Group's ID if you do not provide one.
+     * @param {Boolean} [params.constrain=false] If true, child elements will not be able to be dragged outside of the Group container.
+     * @param {Boolean} [params.revert=true] By default, child elements revert to the container if dragged outside. You can change this by setting `revert:false`. This behaviour is also overridden if you set `orphan` or `prune`.
+     * @param {Boolean} [params.orphan=false] If true, child elements dropped outside of the Group container will be removed from the Group (but not from the DOM).
+     * @param {Boolean} [params.prune=false] If true, child elements dropped outside of the Group container will be removed from the Group and also from the DOM.
+     * @param {Boolean} [params.dropOverride=false] If true, a child element that has been dropped onto some other Group will not be subject to the controls imposed by `prune`, `revert` or `orphan`.
+     * @constructor
+     */
+    var Group = function(_jsPlumb, params) {
+        var self = this;
+        var el = params.el;
+        this.getEl = function() { return el; };
+        this.id = params.id || _ju.uuid();
+        el._isJsPlumbGroup = true;
+
+        var getDragArea = this.getDragArea = function() {
+            var da = _jsPlumb.getSelector(el, GROUP_CONTAINER_SELECTOR);
+            return da && da.length > 0 ? da[0] : el;
+        };
+
+        var ghost = params.ghost === true;
+        var constrain = ghost || (params.constrain === true);
+        var revert = params.revert !== false;
+        var orphan = params.orphan === true;
+        var prune = params.prune === true;
+        var dropOverride = params.dropOverride === true;
+        var proxied = params.proxied !== false;
+        var elements = [];
+        this.connections = { source:[], target:[], internal:[] };
+
+        // this function, and getEndpoint below, are stubs for a future setup in which we can choose endpoint
+        // and anchor based upon the connection and the index (source/target) of the endpoint to be proxied.
+        this.getAnchor = function(conn, endpointIndex) {
+            return params.anchor || "Continuous";
+        };
+
+        this.getEndpoint = function(conn, endpointIndex) {
+            return params.endpoint || [ "Dot", { radius:10 }];
+        };
+
+        this.collapsed = false;
+        if (params.draggable !== false) {
+            var opts = {
+                stop:function(params) {
+                    _jsPlumb.fire(EVT_GROUP_DRAG_STOP, jsPlumb.extend(params, {group:self}));
+                },
+                scope:GROUP_DRAG_SCOPE
+            };
+            if (params.dragOptions) {
+                root.jsPlumb.extend(opts, params.dragOptions);
+            }
+            _jsPlumb.draggable(params.el, opts);
+        }
+        if (params.droppable !== false) {
+            _jsPlumb.droppable(params.el, {
+                drop:function(p) {
+                    var el = p.drag.el;
+                    if (el._isJsPlumbGroup) {
+                        return;
+                    }
+                    var currentGroup = el._jsPlumbGroup;
+                    if (currentGroup !== self) {
+                        if (currentGroup != null) {
+                            if (currentGroup.overrideDrop(el, self)) {
+                                return;
+                            }
+                        }
+                        _jsPlumb.getGroupManager().addToGroup(self, el, false);
+                    }
+
+                }
+            });
+        }
+        var _each = function(_el, fn) {
+            var els = _el.nodeType == null ?  _el : [ _el ];
+            for (var i = 0; i < els.length; i++) {
+                fn(els[i]);
+            }
+        };
+
+        this.overrideDrop = function(_el, targetGroup) {
+            return dropOverride && (revert || prune || orphan);
+        };
+
+        this.add = function(_el, doNotFireEvent) {
+            var dragArea = getDragArea();
+            _each(_el, function(__el) {
+
+                if (__el._jsPlumbGroup != null) {
+                    if (__el._jsPlumbGroup === self) {
+                        return;
+                    } else {
+                        __el._jsPlumbGroup.remove(__el, true, doNotFireEvent, false);
+                    }
+                }
+
+                __el._jsPlumbGroup = self;
+                elements.push(__el);
+                // test if draggable and add handlers if so.
+                if (_jsPlumb.isAlreadyDraggable(__el)) {
+                    _bindDragHandlers(__el);
+                }
+
+                if (__el.parentNode !== dragArea) {
+                    dragArea.appendChild(__el);
+                }
+
+                if (!doNotFireEvent) {
+                    _jsPlumb.fire(EVT_CHILD_ADDED, {group: self, el: __el});
+                }
+            });
+
+            _jsPlumb.getGroupManager().updateConnectionsForGroup(self);
+        };
+
+        this.remove = function(el, manipulateDOM, doNotFireEvent, doNotUpdateConnections) {
+
+            _each(el, function(__el) {
+                delete __el._jsPlumbGroup;
+                _ju.removeWithFunction(elements, function(e) {
+                    return e === __el;
+                });
+
+                if (manipulateDOM) {
+                    try { self.getDragArea().removeChild(__el); }
+                    catch (e) {
+                        jsPlumbUtil.log("Could not remove element from Group " + e);
+                    }
+                }
+                _unbindDragHandlers(__el);
+                if (!doNotFireEvent) {
+                    _jsPlumb.fire(EVT_CHILD_REMOVED, {group: self, el: __el});
+                }
+            });
+            if (!doNotUpdateConnections) {
+                _jsPlumb.getGroupManager().updateConnectionsForGroup(self);
+            }
+        };
+        this.removeAll = function(manipulateDOM, doNotFireEvent) {
+            for (var i = 0, l = elements.length; i < l; i++) {
+                self.remove(elements[0], manipulateDOM, doNotFireEvent, true);
+            }
+            elements.length = 0;
+            _jsPlumb.getGroupManager().updateConnectionsForGroup(self);
+        };
+        this.orphanAll = function() {
+            for (var i = 0; i < elements.length; i++) {
+                _orphan(elements[i]);
+            }
+            elements.length = 0;
+        };
+        this.getMembers = function() { return elements; };
+
+        el[GROUP] = this;
+
+        _jsPlumb.bind(ELEMENT_DRAGGABLE_EVENT, function(dragParams) {
+            // if its for the current group,
+            if (dragParams.el._jsPlumbGroup === this) {
+                _bindDragHandlers(dragParams.el);
+            }
+        }.bind(this));
+
+        function _findParent(_el) {
+            return _el.offsetParent;
+        }
+
+        function _isInsideParent(_el, pos) {
+            var p = _findParent(_el),
+                s = _jsPlumb.getSize(p),
+                ss = _jsPlumb.getSize(_el),
+                leftEdge = pos[0],
+                rightEdge = leftEdge + ss[0],
+                topEdge = pos[1],
+                bottomEdge = topEdge + ss[1];
+
+            return rightEdge > 0 && leftEdge < s[0] && bottomEdge > 0 && topEdge < s[1];
+        }
+
+        //
+        // orphaning an element means taking it out of the group and adding it to the main jsplumb container.
+        //
+        function _orphan(_el) {
+            var id = _jsPlumb.getId(_el);
+            var pos = _jsPlumb.getOffset(_el);
+            _el.parentNode.removeChild(_el);
+            _jsPlumb.getContainer().appendChild(_el);
+            _jsPlumb.setPosition(_el, pos);
+            delete _el._jsPlumbGroup;
+            _unbindDragHandlers(_el);
+            _jsPlumb.dragManager.clearParent(_el, id);
+        }
+
+        //
+        // remove an element from the group, then either prune it from the jsplumb instance, or just orphan it.
+        //
+        function _pruneOrOrphan(p) {
+            if (!_isInsideParent(p.el, p.pos)) {
+                var group = p.el._jsPlumbGroup;
+                if (prune) {
+                    _jsPlumb.remove(p.el);
+                } else {
+                    _orphan(p.el);
+                }
+
+                group.remove(p.el);
+            }
+        }
+
+        //
+        // redraws the element
+        //
+        function _revalidate(_el) {
+            var id = _jsPlumb.getId(_el);
+            _jsPlumb.revalidate(_el);
+            _jsPlumb.dragManager.revalidateParent(_el, id);
+        }
+
+        //
+        // unbind the group specific drag/revert handlers.
+        //
+        function _unbindDragHandlers(_el) {
+            if (!_el._katavorioDrag) {
+                return;
+            }
+            if (prune || orphan) {
+                _el._katavorioDrag.off(STOP, _pruneOrOrphan);
+            }
+            if (!prune && !orphan && revert) {
+                _el._katavorioDrag.off(REVERT, _revalidate);
+                _el._katavorioDrag.setRevert(null);
+            }
+        }
+
+        function _bindDragHandlers(_el) {
+            if (!_el._katavorioDrag) {
+                return;
+            }
+            if (prune || orphan) {
+                _el._katavorioDrag.on(STOP, _pruneOrOrphan);
+            }
+
+            if (constrain) {
+                _el._katavorioDrag.setConstrain(true);
+            }
+
+            if (ghost) {
+                _el._katavorioDrag.setUseGhostProxy(true);
+            }
+
+            if (!prune && !orphan && revert) {
+                _el._katavorioDrag.on(REVERT, _revalidate);
+                _el._katavorioDrag.setRevert(function(__el, pos) {
+                    return !_isInsideParent(__el, pos);
+                });
+            }
+        }
+
+        this.shouldProxy = function() {
+            return proxied;
+        };
+
+        _jsPlumb.getGroupManager().addGroup(this);
+    };
+
+    /**
+     * Adds a group to the jsPlumb instance.
+     * @method addGroup
+     * @param {Object} params
+     * @return {Group} The newly created Group.
+     */
+    _jpi.prototype.addGroup = function(params) {
+        var j = this;
+        j._groups = j._groups || {};
+        if (j._groups[params.id] != null) {
+            throw new TypeError("cannot create Group [" + params.id + "]; a Group with that ID exists");
+        }
+        if (params.el[GROUP] != null) {
+            throw new TypeError("cannot create Group [" + params.id + "]; the given element is already a Group");
+        }
+        var group = new Group(j, params);
+        j._groups[group.id] = group;
+        if (params.collapsed) {
+            this.collapseGroup(group);
+        }
+        return group;
+    };
+
+    /**
+     * Add an element to a group.
+     * @method addToGroup
+     * @param {String} group Group, or ID of the group, to add the element to.
+     * @param {Element} el Element to add to the group.
+     */
+    _jpi.prototype.addToGroup = function(group, el, doNotFireEvent) {
+
+        var _one = function(_el) {
+            var id = this.getId(_el);
+            this.manage(id, _el);
+            this.getGroupManager().addToGroup(group, _el, doNotFireEvent);
+        }.bind(this);
+
+        if (Array.isArray(el)) {
+            for (var i = 0; i < el.length; i++) {
+                _one(el[i]);
+            }
+        } else {
+            _one(el);
+        }
+    };
+
+    /**
+     * Remove an element from a group.
+     * @method removeFromGroup
+     * @param {String} group Group, or ID of the group, to remove the element from.
+     * @param {Element} el Element to add to the group.
+     */
+    _jpi.prototype.removeFromGroup = function(group, el, doNotFireEvent) {
+        this.getGroupManager().removeFromGroup(group, el, doNotFireEvent);
+    };
+
+    /**
+     * Remove a group, and optionally remove its members from the jsPlumb instance.
+     * @method removeGroup
+     * @param {String|Group} group Group to delete, or ID of Group to delete.
+     * @param {Boolean} [deleteMembers=false] If true, group members will be removed along with the group. Otherwise they will
+     * just be 'orphaned' (returned to the main container).
+     */
+    _jpi.prototype.removeGroup = function(group, deleteMembers, manipulateDOM, doNotFireEvent) {
+        this.getGroupManager().removeGroup(group, deleteMembers, manipulateDOM, doNotFireEvent);
+    };
+
+    /**
+     * Remove all groups, and optionally remove their members from the jsPlumb instance.
+     * @method removeAllGroup
+     * @param {Boolean} [deleteMembers=false] If true, group members will be removed along with the groups. Otherwise they will
+     * just be 'orphaned' (returned to the main container).
+     */
+    _jpi.prototype.removeAllGroups = function(deleteMembers, manipulateDOM, doNotFireEvent) {
+        this.getGroupManager().removeAllGroups(deleteMembers, manipulateDOM, doNotFireEvent);
+    };
+
+    /**
+     * Get a Group
+     * @method getGroup
+     * @param {String} groupId ID of the group to get
+     * @return {Group} Group with the given ID, null if not found.
+     */
+    _jpi.prototype.getGroup = function(groupId) {
+        return this.getGroupManager().getGroup(groupId);
+    };
+
+    /**
+     * Gets all the Groups managed by the jsPlumb instance.
+     * @returns {Group[]} List of Groups. Empty if none.
+     */
+    _jpi.prototype.getGroups = function() {
+        return this.getGroupManager().getGroups();
+    };
+
+    /**
+     * Expands a group element. jsPlumb doesn't do "everything" for you here, because what it means to expand a Group
+     * will vary from application to application. jsPlumb does these things:
+     *
+     * - Hides any connections that are internal to the group (connections between members, and connections from member of
+     * the group to the group itself)
+     * - Proxies all connections for which the source or target is a member of the group.
+     * - Hides the proxied connections.
+     * - Adds the jtk-group-expanded class to the group's element
+     * - Removes the jtk-group-collapsed class from the group's element.
+     *
+     * @method expandGroup
+     * @param {String|Group} group Group to expand, or ID of Group to expand.
+     */
+    _jpi.prototype.expandGroup = function(group) {
+        this.getGroupManager().expandGroup(group);
+    };
+
+    /**
+     * Collapses a group element. jsPlumb doesn't do "everything" for you here, because what it means to collapse a Group
+     * will vary from application to application. jsPlumb does these things:
+     *
+     * - Shows any connections that are internal to the group (connections between members, and connections from member of
+     * the group to the group itself)
+     * - Removes proxies for all connections for which the source or target is a member of the group.
+     * - Shows the previously proxied connections.
+     * - Adds the jtk-group-collapsed class to the group's element
+     * - Removes the jtk-group-expanded class from the group's element.
+     *
+     * @method expandGroup
+     * @param {String|Group} group Group to expand, or ID of Group to expand.
+     */
+    _jpi.prototype.collapseGroup = function(groupId) {
+        this.getGroupManager().collapseGroup(groupId);
+    };
+
+
+    _jpi.prototype.repaintGroup = function(group) {
+        this.getGroupManager().repaintGroup(group);
+    };
+
+    /**
+     * Collapses or expands a group element depending on its current state. See notes in the collapseGroup and expandGroup method.
+     *
+     * @method toggleGroup
+     * @param {String|Group} group Group to expand/collapse, or ID of Group to expand/collapse.
+     */
+    _jpi.prototype.toggleGroup = function(group) {
+        group = this.getGroupManager().getGroup(group);
+        if (group != null) {
+            this.getGroupManager()[group.collapsed ? "expandGroup" : "collapseGroup"](group);
+        }
+    };
+
+    //
+    // lazy init a group manager for the given jsplumb instance.
+    //
+    _jpi.prototype.getGroupManager = function() {
+        var mgr = this[GROUP_MANAGER];
+        if (mgr == null) {
+            mgr = this[GROUP_MANAGER] = new GroupManager(this);
+        }
+        return mgr;
+    };
+
+    _jpi.prototype.removeGroupManager = function() {
+        delete this[GROUP_MANAGER];
+    };
+
+    /**
+     * Gets the Group that the given element belongs to, null if none.
+     * @method getGroupFor
+     * @param {String|Element} el Element, or element ID.
+     * @returns {Group} A Group, if found, or null.
+     */
+    _jpi.prototype.getGroupFor = function(el) {
+        el = this.getElement(el);
+        if (el) {
+            return el[GROUP];
+        }
+    };
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+
+/*
+ * jsPlumb Community Edition
+ * 
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ * 
+ * This file contains the 'flowchart' connectors, consisting of vertical and horizontal line segments.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ * 
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+    "use strict";
+    var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+
+    var Flowchart = function (params) {
+        this.type = "Flowchart";
+        params = params || {};
+        params.stub = params.stub == null ? 30 : params.stub;
+        var segments,
+            _super = _jp.Connectors.AbstractConnector.apply(this, arguments),
+            midpoint = params.midpoint == null ? 0.5 : params.midpoint,
+            alwaysRespectStubs = params.alwaysRespectStubs === true,
+            lastx = null, lasty = null, lastOrientation,
+            cornerRadius = params.cornerRadius != null ? params.cornerRadius : 0,
+
+            // TODO now common between this and AbstractBezierEditor; refactor into superclass?
+            loopbackRadius = params.loopbackRadius || 25,
+            isLoopbackCurrently = false,
+
+            sgn = function (n) {
+                return n < 0 ? -1 : n === 0 ? 0 : 1;
+            },
+            /**
+             * helper method to add a segment.
+             */
+            addSegment = function (segments, x, y, paintInfo) {
+                if (lastx === x && lasty === y) {
+                    return;
+                }
+                var lx = lastx == null ? paintInfo.sx : lastx,
+                    ly = lasty == null ? paintInfo.sy : lasty,
+                    o = lx === x ? "v" : "h",
+                    sgnx = sgn(x - lx),
+                    sgny = sgn(y - ly);
+
+                lastx = x;
+                lasty = y;
+                segments.push([lx, ly, x, y, o, sgnx, sgny]);
+            },
+            segLength = function (s) {
+                return Math.sqrt(Math.pow(s[0] - s[2], 2) + Math.pow(s[1] - s[3], 2));
+            },
+            _cloneArray = function (a) {
+                var _a = [];
+                _a.push.apply(_a, a);
+                return _a;
+            },
+            writeSegments = function (conn, segments, paintInfo) {
+                var current = null, next;
+                for (var i = 0; i < segments.length - 1; i++) {
+
+                    current = current || _cloneArray(segments[i]);
+                    next = _cloneArray(segments[i + 1]);
+                    if (cornerRadius > 0 && current[4] !== next[4]) {
+                        var radiusToUse = Math.min(cornerRadius, segLength(current), segLength(next));
+                        // right angle. adjust current segment's end point, and next segment's start point.
+                        current[2] -= current[5] * radiusToUse;
+                        current[3] -= current[6] * radiusToUse;
+                        next[0] += next[5] * radiusToUse;
+                        next[1] += next[6] * radiusToUse;
+                        var ac = (current[6] === next[5] && next[5] === 1) ||
+                                ((current[6] === next[5] && next[5] === 0) && current[5] !== next[6]) ||
+                                (current[6] === next[5] && next[5] === -1),
+                            sgny = next[1] > current[3] ? 1 : -1,
+                            sgnx = next[0] > current[2] ? 1 : -1,
+                            sgnEqual = sgny === sgnx,
+                            cx = (sgnEqual && ac || (!sgnEqual && !ac)) ? next[0] : current[2],
+                            cy = (sgnEqual && ac || (!sgnEqual && !ac)) ? current[3] : next[1];
+
+                        _super.addSegment(conn, "Straight", {
+                            x1: current[0], y1: current[1], x2: current[2], y2: current[3]
+                        });
+
+                        _super.addSegment(conn, "Arc", {
+                            r: radiusToUse,
+                            x1: current[2],
+                            y1: current[3],
+                            x2: next[0],
+                            y2: next[1],
+                            cx: cx,
+                            cy: cy,
+                            ac: ac
+                        });
+                    }
+                    else {
+                        // dx + dy are used to adjust for line width.
+                        var dx = (current[2] === current[0]) ? 0 : (current[2] > current[0]) ? (paintInfo.lw / 2) : -(paintInfo.lw / 2),
+                            dy = (current[3] === current[1]) ? 0 : (current[3] > current[1]) ? (paintInfo.lw / 2) : -(paintInfo.lw / 2);
+                        _super.addSegment(conn, "Straight", {
+                            x1: current[0] - dx, y1: current[1] - dy, x2: current[2] + dx, y2: current[3] + dy
+                        });
+                    }
+                    current = next;
+                }
+                if (next != null) {
+                    // last segment
+                    _super.addSegment(conn, "Straight", {
+                        x1: next[0], y1: next[1], x2: next[2], y2: next[3]
+                    });
+                }
+            };
+
+        this._compute = function (paintInfo, params) {
+
+            segments = [];
+            lastx = null;
+            lasty = null;
+            lastOrientation = null;
+
+            var commonStubCalculator = function () {
+                return [ paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY ];
+            },
+                stubCalculators = {
+                    perpendicular: commonStubCalculator,
+                    orthogonal: commonStubCalculator,
+                    opposite: function (axis) {
+                        var pi = paintInfo,
+                            idx = axis === "x" ? 0 : 1,
+                            areInProximity = {
+                                "x": function () {
+                                    return ( (pi.so[idx] === 1 && (
+                                        ( (pi.startStubX > pi.endStubX) && (pi.tx > pi.startStubX) ) ||
+                                        ( (pi.sx > pi.endStubX) && (pi.tx > pi.sx))))) ||
+
+                                        ( (pi.so[idx] === -1 && (
+                                            ( (pi.startStubX < pi.endStubX) && (pi.tx < pi.startStubX) ) ||
+                                            ( (pi.sx < pi.endStubX) && (pi.tx < pi.sx)))));
+                                },
+                                "y": function () {
+                                    return ( (pi.so[idx] === 1 && (
+                                        ( (pi.startStubY > pi.endStubY) && (pi.ty > pi.startStubY) ) ||
+                                        ( (pi.sy > pi.endStubY) && (pi.ty > pi.sy))))) ||
+
+                                        ( (pi.so[idx] === -1 && (
+                                            ( (pi.startStubY < pi.endStubY) && (pi.ty < pi.startStubY) ) ||
+                                            ( (pi.sy < pi.endStubY) && (pi.ty < pi.sy)))));
+                                }
+                            };
+
+                        if (!alwaysRespectStubs && areInProximity[axis]()) {
+                            return {
+                                "x": [(paintInfo.sx + paintInfo.tx) / 2, paintInfo.startStubY, (paintInfo.sx + paintInfo.tx) / 2, paintInfo.endStubY],
+                                "y": [paintInfo.startStubX, (paintInfo.sy + paintInfo.ty) / 2, paintInfo.endStubX, (paintInfo.sy + paintInfo.ty) / 2]
+                            }[axis];
+                        }
+                        else {
+                            return [ paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY ];
+                        }
+                    }
+                };
+
+            // calculate Stubs.
+            var stubs = stubCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis),
+                idx = paintInfo.sourceAxis === "x" ? 0 : 1,
+                oidx = paintInfo.sourceAxis === "x" ? 1 : 0,
+                ss = stubs[idx],
+                oss = stubs[oidx],
+                es = stubs[idx + 2],
+                oes = stubs[oidx + 2];
+
+            // add the start stub segment. use stubs for loopback as it will look better, with the loop spaced
+            // away from the element.
+            addSegment(segments, stubs[0], stubs[1], paintInfo);
+
+            // if its a loopback and we should treat it differently.
+            if (false) {
+
+                // we use loopbackRadius here, as statemachine connectors do.
+                // so we go radius to the left from stubs[0], then upwards by 2*radius, to the right by 2*radius,
+                // down by 2*radius, left by radius.
+                addSegment(segments, stubs[0] - loopbackRadius, stubs[1], paintInfo);
+                addSegment(segments, stubs[0] - loopbackRadius, stubs[1] - (2 * loopbackRadius), paintInfo);
+                addSegment(segments, stubs[0] + loopbackRadius, stubs[1] - (2 * loopbackRadius), paintInfo);
+                addSegment(segments, stubs[0] + loopbackRadius, stubs[1], paintInfo);
+                addSegment(segments, stubs[0], stubs[1], paintInfo);
+
+            }
+            else {
+
+
+                var midx = paintInfo.startStubX + ((paintInfo.endStubX - paintInfo.startStubX) * midpoint),
+                    midy = paintInfo.startStubY + ((paintInfo.endStubY - paintInfo.startStubY) * midpoint);
+
+                var orientations = { x: [ 0, 1 ], y: [ 1, 0 ] },
+                    lineCalculators = {
+                        perpendicular: function (axis) {
+                            var pi = paintInfo,
+                                sis = {
+                                    x: [
+                                        [ [ 1, 2, 3, 4 ], null, [ 2, 1, 4, 3 ] ],
+                                        null,
+                                        [ [ 4, 3, 2, 1 ], null, [ 3, 4, 1, 2 ] ]
+                                    ],
+                                    y: [
+                                        [ [ 3, 2, 1, 4 ], null, [ 2, 3, 4, 1 ] ],
+                                        null,
+                                        [ [ 4, 1, 2, 3 ], null, [ 1, 4, 3, 2 ] ]
+                                    ]
+                                },
+                                stubs = {
+                                    x: [ [ pi.startStubX, pi.endStubX ], null, [ pi.endStubX, pi.startStubX ] ],
+                                    y: [ [ pi.startStubY, pi.endStubY ], null, [ pi.endStubY, pi.startStubY ] ]
+                                },
+                                midLines = {
+                                    x: [ [ midx, pi.startStubY ], [ midx, pi.endStubY ] ],
+                                    y: [ [ pi.startStubX, midy ], [ pi.endStubX, midy ] ]
+                                },
+                                linesToEnd = {
+                                    x: [ [ pi.endStubX, pi.startStubY ] ],
+                                    y: [ [ pi.startStubX, pi.endStubY ] ]
+                                },
+                                startToEnd = {
+                                    x: [ [ pi.startStubX, pi.endStubY ], [ pi.endStubX, pi.endStubY ] ],
+                                    y: [ [ pi.endStubX, pi.startStubY ], [ pi.endStubX, pi.endStubY ] ]
+                                },
+                                startToMidToEnd = {
+                                    x: [ [ pi.startStubX, midy ], [ pi.endStubX, midy ], [ pi.endStubX, pi.endStubY ] ],
+                                    y: [ [ midx, pi.startStubY ], [ midx, pi.endStubY ], [ pi.endStubX, pi.endStubY ] ]
+                                },
+                                otherStubs = {
+                                    x: [ pi.startStubY, pi.endStubY ],
+                                    y: [ pi.startStubX, pi.endStubX ]
+                                },
+                                soIdx = orientations[axis][0], toIdx = orientations[axis][1],
+                                _so = pi.so[soIdx] + 1,
+                                _to = pi.to[toIdx] + 1,
+                                otherFlipped = (pi.to[toIdx] === -1 && (otherStubs[axis][1] < otherStubs[axis][0])) || (pi.to[toIdx] === 1 && (otherStubs[axis][1] > otherStubs[axis][0])),
+                                stub1 = stubs[axis][_so][0],
+                                stub2 = stubs[axis][_so][1],
+                                segmentIndexes = sis[axis][_so][_to];
+
+                            if (pi.segment === segmentIndexes[3] || (pi.segment === segmentIndexes[2] && otherFlipped)) {
+                                return midLines[axis];
+                            }
+                            else if (pi.segment === segmentIndexes[2] && stub2 < stub1) {
+                                return linesToEnd[axis];
+                            }
+                            else if ((pi.segment === segmentIndexes[2] && stub2 >= stub1) || (pi.segment === segmentIndexes[1] && !otherFlipped)) {
+                                return startToMidToEnd[axis];
+                            }
+                            else if (pi.segment === segmentIndexes[0] || (pi.segment === segmentIndexes[1] && otherFlipped)) {
+                                return startToEnd[axis];
+                            }
+                        },
+                        orthogonal: function (axis, startStub, otherStartStub, endStub, otherEndStub) {
+                            var pi = paintInfo,
+                                extent = {
+                                    "x": pi.so[0] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub),
+                                    "y": pi.so[1] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub)
+                                }[axis];
+
+                            return {
+                                "x": [
+                                    [ extent, otherStartStub ],
+                                    [ extent, otherEndStub ],
+                                    [ endStub, otherEndStub ]
+                                ],
+                                "y": [
+                                    [ otherStartStub, extent ],
+                                    [ otherEndStub, extent ],
+                                    [ otherEndStub, endStub ]
+                                ]
+                            }[axis];
+                        },
+                        opposite: function (axis, ss, oss, es) {
+                            var pi = paintInfo,
+                                otherAxis = {"x": "y", "y": "x"}[axis],
+                                dim = {"x": "height", "y": "width"}[axis],
+                                comparator = pi["is" + axis.toUpperCase() + "GreaterThanStubTimes2"];
+
+                            if (params.sourceEndpoint.elementId === params.targetEndpoint.elementId) {
+                                var _val = oss + ((1 - params.sourceEndpoint.anchor[otherAxis]) * params.sourceInfo[dim]) + _super.maxStub;
+                                return {
+                                    "x": [
+                                        [ ss, _val ],
+                                        [ es, _val ]
+                                    ],
+                                    "y": [
+                                        [ _val, ss ],
+                                        [ _val, es ]
+                                    ]
+                                }[axis];
+
+                            }
+                            else if (!comparator || (pi.so[idx] === 1 && ss > es) || (pi.so[idx] === -1 && ss < es)) {
+                                return {
+                                    "x": [
+                                        [ ss, midy ],
+                                        [ es, midy ]
+                                    ],
+                                    "y": [
+                                        [ midx, ss ],
+                                        [ midx, es ]
+                                    ]
+                                }[axis];
+                            }
+                            else if ((pi.so[idx] === 1 && ss < es) || (pi.so[idx] === -1 && ss > es)) {
+                                return {
+                                    "x": [
+                                        [ midx, pi.sy ],
+                                        [ midx, pi.ty ]
+                                    ],
+                                    "y": [
+                                        [ pi.sx, midy ],
+                                        [ pi.tx, midy ]
+                                    ]
+                                }[axis];
+                            }
+                        }
+                    };
+
+                // compute the rest of the line
+                var p = lineCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis, ss, oss, es, oes);
+                if (p) {
+                    for (var i = 0; i < p.length; i++) {
+                        addSegment(segments, p[i][0], p[i][1], paintInfo);
+                    }
+                }
+
+                // line to end stub
+                addSegment(segments, stubs[2], stubs[3], paintInfo);
+
+            }
+
+            // end stub to end (common)
+            addSegment(segments, paintInfo.tx, paintInfo.ty, paintInfo);
+
+            // write out the segments.
+            writeSegments(this, segments, paintInfo);
+        };
+
+        /*this.getPath = function () {
+            var _last = null, _lastAxis = null, s = [], segs = segments;
+            for (var i = 0; i < segs.length; i++) {
+                var seg = segs[i], axis = seg[4], axisIndex = (axis == "v" ? 3 : 2);
+                if (_last != null && _lastAxis === axis) {
+                    _last[axisIndex] = seg[axisIndex];
+                }
+                else {
+                    if (seg[0] != seg[2] || seg[1] != seg[3]) {
+                        s.push({
+                            start: [ seg[0], seg[1] ],
+                            end: [ seg[2], seg[3] ]
+                        });
+                        _last = seg;
+                        _lastAxis = seg[4];
+                    }
+                }
+            }
+            return s;
+        };*/
+    };
+
+    _ju.extend(Flowchart, _jp.Connectors.AbstractConnector);
+    _jp.registerConnectorType(Flowchart, "Flowchart");
+}).call(typeof window !== 'undefined' ? window : this);
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the code for the Bezier connector type.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+    "use strict";
+    var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+
+    _jp.Connectors.AbstractBezierConnector = function(params) {
+        params = params || {};
+        var showLoopback = params.showLoopback !== false,
+            curviness = params.curviness || 10,
+            margin = params.margin || 5,
+            proximityLimit = params.proximityLimit || 80,
+            clockwise = params.orientation && params.orientation === "clockwise",
+            loopbackRadius = params.loopbackRadius || 25,
+            isLoopbackCurrently = false,
+            _super;
+
+        this.overrideSetEditable = function() { return !isLoopbackCurrently; };
+
+        this._compute = function (paintInfo, p) {
+
+            var sp = p.sourcePos,
+                tp = p.targetPos,
+                _w = Math.abs(sp[0] - tp[0]),
+                _h = Math.abs(sp[1] - tp[1]);
+
+            if (!showLoopback || (p.sourceEndpoint.elementId !== p.targetEndpoint.elementId)) {
+                isLoopbackCurrently = false;
+                this._computeBezier(paintInfo, p, sp, tp, _w, _h);
+            } else {
+                isLoopbackCurrently = true;
+                // a loopback connector.  draw an arc from one anchor to the other.
+                var x1 = p.sourcePos[0], y1 = p.sourcePos[1] - margin,
+                    cx = x1, cy = y1 - loopbackRadius,
+                // canvas sizing stuff, to ensure the whole painted area is visible.
+                    _x = cx - loopbackRadius,
+                    _y = cy - loopbackRadius;
+
+                _w = 2 * loopbackRadius;
+                _h = 2 * loopbackRadius;
+
+                paintInfo.points[0] = _x;
+                paintInfo.points[1] = _y;
+                paintInfo.points[2] = _w;
+                paintInfo.points[3] = _h;
+
+                // ADD AN ARC SEGMENT.
+                _super.addSegment(this, "Arc", {
+                    loopback: true,
+                    x1: (x1 - _x) + 4,
+                    y1: y1 - _y,
+                    startAngle: 0,
+                    endAngle: 2 * Math.PI,
+                    r: loopbackRadius,
+                    ac: !clockwise,
+                    x2: (x1 - _x) - 4,
+                    y2: y1 - _y,
+                    cx: cx - _x,
+                    cy: cy - _y
+                });
+            }
+        };
+
+        _super = _jp.Connectors.AbstractConnector.apply(this, arguments);
+        return _super;
+    };
+    _ju.extend(_jp.Connectors.AbstractBezierConnector, _jp.Connectors.AbstractConnector);
+
+    var Bezier = function (params) {
+        params = params || {};
+        this.type = "Bezier";
+
+        var _super = _jp.Connectors.AbstractBezierConnector.apply(this, arguments),
+            majorAnchor = params.curviness || 150,
+            minorAnchor = 10;
+
+        this.getCurviness = function () {
+            return majorAnchor;
+        };
+
+        this._findControlPoint = function (point, sourceAnchorPosition, targetAnchorPosition, sourceEndpoint, targetEndpoint, soo, too) {
+            // determine if the two anchors are perpendicular to each other in their orientation.  we swap the control
+            // points around if so (code could be tightened up)
+            var perpendicular = soo[0] !== too[0] || soo[1] === too[1],
+                p = [];
+
+            if (!perpendicular) {
+                if (soo[0] === 0) {
+                    p.push(sourceAnchorPosition[0] < targetAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor);
+                }
+                else {
+                    p.push(point[0] - (majorAnchor * soo[0]));
+                }
+
+                if (soo[1] === 0) {
+                    p.push(sourceAnchorPosition[1] < targetAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor);
+                }
+                else {
+                    p.push(point[1] + (majorAnchor * too[1]));
+                }
+            }
+            else {
+                if (too[0] === 0) {
+                    p.push(targetAnchorPosition[0] < sourceAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor);
+                }
+                else {
+                    p.push(point[0] + (majorAnchor * too[0]));
+                }
+
+                if (too[1] === 0) {
+                    p.push(targetAnchorPosition[1] < sourceAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor);
+                }
+                else {
+                    p.push(point[1] + (majorAnchor * soo[1]));
+                }
+            }
+
+            return p;
+        };
+
+        this._computeBezier = function (paintInfo, p, sp, tp, _w, _h) {
+
+            var geometry = this.getGeometry(), _CP, _CP2,
+                _sx = sp[0] < tp[0] ? _w : 0,
+                _sy = sp[1] < tp[1] ? _h : 0,
+                _tx = sp[0] < tp[0] ? 0 : _w,
+                _ty = sp[1] < tp[1] ? 0 : _h;
+
+            if ((this.hasBeenEdited() || this.isEditing()) && geometry != null && geometry.controlPoints != null && geometry.controlPoints[0] != null && geometry.controlPoints[1] != null) {
+                _CP = geometry.controlPoints[0];
+                _CP2 = geometry.controlPoints[1];
+            }
+            else {
+                _CP = this._findControlPoint([_sx, _sy], sp, tp, p.sourceEndpoint, p.targetEndpoint, paintInfo.so, paintInfo.to);
+                _CP2 = this._findControlPoint([_tx, _ty], tp, sp, p.targetEndpoint, p.sourceEndpoint, paintInfo.to, paintInfo.so);
+            }
+
+            _super.setGeometry({controlPoints:[_CP, _CP2]}, true);
+
+            _super.addSegment(this, "Bezier", {
+                x1: _sx, y1: _sy, x2: _tx, y2: _ty,
+                cp1x: _CP[0], cp1y: _CP[1], cp2x: _CP2[0], cp2y: _CP2[1]
+            });
+        };
+
+
+    };
+
+    _ju.extend(Bezier, _jp.Connectors.AbstractBezierConnector);
+    _jp.registerConnectorType(Bezier, "Bezier");
+
+}).call(typeof window !== 'undefined' ? window : this);
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the state machine connectors, which extend AbstractBezierConnector.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+    "use strict";
+    var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+
+    var _segment = function (x1, y1, x2, y2) {
+            if (x1 <= x2 && y2 <= y1) {
+                return 1;
+            }
+            else if (x1 <= x2 && y1 <= y2) {
+                return 2;
+            }
+            else if (x2 <= x1 && y2 >= y1) {
+                return 3;
+            }
+            return 4;
+        },
+
+    // the control point we will use depends on the faces to which each end of the connection is assigned, specifically whether or not the
+    // two faces are parallel or perpendicular.  if they are parallel then the control point lies on the midpoint of the axis in which they
+    // are parellel and varies only in the other axis; this variation is proportional to the distance that the anchor points lie from the
+    // center of that face.  if the two faces are perpendicular then the control point is at some distance from both the midpoints; the amount and
+    // direction are dependent on the orientation of the two elements. 'seg', passed in to this method, tells you which segment the target element
+    // lies in with respect to the source: 1 is top right, 2 is bottom right, 3 is bottom left, 4 is top left.
+    //
+    // sourcePos and targetPos are arrays of info about where on the source and target each anchor is located.  their contents are:
+    //
+    // 0 - absolute x
+    // 1 - absolute y
+    // 2 - proportional x in element (0 is left edge, 1 is right edge)
+    // 3 - proportional y in element (0 is top edge, 1 is bottom edge)
+    //
+        _findControlPoint = function (midx, midy, segment, sourceEdge, targetEdge, dx, dy, distance, proximityLimit) {
+            // TODO (maybe)
+            // - if anchor pos is 0.5, make the control point take into account the relative position of the elements.
+            if (distance <= proximityLimit) {
+                return [midx, midy];
+            }
+
+            if (segment === 1) {
+                if (sourceEdge[3] <= 0 && targetEdge[3] >= 1) {
+                    return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
+                }
+                else if (sourceEdge[2] >= 1 && targetEdge[2] <= 0) {
+                    return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
+                }
+                else {
+                    return [ midx + (-1 * dx) , midy + (-1 * dy) ];
+                }
+            }
+            else if (segment === 2) {
+                if (sourceEdge[3] >= 1 && targetEdge[3] <= 0) {
+                    return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
+                }
+                else if (sourceEdge[2] >= 1 && targetEdge[2] <= 0) {
+                    return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
+                }
+                else {
+                    return [ midx + dx, midy + (-1 * dy) ];
+                }
+            }
+            else if (segment === 3) {
+                if (sourceEdge[3] >= 1 && targetEdge[3] <= 0) {
+                    return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
+                }
+                else if (sourceEdge[2] <= 0 && targetEdge[2] >= 1) {
+                    return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
+                }
+                else {
+                    return [ midx + (-1 * dx) , midy + (-1 * dy) ];
+                }
+            }
+            else if (segment === 4) {
+                if (sourceEdge[3] <= 0 && targetEdge[3] >= 1) {
+                    return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
+                }
+                else if (sourceEdge[2] <= 0 && targetEdge[2] >= 1) {
+                    return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
+                }
+                else {
+                    return [ midx + dx , midy + (-1 * dy) ];
+                }
+            }
+
+        };
+
+    var StateMachine = function (params) {
+        params = params || {};
+        this.type = "StateMachine";
+
+        var _super = _jp.Connectors.AbstractBezierConnector.apply(this, arguments),
+            curviness = params.curviness || 10,
+            margin = params.margin || 5,
+            proximityLimit = params.proximityLimit || 80,
+            clockwise = params.orientation && params.orientation === "clockwise",
+            _controlPoint;
+
+        this._computeBezier = function(paintInfo, params, sp, tp, w, h) {
+            var _sx = params.sourcePos[0] < params.targetPos[0] ? 0 : w,
+                _sy = params.sourcePos[1] < params.targetPos[1] ? 0 : h,
+                _tx = params.sourcePos[0] < params.targetPos[0] ? w : 0,
+                _ty = params.sourcePos[1] < params.targetPos[1] ? h : 0;
+
+            // now adjust for the margin
+            if (params.sourcePos[2] === 0) {
+                _sx -= margin;
+            }
+            if (params.sourcePos[2] === 1) {
+                _sx += margin;
+            }
+            if (params.sourcePos[3] === 0) {
+                _sy -= margin;
+            }
+            if (params.sourcePos[3] === 1) {
+                _sy += margin;
+            }
+            if (params.targetPos[2] === 0) {
+                _tx -= margin;
+            }
+            if (params.targetPos[2] === 1) {
+                _tx += margin;
+            }
+            if (params.targetPos[3] === 0) {
+                _ty -= margin;
+            }
+            if (params.targetPos[3] === 1) {
+                _ty += margin;
+            }
+
+            //
+            // these connectors are quadratic bezier curves, having a single control point. if both anchors
+            // are located at 0.5 on their respective faces, the control point is set to the midpoint and you
+            // get a straight line.  this is also the case if the two anchors are within 'proximityLimit', since
+            // it seems to make good aesthetic sense to do that. outside of that, the control point is positioned
+            // at 'curviness' pixels away along the normal to the straight line connecting the two anchors.
+            //
+            // there may be two improvements to this.  firstly, we might actually support the notion of avoiding nodes
+            // in the UI, or at least making a good effort at doing so.  if a connection would pass underneath some node,
+            // for example, we might increase the distance the control point is away from the midpoint in a bid to
+            // steer it around that node.  this will work within limits, but i think those limits would also be the likely
+            // limits for, once again, aesthetic good sense in the layout of a chart using these connectors.
+            //
+            // the second possible change is actually two possible changes: firstly, it is possible we should gradually
+            // decrease the 'curviness' as the distance between the anchors decreases; start tailing it off to 0 at some
+            // point (which should be configurable).  secondly, we might slightly increase the 'curviness' for connectors
+            // with respect to how far their anchor is from the center of its respective face. this could either look cool,
+            // or stupid, and may indeed work only in a way that is so subtle as to have been a waste of time.
+            //
+
+            var _midx = (_sx + _tx) / 2,
+                _midy = (_sy + _ty) / 2,
+                segment = _segment(_sx, _sy, _tx, _ty),
+                distance = Math.sqrt(Math.pow(_tx - _sx, 2) + Math.pow(_ty - _sy, 2)),
+                cp1x, cp2x, cp1y, cp2y,
+                geometry = _super.getGeometry();
+
+            if ((this.hasBeenEdited() || this.isEditing()) && geometry != null) {
+                cp1x = geometry.controlPoints[0][0];
+                cp1y = geometry.controlPoints[0][1];
+                cp2x = geometry.controlPoints[1][0];
+                cp2y = geometry.controlPoints[1][1];
+            }
+            else {
+                // calculate the control point.  this code will be where we'll put in a rudimentary element avoidance scheme; it
+                // will work by extending the control point to force the curve to be, um, curvier.
+                _controlPoint = _findControlPoint(_midx,
+                    _midy,
+                    segment,
+                    params.sourcePos,
+                    params.targetPos,
+                    curviness, curviness,
+                    distance,
+                    proximityLimit);
+
+                cp1x = _controlPoint[0];
+                cp2x = _controlPoint[0];
+                cp1y = _controlPoint[1];
+                cp2y = _controlPoint[1];
+
+                _super.setGeometry({controlPoints:[_controlPoint, _controlPoint]}, true);
+            }
+
+            _super.addSegment(this, "Bezier", {
+                x1: _tx, y1: _ty, x2: _sx, y2: _sy,
+                cp1x: cp1x, cp1y: cp1y,
+                cp2x: cp2x, cp2y: cp2y
+            });
+        };
+    };
+
+    _ju.extend(StateMachine, _jp.Connectors.AbstractBezierConnector);
+    _jp.registerConnectorType(StateMachine, "StateMachine");
+
+}).call(typeof window !== 'undefined' ? window : this);
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the 'flowchart' connectors, consisting of vertical and horizontal line segments.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+    "use strict";
+    var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+    var STRAIGHT = "Straight";
+
+    var Straight = function (params) {
+        this.type = STRAIGHT;
+        var _super = _jp.Connectors.AbstractConnector.apply(this, arguments);
+
+        this._compute = function (paintInfo, _) {
+            _super.addSegment(this, STRAIGHT, {x1: paintInfo.sx, y1: paintInfo.sy, x2: paintInfo.startStubX, y2: paintInfo.startStubY});
+            _super.addSegment(this, STRAIGHT, {x1: paintInfo.startStubX, y1: paintInfo.startStubY, x2: paintInfo.endStubX, y2: paintInfo.endStubY});
+            _super.addSegment(this, STRAIGHT, {x1: paintInfo.endStubX, y1: paintInfo.endStubY, x2: paintInfo.tx, y2: paintInfo.ty});
+        };
+    };
+
+    _ju.extend(Straight, _jp.Connectors.AbstractConnector);
+    _jp.registerConnectorType(Straight, STRAIGHT);
+
+}).call(typeof window !== 'undefined' ? window : this);
+/*
+ * jsPlumb Community Edition
+ * 
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ * 
+ * This file contains the SVG renderers.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ * 
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+// ************************** SVG utility methods ********************************************	
+
+    "use strict";
+    var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+
+    var svgAttributeMap = {
+            "stroke-linejoin": "stroke-linejoin",
+            "stroke-dashoffset": "stroke-dashoffset",
+            "stroke-linecap": "stroke-linecap"
+        },
+        STROKE_DASHARRAY = "stroke-dasharray",
+        DASHSTYLE = "dashstyle",
+        LINEAR_GRADIENT = "linearGradient",
+        RADIAL_GRADIENT = "radialGradient",
+        DEFS = "defs",
+        FILL = "fill",
+        STOP = "stop",
+        STROKE = "stroke",
+        STROKE_WIDTH = "stroke-width",
+        STYLE = "style",
+        NONE = "none",
+        JSPLUMB_GRADIENT = "jsplumb_gradient_",
+        LINE_WIDTH = "strokeWidth",
+        ns = {
+            svg: "http://www.w3.org/2000/svg"
+        },
+        _attr = function (node, attributes) {
+            for (var i in attributes) {
+                node.setAttribute(i, "" + attributes[i]);
+            }
+        },
+        _node = function (name, attributes) {
+            attributes = attributes || {};
+            attributes.version = "1.1";
+            attributes.xmlns = ns.svg;
+            return _jp.createElementNS(ns.svg, name, null, null, attributes);
+        },
+        _pos = function (d) {
+            return "position:absolute;left:" + d[0] + "px;top:" + d[1] + "px";
+        },
+        _clearGradient = function (parent) {
+            var els = parent.querySelectorAll(" defs,linearGradient,radialGradient");
+            for (var i = 0; i < els.length; i++) {
+                els[i].parentNode.removeChild(els[i]);
+            }
+        },
+        _updateGradient = function (parent, node, style, dimensions, uiComponent) {
+            var id = JSPLUMB_GRADIENT + uiComponent._jsPlumb.instance.idstamp();
+            // first clear out any existing gradient
+            _clearGradient(parent);
+            // this checks for an 'offset' property in the gradient, and in the absence of it, assumes
+            // we want a linear gradient. if it's there, we create a radial gradient.
+            // it is possible that a more explicit means of defining the gradient type would be
+            // better. relying on 'offset' means that we can never have a radial gradient that uses
+            // some default offset, for instance.
+            // issue 244 suggested the 'gradientUnits' attribute; without this, straight/flowchart connectors with gradients would
+            // not show gradients when the line was perfectly horizontal or vertical.
+            var g;
+            if (!style.gradient.offset) {
+                g = _node(LINEAR_GRADIENT, {id: id, gradientUnits: "userSpaceOnUse"});
+            }
+            else {
+                g = _node(RADIAL_GRADIENT, { id: id });
+            }
+
+            var defs = _node(DEFS);
+            parent.appendChild(defs);
+            defs.appendChild(g);
+
+            // the svg radial gradient seems to treat stops in the reverse
+            // order to how canvas does it.  so we want to keep all the maths the same, but
+            // iterate the actual style declarations in reverse order, if the x indexes are not in order.
+            for (var i = 0; i < style.gradient.stops.length; i++) {
+                var styleToUse = uiComponent.segment === 1 || uiComponent.segment === 2 ? i : style.gradient.stops.length - 1 - i,
+                    stopColor = style.gradient.stops[styleToUse][1],
+                    s = _node(STOP, {"offset": Math.floor(style.gradient.stops[i][0] * 100) + "%", "stop-color": stopColor});
+
+                g.appendChild(s);
+            }
+            var applyGradientTo = style.stroke ? STROKE : FILL;
+            node.setAttribute(applyGradientTo, "url(#" + id + ")");
+        },
+        _applyStyles = function (parent, node, style, dimensions, uiComponent) {
+
+            node.setAttribute(FILL, style.fill ? style.fill : NONE);
+            node.setAttribute(STROKE, style.stroke ? style.stroke : NONE);
+
+            if (style.gradient) {
+                _updateGradient(parent, node, style, dimensions, uiComponent);
+            }
+            else {
+                // make sure we clear any existing gradient
+                _clearGradient(parent);
+                node.setAttribute(STYLE, "");
+            }
+
+            if (style.strokeWidth) {
+                node.setAttribute(STROKE_WIDTH, style.strokeWidth);
+            }
+
+            // in SVG there is a stroke-dasharray attribute we can set, and its syntax looks like
+            // the syntax in VML but is actually kind of nasty: values are given in the pixel
+            // coordinate space, whereas in VML they are multiples of the width of the stroked
+            // line, which makes a lot more sense.  for that reason, jsPlumb is supporting both
+            // the native svg 'stroke-dasharray' attribute, and also the 'dashstyle' concept from
+            // VML, which will be the preferred method.  the code below this converts a dashstyle
+            // attribute given in terms of stroke width into a pixel representation, by using the
+            // stroke's lineWidth.
+            if (style[DASHSTYLE] && style[LINE_WIDTH] && !style[STROKE_DASHARRAY]) {
+                var sep = style[DASHSTYLE].indexOf(",") === -1 ? " " : ",",
+                    parts = style[DASHSTYLE].split(sep),
+                    styleToUse = "";
+                parts.forEach(function (p) {
+                    styleToUse += (Math.floor(p * style.strokeWidth) + sep);
+                });
+                node.setAttribute(STROKE_DASHARRAY, styleToUse);
+            }
+            else if (style[STROKE_DASHARRAY]) {
+                node.setAttribute(STROKE_DASHARRAY, style[STROKE_DASHARRAY]);
+            }
+
+            // extra attributes such as join type, dash offset.
+            for (var i in svgAttributeMap) {
+                if (style[i]) {
+                    node.setAttribute(svgAttributeMap[i], style[i]);
+                }
+            }
+        },
+        _appendAtIndex = function (svg, path, idx) {
+            if (svg.childNodes.length > idx) {
+                svg.insertBefore(path, svg.childNodes[idx]);
+            }
+            else {
+                svg.appendChild(path);
+            }
+        };
+
+    /**
+     utility methods for other objects to use.
+     */
+    _ju.svg = {
+        node: _node,
+        attr: _attr,
+        pos: _pos
+    };
+
+    // ************************** / SVG utility methods ********************************************
+
+    /*
+     * Base class for SVG components.
+     */
+    var SvgComponent = function (params) {
+        var pointerEventsSpec = params.pointerEventsSpec || "all", renderer = {};
+
+        _jp.jsPlumbUIComponent.apply(this, params.originalArgs);
+        this.canvas = null;
+        this.path = null;
+        this.svg = null;
+        this.bgCanvas = null;
+
+        var clazz = params.cssClass + " " + (params.originalArgs[0].cssClass || ""),
+            svgParams = {
+                "style": "",
+                "width": 0,
+                "height": 0,
+                "pointer-events": pointerEventsSpec,
+                "position": "absolute"
+            };
+
+        this.svg = _node("svg", svgParams);
+
+        if (params.useDivWrapper) {
+            this.canvas = _jp.createElement("div", { position : "absolute" });
+            _ju.sizeElement(this.canvas, 0, 0, 1, 1);
+            this.canvas.className = clazz;
+        }
+        else {
+            _attr(this.svg, { "class": clazz });
+            this.canvas = this.svg;
+        }
+
+        params._jsPlumb.appendElement(this.canvas, params.originalArgs[0].parent);
+        if (params.useDivWrapper) {
+            this.canvas.appendChild(this.svg);
+        }
+
+        var displayElements = [ this.canvas ];
+        this.getDisplayElements = function () {
+            return displayElements;
+        };
+
+        this.appendDisplayElement = function (el) {
+            displayElements.push(el);
+        };
+
+        this.paint = function (style, anchor, extents) {
+            if (style != null) {
+
+                var xy = [ this.x, this.y ], wh = [ this.w, this.h ], p;
+                if (extents != null) {
+                    if (extents.xmin < 0) {
+                        xy[0] += extents.xmin;
+                    }
+                    if (extents.ymin < 0) {
+                        xy[1] += extents.ymin;
+                    }
+                    wh[0] = extents.xmax + ((extents.xmin < 0) ? -extents.xmin : 0);
+                    wh[1] = extents.ymax + ((extents.ymin < 0) ? -extents.ymin : 0);
+                }
+
+                if (params.useDivWrapper) {
+                    _ju.sizeElement(this.canvas, xy[0], xy[1], wh[0], wh[1]);
+                    xy[0] = 0;
+                    xy[1] = 0;
+                    p = _pos([ 0, 0 ]);
+                }
+                else {
+                    p = _pos([ xy[0], xy[1] ]);
+                }
+
+                renderer.paint.apply(this, arguments);
+
+                _attr(this.svg, {
+                    "style": p,
+                    "width": wh[0] || 0,
+                    "height": wh[1] || 0
+                });
+            }
+        };
+
+        return {
+            renderer: renderer
+        };
+    };
+
+    _ju.extend(SvgComponent, _jp.jsPlumbUIComponent, {
+        cleanup: function (force) {
+            if (force || this.typeId == null) {
+                if (this.canvas) {
+                    this.canvas._jsPlumb = null;
+                }
+                if (this.svg) {
+                    this.svg._jsPlumb = null;
+                }
+                if (this.bgCanvas) {
+                    this.bgCanvas._jsPlumb = null;
+                }
+
+                if (this.canvas && this.canvas.parentNode) {
+                    this.canvas.parentNode.removeChild(this.canvas);
+                }
+                if (this.bgCanvas && this.bgCanvas.parentNode) {
+                    this.canvas.parentNode.removeChild(this.canvas);
+                }
+
+                this.svg = null;
+                this.canvas = null;
+                this.path = null;
+                this.group = null;
+            }
+            else {
+                // if not a forced cleanup, just detach from DOM for now.
+                if (this.canvas && this.canvas.parentNode) {
+                    this.canvas.parentNode.removeChild(this.canvas);
+                }
+                if (this.bgCanvas && this.bgCanvas.parentNode) {
+                    this.bgCanvas.parentNode.removeChild(this.bgCanvas);
+                }
+            }
+        },
+        reattach:function(instance) {
+            var c = instance.getContainer();
+            if (this.canvas && this.canvas.parentNode == null) {
+                c.appendChild(this.canvas);
+            }
+            if (this.bgCanvas && this.bgCanvas.parentNode == null) {
+                c.appendChild(this.bgCanvas);
+            }
+        },
+        setVisible: function (v) {
+            if (this.canvas) {
+                this.canvas.style.display = v ? "block" : "none";
+            }
+        }
+    });
+
+    /*
+     * Base class for SVG connectors.
+     */
+    _jp.ConnectorRenderers.svg = function (params) {
+        var self = this,
+            _super = SvgComponent.apply(this, [
+                {
+                    cssClass: params._jsPlumb.connectorClass + (this.isEditable() ? " " + params._jsPlumb.editableConnectorClass : ""),
+                    originalArgs: arguments,
+                    pointerEventsSpec: "none",
+                    _jsPlumb: params._jsPlumb
+                }
+            ]);
+
+        var _superSetEditable = this.setEditable;
+        this.setEditable = function(e) {
+            var result = _superSetEditable.apply(this, [e]);
+            _jp[result ? "addClass" : "removeClass"](this.canvas, this._jsPlumb.instance.editableConnectorClass);
+        };
+
+        _super.renderer.paint = function (style, anchor, extents) {
+
+            var segments = self.getSegments(), p = "", offset = [0, 0];
+            if (extents.xmin < 0) {
+                offset[0] = -extents.xmin;
+            }
+            if (extents.ymin < 0) {
+                offset[1] = -extents.ymin;
+            }
+
+            if (segments.length > 0) {
+
+                p = self.getPathData();
+
+                var a = {
+                        d: p,
+                        transform: "translate(" + offset[0] + "," + offset[1] + ")",
+                        "pointer-events": params["pointer-events"] || "visibleStroke"
+                    },
+                    outlineStyle = null,
+                    d = [self.x, self.y, self.w, self.h];
+
+                // outline style.  actually means drawing an svg object underneath the main one.
+                if (style.outlineStroke) {
+                    var outlineWidth = style.outlineWidth || 1,
+                        outlineStrokeWidth = style.strokeWidth + (2 * outlineWidth);
+                    outlineStyle = _jp.extend({}, style);
+                    delete outlineStyle.gradient;
+                    outlineStyle.stroke = style.outlineStroke;
+                    outlineStyle.strokeWidth = outlineStrokeWidth;
+
+                    if (self.bgPath == null) {
+                        self.bgPath = _node("path", a);
+                        _jp.addClass(self.bgPath, _jp.connectorOutlineClass);
+                        _appendAtIndex(self.svg, self.bgPath, 0);
+                    }
+                    else {
+                        _attr(self.bgPath, a);
+                    }
+
+                    _applyStyles(self.svg, self.bgPath, outlineStyle, d, self);
+                }
+
+                if (self.path == null) {
+                    self.path = _node("path", a);
+                    _appendAtIndex(self.svg, self.path, style.outlineStroke ? 1 : 0);
+                }
+                else {
+                    _attr(self.path, a);
+                }
+
+                _applyStyles(self.svg, self.path, style, d, self);
+            }
+        };
+    };
+    _ju.extend(_jp.ConnectorRenderers.svg, SvgComponent);
+
+// ******************************* svg segment renderer *****************************************************	
+
+
+// ******************************* /svg segments *****************************************************
+
+    /*
+     * Base class for SVG endpoints.
+     */
+    var SvgEndpoint = _jp.SvgEndpoint = function (params) {
+        var _super = SvgComponent.apply(this, [
+            {
+                cssClass: params._jsPlumb.endpointClass,
+                originalArgs: arguments,
+                pointerEventsSpec: "all",
+                useDivWrapper: true,
+                _jsPlumb: params._jsPlumb
+            }
+        ]);
+
+        _super.renderer.paint = function (style) {
+            var s = _jp.extend({}, style);
+            if (s.outlineStroke) {
+                s.stroke = s.outlineStroke;
+            }
+
+            if (this.node == null) {
+                this.node = this.makeNode(s);
+                this.svg.appendChild(this.node);
+            }
+            else if (this.updateNode != null) {
+                this.updateNode(this.node);
+            }
+            _applyStyles(this.svg, this.node, s, [ this.x, this.y, this.w, this.h ], this);
+            _pos(this.node, [ this.x, this.y ]);
+        }.bind(this);
+
+    };
+    _ju.extend(SvgEndpoint, SvgComponent);
+
+    /*
+     * SVG Dot Endpoint
+     */
+    _jp.Endpoints.svg.Dot = function () {
+        _jp.Endpoints.Dot.apply(this, arguments);
+        SvgEndpoint.apply(this, arguments);
+        this.makeNode = function (style) {
+            return _node("circle", {
+                "cx": this.w / 2,
+                "cy": this.h / 2,
+                "r": this.radius
+            });
+        };
+        this.updateNode = function (node) {
+            _attr(node, {
+                "cx": this.w / 2,
+                "cy": this.h / 2,
+                "r": this.radius
+            });
+        };
+    };
+    _ju.extend(_jp.Endpoints.svg.Dot, [_jp.Endpoints.Dot, SvgEndpoint]);
+
+    /*
+     * SVG Rectangle Endpoint
+     */
+    _jp.Endpoints.svg.Rectangle = function () {
+        _jp.Endpoints.Rectangle.apply(this, arguments);
+        SvgEndpoint.apply(this, arguments);
+        this.makeNode = function (style) {
+            return _node("rect", {
+                "width": this.w,
+                "height": this.h
+            });
+        };
+        this.updateNode = function (node) {
+            _attr(node, {
+                "width": this.w,
+                "height": this.h
+            });
+        };
+    };
+    _ju.extend(_jp.Endpoints.svg.Rectangle, [_jp.Endpoints.Rectangle, SvgEndpoint]);
+
+    /*
+     * SVG Image Endpoint is the default image endpoint.
+     */
+    _jp.Endpoints.svg.Image = _jp.Endpoints.Image;
+    /*
+     * Blank endpoint in svg renderer is the default Blank endpoint.
+     */
+    _jp.Endpoints.svg.Blank = _jp.Endpoints.Blank;
+    /*
+     * Label overlay in svg renderer is the default Label overlay.
+     */
+    _jp.Overlays.svg.Label = _jp.Overlays.Label;
+    /*
+     * Custom overlay in svg renderer is the default Custom overlay.
+     */
+    _jp.Overlays.svg.Custom = _jp.Overlays.Custom;
+
+    var AbstractSvgArrowOverlay = function (superclass, originalArgs) {
+        superclass.apply(this, originalArgs);
+        _jp.jsPlumbUIComponent.apply(this, originalArgs);
+        this.isAppendedAtTopLevel = false;
+        var self = this;
+        this.path = null;
+        this.paint = function (params, containerExtents) {
+            // only draws on connections, not endpoints.
+            if (params.component.svg && containerExtents) {
+                if (this.path == null) {
+                    this.path = _node("path", {
+                        "pointer-events": "all"
+                    });
+                    params.component.svg.appendChild(this.path);
+                    if (this.elementCreated) {
+                        this.elementCreated(this.path, params.component);
+                    }
+
+                    this.canvas = params.component.svg; // for the sake of completeness; this behaves the same as other overlays
+                }
+                var clazz = originalArgs && (originalArgs.length === 1) ? (originalArgs[0].cssClass || "") : "",
+                    offset = [0, 0];
+
+                if (containerExtents.xmin < 0) {
+                    offset[0] = -containerExtents.xmin;
+                }
+                if (containerExtents.ymin < 0) {
+                    offset[1] = -containerExtents.ymin;
+                }
+
+                _attr(this.path, {
+                    "d": makePath(params.d),
+                    "class": clazz,
+                    stroke: params.stroke ? params.stroke : null,
+                    fill: params.fill ? params.fill : null,
+                    transform: "translate(" + offset[0] + "," + offset[1] + ")"
+                });
+            }
+        };
+        var makePath = function (d) {
+            return (isNaN(d.cxy.x) || isNaN(d.cxy.y)) ? "" : "M" + d.hxy.x + "," + d.hxy.y +
+                " L" + d.tail[0].x + "," + d.tail[0].y +
+                " L" + d.cxy.x + "," + d.cxy.y +
+                " L" + d.tail[1].x + "," + d.tail[1].y +
+                " L" + d.hxy.x + "," + d.hxy.y;
+        };
+        this.transfer = function(target) {
+            if (target.canvas && this.path && this.path.parentNode) {
+                this.path.parentNode.removeChild(this.path);
+                target.canvas.appendChild(this.path);
+            }
+        };
+    };
+    _ju.extend(AbstractSvgArrowOverlay, [_jp.jsPlumbUIComponent, _jp.Overlays.AbstractOverlay], {
+        cleanup: function (force) {
+            if (this.path != null) {
+                if (force) {
+                    this._jsPlumb.instance.removeElement(this.path);
+                }
+                else {
+                    if (this.path.parentNode) {
+                        this.path.parentNode.removeChild(this.path);
+                    }
+                }
+            }
+        },
+        reattach:function(instance, component) {
+            if (this.path && component.canvas) {
+                component.canvas.appendChild(this.path);
+            }
+        },
+        setVisible: function (v) {
+            if (this.path != null) {
+                (this.path.style.display = (v ? "block" : "none"));
+            }
+        }
+    });
+
+    _jp.Overlays.svg.Arrow = function () {
+        AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.Arrow, arguments]);
+    };
+    _ju.extend(_jp.Overlays.svg.Arrow, [ _jp.Overlays.Arrow, AbstractSvgArrowOverlay ]);
+
+    _jp.Overlays.svg.PlainArrow = function () {
+        AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.PlainArrow, arguments]);
+    };
+    _ju.extend(_jp.Overlays.svg.PlainArrow, [ _jp.Overlays.PlainArrow, AbstractSvgArrowOverlay ]);
+
+    _jp.Overlays.svg.Diamond = function () {
+        AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.Diamond, arguments]);
+    };
+    _ju.extend(_jp.Overlays.svg.Diamond, [ _jp.Overlays.Diamond, AbstractSvgArrowOverlay ]);
+
+    // a test
+    _jp.Overlays.svg.GuideLines = function () {
+        var path = null, self = this, p1_1, p1_2;
+        _jp.Overlays.GuideLines.apply(this, arguments);
+        this.paint = function (params, containerExtents) {
+            if (path == null) {
+                path = _node("path");
+                params.connector.svg.appendChild(path);
+                self.attachListeners(path, params.connector);
+                self.attachListeners(path, self);
+
+                p1_1 = _node("path");
+                params.connector.svg.appendChild(p1_1);
+                self.attachListeners(p1_1, params.connector);
+                self.attachListeners(p1_1, self);
+
+                p1_2 = _node("path");
+                params.connector.svg.appendChild(p1_2);
+                self.attachListeners(p1_2, params.connector);
+                self.attachListeners(p1_2, self);
+            }
+
+            var offset = [0, 0];
+            if (containerExtents.xmin < 0) {
+                offset[0] = -containerExtents.xmin;
+            }
+            if (containerExtents.ymin < 0) {
+                offset[1] = -containerExtents.ymin;
+            }
+
+            _attr(path, {
+                "d": makePath(params.head, params.tail),
+                stroke: "red",
+                fill: null,
+                transform: "translate(" + offset[0] + "," + offset[1] + ")"
+            });
+
+            _attr(p1_1, {
+                "d": makePath(params.tailLine[0], params.tailLine[1]),
+                stroke: "blue",
+                fill: null,
+                transform: "translate(" + offset[0] + "," + offset[1] + ")"
+            });
+
+            _attr(p1_2, {
+                "d": makePath(params.headLine[0], params.headLine[1]),
+                stroke: "green",
+                fill: null,
+                transform: "translate(" + offset[0] + "," + offset[1] + ")"
+            });
+        };
+
+        var makePath = function (d1, d2) {
+            return "M " + d1.x + "," + d1.y +
+                " L" + d2.x + "," + d2.y;
+        };
+    };
+    _ju.extend(_jp.Overlays.svg.GuideLines, _jp.Overlays.GuideLines);
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ * 
+ * This file contains the 'vanilla' adapter - having no external dependencies other than bundled libs.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ * 
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+    "use strict";
+    var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil,
+        _jk = root.Katavorio, _jg = root.Biltong;
+
+    var _getDragManager = function (instance, category) {
+
+        category = category || "main";
+        var key = "_katavorio_" + category;
+        var k = instance[key],
+            e = instance.getEventManager();
+
+        if (!k) {
+            k = new _jk({
+                bind: e.on,
+                unbind: e.off,
+                getSize: _jp.getSize,
+                getPosition: function (el, relativeToRoot) {
+                    // if this is a nested draggable then compute the offset against its own offsetParent, otherwise
+                    // compute against the Container's origin. see also the getUIPosition method below.
+                    var o = instance.getOffset(el, relativeToRoot, el._katavorioDrag ? el.offsetParent : null);
+                    return [o.left, o.top];
+                },
+                setPosition: function (el, xy) {
+                    el.style.left = xy[0] + "px";
+                    el.style.top = xy[1] + "px";
+                },
+                addClass: _jp.addClass,
+                removeClass: _jp.removeClass,
+                intersects: _jg.intersects,
+                indexOf: function(l, i) { return l.indexOf(i); },
+                scope:instance.getDefaultScope(),
+                css: {
+                    noSelect: instance.dragSelectClass,
+                    droppable: "jtk-droppable",
+                    draggable: "jtk-draggable",
+                    drag: "jtk-drag",
+                    selected: "jtk-drag-selected",
+                    active: "jtk-drag-active",
+                    hover: "jtk-drag-hover",
+                    ghostProxy:"jtk-ghost-proxy"
+                }
+            });
+            k.setZoom(instance.getZoom());
+            instance[key] = k;
+            instance.bind("zoom", k.setZoom);
+        }
+        return k;
+    };
+
+    var _animProps = function (o, p) {
+        var _one = function (pName) {
+            if (p[pName] != null) {
+                if (_ju.isString(p[pName])) {
+                    var m = p[pName].match(/-=/) ? -1 : 1,
+                        v = p[pName].substring(2);
+                    return o[pName] + (m * v);
+                }
+                else {
+                    return p[pName];
+                }
+            }
+            else {
+                return o[pName];
+            }
+        };
+        return [ _one("left"), _one("top") ];
+    };
+
+    _jp.extend(root.jsPlumbInstance.prototype, {
+
+        animationSupported:true,
+        getElement: function (el) {
+            if (el == null) {
+                return null;
+            }
+            // here we pluck the first entry if el was a list of entries.
+            // this is not my favourite thing to do, but previous versions of
+            // jsplumb supported jquery selectors, and it is possible a selector
+            // will be passed in here.
+            el = typeof el === "string" ? el : el.length != null && el.enctype == null ? el[0] : el;
+            return typeof el === "string" ? document.getElementById(el) : el;
+        },
+        removeElement: function (element) {
+            _getDragManager(this).elementRemoved(element);
+            this.getEventManager().remove(element);
+        },
+        //
+        // this adapter supports a rudimentary animation function. no easing is supported.  only
+        // left/top properties are supported. property delta args are expected to be in the form
+        //
+        // +=x.xxxx
+        //
+        // or
+        //
+        // -=x.xxxx
+        //
+        doAnimate: function (el, properties, options) {
+            options = options || {};
+            var o = this.getOffset(el),
+                ap = _animProps(o, properties),
+                ldist = ap[0] - o.left,
+                tdist = ap[1] - o.top,
+                d = options.duration || 250,
+                step = 15, steps = d / step,
+                linc = (step / d) * ldist,
+                tinc = (step / d) * tdist,
+                idx = 0,
+                _int = setInterval(function () {
+                    _jp.setPosition(el, {
+                        left: o.left + (linc * (idx + 1)),
+                        top: o.top + (tinc * (idx + 1))
+                    });
+                    if (options.step != null) {
+                        options.step(idx, Math.ceil(steps));
+                    }
+                    idx++;
+                    if (idx >= steps) {
+                        window.clearInterval(_int);
+                        if (options.complete != null) {
+                            options.complete();
+                        }
+                    }
+                }, step);
+        },
+        // DRAG/DROP
+        destroyDraggable: function (el, category) {
+            _getDragManager(this, category).destroyDraggable(el);
+        },
+        destroyDroppable: function (el, category) {
+            _getDragManager(this, category).destroyDroppable(el);
+        },
+        initDraggable: function (el, options, category) {
+            _getDragManager(this, category).draggable(el, options);
+        },
+        initDroppable: function (el, options, category) {
+            _getDragManager(this, category).droppable(el, options);
+        },
+        isAlreadyDraggable: function (el) {
+            return el._katavorioDrag != null;
+        },
+        isDragSupported: function (el, options) {
+            return true;
+        },
+        isDropSupported: function (el, options) {
+            return true;
+        },
+        isElementDraggable: function (el) {
+            el = _jp.getElement(el);
+            return el._katavorioDrag && el._katavorioDrag.isEnabled();
+        },
+        getDragObject: function (eventArgs) {
+            return eventArgs[0].drag.getDragElement();
+        },
+        getDragScope: function (el) {
+            return el._katavorioDrag && el._katavorioDrag.scopes.join(" ") || "";
+        },
+        getDropEvent: function (args) {
+            return args[0].e;
+        },
+        getUIPosition: function (eventArgs, zoom) {
+            // here the position reported to us by Katavorio is relative to the element's offsetParent. For top
+            // level nodes that is fine, but if we have a nested draggable then its offsetParent is actually
+            // not going to be the jsplumb container; it's going to be some child of that element. In that case
+            // we want to adjust the UI position to account for the offsetParent's position relative to the Container
+            // origin.
+            var el = eventArgs[0].el;
+            if (el.offsetParent == null) {
+                return null;
+            }
+            var finalPos = eventArgs[0].finalPos || eventArgs[0].pos;
+            var p = { left:finalPos[0], top:finalPos[1] };
+            if (el._katavorioDrag && el.offsetParent !== this.getContainer()) {
+                var oc = this.getOffset(el.offsetParent);
+                p.left += oc.left;
+                p.top += oc.top;
+            }
+            return p;
+        },
+        setDragFilter: function (el, filter, _exclude) {
+            if (el._katavorioDrag) {
+                el._katavorioDrag.setFilter(filter, _exclude);
+            }
+        },
+        setElementDraggable: function (el, draggable) {
+            el = _jp.getElement(el);
+            if (el._katavorioDrag) {
+                el._katavorioDrag.setEnabled(draggable);
+            }
+        },
+        setDragScope: function (el, scope) {
+            if (el._katavorioDrag) {
+                el._katavorioDrag.k.setDragScope(el, scope);
+            }
+        },
+        setDropScope:function(el, scope) {
+            if (el._katavorioDrop && el._katavorioDrop.length > 0) {
+                el._katavorioDrop[0].k.setDropScope(el, scope);
+            }
+        },
+        addToPosse:function(el, spec) {
+            var specs = Array.prototype.slice.call(arguments, 1);
+            var dm = _getDragManager(this);
+            _jp.each(el, function(_el) {
+                _el = [ _jp.getElement(_el) ];
+                _el.push.apply(_el, specs );
+                dm.addToPosse.apply(dm, _el);
+            });
+        },
+        setPosse:function(el, spec) {
+            var specs = Array.prototype.slice.call(arguments, 1);
+            var dm = _getDragManager(this);
+            _jp.each(el, function(_el) {
+                _el = [ _jp.getElement(_el) ];
+                _el.push.apply(_el, specs );
+                dm.setPosse.apply(dm, _el);
+            });
+        },
+        removeFromPosse:function(el, posseId) {
+            var specs = Array.prototype.slice.call(arguments, 1);
+            var dm = _getDragManager(this);
+            _jp.each(el, function(_el) {
+                _el = [ _jp.getElement(_el) ];
+                _el.push.apply(_el, specs );
+                dm.removeFromPosse.apply(dm, _el);
+            });
+        },
+        removeFromAllPosses:function(el) {
+            var dm = _getDragManager(this);
+            _jp.each(el, function(_el) { dm.removeFromAllPosses(_jp.getElement(_el)); });
+        },
+        setPosseState:function(el, posseId, state) {
+            var dm = _getDragManager(this);
+            _jp.each(el, function(_el) { dm.setPosseState(_jp.getElement(_el), posseId, state); });
+        },
+        dragEvents: {
+            'start': 'start', 'stop': 'stop', 'drag': 'drag', 'step': 'step',
+            'over': 'over', 'out': 'out', 'drop': 'drop', 'complete': 'complete',
+            'beforeStart':'beforeStart'
+        },
+        animEvents: {
+            'step': "step", 'complete': 'complete'
+        },
+        stopDrag: function (el) {
+            if (el._katavorioDrag) {
+                el._katavorioDrag.abort();
+            }
+        },
+        addToDragSelection: function (spec) {
+            _getDragManager(this).select(spec);
+        },
+        removeFromDragSelection: function (spec) {
+            _getDragManager(this).deselect(spec);
+        },
+        clearDragSelection: function () {
+            _getDragManager(this).deselectAll();
+        },
+        trigger: function (el, event, originalEvent, payload) {
+            this.getEventManager().trigger(el, event, originalEvent, payload);
+        },
+        doReset:function() {
+            // look for katavorio instances and reset each one if found.
+            for (var key in this) {
+                if (key.indexOf("_katavorio_") === 0) {
+                    this[key].reset();
+                }
+            }
+        }
+    });
+
+    var ready = function (f) {
+        var _do = function () {
+            if (/complete|loaded|interactive/.test(document.readyState) && typeof(document.body) !== "undefined" && document.body != null) {
+                f();
+            }
+            else {
+                setTimeout(_do, 9);
+            }
+        };
+
+        _do();
+    };
+    ready(_jp.init);
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+
+/***/ }),
+/* 49 */
+/***/ (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__(10);
@@ -40251,7 +55549,7 @@ function factionInvitationBoxCreate(faction) {
 
 
 /***/ }),
-/* 48 */
+/* 50 */
 /***/ (function(module, exports, __webpack_require__) {
 
 /* ***** BEGIN LICENSE BLOCK *****
@@ -57051,7 +72349,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
 
     try {
             var workerSrc = mod.src;
-    var Blob = __webpack_require__(49);
+    var Blob = __webpack_require__(51);
     var blob = new Blob([ workerSrc ], { type: 'application/javascript' });
     var blobUrl = (window.URL || window.webkitURL).createObjectURL(blob);
 
@@ -59332,7 +74630,7 @@ exports.version = "1.2.6";
 module.exports = window.ace.acequire("ace/ace");
 
 /***/ }),
-/* 49 */
+/* 51 */
 /***/ (function(module, exports, __webpack_require__) {
 
 /* WEBPACK VAR INJECTION */(function(global) {module.exports = get_blob()
@@ -59364,10 +74662,10 @@ function get_blob() {
   }
 }
 
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(50)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(52)))
 
 /***/ }),
-/* 50 */
+/* 52 */
 /***/ (function(module, exports) {
 
 var g;
@@ -59394,7 +74692,7 @@ module.exports = g;
 
 
 /***/ }),
-/* 51 */
+/* 53 */
 /***/ (function(module, exports, __webpack_require__) {
 
 ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
@@ -60182,7 +75480,7 @@ exports.Mode = Mode;
 
 
 /***/ }),
-/* 52 */
+/* 54 */
 /***/ (function(module, exports, __webpack_require__) {
 
 ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
@@ -60988,7 +76286,7 @@ exports.Mode = Mode;
 
 
 /***/ }),
-/* 53 */
+/* 55 */
 /***/ (function(module, exports) {
 
 ace.define("ace/theme/chaos",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -61150,7 +76448,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
 
 
 /***/ }),
-/* 54 */
+/* 56 */
 /***/ (function(module, exports) {
 
 ace.define("ace/theme/chrome",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -61284,7 +76582,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
 
 
 /***/ }),
-/* 55 */
+/* 57 */
 /***/ (function(module, exports) {
 
 ace.define("ace/theme/monokai",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -61395,7 +76693,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
 
 
 /***/ }),
-/* 56 */
+/* 58 */
 /***/ (function(module, exports) {
 
 ace.define("ace/theme/solarized_dark",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -61489,7 +76787,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
 
 
 /***/ }),
-/* 57 */
+/* 59 */
 /***/ (function(module, exports) {
 
 ace.define("ace/theme/solarized_light",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -61586,7 +76884,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
 
 
 /***/ }),
-/* 58 */
+/* 60 */
 /***/ (function(module, exports) {
 
 ace.define("ace/theme/terminal",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -61706,7 +77004,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
 
 
 /***/ }),
-/* 59 */
+/* 61 */
 /***/ (function(module, exports) {
 
 ace.define("ace/theme/twilight",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -61821,7 +77119,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
 
 
 /***/ }),
-/* 60 */
+/* 62 */
 /***/ (function(module, exports) {
 
 ace.define("ace/theme/xcode",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -61915,7 +77213,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
 
 
 /***/ }),
-/* 61 */
+/* 63 */
 /***/ (function(module, exports) {
 
 ace.define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/dom","ace/lib/oop","ace/lib/keys","ace/lib/event","ace/search","ace/lib/useragent","ace/search_highlight","ace/commands/multi_select_commands","ace/mode/text","ace/multi_select"], function(acequire, exports, module) {
@@ -67511,7 +82809,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
 
 
 /***/ }),
-/* 62 */
+/* 64 */
 /***/ (function(module, exports) {
 
 ace.define("ace/occur",["require","exports","module","ace/lib/oop","ace/range","ace/search","ace/edit_session","ace/search_highlight","ace/lib/dom"], function(acequire, exports, module) {
@@ -68698,7 +83996,7 @@ exports.killRing = {
 
 
 /***/ }),
-/* 63 */
+/* 65 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -68779,7 +84077,7 @@ function purchaseRamForHomeComputer(cost) {
 
 
 /***/ }),
-/* 64 */
+/* 66 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -68993,7 +84291,7 @@ let HelpTexts = {
 
 
 /***/ }),
-/* 65 */
+/* 67 */
 /***/ (function(module, exports, __webpack_require__) {
 
 /*
@@ -72629,7 +87927,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
 })));
 
 /***/ }),
-/* 66 */
+/* 68 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -72638,7 +87936,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(40);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(18);
 /* 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_3__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Gang_js__ = __webpack_require__(30);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__HacknetNode_js__ = __webpack_require__(34);
@@ -72653,7 +87951,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_GameOptions_js__ = __webpack_require__(35);
 /* 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__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__ = __webpack_require__(25);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__);
 
diff --git a/index.html b/index.html
index 1e58c93d4..379044ce8 100644
--- a/index.html
+++ b/index.html
@@ -10,6 +10,7 @@
     <link rel="stylesheet" type="text/css" href="css/popupboxes.css" />
     <link rel="stylesheet" type="text/css" href="css/interactivetutorial.css" />
     <link rel="stylesheet" type="text/css" href="css/loader.css" />
+    <link rel="stylesheet" type="text/css" href="css/missions.css" />
 
     <!-- Google Analytics -->
     <script>
@@ -509,6 +510,17 @@
 		use your terminal or create scripts when you are performing a task! <br><br><br><br>
 		</p>
 
+        <div id="faction-hack-mission-div" class="faction-work-div">
+            <div id="faction-hack-mission-div-wrapper" class="faction-work-div-wrapper">
+                <a id="faction-hack-mission-button" class="a-link-button">Hacking Mission</a>
+                <p id="faction-hack-mission-text">
+                    Attempt a hacking mission for your faction.
+                    A mission is a mini game that, if won, earns you significant reputation with this faction.
+                </p>
+            </div>
+            <div class="faction-clear"></div>
+		</div>
+
 		<div id="faction-hack-div" class="faction-work-div">
             <div id="faction-hack-div-wrapper" class="faction-work-div-wrapper">
                 <a id="faction-hack-button" class="a-link-button">Hacking Contracts</a>
diff --git a/src/ActiveScriptsUI.js b/src/ActiveScriptsUI.js
index 539fb17e8..5349022f6 100644
--- a/src/ActiveScriptsUI.js
+++ b/src/ActiveScriptsUI.js
@@ -200,45 +200,26 @@ function updateActiveScriptsItemContent(workerscript) {
     var itemName = itemNameArray.join("-");
     var itemContent = document.getElementById(itemName + "-content")
 
-    //Clear the item
-    while (itemContent.firstChild) {
-        itemContent.removeChild(itemContent.firstChild);
-    }
-
     //Add the updated text back. Returns the total online production rate
-    return createActiveScriptsText(workerscript, itemContent);
+    return updateActiveScriptsText(workerscript, itemContent);
 }
 
 function createActiveScriptsText(workerscript, item) {
-    var itemText = document.createElement("p");
+    var itemTextHeader = document.createElement("p");
+    var itemTextStats = document.createElement("p");
+    var itemId = item.id;
+    itemTextStats.setAttribute("id", itemId + "-stats");
 
     //Server ip/hostname
     var threads = "Threads: " + workerscript.scriptRef.threads;
     var args = "Args: " + printArray(workerscript.args);
 
-    //Online
-    var onlineTotalMoneyMade = "Total online production: $" + formatNumber(workerscript.scriptRef.onlineMoneyMade, 2);
-    var onlineTotalExpEarned = (Array(26).join(" ") + formatNumber(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
+    itemTextHeader.innerHTML = threads + "<br>" + args + "<br>";
 
-    var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
-    var onlineMpsText = "Online production rate: $" + formatNumber(onlineMps, 2) + "/second";
-    var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
-    var onlineEpsText = (Array(25).join(" ") + formatNumber(onlineEps, 4) + " hacking exp/second").replace( / /g, "&nbsp;");
+    item.appendChild(itemTextHeader);
+    item.appendChild(itemTextStats);
 
-    //Offline
-    var offlineTotalMoneyMade = "Total offline production: $" + formatNumber(workerscript.scriptRef.offlineMoneyMade, 2);
-    var offlineTotalExpEarned = (Array(27).join(" ") + formatNumber(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
-
-    var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
-    var offlineMpsText = "Offline production rate: $" + formatNumber(offlineMps, 2) + "/second";
-    var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
-    var offlineEpsText = (Array(26).join(" ") + formatNumber(offlineEps, 4) +  " hacking exp/second").replace( / /g, "&nbsp;");
-
-    itemText.innerHTML = threads + "<br>" + args + "<br>" + onlineTotalMoneyMade + "<br>" + onlineTotalExpEarned + "<br>" +
-                         onlineMpsText + "<br>" + onlineEpsText + "<br>" + offlineTotalMoneyMade + "<br>" + offlineTotalExpEarned + "<br>" +
-                         offlineMpsText + "<br>" + offlineEpsText + "<br>";
-
-    item.appendChild(itemText);
+    var onlineMps = updateActiveScriptsText(workerscript, item, itemTextStats);
 
     var logButton = document.createElement("span");
     logButton.innerHTML = "Log";
@@ -262,4 +243,36 @@ function createActiveScriptsText(workerscript, item) {
     return onlineMps;
 }
 
+function updateActiveScriptsText(workerscript, item, statsEl=null) {
+    var itemId = item.id
+    var itemTextStats = document.getElementById(itemId + "-stats");
+    if (itemTextStats === null || itemTextStats === undefined) {
+        itemTextStats = statsEl;
+    }
+
+    //Updates statistics only
+    //Online
+    var onlineTotalMoneyMade = "Total online production: $" + formatNumber(workerscript.scriptRef.onlineMoneyMade, 2);
+    var onlineTotalExpEarned = (Array(26).join(" ") + formatNumber(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
+
+    var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
+    var onlineMpsText = "Online production rate: $" + formatNumber(onlineMps, 2) + "/second";
+    var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
+    var onlineEpsText = (Array(25).join(" ") + formatNumber(onlineEps, 4) + " hacking exp/second").replace( / /g, "&nbsp;");
+
+    //Offline
+    var offlineTotalMoneyMade = "Total offline production: $" + formatNumber(workerscript.scriptRef.offlineMoneyMade, 2);
+    var offlineTotalExpEarned = (Array(27).join(" ") + formatNumber(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
+
+    var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
+    var offlineMpsText = "Offline production rate: $" + formatNumber(offlineMps, 2) + "/second";
+    var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
+    var offlineEpsText = (Array(26).join(" ") + formatNumber(offlineEps, 4) +  " hacking exp/second").replace( / /g, "&nbsp;");
+
+    itemTextStats.innerHTML = onlineTotalMoneyMade + "<br>" + onlineTotalExpEarned + "<br>" +
+                              onlineMpsText + "<br>" + onlineEpsText + "<br>" + offlineTotalMoneyMade + "<br>" + offlineTotalExpEarned + "<br>" +
+                              offlineMpsText + "<br>" + offlineEpsText + "<br>";
+    return onlineMps;
+}
+
 export {setActiveScriptsClickHandlers, addActiveScriptsItem, deleteActiveScriptsItem, updateActiveScriptsItems};
diff --git a/src/Constants.js b/src/Constants.js
index ebf1edc2f..382a882f9 100644
--- a/src/Constants.js
+++ b/src/Constants.js
@@ -124,6 +124,7 @@ let CONSTANTS = {
     //Hacking Missions
     HackingMissionRepToDiffConversion: 5000, //Faction rep is divided by this to get mission difficulty
     HackingMissionRepToRewardConversion: 20, //Faction rep divided byt his to get mission rep reward
+    HackingMissionHowToPlay: "Hacking missions are a minigame that, if won, will reward you with factin reputation",
 
     //Gang constants
     GangRespectToReputationRatio: 2, //Respect is divided by this to get rep gain
@@ -552,8 +553,8 @@ let CONSTANTS = {
                            "<i>serverExists(hostname/ip)</i><br>Returns a boolean denoting whether or not the specified server exists. The argument " +
                            "must be a string with the hostname or IP of the target server.<br><br>" +
                            "<i>fileExists(filename, [hostname/ip])</i><br> Returns a boolean (true or false) indicating whether the specified file exists on a server. " +
-                           "The first argument must be a string with the name of the file. A file can either be a script or a program. A script name is case-sensitive, but a " +
-                           "program is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe. <br><br> " +
+                           "The first argument must be a string with the name of the file. A file can either be a script, program, or literature file. A script name is case-sensitive, but a " +
+                           "program/literature file is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe. <br><br> " +
                            "The second argument is a string with the hostname or IP of the server on which to search for the program. This second argument is optional. " +
                            "If it is omitted, then the function will search through the current server (the server running the script that calls this function) for the file. <br> " +
                            "Example: fileExists('foo.script', 'foodnstuff');<br>" +
@@ -957,6 +958,9 @@ let CONSTANTS = {
                                "World Stock Exchange account and TIX API Access<br>",
 
     LatestUpdate:
+    "v0.29.1<br>" +
+    "-Added continue statement for for/while loops<br>" +
+    "-fileExists() function now works on literature files<br><br>" +
     "v0.29.0<br>" +
     "-Added BitNode-5: Artificial Intelligence<br>" +
     "-Added getIp(), getIntelligence(), getHackingMultipliers(), and getBitNodeMultipliers() Netscript functions (requires Source-File 5)<br>" +
diff --git a/src/Faction.js b/src/Faction.js
index e82f618a0..1b3191569 100644
--- a/src/Faction.js
+++ b/src/Faction.js
@@ -5,6 +5,7 @@ import {CONSTANTS}                              from "./Constants.js";
 import {Engine}                                 from "./engine.js";
 import {FactionInfo}                            from "./FactionInfo.js";
 import {Locations}                              from "./Location.js";
+import {HackingMission, setInMission}           from "./Missions.js";
 import {Player}                                 from "./Player.js";
 import {Settings}                               from "./Settings.js";
 
@@ -455,16 +456,26 @@ function displayFactionContent(factionName) {
                                                          "is gained whenever you reset after installing an Augmentation. The amount of " +
                                                          "favor you gain depends on how much reputation you have with the faction</span>";
 
+    var hackMissionDiv      = document.getElementById("faction-hack-mission-div");
 	var hackDiv 			= document.getElementById("faction-hack-div");
 	var fieldWorkDiv 		= document.getElementById("faction-fieldwork-div");
 	var securityWorkDiv 	= document.getElementById("faction-securitywork-div");
     var donateDiv           = document.getElementById("faction-donate-div");
     var gangDiv             = document.getElementById("faction-gang-div");
 
+    var newHackMissionButton = clearEventListeners("faction-hack-mission-button");
     var newHackButton = clearEventListeners("faction-hack-button");
     var newFieldWorkButton = clearEventListeners("faction-fieldwork-button");
     var newSecurityWorkButton = clearEventListeners("faction-securitywork-button");
     var newDonateWorkButton = clearEventListeners("faction-donate-button");
+    newHackMissionButton.addEventListener("click", function() {
+        Engine.loadMissionContent();
+        var mission = new HackingMission(faction.playerReputation, faction);
+        setInMission(true); //Sets inMission flag to true
+        mission.init();
+        return false;
+    });
+
     newHackButton.addEventListener("click", function() {
         Player.startFactionHackWork(faction);
         return false;
@@ -602,156 +613,187 @@ function displayFactionContent(factionName) {
 
 		switch(faction.name) {
 			case "Illuminati":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "Daedalus":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "The Covenant":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "ECorp":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "MegaCorp":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Bachman & Associates":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Blade Industries":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "NWO":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Clarke Incorporated":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "OmniTek Incorporated":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Four Sigma":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "KuaiGong International":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
             case "Fulcrum Secret Technologies":
+                hackMissionDiv.style.display = "inline";
                 hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "none";
 				securityWorkDiv.style.display = "inline";
                 break;
 			case "BitRunners":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "none";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "The Black Hand":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "NiteSec":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "none";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "Chongqing":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Sector-12":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "New Tokyo":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Aevum":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Ishima":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Volhaven":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "Speakers for the Dead":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "The Dark Army":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "none";
 				break;
 			case "The Syndicate":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "inline";
 				securityWorkDiv.style.display = "inline";
 				break;
             case "Silhouette":
+                hackMissionDiv.style.display = "inline";
                 hackDiv.style.display = "inline";
                 fieldWorkDiv.style.display = "inline";
                 securityWorkDiv.style.display = "none";
                 break;
             case "Tetrads":
+                hackMissionDiv.style.display = "none";
                 hackDiv.style.display = "none";
                 fieldWorkDiv.style.display = "inline";
                 securityWorkDiv.style.display = "inline";
                 break;
             case "Slum Snakes":
+                hackMissionDiv.style.display = "none";
                 hackDiv.style.display = "none";
                 fieldWorkDiv.style.display = "inline";
                 securityWorkDiv.style.display = "inline";
                 break;
             case "Netburners":
+                hackMissionDiv.style.display = "inline";
                 hackDiv.style.display = "inline";
                 fieldWorkDiv.style.display = "none";
                 securityWorkDiv.style.display = "none";
                 break;
 			case "Tian Di Hui":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "none";
 				securityWorkDiv.style.display = "inline";
 				break;
 			case "CyberSec":
+                hackMissionDiv.style.display = "inline";
 				hackDiv.style.display = "inline";
 				fieldWorkDiv.style.display = "none";
 				securityWorkDiv.style.display = "none";
diff --git a/src/Missions.js b/src/Missions.js
new file mode 100644
index 000000000..563984dc2
--- /dev/null
+++ b/src/Missions.js
@@ -0,0 +1,611 @@
+import {Player}                                     from "./Player.js";
+import {CONSTANTS}                                  from "./Constants.js";
+import {dialogBoxCreate}                            from "../utils/DialogBox.js";
+import {addOffset, getRandomInt,
+        clearEventListenersEl}                      from "../utils/HelperFunctions.js";
+import {formatNumber}                               from "../utils/StringHelperFunctions.js";
+import jsplumb                                      from 'jsplumb'
+
+let inMission = false; //Flag to denote whether a mission is running
+function setInMission(bool) {
+    inMission = bool;
+}
+/* Hacking Missions */
+
+/*You start with N CPU nodes dependent on home computer cores
+
+Three main stats:
+    Attack - Specific to a node. Affected by hacking skill, RAM (for home comp)
+    Defense - Universal defense - summed from all nodes
+    HP - Specific to a node. Affected by hacking skill, RAM (for home comp)
+
+Enemy has the following nodes:
+    Firewall Nodes - Essentially shields. Weak attack but large def
+    CPU Nodes - Defeating and capturing these will give you new nodes to use
+    Database Node - Main Target
+
+Misc Nodes (initially not owned by player or enemy):
+    Spam nodes - Increases time limit
+    Transfer Nodes - Slightly increases attack for all of your CPUs
+    Shield Node - Increases your defense
+
+Shapes for nodes:
+    Firewall - Rectangle
+    CPU - Circle
+    Database - Parralelogram
+    Spam - Diamond
+    Transfer - Cone
+    Shield - Shield shape
+
+*/
+let NodeTypes = {
+    Core: "CPU Core Node",      //All actions available
+    Firewall: "Firewall Node",  //No actions available
+    Database: "Database Node",  //No actions available
+    Spam: "Spam Node",          //No actions Available
+    Transfer: "Transfer Node",  //Can Soften, Scan, and Overflow
+    Shield: "Shield Node"       //Can Fortify
+}
+
+let NodeActions = {
+    Attack: "Attack", //Damaged based on attack stat + hacking level + opp def
+    Scan: "Scan", //-Def for target, affected by hacking level
+    Soften: "Soften", //-Attack for target, affected by hacking level
+    Fortify: "Fortify", //+Defense for Node, affected by hacking level
+    Overflow: "Overflow", //+Attack but -Defense for Node, affected by hacking level
+}
+
+function Node(type, stats) {
+    this.type = type;
+    this.atk = stats.atk ? stats.atk : 0;
+    this.def = stats.def ? stats.def : 0;
+    this.hp = stats.hp ? stats.hp : 0;
+    this.maxhp = this.hp;
+    this.plyrCtrl = false;
+    this.enmyCtrl = false;
+    this.pos = [0, 0]; //x, y
+    this.el = null; //Holds the Node's DOM element
+    this.action = null;
+}
+
+Node.prototype.setPosition = function(x, y) {
+    this.pos = [x, y];
+}
+
+Node.prototype.setControlledByPlayer = function() {
+    this.plyrCtrl = true;
+    this.enmyCtrl = false;
+    if (this.el) {
+        this.classList.remove("hack-mission-enemy-node");
+        this.classList.add("hack-mission-player-node");
+    }
+}
+
+Node.prototype.setControlledByEnemy = function() {
+    this.plyrCtrl = false;
+    this.enmyCtrl = true;
+    if (this.el) {
+        this.classList.remove("hack-mission-player-node");
+        this.classList.add("hack-mission-enemy-node");
+    }
+}
+
+//Sets this node to be the active node
+Node.prototype.select = function(actionButtons) {
+    if (this.enmyCtrl) {return;}
+    this.el.classList.add("hack-mission-player-node-active");
+
+    //Make all buttons inactive
+    for (var i = 0; i < actionButtons.length; ++i) {
+        actionButtons[i].classList.remove("a-link-button");
+        actionButtons[i].classList.add("a-link-button-inactive");
+    }
+
+    switch(this.type) {
+        case NodeTypes.Core:
+            //All buttons active
+            for (var i = 0; i < actionButtons.length; ++i) {
+                actionButtons[i].classList.remove("a-link-button-inactive");
+                actionButtons[i].classList.add("a-link-button");
+            }
+            break;
+        case NodeTypes.Transfer:
+            actionButtons[1].classList.remove("a-link-button-inactive");
+            actionButtons[1].classList.add("a-link-button");
+            actionButtons[2].classList.remove("a-link-button-inactive");
+            actionButtons[2].classList.add("a-link-button");
+            actionButtons[4].classList.remove("a-link-button-inactive");
+            actionButtons[4].classList.add("a-link-button");
+            break;
+        default:
+            break;
+    }
+}
+
+Node.prototype.deselect = function(actionButtons) {
+    this.el.classList.remove("active");
+    for (var i = 0; i < actionButtons.length; ++i) {
+        actionButtons[i].classList.remove("a-link-button");
+        actionButtons[i].classList.add("a-link-button-inactive");
+    }
+}
+
+//Hacking mission instance
+//Takes in the reputation of the Faction for which the mission is
+//being conducted
+function HackingMission(rep, fac) {
+    this.faction = fac;
+
+    this.playerCores = [];
+    this.playerNodes = []; //Non-core nodes
+    this.playerDef = 0;
+
+    this.enemyCores = [];
+    this.enemyDatabases = [];
+    this.enemyNodes = []; //Non-core nodes
+    this.enemyDef = 0;
+
+    this.miscNodes = [];
+
+    this.selectedNode = null; //Which of the player's nodes is currently selected
+
+    this.actionButtons = []; //DOM buttons for actions
+
+    this.availablePositions = [];
+    for (var r = 0; r < 8; ++r) {
+        for (var c = 0; c < 8; ++c) {
+            this.availablePositions.push([r, c]);
+        }
+    }
+
+    //this.map = Array(8).fill(Array(8).fill(null)); //8x8 2d array of references to Nodes
+    this.map = [];
+    for (var i = 0; i < 8; ++i) {
+        this.map.push([null, null, null, null, null, null, null, null]);
+    }
+
+    //difficulty capped at 16
+    this.difficulty = Math.min(16, Math.round(rep / CONSTANTS.HackingMissionRepToDiffConversion) + 1);
+    console.log("difficulty: " + this.difficulty);
+    this.reward = 200 + (rep / CONSTANTS.HackingMissionRepToRewardConversion);
+}
+
+HackingMission.prototype.init = function() {
+    //Create Header DOM
+    this.createPageDom();
+
+    //Create player starting nodes
+    var home = Player.getHomeComputer()
+    for (var i = 0; i < home.cpuCores; ++i) {
+        var stats = {
+            atk: (Player.hacking_skill / 10) * (home.maxRam / 8),
+            def: (Player.hacking_skill / 20) * (home.maxRam / 2),
+            hp: (Player.hacking_skill / 5) * (home.maxRam / 4),
+        };
+        this.playerCores.push(new Node(NodeTypes.Core, stats));
+        this.playerCores[i].setControlledByPlayer();
+        this.setNodePosition(this.playerCores[i], 0, i);
+        this.removeAvailablePosition(0, i);
+    }
+
+    //Randomly generate enemy nodes (CPU and Firewall) based on difficulty
+    var numNodes = getRandomInt(this.difficulty, this.difficulty + 2);
+    var numFirewalls = getRandomInt(this.difficulty, this.difficulty + 5);
+    var numDatabases = getRandomInt(this.difficulty, this.difficulty + 1);
+    var totalNodes = numNodes + numFirewalls + numDatabases;
+    var xlimit = 7 - Math.floor(totalNodes / 8);
+    console.log("numNodes: " + numNodes);
+    console.log("numFirewalls: " + numFirewalls);
+    console.log("numDatabases: " + numDatabases);
+    console.log("totalNodes: " + totalNodes);
+    console.log("xlimit: " + xlimit);
+    var randMult = addOffset(this.difficulty, 20);
+    for (var i = 0; i < numNodes; ++i) {
+        var stats = {
+            atk: randMult * getRandomInt(400, 750),
+            def: randMult * getRandomInt(400, 750),
+            hp: randMult * getRandomInt(800, 1200)
+        }
+        this.enemyCores.push(new Node(NodeTypes.Core, stats));
+        this.enemyCores[i].setControlledByEnemy();
+        this.setNodeRandomPosition(this.enemyCores[i], xlimit);
+    }
+    for (var i = 0; i < numFirewalls; ++i) {
+        var stats = {
+            atk: randMult * getRandomInt(100, 400),
+            def: randMult * getRandomInt(1000, 2500),
+            hp: randMult * getRandomInt(500, 2000)
+        }
+        this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));
+        this.enemyNodes[i].setControlledByEnemy();
+        this.setNodeRandomPosition(this.enemyNodes[i], xlimit);
+    }
+    for (var i = 0; i < numDatabases; ++i) {
+        var stats = {
+            atk: randMult * getRandomInt(100, 200),
+            def: randMult * getRandomInt(1000, 1500),
+            hp: randMult * getRandomInt(1000, 2000)
+        }
+        var node = new Node(NodeTypes.Database, stats);
+        node.setControlledByEnemy();
+        this.setNodeRandomPosition(node, xlimit);
+        this.enemyDatabases.push(node);
+    }
+    this.calculateDefenses();
+    this.createMap();
+}
+
+HackingMission.prototype.createPageDom = function() {
+    var container = document.getElementById("mission-container");
+
+    var headerText = document.createElement("p");
+    headerText.innerHTML = "You are about to start a hacking mission! For more information " +
+                    "about how hacking missions work, click one of the guide links " +
+                    "below (one opens up an in-game guide and the other opens up " +
+                    "the guide from the wiki). Click the 'Start' button to begin.";
+    headerText.style.display = "block";
+    headerText.classList.add("hack-mission-header-element");
+    headerText.style.width = "80%";
+
+    var inGameGuideBtn = document.createElement("a");
+    inGameGuideBtn.innerText = "How to Play";
+    inGameGuideBtn.classList.add("a-link-button");
+    inGameGuideBtn.style.display = "inline-block";
+    inGameGuideBtn.classList.add("hack-mission-header-element");
+    inGameGuideBtn.addEventListener("click", function() {
+        dialogBoxCreate(CONSTANTS.HackingMissionHowToPlay);
+        return false;
+    });
+
+    var wikiGuideBtn = document.createElement("a");
+    wikiGuideBtn.innerText = "Wiki Guide";
+    wikiGuideBtn.classList.add("a-link-button");
+    wikiGuideBtn.style.display = "inline-block";
+    wikiGuideBtn.classList.add("hack-mission-header-element");
+    wikiGuideBtn.target = "_blank";
+    //TODO Add link to wiki page     wikiGuideBtn.href =
+
+
+    //Start button will get replaced with forfeit when game is started
+    var startBtn = document.createElement("a");
+    startBtn.classList.add("hack-mission-header-element");
+    startBtn.style.display = "block";
+
+    //Create Action Buttons (Attack/Scan/Soften/ etc...)
+    var actionsContainer = document.createElement("span");
+    actionsContainer.classList.add("hack-mission-action-buttons-container");
+    for (var i = 0; i < 5; ++i) {
+        this.actionButtons.push(document.createElement("a"));
+        this.actionButtons[i].style.display = "inline-block";
+        this.actionButtons[i].classList.add("a-link-button-inactive"); //Disabled at start
+        this.actionButtons[i].classList.add("tooltip"); //Disabled at start
+        this.actionButtons[i].classList.add("hack-mission-header-element");
+        actionsContainer.appendChild(this.actionButtons[i]);
+    }
+    this.actionButtons[0].innerText = "Attack(1)";
+    var atkTooltip = document.createElement("span");
+    atkTooltip.classList.add("tooltiptext");
+    atkTooltip.innerText = "Lowers the targeted node's HP. The effectiveness of this depends on " +
+                           "this node's Attack level, your hacking level, and the opponents defense level.";
+    this.actionButtons[0].appendChild(atkTooltip);
+    this.actionButtons[1].innerText = "Scan(2)";
+    var scanTooltip = document.createElement("span");
+    scanTooltip.classList.add("tooltiptext");
+    scanTooltip.innerText = "Lowers the targeted node's defense. The effectiveness of this depends on " +
+                            "this node's Attack level and your hacking level";
+    this.actionButtons[1].appendChild(scanTooltip);
+    this.actionButtons[2].innerText = "Soften(3)";
+    var softenTooltip = document.createElement("span");
+    softenTooltip.classList.add("tooltiptext");
+    softenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
+                              "this node's Attack level and your hacking level";
+    this.actionButtons[2].appendChild(softenTooltip);
+    this.actionButtons[3].innerText = "Fortify(4)";
+    var fortifyTooltip = document.createElement("span");
+    fortifyTooltip.classList.add("tooltiptext");
+    fortifyTooltip.innerText = "Raises this node's Defense level. The effectiveness of this depends on " +
+                               "your hacking level";
+    this.actionButtons[3].appendChild(fortifyTooltip);
+    this.actionButtons[4].innerText = "Overflow(5)";
+    var overflowTooltip = document.createElement("span");
+    overflowTooltip.classList.add("tooltiptext");
+    overflowTooltip.innerText = "Raises this node's Attack level but lowers its Defense level. The effectiveness " +
+                                "of this depends on your hacking level.";
+    this.actionButtons[4].appendChild(overflowTooltip);
+
+    var timeDisplay = document.createElement("p");
+
+    container.appendChild(headerText);
+    container.appendChild(inGameGuideBtn);
+    container.appendChild(wikiGuideBtn);
+    container.appendChild(startBtn);
+    container.appendChild(actionsContainer);
+    container.appendChild(timeDisplay);
+}
+
+//Should only be used at the start
+HackingMission.prototype.calculateDefenses = function() {
+    var total = 0;
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        total += this.playerCores[i].def;
+    }
+    for (var i = 0; i < this.playerNodes.length; ++i) {
+        total += this.playerNodes[i].def;
+    }
+    console.log("player defenses calculated to be: " + total);
+    this.playerDef = total;
+    total = 0;
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        total += this.enemyCores[i].def;
+    }
+    for (var i = 0; i < this.enemyDatabases.length; ++i) {
+        total += this.enemyDatabases[i].def;
+    }
+    for (var i = 0; i < this.enemyNodes.length; ++i) {
+        total += this.enemyNodes[i].def;
+    }
+    console.log("enemy defenses calculated to be: " + total);
+    this.enemyDef = total;
+}
+
+HackingMission.prototype.removeAvailablePosition = function(x, y) {
+    for (var i = 0; i < this.availablePositions.length; ++i) {
+        if (this.availablePositions[i][0] === x &&
+            this.availablePositions[i][1] === y) {
+            this.availablePositions.splice(i, 1);
+            return;
+        }
+    }
+    console.log("WARNING: removeAvailablePosition() did not remove " + x + ", " + y);
+}
+
+HackingMission.prototype.setNodePosition = function(nodeObj, x, y) {
+    if (!(nodeObj instanceof Node)) {
+        console.log("WARNING: Non-Node object passed into setNodePOsition");
+        return;
+    }
+    if (isNaN(x) || isNaN(y)) {
+        console.log("ERR: Invalid values passed as x and y for setNodePosition");
+        console.log(x);
+        console.log(y);
+        return;
+    }
+    nodeObj.pos = [x, y];
+    this.map[x][y] = nodeObj;
+}
+
+HackingMission.prototype.setNodeRandomPosition = function(nodeObj, xlimit=0) {
+    var i = getRandomInt(0, this.availablePositions.length - 1);
+    var pos = this.availablePositions.splice(i, 1);
+    pos = pos[0];
+    this.setNodePosition(nodeObj, pos[0], pos[1]);
+}
+
+HackingMission.prototype.createMap = function() {
+    //Use a grid
+    var map = document.createElement("div");
+    map.classList.add("hack-mission-grid");
+    map.setAttribute("id", "hacking-mission-map");
+    document.getElementById("mission-container").appendChild(map);
+
+    //Create random Nodes for every space in the map that
+    //hasn't been filled yet
+    for (var x = 0; x < 8; ++x) {
+        for (var y = 0; y < 8; ++y) {
+            if (!(this.map[x][y] instanceof Node)) {
+                var node, type = getRandomInt(0, 2);
+                var randMult = addOffset(this.difficulty, 20);
+                switch (type) {
+                    case 0: //Spam
+                        var stats = {
+                            atk: 0,
+                            def: randMult * getRandomInt(400, 800),
+                            hp: randMult * getRandomInt(500, 1000)
+                        }
+                        node = new Node(NodeTypes.Spam, stats);
+                        break;
+                    case 1: //Transfer
+                        var stats = {
+                            atk: 0,
+                            def: randMult * getRandomInt(500, 1000),
+                            hp: randMult * getRandomInt(600, 1100)
+                        }
+                        node = new Node(NodeTypes.Transfer, stats);
+                        break;
+                    case 2: //Shield
+                    default:
+                        var stats = {
+                            atk: 0,
+                            def: randMult * getRandomInt(750, 1000),
+                            hp: randMult * getRandomInt(700, 1000)
+                        }
+                        node = new Node(NodeTypes.Shield, stats);
+                        break;
+                }
+                this.setNodePosition(node, x, y);
+                this.removeAvailablePosition(x, y);
+                this.miscNodes.push(node);
+            }
+        }
+    }
+
+    //Create DOM elements in order
+    for (var r = 0; r < 8; ++r) {
+        for (var c = 0; c < 8; ++c) {
+            this.createNodeDomElement(this.map[r][c]);
+        }
+    }
+
+    //Configure all Player CPUS
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        console.log("Configuring Player Node: " + this.playerCores[i].el.id);
+        this.configurePlayerNodeElement(this.playerCores[i].el);
+    }
+
+    console.log(this.map);
+    this.initJsPlumb();
+}
+
+HackingMission.prototype.createNodeDomElement = function(nodeObj) {
+    var nodeDiv = document.createElement("a");
+    nodeObj.el = nodeDiv;
+    document.getElementById("hacking-mission-map").appendChild(nodeDiv);
+
+    //Set the node element's id based on its coordinates
+    nodeDiv.setAttribute("id", "hacking-mission-node-" +
+                                nodeObj.pos[0] + "-" +
+                                nodeObj.pos[1]);
+
+    //Set node classes for owner
+    nodeDiv.classList.add("hack-mission-node");
+    if (nodeObj.plyrCtrl) {
+        nodeDiv.classList.add("hack-mission-player-node");
+    } else if (nodeObj.enmyCtrl) {
+        nodeDiv.classList.add("hack-mission-enemy-node");
+    }
+
+    //Set node classes based on type
+    switch (nodeObj.type) {
+        case NodeTypes.Core:
+            nodeDiv.innerHTML = "<p>CPU Core<br>" + "HP: " +
+                                formatNumber(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-cpu-node");
+            break;
+        case NodeTypes.Firewall:
+            nodeDiv.innerHTML = "<p>Firewall<br>" + "HP: " +
+                                formatNumber(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-firewall-node");
+            break;
+        case NodeTypes.Database:
+            nodeDiv.innerHTML = "<p>Database<br>" + "HP: " +
+                                formatNumber(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-database-node");
+            break;
+        case NodeTypes.Spam:
+            nodeDiv.innerHTML = "<p>Spam<br>" + "HP: " +
+                                formatNumber(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-spam-node");
+            break;
+        case NodeTypes.Transfer:
+            nodeDiv.innerHTML = "<p>Transfer<br>" + "HP: " +
+                                formatNumber(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-transfer-node");
+            break;
+        case NodeTypes.Shield:
+        default:
+            nodeDiv.innerHTML = "<p>Shield<br>" + "HP: " +
+                                formatNumber(nodeObj.hp, 1) + "</p>";
+            nodeDiv.classList.add("hack-mission-shield-node");
+            break;
+    }
+}
+
+//Gets a Node DOM element's corresponding Node object using its
+//element id
+HackingMission.prototype.getNodeFromElement = function(el) {
+    var id = el.id;
+    id = id.replace("hacking-mission-node-", "");
+    var res = id.split('-');
+    if (res.length != 2) {
+        console.log("ERROR Parsing Hacking Mission Node Id. Could not find coordinates");
+        return null;
+    }
+    var x = res[0], y = res[1];
+    if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) {
+        console.log("ERROR: Unexpected values for x and y: " + x + ", " + y);
+        return null;
+    }
+    return this.map[x][y];
+}
+
+//Configures a DOM element representing a player-owned node to
+//be selectable and actionable
+//Note: Does NOT change its css class. This is handled by Node.setControlledBy...
+HackingMission.prototype.configurePlayerNodeElement = function(el) {
+    var nodeObj = this.getNodeFromElement(el);
+    if (nodeObj === null) {console.log("Error getting Node object");}
+
+    //Add event listener
+    el.addEventListener("click", ()=>{
+        if (this.selectedNode instanceof Node) {
+            this.selectedNode.deselect(this.actionButtons);
+            this.selectedNode = null;
+        }
+        console.log("Selecting node :" + el.id);
+        nodeObj.select(this.actionButtons);
+        this.selectedNode = nodeObj;
+    });
+}
+
+//Configures a DOM element representing an enemy-node by removing
+//any event listeners
+HackingMission.prototype.configureEnemyNodeElement = function(el) {
+    //Deselect node if it was the selected node
+    var nodeObj = this.getNodeFromElement(el);
+    if (this.selectedNode == nodeObj) {
+        nodeObj.deselect(this.actionButtons);
+    }
+}
+
+HackingMission.prototype.initJsPlumb = function() {
+    var instance = jsPlumb.getInstance({
+        DragOptions:{cursor:"pointer", zIndex:2000},
+        PaintStyle: {
+            gradient: { stops: [
+                [ 0, "#FFFFFF" ],
+                [ 1, "#FFFFFF" ]
+            ] },
+            stroke: "#FFFFFF",
+            strokeWidth: 10
+        },
+    });
+
+    //All player cores are sources
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        instance.makeSource(this.playerCores[i].el, {
+            deleteEndpointsOnEmpty:true,
+            maxConnections:1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+
+    //Everything else is a target
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        instance.makeTarget(this.enemyCores[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+    for (var i = 0; i < this.enemyDatabases.length; ++i) {
+        instance.makeTarget(this.enemyDatabases[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:["Straight"]
+        });
+    }
+    for (var i = 0; i < this.enemyNodes.length; ++i) {
+        instance.makeTarget(this.enemyNodes[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+    for (var i = 0; i < this.miscNodes.length; ++i) {
+        instance.makeTarget(this.miscNodes[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+
+    //Clicking a connection drops it
+    instance.bind("click", function(conn, originalEvent) {
+        console.log("test");
+        var endpoints = conn.endpoints;
+        endpoints[0].detachFrom(endpoints[1]);
+    });
+}
+
+export {HackingMission, inMission, setInMission};
diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js
index 33b2e4be4..d6981e38c 100644
--- a/src/NetscriptEvaluator.js
+++ b/src/NetscriptEvaluator.js
@@ -201,6 +201,9 @@ function evaluate(exp, workerScript) {
             case "BreakStatement":
                 reject("BREAKSTATEMENT");
                 break;
+            case "ContinueStatement":
+                reject("CONTINUESTATEMENT");
+                break;
             case "IfStatement":
                 evaluateIf(exp, workerScript).then(function(forLoopRes) {
                     resolve("forLoopDone");
@@ -524,7 +527,23 @@ function evaluateFor(exp, workerScript) {
 						reject(e);
 					});
 				}, function(e) {
-					reject(e);
+                    if (e == "CONTINUESTATEMENT" ||
+                       (e instanceof WorkerScript && e.errorMessage == "CONTINUESTATEMENT")) {
+                        //Continue statement, recurse to next iteration
+                        var pUpdate = evaluate(exp.update, workerScript);
+       					pUpdate.then(function(resPostloop) {
+       						var recursiveCall = evaluateFor(exp, workerScript);
+       						recursiveCall.then(function(foo) {
+       							resolve("endForLoop");
+       						}, function(e) {
+       							reject(e);
+       						});
+       					}, function(e) {
+       						reject(e);
+       					});
+                    } else {
+                        reject(e);
+                    }
 				});
 			} else {
 				resolve("endForLoop");	//Doesn't need to resolve to any particular value
@@ -561,7 +580,18 @@ function evaluateWhile(exp, workerScript) {
 						evaluatePromise.then(function(resCode) {
 							resolve(resCode);
 						}, function(e) {
-                            reject(e);
+                            if (e == "CONTINUESTATEMENT" ||
+                               (e instanceof WorkerScript && e.errorMessage == "CONTINUESTATEMENT")) {
+                                //Continue statement, recurse
+                                var recursiveCall = evaluateWhile(exp, workerScript);
+            					recursiveCall.then(function(foo) {
+            						resolve("endWhileLoop");
+            					}, function(e) {
+            						reject(e);
+            					});
+                            } else {
+                                reject(e);
+                            }
 						});
 					}, CONSTANTS.CodeInstructionRunTime);
 				});
diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js
index 69b8133b0..b049da8e4 100644
--- a/src/NetscriptFunctions.js
+++ b/src/NetscriptFunctions.js
@@ -770,6 +770,12 @@ function NetscriptFunctions(workerScript) {
                     return true;
                 }
             }
+            for (var i = 0; i < server.messages.length; ++i) {
+                if (!(server.messages[i] instanceof Message) &&
+                    filename.toLowerCase() === server.messages[i]) {
+                    return true;
+                }
+            }
             return false;
         },
         isRunning : function(filename,ip){
diff --git a/src/Script.js b/src/Script.js
index c3d690f1b..11219db16 100644
--- a/src/Script.js
+++ b/src/Script.js
@@ -12,8 +12,6 @@ require('brace/theme/xcode');
 require("brace/keybinding/vim");
 require("brace/keybinding/emacs");
 
-
-
 import {CONSTANTS}                              from "./Constants.js";
 import {Engine}                                 from "./engine.js";
 import {iTutorialSteps, iTutorialNextStep,
diff --git a/src/engine.js b/src/engine.js
index 66da6f051..de87ea2a7 100644
--- a/src/engine.js
+++ b/src/engine.js
@@ -178,6 +178,7 @@ let Engine = {
         locationContent:                null,
         workInProgressContent:          null,
         redPillContent:                 null,
+        missionContent:                 null,
 
         //Character info
         characterInfo:                  null,
@@ -202,6 +203,7 @@ let Engine = {
         Infiltration:       "Infiltration",
         StockMarket:        "StockMarket",
         Gang:               "Gang",
+        Mission:            "Mission",
     },
     currentPage:    null,
 
@@ -385,7 +387,13 @@ let Engine = {
             Engine.loadTerminalContent();
             Engine.currentPage = Engine.Page.Terminal;
         }
+    },
 
+    loadMissionContent: function() {
+        Engine.hideAllContent();
+        document.getElementById("mainmenu-container").style.visibility = "hidden";
+        document.getElementById("character-overview-wrapper").style.visibility = "hidden";
+        Engine.Display.missionContent.style.visibility = "visible";
     },
 
     //Helper function that hides all content
@@ -407,6 +415,7 @@ let Engine = {
         Engine.Display.redPillContent.style.visibility = "hidden";
         Engine.Display.infiltrationContent.style.visibility = "hidden";
         Engine.Display.stockMarketContent.style.visibility = "hidden";
+        Engine.Display.missionContent.style.visibility = "hidden";
         if (document.getElementById("gang-container")) {
             document.getElementById("gang-container").style.visibility = "hidden";
         }
@@ -1278,6 +1287,8 @@ let Engine = {
         Engine.Display.stockMarketContent = document.getElementById("stock-market-container");
         Engine.Display.stockMarketContent.style.visibility = "hidden";
 
+        Engine.Display.missionContent = document.getElementById("mission-container");
+        Engine.Display.missionContent.style.visibility = "hidden";
 
         //Character info
         Engine.Display.characterInfo = document.getElementById("character-info");
diff --git a/utils/HelperFunctions.js b/utils/HelperFunctions.js
index c16a0a20a..5fb168ea1 100644
--- a/utils/HelperFunctions.js
+++ b/utils/HelperFunctions.js
@@ -30,6 +30,14 @@ function clearEventListeners(elemId) {
     return newElem;
 }
 
+//Same as clearEventListeners except it takes a DOM element object rather than an ID
+function clearEventListenersEl(el) {
+    if (el == null) {console.log("ERR: element passed into clearEventListenersEl is null"); return null;}
+    var newElem = el.cloneNode(true);
+    el.parentNode.replaceChild(newElem, el);
+    return newElem;
+}
+
 function getRandomInt(min, max) {
     if (min > max) {return getRandomInt(max, min);}
     return Math.floor(Math.random() * (max - min + 1)) + min;
@@ -59,4 +67,4 @@ function powerOfTwo(n) {
 }
 
 export {sizeOfObject, addOffset, clearEventListeners, getRandomInt,
-        compareArrays, printArray, powerOfTwo};
+        compareArrays, printArray, powerOfTwo, clearEventListenersEl};

From ffa59d977935574e89b43146a85a5a09be7c1752 Mon Sep 17 00:00:00 2001
From: danielyxie <danielyxie@gmail.com>
Date: Thu, 21 Sep 2017 16:28:24 -0500
Subject: [PATCH 2/6] Adding jsplum to utils...I think this can be deleted
 actually

---
 utils/jsplumb.min.js | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 utils/jsplumb.min.js

diff --git a/utils/jsplumb.min.js b/utils/jsplumb.min.js
new file mode 100644
index 000000000..65243e290
--- /dev/null
+++ b/utils/jsplumb.min.js
@@ -0,0 +1,7 @@
+(function(){"undefined"==typeof Math.sgn&&(Math.sgn=function(a){return 0==a?0:a>0?1:-1});var a={subtract:function(a,b){return{x:a.x-b.x,y:a.y-b.y}},dotProduct:function(a,b){return a.x*b.x+a.y*b.y},square:function(a){return Math.sqrt(a.x*a.x+a.y*a.y)},scale:function(a,b){return{x:a.x*b,y:a.y*b}}},b=64,c=Math.pow(2,-b-1),d=function(b,c){for(var d=[],e=f(b,c),h=c.length-1,i=2*h-1,j=g(e,i,d,0),k=a.subtract(b,c[0]),m=a.square(k),n=0,o=0;j>o;o++){k=a.subtract(b,l(c,h,d[o],null,null));var p=a.square(k);m>p&&(m=p,n=d[o])}return k=a.subtract(b,c[h]),p=a.square(k),m>p&&(m=p,n=1),{location:n,distance:m}},e=function(a,b){var c=d(a,b);return{point:l(b,b.length-1,c.location,null,null),location:c.location}},f=function(b,c){for(var d=c.length-1,e=2*d-1,f=[],g=[],h=[],i=[],k=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]],l=0;d>=l;l++)f[l]=a.subtract(c[l],b);for(var l=0;d-1>=l;l++)g[l]=a.subtract(c[l+1],c[l]),g[l]=a.scale(g[l],3);for(var m=0;d-1>=m;m++)for(var n=0;d>=n;n++)h[m]||(h[m]=[]),h[m][n]=a.dotProduct(g[m],f[n]);for(l=0;e>=l;l++)i[l]||(i[l]=[]),i[l].y=0,i[l].x=parseFloat(l)/e;for(var o=d,p=d-1,q=0;o+p>=q;q++){var r=Math.max(0,q-p),s=Math.min(q,o);for(l=r;s>=l;l++)j=q-l,i[l+j].y+=h[j][l]*k[j][l]}return i},g=function(a,c,d,e){var f,j,m=[],n=[],o=[],p=[];switch(h(a,c)){case 0:return 0;case 1:if(e>=b)return d[0]=(a[0].x+a[c].x)/2,1;if(i(a,c))return d[0]=k(a,c),1}l(a,c,.5,m,n),f=g(m,c,o,e+1),j=g(n,c,p,e+1);for(var q=0;f>q;q++)d[q]=o[q];for(var q=0;j>q;q++)d[q+f]=p[q];return f+j},h=function(a,b){var c,d,e=0;c=d=Math.sgn(a[0].y);for(var f=1;b>=f;f++)c=Math.sgn(a[f].y),c!=d&&e++,d=c;return e},i=function(a,b){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;i=a[0].y-a[b].y,j=a[b].x-a[0].x,k=a[0].x*a[b].y-a[b].x*a[0].y;for(var t=max_distance_below=0,u=1;b>u;u++){var v=i*a[u].x+j*a[u].y+k;v>t?t=v:max_distance_below>v&&(max_distance_below=v)}return n=0,o=1,p=0,q=i,r=j,s=k-t,l=n*r-q*o,m=1/l,e=(o*s-r*p)*m,q=i,r=j,s=k-max_distance_below,l=n*r-q*o,m=1/l,f=(o*s-r*p)*m,g=Math.min(e,f),h=Math.max(e,f),d=h-g,c>d?1:0},k=function(a,b){var c=1,d=0,e=a[b].x-a[0].x,f=a[b].y-a[0].y,g=a[0].x-0,h=a[0].y-0,i=e*d-f*c,j=1/i,k=(e*h-f*g)*j;return 0+c*k},l=function(a,b,c,d,e){for(var f=[[]],g=0;b>=g;g++)f[0][g]=a[g];for(var h=1;b>=h;h++)for(var g=0;b-h>=g;g++)f[h]||(f[h]=[]),f[h][g]||(f[h][g]={}),f[h][g].x=(1-c)*f[h-1][g].x+c*f[h-1][g+1].x,f[h][g].y=(1-c)*f[h-1][g].y+c*f[h-1][g+1].y;if(null!=d)for(g=0;b>=g;g++)d[g]=f[g][0];if(null!=e)for(g=0;b>=g;g++)e[g]=f[b-g][g];return f[b][0]},m={},n=function(a){var b=m[a];if(!b){b=[];var c=function(){return function(b){return Math.pow(b,a)}},d=function(){return function(b){return Math.pow(1-b,a)}},e=function(a){return function(){return a}},f=function(){return function(a){return a}},g=function(){return function(a){return 1-a}},h=function(a){return function(b){for(var c=1,d=0;d<a.length;d++)c*=a[d](b);return c}};b.push(new c);for(var i=1;a>i;i++){for(var j=[new e(a)],k=0;a-i>k;k++)j.push(new f);for(var k=0;i>k;k++)j.push(new g);b.push(new h(j))}b.push(new d),m[a]=b}return b},o=function(a,b){for(var c=n(a.length-1),d=0,e=0,f=0;f<a.length;f++)d+=a[f].x*c[f](b),e+=a[f].y*c[f](b);return{x:d,y:e}},p=function(a,b){return Math.sqrt(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2))},q=function(a){return a[0].x==a[1].x&&a[0].y==a[1].y},r=function(a,b,c){if(q(a))return{point:a[0],location:b};for(var d=o(a,b),e=0,f=b,g=c>0?1:-1,h=null;e<Math.abs(c);)f+=.005*g,h=o(a,f),e+=p(h,d),d=h;return{point:h,location:f}},s=function(a){if(q(a))return 0;for(var b=o(a,0),c=0,d=0,e=1,f=null;1>d;)d+=.005*e,f=o(a,d),c+=p(f,b),b=f;return c},t=function(a,b,c){return r(a,b,c).point},u=function(a,b,c){return r(a,b,c).location},v=function(a,b){var c=o(a,b),d=o(a.slice(0,a.length-1),b),e=d.y-c.y,f=d.x-c.x;return 0==e?1/0:Math.atan(e/f)},w=function(a,b,c){var d=r(a,b,c);return d.location>1&&(d.location=1),d.location<0&&(d.location=0),v(a,d.location)},x=function(a,b,c,d){d=null==d?0:d;var e=r(a,b,d),f=v(a,e.location),g=Math.atan(-1/f),h=c/2*Math.sin(g),i=c/2*Math.cos(g);return[{x:e.point.x+i,y:e.point.y+h},{x:e.point.x-i,y:e.point.y-h}]},y=this.jsBezier={distanceFromCurve:d,gradientAtPoint:v,gradientAtPointAlongCurveFrom:w,nearestPointOnCurve:e,pointOnCurve:o,pointAlongCurveFrom:t,perpendicularToCurveAt:x,locationAlongCurveFrom:u,getLength:s,version:"0.9.0"};"undefined"!=typeof exports&&(exports.jsBezier=y)}).call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.Biltong={version:"0.4.0"};"undefined"!=typeof exports&&(exports.Biltong=b);var c=function(a){return"[object Array]"===Object.prototype.toString.call(a)},d=function(a,b,d){return a=c(a)?a:[a.x,a.y],b=c(b)?b:[b.x,b.y],d(a,b)},e=b.gradient=function(a,b){return d(a,b,function(a,b){return b[0]==a[0]?b[1]>a[1]?1/0:-1/0:b[1]==a[1]?b[0]>a[0]?0:-0:(b[1]-a[1])/(b[0]-a[0])})},f=(b.normal=function(a,b){return-1/e(a,b)},b.lineLength=function(a,b){return d(a,b,function(a,b){return Math.sqrt(Math.pow(b[1]-a[1],2)+Math.pow(b[0]-a[0],2))})},b.quadrant=function(a,b){return d(a,b,function(a,b){return b[0]>a[0]?b[1]>a[1]?2:1:b[0]==a[0]?b[1]>a[1]?2:1:b[1]>a[1]?3:4})}),g=(b.theta=function(a,b){return d(a,b,function(a,b){var c=e(a,b),d=Math.atan(c),g=f(a,b);return(4==g||3==g)&&(d+=Math.PI),0>d&&(d+=2*Math.PI),d})},b.intersects=function(a,b){var c=a.x,d=a.x+a.w,e=a.y,f=a.y+a.h,g=b.x,h=b.x+b.w,i=b.y,j=b.y+b.h;return g>=c&&d>=g&&i>=e&&f>=i||h>=c&&d>=h&&i>=e&&f>=i||g>=c&&d>=g&&j>=e&&f>=j||h>=c&&d>=g&&j>=e&&f>=j||c>=g&&h>=c&&e>=i&&j>=e||d>=g&&h>=d&&e>=i&&j>=e||c>=g&&h>=c&&f>=i&&j>=f||d>=g&&h>=c&&f>=i&&j>=f},b.encloses=function(a,b,c){var d=a.x,e=a.x+a.w,f=a.y,g=a.y+a.h,h=b.x,i=b.x+b.w,j=b.y,k=b.y+b.h,l=function(a,b,d,e){return c?b>=a&&d>=e:b>a&&d>e};return l(d,h,e,i)&&l(f,j,g,k)},[null,[1,-1],[1,1],[-1,1],[-1,-1]]),h=[null,[-1,-1],[-1,1],[1,1],[1,-1]];b.pointOnLine=function(a,b,c){var d=e(a,b),i=f(a,b),j=c>0?g[i]:h[i],k=Math.atan(d),l=Math.abs(c*Math.sin(k))*j[1],m=Math.abs(c*Math.cos(k))*j[0];return{x:a.x+m,y:a.y+l}},b.perpendicularLineTo=function(a,b,c){var d=e(a,b),f=Math.atan(-1/d),g=c/2*Math.sin(f),h=c/2*Math.cos(f);return[{x:b.x+h,y:b.y+g},{x:b.x-h,y:b.y-g}]}}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b={android:navigator.userAgent.toLowerCase().indexOf("android")>-1},c=function(a,b,c){c=c||a.parentNode;for(var d=c.querySelectorAll(b),e=0;e<d.length;e++)if(d[e]===a)return!0;return!1},d=function(a){return"string"==typeof a||a.constructor===String?document.getElementById(a):a},e=function(a){return a.srcElement||a.target},f=function(a,b,c,d){if(d){if("undefined"!=typeof a.path&&a.path.indexOf)return{path:a.path,end:a.path.indexOf(c)};var e={path:[],end:-1},f=function(a){e.path.push(a),a===c?e.end=e.path.length-1:null!=a.parentNode&&f(a.parentNode)};return f(b),e}return{path:[b],end:1}},g=function(a,b){for(var c=0,d=a.length;d>c&&a[c]!=b;c++);c<a.length&&a.splice(c,1)},h=1,i=function(a,b,c){var d=h++;return a.__ta=a.__ta||{},a.__ta[b]=a.__ta[b]||{},a.__ta[b][d]=c,c.__tauid=d,d},j=function(a,b,c){if(a.__ta&&a.__ta[b]&&delete a.__ta[b][c.__tauid],c.__taExtra){for(var d=0;d<c.__taExtra.length;d++)F(a,c.__taExtra[d][0],c.__taExtra[d][1]);c.__taExtra.length=0}c.__taUnstore&&c.__taUnstore()},k=function(a,b,d,g){if(null==a)return d;var h=a.split(","),i=function(g){i.__tauid=d.__tauid;var j=e(g),k=j,l=f(g,j,b,null!=a);if(-1!=l.end)for(var m=0;m<l.end;m++){k=l.path[m];for(var n=0;n<h.length;n++)c(k,h[n],b)&&d.apply(k,arguments)}};return l(d,g,i),i},l=function(a,b,c){a.__taExtra=a.__taExtra||[],a.__taExtra.push([b,c])},m=function(a,b,c,d){if(s&&u[b]){var e=k(d,a,c,u[b]);E(a,u[b],e,c)}"focus"===b&&null==a.getAttribute("tabindex")&&a.setAttribute("tabindex","1"),E(a,b,k(d,a,c,b),c)},n=function(a,b,c,d){if(null==a.__taSmartClicks){var f=function(b){a.__tad=y(b)},h=function(b){a.__tau=y(b)},i=function(b){if(a.__tad&&a.__tau&&a.__tad[0]===a.__tau[0]&&a.__tad[1]===a.__tau[1])for(var c=0;c<a.__taSmartClicks.length;c++)a.__taSmartClicks[c].apply(e(b),[b])};m(a,"mousedown",f,d),m(a,"mouseup",h,d),m(a,"click",i,d),a.__taSmartClicks=[]}a.__taSmartClicks.push(c),c.__taUnstore=function(){g(a.__taSmartClicks,c)}},o={tap:{touches:1,taps:1},dbltap:{touches:1,taps:2},contextmenu:{touches:2,taps:1}},p=function(a,b){return function(d,h,i,j){if("contextmenu"==h&&t)m(d,h,i,j);else{if(null==d.__taTapHandler){var k=d.__taTapHandler={tap:[],dbltap:[],contextmenu:[],down:!1,taps:0,downSelectors:[]},l=function(g){for(var h=e(g),i=f(g,h,d,null!=j),l=!1,m=0;m<i.end;m++){if(l)return;h=i.path[m];for(var n=0;n<k.downSelectors.length;n++)if(null==k.downSelectors[n]||c(h,k.downSelectors[n],d)){k.down=!0,setTimeout(p,a),setTimeout(q,b),l=!0;break}}},n=function(a){if(k.down){var b,g,h=e(a);k.taps++;var i=D(a);for(var j in o)if(o.hasOwnProperty(j)){var l=o[j];if(l.touches===i&&(1===l.taps||l.taps===k.taps))for(var m=0;m<k[j].length;m++){g=f(a,h,d,null!=k[j][m][1]);for(var n=0;n<g.end;n++)if(b=g.path[n],null==k[j][m][1]||c(b,k[j][m][1],d)){k[j][m][0].apply(b,[a]);break}}}}},p=function(){k.down=!1},q=function(){k.taps=0};m(d,"mousedown",l),m(d,"mouseup",n)}d.__taTapHandler.downSelectors.push(j),d.__taTapHandler[h].push([i,j]),i.__taUnstore=function(){g(d.__taTapHandler[h],i)}}}},q=function(a,b,c,d){for(var e in c.__tamee[a])c.__tamee[a].hasOwnProperty(e)&&c.__tamee[a][e].apply(d,[b])},r=function(){var a=[];return function(b,d,f,g){if(!b.__tamee){b.__tamee={over:!1,mouseenter:[],mouseexit:[]};var h=function(d){var f=e(d);(null==g&&f==b&&!b.__tamee.over||c(f,g,b)&&(null==f.__tamee||!f.__tamee.over))&&(q("mouseenter",d,b,f),f.__tamee=f.__tamee||{},f.__tamee.over=!0,a.push(f))},j=function(d){for(var f=e(d),g=0;g<a.length;g++)f!=a[g]||c(d.relatedTarget||d.toElement,"*",f)||(f.__tamee.over=!1,a.splice(g,1),q("mouseexit",d,b,f))};E(b,"mouseover",k(g,b,h,"mouseover"),h),E(b,"mouseout",k(g,b,j,"mouseout"),j)}f.__taUnstore=function(){delete b.__tamee[d][f.__tauid]},i(b,d,f),b.__tamee[d][f.__tauid]=f}},s="ontouchstart"in document.documentElement,t="onmousedown"in document.documentElement,u={mousedown:"touchstart",mouseup:"touchend",mousemove:"touchmove"},v=function(){var a=-1;if("Microsoft Internet Explorer"==navigator.appName){var b=navigator.userAgent,c=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");null!=c.exec(b)&&(a=parseFloat(RegExp.$1))}return a}(),w=v>-1&&9>v,x=function(a,b){if(null==a)return[0,0];var c=C(a),d=B(c,0);return[d[b+"X"],d[b+"Y"]]},y=function(a){return null==a?[0,0]:w?[a.clientX+document.documentElement.scrollLeft,a.clientY+document.documentElement.scrollTop]:x(a,"page")},z=function(a){return x(a,"screen")},A=function(a){return x(a,"client")},B=function(a,b){return a.item?a.item(b):a[b]},C=function(a){return a.touches&&a.touches.length>0?a.touches:a.changedTouches&&a.changedTouches.length>0?a.changedTouches:a.targetTouches&&a.targetTouches.length>0?a.targetTouches:[a]},D=function(a){return C(a).length},E=function(a,b,c,d){if(i(a,b,c),d.__tauid=c.__tauid,a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent){var e=b+c.__tauid;a["e"+e]=c,a[e]=function(){a["e"+e]&&a["e"+e](window.event)},a.attachEvent("on"+b,a[e])}},F=function(a,b,c){null!=c&&G(a,function(){var e=d(this);if(j(e,b,c),null!=c.__tauid)if(e.removeEventListener)e.removeEventListener(b,c,!1),s&&u[b]&&e.removeEventListener(u[b],c,!1);else if(this.detachEvent){var f=b+c.__tauid;e[f]&&e.detachEvent("on"+b,e[f]),e[f]=null,e["e"+f]=null}c.__taTouchProxy&&F(a,c.__taTouchProxy[1],c.__taTouchProxy[0])})},G=function(a,b){if(null!=a){a="undefined"!=typeof Window&&"unknown"!=typeof a.top&&a==a.top?[a]:"string"!=typeof a&&null==a.tagName&&null!=a.length?a:"string"==typeof a?document.querySelectorAll(a):[a];for(var c=0;c<a.length;c++)b.apply(a[c])}};a.Mottle=function(a){a=a||{};var c=a.clickThreshold||250,e=a.dblClickThreshold||450,f=new r,g=new p(c,e),h=a.smartClicks,i=function(a,b,c,e){null!=c&&G(a,function(){var a=d(this);h&&"click"===b?n(a,b,c,e):"tap"===b||"dbltap"===b||"contextmenu"===b?g(a,b,c,e):"mouseenter"===b||"mouseexit"==b?f(a,b,c,e):m(a,b,c,e)})};this.remove=function(a){return G(a,function(){var a=d(this);if(a.__ta)for(var b in a.__ta)if(a.__ta.hasOwnProperty(b))for(var c in a.__ta[b])a.__ta[b].hasOwnProperty(c)&&F(a,b,a.__ta[b][c]);a.parentNode&&a.parentNode.removeChild(a)}),this},this.on=function(){var a=arguments[0],b=4==arguments.length?arguments[2]:null,c=arguments[1],d=arguments[arguments.length-1];return i(a,c,d,b),this},this.off=function(a,b,c){return F(a,b,c),this},this.trigger=function(a,c,e,f){var g=t&&("undefined"==typeof MouseEvent||null==e||e.constructor===MouseEvent),h=s&&!t&&u[c]?u[c]:c,i=!(s&&!t&&u[c]),j=y(e),k=z(e),l=A(e);return G(a,function(){var a,m=d(this);e=e||{screenX:k[0],screenY:k[1],clientX:l[0],clientY:l[1]};var n=function(a){f&&(a.payload=f)},o={TouchEvent:function(a){var b=document.createTouch(window,m,0,j[0],j[1],k[0],k[1],l[0],l[1],0,0,0,0),c=document.createTouchList(b),d=document.createTouchList(b),e=document.createTouchList(b);a.initTouchEvent(h,!0,!0,window,null,k[0],k[1],l[0],l[1],!1,!1,!1,!1,c,d,e,1,0)},MouseEvents:function(a){if(a.initMouseEvent(h,!0,!0,window,0,k[0],k[1],l[0],l[1],!1,!1,!1,!1,1,m),b.android){var c=document.createTouch(window,m,0,j[0],j[1],k[0],k[1],l[0],l[1],0,0,0,0);a.touches=a.targetTouches=a.changedTouches=document.createTouchList(c)}}};if(document.createEvent){var p=!i&&!g&&s&&u[c]&&!b.android,q=p?"TouchEvent":"MouseEvents";a=document.createEvent(q),o[q](a),n(a),m.dispatchEvent(a)}else document.createEventObject&&(a=document.createEventObject(),a.eventType=a.eventName=h,a.screenX=k[0],a.screenY=k[1],a.clientX=l[0],a.clientY=l[1],n(a),m.fireEvent("on"+h,a))}),this}},a.Mottle.consume=function(a,b){a.stopPropagation?a.stopPropagation():a.returnValue=!1,!b&&a.preventDefault&&a.preventDefault()},a.Mottle.pageLocation=y,a.Mottle.setForceTouchEvents=function(a){s=a},a.Mottle.setForceMouseEvents=function(a){t=a},a.Mottle.version="0.8.0","undefined"!=typeof exports&&(exports.Mottle=a.Mottle)}.call("undefined"==typeof window?this:window),function(){"use strict";var a=this,b=function(a,b,c){return-1===a.indexOf(b)?(c?a.unshift(b):a.push(b),!0):!1},c=function(a,b){var c=a.indexOf(b);-1!=c&&a.splice(c,1)},d=function(a,b){for(var c=[],d=0;d<a.length;d++)-1==b.indexOf(a[d])&&c.push(a[d]);return c},e=function(a){return null==a?!1:"string"==typeof a||a.constructor==String},f=function(a){var b=a.getBoundingClientRect(),c=document.body,d=document.documentElement,e=window.pageYOffset||d.scrollTop||c.scrollTop,f=window.pageXOffset||d.scrollLeft||c.scrollLeft,g=d.clientTop||c.clientTop||0,h=d.clientLeft||c.clientLeft||0,i=b.top+e-g,j=b.left+f-h;return{top:Math.round(i),left:Math.round(j)}},g=function(a,b,c){c=c||a.parentNode;for(var d=c.querySelectorAll(b),e=0;e<d.length;e++)if(d[e]===a)return!0;return!1},h=function(){var a=-1;if("Microsoft Internet Explorer"==navigator.appName){var b=navigator.userAgent,c=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");null!=c.exec(b)&&(a=parseFloat(RegExp.$1))}return a}(),i=50,j=50,k=h>-1&&9>h,l=9==h,m=function(a){if(k)return[a.clientX+document.documentElement.scrollLeft,a.clientY+document.documentElement.scrollTop];var b=o(a),c=n(b,0);return l?[c.pageX||c.clientX,c.pageY||c.clientY]:[c.pageX,c.pageY]},n=function(a,b){return a.item?a.item(b):a[b]},o=function(a){return a.touches&&a.touches.length>0?a.touches:a.changedTouches&&a.changedTouches.length>0?a.changedTouches:a.targetTouches&&a.targetTouches.length>0?a.targetTouches:[a]},p={draggable:"katavorio-draggable",droppable:"katavorio-droppable",drag:"katavorio-drag",selected:"katavorio-drag-selected",active:"katavorio-drag-active",hover:"katavorio-drag-hover",noSelect:"katavorio-drag-no-select",ghostProxy:"katavorio-ghost-proxy"},q="katavorio-drag-scope",r=["stop","start","drag","drop","over","out","beforeStart"],s=function(){},t=function(){return!0},u=function(a,b,c){for(var d=0;d<a.length;d++)a[d]!=c&&b(a[d])},v=function(a,b,c,d){u(a,function(a){a.setActive(b),b&&a.updatePosition(),c&&a.setHover(d,b)})},w=function(a,b){if(null!=a){a=e(a)||null!=a.tagName||null==a.length?[a]:a;for(var c=0;c<a.length;c++)b.apply(a[c],[a[c]])}},x=function(a){a.stopPropagation?(a.stopPropagation(),a.preventDefault()):a.returnValue=!1},y="input,textarea,select,button,option",z=function(a,b,c){var d=a.srcElement||a.target;return!g(d,c.getInputFilterSelector(),b)},A=function(a,b,c,d){this.params=b||{},this.el=a,this.params.addClass(this.el,this._class),this.uuid=F();var e=!0;return this.setEnabled=function(a){e=a},this.isEnabled=function(){return e},this.toggleEnabled=function(){e=!e},this.setScope=function(a){this.scopes=a?a.split(/\s+/):[d]},this.addScope=function(a){var b={};w(this.scopes,function(a){b[a]=!0}),w(a?a.split(/\s+/):[],function(a){b[a]=!0}),this.scopes=[];for(var c in b)this.scopes.push(c)},this.removeScope=function(a){var b={};w(this.scopes,function(a){b[a]=!0}),w(a?a.split(/\s+/):[],function(a){delete b[a]}),this.scopes=[];for(var c in b)this.scopes.push(c)},this.toggleScope=function(a){var b={};w(this.scopes,function(a){b[a]=!0}),w(a?a.split(/\s+/):[],function(a){b[a]?delete b[a]:b[a]=!0}),this.scopes=[];for(var c in b)this.scopes.push(c)},this.setScope(b.scope),this.k=b.katavorio,b.katavorio},B=function(){return!0},C=function(){return!1},D=function(a,b,c){this._class=c.draggable;var d=A.apply(this,arguments);this.rightButtonCanDrag=this.params.rightButtonCanDrag;var h=[0,0],k=null,l=null,n=[0,0],o=!1,q=this.params.consumeStartEvent!==!1,r=this.el,s=this.params.clone,u=(this.params.scroll,b.multipleDrop!==!1),w=!1,y=b.ghostProxy===!0?B:b.ghostProxy&&"function"==typeof b.ghostProxy?b.ghostProxy:C,D=function(a){return a.cloneNode(!0)},E=b.snapThreshold||5,H=function(a,b,c,d,e){d=d||E,e=e||E;var f=Math.floor(a[0]/b),g=b*f,h=g+b,i=Math.abs(a[0]-g)<=d?g:Math.abs(h-a[0])<=d?h:a[0],j=Math.floor(a[1]/c),k=c*j,l=k+c,m=Math.abs(a[1]-k)<=e?k:Math.abs(l-a[1])<=e?l:a[1];return[i,m]};this.posses=[],this.posseRoles={},this.toGrid=function(a){return null==this.params.grid?a:H(a,this.params.grid[0],this.params.grid[1])},this.snap=function(a,b){if(null!=r){a=a||(this.params.grid?this.params.grid[0]:i),b=b||(this.params.grid?this.params.grid[1]:j);var c=this.params.getPosition(r);this.params.setPosition(r,H(c,a,b,a,b))}},this.setUseGhostProxy=function(a){y=a?B:C};var I,J=function(a){return b.allowNegative===!1?[Math.max(0,a[0]),Math.max(0,a[1])]:a},K=function(a){I="function"==typeof a?a:a?function(a){return J([Math.max(0,Math.min(Q.w-this.size[0],a[0])),Math.max(0,Math.min(Q.h-this.size[1],a[1]))])}.bind(this):function(a){return J(a)}}.bind(this);K("function"==typeof this.params.constrain?this.params.constrain:this.params.constrain||this.params.containment),this.setConstrain=function(a){K(a)};var L;this.setRevert=function(a){L=a};var M=function(a){return"function"==typeof a?(a._katavorioId=F(),a._katavorioId):a},N={},O=function(a){for(var b in N){var c=N[b],d=c[0](a);if(c[1]&&(d=!d),!d)return!1}return!0},P=this.setFilter=function(b,c){if(b){var d=M(b);N[d]=[function(c){var d,f=c.srcElement||c.target;return e(b)?d=g(f,b,a):"function"==typeof b&&(d=b(c,a)),d},c!==!1]}};this.addFilter=P,this.removeFilter=function(a){var b="function"==typeof a?a._katavorioId:a;delete N[b]},this.clearAllFilters=function(){N={}},this.canDrag=this.params.canDrag||t;var Q,R=[],S=[];this.downListener=function(a){var b=this.rightButtonCanDrag||3!==a.which&&2!==a.button;if(b&&this.isEnabled()&&this.canDrag()){var e=O(a)&&z(a,this.el,this.k);if(e){if(s){r=this.el.cloneNode(!0),r.setAttribute("id",null),r.style.position="absolute";var g=f(this.el);r.style.left=g.left+"px",r.style.top=g.top+"px",document.body.appendChild(r)}else r=this.el;q&&x(a),h=m(a),this.params.bind(document,"mousemove",this.moveListener),this.params.bind(document,"mouseup",this.upListener),d.markSelection(this),d.markPosses(this),this.params.addClass(document.body,c.noSelect),U("beforeStart",{el:this.el,pos:k,e:a,drag:this})}else this.params.consumeFilteredEvents&&x(a)}}.bind(this),this.moveListener=function(a){if(h){if(!o){var b=U("start",{el:this.el,pos:k,e:a,drag:this});if(b!==!1){if(!h)return;this.mark(!0),o=!0}}if(h){S.length=0;var c=m(a),e=c[0]-h[0],f=c[1]-h[1],g=this.params.ignoreZoom?1:d.getZoom();e/=g,f/=g,this.moveBy(e,f,a),d.updateSelection(e,f,this),d.updatePosses(e,f,this)}}}.bind(this),this.upListener=function(a){h&&(h=null,this.params.unbind(document,"mousemove",this.moveListener),this.params.unbind(document,"mouseup",this.upListener),this.params.removeClass(document.body,c.noSelect),this.unmark(a),d.unmarkSelection(this,a),d.unmarkPosses(this,a),this.stop(a),d.notifySelectionDragStop(this,a),d.notifyPosseDragStop(this,a),o=!1,s&&(r&&r.parentNode&&r.parentNode.removeChild(r),r=null),S.length=0,L&&L(this.el,this.params.getPosition(this.el))===!0&&(this.params.setPosition(this.el,k),U("revert",this.el)))}.bind(this),this.getFilters=function(){return N},this.abort=function(){null!=h&&this.upListener()},this.getDragElement=function(){return r||this.el};var T={start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]};b.events.start&&T.start.push(b.events.start),b.events.beforeStart&&T.beforeStart.push(b.events.beforeStart),b.events.stop&&T.stop.push(b.events.stop),b.events.drag&&T.drag.push(b.events.drag),b.events.revert&&T.revert.push(b.events.revert),this.on=function(a,b){T[a]&&T[a].push(b)},this.off=function(a,b){if(T[a]){for(var c=[],d=0;d<T[a].length;d++)T[a][d]!==b&&c.push(T[a][d]);T[a]=c}};var U=function(a,b){if(T[a])for(var c=0;c<T[a].length;c++)try{T[a][c](b)}catch(d){}};this.notifyStart=function(a){U("start",{el:this.el,pos:this.params.getPosition(r),e:a,drag:this})},this.stop=function(a,b){if(b||o){var c=[],e=d.getSelection(),f=this.params.getPosition(r);if(e.length>1)for(var g=0;g<e.length;g++){var h=this.params.getPosition(e[g].el);c.push([e[g].el,{left:h[0],top:h[1]},e[g]])}else c.push([r,{left:f[0],top:f[1]},this]);U("stop",{el:r,pos:V||f,finalPos:f,e:a,drag:this,selection:c})}},this.mark=function(a){k=this.params.getPosition(r),l=this.params.getPosition(r,!0),n=[l[0]-k[0],l[1]-k[1]],this.size=this.params.getSize(r),R=d.getMatchingDroppables(this),v(R,!0,!1,this),this.params.addClass(r,this.params.dragClass||c.drag);var b=this.params.getSize(r.parentNode);Q={w:b[0],h:b[1]},a&&d.notifySelectionDragStart(this)};var V;this.unmark=function(a,d){if(v(R,!1,!0,this),w&&y(this.el)?(V=[r.offsetLeft,r.offsetTop],this.el.parentNode.removeChild(r),r=this.el):V=null,this.params.removeClass(r,this.params.dragClass||c.drag),R.length=0,w=!1,!d){S.length>0&&V&&b.setPosition(this.el,V),S.sort(G);for(var e=0;e<S.length;e++){var f=S[e].drop(this,a);if(f===!0)break}}},this.moveBy=function(a,c,d){S.length=0;var e=this.toGrid([k[0]+a,k[1]+c]),f=I(e,r);if(y(this.el))if(e[0]!=f[0]||e[1]!=f[1]){if(!w){var g=D(this.el);b.addClass(g,p.ghostProxy),this.el.parentNode.appendChild(g),r=g,w=!0}f=e}else w&&(this.el.parentNode.removeChild(r),r=this.el,w=!1);var h={x:f[0],y:f[1],w:this.size[0],h:this.size[1]},i={x:h.x+n[0],y:h.y+n[1],w:h.w,h:h.h},j=null;this.params.setPosition(r,f);for(var l=0;l<R.length;l++){var m={x:R[l].pagePosition[0],y:R[l].pagePosition[1],w:R[l].size[0],h:R[l].size[1]};this.params.intersects(i,m)&&(u||null==j||j==R[l].el)&&R[l].canDrop(this)?(j||(j=R[l].el),S.push(R[l]),R[l].setHover(this,!0,d)):R[l].isHover()&&R[l].setHover(this,!1,d)}U("drag",{el:this.el,pos:f,e:d,drag:this})},this.destroy=function(){this.params.unbind(this.el,"mousedown",this.downListener),this.params.unbind(document,"mousemove",this.moveListener),this.params.unbind(document,"mouseup",this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null},this.params.bind(this.el,"mousedown",this.downListener),this.params.handle?P(this.params.handle,!1):P(this.params.filter,this.params.filterExclude)},E=function(a,b,c){this._class=c.droppable,this.params=b||{},this.rank=b.rank||0,this._activeClass=this.params.activeClass||c.active,this._hoverClass=this.params.hoverClass||c.hover,A.apply(this,arguments);var d=!1;this.allowLoopback=this.params.allowLoopback!==!1,this.setActive=function(a){this.params[a?"addClass":"removeClass"](this.el,this._activeClass)},this.updatePosition=function(){this.position=this.params.getPosition(this.el),this.pagePosition=this.params.getPosition(this.el,!0),this.size=this.params.getSize(this.el)},this.canDrop=this.params.canDrop||function(){return!0},this.isHover=function(){return d},this.setHover=function(a,b,c){(b||null==this.el._katavorioDragHover||this.el._katavorioDragHover==a.el._katavorio)&&(this.params[b?"addClass":"removeClass"](this.el,this._hoverClass),this.el._katavorioDragHover=b?a.el._katavorio:null,d!==b&&this.params.events[b?"over":"out"]({el:this.el,e:c,drag:a,drop:this}),d=b)},this.drop=function(a,b){return this.params.events.drop({drag:a,e:b,drop:this})},this.destroy=function(){this._class=null,this._activeClass=null,this._hoverClass=null,d=null}},F=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=0|16*Math.random(),c="x"==a?b:8|3&b;return c.toString(16)})},G=function(a,b){return a.rank<b.rank?1:a.rank>b.rank?-1:0},H=function(a){return null==a?null:(a="string"==typeof a||a.constructor==String?document.getElementById(a):a,null==a?null:(a._katavorio=a._katavorio||F(),a))};a.Katavorio=function(a){var f=[],g={};this._dragsByScope={},this._dropsByScope={};var h=1,i=function(a,b){w(a,function(a){for(var c=0;c<a.scopes.length;c++)b[a.scopes[c]]=b[a.scopes[c]]||[],b[a.scopes[c]].push(a)})},j=function(b,c){var d=0;return w(b,function(b){for(var e=0;e<b.scopes.length;e++)if(c[b.scopes[e]]){var f=a.indexOf(c[b.scopes[e]],b);-1!=f&&(c[b.scopes[e]].splice(f,1),d++)}}),d>0},k=(this.getMatchingDroppables=function(a){for(var b=[],c={},d=0;d<a.scopes.length;d++){var e=this._dropsByScope[a.scopes[d]];if(e)for(var f=0;f<e.length;f++)!e[f].canDrop(a)||c[e[f].uuid]||!e[f].allowLoopback&&e[f].el===a.el||(c[e[f].uuid]=!0,b.push(e[f]))}return b.sort(G),b},function(b){b=b||{};var c,d={events:{}};for(c in a)d[c]=a[c];for(c in b)d[c]=b[c];for(c=0;c<r.length;c++)d.events[r[c]]=b[r[c]]||s;return d.katavorio=this,d}.bind(this)),l=function(a,b){for(var c=0;c<r.length;c++)b[r[c]]&&a.on(r[c],b[r[c]])}.bind(this),m={},n=a.css||{},o=a.scope||q;for(var t in p)m[t]=p[t];for(var t in n)m[t]=n[t];var v=a.inputFilterSelector||y;this.getInputFilterSelector=function(){return v},this.setInputFilterSelector=function(a){return v=a,this},this.draggable=function(b,c){var d=[];return w(b,function(b){if(b=H(b),null!=b)if(null==b._katavorioDrag){var e=k(c);b._katavorioDrag=new D(b,e,m,o),i(b._katavorioDrag,this._dragsByScope),d.push(b._katavorioDrag),a.addClass(b,m.draggable)}else l(b._katavorioDrag,c)}.bind(this)),d},this.droppable=function(b,c){var d=[];return w(b,function(b){if(b=H(b),null!=b){var e=new E(b,k(c),m,o);b._katavorioDrop=b._katavorioDrop||[],b._katavorioDrop.push(e),i(e,this._dropsByScope),d.push(e),a.addClass(b,m.droppable)}}.bind(this)),d},this.select=function(b){return w(b,function(){var b=H(this);b&&b._katavorioDrag&&(g[b._katavorio]||(f.push(b._katavorioDrag),g[b._katavorio]=[b,f.length-1],a.addClass(b,m.selected)))}),this},this.deselect=function(b){return w(b,function(){var b=H(this);if(b&&b._katavorio){var c=g[b._katavorio];if(c){for(var d=[],e=0;e<f.length;e++)f[e].el!==b&&d.push(f[e]);f=d,delete g[b._katavorio],a.removeClass(b,m.selected)}}}),this},this.deselectAll=function(){for(var b in g){var c=g[b];a.removeClass(c[0],m.selected)}f.length=0,g={}},this.markSelection=function(a){u(f,function(a){a.mark()},a)},this.markPosses=function(a){a.posses&&w(a.posses,function(b){a.posseRoles[b]&&B[b]&&u(B[b].members,function(a){a.mark()},a)})},this.unmarkSelection=function(a,b){u(f,function(a){a.unmark(b)},a)},this.unmarkPosses=function(a,b){a.posses&&w(a.posses,function(c){a.posseRoles[c]&&B[c]&&u(B[c].members,function(a){a.unmark(b,!0)},a)})},this.getSelection=function(){return f.slice(0)},this.updateSelection=function(a,b,c){u(f,function(c){c.moveBy(a,b)},c)};var x=function(a,b){b.posses&&w(b.posses,function(c){b.posseRoles[c]&&B[c]&&u(B[c].members,function(b){a(b)},b)})};this.updatePosses=function(a,b,c){x(function(c){c.moveBy(a,b)},c)},this.notifyPosseDragStop=function(a,b){x(function(a){a.stop(b,!0)},a)},this.notifySelectionDragStop=function(a,b){u(f,function(a){a.stop(b,!0)},a)},this.notifySelectionDragStart=function(a,b){u(f,function(a){a.notifyStart(b)},a)},this.setZoom=function(a){h=a},this.getZoom=function(){return h};var z=function(a,b,c,d){w(a,function(a){j(a,c),a[d](b),i(a,c)})};w(["set","add","remove","toggle"],function(a){this[a+"Scope"]=function(b,c){z(b._katavorioDrag,c,this._dragsByScope,a+"Scope"),z(b._katavorioDrop,c,this._dropsByScope,a+"Scope")}.bind(this),this[a+"DragScope"]=function(b,c){z(b.constructor===D?b:b._katavorioDrag,c,this._dragsByScope,a+"Scope")}.bind(this),this[a+"DropScope"]=function(b,c){z(b.constructor===E?b:b._katavorioDrop,c,this._dropsByScope,a+"Scope")}.bind(this)}.bind(this)),this.snapToGrid=function(a,b){for(var c in this._dragsByScope)u(this._dragsByScope[c],function(c){c.snap(a,b)})},this.getDragsForScope=function(a){return this._dragsByScope[a]},this.getDropsForScope=function(a){return this._dropsByScope[a]};var A=function(a,b,c){if(a=H(a),a[b]){var d=f.indexOf(a[b]);d>=0&&f.splice(d,1),j(a[b],c)&&w(a[b],function(a){a.destroy()}),delete a[b]}};this.elementRemoved=function(a){this.destroyDraggable(a),this.destroyDroppable(a)},this.destroyDraggable=function(a){A(a,"_katavorioDrag",this._dragsByScope)},this.destroyDroppable=function(a){A(a,"_katavorioDrop",this._dropsByScope)},this.reset=function(){this._dragsByScope={},this._dropsByScope={},f=[],g={},B={}};var B={},C=function(a,c,d){var f=e(c)?c:c.id,g=e(c)?!0:c.active!==!1,h=B[f]||function(){var a={name:f,members:[]};return B[f]=a,a}();return w(a,function(a){if(a._katavorioDrag){if(d&&null!=a._katavorioDrag.posseRoles[h.name])return;b(h.members,a._katavorioDrag),b(a._katavorioDrag.posses,h.name),a._katavorioDrag.posseRoles[h.name]=g}}),h};this.addToPosse=function(a){for(var b=[],c=1;c<arguments.length;c++)b.push(C(a,arguments[c]));return 1==b.length?b[0]:b},this.setPosse=function(a){for(var b=[],c=1;c<arguments.length;c++)b.push(C(a,arguments[c],!0).name);return w(a,function(a){if(a._katavorioDrag){var c=d(a._katavorioDrag.posses,b),e=[];Array.prototype.push.apply(e,a._katavorioDrag.posses);for(var f=0;f<c.length;f++)this.removeFromPosse(a,c[f])}}.bind(this)),1==b.length?b[0]:b},this.removeFromPosse=function(a,b){if(arguments.length<2)throw new TypeError("No posse id provided for remove operation");for(var d=1;d<arguments.length;d++)b=arguments[d],w(a,function(a){if(a._katavorioDrag&&a._katavorioDrag.posses){var d=a._katavorioDrag;w(b,function(a){c(B[a].members,d),c(d.posses,a),delete d.posseRoles[a]})}})},this.removeFromAllPosses=function(a){w(a,function(a){if(a._katavorioDrag&&a._katavorioDrag.posses){var b=a._katavorioDrag;w(b.posses,function(a){c(B[a].members,b)}),b.posses.length=0,b.posseRoles={}}})},this.setPosseState=function(a,b,c){var d=B[b];d&&w(a,function(a){a._katavorioDrag&&a._katavorioDrag.posses&&(a._katavorioDrag.posseRoles[d.name]=c)})}},a.Katavorio.version="0.19.2","undefined"!=typeof exports&&(exports.Katavorio=a.Katavorio)}.call("undefined"!=typeof window?window:this),function(){var a=function(a){return"[object Array]"===Object.prototype.toString.call(a)},b=function(a){return"[object Number]"===Object.prototype.toString.call(a)},c=function(a){return"string"==typeof a},d=function(a){return"boolean"==typeof a},e=function(a){return null==a},f=function(a){return null==a?!1:"[object Object]"===Object.prototype.toString.call(a)},g=function(a){return"[object Date]"===Object.prototype.toString.call(a)},h=function(a){return"[object Function]"===Object.prototype.toString.call(a)},i=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},j=this;j.jsPlumbUtil={isArray:a,isString:c,isBoolean:d,isNull:e,isObject:f,isDate:g,isFunction:h,isEmpty:i,isNumber:b,clone:function(b){if(c(b))return""+b;if(d(b))return!!b;if(g(b))return new Date(b.getTime());if(h(b))return b;if(a(b)){for(var e=[],i=0;i<b.length;i++)e.push(this.clone(b[i]));
+return e}if(f(b)){var j={};for(var k in b)j[k]=this.clone(b[k]);return j}return b},merge:function(b,e,g){var h,i,j={};for(g=g||[],i=0;i<g.length;i++)j[g[i]]=!0;var k=this.clone(b);for(i in e)if(null==k[i])k[i]=e[i];else if(c(e[i])||d(e[i]))j[i]?(h=[],h.push.apply(h,a(k[i])?k[i]:[k[i]]),h.push.apply(h,a(e[i])?e[i]:[e[i]]),k[i]=h):k[i]=e[i];else if(a(e[i]))h=[],a(k[i])&&h.push.apply(h,k[i]),h.push.apply(h,e[i]),k[i]=h;else if(f(e[i])){f(k[i])||(k[i]={});for(var l in e[i])k[i][l]=e[i][l]}return k},replace:function(a,b,c){if(null!=a){var d=a,e=d;return b.replace(/([^\.])+/g,function(a,b,d,f){var g=a.match(/([^\[0-9]+){1}(\[)([0-9+])/),h=d+a.length>=f.length,i=function(){return e[g[1]]||function(){return e[g[1]]=[],e[g[1]]}()};if(h)g?i()[g[3]]=c:e[a]=c;else if(g){var j=i();e=j[g[3]]||function(){return j[g[3]]={},j[g[3]]}()}else e=e[a]||function(){return e[a]={},e[a]}()}),a}},functionChain:function(a,b,c){for(var d=0;d<c.length;d++){var e=c[d][0][c[d][1]].apply(c[d][0],c[d][2]);if(e===b)return e}return a},populate:function(b,d,e){var g=function(a){var b=a.match(/(\${.*?})/g);if(null!=b)for(var c=0;c<b.length;c++){var e=d[b[c].substring(2,b[c].length-1)]||"";null!=e&&(a=a.replace(b[c],e))}return a},i=function(b){if(null!=b){if(c(b))return g(b);if(!h(b)||null!=e&&0!==(b.name||"").indexOf(e)){if(a(b)){for(var j=[],k=0;k<b.length;k++)j.push(i(b[k]));return j}if(f(b)){var l={};for(var m in b)l[m]=i(b[m]);return l}return b}return b(d)}};return i(b)},findWithFunction:function(a,b){if(a)for(var c=0;c<a.length;c++)if(b(a[c]))return c;return-1},removeWithFunction:function(a,b){var c=j.jsPlumbUtil.findWithFunction(a,b);return c>-1&&a.splice(c,1),-1!==c},remove:function(a,b){var c=a.indexOf(b);return c>-1&&a.splice(c,1),-1!==c},addWithFunction:function(a,b,c){-1===j.jsPlumbUtil.findWithFunction(a,c)&&a.push(b)},addToList:function(a,b,c,d){var e=a[b];return null==e&&(e=[],a[b]=e),e[d?"unshift":"push"](c),e},suggest:function(a,b,c){return-1===a.indexOf(b)?(c?a.unshift(b):a.push(b),!0):!1},extend:function(b,c){var d;for(c=a(c)?c:[c],d=0;d<c.length;d++)for(var e in c[d].prototype)c[d].prototype.hasOwnProperty(e)&&(b.prototype[e]=c[d].prototype[e]);var f=function(a,b){return function(){for(d=0;d<c.length;d++)c[d].prototype[a]&&c[d].prototype[a].apply(this,arguments);return b.apply(this,arguments)}},g=function(a){for(var c in a)b.prototype[c]=f(c,a[c])};if(arguments.length>2)for(d=2;d<arguments.length;d++)g(arguments[d]);return b},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=0|16*Math.random(),c="x"===a?b:8|3&b;return c.toString(16)})},logEnabled:!0,log:function(){if(j.jsPlumbUtil.logEnabled&&"undefined"!=typeof console)try{var a=arguments[arguments.length-1];console.log(a)}catch(b){}},wrap:function(a,b,c){return a=a||function(){},b=b||function(){},function(){var d=null;try{d=b.apply(this,arguments)}catch(e){j.jsPlumbUtil.log("jsPlumb function failed : "+e)}if(null==c||d!==c)try{d=a.apply(this,arguments)}catch(e){j.jsPlumbUtil.log("wrapped function failed : "+e)}return d}}},j.jsPlumbUtil.EventGenerator=function(){var a={},b=!1,c=!1,d={ready:!0},e=[];this.bind=function(b,c,d){var e=function(b){j.jsPlumbUtil.addToList(a,b,c,d),c.__jsPlumb=c.__jsPlumb||{},c.__jsPlumb[j.jsPlumbUtil.uuid()]=b};if("string"==typeof b)e(b);else if(null!=b.length)for(var f=0;f<b.length;f++)e(b[f]);return this},this.fire=function(g,h,i){if(c)e.unshift(arguments);else{if(c=!0,!b&&a[g]){var k=a[g].length,l=0,m=!1,n=null;if(!this.shouldFireEvent||this.shouldFireEvent(g,h,i))for(;!m&&k>l&&n!==!1;){if(d[g])a[g][l].apply(this,[h,i]);else try{n=a[g][l].apply(this,[h,i])}catch(o){j.jsPlumbUtil.log("jsPlumb: fire failed for event "+g+" : "+o)}l++,(null==a||null==a[g])&&(m=!0)}}c=!1,f()}return this};var f=function(){var a=e.pop();a&&this.fire.apply(this,a)}.bind(this);this.unbind=function(b,c){if(0===arguments.length)a={};else if(1===arguments.length){if("string"==typeof b)delete a[b];else if(b.__jsPlumb){var d;for(var e in b.__jsPlumb)d=b.__jsPlumb[e],j.jsPlumbUtil.remove(a[d]||[],b)}}else 2===arguments.length&&j.jsPlumbUtil.remove(a[b]||[],c);return this},this.getListener=function(b){return a[b]},this.setSuspendEvents=function(a){b=a},this.isSuspendEvents=function(){return b},this.silently=function(a){this.setSuspendEvents(!0);try{a()}catch(b){j.jsPlumbUtil.log("Cannot execute silent function "+b)}this.setSuspendEvents(!1)},this.cleanupListeners=function(){for(var b in a)a[b]=null}},j.jsPlumbUtil.EventGenerator.prototype={cleanup:function(){this.cleanupListeners()}},"undefined"!=typeof exports&&(exports.jsPlumbUtil=j.jsPlumbUtil)}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this;a.jsPlumbUtil.matchesSelector=function(a,b,c){c=c||a.parentNode;for(var d=c.querySelectorAll(b),e=0;e<d.length;e++)if(d[e]===a)return!0;return!1},a.jsPlumbUtil.consume=function(a,b){a.stopPropagation?a.stopPropagation():a.returnValue=!1,!b&&a.preventDefault&&a.preventDefault()},a.jsPlumbUtil.sizeElement=function(a,b,c,d,e){a&&(a.style.height=e+"px",a.height=e,a.style.width=d+"px",a.width=d,a.style.left=b+"px",a.style.top=c+"px")}}.call("undefined"!=typeof window?window:this),function(){"use strict";var a,b=this,c=[],d=b.jsPlumbUtil,e=function(){return""+(new Date).getTime()},f=function(a){if(a._jsPlumb.paintStyle&&a._jsPlumb.hoverPaintStyle){var b={};r.extend(b,a._jsPlumb.paintStyle),r.extend(b,a._jsPlumb.hoverPaintStyle),delete a._jsPlumb.hoverPaintStyle,b.gradient&&a._jsPlumb.paintStyle.fill&&delete b.gradient,a._jsPlumb.hoverPaintStyle=b}},g=["tap","dbltap","click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","contextmenu"],h=function(a,b,c,d){var e=a.getAttachedElements();if(e)for(var f=0,g=e.length;g>f;f++)d&&d===e[f]||e[f].setHover(b,!0,c)},i=function(a){return null==a?null:a.split(" ")},j=function(a,b,c){for(var d in b)a[d]=c},k=function(a,b){b=d.isArray(b)||null!=b.length&&!d.isString(b)?b:[b];for(var c=0;c<b.length;c++)try{a.apply(b[c],[b[c]])}catch(e){d.log(".each iteration failed : "+e)}},l=function(a,b,c){if(a.getDefaultType){var e=a.getTypeDescriptor(),f={},g=a.getDefaultType(),h=d.merge({},g);j(f,g,"__default");for(var i=0,k=a._jsPlumb.types.length;k>i;i++){var l=a._jsPlumb.types[i];if("__default"!==l){var m=a._jsPlumb.instance.getType(l,e);null!=m&&(h=d.merge(h,m,["cssClass"]),j(f,m,l))}}b&&(h=d.populate(h,b,"_")),a.applyType(h,c,f),c||a.repaint()}},m=b.jsPlumbUIComponent=function(a){d.EventGenerator.apply(this,arguments);var b=this,c=arguments,e=b.idPrefix,f=e+(new Date).getTime();this._jsPlumb={instance:a._jsPlumb,parameters:a.parameters||{},paintStyle:null,hoverPaintStyle:null,paintStyleInUse:null,hover:!1,beforeDetach:a.beforeDetach,beforeDrop:a.beforeDrop,overlayPlacements:[],hoverClass:a.hoverClass||a._jsPlumb.Defaults.HoverClass,types:[],typeCache:{}},this.cacheTypeItem=function(a,b,c){this._jsPlumb.typeCache[c]=this._jsPlumb.typeCache[c]||{},this._jsPlumb.typeCache[c][a]=b},this.getCachedTypeItem=function(a,b){return this._jsPlumb.typeCache[b]?this._jsPlumb.typeCache[b][a]:null},this.getId=function(){return f};var g=a.overlays||[],h={};if(this.defaultOverlayKeys){for(var i=0;i<this.defaultOverlayKeys.length;i++)Array.prototype.push.apply(g,this._jsPlumb.instance.Defaults[this.defaultOverlayKeys[i]]||[]);for(i=0;i<g.length;i++){var j=r.convertToFullOverlaySpec(g[i]);h[j[1].id]=j}}var k={overlays:h,parameters:a.parameters||{},scope:a.scope||this._jsPlumb.instance.getDefaultScope()};if(this.getDefaultType=function(){return k},this.appendToDefaultType=function(a){for(var b in a)k[b]=a[b]},a.events)for(var l in a.events)b.bind(l,a.events[l]);this.clone=function(){var a=Object.create(this.constructor.prototype);return this.constructor.apply(a,c),a}.bind(this),this.isDetachAllowed=function(a){var b=!0;if(this._jsPlumb.beforeDetach)try{b=this._jsPlumb.beforeDetach(a)}catch(c){d.log("jsPlumb: beforeDetach callback failed",c)}return b},this.isDropAllowed=function(a,b,c,e,f,g,h){var i=this._jsPlumb.instance.checkCondition("beforeDrop",{sourceId:a,targetId:b,scope:c,connection:e,dropEndpoint:f,source:g,target:h});if(this._jsPlumb.beforeDrop)try{i=this._jsPlumb.beforeDrop({sourceId:a,targetId:b,scope:c,connection:e,dropEndpoint:f,source:g,target:h})}catch(j){d.log("jsPlumb: beforeDrop callback failed",j)}return i};var m=[];this.setListenerComponent=function(a){for(var b=0;b<m.length;b++)m[b][3]=a}},n=function(a,b){var c=a._jsPlumb.types[b],d=a._jsPlumb.instance.getType(c,a.getTypeDescriptor());null!=d&&d.cssClass&&a.canvas&&a._jsPlumb.instance.removeClass(a.canvas,d.cssClass)};d.extend(b.jsPlumbUIComponent,d.EventGenerator,{getParameter:function(a){return this._jsPlumb.parameters[a]},setParameter:function(a,b){this._jsPlumb.parameters[a]=b},getParameters:function(){return this._jsPlumb.parameters},setParameters:function(a){this._jsPlumb.parameters=a},getClass:function(){return r.getClass(this.canvas)},hasClass:function(a){return r.hasClass(this.canvas,a)},addClass:function(a){r.addClass(this.canvas,a)},removeClass:function(a){r.removeClass(this.canvas,a)},updateClasses:function(a,b){r.updateClasses(this.canvas,a,b)},setType:function(a,b,c){this.clearTypes(),this._jsPlumb.types=i(a)||[],l(this,b,c)},getType:function(){return this._jsPlumb.types},reapplyTypes:function(a,b){l(this,a,b)},hasType:function(a){return-1!==this._jsPlumb.types.indexOf(a)},addType:function(a,b,c){var d=i(a),e=!1;if(null!=d){for(var f=0,g=d.length;g>f;f++)this.hasType(d[f])||(this._jsPlumb.types.push(d[f]),e=!0);e&&l(this,b,c)}},removeType:function(a,b,c){var d=i(a),e=!1,f=function(a){var b=this._jsPlumb.types.indexOf(a);return-1!==b?(n(this,b),this._jsPlumb.types.splice(b,1),!0):!1}.bind(this);if(null!=d){for(var g=0,h=d.length;h>g;g++)e=f(d[g])||e;e&&l(this,b,c)}},clearTypes:function(a,b){for(var c=this._jsPlumb.types.length,d=0;c>d;d++)n(this,0),this._jsPlumb.types.splice(0,1);l(this,a,b)},toggleType:function(a,b,c){var d=i(a);if(null!=d){for(var e=0,f=d.length;f>e;e++){var g=this._jsPlumb.types.indexOf(d[e]);-1!==g?(n(this,g),this._jsPlumb.types.splice(g,1)):this._jsPlumb.types.push(d[e])}l(this,b,c)}},applyType:function(a,b){if(this.setPaintStyle(a.paintStyle,b),this.setHoverPaintStyle(a.hoverPaintStyle,b),a.parameters)for(var c in a.parameters)this.setParameter(c,a.parameters[c]);this._jsPlumb.paintStyleInUse=this.getPaintStyle()},setPaintStyle:function(a,b){this._jsPlumb.paintStyle=a,this._jsPlumb.paintStyleInUse=this._jsPlumb.paintStyle,f(this),b||this.repaint()},getPaintStyle:function(){return this._jsPlumb.paintStyle},setHoverPaintStyle:function(a,b){this._jsPlumb.hoverPaintStyle=a,f(this),b||this.repaint()},getHoverPaintStyle:function(){return this._jsPlumb.hoverPaintStyle},destroy:function(a){(a||null==this.typeId)&&(this.cleanupListeners(),this.clone=null,this._jsPlumb=null)},isHover:function(){return this._jsPlumb.hover},setHover:function(a,b,c){if(this._jsPlumb&&!this._jsPlumb.instance.currentlyDragging&&!this._jsPlumb.instance.isHoverSuspended()){this._jsPlumb.hover=a;var d=a?"addClass":"removeClass";null!=this.canvas&&(null!=this._jsPlumb.instance.hoverClass&&this._jsPlumb.instance[d](this.canvas,this._jsPlumb.instance.hoverClass),null!=this._jsPlumb.hoverClass&&this._jsPlumb.instance[d](this.canvas,this._jsPlumb.hoverClass)),null!=this._jsPlumb.hoverPaintStyle&&(this._jsPlumb.paintStyleInUse=a?this._jsPlumb.hoverPaintStyle:this._jsPlumb.paintStyle,this._jsPlumb.instance.isSuspendDrawing()||(c=c||e(),this.repaint({timestamp:c,recalc:!1}))),this.getAttachedElements&&!b&&h(this,a,e(),this)}}});var o=0,p=function(){var a=o+1;return o++,a},q=b.jsPlumbInstance=function(f){this.version="2.5.1",f&&r.extend(this.Defaults,f),this.logEnabled=this.Defaults.LogEnabled,this._connectionTypes={},this._endpointTypes={},d.EventGenerator.apply(this);var h=this,i=p(),j=h.bind,l={},n=1,o=function(a){if(null==a)return null;if(3===a.nodeType||8===a.nodeType)return{el:a,text:!0};var b=h.getElement(a);return{el:b,id:d.isString(a)&&null==b?a:$(b)}};this.getInstanceIndex=function(){return i},this.setZoom=function(a,b){return n=a,h.fire("zoom",n),b&&h.repaintEverything(),!0},this.getZoom=function(){return n};for(var q in this.Defaults)l[q]=this.Defaults[q];var s,t=[];this.unbindContainer=function(){if(null!=s&&t.length>0)for(var a=0;a<t.length;a++)h.off(s,t[a][0],t[a][1])},this.setContainer=function(a){this.unbindContainer(),a=this.getElement(a),this.select().each(function(b){b.moveParent(a)}),this.selectEndpoints().each(function(b){b.moveParent(a)});var b=s;s=a,t.length=0;for(var c={endpointclick:"endpointClick",endpointdblclick:"endpointDblClick"},d=function(a,b,d){var e=b.srcElement||b.target,f=(e&&e.parentNode?e.parentNode._jsPlumb:null)||(e?e._jsPlumb:null)||(e&&e.parentNode&&e.parentNode.parentNode?e.parentNode.parentNode._jsPlumb:null);if(f){f.fire(a,f,b);var g=d?c[d+a]||a:a;h.fire(g,f.component||f,b)}},e=function(a,b,c){t.push([a,c]),h.on(s,a,b,c)},f=function(a){e(a,".jtk-connector",function(b){d(a,b)}),e(a,".jtk-endpoint",function(b){d(a,b,"endpoint")}),e(a,".jtk-overlay",function(b){d(a,b)})},i=0;i<g.length;i++)f(g[i]);for(var j in z){var k=z[j].el;k.parentNode===b&&(b.removeChild(k),s.appendChild(k))}},this.getContainer=function(){return s},this.bind=function(a,b){"ready"===a&&v?b():j.apply(h,[a,b])},h.importDefaults=function(a){for(var b in a)h.Defaults[b]=a[b];return a.Container&&h.setContainer(a.Container),h},h.restoreDefaults=function(){return h.Defaults=r.extend({},l),h};var u=null,v=!1,w=[],x={},y={},z={},A={},B={},C={},D=!1,E=[],F=!1,G=null,H=this.Defaults.Scope,I=1,J=function(){return""+I++},K=function(a,b){s?s.appendChild(a):b?this.getElement(b).appendChild(a):this.appendToRoot(a)}.bind(this),L=function(a,b,c,d){if(!F){var f,g=$(a),i=h.getDragManager();i&&(f=i.getElementsForDraggable(g)),null==c&&(c=e());var j=vb({elId:g,offset:b,recalc:!1,timestamp:c});if(f&&j&&j.o)for(var k in f)vb({elId:f[k].id,offset:{left:j.o.left+f[k].offset.left,top:j.o.top+f[k].offset.top},recalc:!1,timestamp:c});if(h.anchorManager.redraw(g,b,c,null,d),f)for(var l in f)h.anchorManager.redraw(f[l].id,b,c,f[l].offset,d,!0)}},M=function(a){return y[a]},N=function(a,b,c,e,f){if(!r.headless){var g=null==b?!1:b;if(g&&r.isDragSupported(a,h)){var i=c||h.Defaults.DragOptions;if(i=r.extend({},i),r.isAlreadyDraggable(a,h))c.force&&h.initDraggable(a,i);else{var j=r.dragEvents.drag,k=r.dragEvents.stop,l=r.dragEvents.start,m=!1;ub(e,a),i[l]=d.wrap(i[l],function(){return h.setHoverSuspended(!0),h.select({source:a}).addClass(h.elementDraggingClass+" "+h.sourceElementDraggingClass,!0),h.select({target:a}).addClass(h.elementDraggingClass+" "+h.targetElementDraggingClass,!0),h.setConnectionBeingDragged(!0),i.canDrag?c.canDrag():void 0},!1),i[j]=d.wrap(i[j],function(){var b=h.getUIPosition(arguments,h.getZoom());null!=b&&(L(a,b,null,!0),m&&h.addClass(a,"jtk-dragged"),m=!0)}),i[k]=d.wrap(i[k],function(){for(var a,b=arguments[0].selection,c=function(b){null!=b[1]&&(a=h.getUIPosition([{el:b[2].el,pos:[b[1].left,b[1].top]}]),L(b[2].el,a)),h.removeClass(b[0],"jtk-dragged"),h.select({source:b[2].el}).removeClass(h.elementDraggingClass+" "+h.sourceElementDraggingClass,!0),h.select({target:b[2].el}).removeClass(h.elementDraggingClass+" "+h.targetElementDraggingClass,!0),h.getDragManager().dragEnded(b[2].el)},d=0;d<b.length;d++)c(b[d]);m=!1,h.setHoverSuspended(!1),h.setConnectionBeingDragged(!1)});var n=$(a);C[n]=!0;var o=C[n];i.disabled=null==o?!1:!o,h.initDraggable(a,i),h.getDragManager().register(a),f&&h.fire("elementDraggable",{el:a,options:i})}}}},O=function(a,b){for(var c=a.scope.split(/\s/),d=b.scope.split(/\s/),e=0;e<c.length;e++)for(var f=0;f<d.length;f++)if(d[f]===c[e])return!0;return!1},P=function(a,b){var c=r.extend({},a);for(var d in b)b[d]&&(c[d]=b[d]);return c},Q=function(a,b){var c=r.extend({},a);if(b&&r.extend(c,b),c.source&&(c.source.endpoint?c.sourceEndpoint=c.source:c.source=h.getElement(c.source)),c.target&&(c.target.endpoint?c.targetEndpoint=c.target:c.target=h.getElement(c.target)),a.uuids&&(c.sourceEndpoint=M(a.uuids[0]),c.targetEndpoint=M(a.uuids[1])),c.sourceEndpoint&&c.sourceEndpoint.isFull())return d.log(h,"could not add connection; source endpoint is full"),void 0;if(c.targetEndpoint&&c.targetEndpoint.isFull())return d.log(h,"could not add connection; target endpoint is full"),void 0;if(!c.type&&c.sourceEndpoint&&(c.type=c.sourceEndpoint.connectionType),c.sourceEndpoint&&c.sourceEndpoint.connectorOverlays){c.overlays=c.overlays||[];for(var e=0,f=c.sourceEndpoint.connectorOverlays.length;f>e;e++)c.overlays.push(c.sourceEndpoint.connectorOverlays[e])}c.sourceEndpoint&&c.sourceEndpoint.scope&&(c.scope=c.sourceEndpoint.scope),!c["pointer-events"]&&c.sourceEndpoint&&c.sourceEndpoint.connectorPointerEvents&&(c["pointer-events"]=c.sourceEndpoint.connectorPointerEvents);var g=function(a,b,d){return h.addEndpoint(a,P(b,{anchor:c.anchors?c.anchors[d]:c.anchor,endpoint:c.endpoints?c.endpoints[d]:c.endpoint,paintStyle:c.endpointStyles?c.endpointStyles[d]:c.endpointStyle,hoverPaintStyle:c.endpointHoverStyles?c.endpointHoverStyles[d]:c.endpointHoverStyle}))},i=function(a,b,d,e){if(c[a]&&!c[a].endpoint&&!c[a+"Endpoint"]&&!c.newConnection){var f=$(c[a]),h=d[f];if(h=h?h[e]:null){if(!h.enabled)return!1;var i=null!=h.endpoint&&h.endpoint._jsPlumb?h.endpoint:g(c[a],h.def,b);if(i.isFull())return!1;c[a+"Endpoint"]=i,!c.scope&&h.def.scope&&(c.scope=h.def.scope),h.uniqueEndpoint?h.endpoint?i.finalEndpoint=h.endpoint:(h.endpoint=i,i.setDeleteOnEmpty(!1)):i.setDeleteOnEmpty(!0)}}};return i("source",0,this.sourceEndpointDefinitions,c.type||"default")!==!1&&i("target",1,this.targetEndpointDefinitions,c.type||"default")!==!1?(c.sourceEndpoint&&c.targetEndpoint&&(O(c.sourceEndpoint,c.targetEndpoint)||(c=null)),c):void 0}.bind(h),R=function(a){var b=h.Defaults.ConnectionType||h.getDefaultConnectionType();a._jsPlumb=h,a.newConnection=R,a.newEndpoint=T,a.endpointsByUUID=y,a.endpointsByElement=x,a.finaliseConnection=S,a.id="con_"+J();var c=new b(a);return c.isDetachable()&&(c.endpoints[0].initDraggable("_jsPlumbSource"),c.endpoints[1].initDraggable("_jsPlumbTarget")),c},S=h.finaliseConnection=function(a,b,c,d){if(b=b||{},a.suspendedEndpoint||w.push(a),a.pending=null,a.endpoints[0].isTemporarySource=!1,d!==!1&&h.anchorManager.newConnection(a),L(a.source),!b.doNotFireConnectionEvent&&b.fireEvent!==!1){var e={connection:a,source:a.source,target:a.target,sourceId:a.sourceId,targetId:a.targetId,sourceEndpoint:a.endpoints[0],targetEndpoint:a.endpoints[1]};h.fire("connection",e,c)}},T=function(a,b){var c=h.Defaults.EndpointType||r.Endpoint,d=r.extend({},a);d._jsPlumb=h,d.newConnection=R,d.newEndpoint=T,d.endpointsByUUID=y,d.endpointsByElement=x,d.fireDetachEvent=bb,d.elementId=b||$(d.source);var e=new c(d);return e.id="ep_"+J(),ub(d.elementId,d.source),r.headless||h.getDragManager().endpointAdded(d.source,b),e},U=function(a,b,c){var d=x[a];if(d&&d.length)for(var e=0,f=d.length;f>e;e++){for(var g=0,h=d[e].connections.length;h>g;g++){var i=b(d[e].connections[g]);if(i)return}c&&c(d[e])}},V=function(a,b){return r.each(a,function(a){h.isDragSupported(a)&&(C[h.getAttribute(a,"id")]=b,h.setElementDraggable(a,b))})},W=function(a,b,c){b="block"===b;var d=null;c&&(d=function(a){a.setVisible(b,!0,!0)});var e=o(a);U(e.id,function(a){if(b&&c){var d=a.sourceId===e.id?1:0;a.endpoints[d].isVisible()&&a.setVisible(!0)}else a.setVisible(b)},d)},X=function(a){var b;return r.each(a,function(a){var c=h.getAttribute(a,"id");return b=null==C[c]?!1:C[c],b=!b,C[c]=b,h.setDraggable(a,b),b}.bind(this)),b},Y=function(a,b){var c=null;b&&(c=function(a){var b=a.isVisible();a.setVisible(!b)}),U(a,function(a){var b=a.isVisible();a.setVisible(!b)},c)},Z=function(a){var b=A[a];return b?{o:b,s:E[a]}:vb({elId:a})},$=function(a,b,c){if(d.isString(a))return a;if(null==a)return null;var e=h.getAttribute(a,"id");return e&&"undefined"!==e||(2===arguments.length&&void 0!==arguments[1]?e=b:(1===arguments.length||3===arguments.length&&!arguments[2])&&(e="jsPlumb_"+i+"_"+J()),c||h.setAttribute(a,"id",e)),e};this.setConnectionBeingDragged=function(a){D=a},this.isConnectionBeingDragged=function(){return D},this.getManagedElements=function(){return z},this.connectorClass="jtk-connector",this.connectorOutlineClass="jtk-connector-outline",this.editableConnectorClass="jtk-connector-editable",this.connectedClass="jtk-connected",this.hoverClass="jtk-hover",this.endpointClass="jtk-endpoint",this.endpointConnectedClass="jtk-endpoint-connected",this.endpointFullClass="jtk-endpoint-full",this.endpointDropAllowedClass="jtk-endpoint-drop-allowed",this.endpointDropForbiddenClass="jtk-endpoint-drop-forbidden",this.overlayClass="jtk-overlay",this.draggingClass="jtk-dragging",this.elementDraggingClass="jtk-element-dragging",this.sourceElementDraggingClass="jtk-source-element-dragging",this.targetElementDraggingClass="jtk-target-element-dragging",this.endpointAnchorClassPrefix="jtk-endpoint-anchor",this.hoverSourceClass="jtk-source-hover",this.hoverTargetClass="jtk-target-hover",this.dragSelectClass="jtk-drag-select",this.Anchors={},this.Connectors={svg:{}},this.Endpoints={svg:{}},this.Overlays={svg:{}},this.ConnectorRenderers={},this.SVG="svg",this.addEndpoint=function(a,b,c){c=c||{};var e=r.extend({},c);r.extend(e,b),e.endpoint=e.endpoint||h.Defaults.Endpoint,e.paintStyle=e.paintStyle||h.Defaults.EndpointStyle;for(var f=[],g=d.isArray(a)||null!=a.length&&!d.isString(a)?a:[a],i=0,j=g.length;j>i;i++){e.source=h.getElement(g[i]),sb(e.source);var k=$(e.source),l=T(e,k),m=ub(k,e.source).info.o;d.addToList(x,k,l),F||l.paint({anchorLoc:l.anchor.compute({xy:[m.left,m.top],wh:E[k],element:l,timestamp:G}),timestamp:G}),f.push(l)}return 1===f.length?f[0]:f},this.addEndpoints=function(a,b,c){for(var e=[],f=0,g=b.length;g>f;f++){var i=h.addEndpoint(a,b[f],c);d.isArray(i)?Array.prototype.push.apply(e,i):e.push(i)}return e},this.animate=function(a,b,c){if(!this.animationSupported)return!1;c=c||{};var e=h.getElement(a),f=$(e),g=r.animEvents.step,i=r.animEvents.complete;c[g]=d.wrap(c[g],function(){h.revalidate(f)}),c[i]=d.wrap(c[i],function(){h.revalidate(f)}),h.doAnimate(e,b,c)},this.checkCondition=function(a){var b=h.getListener(a),c=!0;if(b&&b.length>0){var e=Array.prototype.slice.call(arguments,1);try{for(var f=0,g=b.length;g>f;f++)c=c&&b[f].apply(b[f],e)}catch(i){d.log(h,"cannot check condition ["+a+"]"+i)}}return c},this.connect=function(a,b){var c,e=Q(a,b);if(e){if(null==e.source&&null==e.sourceEndpoint)return d.log("Cannot establish connection - source does not exist"),void 0;if(null==e.target&&null==e.targetEndpoint)return d.log("Cannot establish connection - target does not exist"),void 0;sb(e.source),c=R(e),S(c,e)}return c};var _=[{el:"source",elId:"sourceId",epDefs:"sourceEndpointDefinitions"},{el:"target",elId:"targetId",epDefs:"targetEndpointDefinitions"}],ab=function(a,b,c,d){var e,f,g,h=_[c],i=a[h.elId],j=(a[h.el],a.endpoints[c]),k={index:c,originalSourceId:0===c?i:a.sourceId,newSourceId:a.sourceId,originalTargetId:1===c?i:a.targetId,newTargetId:a.targetId,connection:a};if(b.constructor===r.Endpoint)e=b,e.addConnection(a),b=e.element;else if(f=$(b),g=this[h.epDefs][f],f===a[h.elId])e=null;else if(g)for(var l in g){if(!g[l].enabled)return;e=null!=g[l].endpoint&&g[l].endpoint._jsPlumb?g[l].endpoint:this.addEndpoint(b,g[l].def),g[l].uniqueEndpoint&&(g[l].endpoint=e),e.addConnection(a)}else e=a.makeEndpoint(0===c,b,f);return null!=e&&(j.detachFromConnection(a),a.endpoints[c]=e,a[h.el]=e.element,a[h.elId]=e.elementId,k[0===c?"newSourceId":"newTargetId"]=e.elementId,cb(k),d||a.repaint()),k.element=b,k}.bind(this);this.setSource=function(a,b,c){var d=ab(a,b,0,c);this.anchorManager.sourceChanged(d.originalSourceId,d.newSourceId,a,d.el)},this.setTarget=function(a,b,c){var d=ab(a,b,1,c);this.anchorManager.updateOtherEndpoint(d.originalSourceId,d.originalTargetId,d.newTargetId,a)},this.deleteEndpoint=function(a,b,c){var d="string"==typeof a?y[a]:a;return d&&h.deleteObject({endpoint:d,dontUpdateHover:b,deleteAttachedObjects:c}),h},this.deleteEveryEndpoint=function(){var a=h.setSuspendDrawing(!0);for(var b in x){var c=x[b];if(c&&c.length)for(var d=0,e=c.length;e>d;d++)h.deleteEndpoint(c[d],!0)}x={},z={},y={},A={},B={},h.anchorManager.reset();var f=h.getDragManager();return f&&f.reset(),a||h.setSuspendDrawing(!1),h};var bb=function(a,b,c){var d=h.Defaults.ConnectionType||h.getDefaultConnectionType(),e=a.constructor===d,f=e?{connection:a,source:a.source,target:a.target,sourceId:a.sourceId,targetId:a.targetId,sourceEndpoint:a.endpoints[0],targetEndpoint:a.endpoints[1]}:a;b&&h.fire("connectionDetached",f,c),h.fire("internal.connectionDetached",f,c),h.anchorManager.connectionDetached(f)},cb=h.fireMoveEvent=function(a,b){h.fire("connectionMoved",a,b)};this.unregisterEndpoint=function(a){a._jsPlumb.uuid&&(y[a._jsPlumb.uuid]=null),h.anchorManager.deleteEndpoint(a);for(var b in x){var c=x[b];if(c){for(var d=[],e=0,f=c.length;f>e;e++)c[e]!==a&&d.push(c[e]);x[b]=d}x[b].length<1&&delete x[b]}};var db="isDetachAllowed",eb="beforeDetach",fb="checkCondition";this.deleteConnection=function(a,b){return null!=a&&(b=b||{},b.force||d.functionChain(!0,!1,[[a.endpoints[0],db,[a]],[a.endpoints[1],db,[a]],[a,db,[a]],[h,fb,[eb,a]]]))?(a.setHover(!1),bb(a,!a.pending&&b.fireEvent!==!1,b.originalEvent),a.endpoints[0].detachFromConnection(a),a.endpoints[1].detachFromConnection(a),d.removeWithFunction(w,function(b){return a.id===b.id}),a.cleanup(),a.destroy(),!0):!1},this.deleteEveryConnection=function(a){a=a||{};var b=w.length,c=0;return h.batch(function(){for(var d=0;b>d;d++)c+=h.deleteConnection(w[0],a)?1:0}),c},this.deleteConnectionsForElement=function(a,b){b=b||{},a=h.getElement(a);var c=$(a),d=x[c];if(d&&d.length)for(var e=0,f=d.length;f>e;e++)d[e].deleteEveryConnection(b);return h},this.deleteObject=function(a){var b={endpoints:{},connections:{},endpointCount:0,connectionCount:0},c=a.deleteAttachedObjects!==!1,e=function(c){null!=c&&null==b.connections[c.id]&&(a.dontUpdateHover||null==c._jsPlumb||c.setHover(!1),b.connections[c.id]=c,b.connectionCount++)},f=function(d){if(null!=d&&null==b.endpoints[d.id]&&(a.dontUpdateHover||null==d._jsPlumb||d.setHover(!1),b.endpoints[d.id]=d,b.endpointCount++,c))for(var f=0;f<d.connections.length;f++){var g=d.connections[f];e(g)}};a.connection?e(a.connection):f(a.endpoint);for(var g in b.connections){var i=b.connections[g];if(i._jsPlumb){d.removeWithFunction(w,function(a){return i.id===a.id}),bb(i,a.fireEvent===!1?!1:!i.pending,a.originalEvent);var j=null==a.deleteAttachedObjects?null:!a.deleteAttachedObjects;i.endpoints[0].detachFromConnection(i,null,j),i.endpoints[1].detachFromConnection(i,null,j),i.cleanup(!0),i.destroy(!0)}}for(var k in b.endpoints){var l=b.endpoints[k];l._jsPlumb&&(h.unregisterEndpoint(l),l.cleanup(!0),l.destroy(!0))}return b},this.draggable=function(a,b){var c;return k(function(a){c=o(a),c.el&&N(c.el,!0,b,c.id,!0)},a),h},this.droppable=function(a,b){var c;return b=b||{},b.allowLoopback=!1,k(function(a){c=o(a),c.el&&h.initDroppable(c.el,b)},a),h};var gb=function(a,b,c,d){for(var e=0,f=a.length;f>e;e++)a[e][b].apply(a[e],c);return d(a)},hb=function(a,b,c){for(var d=[],e=0,f=a.length;f>e;e++)d.push([a[e][b].apply(a[e],c),a[e]]);return d},ib=function(a,b,c){return function(){return gb(a,b,arguments,c)}},jb=function(a,b){return function(){return hb(a,b,arguments)}},kb=function(a,b){var c=[];if(a)if("string"==typeof a){if("*"===a)return a;c.push(a)}else if(b)c=a;else if(a.length)for(var d=0,e=a.length;e>d;d++)c.push(o(a[d]).id);else c.push(o(a).id);return c},lb=function(a,b,c){return"*"===a?!0:a.length>0?-1!==a.indexOf(b):!c};this.getConnections=function(a,b){a?a.constructor===String&&(a={scope:a}):a={};for(var c=a.scope||h.getDefaultScope(),d=kb(c,!0),e=kb(a.source),f=kb(a.target),g=!b&&d.length>1?{}:[],i=function(a,c){if(!b&&d.length>1){var e=g[a];null==e&&(e=g[a]=[]),e.push(c)}else g.push(c)},j=0,k=w.length;k>j;j++){var l=w[j],m=l.proxies&&l.proxies[0]?l.proxies[0].originalEp.elementId:l.sourceId,n=l.proxies&&l.proxies[1]?l.proxies[1].originalEp.elementId:l.targetId;lb(d,l.scope)&&lb(e,m)&&lb(f,n)&&i(l.scope,l)}return g};var mb=function(a,b){return function(c){for(var d=0,e=a.length;e>d;d++)c(a[d]);return b(a)}},nb=function(a){return function(b){return a[b]}},ob=function(a,b){var c,d,e={length:a.length,each:mb(a,b),get:nb(a)},f=["setHover","removeAllOverlays","setLabel","addClass","addOverlay","removeOverlay","removeOverlays","showOverlay","hideOverlay","showOverlays","hideOverlays","setPaintStyle","setHoverPaintStyle","setSuspendEvents","setParameter","setParameters","setVisible","repaint","addType","toggleType","removeType","removeClass","setType","bind","unbind"],g=["getLabel","getOverlay","isHover","getParameter","getParameters","getPaintStyle","getHoverPaintStyle","isVisible","hasType","getType","isSuspendEvents"];for(c=0,d=f.length;d>c;c++)e[f[c]]=ib(a,f[c],b);for(c=0,d=g.length;d>c;c++)e[g[c]]=jb(a,g[c]);return e},pb=function(a){var b=ob(a,pb);return r.extend(b,{setDetachable:ib(a,"setDetachable",pb),setReattach:ib(a,"setReattach",pb),setConnector:ib(a,"setConnector",pb),"delete":function(){for(var b=0,c=a.length;c>b;b++)h.deleteConnection(a[b])},isDetachable:jb(a,"isDetachable"),isReattach:jb(a,"isReattach")})},qb=function(a){var b=ob(a,qb);return r.extend(b,{setEnabled:ib(a,"setEnabled",qb),setAnchor:ib(a,"setAnchor",qb),isEnabled:jb(a,"isEnabled"),deleteEveryConnection:function(){for(var b=0,c=a.length;c>b;b++)a[b].deleteEveryConnection()},"delete":function(){for(var b=0,c=a.length;c>b;b++)h.deleteEndpoint(a[b])}})};this.select=function(a){return a=a||{},a.scope=a.scope||"*",pb(a.connections||h.getConnections(a,!0))},this.selectEndpoints=function(a){a=a||{},a.scope=a.scope||"*";var b=!a.element&&!a.source&&!a.target,c=b?"*":kb(a.element),d=b?"*":kb(a.source),e=b?"*":kb(a.target),f=kb(a.scope,!0),g=[];for(var h in x){var i=lb(c,h,!0),j=lb(d,h,!0),k="*"!==d,l=lb(e,h,!0),m="*"!==e;if(i||j||l)a:for(var n=0,o=x[h].length;o>n;n++){var p=x[h][n];if(lb(f,p.scope,!0)){var q=k&&d.length>0&&!p.isSource,r=m&&e.length>0&&!p.isTarget;if(q||r)continue a;g.push(p)}}}return qb(g)},this.getAllConnections=function(){return w},this.getDefaultScope=function(){return H},this.getEndpoint=M,this.getEndpoints=function(a){return x[o(a).id]||[]},this.getDefaultEndpointType=function(){return r.Endpoint},this.getDefaultConnectionType=function(){return r.Connection},this.getId=$,this.appendElement=K;var rb=!1;this.isHoverSuspended=function(){return rb},this.setHoverSuspended=function(a){rb=a},this.hide=function(a,b){return W(a,"none",b),h},this.idstamp=J,this.connectorsInitialized=!1,this.registerConnectorType=function(a,b){c.push([a,b])};var sb=function(a){if(!s&&a){var b=h.getElement(a);b.offsetParent&&h.setContainer(b.offsetParent)}},tb=function(){h.Defaults.Container&&h.setContainer(h.Defaults.Container)},ub=h.manage=function(a,b,c){return z[a]||(z[a]={el:b,endpoints:[],connections:[]},z[a].info=vb({elId:a,timestamp:G}),c||h.fire("manageElement",{id:a,info:z[a].info,el:b})),z[a]},vb=this.updateOffset=function(a){var b,c=a.timestamp,d=a.recalc,e=a.offset,f=a.elId;return F&&!c&&(c=G),!d&&c&&c===B[f]?{o:a.offset||A[f],s:E[f]}:(d||!e&&null==A[f]?(b=z[f]?z[f].el:null,null!=b&&(E[f]=h.getSize(b),A[f]=h.getOffset(b),B[f]=c)):(A[f]=e||A[f],null==E[f]&&(b=z[f].el,null!=b&&(E[f]=h.getSize(b))),B[f]=c),A[f]&&!A[f].right&&(A[f].right=A[f].left+E[f][0],A[f].bottom=A[f].top+E[f][1],A[f].width=E[f][0],A[f].height=E[f][1],A[f].centerx=A[f].left+A[f].width/2,A[f].centery=A[f].top+A[f].height/2),{o:A[f],s:E[f]})};this.init=function(){a=b.jsPlumb.getRenderModes();var e=function(a,c,e){b.jsPlumb.Connectors[a][c]=function(){e.apply(this,arguments),b.jsPlumb.ConnectorRenderers[a].apply(this,arguments)},d.extend(b.jsPlumb.Connectors[a][c],[e,b.jsPlumb.ConnectorRenderers[a]])};if(!b.jsPlumb.connectorsInitialized){for(var f=0;f<c.length;f++)for(var g=0;g<a.length;g++)e(a[g],c[f][1],c[f][0]);b.jsPlumb.connectorsInitialized=!0}v||(tb(),h.anchorManager=new b.jsPlumb.AnchorManager({jsPlumbInstance:h}),v=!0,h.fire("ready",h))
+}.bind(this),this.log=u,this.jsPlumbUIComponent=m,this.makeAnchor=function(){var a,c=function(a,c){if(b.jsPlumb.Anchors[a])return new b.jsPlumb.Anchors[a](c);if(!h.Defaults.DoNotThrowErrors)throw{msg:"jsPlumb: unknown anchor type '"+a+"'"}};if(0===arguments.length)return null;var e=arguments[0],f=arguments[1],g=(arguments[2],null);if(e.compute&&e.getOrientation)return e;if("string"==typeof e)g=c(arguments[0],{elementId:f,jsPlumbInstance:h});else if(d.isArray(e))if(d.isArray(e[0])||d.isString(e[0]))2===e.length&&d.isObject(e[1])?d.isString(e[0])?(a=b.jsPlumb.extend({elementId:f,jsPlumbInstance:h},e[1]),g=c(e[0],a)):(a=b.jsPlumb.extend({elementId:f,jsPlumbInstance:h,anchors:e[0]},e[1]),g=new b.jsPlumb.DynamicAnchor(a)):g=new r.DynamicAnchor({anchors:e,selector:null,elementId:f,jsPlumbInstance:h});else{var i={x:e[0],y:e[1],orientation:e.length>=4?[e[2],e[3]]:[0,0],offsets:e.length>=6?[e[4],e[5]]:[0,0],elementId:f,jsPlumbInstance:h,cssClass:7===e.length?e[6]:null};g=new b.jsPlumb.Anchor(i),g.clone=function(){return new b.jsPlumb.Anchor(i)}}return g.id||(g.id="anchor_"+J()),g},this.makeAnchors=function(a,c,e){for(var f=[],g=0,i=a.length;i>g;g++)"string"==typeof a[g]?f.push(b.jsPlumb.Anchors[a[g]]({elementId:c,jsPlumbInstance:e})):d.isArray(a[g])&&f.push(h.makeAnchor(a[g],c,e));return f},this.makeDynamicAnchor=function(a,c){return new b.jsPlumb.DynamicAnchor({anchors:a,selector:c,elementId:null,jsPlumbInstance:h})},this.targetEndpointDefinitions={},this.sourceEndpointDefinitions={};var wb=function(a,b,c,d,e){for(var f=a.target||a.srcElement,g=!1,h=d.getSelector(b,c),i=0;i<h.length;i++)if(h[i]===f){g=!0;break}return e?!g:g},xb=function(a,c,e,f,g){var i=new m(c),j=c._jsPlumb.EndpointDropHandler({jsPlumb:h,enabled:function(){return a.def.enabled},isFull:function(){var b=h.select({target:a.id}).length;return a.def.maxConnections>0&&b>=a.def.maxConnections},element:a.el,elementId:a.id,isSource:f,isTarget:g,addClass:function(b){h.addClass(a.el,b)},removeClass:function(b){h.removeClass(a.el,b)},onDrop:function(a){var b=a.endpoints[0];b.anchor.locked=!1},isDropAllowed:function(){return i.isDropAllowed.apply(i,arguments)},isRedrop:function(b){return null!=b.suspendedElement&&null!=b.suspendedEndpoint&&b.suspendedEndpoint.element===a.el},getEndpoint:function(d){var e=a.def.endpoint;if(null==e||null==e._jsPlumb){var f=h.deriveEndpointAndAnchorSpec(d.getType().join(" "),!0),g=f.endpoints?b.jsPlumb.extend(c,{endpoint:a.def.def.endpoint||f.endpoints[1]}):c;f.anchors&&(g=b.jsPlumb.extend(g,{anchor:a.def.def.anchor||f.anchors[1]})),e=h.addEndpoint(a.el,g),e._mtNew=!0}if(c.uniqueEndpoint&&(a.def.endpoint=e),e.setDeleteOnEmpty(!0),d.isDetachable()&&e.initDraggable(),null!=e.anchor.positionFinder){var i=h.getUIPosition(arguments,h.getZoom()),j=h.getOffset(a.el),k=h.getSize(a.el),l=null==i?[0,0]:e.anchor.positionFinder(i,j,k,e.anchor.constructorParams);e.anchor.x=l[0],e.anchor.y=l[1]}return e},maybeCleanup:function(a){a._mtNew&&0===a.connections.length?h.deleteObject({endpoint:a}):delete a._mtNew}}),k=b.jsPlumb.dragEvents.drop;return e.scope=e.scope||c.scope||h.Defaults.Scope,e[k]=d.wrap(e[k],j,!0),g&&(e[b.jsPlumb.dragEvents.over]=function(){return!0}),c.allowLoopback===!1&&(e.canDrop=function(b){var c=b.getDragElement()._jsPlumbRelatedElement;return c!==a.el}),h.initDroppable(a.el,e,"internal"),j};this.makeTarget=function(a,c,d){var e=b.jsPlumb.extend({_jsPlumb:this},d);b.jsPlumb.extend(e,c);for(var f=e.maxConnections||-1,g=function(a){var c=o(a),d=c.id,g=b.jsPlumb.extend({},e.dropOptions||{}),i=e.connectionType||"default";this.targetEndpointDefinitions[d]=this.targetEndpointDefinitions[d]||{},sb(d),c.el._isJsPlumbGroup&&null==g.rank&&(g.rank=-1);var j={def:b.jsPlumb.extend({},e),uniqueEndpoint:e.uniqueEndpoint,maxConnections:f,enabled:!0};e.createEndpoint&&(j.uniqueEndpoint=!0,j.endpoint=h.addEndpoint(a,j.def),j.endpoint.setDeleteOnEmpty(!1)),c.def=j,this.targetEndpointDefinitions[d][i]=j,xb(c,e,g,e.isSource===!0,!0),c.el._katavorioDrop[c.el._katavorioDrop.length-1].targetDef=j}.bind(this),i=a.length&&a.constructor!==String?a:[a],j=0,k=i.length;k>j;j++)g(i[j]);return this},this.unmakeTarget=function(a,b){var c=o(a);return h.destroyDroppable(c.el,"internal"),b||delete this.targetEndpointDefinitions[c.id],this},this.makeSource=function(a,c,e){var f=b.jsPlumb.extend({_jsPlumb:this},e);b.jsPlumb.extend(f,c);var g=f.connectionType||"default",i=h.deriveEndpointAndAnchorSpec(g);f.endpoint=f.endpoint||i.endpoints[0],f.anchor=f.anchor||i.anchors[0];for(var j=f.maxConnections||-1,k=f.onMaxConnections,l=function(c){var e=c.id,i=this.getElement(c.el);this.sourceEndpointDefinitions[e]=this.sourceEndpointDefinitions[e]||{},sb(e);var l={def:b.jsPlumb.extend({},f),uniqueEndpoint:f.uniqueEndpoint,maxConnections:j,enabled:!0};f.createEndpoint&&(l.uniqueEndpoint=!0,l.endpoint=h.addEndpoint(a,l.def),l.endpoint.setDeleteOnEmpty(!1)),this.sourceEndpointDefinitions[e][g]=l,c.def=l;var m=b.jsPlumb.dragEvents.stop,o=b.jsPlumb.dragEvents.drag,p=b.jsPlumb.extend({},f.dragOptions||{}),q=p.drag,r=p.stop,s=null,t=!1;p.scope=p.scope||f.scope,p[o]=d.wrap(p[o],function(){q&&q.apply(this,arguments),t=!1}),p[m]=d.wrap(p[m],function(){if(r&&r.apply(this,arguments),this.currentlyDragging=!1,null!=s._jsPlumb){var a=f.anchor||this.Defaults.Anchor,b=s.anchor,c=s.connections[0],d=this.makeAnchor(a,e,this),g=s.element;if(null!=d.positionFinder){var i=h.getOffset(g),j=this.getSize(g),k={left:i.left+b.x*j[0],top:i.top+b.y*j[1]},l=d.positionFinder(k,i,j,d.constructorParams);d.x=l[0],d.y=l[1]}s.setAnchor(d,!0),s.repaint(),this.repaint(s.elementId),null!=c&&this.repaint(c.targetId)}}.bind(this));var u=function(a){if(3!==a.which&&2!==a.button){var l=this.sourceEndpointDefinitions[e][g];if(l.enabled){if(e=this.getId(this.getElement(c.el)),f.filter){var m=d.isString(f.filter)?wb(a,c.el,f.filter,this,f.filterExclude):f.filter(a,c.el);if(m===!1)return}var o=this.select({source:e}).length;if(l.maxConnections>=0&&o>=l.maxConnections)return k&&k({element:c.el,maxConnections:j},a),!1;var q=b.jsPlumb.getPositionOnElement(a,i,n),r={};b.jsPlumb.extend(r,f),r.isTemporarySource=!0,r.anchor=[q[0],q[1],0,0],r.dragOptions=p,l.def.scope&&(r.scope=l.def.scope),s=this.addEndpoint(e,r),t=!0,s.setDeleteOnEmpty(!0),l.uniqueEndpoint&&(l.endpoint?s.finalEndpoint=l.endpoint:(l.endpoint=s,s.setDeleteOnEmpty(!1)));var u=function(){h.off(s.canvas,"mouseup",u),h.off(c.el,"mouseup",u),t&&(t=!1,h.deleteEndpoint(s))};h.on(s.canvas,"mouseup",u),h.on(c.el,"mouseup",u);var v={};if(l.def.extract)for(var w in l.def.extract){var x=(a.srcElement||a.target).getAttribute(w);x&&(v[l.def.extract[w]]=x)}h.trigger(s.canvas,"mousedown",a,v),d.consume(a)}}}.bind(this);this.on(c.el,"mousedown",u),l.trigger=u,f.filter&&(d.isString(f.filter)||d.isFunction(f.filter))&&h.setDragFilter(c.el,f.filter);var v=b.jsPlumb.extend({},f.dropOptions||{});xb(c,f,v,!0,f.isTarget===!0)}.bind(this),m=a.length&&a.constructor!==String?a:[a],p=0,q=m.length;q>p;p++)l(o(m[p]));return this},this.unmakeSource=function(a,b,c){var d=o(a);h.destroyDroppable(d.el,"internal");var e=this.sourceEndpointDefinitions[d.id];if(e)for(var f in e)if(null==b||b===f){var g=e[f].trigger;g&&h.off(d.el,"mousedown",g),c||delete this.sourceEndpointDefinitions[d.id][f]}return this},this.unmakeEverySource=function(){for(var a in this.sourceEndpointDefinitions)h.unmakeSource(a,null,!0);return this.sourceEndpointDefinitions={},this};var yb=function(a,b,c){b=d.isArray(b)?b:[b];var e=$(a);c=c||"default";for(var f=0;f<b.length;f++){var g=this[b[f]][e];if(g&&g[c])return g[c].def.scope||this.Defaults.Scope}}.bind(this),zb=function(a,b,c,e){c=d.isArray(c)?c:[c];var f=$(a);e=e||"default";for(var g=0;g<c.length;g++){var h=this[c[g]][f];h&&h[e]&&(h[e].def.scope=b)}}.bind(this);this.getScope=function(a){return yb(a,["sourceEndpointDefinitions","targetEndpointDefinitions"])},this.getSourceScope=function(a){return yb(a,"sourceEndpointDefinitions")},this.getTargetScope=function(a){return yb(a,"targetEndpointDefinitions")},this.setScope=function(a,b,c){this.setSourceScope(a,b,c),this.setTargetScope(a,b,c)},this.setSourceScope=function(a,b,c){zb(a,b,"sourceEndpointDefinitions",c),this.setDragScope(a,b)},this.setTargetScope=function(a,b,c){zb(a,b,"targetEndpointDefinitions",c),this.setDropScope(a,b)},this.unmakeEveryTarget=function(){for(var a in this.targetEndpointDefinitions)h.unmakeTarget(a,!0);return this.targetEndpointDefinitions={},this};var Ab=function(a,b,c,e,f){var g,i,j,k="source"===a?this.sourceEndpointDefinitions:this.targetEndpointDefinitions;if(f=f||"default",b.length&&!d.isString(b)){g=[];for(var l=0,m=b.length;m>l;l++)i=o(b[l]),k[i.id]&&k[i.id][f]&&(g[l]=k[i.id][f].enabled,j=e?!g[l]:c,k[i.id][f].enabled=j,h[j?"removeClass":"addClass"](i.el,"jtk-"+a+"-disabled"))}else{i=o(b);var n=i.id;k[n]&&k[n][f]&&(g=k[n][f].enabled,j=e?!g:c,k[n][f].enabled=j,h[j?"removeClass":"addClass"](i.el,"jtk-"+a+"-disabled"))}return g}.bind(this),Bb=function(a,b){return d.isString(a)||!a.length?b.apply(this,[a]):a.length?b.apply(this,[a[0]]):void 0}.bind(this);this.toggleSourceEnabled=function(a,b){return Ab("source",a,null,!0,b),this.isSourceEnabled(a,b)},this.setSourceEnabled=function(a,b,c){return Ab("source",a,b,null,c)},this.isSource=function(a,b){return b=b||"default",Bb(a,function(a){var c=this.sourceEndpointDefinitions[o(a).id];return null!=c&&null!=c[b]}.bind(this))},this.isSourceEnabled=function(a,b){return b=b||"default",Bb(a,function(a){var c=this.sourceEndpointDefinitions[o(a).id];return c&&c[b]&&c[b].enabled===!0}.bind(this))},this.toggleTargetEnabled=function(a,b){return Ab("target",a,null,!0,b),this.isTargetEnabled(a,b)},this.isTarget=function(a,b){return b=b||"default",Bb(a,function(a){var c=this.targetEndpointDefinitions[o(a).id];return null!=c&&null!=c[b]}.bind(this))},this.isTargetEnabled=function(a,b){return b=b||"default",Bb(a,function(a){var c=this.targetEndpointDefinitions[o(a).id];return c&&c[b]&&c[b].enabled===!0}.bind(this))},this.setTargetEnabled=function(a,b,c){return Ab("target",a,b,null,c)},this.ready=function(a){h.bind("ready",a)};var Cb=function(a,b){if("object"==typeof a&&a.length)for(var c=0,d=a.length;d>c;c++)b(a[c]);else b(a);return h};this.repaint=function(a,b,c){return Cb(a,function(a){L(a,b,c)})},this.revalidate=function(a,b,c){return Cb(a,function(a){var d=c?a:h.getId(a);h.updateOffset({elId:d,recalc:!0,timestamp:b});var e=h.getDragManager();e&&e.updateOffsets(d),h.repaint(a)})},this.repaintEverything=function(){var a,b=e();for(a in x)h.updateOffset({elId:a,recalc:!0,timestamp:b});for(a in x)L(a,null,b);return this},this.removeAllEndpoints=function(a,b,c){c=c||[];var d=function(a){var e,f,g=o(a),i=x[g.id];if(i)for(c.push(g),e=0,f=i.length;f>e;e++)h.deleteEndpoint(i[e],!1);if(delete x[g.id],b&&g.el&&3!==g.el.nodeType&&8!==g.el.nodeType)for(e=0,f=g.el.childNodes.length;f>e;e++)d(g.el.childNodes[e])};return d(a),this};var Db=function(a,b){h.removeAllEndpoints(a.id,!0,b);for(var c=h.getDragManager(),d=function(a){c&&c.elementRemoved(a.id),h.anchorManager.clearFor(a.id),h.anchorManager.removeFloatingConnection(a.id),h.isSource(a.el)&&h.unmakeSource(a.el),h.isTarget(a.el)&&h.unmakeTarget(a.el),h.destroyDraggable(a.el),h.destroyDroppable(a.el),delete h.floatingConnections[a.id],delete z[a.id],delete A[a.id],a.el&&(h.removeElement(a.el),a.el._jsPlumb=null)},e=1;e<b.length;e++)d(b[e]);d(a)};this.remove=function(a,b){var c=o(a),d=[];return c.text?c.el.parentNode.removeChild(c.el):c.id&&h.batch(function(){Db(c,d)},b===!1),h},this.empty=function(a,b){var c=[],d=function(a,b){var e=o(a);if(e.text)e.el.parentNode.removeChild(e.el);else if(e.el){for(;e.el.childNodes.length>0;)d(e.el.childNodes[0]);b||Db(e,c)}};return h.batch(function(){d(a,!0)},b===!1),h},this.reset=function(){h.silently(function(){rb=!1,h.removeAllGroups(),h.removeGroupManager(),h.deleteEveryEndpoint(),h.unbind(),this.targetEndpointDefinitions={},this.sourceEndpointDefinitions={},w.length=0,this.doReset&&this.doReset()}.bind(this))};var Eb=function(a){a.canvas&&a.canvas.parentNode&&a.canvas.parentNode.removeChild(a.canvas),a.cleanup(),a.destroy()};this.clear=function(){h.select().each(Eb),h.selectEndpoints().each(Eb),x={},y={}},this.setDefaultScope=function(a){return H=a,h},this.setDraggable=V,this.deriveEndpointAndAnchorSpec=function(a,b){for(var c=((b?"":"default ")+a).split(/[\s]/),d=null,e=null,f=null,g=null,i=0;i<c.length;i++){var j=h.getType(c[i],"connection");j&&(j.endpoints&&(d=j.endpoints),j.endpoint&&(e=j.endpoint),j.anchors&&(g=j.anchors),j.anchor&&(f=j.anchor))}return{endpoints:d?d:[e,e],anchors:g?g:[f,f]}},this.setId=function(a,b,c){var e;d.isString(a)?e=a:(a=this.getElement(a),e=this.getId(a));var f=this.getConnections({source:e,scope:"*"},!0),g=this.getConnections({target:e,scope:"*"},!0);b=""+b,c?a=this.getElement(b):(a=this.getElement(e),this.setAttribute(a,"id",b)),x[b]=x[e]||[];for(var h=0,i=x[b].length;i>h;h++)x[b][h].setElementId(b),x[b][h].setReferenceElement(a);delete x[e],this.sourceEndpointDefinitions[b]=this.sourceEndpointDefinitions[e],delete this.sourceEndpointDefinitions[e],this.targetEndpointDefinitions[b]=this.targetEndpointDefinitions[e],delete this.targetEndpointDefinitions[e],this.anchorManager.changeId(e,b);var j=this.getDragManager();j&&j.changeId(e,b),z[b]=z[e],delete z[e];var k=function(c,d,e){for(var f=0,g=c.length;g>f;f++)c[f].endpoints[d].setElementId(b),c[f].endpoints[d].setReferenceElement(a),c[f][e+"Id"]=b,c[f][e]=a};k(f,0,"source"),k(g,1,"target"),this.repaint(b)},this.setDebugLog=function(a){u=a},this.setSuspendDrawing=function(a,b){var c=F;return F=a,G=a?(new Date).getTime():null,b&&this.repaintEverything(),c},this.isSuspendDrawing=function(){return F},this.getSuspendedAt=function(){return G},this.batch=function(a,b){var c=this.isSuspendDrawing();c||this.setSuspendDrawing(!0);try{a()}catch(e){d.log("Function run while suspended failed",e)}c||this.setSuspendDrawing(!1,!b)},this.doWhileSuspended=this.batch,this.getCachedData=Z,this.timestamp=e,this.show=function(a,b){return W(a,"block",b),h},this.toggleVisible=Y,this.toggleDraggable=X,this.addListener=this.bind};d.extend(b.jsPlumbInstance,d.EventGenerator,{setAttribute:function(a,b,c){this.setAttribute(a,b,c)},getAttribute:function(a,c){return this.getAttribute(b.jsPlumb.getElement(a),c)},convertToFullOverlaySpec:function(a){return d.isString(a)&&(a=[a,{}]),a[1].id=a[1].id||d.uuid(),a},registerConnectionType:function(a,c){if(this._connectionTypes[a]=b.jsPlumb.extend({},c),c.overlays){for(var d={},e=0;e<c.overlays.length;e++){var f=this.convertToFullOverlaySpec(c.overlays[e]);d[f[1].id]=f}this._connectionTypes[a].overlays=d}},registerConnectionTypes:function(a){for(var b in a)this.registerConnectionType(b,a[b])},registerEndpointType:function(a,c){if(this._endpointTypes[a]=b.jsPlumb.extend({},c),c.overlays){for(var d={},e=0;e<c.overlays.length;e++){var f=this.convertToFullOverlaySpec(c.overlays[e]);d[f[1].id]=f}this._endpointTypes[a].overlays=d}},registerEndpointTypes:function(a){for(var b in a)this.registerEndpointType(b,a[b])},getType:function(a,b){return"connection"===b?this._connectionTypes[a]:this._endpointTypes[a]},setIdChanged:function(a,b){this.setId(a,b,!0)},setParent:function(a,b){var c=this.getElement(a),d=this.getId(c),e=this.getElement(b),f=this.getId(e),g=this.getDragManager();c.parentNode.removeChild(c),e.appendChild(c),g&&g.setParent(c,d,e,f)},extend:function(a,b,c){var d;if(c)for(d=0;d<c.length;d++)a[c[d]]=b[c[d]];else for(d in b)a[d]=b[d];return a},floatingConnections:{},getFloatingAnchorIndex:function(a){return a.endpoints[0].isFloating()?0:a.endpoints[1].isFloating()?1:-1}}),q.prototype.Defaults={Anchor:"Bottom",Anchors:[null,null],ConnectionsDetachable:!0,ConnectionOverlays:[],Connector:"Bezier",Container:null,DoNotThrowErrors:!1,DragOptions:{},DropOptions:{},Endpoint:"Dot",EndpointOverlays:[],Endpoints:[null,null],EndpointStyle:{fill:"#456"},EndpointStyles:[null,null],EndpointHoverStyle:null,EndpointHoverStyles:[null,null],HoverPaintStyle:null,LabelStyle:{color:"black"},LogEnabled:!1,Overlays:[],MaxConnections:1,PaintStyle:{"stroke-width":4,stroke:"#456"},ReattachConnections:!1,RenderMode:"svg",Scope:"jsPlumb_DefaultScope"};var r=new q;b.jsPlumb=r,r.getInstance=function(a,b){var c=new q(a);if(b)for(var d in b)c[d]=b[d];return c.init(),c},r.each=function(a,b){if(null!=a)if("string"==typeof a)b(r.getElement(a));else if(null!=a.length)for(var c=0;c<a.length;c++)b(r.getElement(a[c]));else b(a)},"undefined"!=typeof exports&&(exports.jsPlumb=r)}.call("undefined"!=typeof window?window:this),function(){var a=this,b=a.jsPlumbUtil,c=function(a,b){if(null==b)return[0,0];var c=h(b),d=g(c,0);return[d[a+"X"],d[a+"Y"]]},d=c.bind(this,"page"),e=c.bind(this,"screen"),f=c.bind(this,"client"),g=function(a,b){return a.item?a.item(b):a[b]},h=function(a){return a.touches&&a.touches.length>0?a.touches:a.changedTouches&&a.changedTouches.length>0?a.changedTouches:a.targetTouches&&a.targetTouches.length>0?a.targetTouches:[a]},i=function(a){var b={},c=[],d={},e={},f={};this.register=function(g){var h=a.getId(g),i=a.getOffset(g);b[h]||(b[h]=g,c.push(g),d[h]={});var j=function(b){if(b)for(var c=0;c<b.childNodes.length;c++)if(3!==b.childNodes[c].nodeType&&8!==b.childNodes[c].nodeType){var g=jsPlumb.getElement(b.childNodes[c]),k=a.getId(b.childNodes[c],null,!0);if(k&&e[k]&&e[k]>0){var l=a.getOffset(g);d[h][k]={id:k,offset:{left:l.left-i.left,top:l.top-i.top}},f[k]=h}j(b.childNodes[c])}};j(g)},this.updateOffsets=function(b,c){if(null!=b){c=c||{};var e=jsPlumb.getElement(b),g=a.getId(e),h=d[g],i=a.getOffset(e);if(h)for(var j in h)if(h.hasOwnProperty(j)){var k=jsPlumb.getElement(j),l=c[j]||a.getOffset(k);if(null==k.offsetParent&&null!=d[g][j])continue;d[g][j]={id:j,offset:{left:l.left-i.left,top:l.top-i.top}},f[j]=g}}},this.endpointAdded=function(c,g){g=g||a.getId(c);var h=document.body,i=c.parentNode;for(e[g]=e[g]?e[g]+1:1;null!=i&&i!==h;){var j=a.getId(i,null,!0);if(j&&b[j]){var k=a.getOffset(i);if(null==d[j][g]){var l=a.getOffset(c);d[j][g]={id:g,offset:{left:l.left-k.left,top:l.top-k.top}},f[g]=j}break}i=i.parentNode}},this.endpointDeleted=function(a){if(e[a.elementId]&&(e[a.elementId]--,e[a.elementId]<=0))for(var b in d)d.hasOwnProperty(b)&&d[b]&&(delete d[b][a.elementId],delete f[a.elementId])},this.changeId=function(a,b){d[b]=d[a],d[a]={},f[b]=f[a],f[a]=null},this.getElementsForDraggable=function(a){return d[a]},this.elementRemoved=function(a){var b=f[a];b&&(delete d[b][a],delete f[a])},this.reset=function(){b={},c=[],d={},e={}},this.dragEnded=function(b){if(null!=b.offsetParent){var c=a.getId(b),d=f[c];d&&this.updateOffsets(d)}},this.setParent=function(b,c,e,g,h){var i=f[c];d[g]||(d[g]={});var j=a.getOffset(e),k=h||a.getOffset(b);i&&d[i]&&delete d[i][c],d[g][c]={id:c,offset:{left:k.left-j.left,top:k.top-j.top}},f[c]=g},this.clearParent=function(a,b){var c=f[b];c&&(delete d[c][b],delete f[b])},this.revalidateParent=function(b,c,d){var e=f[c];if(e){var g={};g[c]=d,this.updateOffsets(e,g),a.revalidate(e)}},this.getDragAncestor=function(b){var c=jsPlumb.getElement(b),d=a.getId(c),e=f[d];return e?jsPlumb.getElement(e):null}},j=function(a){return null==a?null:a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},k=function(a,b){b=j(b),"undefined"!=typeof a.className.baseVal?a.className.baseVal=b:a.className=b},l=function(a){return"undefined"==typeof a.className.baseVal?a.className:a.className.baseVal},m=function(a,c,d){c=null==c?[]:b.isArray(c)?c:c.split(/\s+/),d=null==d?[]:b.isArray(d)?d:d.split(/\s+/);var e=l(a),f=e.split(/\s+/),g=function(a,b){for(var c=0;c<b.length;c++)if(a)-1===f.indexOf(b[c])&&f.push(b[c]);else{var d=f.indexOf(b[c]);-1!==d&&f.splice(d,1)}};g(!0,c),g(!1,d),k(a,f.join(" "))};a.jsPlumb.extend(a.jsPlumbInstance.prototype,{headless:!1,pageLocation:d,screenLocation:e,clientLocation:f,getDragManager:function(){return null==this.dragManager&&(this.dragManager=new i(this)),this.dragManager},recalculateOffsets:function(a){this.getDragManager().updateOffsets(a)},createElement:function(a,b,c,d){return this.createElementNS(null,a,b,c,d)},createElementNS:function(a,b,c,d,e){var f,g=null==a?document.createElement(b):document.createElementNS(a,b);c=c||{};for(f in c)g.style[f]=c[f];d&&(g.className=d),e=e||{};for(f in e)g.setAttribute(f,""+e[f]);return g},getAttribute:function(a,b){return null!=a.getAttribute?a.getAttribute(b):null},setAttribute:function(a,b,c){null!=a.setAttribute&&a.setAttribute(b,c)},setAttributes:function(a,b){for(var c in b)b.hasOwnProperty(c)&&a.setAttribute(c,b[c])},appendToRoot:function(a){document.body.appendChild(a)},getRenderModes:function(){return["svg"]},getClass:l,addClass:function(a,b){jsPlumb.each(a,function(a){m(a,b)})},hasClass:function(a,b){return a=jsPlumb.getElement(a),a.classList?a.classList.contains(b):-1!==l(a).indexOf(b)},removeClass:function(a,b){jsPlumb.each(a,function(a){m(a,null,b)})},updateClasses:function(a,b,c){jsPlumb.each(a,function(a){m(a,b,c)})},setClass:function(a,b){jsPlumb.each(a,function(a){k(a,b)})},setPosition:function(a,b){a.style.left=b.left+"px",a.style.top=b.top+"px"},getPosition:function(a){var b=function(b){var c=a.style[b];return c?c.substring(0,c.length-2):0};return{left:b("left"),top:b("top")}},getStyle:function(a,b){return"undefined"!=typeof window.getComputedStyle?getComputedStyle(a,null).getPropertyValue(b):a.currentStyle[b]},getSelector:function(a,b){var c=null;return c=1===arguments.length?null!=a.nodeType?a:document.querySelectorAll(a):a.querySelectorAll(b)},getOffset:function(a,b,c){a=jsPlumb.getElement(a),c=c||this.getContainer();for(var d={left:a.offsetLeft,top:a.offsetTop},e=b||null!=c&&a!==c&&a.offsetParent!==c?a.offsetParent:null,f=function(a){null!=a&&a!==document.body&&(a.scrollTop>0||a.scrollLeft>0)&&(d.left-=a.scrollLeft,d.top-=a.scrollTop)}.bind(this);null!=e;)d.left+=e.offsetLeft,d.top+=e.offsetTop,f(e),e=b?e.offsetParent:e.offsetParent===c?null:e.offsetParent;if(null!=c&&!b&&(c.scrollTop>0||c.scrollLeft>0)){var g=null!=a.offsetParent?this.getStyle(a.offsetParent,"position"):"static",h=this.getStyle(a,"position");"absolute"!==h&&"fixed"!==h&&"absolute"!==g&&"fixed"!==g&&(d.left-=c.scrollLeft,d.top-=c.scrollTop)}return d},getPositionOnElement:function(a,b,c){var d="undefined"!=typeof b.getBoundingClientRect?b.getBoundingClientRect():{left:0,top:0,width:0,height:0},e=document.body,f=document.documentElement,g=window.pageYOffset||f.scrollTop||e.scrollTop,h=window.pageXOffset||f.scrollLeft||e.scrollLeft,i=f.clientTop||e.clientTop||0,j=f.clientLeft||e.clientLeft||0,k=0,l=0,m=d.top+g-i+k*c,n=d.left+h-j+l*c,o=jsPlumb.pageLocation(a),p=d.width||b.offsetWidth*c,q=d.height||b.offsetHeight*c,r=(o[0]-n)/p,s=(o[1]-m)/q;return[r,s]},getAbsolutePosition:function(a){var b=function(b){var c=a.style[b];return c?parseFloat(c.substring(0,c.length-2)):void 0};return[b("left"),b("top")]},setAbsolutePosition:function(a,b,c,d){c?this.animate(a,{left:"+="+(b[0]-c[0]),top:"+="+(b[1]-c[1])},d):(a.style.left=b[0]+"px",a.style.top=b[1]+"px")},getSize:function(a){return[a.offsetWidth,a.offsetHeight]},getWidth:function(a){return a.offsetWidth},getHeight:function(a){return a.offsetHeight},getRenderMode:function(){return"svg"}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d="__label",e=function(a,c){var e={cssClass:c.cssClass,labelStyle:a.labelStyle,id:d,component:a,_jsPlumb:a._jsPlumb.instance},f=b.extend(e,c);return new(b.Overlays[a._jsPlumb.instance.getRenderMode()].Label)(f)},f=function(a,d){var e=null;if(c.isArray(d)){var f=d[0],g=b.extend({component:a,_jsPlumb:a._jsPlumb.instance},d[1]);3===d.length&&b.extend(g,d[2]),e=new(b.Overlays[a._jsPlumb.instance.getRenderMode()][f])(g)}else e=d.constructor===String?new(b.Overlays[a._jsPlumb.instance.getRenderMode()][d])({component:a,_jsPlumb:a._jsPlumb.instance}):d;return e.id=e.id||c.uuid(),a.cacheTypeItem("overlay",e,e.id),a._jsPlumb.overlays[e.id]=e,e};b.OverlayCapableJsPlumbUIComponent=function(b){a.jsPlumbUIComponent.apply(this,arguments),this._jsPlumb.overlays={},this._jsPlumb.overlayPositions={},b.label&&(this.getDefaultType().overlays[d]=["Label",{label:b.label,location:b.labelLocation||this.defaultLabelLocation||.5,labelStyle:b.labelStyle||this._jsPlumb.instance.Defaults.LabelStyle,id:d}]),this.setListenerComponent=function(a){if(this._jsPlumb)for(var b in this._jsPlumb.overlays)this._jsPlumb.overlays[b].setListenerComponent(a)}},b.OverlayCapableJsPlumbUIComponent.applyType=function(a,b){if(b.overlays){var c,d={};for(c in b.overlays){var e=a._jsPlumb.overlays[b.overlays[c][1].id];if(e)e.updateFrom(b.overlays[c][1]),d[b.overlays[c][1].id]=!0;else{var f=a.getCachedTypeItem("overlay",b.overlays[c][1].id);null!=f?(f.reattach(a._jsPlumb.instance,a),f.setVisible(!0),f.updateFrom(b.overlays[c][1]),a._jsPlumb.overlays[f.id]=f):f=a.addOverlay(b.overlays[c],!0),d[f.id]=!0}}for(c in a._jsPlumb.overlays)null==d[a._jsPlumb.overlays[c].id]&&a.removeOverlay(a._jsPlumb.overlays[c].id,!0)}},c.extend(b.OverlayCapableJsPlumbUIComponent,a.jsPlumbUIComponent,{setHover:function(a){if(this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged())for(var b in this._jsPlumb.overlays)this._jsPlumb.overlays[b][a?"addClass":"removeClass"](this._jsPlumb.instance.hoverClass)},addOverlay:function(a,b){var c=f(this,a);return b||this.repaint(),c},getOverlay:function(a){return this._jsPlumb.overlays[a]},getOverlays:function(){return this._jsPlumb.overlays},hideOverlay:function(a){var b=this.getOverlay(a);b&&b.hide()},hideOverlays:function(){for(var a in this._jsPlumb.overlays)this._jsPlumb.overlays[a].hide()},showOverlay:function(a){var b=this.getOverlay(a);b&&b.show()},showOverlays:function(){for(var a in this._jsPlumb.overlays)this._jsPlumb.overlays[a].show()},removeAllOverlays:function(a){for(var b in this._jsPlumb.overlays)this._jsPlumb.overlays[b].cleanup&&this._jsPlumb.overlays[b].cleanup();this._jsPlumb.overlays={},this._jsPlumb.overlayPositions=null,a||this.repaint()},removeOverlay:function(a,b){var c=this._jsPlumb.overlays[a];c&&(c.setVisible(!1),!b&&c.cleanup&&c.cleanup(),delete this._jsPlumb.overlays[a],this._jsPlumb.overlayPositions&&delete this._jsPlumb.overlayPositions[a])},removeOverlays:function(){for(var a=0,b=arguments.length;b>a;a++)this.removeOverlay(arguments[a])},moveParent:function(a){if(this.bgCanvas&&(this.bgCanvas.parentNode.removeChild(this.bgCanvas),a.appendChild(this.bgCanvas)),this.canvas&&this.canvas.parentNode){this.canvas.parentNode.removeChild(this.canvas),a.appendChild(this.canvas);for(var b in this._jsPlumb.overlays)if(this._jsPlumb.overlays[b].isAppendedAtTopLevel){var c=this._jsPlumb.overlays[b].getElement();c.parentNode.removeChild(c),a.appendChild(c)}}},getLabel:function(){var a=this.getOverlay(d);return null!=a?a.getLabel():null},getLabelOverlay:function(){return this.getOverlay(d)},setLabel:function(a){var b=this.getOverlay(d);if(b)a.constructor===String||a.constructor===Function?b.setLabel(a):(a.label&&b.setLabel(a.label),a.location&&b.setLocation(a.location));else{var c=a.constructor===String||a.constructor===Function?{label:a}:a;b=e(this,c),this._jsPlumb.overlays[d]=b}this._jsPlumb.instance.isSuspendDrawing()||this.repaint()},cleanup:function(a){for(var b in this._jsPlumb.overlays)this._jsPlumb.overlays[b].cleanup(a),this._jsPlumb.overlays[b].destroy(a);a&&(this._jsPlumb.overlays={},this._jsPlumb.overlayPositions=null)},setVisible:function(a){this[a?"showOverlays":"hideOverlays"]()},setAbsoluteOverlayPosition:function(a,b){this._jsPlumb.overlayPositions[a.id]=b},getAbsoluteOverlayPosition:function(a){return this._jsPlumb.overlayPositions?this._jsPlumb.overlayPositions[a.id]:null},_clazzManip:function(a,b,c){if(!c)for(var d in this._jsPlumb.overlays)this._jsPlumb.overlays[d][a+"Class"](b)},addClass:function(a,b){this._clazzManip("add",a,b)},removeClass:function(a,b){this._clazzManip("remove",a,b)}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=function(a,b,c){var d=!1;return{drag:function(){if(d)return d=!1,!0;if(b.element){var e=c.getUIPosition(arguments,c.getZoom());null!=e&&c.setPosition(b.element,e),c.repaint(b.element,e),a.paint({anchorPoint:a.anchor.getCurrentLocation({element:a})})}},stopDrag:function(){d=!0}}},e=function(a,b,c,d){var e=b.createElement("div",{position:"absolute"});b.appendElement(e);var f=b.getId(e);b.setPosition(e,c),e.style.width=d[0]+"px",e.style.height=d[1]+"px",b.manage(f,e,!0),a.id=f,a.element=e},f=function(a,c,d,e,f,g,h,i){var j=new b.FloatingAnchor({reference:c,referenceCanvas:e,jsPlumbInstance:g});return h({paintStyle:a,endpoint:d,anchor:j,source:f,scope:i})},g=["connectorStyle","connectorHoverStyle","connectorOverlays","connector","connectionType","connectorClass","connectorHoverClass"],h=function(a,b){var c=0;if(null!=b)for(var d=0;d<a.connections.length;d++)if(a.connections[d].sourceId===b||a.connections[d].targetId===b){c=d;break}return a.connections[c]};b.Endpoint=function(a){var i=a._jsPlumb,j=a.newConnection,k=a.newEndpoint;this.idPrefix="_jsplumb_e_",this.defaultLabelLocation=[.5,.5],this.defaultOverlayKeys=["Overlays","EndpointOverlays"],b.OverlayCapableJsPlumbUIComponent.apply(this,arguments),this.appendToDefaultType({connectionType:a.connectionType,maxConnections:null==a.maxConnections?this._jsPlumb.instance.Defaults.MaxConnections:a.maxConnections,paintStyle:a.endpointStyle||a.paintStyle||a.style||this._jsPlumb.instance.Defaults.EndpointStyle||b.Defaults.EndpointStyle,hoverPaintStyle:a.endpointHoverStyle||a.hoverPaintStyle||this._jsPlumb.instance.Defaults.EndpointHoverStyle||b.Defaults.EndpointHoverStyle,connectorStyle:a.connectorStyle,connectorHoverStyle:a.connectorHoverStyle,connectorClass:a.connectorClass,connectorHoverClass:a.connectorHoverClass,connectorOverlays:a.connectorOverlays,connector:a.connector,connectorTooltip:a.connectorTooltip}),this._jsPlumb.enabled=!(a.enabled===!1),this._jsPlumb.visible=!0,this.element=b.getElement(a.source),this._jsPlumb.uuid=a.uuid,this._jsPlumb.floatingEndpoint=null;var l=null;this._jsPlumb.uuid&&(a.endpointsByUUID[this._jsPlumb.uuid]=this),this.elementId=a.elementId,this.dragProxy=a.dragProxy,this._jsPlumb.connectionCost=a.connectionCost,this._jsPlumb.connectionsDirected=a.connectionsDirected,this._jsPlumb.currentAnchorClass="",this._jsPlumb.events={};var m=a.deleteOnEmpty===!0;this.setDeleteOnEmpty=function(a){m=a};var n=function(){var a=i.endpointAnchorClassPrefix+"-"+this._jsPlumb.currentAnchorClass;this._jsPlumb.currentAnchorClass=this.anchor.getCssClass();var c=i.endpointAnchorClassPrefix+(this._jsPlumb.currentAnchorClass?"-"+this._jsPlumb.currentAnchorClass:"");this.removeClass(a),this.addClass(c),b.updateClasses(this.element,c,a)}.bind(this);this.prepareAnchor=function(a){var b=this._jsPlumb.instance.makeAnchor(a,this.elementId,i);return b.bind("anchorChanged",function(a){this.fire("anchorChanged",{endpoint:this,anchor:a}),n()}.bind(this)),b},this.setPreparedAnchor=function(a,b){return this._jsPlumb.instance.continuousAnchorFactory.clear(this.elementId),this.anchor=a,n(),b||this._jsPlumb.instance.repaint(this.elementId),this},this.setAnchor=function(a,b){var c=this.prepareAnchor(a);return this.setPreparedAnchor(c,b),this};var o=function(a){if(this.connections.length>0)for(var b=0;b<this.connections.length;b++)this.connections[b].setHover(a,!1);else this.setHover(a)}.bind(this);this.bind("mouseover",function(){o(!0)}),this.bind("mouseout",function(){o(!1)}),a._transient||this._jsPlumb.instance.anchorManager.add(this,this.elementId),this.prepareEndpoint=function(d,e){var f,g=function(a,c){var d=i.getRenderMode();if(b.Endpoints[d][a])return new b.Endpoints[d][a](c);if(!i.Defaults.DoNotThrowErrors)throw{msg:"jsPlumb: unknown endpoint type '"+a+"'"}},h={_jsPlumb:this._jsPlumb.instance,cssClass:a.cssClass,container:a.container,tooltip:a.tooltip,connectorTooltip:a.connectorTooltip,endpoint:this};return c.isString(d)?f=g(d,h):c.isArray(d)?(h=c.merge(d[1],h),f=g(d[0],h)):f=d.clone(),f.clone=function(){return c.isString(d)?g(d,h):c.isArray(d)?(h=c.merge(d[1],h),g(d[0],h)):void 0
+}.bind(this),f.typeId=e,f},this.setEndpoint=function(a){var b=this.prepareEndpoint(a);this.setPreparedEndpoint(b,!0)},this.setPreparedEndpoint=function(a){null!=this.endpoint&&(this.endpoint.cleanup(),this.endpoint.destroy()),this.endpoint=a,this.type=this.endpoint.type,this.canvas=this.endpoint.canvas},b.extend(this,a,g),this.isSource=a.isSource||!1,this.isTemporarySource=a.isTemporarySource||!1,this.isTarget=a.isTarget||!1,this.connections=a.connections||[],this.connectorPointerEvents=a["connector-pointer-events"],this.scope=a.scope||i.getDefaultScope(),this.timestamp=null,this.reattachConnections=a.reattach||i.Defaults.ReattachConnections,this.connectionsDetachable=i.Defaults.ConnectionsDetachable,(a.connectionsDetachable===!1||a.detachable===!1)&&(this.connectionsDetachable=!1),this.dragAllowedWhenFull=a.dragAllowedWhenFull!==!1,a.onMaxConnections&&this.bind("maxConnections",a.onMaxConnections),this.addConnection=function(a){this.connections.push(a),this[(this.connections.length>0?"add":"remove")+"Class"](i.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](i.endpointFullClass)},this.detachFromConnection=function(a,b,c){b=null==b?this.connections.indexOf(a):b,b>=0&&(this.connections.splice(b,1),this[(this.connections.length>0?"add":"remove")+"Class"](i.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](i.endpointFullClass)),!c&&m&&0===this.connections.length&&i.deleteObject({endpoint:this,fireEvent:!1,deleteAttachedObjects:c!==!0})},this.deleteEveryConnection=function(a){for(var b=this.connections.length,c=0;b>c;c++)i.deleteConnection(this.connections[0],a)},this.detachFrom=function(a){for(var b=[],c=0;c<this.connections.length;c++)(this.connections[c].endpoints[1]===a||this.connections[c].endpoints[0]===a)&&b.push(this.connections[c]);for(var d=0,e=b.length;e>d;d++)i.deleteConnection(b[0]);return this},this.getElement=function(){return this.element},this.setElement=function(d){var e=this._jsPlumb.instance.getId(d),f=this.elementId;return c.removeWithFunction(a.endpointsByElement[this.elementId],function(a){return a.id===this.id}.bind(this)),this.element=b.getElement(d),this.elementId=i.getId(this.element),i.anchorManager.rehomeEndpoint(this,f,this.element),i.dragManager.endpointAdded(this.element),c.addToList(a.endpointsByElement,e,this),this},this.makeInPlaceCopy=function(){var b=this.anchor.getCurrentLocation({element:this}),c=this.anchor.getOrientation(this),d=this.anchor.getCssClass(),e={bind:function(){},compute:function(){return[b[0],b[1]]},getCurrentLocation:function(){return[b[0],b[1]]},getOrientation:function(){return c},getCssClass:function(){return d}};return k({dropOptions:a.dropOptions,anchor:e,source:this.element,paintStyle:this.getPaintStyle(),endpoint:a.hideOnDrag?"Blank":this.endpoint,_transient:!0,scope:this.scope,reference:this})},this.connectorSelector=function(){var a=this.connections[0];return a?a:this.connections.length<this._jsPlumb.maxConnections||-1===this._jsPlumb.maxConnections?null:a},this.setStyle=this.setPaintStyle,this.paint=function(a){a=a||{};var b=a.timestamp,c=!(a.recalc===!1);if(!b||this.timestamp!==b){var d=i.updateOffset({elId:this.elementId,timestamp:b}),e=a.offset?a.offset.o:d.o;if(null!=e){var f=a.anchorPoint,g=a.connectorPaintStyle;if(null==f){var j=a.dimensions||d.s,k={xy:[e.left,e.top],wh:j,element:this,timestamp:b};if(c&&this.anchor.isDynamic&&this.connections.length>0){var l=h(this,a.elementWithPrecedence),m=l.endpoints[0]===this?1:0,n=0===m?l.sourceId:l.targetId,o=i.getCachedData(n),p=o.o,q=o.s;k.txy=[p.left,p.top],k.twh=q,k.tElement=l.endpoints[m]}f=this.anchor.compute(k)}this.endpoint.compute(f,this.anchor.getOrientation(this),this._jsPlumb.paintStyleInUse,g||this.paintStyleInUse),this.endpoint.paint(this._jsPlumb.paintStyleInUse,this.anchor),this.timestamp=b;for(var r in this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(r)){var s=this._jsPlumb.overlays[r];s.isVisible()&&(this._jsPlumb.overlayPlacements[r]=s.draw(this.endpoint,this._jsPlumb.paintStyleInUse),s.paint(this._jsPlumb.overlayPlacements[r]))}}}},this.getTypeDescriptor=function(){return"endpoint"},this.isVisible=function(){return this._jsPlumb.visible},this.repaint=this.paint;var p=!1;this.initDraggable=function(){if(!p&&b.isDragSupported(this.element)){var g,h={id:null,element:null},m=null,n=!1,o=null,q=d(this,h,i),r=a.dragOptions||{},s={},t=b.dragEvents.start,u=b.dragEvents.stop,v=b.dragEvents.drag,w=b.dragEvents.beforeStart,x=function(a){g=a.e.payload||{}},y=function(){m=this.connectorSelector();var d=!0;this.isEnabled()||(d=!1),null!=m||this.isSource||this.isTemporarySource||(d=!1),!this.isSource||!this.isFull()||null!=m&&this.dragAllowedWhenFull||(d=!1),null==m||m.isDetachable(this)||(d=!1);var l=i.checkCondition(null==m?"beforeDrag":"beforeStartDetach",{endpoint:this,source:this.element,sourceId:this.elementId,connection:m});if(l===!1?d=!1:"object"==typeof l?b.extend(l,g||{}):l=g||{},d===!1)return i.stopDrag&&i.stopDrag(this.canvas),q.stopDrag(),!1;for(var p=0;p<this.connections.length;p++)this.connections[p].setHover(!1);this.addClass("endpointDrag"),i.setConnectionBeingDragged(!0),m&&!this.isFull()&&this.isSource&&(m=null),i.updateOffset({elId:this.elementId});var r=this._jsPlumb.instance.getOffset(this.canvas),s=this.canvas,t=this._jsPlumb.instance.getSize(this.canvas);e(h,i,r,t),i.setAttributes(this.canvas,{dragId:h.id,elId:this.elementId});var u=this.dragProxy||this.endpoint;if(null==this.dragProxy&&null!=this.connectionType){var v=this._jsPlumb.instance.deriveEndpointAndAnchorSpec(this.connectionType);v.endpoints[1]&&(u=v.endpoints[1])}var w=this._jsPlumb.instance.makeAnchor("Center");w.isFloating=!0,this._jsPlumb.floatingEndpoint=f(this.getPaintStyle(),w,u,this.canvas,h.element,i,k,this.scope);var x=this._jsPlumb.floatingEndpoint.anchor;if(null==m)this.setHover(!1,!1),m=j({sourceEndpoint:this,targetEndpoint:this._jsPlumb.floatingEndpoint,source:this.element,target:h.element,anchors:[this.anchor,this._jsPlumb.floatingEndpoint.anchor],paintStyle:a.connectorStyle,hoverPaintStyle:a.connectorHoverStyle,connector:a.connector,overlays:a.connectorOverlays,type:this.connectionType,cssClass:this.connectorClass,hoverClass:this.connectorHoverClass,scope:a.scope,data:l}),m.pending=!0,m.addClass(i.draggingClass),this._jsPlumb.floatingEndpoint.addClass(i.draggingClass),this._jsPlumb.floatingEndpoint.anchor=x,i.fire("connectionDrag",m),i.anchorManager.newConnection(m);else{n=!0,m.setHover(!1);var y=m.endpoints[0].id===this.id?0:1;this.detachFromConnection(m,null,!0);var z=i.getDragScope(s);i.setAttribute(this.canvas,"originalScope",z),i.fire("connectionDrag",m),0===y?(o=[m.source,m.sourceId,s,z],i.anchorManager.sourceChanged(m.endpoints[y].elementId,h.id,m,h.element)):(o=[m.target,m.targetId,s,z],m.target=h.element,m.targetId=h.id,i.anchorManager.updateOtherEndpoint(m.sourceId,m.endpoints[y].elementId,m.targetId,m)),m.suspendedEndpoint=m.endpoints[y],m.suspendedElement=m.endpoints[y].getElement(),m.suspendedElementId=m.endpoints[y].elementId,m.suspendedElementType=0===y?"source":"target",m.suspendedEndpoint.setHover(!1),this._jsPlumb.floatingEndpoint.referenceEndpoint=m.suspendedEndpoint,m.endpoints[y]=this._jsPlumb.floatingEndpoint,m.addClass(i.draggingClass),this._jsPlumb.floatingEndpoint.addClass(i.draggingClass)}i.floatingConnections[h.id]=m,c.addToList(a.endpointsByElement,h.id,this._jsPlumb.floatingEndpoint),i.currentlyDragging=!0}.bind(this),z=function(){if(i.setConnectionBeingDragged(!1),m&&null!=m.endpoints){var a=i.getDropEvent(arguments),b=i.getFloatingAnchorIndex(m);if(m.endpoints[0===b?1:0].anchor.locked=!1,m.removeClass(i.draggingClass),this._jsPlumb&&(m.deleteConnectionNow||m.endpoints[b]===this._jsPlumb.floatingEndpoint)&&n&&m.suspendedEndpoint){0===b?(m.floatingElement=m.source,m.floatingId=m.sourceId,m.floatingEndpoint=m.endpoints[0],m.floatingIndex=0,m.source=o[0],m.sourceId=o[1]):(m.floatingElement=m.target,m.floatingId=m.targetId,m.floatingEndpoint=m.endpoints[1],m.floatingIndex=1,m.target=o[0],m.targetId=o[1]);var c=this._jsPlumb.floatingEndpoint;i.setDragScope(o[2],o[3]),m.endpoints[b]=m.suspendedEndpoint,m.isReattach()||m._forceReattach||m._forceDetach||!i.deleteConnection(m)?(m.setHover(!1),m._forceDetach=null,m._forceReattach=null,this._jsPlumb.floatingEndpoint.detachFromConnection(m),m.suspendedEndpoint.addConnection(m),1===b?i.anchorManager.updateOtherEndpoint(m.sourceId,m.floatingId,m.targetId,m):i.anchorManager.sourceChanged(m.floatingId,m.sourceId,m,m.source),i.repaint(o[1])):i.deleteObject({endpoint:c})}this.deleteAfterDragStop?i.deleteObject({endpoint:this}):this._jsPlumb&&this.paint({recalc:!1}),i.fire("connectionDragStop",m,a),m.pending&&i.fire("connectionAborted",m,a),i.currentlyDragging=!1,m.suspendedElement=null,m.suspendedEndpoint=null,m=null}h&&h.element&&i.remove(h.element,!1,!1),l&&i.deleteObject({endpoint:l}),this._jsPlumb&&(this.canvas.style.visibility="visible",this.anchor.locked=!1,this._jsPlumb.floatingEndpoint=null)}.bind(this);r=b.extend(s,r),r.scope=this.scope||r.scope,r[w]=c.wrap(r[w],x,!1),r[t]=c.wrap(r[t],y,!1),r[v]=c.wrap(r[v],q.drag),r[u]=c.wrap(r[u],z),r.multipleDrop=!1,r.canDrag=function(){return this.isSource||this.isTemporarySource||this.connections.length>0}.bind(this),i.initDraggable(this.canvas,r,"internal"),this.canvas._jsPlumbRelatedElement=this.element,p=!0}};var q=a.endpoint||this._jsPlumb.instance.Defaults.Endpoint||b.Defaults.Endpoint;this.setEndpoint(q,!0);var r=a.anchor?a.anchor:a.anchors?a.anchors:i.Defaults.Anchor||"Top";this.setAnchor(r,!0);var s=["default",a.type||""].join(" ");this.addType(s,a.data,!0),this.canvas=this.endpoint.canvas,this.canvas._jsPlumb=this,this.initDraggable();var t=function(d,e,f,g){if(b.isDropSupported(this.element)){var h=a.dropOptions||i.Defaults.DropOptions||b.Defaults.DropOptions;h=b.extend({},h),h.scope=h.scope||this.scope;var j=b.dragEvents.drop,k=b.dragEvents.over,l=b.dragEvents.out,m=this,n=i.EndpointDropHandler({getEndpoint:function(){return m},jsPlumb:i,enabled:function(){return null!=f?f.isEnabled():!0},isFull:function(){return f.isFull()},element:this.element,elementId:this.elementId,isSource:this.isSource,isTarget:this.isTarget,addClass:function(a){m.addClass(a)},removeClass:function(a){m.removeClass(a)},isDropAllowed:function(){return m.isDropAllowed.apply(m,arguments)},reference:g,isRedrop:function(a,b){return a.suspendedEndpoint&&b.reference&&a.suspendedEndpoint.id===b.reference.id}});h[j]=c.wrap(h[j],n,!0),h[k]=c.wrap(h[k],function(){var a=b.getDragObject(arguments),c=i.getAttribute(b.getElement(a),"dragId"),d=i.floatingConnections[c];if(null!=d){var e=i.getFloatingAnchorIndex(d),f=this.isTarget&&0!==e||d.suspendedEndpoint&&this.referenceEndpoint&&this.referenceEndpoint.id===d.suspendedEndpoint.id;if(f){var g=i.checkCondition("checkDropAllowed",{sourceEndpoint:d.endpoints[e],targetEndpoint:this,connection:d});this[(g?"add":"remove")+"Class"](i.endpointDropAllowedClass),this[(g?"remove":"add")+"Class"](i.endpointDropForbiddenClass),d.endpoints[e].anchor.over(this.anchor,this)}}}.bind(this)),h[l]=c.wrap(h[l],function(){var a=b.getDragObject(arguments),c=null==a?null:i.getAttribute(b.getElement(a),"dragId"),d=c?i.floatingConnections[c]:null;if(null!=d){var e=i.getFloatingAnchorIndex(d),f=this.isTarget&&0!==e||d.suspendedEndpoint&&this.referenceEndpoint&&this.referenceEndpoint.id===d.suspendedEndpoint.id;f&&(this.removeClass(i.endpointDropAllowedClass),this.removeClass(i.endpointDropForbiddenClass),d.endpoints[e].anchor.out())}}.bind(this)),i.initDroppable(d,h,"internal",e)}}.bind(this);return this.anchor.isFloating||t(this.canvas,!(a._transient||this.anchor.isFloating),this,a.reference),this},c.extend(b.Endpoint,b.OverlayCapableJsPlumbUIComponent,{setVisible:function(a,b,c){if(this._jsPlumb.visible=a,this.canvas&&(this.canvas.style.display=a?"block":"none"),this[a?"showOverlays":"hideOverlays"](),!b)for(var d=0;d<this.connections.length;d++)if(this.connections[d].setVisible(a),!c){var e=this===this.connections[d].endpoints[0]?1:0;1===this.connections[d].endpoints[e].connections.length&&this.connections[d].endpoints[e].setVisible(a,!0,!0)}},getAttachedElements:function(){return this.connections},applyType:function(a,c){this.setPaintStyle(a.endpointStyle||a.paintStyle,c),this.setHoverPaintStyle(a.endpointHoverStyle||a.hoverPaintStyle,c),null!=a.maxConnections&&(this._jsPlumb.maxConnections=a.maxConnections),a.scope&&(this.scope=a.scope),b.extend(this,a,g),null!=a.cssClass&&this.canvas&&this._jsPlumb.instance.addClass(this.canvas,a.cssClass),b.OverlayCapableJsPlumbUIComponent.applyType(this,a)},isEnabled:function(){return this._jsPlumb.enabled},setEnabled:function(a){this._jsPlumb.enabled=a},cleanup:function(){var a=this._jsPlumb.instance.endpointAnchorClassPrefix+(this._jsPlumb.currentAnchorClass?"-"+this._jsPlumb.currentAnchorClass:"");b.removeClass(this.element,a),this.anchor=null,this.endpoint.cleanup(!0),this.endpoint.destroy(),this.endpoint=null,this._jsPlumb.instance.destroyDraggable(this.canvas,"internal"),this._jsPlumb.instance.destroyDroppable(this.canvas,"internal")},setHover:function(a){this.endpoint&&this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged()&&this.endpoint.setHover(a)},isFull:function(){return 0===this._jsPlumb.maxConnections?!0:!(this.isFloating()||this._jsPlumb.maxConnections<0||this.connections.length<this._jsPlumb.maxConnections)},isFloating:function(){return null!=this.anchor&&this.anchor.isFloating},isConnectedTo:function(a){var b=!1;if(a)for(var c=0;c<this.connections.length;c++)if(this.connections[c].endpoints[1]===a||this.connections[c].endpoints[0]===a){b=!0;break}return b},getConnectionCost:function(){return this._jsPlumb.connectionCost},setConnectionCost:function(a){this._jsPlumb.connectionCost=a},areConnectionsDirected:function(){return this._jsPlumb.connectionsDirected},setConnectionsDirected:function(a){this._jsPlumb.connectionsDirected=a},setElementId:function(a){this.elementId=a,this.anchor.elementId=a},setReferenceElement:function(a){this.element=b.getElement(a)},setDragAllowedWhenFull:function(a){this.dragAllowedWhenFull=a},equals:function(a){return this.anchor.equals(a.anchor)},getUuid:function(){return this._jsPlumb.uuid},computeAnchor:function(a){return this.anchor.compute(a)}}),a.jsPlumbInstance.prototype.EndpointDropHandler=function(a){return function(b){var d=a.jsPlumb;a.removeClass(d.endpointDropAllowedClass),a.removeClass(d.endpointDropForbiddenClass);var e=d.getDropEvent(arguments),f=d.getDragObject(arguments),g=d.getAttribute(f,"dragId"),h=(d.getAttribute(f,"elId"),d.getAttribute(f,"originalScope")),i=d.floatingConnections[g];if(null!=i){var j=null!=i.suspendedEndpoint;if(!j||null!=i.suspendedEndpoint._jsPlumb){var k=a.getEndpoint(i);if(null!=k){if(a.isRedrop(i,a))return i._forceReattach=!0,i.setHover(!1),a.maybeCleanup&&a.maybeCleanup(k),void 0;var l=d.getFloatingAnchorIndex(i);if(0===l&&!a.isSource||1===l&&!a.isTarget)return a.maybeCleanup&&a.maybeCleanup(k),void 0;a.onDrop&&a.onDrop(i),h&&d.setDragScope(f,h);var m=a.isFull(b);if(m&&k.fire("maxConnections",{endpoint:this,connection:i,maxConnections:k._jsPlumb.maxConnections},e),!m&&a.enabled()){var n=!0;0===l?(i.floatingElement=i.source,i.floatingId=i.sourceId,i.floatingEndpoint=i.endpoints[0],i.floatingIndex=0,i.source=a.element,i.sourceId=a.elementId):(i.floatingElement=i.target,i.floatingId=i.targetId,i.floatingEndpoint=i.endpoints[1],i.floatingIndex=1,i.target=a.element,i.targetId=a.elementId),j&&i.suspendedEndpoint.id!==k.id&&(i.isDetachAllowed(i)&&i.endpoints[l].isDetachAllowed(i)&&i.suspendedEndpoint.isDetachAllowed(i)&&d.checkCondition("beforeDetach",i)||(n=!1));var o=function(b){i.endpoints[l].detachFromConnection(i),i.suspendedEndpoint&&i.suspendedEndpoint.detachFromConnection(i),i.endpoints[l]=k,k.addConnection(i);var f=k.getParameters();for(var g in f)i.setParameter(g,f[g]);if(j){var h=i.suspendedEndpoint.elementId;d.fireMoveEvent({index:l,originalSourceId:0===l?h:i.sourceId,newSourceId:0===l?k.elementId:i.sourceId,originalTargetId:1===l?h:i.targetId,newTargetId:1===l?k.elementId:i.targetId,originalSourceEndpoint:0===l?i.suspendedEndpoint:i.endpoints[0],newSourceEndpoint:0===l?k:i.endpoints[0],originalTargetEndpoint:1===l?i.suspendedEndpoint:i.endpoints[1],newTargetEndpoint:1===l?k:i.endpoints[1],connection:i},e)}else f.draggable&&d.initDraggable(this.element,a.dragOptions,"internal",d);if(1===l?d.anchorManager.updateOtherEndpoint(i.sourceId,i.floatingId,i.targetId,i):d.anchorManager.sourceChanged(i.floatingId,i.sourceId,i,i.source),i.endpoints[0].finalEndpoint){var m=i.endpoints[0];m.detachFromConnection(i),i.endpoints[0]=i.endpoints[0].finalEndpoint,i.endpoints[0].addConnection(i)}c.isObject(b)&&i.mergeData(b),d.finaliseConnection(i,null,e,!1),i.setHover(!1)}.bind(this),p=function(){i.suspendedEndpoint&&(i.endpoints[l]=i.suspendedEndpoint,i.setHover(!1),i._forceDetach=!0,0===l?(i.source=i.suspendedEndpoint.element,i.sourceId=i.suspendedEndpoint.elementId):(i.target=i.suspendedEndpoint.element,i.targetId=i.suspendedEndpoint.elementId),i.suspendedEndpoint.addConnection(i),1===l?d.anchorManager.updateOtherEndpoint(i.sourceId,i.floatingId,i.targetId,i):d.anchorManager.sourceChanged(i.floatingId,i.sourceId,i,i.source),d.repaint(i.sourceId),i._forceDetach=!1)};if(n=n&&a.isDropAllowed(i.sourceId,i.targetId,i.scope,i,k))return o(n),!0;p()}a.maybeCleanup&&a.maybeCleanup(k),d.currentlyDragging=!1}}}}}}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=function(a,c,d,e,f){if(!a.Defaults.DoNotThrowErrors&&null==b.Connectors[c][d])throw{msg:"jsPlumb: unknown connector type '"+d+"'"};return new b.Connectors[c][d](e,f)},e=function(a,b,c){return a?c.makeAnchor(a,b,c):null},f=function(a,b,d,e){null!=b&&(b._jsPlumbConnections=b._jsPlumbConnections||{},e?delete b._jsPlumbConnections[a.id]:b._jsPlumbConnections[a.id]=!0,c.isEmpty(b._jsPlumbConnections)?d.removeClass(b,d.connectedClass):d.addClass(b,d.connectedClass))};b.Connection=function(a){var d=a.newEndpoint;this.id=a.id,this.connector=null,this.idPrefix="_jsplumb_c_",this.defaultLabelLocation=.5,this.defaultOverlayKeys=["Overlays","ConnectionOverlays"],this.previousConnection=a.previousConnection,this.source=b.getElement(a.source),this.target=b.getElement(a.target),a.sourceEndpoint&&(this.source=a.sourceEndpoint.getElement()),a.targetEndpoint&&(this.target=a.targetEndpoint.getElement()),b.OverlayCapableJsPlumbUIComponent.apply(this,arguments),this.sourceId=this._jsPlumb.instance.getId(this.source),this.targetId=this._jsPlumb.instance.getId(this.target),this.scope=a.scope,this.endpoints=[],this.endpointStyles=[];var e=this._jsPlumb.instance;e.manage(this.sourceId,this.source),e.manage(this.targetId,this.target),this._jsPlumb.visible=!0,this._jsPlumb.editable=a.editable===!0,this._jsPlumb.params={cssClass:a.cssClass,container:a.container,"pointer-events":a["pointer-events"],editorParams:a.editorParams,overlays:a.overlays},this._jsPlumb.lastPaintedAt=null,this.bind("mouseover",function(){this.setHover(!0)}.bind(this)),this.bind("mouseout",function(){this.setHover(!1)}.bind(this)),this.editableRequested=a.editable!==!1,this.setEditable=function(a){return this.connector?this.connector.setEditable(a):!1},this.isEditable=function(){return this.connector?this.connector.isEditable():!1},this.isEditing=function(){return this.connector?this.connector.isEditing():!1},this.makeEndpoint=function(b,c,f,g){return f=f||this._jsPlumb.instance.getId(c),this.prepareEndpoint(e,d,this,g,b?0:1,a,c,f)},a.type&&(a.endpoints=a.endpoints||this._jsPlumb.instance.deriveEndpointAndAnchorSpec(a.type).endpoints);var f=this.makeEndpoint(!0,this.source,this.sourceId,a.sourceEndpoint),g=this.makeEndpoint(!1,this.target,this.targetId,a.targetEndpoint);f&&c.addToList(a.endpointsByElement,this.sourceId,f),g&&c.addToList(a.endpointsByElement,this.targetId,g),this.scope||(this.scope=this.endpoints[0].scope),null!=a.deleteEndpointsOnEmpty&&(this.endpoints[0].setDeleteOnEmpty(a.deleteEndpointsOnEmpty),this.endpoints[1].setDeleteOnEmpty(a.deleteEndpointsOnEmpty));var h=e.Defaults.ConnectionsDetachable;a.detachable===!1&&(h=!1),this.endpoints[0].connectionsDetachable===!1&&(h=!1),this.endpoints[1].connectionsDetachable===!1&&(h=!1);var i=a.reattach||this.endpoints[0].reattachConnections||this.endpoints[1].reattachConnections||e.Defaults.ReattachConnections;this.appendToDefaultType({detachable:h,reattach:i,paintStyle:this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||a.paintStyle||e.Defaults.PaintStyle||b.Defaults.PaintStyle,hoverPaintStyle:this.endpoints[0].connectorHoverStyle||this.endpoints[1].connectorHoverStyle||a.hoverPaintStyle||e.Defaults.HoverPaintStyle||b.Defaults.HoverPaintStyle});var j=e.getSuspendedAt();if(!e.isSuspendDrawing()){var k=e.getCachedData(this.sourceId),l=k.o,m=k.s,n=e.getCachedData(this.targetId),o=n.o,p=n.s,q=j||e.timestamp(),r=this.endpoints[0].anchor.compute({xy:[l.left,l.top],wh:m,element:this.endpoints[0],elementId:this.endpoints[0].elementId,txy:[o.left,o.top],twh:p,tElement:this.endpoints[1],timestamp:q});this.endpoints[0].paint({anchorLoc:r,timestamp:q}),r=this.endpoints[1].anchor.compute({xy:[o.left,o.top],wh:p,element:this.endpoints[1],elementId:this.endpoints[1].elementId,txy:[l.left,l.top],twh:m,tElement:this.endpoints[0],timestamp:q}),this.endpoints[1].paint({anchorLoc:r,timestamp:q})}this.getTypeDescriptor=function(){return"connection"},this.getAttachedElements=function(){return this.endpoints},this.isDetachable=function(){return this._jsPlumb.detachable===!0},this.setDetachable=function(a){this._jsPlumb.detachable=a===!0},this.isReattach=function(){return this._jsPlumb.reattach===!0||this.endpoints[0].reattachConnections===!0||this.endpoints[1].reattachConnections===!0},this.setReattach=function(a){this._jsPlumb.reattach=a===!0},this._jsPlumb.cost=a.cost||this.endpoints[0].getConnectionCost(),this._jsPlumb.directed=a.directed,null==a.directed&&(this._jsPlumb.directed=this.endpoints[0].areConnectionsDirected());var s=b.extend({},this.endpoints[1].getParameters());b.extend(s,this.endpoints[0].getParameters()),b.extend(s,this.getParameters()),this.setParameters(s),this.setConnector(this.endpoints[0].connector||this.endpoints[1].connector||a.connector||e.Defaults.Connector||b.Defaults.Connector,!0),a.geometry&&this.connector.setGeometry(a.geometry);var t=null!=a.data&&c.isObject(a.data)?a.data:{};this.getData=function(){return t},this.setData=function(a){t=a||{}},this.mergeData=function(a){t=b.extend(t,a)};var u=["default",this.endpoints[0].connectionType,this.endpoints[1].connectionType,a.type].join(" ");/[^\s]/.test(u)&&this.addType(u,a.data,!0),this.updateConnectedClass()},c.extend(b.Connection,b.OverlayCapableJsPlumbUIComponent,{applyType:function(a,c,d){null!=a.detachable&&this.setDetachable(a.detachable),null!=a.reattach&&this.setReattach(a.reattach),a.scope&&(this.scope=a.scope),null!=a.cssClass&&this.canvas&&this._jsPlumb.instance.addClass(this.canvas,a.cssClass);var e=null;a.anchor?(e=this.getCachedTypeItem("anchors",d.anchor),null==e&&(e=[this._jsPlumb.instance.makeAnchor(a.anchor),this._jsPlumb.instance.makeAnchor(a.anchor)],this.cacheTypeItem("anchors",e,d.anchor))):a.anchors&&(e=this.getCachedTypeItem("anchors",d.anchors),null==e&&(e=[this._jsPlumb.instance.makeAnchor(a.anchors[0]),this._jsPlumb.instance.makeAnchor(a.anchors[1])],this.cacheTypeItem("anchors",e,d.anchors))),null!=e&&(this.endpoints[0].anchor=e[0],this.endpoints[1].anchor=e[1],this.endpoints[1].anchor.isDynamic&&this._jsPlumb.instance.repaint(this.endpoints[1].elementId)),b.OverlayCapableJsPlumbUIComponent.applyType(this,a)},addClass:function(a,b){b&&(this.endpoints[0].addClass(a),this.endpoints[1].addClass(a),this.suspendedEndpoint&&this.suspendedEndpoint.addClass(a)),this.connector&&this.connector.addClass(a)},removeClass:function(a,b){b&&(this.endpoints[0].removeClass(a),this.endpoints[1].removeClass(a),this.suspendedEndpoint&&this.suspendedEndpoint.removeClass(a)),this.connector&&this.connector.removeClass(a)},isVisible:function(){return this._jsPlumb.visible},setVisible:function(a){this._jsPlumb.visible=a,this.connector&&this.connector.setVisible(a),this.repaint()},cleanup:function(){this.updateConnectedClass(!0),this.endpoints=null,this.source=null,this.target=null,null!=this.connector&&(this.connector.cleanup(!0),this.connector.destroy(!0)),this.connector=null},updateConnectedClass:function(a){this._jsPlumb&&(f(this,this.source,this._jsPlumb.instance,a),f(this,this.target,this._jsPlumb.instance,a))},setHover:function(b){this.connector&&this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged()&&(this.connector.setHover(b),a.jsPlumb[b?"addClass":"removeClass"](this.source,this._jsPlumb.instance.hoverSourceClass),a.jsPlumb[b?"addClass":"removeClass"](this.target,this._jsPlumb.instance.hoverTargetClass))},getUuids:function(){return[this.endpoints[0].getUuid(),this.endpoints[1].getUuid()]},getCost:function(){return this._jsPlumb?this._jsPlumb.cost:-1/0},setCost:function(a){this._jsPlumb.cost=a},isDirected:function(){return this._jsPlumb.directed===!0},getConnector:function(){return this.connector},getGeometry:function(){return this.connector?this.connector.getGeometry():null},setGeometry:function(a){this.connector&&this.connector.setGeometry(a)},prepareConnector:function(a,b){var e,f={_jsPlumb:this._jsPlumb.instance,cssClass:(this._jsPlumb.params.cssClass||"")+(this.isEditable()?this._jsPlumb.instance.editableConnectorClass:""),container:this._jsPlumb.params.container,"pointer-events":this._jsPlumb.params["pointer-events"],editable:this.editableRequested},g=this._jsPlumb.instance.getRenderMode();return c.isString(a)?e=d(this._jsPlumb.instance,g,a,f,this):c.isArray(a)&&(e=1===a.length?d(this._jsPlumb.instance,g,a[0],f,this):d(this._jsPlumb.instance,g,a[0],c.merge(a[1],f),this)),null!=b&&(e.typeId=b),e},setPreparedConnector:function(a,b,c,d){var e,f="";if(null!=this.connector&&(e=this.connector,f=e.getClass(),this.connector.cleanup(),this.connector.destroy()),this.connector=a,d&&this.cacheTypeItem("connector",a,d),this.canvas=this.connector.canvas,this.bgCanvas=this.connector.bgCanvas,this.addClass(f),this.canvas&&(this.canvas._jsPlumb=this),this.bgCanvas&&(this.bgCanvas._jsPlumb=this),null!=e)for(var g=this.getOverlays(),h=0;h<g.length;h++)g[h].transfer&&g[h].transfer(this.connector);c||this.setListenerComponent(this.connector),b||this.repaint()},setConnector:function(a,b,c,d){var e=this.prepareConnector(a,d);this.setPreparedConnector(e,b,c,d)},paint:function(a){if(!this._jsPlumb.instance.isSuspendDrawing()&&this._jsPlumb.visible){a=a||{};var b=a.timestamp,c=!1,d=c?this.sourceId:this.targetId,e=c?this.targetId:this.sourceId,f=c?0:1,g=c?1:0;if(null==b||b!==this._jsPlumb.lastPaintedAt){var h=this._jsPlumb.instance.updateOffset({elId:e}).o,i=this._jsPlumb.instance.updateOffset({elId:d}).o,j=this.endpoints[g],k=this.endpoints[f],l=j.anchor.getCurrentLocation({xy:[h.left,h.top],wh:[h.width,h.height],element:j,timestamp:b}),m=k.anchor.getCurrentLocation({xy:[i.left,i.top],wh:[i.width,i.height],element:k,timestamp:b});this.connector.resetBounds(),this.connector.compute({sourcePos:l,targetPos:m,sourceEndpoint:this.endpoints[g],targetEndpoint:this.endpoints[f],"stroke-width":this._jsPlumb.paintStyleInUse.strokeWidth,sourceInfo:h,targetInfo:i});var n={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(var o in this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(o)){var p=this._jsPlumb.overlays[o];p.isVisible()&&(this._jsPlumb.overlayPlacements[o]=p.draw(this.connector,this._jsPlumb.paintStyleInUse,this.getAbsoluteOverlayPosition(p)),n.minX=Math.min(n.minX,this._jsPlumb.overlayPlacements[o].minX),n.maxX=Math.max(n.maxX,this._jsPlumb.overlayPlacements[o].maxX),n.minY=Math.min(n.minY,this._jsPlumb.overlayPlacements[o].minY),n.maxY=Math.max(n.maxY,this._jsPlumb.overlayPlacements[o].maxY))}var q=parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth||1)/2,r=parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth||0),s={xmin:Math.min(this.connector.bounds.minX-(q+r),n.minX),ymin:Math.min(this.connector.bounds.minY-(q+r),n.minY),xmax:Math.max(this.connector.bounds.maxX+(q+r),n.maxX),ymax:Math.max(this.connector.bounds.maxY+(q+r),n.maxY)};this.connector.paint(this._jsPlumb.paintStyleInUse,null,s);for(var t in this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(t)){var u=this._jsPlumb.overlays[t];u.isVisible()&&u.paint(this._jsPlumb.overlayPlacements[t],s)}}this._jsPlumb.lastPaintedAt=b}},repaint:function(a){a=a||{},this.paint({elId:this.sourceId,recalc:!(a.recalc===!1),timestamp:a.timestamp})},prepareEndpoint:function(a,c,d,f,g,h,i,j){var k;if(f)d.endpoints[g]=f,f.addConnection(d);else{h.endpoints||(h.endpoints=[null,null]);var l=h.endpoints[g]||h.endpoint||a.Defaults.Endpoints[g]||b.Defaults.Endpoints[g]||a.Defaults.Endpoint||b.Defaults.Endpoint;h.endpointStyles||(h.endpointStyles=[null,null]),h.endpointHoverStyles||(h.endpointHoverStyles=[null,null]);var m=h.endpointStyles[g]||h.endpointStyle||a.Defaults.EndpointStyles[g]||b.Defaults.EndpointStyles[g]||a.Defaults.EndpointStyle||b.Defaults.EndpointStyle;null==m.fill&&null!=h.paintStyle&&(m.fill=h.paintStyle.stroke),null==m.outlineStroke&&null!=h.paintStyle&&(m.outlineStroke=h.paintStyle.outlineStroke),null==m.outlineWidth&&null!=h.paintStyle&&(m.outlineWidth=h.paintStyle.outlineWidth);var n=h.endpointHoverStyles[g]||h.endpointHoverStyle||a.Defaults.EndpointHoverStyles[g]||b.Defaults.EndpointHoverStyles[g]||a.Defaults.EndpointHoverStyle||b.Defaults.EndpointHoverStyle;null!=h.hoverPaintStyle&&(null==n&&(n={}),null==n.fill&&(n.fill=h.hoverPaintStyle.stroke));var o=h.anchors?h.anchors[g]:h.anchor?h.anchor:e(a.Defaults.Anchors[g],j,a)||e(b.Defaults.Anchors[g],j,a)||e(a.Defaults.Anchor,j,a)||e(b.Defaults.Anchor,j,a),p=h.uuids?h.uuids[g]:null;k=c({paintStyle:m,hoverPaintStyle:n,endpoint:l,connections:[d],uuid:p,anchor:o,source:i,scope:h.scope,reattach:h.reattach||a.Defaults.ReattachConnections,detachable:h.detachable||a.Defaults.ConnectionsDetachable}),null==f&&k.setDeleteOnEmpty(!0),d.endpoints[g]=k,h.drawEndpoints===!1&&k.setVisible(!1,!0,!0)}return k}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumbUtil,c=a.jsPlumb;c.AnchorManager=function(a){var d={},e={},f={},g={},h={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"},i=["left","top","right","bottom"],j={},k=this,l={},m=a.jsPlumbInstance,n={},o=function(a,b,c,d,e,f){if(a===b)return{orientation:h.IDENTITY,a:["top","top"]};var g=Math.atan2(d.centery-c.centery,d.centerx-c.centerx),j=Math.atan2(c.centery-d.centery,c.centerx-d.centerx),k=[],l={};!function(a,b){for(var c=0;c<a.length;c++)l[a[c]]={left:[b[c].left,b[c].centery],right:[b[c].right,b[c].centery],top:[b[c].centerx,b[c].top],bottom:[b[c].centerx,b[c].bottom]}}(["source","target"],[c,d]);for(var m=0;m<i.length;m++)for(var n=0;n<i.length;n++)k.push({source:i[m],target:i[n],dist:Biltong.lineLength(l.source[i[m]],l.target[i[n]])});k.sort(function(a,b){return a.dist<b.dist?-1:a.dist>b.dist?1:0});for(var o=k[0].source,p=k[0].target,q=0;q<k.length&&(o=!e.isContinuous||e.isEdgeSupported(k[q].source)?k[q].source:null,p=!f.isContinuous||f.isEdgeSupported(k[q].target)?k[q].target:null,null==o||null==p);q++);return{a:[o,p],theta:g,theta2:j}},p=function(a,b,c,d,e,f,g){for(var h=[],i=b[e?0:1]/(d.length+1),j=0;j<d.length;j++){var k=(j+1)*i,l=f*b[e?1:0];g&&(k=b[e?0:1]-k);var m=e?k:l,n=c[0]+m,o=m/b[0],p=e?l:k,q=c[1]+p,r=p/b[1];h.push([n,q,o,r,d[j][1],d[j][2]])}return h},q=function(a){return function(b,c){var d=!0;return d=a?b[0][0]<c[0][0]:b[0][0]>c[0][0],d===!1?-1:1}},r=function(a,b){var c=a[0][0]<0?-Math.PI-a[0][0]:Math.PI-a[0][0],d=b[0][0]<0?-Math.PI-b[0][0]:Math.PI-b[0][0];return c>d?1:-1},s={top:function(a,b){return a[0]>b[0]?1:-1},right:q(!0),bottom:q(!0),left:r},t=function(a,b){return a.sort(b)},u=function(a,b){var c=m.getCachedData(a),d=c.s,f=c.o,h=function(b,c,d,f,h,i,j){if(f.length>0)for(var k=t(f,s[b]),l="right"===b||"top"===b,m=p(b,c,d,k,h,i,l),n=function(a,b){e[a.id]=[b[0],b[1],b[2],b[3]],g[a.id]=j
+},o=0;o<m.length;o++){var q=m[o][4],r=q.endpoints[0].elementId===a,u=q.endpoints[1].elementId===a;r&&n(q.endpoints[0],m[o]),u&&n(q.endpoints[1],m[o])}};h("bottom",d,[f.left,f.top],b.bottom,!0,1,[0,1]),h("top",d,[f.left,f.top],b.top,!0,0,[0,-1]),h("left",d,[f.left,f.top],b.left,!1,0,[-1,0]),h("right",d,[f.left,f.top],b.right,!1,1,[1,0])};this.reset=function(){d={},j={},l={}},this.addFloatingConnection=function(a,b){n[a]=b},this.removeFloatingConnection=function(a){delete n[a]},this.newConnection=function(a){var d=a.sourceId,e=a.targetId,f=a.endpoints,g=!0,h=function(h,i,k,l,m){d===e&&k.isContinuous&&(a._jsPlumb.instance.removeElement(f[1].canvas),g=!1),b.addToList(j,l,[m,i,k.constructor===c.DynamicAnchor])};h(0,f[0],f[0].anchor,e,a),g&&h(1,f[1],f[1].anchor,d,a)};var v=function(a){!function(a,c){if(a){var d=function(a){return a[4]===c};b.removeWithFunction(a.top,d),b.removeWithFunction(a.left,d),b.removeWithFunction(a.bottom,d),b.removeWithFunction(a.right,d)}}(l[a.elementId],a.id)};this.connectionDetached=function(a,c){var d=a.connection||a,e=a.sourceId,f=a.targetId,g=d.endpoints,h=function(a,c,d,e,f){b.removeWithFunction(j[e],function(a){return a[0].id===f.id})};h(1,g[1],g[1].anchor,e,d),h(0,g[0],g[0].anchor,f,d),d.floatingId&&(h(d.floatingIndex,d.floatingEndpoint,d.floatingEndpoint.anchor,d.floatingId,d),v(d.floatingEndpoint)),v(d.endpoints[0]),v(d.endpoints[1]),c||(k.redraw(d.sourceId),d.targetId!==d.sourceId&&k.redraw(d.targetId))},this.add=function(a,c){b.addToList(d,c,a)},this.changeId=function(a,b){j[b]=j[a],d[b]=d[a],delete j[a],delete d[a]},this.getConnectionsFor=function(a){return j[a]||[]},this.getEndpointsFor=function(a){return d[a]||[]},this.deleteEndpoint=function(a){b.removeWithFunction(d[a.elementId],function(b){return b.id===a.id}),v(a)},this.clearFor=function(a){delete d[a],d[a]=[]};var w=function(c,d,e,f,g,h,i,j,k,l,m,n){var o,p,q=-1,r=-1,s=f.endpoints[i],t=s.id,u=[1,0][i],v=[[d,e],f,g,h,t],w=c[k],x=s._continuousAnchorEdge?c[s._continuousAnchorEdge]:null;if(x){var y=b.findWithFunction(x,function(a){return a[4]===t});if(-1!==y)for(x.splice(y,1),o=0;o<x.length;o++)p=x[o][1],b.addWithFunction(m,p,function(a){return a.id===p.id}),b.addWithFunction(n,x[o][1].endpoints[i],function(a){return a.id===p.endpoints[i].id}),b.addWithFunction(n,x[o][1].endpoints[u],function(a){return a.id===p.endpoints[u].id})}for(o=0;o<w.length;o++)p=w[o][1],1===a.idx&&w[o][3]===h&&-1===r&&(r=o),b.addWithFunction(m,p,function(a){return a.id===p.id}),b.addWithFunction(n,w[o][1].endpoints[i],function(a){return a.id===p.endpoints[i].id}),b.addWithFunction(n,w[o][1].endpoints[u],function(a){return a.id===p.endpoints[u].id});if(-1!==q)w[q]=v;else{var z=j?-1!==r?r:0:w.length;w.splice(z,0,v)}s._continuousAnchorEdge=k};this.updateOtherEndpoint=function(a,d,e,f){var g=b.findWithFunction(j[a],function(a){return a[0].id===f.id}),h=b.findWithFunction(j[d],function(a){return a[0].id===f.id});-1!==g&&(j[a][g][0]=f,j[a][g][1]=f.endpoints[1],j[a][g][2]=f.endpoints[1].anchor.constructor===c.DynamicAnchor),h>-1&&(j[d].splice(h,1),b.addToList(j,e,[f,f.endpoints[0],f.endpoints[0].anchor.constructor===c.DynamicAnchor])),f.updateConnectedClass()},this.sourceChanged=function(a,d,e,f){if(a!==d){e.sourceId=d,e.source=f,b.removeWithFunction(j[a],function(a){return a[0].id===e.id});var g=b.findWithFunction(j[e.targetId],function(a){return a[0].id===e.id});g>-1&&(j[e.targetId][g][0]=e,j[e.targetId][g][1]=e.endpoints[0],j[e.targetId][g][2]=e.endpoints[0].anchor.constructor===c.DynamicAnchor),b.addToList(j,d,[e,e.endpoints[1],e.endpoints[1].anchor.constructor===c.DynamicAnchor]),e.endpoints[1].anchor.isContinuous&&(e.source===e.target?e._jsPlumb.instance.removeElement(e.endpoints[1].canvas):null==e.endpoints[1].canvas.parentNode&&e._jsPlumb.instance.appendElement(e.endpoints[1].canvas)),e.updateConnectedClass()}},this.rehomeEndpoint=function(a,b,c){var e=d[b]||[],f=m.getId(c);if(f!==b){var g=e.indexOf(a);if(g>-1){var h=e.splice(g,1)[0];k.add(h,f)}}for(var i=0;i<a.connections.length;i++)a.connections[i].sourceId===b?k.sourceChanged(b,a.elementId,a.connections[i],a.element):a.connections[i].targetId===b&&(a.connections[i].targetId=a.elementId,a.connections[i].target=a.element,k.updateOtherEndpoint(a.connections[i].sourceId,b,a.elementId,a.connections[i]))},this.redraw=function(a,e,f,g,h,i){if(!m.isSuspendDrawing()){var k=d[a]||[],p=j[a]||[],q=[],r=[],s=[];f=f||m.timestamp(),g=g||{left:0,top:0},e&&(e={left:e.left+g.left,top:e.top+g.top});for(var t=m.updateOffset({elId:a,offset:e,recalc:!1,timestamp:f}),v={},x=0;x<p.length;x++){var y=p[x][0],z=y.sourceId,A=y.targetId,B=y.endpoints[0].anchor.isContinuous,C=y.endpoints[1].anchor.isContinuous;if(B||C){var D=z+"_"+A,E=v[D],F=y.sourceId===a?1:0;B&&!l[z]&&(l[z]={top:[],right:[],bottom:[],left:[]}),C&&!l[A]&&(l[A]={top:[],right:[],bottom:[],left:[]}),a!==A&&m.updateOffset({elId:A,timestamp:f}),a!==z&&m.updateOffset({elId:z,timestamp:f});var G=m.getCachedData(A),H=m.getCachedData(z);A===z&&(B||C)?(w(l[z],-Math.PI/2,0,y,!1,A,0,!1,"top",z,q,r),w(l[A],-Math.PI/2,0,y,!1,z,1,!1,"top",A,q,r)):(E||(E=o(z,A,H.o,G.o,y.endpoints[0].anchor,y.endpoints[1].anchor),v[D]=E),B&&w(l[z],E.theta,0,y,!1,A,0,!1,E.a[0],z,q,r),C&&w(l[A],E.theta2,-1,y,!0,z,1,!0,E.a[1],A,q,r)),B&&b.addWithFunction(s,z,function(a){return a===z}),C&&b.addWithFunction(s,A,function(a){return a===A}),b.addWithFunction(q,y,function(a){return a.id===y.id}),(B&&0===F||C&&1===F)&&b.addWithFunction(r,y.endpoints[F],function(a){return a.id===y.endpoints[F].id})}}for(x=0;x<k.length;x++)0===k[x].connections.length&&k[x].anchor.isContinuous&&(l[a]||(l[a]={top:[],right:[],bottom:[],left:[]}),w(l[a],-Math.PI/2,0,{endpoints:[k[x],k[x]],paint:function(){}},!1,a,0,!1,k[x].anchor.getDefaultFace(),a,q,r),b.addWithFunction(s,a,function(b){return b===a}));for(x=0;x<s.length;x++)u(s[x],l[s[x]]);for(x=0;x<k.length;x++)k[x].paint({timestamp:f,offset:t,dimensions:t.s,recalc:i!==!0});for(x=0;x<r.length;x++){var I=m.getCachedData(r[x].elementId);r[x].paint({timestamp:f,offset:I,dimensions:I.s})}for(x=0;x<p.length;x++){var J=p[x][1];if(J.anchor.constructor===c.DynamicAnchor){J.paint({elementWithPrecedence:a,timestamp:f}),b.addWithFunction(q,p[x][0],function(a){return a.id===p[x][0].id});for(var K=0;K<J.connections.length;K++)J.connections[K]!==p[x][0]&&b.addWithFunction(q,J.connections[K],function(a){return a.id===J.connections[K].id})}else J.anchor.constructor===c.Anchor&&b.addWithFunction(q,p[x][0],function(a){return a.id===p[x][0].id})}var L=n[a];for(L&&L.paint({timestamp:f,recalc:!1,elId:a}),x=0;x<q.length;x++)q[x].paint({elId:a,timestamp:f,recalc:!1,clearEdits:h})}};var x=function(a){b.EventGenerator.apply(this),this.type="Continuous",this.isDynamic=!0,this.isContinuous=!0;for(var c=a.faces||["top","right","bottom","left"],d=!(a.clockwise===!1),h={},i={top:"bottom",right:"left",left:"right",bottom:"top"},j={top:"right",right:"bottom",left:"top",bottom:"left"},k={top:"left",right:"top",left:"bottom",bottom:"right"},l=d?j:k,m=d?k:j,n=a.cssClass||"",o=0;o<c.length;o++)h[c[o]]=!0;this.getDefaultFace=function(){return 0===c.length?"top":c[0]},this.verifyEdge=function(a){return h[a]?a:h[i[a]]?i[a]:h[l[a]]?l[a]:h[m[a]]?m[a]:a},this.isEdgeSupported=function(a){return h[a]===!0},this.compute=function(a){return f[a.element.id]||e[a.element.id]||[0,0]},this.getCurrentLocation=function(a){return f[a.element.id]||e[a.element.id]||[0,0]},this.getOrientation=function(a){return g[a.id]||[0,0]},this.clearUserDefinedLocation=function(){delete f[a.elementId]},this.setUserDefinedLocation=function(b){f[a.elementId]=b},this.getCssClass=function(){return n}};m.continuousAnchorFactory={get:function(a){return new x(a)},clear:function(a){delete f[a],delete e[a]}}},c.Anchor=function(a){this.x=a.x||0,this.y=a.y||0,this.elementId=a.elementId,this.cssClass=a.cssClass||"",this.userDefinedLocation=null,this.orientation=a.orientation||[0,0],this.lastReturnValue=null,this.offsets=a.offsets||[0,0],this.timestamp=null,b.EventGenerator.apply(this),this.compute=function(a){var b=a.xy,c=a.wh,d=a.timestamp;return a.clearUserDefinedLocation&&(this.userDefinedLocation=null),d&&d===this.timestamp?this.lastReturnValue:(this.lastReturnValue=null!=this.userDefinedLocation?this.userDefinedLocation:[b[0]+this.x*c[0]+this.offsets[0],b[1]+this.y*c[1]+this.offsets[1]],this.timestamp=d,this.lastReturnValue)},this.getCurrentLocation=function(a){return a=a||{},null==this.lastReturnValue||null!=a.timestamp&&this.timestamp!==a.timestamp?this.compute(a):this.lastReturnValue}},b.extend(c.Anchor,b.EventGenerator,{equals:function(a){if(!a)return!1;var b=a.getOrientation(),c=this.getOrientation();return this.x===a.x&&this.y===a.y&&this.offsets[0]===a.offsets[0]&&this.offsets[1]===a.offsets[1]&&c[0]===b[0]&&c[1]===b[1]},getUserDefinedLocation:function(){return this.userDefinedLocation},setUserDefinedLocation:function(a){this.userDefinedLocation=a},clearUserDefinedLocation:function(){this.userDefinedLocation=null},getOrientation:function(){return this.orientation},getCssClass:function(){return this.cssClass}}),c.FloatingAnchor=function(a){c.Anchor.apply(this,arguments);var b=a.reference,d=a.referenceCanvas,e=c.getSize(d),f=0,g=0,h=null,i=null;this.orientation=null,this.x=0,this.y=0,this.isFloating=!0,this.compute=function(a){var b=a.xy,c=[b[0]+e[0]/2,b[1]+e[1]/2];return i=c,c},this.getOrientation=function(a){if(h)return h;var c=b.getOrientation(a);return[-1*Math.abs(c[0])*f,-1*Math.abs(c[1])*g]},this.over=function(a,b){h=a.getOrientation(b)},this.out=function(){h=null},this.getCurrentLocation=function(a){return null==i?this.compute(a):i}},b.extend(c.FloatingAnchor,c.Anchor);var d=function(a,b,d){return a.constructor===c.Anchor?a:b.makeAnchor(a,d,b)};c.DynamicAnchor=function(a){c.Anchor.apply(this,arguments),this.isDynamic=!0,this.anchors=[],this.elementId=a.elementId,this.jsPlumbInstance=a.jsPlumbInstance;for(var b=0;b<a.anchors.length;b++)this.anchors[b]=d(a.anchors[b],this.jsPlumbInstance,this.elementId);this.getAnchors=function(){return this.anchors},this.locked=!1;var e=this.anchors.length>0?this.anchors[0]:null,f=e,g=this,h=function(a,b,c,d,e){var f=d[0]+a.x*e[0],g=d[1]+a.y*e[1],h=d[0]+e[0]/2,i=d[1]+e[1]/2;return Math.sqrt(Math.pow(b-f,2)+Math.pow(c-g,2))+Math.sqrt(Math.pow(h-f,2)+Math.pow(i-g,2))},i=a.selector||function(a,b,c,d,e){for(var f=c[0]+d[0]/2,g=c[1]+d[1]/2,i=-1,j=1/0,k=0;k<e.length;k++){var l=h(e[k],f,g,a,b);j>l&&(i=k+0,j=l)}return e[i]};this.compute=function(a){var b=a.xy,c=a.wh,d=a.txy,h=a.twh;this.timestamp=a.timestamp;var j=g.getUserDefinedLocation();return null!=j?j:this.locked||null==d||null==h?e.compute(a):(a.timestamp=null,e=i(b,c,d,h,this.anchors),this.x=e.x,this.y=e.y,e!==f&&this.fire("anchorChanged",e),f=e,e.compute(a))},this.getCurrentLocation=function(a){return this.getUserDefinedLocation()||(null!=e?e.getCurrentLocation(a):null)},this.getOrientation=function(a){return null!=e?e.getOrientation(a):[0,0]},this.over=function(a,b){null!=e&&e.over(a,b)},this.out=function(){null!=e&&e.out()},this.getCssClass=function(){return e&&e.getCssClass()||""}},b.extend(c.DynamicAnchor,c.Anchor);var e=function(a,b,d,e,f,g){c.Anchors[f]=function(c){var h=c.jsPlumbInstance.makeAnchor([a,b,d,e,0,0],c.elementId,c.jsPlumbInstance);return h.type=f,g&&g(h,c),h}};e(.5,0,0,-1,"TopCenter"),e(.5,1,0,1,"BottomCenter"),e(0,.5,-1,0,"LeftMiddle"),e(1,.5,1,0,"RightMiddle"),e(.5,0,0,-1,"Top"),e(.5,1,0,1,"Bottom"),e(0,.5,-1,0,"Left"),e(1,.5,1,0,"Right"),e(.5,.5,0,0,"Center"),e(1,0,0,-1,"TopRight"),e(1,1,0,1,"BottomRight"),e(0,0,0,-1,"TopLeft"),e(0,1,0,1,"BottomLeft"),c.Defaults.DynamicAnchors=function(a){return a.jsPlumbInstance.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"],a.elementId,a.jsPlumbInstance)},c.Anchors.AutoDefault=function(a){var b=a.jsPlumbInstance.makeDynamicAnchor(c.Defaults.DynamicAnchors(a));return b.type="AutoDefault",b};var f=function(a,b){c.Anchors[a]=function(c){var d=c.jsPlumbInstance.makeAnchor(["Continuous",{faces:b}],c.elementId,c.jsPlumbInstance);return d.type=a,d}};c.Anchors.Continuous=function(a){return a.jsPlumbInstance.continuousAnchorFactory.get(a)},f("ContinuousLeft",["left"]),f("ContinuousTop",["top"]),f("ContinuousBottom",["bottom"]),f("ContinuousRight",["right"]),e(0,0,0,0,"Assign",function(a,b){var c=b.position||"Fixed";a.positionFinder=c.constructor===String?b.jsPlumbInstance.AnchorPositionFinders[c]:c,a.constructorParams=b}),a.jsPlumbInstance.prototype.AnchorPositionFinders={Fixed:function(a,b,c){return[(a.left-b.left)/c[0],(a.top-b.top)/c[1]]},Grid:function(a,b,c,d){var e=a.left-b.left,f=a.top-b.top,g=c[0]/d.grid[0],h=c[1]/d.grid[1],i=Math.floor(e/g),j=Math.floor(f/h);return[(i*g+g/2)/c[0],(j*h+h/2)/c[1]]}},c.Anchors.Perimeter=function(a){a=a||{};var b=a.anchorCount||60,c=a.shape;if(!c)throw new Error("no shape supplied to Perimeter Anchor type");var d=function(){for(var a=.5,c=2*Math.PI/b,d=0,e=[],f=0;b>f;f++){var g=a+a*Math.sin(d),h=a+a*Math.cos(d);e.push([g,h,0,0]),d+=c}return e},e=function(a){for(var c=b/a.length,d=[],e=function(a,e,f,g,h){c=b*h;for(var i=(f-a)/c,j=(g-e)/c,k=0;c>k;k++)d.push([a+i*k,e+j*k,0,0])},f=0;f<a.length;f++)e.apply(null,a[f]);return d},f=function(a){for(var b=[],c=0;c<a.length;c++)b.push([a[c][0],a[c][1],a[c][2],a[c][3],1/a.length]);return e(b)},g=function(){return f([[0,0,1,0],[1,0,1,1],[1,1,0,1],[0,1,0,0]])},h={Circle:d,Ellipse:d,Diamond:function(){return f([[.5,0,1,.5],[1,.5,.5,1],[.5,1,0,.5],[0,.5,.5,0]])},Rectangle:g,Square:g,Triangle:function(){return f([[.5,0,1,1],[1,1,0,1],[0,1,.5,0]])},Path:function(a){for(var b=a.points,c=[],d=0,f=0;f<b.length-1;f++){var g=Math.sqrt(Math.pow(b[f][2]-b[f][0])+Math.pow(b[f][3]-b[f][1]));d+=g,c.push([b[f][0],b[f][1],b[f+1][0],b[f+1][1],g])}for(var h=0;h<c.length;h++)c[h][4]=c[h][4]/d;return e(c)}},i=function(a,b){for(var c=[],d=b/180*Math.PI,e=0;e<a.length;e++){var f=a[e][0]-.5,g=a[e][1]-.5;c.push([.5+(f*Math.cos(d)-g*Math.sin(d)),.5+(f*Math.sin(d)+g*Math.cos(d)),a[e][2],a[e][3]])}return c};if(!h[c])throw new Error("Shape ["+c+"] is unknown by Perimeter Anchor type");var j=h[c](a);a.rotation&&(j=i(j,a.rotation));var k=a.jsPlumbInstance.makeDynamicAnchor(j);return k.type="Perimeter",k}}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=a.Biltong;b.Segments={AbstractSegment:function(a){this.params=a,this.findClosestPointOnPath=function(){return{d:1/0,x:null,y:null,l:null}},this.getBounds=function(){return{minX:Math.min(a.x1,a.x2),minY:Math.min(a.y1,a.y2),maxX:Math.max(a.x1,a.x2),maxY:Math.max(a.y1,a.y2)}}},Straight:function(a){var c,e,f,g,h,i,j,k=(b.Segments.AbstractSegment.apply(this,arguments),function(){c=Math.sqrt(Math.pow(h-g,2)+Math.pow(j-i,2)),e=d.gradient({x:g,y:i},{x:h,y:j}),f=-1/e});this.type="Straight",this.getLength=function(){return c},this.getGradient=function(){return e},this.getCoordinates=function(){return{x1:g,y1:i,x2:h,y2:j}},this.setCoordinates=function(a){g=a.x1,i=a.y1,h=a.x2,j=a.y2,k()},this.setCoordinates({x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2}),this.getBounds=function(){return{minX:Math.min(g,h),minY:Math.min(i,j),maxX:Math.max(g,h),maxY:Math.max(i,j)}},this.pointOnPath=function(a,b){if(0!==a||b){if(1!==a||b){var e=b?a>0?a:c+a:a*c;return d.pointOnLine({x:g,y:i},{x:h,y:j},e)}return{x:h,y:j}}return{x:g,y:i}},this.gradientAtPoint=function(){return e},this.pointAlongPathFrom=function(a,b,c){var e=this.pointOnPath(a,c),f=0>=b?{x:g,y:i}:{x:h,y:j};return 0>=b&&Math.abs(b)>1&&(b*=-1),d.pointOnLine(e,f,b)};var l=function(a,b,c){return c>=Math.min(a,b)&&c<=Math.max(a,b)},m=function(a,b,c){return Math.abs(c-a)<Math.abs(c-b)?a:b};this.findClosestPointOnPath=function(a,b){var k={d:1/0,x:null,y:null,l:null,x1:g,x2:h,y1:i,y2:j};if(0===e)k.y=i,k.x=l(g,h,a)?a:m(g,h,a);else if(1/0===e||e===-1/0)k.x=g,k.y=l(i,j,b)?b:m(i,j,b);else{var n=i-e*g,o=b-f*a,p=(o-n)/(e-f),q=e*p+n;k.x=l(g,h,p)?p:m(g,h,p),k.y=l(i,j,q)?q:m(i,j,q)}var r=d.lineLength([k.x,k.y],[g,i]);return k.d=d.lineLength([a,b],[k.x,k.y]),k.l=r/c,k}},Arc:function(a){var c=(b.Segments.AbstractSegment.apply(this,arguments),function(b,c){return d.theta([a.cx,a.cy],[b,c])}),e=function(a,b){if(a.anticlockwise){var c=a.startAngle<a.endAngle?a.startAngle+f:a.startAngle,d=Math.abs(c-a.endAngle);return c-d*b}var e=a.endAngle<a.startAngle?a.endAngle+f:a.endAngle,g=Math.abs(e-a.startAngle);return a.startAngle+g*b},f=2*Math.PI;this.radius=a.r,this.anticlockwise=a.ac,this.type="Arc",a.startAngle&&a.endAngle?(this.startAngle=a.startAngle,this.endAngle=a.endAngle,this.x1=a.cx+this.radius*Math.cos(a.startAngle),this.y1=a.cy+this.radius*Math.sin(a.startAngle),this.x2=a.cx+this.radius*Math.cos(a.endAngle),this.y2=a.cy+this.radius*Math.sin(a.endAngle)):(this.startAngle=c(a.x1,a.y1),this.endAngle=c(a.x2,a.y2),this.x1=a.x1,this.y1=a.y1,this.x2=a.x2,this.y2=a.y2),this.endAngle<0&&(this.endAngle+=f),this.startAngle<0&&(this.startAngle+=f);var g=this.endAngle<this.startAngle?this.endAngle+f:this.endAngle;this.sweep=Math.abs(g-this.startAngle),this.anticlockwise&&(this.sweep=f-this.sweep);var h=2*Math.PI*this.radius,i=this.sweep/f,j=h*i;this.getLength=function(){return j},this.getBounds=function(){return{minX:a.cx-a.r,maxX:a.cx+a.r,minY:a.cy-a.r,maxY:a.cy+a.r}};var k=1e-10,l=function(a){var b=Math.floor(a),c=Math.ceil(a);return k>a-b?b:k>c-a?c:a};this.pointOnPath=function(b,c){if(0===b)return{x:this.x1,y:this.y1,theta:this.startAngle};if(1===b)return{x:this.x2,y:this.y2,theta:this.endAngle};c&&(b/=j);var d=e(this,b),f=a.cx+a.r*Math.cos(d),g=a.cy+a.r*Math.sin(d);return{x:l(f),y:l(g),theta:d}},this.gradientAtPoint=function(b,c){var e=this.pointOnPath(b,c),f=d.normal([a.cx,a.cy],[e.x,e.y]);return this.anticlockwise||1/0!==f&&f!==-1/0||(f*=-1),f},this.pointAlongPathFrom=function(b,c,d){var e=this.pointOnPath(b,d),f=2*(c/h)*Math.PI,g=this.anticlockwise?-1:1,i=e.theta+g*f,j=a.cx+this.radius*Math.cos(i),k=a.cy+this.radius*Math.sin(i);return{x:j,y:k}}},Bezier:function(c){this.curve=[{x:c.x1,y:c.y1},{x:c.cp1x,y:c.cp1y},{x:c.cp2x,y:c.cp2y},{x:c.x2,y:c.y2}],b.Segments.AbstractSegment.apply(this,arguments),this.bounds={minX:Math.min(c.x1,c.x2,c.cp1x,c.cp2x),minY:Math.min(c.y1,c.y2,c.cp1y,c.cp2y),maxX:Math.max(c.x1,c.x2,c.cp1x,c.cp2x),maxY:Math.max(c.y1,c.y2,c.cp1y,c.cp2y)},this.type="Bezier";var d=function(b,c,d){return d&&(c=a.jsBezier.locationAlongCurveFrom(b,c>0?0:1,c)),c};this.pointOnPath=function(b,c){return b=d(this.curve,b,c),a.jsBezier.pointOnCurve(this.curve,b)},this.gradientAtPoint=function(b,c){return b=d(this.curve,b,c),a.jsBezier.gradientAtPoint(this.curve,b)},this.pointAlongPathFrom=function(b,c,e){return b=d(this.curve,b,e),a.jsBezier.pointAlongCurveFrom(this.curve,b,c)},this.getLength=function(){return a.jsBezier.getLength(this.curve)},this.getBounds=function(){return this.bounds}}},b.SegmentRenderer={getPath:function(a){return{Straight:function(){var b=a.getCoordinates();return"M "+b.x1+" "+b.y1+" L "+b.x2+" "+b.y2},Bezier:function(){var b=a.params;return"M "+b.x1+" "+b.y1+" C "+b.cp1x+" "+b.cp1y+" "+b.cp2x+" "+b.cp2y+" "+b.x2+" "+b.y2},Arc:function(){var b=a.params,c=a.sweep>Math.PI?1:0,d=a.anticlockwise?0:1;return"M"+a.x1+" "+a.y1+" A "+a.radius+" "+b.r+" 0 "+c+","+d+" "+a.x2+" "+a.y2}}[a.type]()}};var e=function(){this.resetBounds=function(){this.bounds={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}},this.resetBounds()};b.Connectors.AbstractConnector=function(a){e.apply(this,arguments);var f=[],g=0,h=[],i=[],j=a.stub||0,k=c.isArray(j)?j[0]:j,l=c.isArray(j)?j[1]:j,m=a.gap||0,n=c.isArray(m)?m[0]:m,o=c.isArray(m)?m[1]:m,p=null,q=!1,r=null,s=null,t=a.editable!==!1&&null!=b.ConnectorEditors&&null!=b.ConnectorEditors[this.type],u=this.setGeometry=function(a,b){q=!b,s=a},v=this.getGeometry=function(){return s};this.getPathData=function(){for(var a="",c=0;c<f.length;c++)a+=b.SegmentRenderer.getPath(f[c]),a+=" ";return a},this.hasBeenEdited=function(){return q},this.isEditing=function(){return null!=this.editor&&this.editor.isActive()},this.setEditable=function(a){return t=a&&null!=b.ConnectorEditors&&null!=b.ConnectorEditors[this.type]&&(null==this.overrideSetEditable||this.overrideSetEditable())?a:!1},this.isEditable=function(){return t},this.findSegmentForPoint=function(a,b){for(var c={d:1/0,s:null,x:null,y:null,l:null},d=0;d<f.length;d++){var e=f[d].findClosestPointOnPath(a,b);e.d<c.d&&(c.d=e.d,c.l=e.l,c.x=e.x,c.y=e.y,c.s=f[d],c.x1=e.x1,c.x2=e.x2,c.y1=e.y1,c.y2=e.y2,c.index=d)}return c};var w=function(){for(var a=0,b=0;b<f.length;b++){var c=f[b].getLength();i[b]=c/g,h[b]=[a,a+=c/g]}},x=function(a,b){b&&(a=a>0?a/g:(g+a)/g);for(var c=h.length-1,d=1,e=0;e<h.length;e++)if(h[e][1]>=a){c=e,d=1===a?1:0===a?0:(a-h[e][0])/i[e];break}return{segment:f[c],proportion:d,index:c}},y=function(a,c,d){if(d.x1!==d.x2||d.y1!==d.y2){var e=new b.Segments[c](d);f.push(e),g+=e.getLength(),a.updateBounds(e)}},z=function(){g=f.length=h.length=i.length=0};this.setSegments=function(a){p=[],g=0;for(var b=0;b<a.length;b++)p.push(a[b]),g+=a[b].getLength()},this.getLength=function(){return g};var A=function(a){this.strokeWidth=a.strokeWidth;var b=d.quadrant(a.sourcePos,a.targetPos),c=a.targetPos[0]<a.sourcePos[0],e=a.targetPos[1]<a.sourcePos[1],f=a.strokeWidth||1,g=a.sourceEndpoint.anchor.getOrientation(a.sourceEndpoint),h=a.targetEndpoint.anchor.getOrientation(a.targetEndpoint),i=c?a.targetPos[0]:a.sourcePos[0],j=e?a.targetPos[1]:a.sourcePos[1],m=Math.abs(a.targetPos[0]-a.sourcePos[0]),p=Math.abs(a.targetPos[1]-a.sourcePos[1]);if(0===g[0]&&0===g[1]||0===h[0]&&0===h[1]){var q=m>p?0:1,r=[1,0][q];g=[],h=[],g[q]=a.sourcePos[q]>a.targetPos[q]?-1:1,h[q]=a.sourcePos[q]>a.targetPos[q]?1:-1,g[r]=0,h[r]=0}var s=c?m+n*g[0]:n*g[0],t=e?p+n*g[1]:n*g[1],u=c?o*h[0]:m+o*h[0],v=e?o*h[1]:p+o*h[1],w=g[0]*h[0]+g[1]*h[1],x={sx:s,sy:t,tx:u,ty:v,lw:f,xSpan:Math.abs(u-s),ySpan:Math.abs(v-t),mx:(s+u)/2,my:(t+v)/2,so:g,to:h,x:i,y:j,w:m,h:p,segment:b,startStubX:s+g[0]*k,startStubY:t+g[1]*k,endStubX:u+h[0]*l,endStubY:v+h[1]*l,isXGreaterThanStubTimes2:Math.abs(s-u)>k+l,isYGreaterThanStubTimes2:Math.abs(t-v)>k+l,opposite:-1===w,perpendicular:0===w,orthogonal:1===w,sourceAxis:0===g[0]?"y":"x",points:[i,j,m,p,s,t,u,v]};return x.anchorOrientation=x.opposite?"opposite":x.orthogonal?"orthogonal":"perpendicular",x};return this.getSegments=function(){return f},this.updateBounds=function(a){var b=a.getBounds();this.bounds.minX=Math.min(this.bounds.minX,b.minX),this.bounds.maxX=Math.max(this.bounds.maxX,b.maxX),this.bounds.minY=Math.min(this.bounds.minY,b.minY),this.bounds.maxY=Math.max(this.bounds.maxY,b.maxY)},this.pointOnPath=function(a,b){var c=x(a,b);return c.segment&&c.segment.pointOnPath(c.proportion,!1)||[0,0]},this.gradientAtPoint=function(a,b){var c=x(a,b);return c.segment&&c.segment.gradientAtPoint(c.proportion,!1)||0},this.pointAlongPathFrom=function(a,b,c){var d=x(a,c);return d.segment&&d.segment.pointAlongPathFrom(d.proportion,b,!1)||[0,0]},this.compute=function(a){r=A.call(this,a),z(),this._compute(r,a),this.x=r.points[0],this.y=r.points[1],this.w=r.points[2],this.h=r.points[3],this.segment=r.segment,w()},{addSegment:y,prepareCompute:A,sourceStub:k,targetStub:l,maxStub:Math.max(k,l),sourceGap:n,targetGap:o,maxGap:Math.max(n,o),setGeometry:u,getGeometry:v}},c.extend(b.Connectors.AbstractConnector,e),b.Endpoints.AbstractEndpoint=function(a){e.apply(this,arguments);var b=this.compute=function(){var a=this._compute.apply(this,arguments);return this.x=a[0],this.y=a[1],this.w=a[2],this.h=a[3],this.bounds.minX=this.x,this.bounds.minY=this.y,this.bounds.maxX=this.x+this.w,this.bounds.maxY=this.y+this.h,a};return{compute:b,cssClass:a.cssClass}},c.extend(b.Endpoints.AbstractEndpoint,e),b.Endpoints.Dot=function(a){this.type="Dot",b.Endpoints.AbstractEndpoint.apply(this,arguments),a=a||{},this.radius=a.radius||10,this.defaultOffset=.5*this.radius,this.defaultInnerRadius=this.radius/3,this._compute=function(a,b,c){this.radius=c.radius||this.radius;var d=a[0]-this.radius,e=a[1]-this.radius,f=2*this.radius,g=2*this.radius;if(c.stroke){var h=c.strokeWidth||1;d-=h,e-=h,f+=2*h,g+=2*h}return[d,e,f,g,this.radius]}},c.extend(b.Endpoints.Dot,b.Endpoints.AbstractEndpoint),b.Endpoints.Rectangle=function(a){this.type="Rectangle",b.Endpoints.AbstractEndpoint.apply(this,arguments),a=a||{},this.width=a.width||20,this.height=a.height||20,this._compute=function(a,b,c){var d=c.width||this.width,e=c.height||this.height,f=a[0]-d/2,g=a[1]-e/2;return[f,g,d,e]}},c.extend(b.Endpoints.Rectangle,b.Endpoints.AbstractEndpoint);var f=function(){b.jsPlumbUIComponent.apply(this,arguments),this._jsPlumb.displayElements=[]};c.extend(f,b.jsPlumbUIComponent,{getDisplayElements:function(){return this._jsPlumb.displayElements},appendDisplayElement:function(a){this._jsPlumb.displayElements.push(a)}}),b.Endpoints.Image=function(d){this.type="Image",f.apply(this,arguments),b.Endpoints.AbstractEndpoint.apply(this,arguments);var e=d.onload,g=d.src||d.url,h=d.cssClass?" "+d.cssClass:"";this._jsPlumb.img=new Image,this._jsPlumb.ready=!1,this._jsPlumb.initialized=!1,this._jsPlumb.deleted=!1,this._jsPlumb.widthToUse=d.width,this._jsPlumb.heightToUse=d.height,this._jsPlumb.endpoint=d.endpoint,this._jsPlumb.img.onload=function(){null!=this._jsPlumb&&(this._jsPlumb.ready=!0,this._jsPlumb.widthToUse=this._jsPlumb.widthToUse||this._jsPlumb.img.width,this._jsPlumb.heightToUse=this._jsPlumb.heightToUse||this._jsPlumb.img.height,e&&e(this))}.bind(this),this._jsPlumb.endpoint.setImage=function(a,b){var c=a.constructor===String?a:a.src;e=b,this._jsPlumb.img.src=c,null!=this.canvas&&this.canvas.setAttribute("src",this._jsPlumb.img.src)}.bind(this),this._jsPlumb.endpoint.setImage(g,e),this._compute=function(a){return this.anchorPoint=a,this._jsPlumb.ready?[a[0]-this._jsPlumb.widthToUse/2,a[1]-this._jsPlumb.heightToUse/2,this._jsPlumb.widthToUse,this._jsPlumb.heightToUse]:[0,0,0,0]},this.canvas=b.createElement("img",{position:"absolute",margin:0,padding:0,outline:0},this._jsPlumb.instance.endpointClass+h),this._jsPlumb.widthToUse&&this.canvas.setAttribute("width",this._jsPlumb.widthToUse),this._jsPlumb.heightToUse&&this.canvas.setAttribute("height",this._jsPlumb.heightToUse),this._jsPlumb.instance.appendElement(this.canvas),this.actuallyPaint=function(){if(!this._jsPlumb.deleted){this._jsPlumb.initialized||(this.canvas.setAttribute("src",this._jsPlumb.img.src),this.appendDisplayElement(this.canvas),this._jsPlumb.initialized=!0);var a=this.anchorPoint[0]-this._jsPlumb.widthToUse/2,b=this.anchorPoint[1]-this._jsPlumb.heightToUse/2;c.sizeElement(this.canvas,a,b,this._jsPlumb.widthToUse,this._jsPlumb.heightToUse)}},this.paint=function(b,c){null!=this._jsPlumb&&(this._jsPlumb.ready?this.actuallyPaint(b,c):a.setTimeout(function(){this.paint(b,c)}.bind(this),200))}},c.extend(b.Endpoints.Image,[f,b.Endpoints.AbstractEndpoint],{cleanup:function(a){a&&(this._jsPlumb.deleted=!0,this.canvas&&this.canvas.parentNode.removeChild(this.canvas),this.canvas=null)}}),b.Endpoints.Blank=function(a){b.Endpoints.AbstractEndpoint.apply(this,arguments),this.type="Blank",f.apply(this,arguments),this._compute=function(a){return[a[0],a[1],10,0]};var d=a.cssClass?" "+a.cssClass:"";this.canvas=b.createElement("div",{display:"block",width:"1px",height:"1px",background:"transparent",position:"absolute"},this._jsPlumb.instance.endpointClass+d),this._jsPlumb.instance.appendElement(this.canvas),this.paint=function(){c.sizeElement(this.canvas,this.x,this.y,this.w,this.h)}},c.extend(b.Endpoints.Blank,[b.Endpoints.AbstractEndpoint,f],{cleanup:function(){this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}}),b.Endpoints.Triangle=function(a){this.type="Triangle",b.Endpoints.AbstractEndpoint.apply(this,arguments);var c=this;a=a||{},a.width=a.width||55,a.height=a.height||55,this.width=a.width,this.height=a.height,this._compute=function(a,b,d){var e=d.width||c.width,f=d.height||c.height,g=a[0]-e/2,h=a[1]-f/2;return[g,h,e,f]}};var g=b.Overlays.AbstractOverlay=function(a){this.visible=!0,this.isAppendedAtTopLevel=!0,this.component=a.component,this.loc=null==a.location?.5:a.location,this.endpointLoc=null==a.endpointLocation?[.5,.5]:a.endpointLocation,this.visible=a.visible!==!1};g.prototype={cleanup:function(a){a&&(this.component=null,this.canvas=null,this.endpointLoc=null)},reattach:function(){},setVisible:function(a){this.visible=a,this.component.repaint()},isVisible:function(){return this.visible},hide:function(){this.setVisible(!1)},show:function(){this.setVisible(!0)},incrementLocation:function(a){this.loc+=a,this.component.repaint()},setLocation:function(a){this.loc=a,this.component.repaint()},getLocation:function(){return this.loc},updateFrom:function(){}},b.Overlays.Arrow=function(a){this.type="Arrow",g.apply(this,arguments),this.isAppendedAtTopLevel=!1,a=a||{};var e=this;this.length=a.length||20,this.width=a.width||20,this.id=a.id;var f=(a.direction||1)<0?-1:1,h=a.paintStyle||{"stroke-width":1},i=a.foldback||.623;this.computeMaxSize=function(){return 1.5*e.width},this.elementCreated=function(c){if(this.path=c,a.events)for(var d in a.events)b.on(c,d,a.events[d])},this.draw=function(a,b){var e,g,j,k,l;if(a.pointAlongPathFrom){if(c.isString(this.loc)||this.loc>1||this.loc<0){var m=parseInt(this.loc,10),n=this.loc<0?1:0;e=a.pointAlongPathFrom(n,m,!1),g=a.pointAlongPathFrom(n,m-f*this.length/2,!1),j=d.pointOnLine(e,g,this.length)}else if(1===this.loc){if(e=a.pointOnPath(this.loc),g=a.pointAlongPathFrom(this.loc,-this.length),j=d.pointOnLine(e,g,this.length),-1===f){var o=j;j=e,e=o}}else if(0===this.loc){if(j=a.pointOnPath(this.loc),g=a.pointAlongPathFrom(this.loc,this.length),e=d.pointOnLine(j,g,this.length),-1===f){var p=j;j=e,e=p}}else e=a.pointAlongPathFrom(this.loc,f*this.length/2),g=a.pointOnPath(this.loc),j=d.pointOnLine(e,g,this.length);k=d.perpendicularLineTo(e,j,this.width),l=d.pointOnLine(e,j,i*this.length);var q={hxy:e,tail:k,cxy:l},r=h.stroke||b.stroke,s=h.fill||b.stroke,t=h.strokeWidth||b.strokeWidth;return{component:a,d:q,"stroke-width":t,stroke:r,fill:s,minX:Math.min(e.x,k[0].x,k[1].x),maxX:Math.max(e.x,k[0].x,k[1].x),minY:Math.min(e.y,k[0].y,k[1].y),maxY:Math.max(e.y,k[0].y,k[1].y)}}return{component:a,minX:0,maxX:0,minY:0,maxY:0}}},c.extend(b.Overlays.Arrow,g,{updateFrom:function(a){this.length=a.length||this.length,this.width=a.width||this.width,this.direction=null!=a.direction?a.direction:this.direction,this.foldback=a.foldback||this.foldback}}),b.Overlays.PlainArrow=function(a){a=a||{};var c=b.extend(a,{foldback:1});b.Overlays.Arrow.call(this,c),this.type="PlainArrow"},c.extend(b.Overlays.PlainArrow,b.Overlays.Arrow),b.Overlays.Diamond=function(a){a=a||{};var c=a.length||40,d=b.extend(a,{length:c/2,foldback:2});b.Overlays.Arrow.call(this,d),this.type="Diamond"},c.extend(b.Overlays.Diamond,b.Overlays.Arrow);var h=function(a,b){return(null==a._jsPlumb.cachedDimensions||b)&&(a._jsPlumb.cachedDimensions=a.getDimensions()),a._jsPlumb.cachedDimensions},i=function(a){b.jsPlumbUIComponent.apply(this,arguments),g.apply(this,arguments);var d=this.fire;this.fire=function(){d.apply(this,arguments),this.component&&this.component.fire.apply(this.component,arguments)},this.detached=!1,this.id=a.id,this._jsPlumb.div=null,this._jsPlumb.initialised=!1,this._jsPlumb.component=a.component,this._jsPlumb.cachedDimensions=null,this._jsPlumb.create=a.create,this._jsPlumb.initiallyInvisible=a.visible===!1,this.getElement=function(){if(null==this._jsPlumb.div){var c=this._jsPlumb.div=b.getElement(this._jsPlumb.create(this._jsPlumb.component));c.style.position="absolute",c.className=this._jsPlumb.instance.overlayClass+" "+(this.cssClass?this.cssClass:a.cssClass?a.cssClass:""),this._jsPlumb.instance.appendElement(c),this._jsPlumb.instance.getId(c),this.canvas=c;var d="translate(-50%, -50%)";c.style.webkitTransform=d,c.style.mozTransform=d,c.style.msTransform=d,c.style.oTransform=d,c.style.transform=d,c._jsPlumb=this,a.visible===!1&&(c.style.display="none")}return this._jsPlumb.div},this.draw=function(a,b,d){var e=h(this);if(null!=e&&2===e.length){var f={x:0,y:0};if(d)f={x:d[0],y:d[1]};else if(a.pointOnPath){var g=this.loc,i=!1;(c.isString(this.loc)||this.loc<0||this.loc>1)&&(g=parseInt(this.loc,10),i=!0),f=a.pointOnPath(g,i)
+}else{var j=this.loc.constructor===Array?this.loc:this.endpointLoc;f={x:j[0]*a.w,y:j[1]*a.h}}var k=f.x-e[0]/2,l=f.y-e[1]/2;return{component:a,d:{minx:k,miny:l,td:e,cxy:f},minX:k,maxX:k+e[0],minY:l,maxY:l+e[1]}}return{minX:0,maxX:0,minY:0,maxY:0}}};c.extend(i,[b.jsPlumbUIComponent,g],{getDimensions:function(){return[1,1]},setVisible:function(a){this._jsPlumb.div&&(this._jsPlumb.div.style.display=a?"block":"none",a&&this._jsPlumb.initiallyInvisible&&(h(this,!0),this.component.repaint(),this._jsPlumb.initiallyInvisible=!1))},clearCachedDimensions:function(){this._jsPlumb.cachedDimensions=null},cleanup:function(a){a?null!=this._jsPlumb.div&&(this._jsPlumb.div._jsPlumb=null,this._jsPlumb.instance.removeElement(this._jsPlumb.div)):(this._jsPlumb&&this._jsPlumb.div&&this._jsPlumb.div.parentNode&&this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div),this.detached=!0)},reattach:function(a){null!=this._jsPlumb.div&&a.getContainer().appendChild(this._jsPlumb.div),this.detached=!1},computeMaxSize:function(){var a=h(this);return Math.max(a[0],a[1])},paint:function(a){this._jsPlumb.initialised||(this.getElement(),a.component.appendDisplayElement(this._jsPlumb.div),this._jsPlumb.initialised=!0,this.detached&&this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div)),this._jsPlumb.div.style.left=a.component.x+a.d.minx+"px",this._jsPlumb.div.style.top=a.component.y+a.d.miny+"px"}}),b.Overlays.Custom=function(){this.type="Custom",i.apply(this,arguments)},c.extend(b.Overlays.Custom,i),b.Overlays.GuideLines=function(){var a=this;a.length=50,a.strokeWidth=5,this.type="GuideLines",g.apply(this,arguments),b.jsPlumbUIComponent.apply(this,arguments),this.draw=function(b){var c=b.pointAlongPathFrom(a.loc,a.length/2),e=b.pointOnPath(a.loc),f=d.pointOnLine(c,e,a.length),g=d.perpendicularLineTo(c,f,40),h=d.perpendicularLineTo(f,c,20);return{connector:b,head:c,tail:f,headLine:h,tailLine:g,minX:Math.min(c.x,f.x,h[0].x,h[1].x),minY:Math.min(c.y,f.y,h[0].y,h[1].y),maxX:Math.max(c.x,f.x,h[0].x,h[1].x),maxY:Math.max(c.y,f.y,h[0].y,h[1].y)}}},b.Overlays.Label=function(a){this.labelStyle=a.labelStyle,this.cssClass=null!=this.labelStyle?this.labelStyle.cssClass:null;var c=b.extend({create:function(){return b.createElement("div")}},a);if(b.Overlays.Custom.call(this,c),this.type="Label",this.label=a.label||"",this.labelText=null,this.labelStyle){var d=this.getElement();if(this.labelStyle.font=this.labelStyle.font||"12px sans-serif",d.style.font=this.labelStyle.font,d.style.color=this.labelStyle.color||"black",this.labelStyle.fill&&(d.style.background=this.labelStyle.fill),this.labelStyle.borderWidth>0){var e=this.labelStyle.borderStyle?this.labelStyle.borderStyle:"black";d.style.border=this.labelStyle.borderWidth+"px solid "+e}this.labelStyle.padding&&(d.style.padding=this.labelStyle.padding)}},c.extend(b.Overlays.Label,b.Overlays.Custom,{cleanup:function(a){a&&(this.div=null,this.label=null,this.labelText=null,this.cssClass=null,this.labelStyle=null)},getLabel:function(){return this.label},setLabel:function(a){this.label=a,this.labelText=null,this.clearCachedDimensions(),this.update(),this.component.repaint()},getDimensions:function(){return this.update(),i.prototype.getDimensions.apply(this,arguments)},update:function(){if("function"==typeof this.label){var a=this.label(this);this.getElement().innerHTML=a.replace(/\r\n/g,"<br/>")}else null==this.labelText&&(this.labelText=this.label,this.getElement().innerHTML=this.labelText.replace(/\r\n/g,"<br/>"))},updateFrom:function(a){null!=a.label&&this.setLabel(a.label)}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=function(b){var c=b._mottle;return c||(c=b._mottle=new a.Mottle),c};b.extend(a.jsPlumbInstance.prototype,{getEventManager:function(){return c(this)},on:function(){return this.getEventManager().on.apply(this,arguments),this},off:function(){return this.getEventManager().off.apply(this,arguments),this}})}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumbUtil,c=a.jsPlumbInstance,d="jtk-group-collapsed",e="jtk-group-expanded",f="[jtk-group-content]",g="elementDraggable",h="stop",i="revert",j="_groupManager",k="_jsPlumbGroup",l="_jsPlumbGroupDrag",m="group:addMember",n="group:removeMember",o="group:add",p="group:remove",q="group:expand",r="group:collapse",s="groupDragStop",t="connectionMoved",u="internal.connectionDetached",v="removeAll",w="orphanAll",x="show",y="hide",z=function(a){function c(a){delete a.proxies;var c,d=i[a.id];null!=d&&(c=function(b){return b.id===a.id},b.removeWithFunction(d.connections.source,c),b.removeWithFunction(d.connections.target,c),delete i[a.id]),d=j[a.id],null!=d&&(c=function(b){return b.id===a.id},b.removeWithFunction(d.connections.source,c),b.removeWithFunction(d.connections.target,c),delete j[a.id])}function f(b,c){for(var d=b.getMembers(),e=0;e<d.length;e++)a[c?x:y](d[e],!0)}function g(b){var c=b.getMembers(),d=a.getConnections({source:c},!0),e=a.getConnections({target:c},!0),f={};b.connections.source.length=0,b.connections.target.length=0;var g=function(a){for(var c=0;c<a.length;c++)f[a[c].id]||(f[a[c].id]=!0,a[c].source._jsPlumbGroup===b?(a[c].target._jsPlumbGroup!==b&&b.connections.source.push(a[c]),i[a[c].id]=b):a[c].target._jsPlumbGroup===b&&(b.connections.target.push(a[c]),j[a[c].id]=b))};g(d),g(e)}var h={},i={},j={},l=this;a.bind("connection",function(a){null!=a.source[k]&&null!=a.target[k]&&a.source[k]===a.target[k]?(i[a.connection.id]=a.source[k],j[a.connection.id]=a.source[k]):(null!=a.source[k]&&(b.suggest(a.source[k].connections.source,a.connection),i[a.connection.id]=a.source[k]),null!=a.target[k]&&(b.suggest(a.target[k].connections.target,a.connection),j[a.connection.id]=a.target[k]))}),a.bind(u,function(a){c(a.connection)}),a.bind(t,function(a){var b=0===a.index?i:j,c=b[a.connection.id];if(c){var d=c.connections[0===a.index?"source":"target"],e=d.indexOf(a.connection);-1!==e&&d.splice(e,1)}}),this.addGroup=function(b){a.addClass(b.getEl(),e),h[b.id]=b,b.manager=this,g(b),a.fire(o,{group:b})},this.addToGroup=function(b,c,d){if(b=this.getGroup(b)){var e=b.getEl();if(c._isJsPlumbGroup)return;var f=c._jsPlumbGroup;if(f!==b){var g=a.getOffset(c,!0),h=b.collapsed?a.getOffset(e,!0):a.getOffset(b.getDragArea(),!0);null!=f&&(f.remove(c,d),l.updateConnectionsForGroup(f)),b.add(c,d);var i=function(a,c){var d=0===c?1:0;a.each(function(a){a.setVisible(!1),a.endpoints[d].element._jsPlumbGroup===b?(a.endpoints[d].setVisible(!1),l.expandConnection(a,d,b)):(a.endpoints[c].setVisible(!1),l.collapseConnection(a,c,b))})};b.collapsed&&(i(a.select({source:c}),0),i(a.select({target:c}),1));var j=a.getId(c);a.dragManager.setParent(c,j,e,a.getId(e),g);var k={left:g.left-h.left,top:g.top-h.top};a.setPosition(c,k),a.dragManager.revalidateParent(c,j,g),l.updateConnectionsForGroup(b),a.revalidate(j),setTimeout(function(){a.fire(m,{group:b,el:c})},0)}}},this.removeFromGroup=function(a,b,c){a=this.getGroup(a),a&&a.remove(b,null,c)},this.getGroup=function(a){var c=a;if(b.isString(a)&&(c=h[a],null==c))throw new TypeError("No such group ["+a+"]");return c},this.getGroups=function(){var a=[];for(var b in h)a.push(h[b]);return a},this.removeGroup=function(b,c,d,e){b=this.getGroup(b),this.expandGroup(b,!0),b[c?v:w](d,e),a.remove(b.getEl()),delete h[b.id],delete a._groups[b.id],a.fire(p,{group:b})},this.removeAllGroups=function(a,b,c){for(var d in h)this.removeGroup(h[d],a,b,c)};var n=this.collapseConnection=function(b,c,d){var e,f=d.getEl(),g=a.getId(f),h=b.endpoints[c].elementId,i=b.endpoints[0===c?1:0].element;i[k]&&!i[k].shouldProxy()&&i[k].collapsed||(b.proxies=b.proxies||[],e=b.proxies[c]?b.proxies[c].ep:a.addEndpoint(f,{endpoint:d.getEndpoint(b,c),anchor:d.getAnchor(b,c),parameters:{isProxyEndpoint:!0}}),e.setDeleteOnEmpty(!0),b.proxies[c]={ep:e,originalEp:b.endpoints[c]},0===c?a.anchorManager.sourceChanged(h,g,b,f):(a.anchorManager.updateOtherEndpoint(b.endpoints[0].elementId,h,g,b),b.target=f,b.targetId=g),b.proxies[c].originalEp.detachFromConnection(b,null,!0),e.connections=[b],b.endpoints[c]=e,b.setVisible(!0))};this.collapseGroup=function(b){if(b=this.getGroup(b),null!=b&&!b.collapsed){var c=b.getEl();if(f(b,!1),b.shouldProxy()){var g=function(a,c){for(var d=0;d<a.length;d++){var e=a[d];n(e,c,b)}};g(b.connections.source,0),g(b.connections.target,1)}b.collapsed=!0,a.removeClass(c,e),a.addClass(c,d),a.revalidate(c),a.fire(r,{group:b})}};var s=this.expandConnection=function(b,c,d){if(null!=b.proxies&&null!=b.proxies[c]){var e=a.getId(d.getEl()),f=b.proxies[c].originalEp.element,g=b.proxies[c].originalEp.elementId;b.endpoints[c]=b.proxies[c].originalEp,0===c?a.anchorManager.sourceChanged(e,g,b,f):(a.anchorManager.updateOtherEndpoint(b.endpoints[0].elementId,e,g,b),b.target=f,b.targetId=g),b.proxies[c].ep.detachFromConnection(b,null),b.proxies[c].originalEp.addConnection(b),delete b.proxies[c]}};this.expandGroup=function(b,c){if(b=this.getGroup(b),null!=b&&b.collapsed){var g=b.getEl();if(f(b,!0),b.shouldProxy()){var h=function(a,c){for(var d=0;d<a.length;d++){var e=a[d];s(e,c,b)}};h(b.connections.source,0),h(b.connections.target,1)}b.collapsed=!1,a.addClass(g,e),a.removeClass(g,d),a.revalidate(g),this.repaintGroup(b),c||a.fire(q,{group:b})}},this.repaintGroup=function(b){b=this.getGroup(b);for(var c=b.getMembers(),d=0;d<c.length;d++)a.revalidate(c[d])},this.updateConnectionsForGroup=g,this.refreshAllGroups=function(){for(var b in h)g(h[b]),a.dragManager.updateOffsets(a.getId(h[b].getEl()))}},A=function(c,d){function e(a){return a.offsetParent}function j(a,b){var d=e(a),f=c.getSize(d),g=c.getSize(a),h=b[0],i=h+g[0],j=b[1],k=j+g[1];return i>0&&h<f[0]&&k>0&&j<f[1]}function o(a){var b=c.getId(a),d=c.getOffset(a);a.parentNode.removeChild(a),c.getContainer().appendChild(a),c.setPosition(a,d),delete a._jsPlumbGroup,r(a),c.dragManager.clearParent(a,b)}function p(a){if(!j(a.el,a.pos)){var b=a.el._jsPlumbGroup;B?c.remove(a.el):o(a.el),b.remove(a.el)}}function q(a){var b=c.getId(a);c.revalidate(a),c.dragManager.revalidateParent(a,b)}function r(a){a._katavorioDrag&&((B||A)&&a._katavorioDrag.off(h,p),B||A||!z||(a._katavorioDrag.off(i,q),a._katavorioDrag.setRevert(null)))}function t(a){a._katavorioDrag&&((B||A)&&a._katavorioDrag.on(h,p),y&&a._katavorioDrag.setConstrain(!0),x&&a._katavorioDrag.setUseGhostProxy(!0),B||A||!z||(a._katavorioDrag.on(i,q),a._katavorioDrag.setRevert(function(a,b){return!j(a,b)})))}var u=this,v=d.el;this.getEl=function(){return v},this.id=d.id||b.uuid(),v._isJsPlumbGroup=!0;var w=this.getDragArea=function(){var a=c.getSelector(v,f);return a&&a.length>0?a[0]:v},x=d.ghost===!0,y=x||d.constrain===!0,z=d.revert!==!1,A=d.orphan===!0,B=d.prune===!0,C=d.dropOverride===!0,D=d.proxied!==!1,E=[];if(this.connections={source:[],target:[],internal:[]},this.getAnchor=function(){return d.anchor||"Continuous"},this.getEndpoint=function(){return d.endpoint||["Dot",{radius:10}]},this.collapsed=!1,d.draggable!==!1){var F={stop:function(a){c.fire(s,jsPlumb.extend(a,{group:u}))},scope:l};d.dragOptions&&a.jsPlumb.extend(F,d.dragOptions),c.draggable(d.el,F)}d.droppable!==!1&&c.droppable(d.el,{drop:function(a){var b=a.drag.el;if(!b._isJsPlumbGroup){var d=b._jsPlumbGroup;if(d!==u){if(null!=d&&d.overrideDrop(b,u))return;c.getGroupManager().addToGroup(u,b,!1)}}}});var G=function(a,b){for(var c=null==a.nodeType?a:[a],d=0;d<c.length;d++)b(c[d])};this.overrideDrop=function(){return C&&(z||B||A)},this.add=function(a,b){var d=w();G(a,function(a){if(null!=a._jsPlumbGroup){if(a._jsPlumbGroup===u)return;a._jsPlumbGroup.remove(a,!0,b,!1)}a._jsPlumbGroup=u,E.push(a),c.isAlreadyDraggable(a)&&t(a),a.parentNode!==d&&d.appendChild(a),b||c.fire(m,{group:u,el:a})}),c.getGroupManager().updateConnectionsForGroup(u)},this.remove=function(a,d,e,f){G(a,function(a){if(delete a._jsPlumbGroup,b.removeWithFunction(E,function(b){return b===a}),d)try{u.getDragArea().removeChild(a)}catch(f){jsPlumbUtil.log("Could not remove element from Group "+f)}r(a),e||c.fire(n,{group:u,el:a})}),f||c.getGroupManager().updateConnectionsForGroup(u)},this.removeAll=function(a,b){for(var d=0,e=E.length;e>d;d++)u.remove(E[0],a,b,!0);E.length=0,c.getGroupManager().updateConnectionsForGroup(u)},this.orphanAll=function(){for(var a=0;a<E.length;a++)o(E[a]);E.length=0},this.getMembers=function(){return E},v[k]=this,c.bind(g,function(a){a.el._jsPlumbGroup===this&&t(a.el)}.bind(this)),this.shouldProxy=function(){return D},c.getGroupManager().addGroup(this)};c.prototype.addGroup=function(a){var b=this;if(b._groups=b._groups||{},null!=b._groups[a.id])throw new TypeError("cannot create Group ["+a.id+"]; a Group with that ID exists");if(null!=a.el[k])throw new TypeError("cannot create Group ["+a.id+"]; the given element is already a Group");var c=new A(b,a);return b._groups[c.id]=c,a.collapsed&&this.collapseGroup(c),c},c.prototype.addToGroup=function(a,b,c){var d=function(b){var d=this.getId(b);this.manage(d,b),this.getGroupManager().addToGroup(a,b,c)}.bind(this);if(Array.isArray(b))for(var e=0;e<b.length;e++)d(b[e]);else d(b)},c.prototype.removeFromGroup=function(a,b,c){this.getGroupManager().removeFromGroup(a,b,c)},c.prototype.removeGroup=function(a,b,c,d){this.getGroupManager().removeGroup(a,b,c,d)},c.prototype.removeAllGroups=function(a,b,c){this.getGroupManager().removeAllGroups(a,b,c)},c.prototype.getGroup=function(a){return this.getGroupManager().getGroup(a)},c.prototype.getGroups=function(){return this.getGroupManager().getGroups()},c.prototype.expandGroup=function(a){this.getGroupManager().expandGroup(a)},c.prototype.collapseGroup=function(a){this.getGroupManager().collapseGroup(a)},c.prototype.repaintGroup=function(a){this.getGroupManager().repaintGroup(a)},c.prototype.toggleGroup=function(a){a=this.getGroupManager().getGroup(a),null!=a&&this.getGroupManager()[a.collapsed?"expandGroup":"collapseGroup"](a)},c.prototype.getGroupManager=function(){var a=this[j];return null==a&&(a=this[j]=new z(this)),a},c.prototype.removeGroupManager=function(){delete this[j]},c.prototype.getGroupFor=function(a){return a=this.getElement(a),a?a[k]:void 0}}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=function(a){this.type="Flowchart",a=a||{},a.stub=null==a.stub?30:a.stub;var c,d,e=b.Connectors.AbstractConnector.apply(this,arguments),f=null==a.midpoint?.5:a.midpoint,g=a.alwaysRespectStubs===!0,h=null,i=null,j=null!=a.cornerRadius?a.cornerRadius:0,k=(a.loopbackRadius||25,function(a){return 0>a?-1:0===a?0:1}),l=function(a,b,c,d){if(h!==b||i!==c){var e=null==h?d.sx:h,f=null==i?d.sy:i,g=e===b?"v":"h",j=k(b-e),l=k(c-f);h=b,i=c,a.push([e,f,b,c,g,j,l])}},m=function(a){return Math.sqrt(Math.pow(a[0]-a[2],2)+Math.pow(a[1]-a[3],2))},n=function(a){var b=[];return b.push.apply(b,a),b},o=function(a,b,c){for(var d,f=null,g=0;g<b.length-1;g++){if(f=f||n(b[g]),d=n(b[g+1]),j>0&&f[4]!==d[4]){var h=Math.min(j,m(f),m(d));f[2]-=f[5]*h,f[3]-=f[6]*h,d[0]+=d[5]*h,d[1]+=d[6]*h;var i=f[6]===d[5]&&1===d[5]||f[6]===d[5]&&0===d[5]&&f[5]!==d[6]||f[6]===d[5]&&-1===d[5],k=d[1]>f[3]?1:-1,l=d[0]>f[2]?1:-1,o=k===l,p=o&&i||!o&&!i?d[0]:f[2],q=o&&i||!o&&!i?f[3]:d[1];e.addSegment(a,"Straight",{x1:f[0],y1:f[1],x2:f[2],y2:f[3]}),e.addSegment(a,"Arc",{r:h,x1:f[2],y1:f[3],x2:d[0],y2:d[1],cx:p,cy:q,ac:i})}else{var r=f[2]===f[0]?0:f[2]>f[0]?c.lw/2:-(c.lw/2),s=f[3]===f[1]?0:f[3]>f[1]?c.lw/2:-(c.lw/2);e.addSegment(a,"Straight",{x1:f[0]-r,y1:f[1]-s,x2:f[2]+r,y2:f[3]+s})}f=d}null!=d&&e.addSegment(a,"Straight",{x1:d[0],y1:d[1],x2:d[2],y2:d[3]})};this._compute=function(a,b){c=[],h=null,i=null,d=null;var j=function(){return[a.startStubX,a.startStubY,a.endStubX,a.endStubY]},k={perpendicular:j,orthogonal:j,opposite:function(b){var c=a,d="x"===b?0:1,e={x:function(){return 1===c.so[d]&&(c.startStubX>c.endStubX&&c.tx>c.startStubX||c.sx>c.endStubX&&c.tx>c.sx)||-1===c.so[d]&&(c.startStubX<c.endStubX&&c.tx<c.startStubX||c.sx<c.endStubX&&c.tx<c.sx)},y:function(){return 1===c.so[d]&&(c.startStubY>c.endStubY&&c.ty>c.startStubY||c.sy>c.endStubY&&c.ty>c.sy)||-1===c.so[d]&&(c.startStubY<c.endStubY&&c.ty<c.startStubY||c.sy<c.endStubY&&c.ty<c.sy)}};return!g&&e[b]()?{x:[(a.sx+a.tx)/2,a.startStubY,(a.sx+a.tx)/2,a.endStubY],y:[a.startStubX,(a.sy+a.ty)/2,a.endStubX,(a.sy+a.ty)/2]}[b]:[a.startStubX,a.startStubY,a.endStubX,a.endStubY]}},m=k[a.anchorOrientation](a.sourceAxis),n="x"===a.sourceAxis?0:1,p="x"===a.sourceAxis?1:0,q=m[n],r=m[p],s=m[n+2],t=m[p+2];l(c,m[0],m[1],a);var u=a.startStubX+(a.endStubX-a.startStubX)*f,v=a.startStubY+(a.endStubY-a.startStubY)*f,w={x:[0,1],y:[1,0]},x={perpendicular:function(b){var c=a,d={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]},e={x:[[c.startStubX,c.endStubX],null,[c.endStubX,c.startStubX]],y:[[c.startStubY,c.endStubY],null,[c.endStubY,c.startStubY]]},f={x:[[u,c.startStubY],[u,c.endStubY]],y:[[c.startStubX,v],[c.endStubX,v]]},g={x:[[c.endStubX,c.startStubY]],y:[[c.startStubX,c.endStubY]]},h={x:[[c.startStubX,c.endStubY],[c.endStubX,c.endStubY]],y:[[c.endStubX,c.startStubY],[c.endStubX,c.endStubY]]},i={x:[[c.startStubX,v],[c.endStubX,v],[c.endStubX,c.endStubY]],y:[[u,c.startStubY],[u,c.endStubY],[c.endStubX,c.endStubY]]},j={x:[c.startStubY,c.endStubY],y:[c.startStubX,c.endStubX]},k=w[b][0],l=w[b][1],m=c.so[k]+1,n=c.to[l]+1,o=-1===c.to[l]&&j[b][1]<j[b][0]||1===c.to[l]&&j[b][1]>j[b][0],p=e[b][m][0],q=e[b][m][1],r=d[b][m][n];return c.segment===r[3]||c.segment===r[2]&&o?f[b]:c.segment===r[2]&&p>q?g[b]:c.segment===r[2]&&q>=p||c.segment===r[1]&&!o?i[b]:c.segment===r[0]||c.segment===r[1]&&o?h[b]:void 0},orthogonal:function(b,c,d,e,f){var g=a,h={x:-1===g.so[0]?Math.min(c,e):Math.max(c,e),y:-1===g.so[1]?Math.min(c,e):Math.max(c,e)}[b];return{x:[[h,d],[h,f],[e,f]],y:[[d,h],[f,h],[f,e]]}[b]},opposite:function(c,d,f,g){var h=a,i={x:"y",y:"x"}[c],j={x:"height",y:"width"}[c],k=h["is"+c.toUpperCase()+"GreaterThanStubTimes2"];if(b.sourceEndpoint.elementId===b.targetEndpoint.elementId){var l=f+(1-b.sourceEndpoint.anchor[i])*b.sourceInfo[j]+e.maxStub;return{x:[[d,l],[g,l]],y:[[l,d],[l,g]]}[c]}return!k||1===h.so[n]&&d>g||-1===h.so[n]&&g>d?{x:[[d,v],[g,v]],y:[[u,d],[u,g]]}[c]:1===h.so[n]&&g>d||-1===h.so[n]&&d>g?{x:[[u,h.sy],[u,h.ty]],y:[[h.sx,v],[h.tx,v]]}[c]:void 0}},y=x[a.anchorOrientation](a.sourceAxis,q,r,s,t);if(y)for(var z=0;z<y.length;z++)l(c,y[z][0],y[z][1],a);l(c,m[2],m[3],a),l(c,a.tx,a.ty,a),o(this,c,a)}};c.extend(d,b.Connectors.AbstractConnector),b.registerConnectorType(d,"Flowchart")}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil;b.Connectors.AbstractBezierConnector=function(a){a=a||{};var c,d=a.showLoopback!==!1,e=(a.curviness||10,a.margin||5),f=(a.proximityLimit||80,a.orientation&&"clockwise"===a.orientation),g=a.loopbackRadius||25,h=!1;return this.overrideSetEditable=function(){return!h},this._compute=function(a,b){var i=b.sourcePos,j=b.targetPos,k=Math.abs(i[0]-j[0]),l=Math.abs(i[1]-j[1]);if(d&&b.sourceEndpoint.elementId===b.targetEndpoint.elementId){h=!0;var m=b.sourcePos[0],n=b.sourcePos[1]-e,o=m,p=n-g,q=o-g,r=p-g;k=2*g,l=2*g,a.points[0]=q,a.points[1]=r,a.points[2]=k,a.points[3]=l,c.addSegment(this,"Arc",{loopback:!0,x1:m-q+4,y1:n-r,startAngle:0,endAngle:2*Math.PI,r:g,ac:!f,x2:m-q-4,y2:n-r,cx:o-q,cy:p-r})}else h=!1,this._computeBezier(a,b,i,j,k,l)},c=b.Connectors.AbstractConnector.apply(this,arguments)},c.extend(b.Connectors.AbstractBezierConnector,b.Connectors.AbstractConnector);var d=function(a){a=a||{},this.type="Bezier";var c=b.Connectors.AbstractBezierConnector.apply(this,arguments),d=a.curviness||150,e=10;this.getCurviness=function(){return d},this._findControlPoint=function(a,b,c,f,g,h,i){var j=h[0]!==i[0]||h[1]===i[1],k=[];return j?(0===i[0]?k.push(c[0]<b[0]?a[0]+e:a[0]-e):k.push(a[0]+d*i[0]),0===i[1]?k.push(c[1]<b[1]?a[1]+e:a[1]-e):k.push(a[1]+d*h[1])):(0===h[0]?k.push(b[0]<c[0]?a[0]+e:a[0]-e):k.push(a[0]-d*h[0]),0===h[1]?k.push(b[1]<c[1]?a[1]+e:a[1]-e):k.push(a[1]+d*i[1])),k},this._computeBezier=function(a,b,d,e,f,g){var h,i,j=this.getGeometry(),k=d[0]<e[0]?f:0,l=d[1]<e[1]?g:0,m=d[0]<e[0]?0:f,n=d[1]<e[1]?0:g;(this.hasBeenEdited()||this.isEditing())&&null!=j&&null!=j.controlPoints&&null!=j.controlPoints[0]&&null!=j.controlPoints[1]?(h=j.controlPoints[0],i=j.controlPoints[1]):(h=this._findControlPoint([k,l],d,e,b.sourceEndpoint,b.targetEndpoint,a.so,a.to),i=this._findControlPoint([m,n],e,d,b.targetEndpoint,b.sourceEndpoint,a.to,a.so)),c.setGeometry({controlPoints:[h,i]},!0),c.addSegment(this,"Bezier",{x1:k,y1:l,x2:m,y2:n,cp1x:h[0],cp1y:h[1],cp2x:i[0],cp2y:i[1]})}};c.extend(d,b.Connectors.AbstractBezierConnector),b.registerConnectorType(d,"Bezier")}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=function(a,b,c,d){return c>=a&&b>=d?1:c>=a&&d>=b?2:a>=c&&d>=b?3:4},e=function(a,b,c,d,e,f,g,h,i){return i>=h?[a,b]:1===c?d[3]<=0&&e[3]>=1?[a+(d[2]<.5?-1*f:f),b]:d[2]>=1&&e[2]<=0?[a,b+(d[3]<.5?-1*g:g)]:[a+-1*f,b+-1*g]:2===c?d[3]>=1&&e[3]<=0?[a+(d[2]<.5?-1*f:f),b]:d[2]>=1&&e[2]<=0?[a,b+(d[3]<.5?-1*g:g)]:[a+f,b+-1*g]:3===c?d[3]>=1&&e[3]<=0?[a+(d[2]<.5?-1*f:f),b]:d[2]<=0&&e[2]>=1?[a,b+(d[3]<.5?-1*g:g)]:[a+-1*f,b+-1*g]:4===c?d[3]<=0&&e[3]>=1?[a+(d[2]<.5?-1*f:f),b]:d[2]<=0&&e[2]>=1?[a,b+(d[3]<.5?-1*g:g)]:[a+f,b+-1*g]:void 0},f=function(a){a=a||{},this.type="StateMachine";var c,f=b.Connectors.AbstractBezierConnector.apply(this,arguments),g=a.curviness||10,h=a.margin||5,i=a.proximityLimit||80;a.orientation&&"clockwise"===a.orientation,this._computeBezier=function(a,b,j,k,l,m){var n=b.sourcePos[0]<b.targetPos[0]?0:l,o=b.sourcePos[1]<b.targetPos[1]?0:m,p=b.sourcePos[0]<b.targetPos[0]?l:0,q=b.sourcePos[1]<b.targetPos[1]?m:0;0===b.sourcePos[2]&&(n-=h),1===b.sourcePos[2]&&(n+=h),0===b.sourcePos[3]&&(o-=h),1===b.sourcePos[3]&&(o+=h),0===b.targetPos[2]&&(p-=h),1===b.targetPos[2]&&(p+=h),0===b.targetPos[3]&&(q-=h),1===b.targetPos[3]&&(q+=h);var r,s,t,u,v=(n+p)/2,w=(o+q)/2,x=d(n,o,p,q),y=Math.sqrt(Math.pow(p-n,2)+Math.pow(q-o,2)),z=f.getGeometry();(this.hasBeenEdited()||this.isEditing())&&null!=z?(r=z.controlPoints[0][0],t=z.controlPoints[0][1],s=z.controlPoints[1][0],u=z.controlPoints[1][1]):(c=e(v,w,x,b.sourcePos,b.targetPos,g,g,y,i),r=c[0],s=c[0],t=c[1],u=c[1],f.setGeometry({controlPoints:[c,c]},!0)),f.addSegment(this,"Bezier",{x1:p,y1:q,x2:n,y2:o,cp1x:r,cp1y:t,cp2x:s,cp2y:u})}};c.extend(f,b.Connectors.AbstractBezierConnector),b.registerConnectorType(f,"StateMachine")}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d="Straight",e=function(){this.type=d;var a=b.Connectors.AbstractConnector.apply(this,arguments);this._compute=function(b){a.addSegment(this,d,{x1:b.sx,y1:b.sy,x2:b.startStubX,y2:b.startStubY}),a.addSegment(this,d,{x1:b.startStubX,y1:b.startStubY,x2:b.endStubX,y2:b.endStubY}),a.addSegment(this,d,{x1:b.endStubX,y1:b.endStubY,x2:b.tx,y2:b.ty})}};c.extend(e,b.Connectors.AbstractConnector),b.registerConnectorType(e,d)}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d={"stroke-linejoin":"stroke-linejoin","stroke-dashoffset":"stroke-dashoffset","stroke-linecap":"stroke-linecap"},e="stroke-dasharray",f="dashstyle",g="linearGradient",h="radialGradient",i="defs",j="fill",k="stop",l="stroke",m="stroke-width",n="style",o="none",p="jsplumb_gradient_",q="strokeWidth",r={svg:"http://www.w3.org/2000/svg"},s=function(a,b){for(var c in b)a.setAttribute(c,""+b[c])},t=function(a,c){return c=c||{},c.version="1.1",c.xmlns=r.svg,b.createElementNS(r.svg,a,null,null,c)},u=function(a){return"position:absolute;left:"+a[0]+"px;top:"+a[1]+"px"},v=function(a){for(var b=a.querySelectorAll(" defs,linearGradient,radialGradient"),c=0;c<b.length;c++)b[c].parentNode.removeChild(b[c])},w=function(a,b,c,d,e){var f=p+e._jsPlumb.instance.idstamp();v(a);var m;m=c.gradient.offset?t(h,{id:f}):t(g,{id:f,gradientUnits:"userSpaceOnUse"});var n=t(i);a.appendChild(n),n.appendChild(m);for(var o=0;o<c.gradient.stops.length;o++){var q=1===e.segment||2===e.segment?o:c.gradient.stops.length-1-o,r=c.gradient.stops[q][1],s=t(k,{offset:Math.floor(100*c.gradient.stops[o][0])+"%","stop-color":r});m.appendChild(s)}var u=c.stroke?l:j;b.setAttribute(u,"url(#"+f+")")},x=function(a,b,c,g,h){if(b.setAttribute(j,c.fill?c.fill:o),b.setAttribute(l,c.stroke?c.stroke:o),c.gradient?w(a,b,c,g,h):(v(a),b.setAttribute(n,"")),c.strokeWidth&&b.setAttribute(m,c.strokeWidth),c[f]&&c[q]&&!c[e]){var i=-1===c[f].indexOf(",")?" ":",",k=c[f].split(i),p="";k.forEach(function(a){p+=Math.floor(a*c.strokeWidth)+i}),b.setAttribute(e,p)}else c[e]&&b.setAttribute(e,c[e]);for(var r in d)c[r]&&b.setAttribute(d[r],c[r])},y=function(a,b,c){a.childNodes.length>c?a.insertBefore(b,a.childNodes[c]):a.appendChild(b)};c.svg={node:t,attr:s,pos:u};var z=function(a){var d=a.pointerEventsSpec||"all",e={};b.jsPlumbUIComponent.apply(this,a.originalArgs),this.canvas=null,this.path=null,this.svg=null,this.bgCanvas=null;var f=a.cssClass+" "+(a.originalArgs[0].cssClass||""),g={style:"",width:0,height:0,"pointer-events":d,position:"absolute"};this.svg=t("svg",g),a.useDivWrapper?(this.canvas=b.createElement("div",{position:"absolute"}),c.sizeElement(this.canvas,0,0,1,1),this.canvas.className=f):(s(this.svg,{"class":f}),this.canvas=this.svg),a._jsPlumb.appendElement(this.canvas,a.originalArgs[0].parent),a.useDivWrapper&&this.canvas.appendChild(this.svg);var h=[this.canvas];return this.getDisplayElements=function(){return h},this.appendDisplayElement=function(a){h.push(a)},this.paint=function(b,d,f){if(null!=b){var g,h=[this.x,this.y],i=[this.w,this.h];null!=f&&(f.xmin<0&&(h[0]+=f.xmin),f.ymin<0&&(h[1]+=f.ymin),i[0]=f.xmax+(f.xmin<0?-f.xmin:0),i[1]=f.ymax+(f.ymin<0?-f.ymin:0)),a.useDivWrapper?(c.sizeElement(this.canvas,h[0],h[1],i[0],i[1]),h[0]=0,h[1]=0,g=u([0,0])):g=u([h[0],h[1]]),e.paint.apply(this,arguments),s(this.svg,{style:g,width:i[0]||0,height:i[1]||0})}},{renderer:e}};c.extend(z,b.jsPlumbUIComponent,{cleanup:function(a){a||null==this.typeId?(this.canvas&&(this.canvas._jsPlumb=null),this.svg&&(this.svg._jsPlumb=null),this.bgCanvas&&(this.bgCanvas._jsPlumb=null),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.bgCanvas&&this.bgCanvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.svg=null,this.canvas=null,this.path=null,this.group=null):(this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.bgCanvas&&this.bgCanvas.parentNode&&this.bgCanvas.parentNode.removeChild(this.bgCanvas))},reattach:function(a){var b=a.getContainer();this.canvas&&null==this.canvas.parentNode&&b.appendChild(this.canvas),this.bgCanvas&&null==this.bgCanvas.parentNode&&b.appendChild(this.bgCanvas)},setVisible:function(a){this.canvas&&(this.canvas.style.display=a?"block":"none")}}),b.ConnectorRenderers.svg=function(a){var c=this,d=z.apply(this,[{cssClass:a._jsPlumb.connectorClass+(this.isEditable()?" "+a._jsPlumb.editableConnectorClass:""),originalArgs:arguments,pointerEventsSpec:"none",_jsPlumb:a._jsPlumb}]),e=this.setEditable;this.setEditable=function(a){var c=e.apply(this,[a]);b[c?"addClass":"removeClass"](this.canvas,this._jsPlumb.instance.editableConnectorClass)},d.renderer.paint=function(d,e,f){var g=c.getSegments(),h="",i=[0,0];if(f.xmin<0&&(i[0]=-f.xmin),f.ymin<0&&(i[1]=-f.ymin),g.length>0){h=c.getPathData();var j={d:h,transform:"translate("+i[0]+","+i[1]+")","pointer-events":a["pointer-events"]||"visibleStroke"},k=null,l=[c.x,c.y,c.w,c.h];if(d.outlineStroke){var m=d.outlineWidth||1,n=d.strokeWidth+2*m;k=b.extend({},d),delete k.gradient,k.stroke=d.outlineStroke,k.strokeWidth=n,null==c.bgPath?(c.bgPath=t("path",j),b.addClass(c.bgPath,b.connectorOutlineClass),y(c.svg,c.bgPath,0)):s(c.bgPath,j),x(c.svg,c.bgPath,k,l,c)}null==c.path?(c.path=t("path",j),y(c.svg,c.path,d.outlineStroke?1:0)):s(c.path,j),x(c.svg,c.path,d,l,c)}}},c.extend(b.ConnectorRenderers.svg,z);var A=b.SvgEndpoint=function(a){var c=z.apply(this,[{cssClass:a._jsPlumb.endpointClass,originalArgs:arguments,pointerEventsSpec:"all",useDivWrapper:!0,_jsPlumb:a._jsPlumb}]);c.renderer.paint=function(a){var c=b.extend({},a);c.outlineStroke&&(c.stroke=c.outlineStroke),null==this.node?(this.node=this.makeNode(c),this.svg.appendChild(this.node)):null!=this.updateNode&&this.updateNode(this.node),x(this.svg,this.node,c,[this.x,this.y,this.w,this.h],this),u(this.node,[this.x,this.y])}.bind(this)};c.extend(A,z),b.Endpoints.svg.Dot=function(){b.Endpoints.Dot.apply(this,arguments),A.apply(this,arguments),this.makeNode=function(){return t("circle",{cx:this.w/2,cy:this.h/2,r:this.radius})},this.updateNode=function(a){s(a,{cx:this.w/2,cy:this.h/2,r:this.radius})}},c.extend(b.Endpoints.svg.Dot,[b.Endpoints.Dot,A]),b.Endpoints.svg.Rectangle=function(){b.Endpoints.Rectangle.apply(this,arguments),A.apply(this,arguments),this.makeNode=function(){return t("rect",{width:this.w,height:this.h})},this.updateNode=function(a){s(a,{width:this.w,height:this.h})}},c.extend(b.Endpoints.svg.Rectangle,[b.Endpoints.Rectangle,A]),b.Endpoints.svg.Image=b.Endpoints.Image,b.Endpoints.svg.Blank=b.Endpoints.Blank,b.Overlays.svg.Label=b.Overlays.Label,b.Overlays.svg.Custom=b.Overlays.Custom;var B=function(a,c){a.apply(this,c),b.jsPlumbUIComponent.apply(this,c),this.isAppendedAtTopLevel=!1,this.path=null,this.paint=function(a,b){if(a.component.svg&&b){null==this.path&&(this.path=t("path",{"pointer-events":"all"}),a.component.svg.appendChild(this.path),this.elementCreated&&this.elementCreated(this.path,a.component),this.canvas=a.component.svg);var e=c&&1===c.length?c[0].cssClass||"":"",f=[0,0];b.xmin<0&&(f[0]=-b.xmin),b.ymin<0&&(f[1]=-b.ymin),s(this.path,{d:d(a.d),"class":e,stroke:a.stroke?a.stroke:null,fill:a.fill?a.fill:null,transform:"translate("+f[0]+","+f[1]+")"})}};var d=function(a){return isNaN(a.cxy.x)||isNaN(a.cxy.y)?"":"M"+a.hxy.x+","+a.hxy.y+" L"+a.tail[0].x+","+a.tail[0].y+" L"+a.cxy.x+","+a.cxy.y+" L"+a.tail[1].x+","+a.tail[1].y+" L"+a.hxy.x+","+a.hxy.y};this.transfer=function(a){a.canvas&&this.path&&this.path.parentNode&&(this.path.parentNode.removeChild(this.path),a.canvas.appendChild(this.path))}};c.extend(B,[b.jsPlumbUIComponent,b.Overlays.AbstractOverlay],{cleanup:function(a){null!=this.path&&(a?this._jsPlumb.instance.removeElement(this.path):this.path.parentNode&&this.path.parentNode.removeChild(this.path))},reattach:function(a,b){this.path&&b.canvas&&b.canvas.appendChild(this.path)},setVisible:function(a){null!=this.path&&(this.path.style.display=a?"block":"none")}}),b.Overlays.svg.Arrow=function(){B.apply(this,[b.Overlays.Arrow,arguments])},c.extend(b.Overlays.svg.Arrow,[b.Overlays.Arrow,B]),b.Overlays.svg.PlainArrow=function(){B.apply(this,[b.Overlays.PlainArrow,arguments])},c.extend(b.Overlays.svg.PlainArrow,[b.Overlays.PlainArrow,B]),b.Overlays.svg.Diamond=function(){B.apply(this,[b.Overlays.Diamond,arguments])},c.extend(b.Overlays.svg.Diamond,[b.Overlays.Diamond,B]),b.Overlays.svg.GuideLines=function(){var a,c,d=null,e=this;b.Overlays.GuideLines.apply(this,arguments),this.paint=function(b,g){null==d&&(d=t("path"),b.connector.svg.appendChild(d),e.attachListeners(d,b.connector),e.attachListeners(d,e),a=t("path"),b.connector.svg.appendChild(a),e.attachListeners(a,b.connector),e.attachListeners(a,e),c=t("path"),b.connector.svg.appendChild(c),e.attachListeners(c,b.connector),e.attachListeners(c,e));var h=[0,0];g.xmin<0&&(h[0]=-g.xmin),g.ymin<0&&(h[1]=-g.ymin),s(d,{d:f(b.head,b.tail),stroke:"red",fill:null,transform:"translate("+h[0]+","+h[1]+")"}),s(a,{d:f(b.tailLine[0],b.tailLine[1]),stroke:"blue",fill:null,transform:"translate("+h[0]+","+h[1]+")"}),s(c,{d:f(b.headLine[0],b.headLine[1]),stroke:"green",fill:null,transform:"translate("+h[0]+","+h[1]+")"})};var f=function(a,b){return"M "+a.x+","+a.y+" L"+b.x+","+b.y}},c.extend(b.Overlays.svg.GuideLines,b.Overlays.GuideLines)}.call("undefined"!=typeof window?window:this),function(){"use strict";var a=this,b=a.jsPlumb,c=a.jsPlumbUtil,d=a.Katavorio,e=a.Biltong,f=function(a,c){c=c||"main";
+var f="_katavorio_"+c,g=a[f],h=a.getEventManager();return g||(g=new d({bind:h.on,unbind:h.off,getSize:b.getSize,getPosition:function(b,c){var d=a.getOffset(b,c,b._katavorioDrag?b.offsetParent:null);return[d.left,d.top]},setPosition:function(a,b){a.style.left=b[0]+"px",a.style.top=b[1]+"px"},addClass:b.addClass,removeClass:b.removeClass,intersects:e.intersects,indexOf:function(a,b){return a.indexOf(b)},scope:a.getDefaultScope(),css:{noSelect:a.dragSelectClass,droppable:"jtk-droppable",draggable:"jtk-draggable",drag:"jtk-drag",selected:"jtk-drag-selected",active:"jtk-drag-active",hover:"jtk-drag-hover",ghostProxy:"jtk-ghost-proxy"}}),g.setZoom(a.getZoom()),a[f]=g,a.bind("zoom",g.setZoom)),g},g=function(a,b){var d=function(d){if(null!=b[d]){if(c.isString(b[d])){var e=b[d].match(/-=/)?-1:1,f=b[d].substring(2);return a[d]+e*f}return b[d]}return a[d]};return[d("left"),d("top")]};b.extend(a.jsPlumbInstance.prototype,{animationSupported:!0,getElement:function(a){return null==a?null:(a="string"==typeof a?a:null!=a.length&&null==a.enctype?a[0]:a,"string"==typeof a?document.getElementById(a):a)},removeElement:function(a){f(this).elementRemoved(a),this.getEventManager().remove(a)},doAnimate:function(a,c,d){d=d||{};var e=this.getOffset(a),f=g(e,c),h=f[0]-e.left,i=f[1]-e.top,j=d.duration||250,k=15,l=j/k,m=k/j*h,n=k/j*i,o=0,p=setInterval(function(){b.setPosition(a,{left:e.left+m*(o+1),top:e.top+n*(o+1)}),null!=d.step&&d.step(o,Math.ceil(l)),o++,o>=l&&(window.clearInterval(p),null!=d.complete&&d.complete())},k)},destroyDraggable:function(a,b){f(this,b).destroyDraggable(a)},destroyDroppable:function(a,b){f(this,b).destroyDroppable(a)},initDraggable:function(a,b,c){f(this,c).draggable(a,b)},initDroppable:function(a,b,c){f(this,c).droppable(a,b)},isAlreadyDraggable:function(a){return null!=a._katavorioDrag},isDragSupported:function(){return!0},isDropSupported:function(){return!0},isElementDraggable:function(a){return a=b.getElement(a),a._katavorioDrag&&a._katavorioDrag.isEnabled()},getDragObject:function(a){return a[0].drag.getDragElement()},getDragScope:function(a){return a._katavorioDrag&&a._katavorioDrag.scopes.join(" ")||""},getDropEvent:function(a){return a[0].e},getUIPosition:function(a){var b=a[0].el;if(null==b.offsetParent)return null;var c=a[0].finalPos||a[0].pos,d={left:c[0],top:c[1]};if(b._katavorioDrag&&b.offsetParent!==this.getContainer()){var e=this.getOffset(b.offsetParent);d.left+=e.left,d.top+=e.top}return d},setDragFilter:function(a,b,c){a._katavorioDrag&&a._katavorioDrag.setFilter(b,c)},setElementDraggable:function(a,c){a=b.getElement(a),a._katavorioDrag&&a._katavorioDrag.setEnabled(c)},setDragScope:function(a,b){a._katavorioDrag&&a._katavorioDrag.k.setDragScope(a,b)},setDropScope:function(a,b){a._katavorioDrop&&a._katavorioDrop.length>0&&a._katavorioDrop[0].k.setDropScope(a,b)},addToPosse:function(a){var c=Array.prototype.slice.call(arguments,1),d=f(this);b.each(a,function(a){a=[b.getElement(a)],a.push.apply(a,c),d.addToPosse.apply(d,a)})},setPosse:function(a){var c=Array.prototype.slice.call(arguments,1),d=f(this);b.each(a,function(a){a=[b.getElement(a)],a.push.apply(a,c),d.setPosse.apply(d,a)})},removeFromPosse:function(a){var c=Array.prototype.slice.call(arguments,1),d=f(this);b.each(a,function(a){a=[b.getElement(a)],a.push.apply(a,c),d.removeFromPosse.apply(d,a)})},removeFromAllPosses:function(a){var c=f(this);b.each(a,function(a){c.removeFromAllPosses(b.getElement(a))})},setPosseState:function(a,c,d){var e=f(this);b.each(a,function(a){e.setPosseState(b.getElement(a),c,d)})},dragEvents:{start:"start",stop:"stop",drag:"drag",step:"step",over:"over",out:"out",drop:"drop",complete:"complete",beforeStart:"beforeStart"},animEvents:{step:"step",complete:"complete"},stopDrag:function(a){a._katavorioDrag&&a._katavorioDrag.abort()},addToDragSelection:function(a){f(this).select(a)},removeFromDragSelection:function(a){f(this).deselect(a)},clearDragSelection:function(){f(this).deselectAll()},trigger:function(a,b,c,d){this.getEventManager().trigger(a,b,c,d)},doReset:function(){for(var a in this)0===a.indexOf("_katavorio_")&&this[a].reset()}});var h=function(a){var b=function(){/complete|loaded|interactive/.test(document.readyState)&&"undefined"!=typeof document.body&&null!=document.body?a():setTimeout(b,9)};b()};h(b.init)}.call("undefined"!=typeof window?window:this);
\ No newline at end of file

From 5e7d72d901ac48f4aeb8d10ab3ddf3d7fa5a492d Mon Sep 17 00:00:00 2001
From: danielyxie <danielyxie@gmail.com>
Date: Mon, 25 Sep 2017 07:50:19 -0500
Subject: [PATCH 3/6] More work on Hacking Missions

---
 css/missions.css |   16 +-
 css/styles.css   |    2 +-
 dist/bundle.js   | 2072 +++++++++++++++++++++++++++-------------------
 src/Faction.js   |    2 +-
 src/Missions.js  |  508 ++++++++++--
 src/Player.js    |    4 +-
 src/Server.js    |    2 +-
 src/engine.js    |    7 +-
 8 files changed, 1675 insertions(+), 938 deletions(-)

diff --git a/css/missions.css b/css/missions.css
index 5b1377185..4a5052378 100644
--- a/css/missions.css
+++ b/css/missions.css
@@ -4,12 +4,13 @@
 
 .hack-mission-grid {
     display: grid;
-    grid-template-columns: 7% 7% 7% 7% 7% 7% 7% 7%;
-    grid-template-rows: 7% 7% 7% 7% 7% 7% 7% 7%;
-    grid-gap: 3%;
+    grid-template-columns: 10% 10% 10% 10% 10% 10% 10% 10%;
+    grid-template-rows: 8% 8% 8% 8% 8% 8% 8% 8%;
+    grid-gap: 2.5%;
     height: 100%;
     position:fixed;
     width: 100%;
+    overflow-y:auto;
 }
 
 .hack-mission-node {
@@ -18,6 +19,7 @@
     background-color:gray;
     align-self: center;
     justify-self: center;
+    display:inline-block;
 }
 
 .hack-mission-node p {
@@ -28,7 +30,7 @@
 }
 
 .hack-mission-player-node {
-    color:blue;
+    color:white;
     background-color:blue;
 }
 
@@ -53,13 +55,13 @@
 }
 
 .hack-mission-firewall-node {
-    width:100%;
-    height:75%;
+    width:90%;
+    height:100%;
 }
 
 .hack-mission-database-node {
     width: 100%;
-	height: 75%;
+	height: 90%;
 	-webkit-transform: skew(20deg);
 	-moz-transform: skew(20deg);
 	-o-transform: skew(20deg);
diff --git a/css/styles.css b/css/styles.css
index 7a2d26478..db1ba27d7 100644
--- a/css/styles.css
+++ b/css/styles.css
@@ -200,7 +200,7 @@ a:link, a:visited {
     left: 101%;
 
     position: absolute;
-    z-index: 3;
+    z-index: 99;
 }
 
 .tooltip:hover .tooltiptext {
diff --git a/dist/bundle.js b/dist/bundle.js
index 9b35587d6..afec863d3 100644
--- a/dist/bundle.js
+++ b/dist/bundle.js
@@ -1310,7 +1310,9 @@ PlayerObject.prototype.finishCreateProgramWork = function(cancelled, sing=false)
         this.getHomeComputer().programs.push(incompleteName);
     }
 
-    this.gainIntelligenceExp(this.createProgramReqLvl / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].IntelligenceProgramBaseExpGain);
+    if (!cancelled) {
+        this.gainIntelligenceExp(this.createProgramReqLvl / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].IntelligenceProgramBaseExpGain);
+    }
 
     var mainMenu = document.getElementById("mainmenu-container");
     mainMenu.style.visibility = "visible";
@@ -3674,21 +3676,23 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Gang_js__ = __webpack_require__(30);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__ = __webpack_require__(34);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__InteractiveTutorial_js__ = __webpack_require__(24);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__Literature_js__ = __webpack_require__(42);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__Literature_js__ = __webpack_require__(43);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__Message_js__ = __webpack_require__(22);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__NetscriptFunctions_js__ = __webpack_require__(29);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__NetscriptWorker_js__ = __webpack_require__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__Prestige_js__ = __webpack_require__(32);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__RedPill_js__ = __webpack_require__(43);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__SaveObject_js__ = __webpack_require__(68);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__Script_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__Settings_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__SourceFile_js__ = __webpack_require__(31);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__SpecialServerIps_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__StockMarket_js__ = __webpack_require__(26);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__Terminal_js__ = __webpack_require__(20);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__Missions_js__ = __webpack_require__(38);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__NetscriptFunctions_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__NetscriptWorker_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__Prestige_js__ = __webpack_require__(32);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__RedPill_js__ = __webpack_require__(44);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__ = __webpack_require__(68);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__Script_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__Settings_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__SourceFile_js__ = __webpack_require__(31);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__SpecialServerIps_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__StockMarket_js__ = __webpack_require__(26);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__Terminal_js__ = __webpack_require__(20);
+
 
 
 
@@ -3741,7 +3745,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  *  Alt-o - Options
  */
 $(document).keydown(function(e) {
-    if (!__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].isWorking && !__WEBPACK_IMPORTED_MODULE_23__RedPill_js__["b" /* redPillFlag */]) {
+    if (!__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].isWorking && !__WEBPACK_IMPORTED_MODULE_24__RedPill_js__["b" /* redPillFlag */] && !__WEBPACK_IMPORTED_MODULE_19__Missions_js__["c" /* inMission */]) {
         if (e.keyCode == 84 && e.altKey) {
             e.preventDefault();
             Engine.loadTerminalContent();
@@ -3909,7 +3913,7 @@ let Engine = {
             editor.setValue(code);
         }
         editor.focus();
-        Object(__WEBPACK_IMPORTED_MODULE_25__Script_js__["f" /* updateScriptEditorContent */])();
+        Object(__WEBPACK_IMPORTED_MODULE_26__Script_js__["f" /* updateScriptEditorContent */])();
         Engine.currentPage = Engine.Page.ScriptEditor;
         document.getElementById("create-script-menu-link").classList.add("active");
     },
@@ -3984,24 +3988,24 @@ let Engine = {
     },
 
     loadTravelContent: function() {
-        switch(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].city) {
+        switch(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].city) {
             case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Aevum:
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].AevumTravelAgency;
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].AevumTravelAgency;
                 break;
             case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Chongqing:
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].ChongqingTravelAgency;
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].ChongqingTravelAgency;
                 break;
             case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Sector12:
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Sector12TravelAgency;
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Sector12TravelAgency;
                 break;
             case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].NewTokyo:
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].NewTokyoTravelAgency;
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].NewTokyoTravelAgency;
                 break;
             case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Ishima:
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].IshimaTravelAgency;
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].IshimaTravelAgency;
                 break;
             case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Volhaven:
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].VolhavenTravelAgency;
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].VolhavenTravelAgency;
                 break;
             default:
                 Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: Invalid city. This is a bug please contact game dev");
@@ -4011,12 +4015,12 @@ let Engine = {
     },
 
     loadJobContent: function() {
-        if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].companyName == "") {
+        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyName == "") {
             Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You do not currently have a job! You can visit various companies " +
                             "in the city and try to find a job.");
             return;
         }
-        __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].companyName;
+        __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyName;
         Engine.loadLocationContent();
     },
 
@@ -4045,13 +4049,13 @@ let Engine = {
     loadStockMarketContent: function() {
         Engine.hideAllContent();
         Engine.Display.stockMarketContent.style.visibility = "visible";
-        Object(__WEBPACK_IMPORTED_MODULE_30__StockMarket_js__["c" /* displayStockMarketContent */])();
+        Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["c" /* displayStockMarketContent */])();
         Engine.currentPage = Engine.Page.StockMarket;
     },
 
     loadGangContent: function() {
         Engine.hideAllContent();
-        if (document.getElementById("gang-container") || __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].inGang()) {
+        if (document.getElementById("gang-container") || __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].inGang()) {
             Object(__WEBPACK_IMPORTED_MODULE_14__Gang_js__["c" /* displayGangContent */])();
             Engine.currentPage = Engine.Page.Gang;
         } else {
@@ -4114,29 +4118,29 @@ let Engine = {
     },
 
     displayCharacterOverviewInfo: function() {
-        if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hp == null) {__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hp = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].max_hp;}
-        if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].intelligence >= 1) {
+        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hp == null) {__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hp = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].max_hp;}
+        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].intelligence >= 1) {
             document.getElementById("character-overview-text").innerHTML =
-            ("Hp:    " + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hp + " / " + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].max_hp + "<br>" +
-             "Money: " + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].money.toNumber()).format('($0.000a)') + "<br>" +
-             "Hack:  " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_skill).toLocaleString() + "<br>" +
-             "Str:   " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].strength).toLocaleString() + "<br>" +
-             "Def:   " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].defense).toLocaleString() + "<br>" +
-             "Dex:   " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].dexterity).toLocaleString() + "<br>" +
-             "Agi:   " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].agility).toLocaleString() + "<br>" +
-             "Cha:   " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].charisma).toLocaleString() + "<br>" +
-             "Int:   " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].intelligence).toLocaleString()
+            ("Hp:    " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hp + " / " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].max_hp + "<br>" +
+             "Money: " + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].money.toNumber()).format('($0.000a)') + "<br>" +
+             "Hack:  " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_skill).toLocaleString() + "<br>" +
+             "Str:   " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength).toLocaleString() + "<br>" +
+             "Def:   " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense).toLocaleString() + "<br>" +
+             "Dex:   " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity).toLocaleString() + "<br>" +
+             "Agi:   " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility).toLocaleString() + "<br>" +
+             "Cha:   " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma).toLocaleString() + "<br>" +
+             "Int:   " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].intelligence).toLocaleString()
             ).replace( / /g, "&nbsp;" );
         } else {
             document.getElementById("character-overview-text").innerHTML =
-            ("Hp:    " + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hp + " / " + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].max_hp + "<br>" +
-             "Money: " + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].money.toNumber()).format('($0.000a)') + "<br>" +
-             "Hack:  " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_skill).toLocaleString() + "<br>" +
-             "Str:   " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].strength).toLocaleString() + "<br>" +
-             "Def:   " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].defense).toLocaleString() + "<br>" +
-             "Dex:   " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].dexterity).toLocaleString() + "<br>" +
-             "Agi:   " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].agility).toLocaleString() + "<br>" +
-             "Cha:   " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].charisma).toLocaleString()
+            ("Hp:    " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hp + " / " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].max_hp + "<br>" +
+             "Money: " + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].money.toNumber()).format('($0.000a)') + "<br>" +
+             "Hack:  " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_skill).toLocaleString() + "<br>" +
+             "Str:   " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength).toLocaleString() + "<br>" +
+             "Def:   " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense).toLocaleString() + "<br>" +
+             "Dex:   " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity).toLocaleString() + "<br>" +
+             "Agi:   " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility).toLocaleString() + "<br>" +
+             "Cha:   " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma).toLocaleString()
             ).replace( / /g, "&nbsp;" );
         }
     },
@@ -4144,61 +4148,61 @@ let Engine = {
     /* Display character info */
     displayCharacterInfo: function() {
         var companyPosition = "";
-        if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].companyPosition != "") {
-            companyPosition = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].companyPosition.positionName;
+        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyPosition != "") {
+            companyPosition = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyPosition.positionName;
         }
         Engine.Display.characterInfo.innerHTML =
        ('<b>General</b><br><br>' +
-        'Current City: ' + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].city + '<br><br>' +
-        'Employer: ' + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].companyName + '<br>' +
+        'Current City: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].city + '<br><br>' +
+        'Employer: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyName + '<br>' +
         'Job Title: ' + companyPosition + '<br><br>' +
-        'Money: $' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].money.toNumber(), 2)+ '<br><br><br>' +
+        'Money: $' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].money.toNumber(), 2)+ '<br><br><br>' +
         '<b>Stats</b><br><br>' +
-        'Hacking Level: ' + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_skill).toLocaleString() +
-                        " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_exp).format('(0.000a)') + ' experience)<br>' +
-        'Strength:      ' + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].strength).toLocaleString() +
-                   " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].strength_exp).format('(0.000a)') + ' experience)<br>' +
-        'Defense:       ' + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].defense).toLocaleString() +
-                  " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].defense_exp).format('(0.000a)')+ ' experience)<br>' +
-        'Dexterity:     ' + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].dexterity).toLocaleString() +
-                   " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].dexterity_exp).format('(0.000a)') + ' experience)<br>' +
-        'Agility:       ' + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].agility).toLocaleString() +
-                  " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].agility_exp).format('(0.000a)') + ' experience)<br>' +
-        'Charisma:      ' + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].charisma).toLocaleString() +
-                   " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].charisma_exp).format('(0.000a)') + ' experience)<br><br><br>' +
+        'Hacking Level: ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_skill).toLocaleString() +
+                        " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_exp).format('(0.000a)') + ' experience)<br>' +
+        'Strength:      ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength).toLocaleString() +
+                   " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength_exp).format('(0.000a)') + ' experience)<br>' +
+        'Defense:       ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense).toLocaleString() +
+                  " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense_exp).format('(0.000a)')+ ' experience)<br>' +
+        'Dexterity:     ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity).toLocaleString() +
+                   " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity_exp).format('(0.000a)') + ' experience)<br>' +
+        'Agility:       ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility).toLocaleString() +
+                  " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility_exp).format('(0.000a)') + ' experience)<br>' +
+        'Charisma:      ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma).toLocaleString() +
+                   " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma_exp).format('(0.000a)') + ' experience)<br><br><br>' +
         '<b>Multipliers</b><br><br>' +
-        'Hacking Chance multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_chance_mult * 100, 2) + '%<br>' +
-        'Hacking Speed multiplier:  ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_speed_mult * 100, 2) + '%<br>' +
-        'Hacking Money multiplier:  ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_money_mult * 100, 2) + '%<br>' +
-        'Hacking Growth multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_grow_mult * 100, 2) + '%<br><br>' +
-        'Hacking Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_mult * 100, 2) + '%<br>' +
-        'Hacking Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_exp_mult * 100, 2) + '%<br><br>' +
-        'Strength Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].strength_mult * 100, 2) + '%<br>' +
-        'Strength Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].strength_exp_mult * 100, 2) + '%<br><br>' +
-        'Defense Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].defense_mult * 100, 2) + '%<br>' +
-        'Defense Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].defense_exp_mult * 100, 2) + '%<br><br>' +
-        'Dexterity Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].dexterity_mult * 100, 2) + '%<br>' +
-        'Dexterity Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].dexterity_exp_mult * 100, 2) + '%<br><br>' +
-        'Agility Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].agility_mult * 100, 2) + '%<br>' +
-        'Agility Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].agility_exp_mult * 100, 2) + '%<br><br>' +
-        'Charisma Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].charisma_mult * 100, 2) + '%<br>' +
-        'Charisma Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].charisma_exp_mult * 100, 2) + '%<br><br>' +
-        'Hacknet Node production multiplier:         ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacknet_node_money_mult * 100, 2) + '%<br>' +
-        'Hacknet Node purchase cost multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacknet_node_purchase_cost_mult * 100, 2) + '%<br>' +
-        'Hacknet Node RAM upgrade cost multiplier:   ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacknet_node_ram_cost_mult * 100, 2) + '%<br>' +
-        'Hacknet Node Core purchase cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacknet_node_core_cost_mult * 100, 2) + '%<br>' +
-        'Hacknet Node level upgrade cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacknet_node_level_cost_mult * 100, 2) + '%<br><br>' +
-        'Company reputation gain multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].company_rep_mult * 100, 2) + '%<br>' +
-        'Faction reputation gain multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].faction_rep_mult * 100, 2) + '%<br>' +
-        'Salary multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].work_money_mult * 100, 2) + '%<br>' +
-        'Crime success multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].crime_success_mult * 100, 2) + '%<br>' +
-        'Crime money multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].crime_money_mult * 100, 2) + '%<br><br><br>' +
+        'Hacking Chance multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_chance_mult * 100, 2) + '%<br>' +
+        'Hacking Speed multiplier:  ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_speed_mult * 100, 2) + '%<br>' +
+        'Hacking Money multiplier:  ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_money_mult * 100, 2) + '%<br>' +
+        'Hacking Growth multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_grow_mult * 100, 2) + '%<br><br>' +
+        'Hacking Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_mult * 100, 2) + '%<br>' +
+        'Hacking Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_exp_mult * 100, 2) + '%<br><br>' +
+        'Strength Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength_mult * 100, 2) + '%<br>' +
+        'Strength Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength_exp_mult * 100, 2) + '%<br><br>' +
+        'Defense Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense_mult * 100, 2) + '%<br>' +
+        'Defense Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense_exp_mult * 100, 2) + '%<br><br>' +
+        'Dexterity Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity_mult * 100, 2) + '%<br>' +
+        'Dexterity Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity_exp_mult * 100, 2) + '%<br><br>' +
+        'Agility Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility_mult * 100, 2) + '%<br>' +
+        'Agility Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility_exp_mult * 100, 2) + '%<br><br>' +
+        'Charisma Level multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma_mult * 100, 2) + '%<br>' +
+        'Charisma Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma_exp_mult * 100, 2) + '%<br><br>' +
+        'Hacknet Node production multiplier:         ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknet_node_money_mult * 100, 2) + '%<br>' +
+        'Hacknet Node purchase cost multiplier:      ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknet_node_purchase_cost_mult * 100, 2) + '%<br>' +
+        'Hacknet Node RAM upgrade cost multiplier:   ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknet_node_ram_cost_mult * 100, 2) + '%<br>' +
+        'Hacknet Node Core purchase cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknet_node_core_cost_mult * 100, 2) + '%<br>' +
+        'Hacknet Node level upgrade cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknet_node_level_cost_mult * 100, 2) + '%<br><br>' +
+        'Company reputation gain multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].company_rep_mult * 100, 2) + '%<br>' +
+        'Faction reputation gain multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].faction_rep_mult * 100, 2) + '%<br>' +
+        'Salary multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].work_money_mult * 100, 2) + '%<br>' +
+        'Crime success multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].crime_success_mult * 100, 2) + '%<br>' +
+        'Crime money multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].crime_money_mult * 100, 2) + '%<br><br><br>' +
         '<b>Misc</b><br><br>' +
-        'Servers owned:       ' + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].purchasedServers.length + '<br>' +
-        'Hacknet Nodes owned: ' + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacknetNodes.length + '<br>' +
-        'Augmentations installed: ' + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].augmentations.length + '<br>' +
-        'Time played since last Augmentation: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].playtimeSinceLastAug) + '<br>' +
-        'Time played: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].totalPlaytime) + '<br><br><br>').replace( / /g, "&nbsp;" );
+        'Servers owned:       ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].purchasedServers.length + '<br>' +
+        'Hacknet Nodes owned: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknetNodes.length + '<br>' +
+        'Augmentations installed: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].augmentations.length + '<br>' +
+        'Time played since last Augmentation: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug) + '<br>' +
+        'Time played: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime) + '<br><br><br>').replace( / /g, "&nbsp;" );
     },
 
     /* Display locations in the world*/
@@ -4217,9 +4221,9 @@ let Engine = {
         Engine.ishimaLocationsList.style.display = "none";
         Engine.volhavenLocationsList.style.display = "none";
 
-        document.getElementById("world-city-name").innerHTML = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].city;
+        document.getElementById("world-city-name").innerHTML = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].city;
         var cityDesc = document.getElementById("world-city-desc"); //TODO
-        switch(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].city) {
+        switch(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].city) {
             case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Aevum:
                 Engine.aevumLocationsList.style.display = "inline";
                 break;
@@ -4254,9 +4258,9 @@ let Engine = {
         }
 
         //Re-add a link for each faction you are a member of
-        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].factions.length; ++i) {
+        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factions.length; ++i) {
             (function () {
-                var factionName = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].factions[i];
+                var factionName = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factions[i];
 
                 //Add the faction to the Factions page content
                 var item = document.createElement("li");
@@ -4280,9 +4284,9 @@ let Engine = {
         }
 
         //Add a link to accept for each faction you have invitiations for
-        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].factionInvitations.length; ++i) {
+        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factionInvitations.length; ++i) {
             (function () {
-                var factionName = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].factionInvitations[i];
+                var factionName = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factionInvitations[i];
 
                 var item = document.createElement("li");
 
@@ -4300,9 +4304,9 @@ let Engine = {
                 aElem.style.padding = "4px";
                 aElem.addEventListener("click", function() {
                     Object(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["h" /* joinFaction */])(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["b" /* Factions */][factionName]);
-                    for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].factionInvitations.length; ++i) {
-                        if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].factionInvitations[i] == factionName) {
-                            __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].factionInvitations.splice(i, 1);
+                    for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factionInvitations.length; ++i) {
+                        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factionInvitations[i] == factionName) {
+                            __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factionInvitations.splice(i, 1);
                             break;
                         }
                     }
@@ -4327,8 +4331,8 @@ let Engine = {
             queuedAugmentationsList.removeChild(queuedAugmentationsList.firstChild);
         }
 
-        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].queuedAugmentations.length; ++i) {
-            var augName = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].queuedAugmentations[i].name;
+        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].queuedAugmentations.length; ++i) {
+            var augName = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].queuedAugmentations[i].name;
             var aug = __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["c" /* Augmentations */][augName];
 
             var item = document.createElement("li");
@@ -4338,7 +4342,7 @@ let Engine = {
             item.setAttribute("class", "installed-augmentation");
             hElem.innerHTML = augName;
             if (augName == __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
-                hElem.innerHTML += " - Level " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].queuedAugmentations[i].level);
+                hElem.innerHTML += " - Level " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].queuedAugmentations[i].level);
             }
             pElem.innerHTML = aug.info;
 
@@ -4363,11 +4367,11 @@ let Engine = {
         }
 
         //Source Files - Temporary...Will probably put in a separate pane Later
-        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
-            var srcFileKey = "SourceFile" + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].sourceFiles[i].n;
-            var sourceFileObject = __WEBPACK_IMPORTED_MODULE_28__SourceFile_js__["b" /* SourceFiles */][srcFileKey];
+        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
+            var srcFileKey = "SourceFile" + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].sourceFiles[i].n;
+            var sourceFileObject = __WEBPACK_IMPORTED_MODULE_29__SourceFile_js__["b" /* SourceFiles */][srcFileKey];
             if (sourceFileObject == null) {
-                console.log("ERROR: Invalid source file number: " + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].sourceFiles[i].n);
+                console.log("ERROR: Invalid source file number: " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].sourceFiles[i].n);
                 continue;
             }
             var item = document.createElement("li");
@@ -4376,7 +4380,7 @@ let Engine = {
 
             item.setAttribute("class", "installed-augmentation");
             hElem.innerHTML = sourceFileObject.name + "<br>";
-            hElem.innerHTML += "Level " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].sourceFiles[i].lvl) + " / 3";
+            hElem.innerHTML += "Level " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].sourceFiles[i].lvl) + " / 3";
             pElem.innerHTML = sourceFileObject.info;
 
             item.appendChild(hElem);
@@ -4385,8 +4389,8 @@ let Engine = {
             augmentationsList.appendChild(item);
         }
 
-        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].augmentations.length; ++i) {
-            var augName = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].augmentations[i].name;
+        for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].augmentations.length; ++i) {
+            var augName = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].augmentations[i].name;
             var aug = __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["c" /* Augmentations */][augName];
 
             var item = document.createElement("li");
@@ -4396,7 +4400,7 @@ let Engine = {
             item.setAttribute("class", "installed-augmentation");
             hElem.innerHTML = augName;
             if (augName == __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
-                hElem.innerHTML += " - Level " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].augmentations[i].level);
+                hElem.innerHTML += " - Level " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].augmentations[i].level);
             }
             pElem.innerHTML = aug.info;
 
@@ -4454,7 +4458,7 @@ let Engine = {
         if (diff > 0) {
             //Update the game engine by the calculated number of cycles
             Engine._lastUpdate = _thisUpdate - offset;
-            __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].lastUpdate = _thisUpdate - offset;
+            __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].lastUpdate = _thisUpdate - offset;
             Engine.updateGame(diff);
         }
 
@@ -4464,42 +4468,46 @@ let Engine = {
     updateGame: function(numCycles = 1) {
         //Update total playtime
         var time = numCycles * Engine._idleSpeed;
-        if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].totalPlaytime == null) {__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].totalPlaytime = 0;}
-        if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].playtimeSinceLastAug == null) {__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].playtimeSinceLastAug = 0;}
-        __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].totalPlaytime += time;
-        __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].playtimeSinceLastAug += time;
+        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime == null) {__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime = 0;}
+        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug == null) {__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug = 0;}
+        __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime += time;
+        __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug += time;
 
         //Start Manual hack
-        if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].startAction == true) {
-            Engine._totalActionTime = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].actionTime;
-            Engine._actionTimeLeft = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].actionTime;
+        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].startAction == true) {
+            Engine._totalActionTime = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].actionTime;
+            Engine._actionTimeLeft = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].actionTime;
             Engine._actionInProgress = true;
             Engine._actionProgressBarCount = 1;
             Engine._actionProgressStr = "[                                                  ]";
             Engine._actionTimeStr = "Time left: ";
-            __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].startAction = false;
+            __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].startAction = false;
         }
 
         //Working
-        if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].isWorking) {
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workForFaction(numCycles);
-            } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].createProgramWork(numCycles);
-            } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].takeClass(numCycles);
-            } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].commitCrime(numCycles);
-            } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workPartTime(numCycles);
+        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].isWorking) {
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workForFaction(numCycles);
+            } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].createProgramWork(numCycles);
+            } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].takeClass(numCycles);
+            } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].commitCrime(numCycles);
+            } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workPartTime(numCycles);
             } else {
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].work(numCycles);
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].work(numCycles);
             }
         }
 
         //Gang, if applicable
-        if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].inGang()) {
-            __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].gang.process(numCycles);
+        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].inGang()) {
+            __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].gang.process(numCycles);
+        }
+
+        if (__WEBPACK_IMPORTED_MODULE_19__Missions_js__["c" /* inMission */] && __WEBPACK_IMPORTED_MODULE_19__Missions_js__["b" /* currMission */]) {
+            __WEBPACK_IMPORTED_MODULE_19__Missions_js__["b" /* currMission */].process(numCycles);
         }
 
         //Counters
@@ -4512,7 +4520,7 @@ let Engine = {
         }
 
         //Update the running time of all active scripts
-        Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptWorker_js__["g" /* updateOnlineScriptTimes */])(numCycles);
+        Object(__WEBPACK_IMPORTED_MODULE_21__NetscriptWorker_js__["g" /* updateOnlineScriptTimes */])(numCycles);
 
         //Hacknet Nodes
         Object(__WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__["c" /* processAllHacknetNodeEarnings */])(numCycles);
@@ -4547,12 +4555,12 @@ let Engine = {
     //is necessary and then resets the counter
     checkCounters: function() {
         if (Engine.Counters.autoSaveCounter <= 0) {
-            __WEBPACK_IMPORTED_MODULE_24__SaveObject_js__["b" /* saveObject */].saveGame();
+            __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].saveGame();
             Engine.Counters.autoSaveCounter = 300;
         }
 
         if (Engine.Counters.updateSkillLevelsCounter <= 0) {
-            __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].updateSkillLevels();
+            __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].updateSkillLevels();
             Engine.Counters.updateSkillLevelsCounter = 10;
         }
 
@@ -4601,10 +4609,10 @@ let Engine = {
         }
 
         if (Engine.Counters.checkFactionInvitations <= 0) {
-            var invitedFactions = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].checkForFactionInvitations();
+            var invitedFactions = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].checkForFactionInvitations();
             if (invitedFactions.length > 0) {
-                if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstFacInvRecvd === false) {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstFacInvRecvd = true;
+                if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstFacInvRecvd === false) {
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstFacInvRecvd = true;
                     document.getElementById("factions-tab").style.display = "list-item";
                     document.getElementById("character-menu-header").click();
                     document.getElementById("character-menu-header").click();
@@ -4632,23 +4640,23 @@ let Engine = {
         }
 
         if (Engine.Counters.stockTick <= 0) {
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hasWseAccount) {
-                Object(__WEBPACK_IMPORTED_MODULE_30__StockMarket_js__["k" /* updateStockPrices */])();
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hasWseAccount) {
+                Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["k" /* updateStockPrices */])();
             }
             Engine.Counters.stockTick = 30;
         }
 
         if (Engine.Counters.sCr <= 0) {
             //Assume 4Sig will always indicate state of market
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hasWseAccount) {
-                Object(__WEBPACK_IMPORTED_MODULE_30__StockMarket_js__["i" /* stockMarketCycle */])();
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hasWseAccount) {
+                Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["i" /* stockMarketCycle */])();
             }
             Engine.Counters.sCr = 1500;
         }
 
         if (Engine.Counters.updateScriptEditorDisplay <= 0) {
             if (Engine.currentPage == Engine.Page.ScriptEditor) {
-                Object(__WEBPACK_IMPORTED_MODULE_25__Script_js__["f" /* updateScriptEditorContent */])();
+                Object(__WEBPACK_IMPORTED_MODULE_26__Script_js__["f" /* updateScriptEditorContent */])();
             }
             Engine.Counters.updateScriptEditorDisplay = 5;
         }
@@ -4685,7 +4693,7 @@ let Engine = {
         //Once percent is 100, the hack is completed
         if (percent >= 100) {
             Engine._actionInProgress = false;
-            __WEBPACK_IMPORTED_MODULE_31__Terminal_js__["a" /* Terminal */].finishAction();
+            __WEBPACK_IMPORTED_MODULE_32__Terminal_js__["a" /* Terminal */].finishAction();
         }
     },
 
@@ -4780,44 +4788,44 @@ let Engine = {
         var options             = document.getElementById("options-tab");
 
         //Load game from save or create new game
-        if (Object(__WEBPACK_IMPORTED_MODULE_24__SaveObject_js__["a" /* loadGame */])(__WEBPACK_IMPORTED_MODULE_24__SaveObject_js__["b" /* saveObject */])) {
+        if (Object(__WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["a" /* loadGame */])(__WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */])) {
             console.log("Loaded game from save");
             Object(__WEBPACK_IMPORTED_MODULE_8__BitNode_js__["d" /* initBitNodes */])();
             Object(__WEBPACK_IMPORTED_MODULE_8__BitNode_js__["c" /* initBitNodeMultipliers */])();
-            Object(__WEBPACK_IMPORTED_MODULE_28__SourceFile_js__["d" /* initSourceFiles */])();
+            Object(__WEBPACK_IMPORTED_MODULE_29__SourceFile_js__["d" /* initSourceFiles */])();
             Engine.setDisplayElements();    //Sets variables for important DOM elements
             Engine.init();                  //Initialize buttons, work, etc.
             __WEBPACK_IMPORTED_MODULE_9__Company_js__["d" /* CompanyPositions */].init();
             Object(__WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["g" /* initAugmentations */])();            //Also calls Player.reapplyAllAugmentations()
-            __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].reapplyAllSourceFiles();
-            Object(__WEBPACK_IMPORTED_MODULE_30__StockMarket_js__["e" /* initStockSymbols */])();
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hasWseAccount) {
-                Object(__WEBPACK_IMPORTED_MODULE_30__StockMarket_js__["f" /* initSymbolToStockMap */])();
+            __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].reapplyAllSourceFiles();
+            Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["e" /* initStockSymbols */])();
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hasWseAccount) {
+                Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["f" /* initSymbolToStockMap */])();
             }
             Object(__WEBPACK_IMPORTED_MODULE_17__Literature_js__["a" /* initLiterature */])();
-            Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptFunctions_js__["c" /* initSingularitySFFlags */])();
+            Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptFunctions_js__["c" /* initSingularitySFFlags */])();
 
             //Calculate the number of cycles have elapsed while offline
             Engine._lastUpdate = new Date().getTime();
-            var lastUpdate = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].lastUpdate;
+            var lastUpdate = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].lastUpdate;
             var numCyclesOffline = Math.floor((Engine._lastUpdate - lastUpdate) / Engine._idleSpeed);
 
             /* Process offline progress */
-            var offlineProductionFromScripts = Object(__WEBPACK_IMPORTED_MODULE_25__Script_js__["e" /* loadAllRunningScripts */])();    //This also takes care of offline production for those scripts
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].isWorking) {
+            var offlineProductionFromScripts = Object(__WEBPACK_IMPORTED_MODULE_26__Script_js__["e" /* loadAllRunningScripts */])();    //This also takes care of offline production for those scripts
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].isWorking) {
                 console.log("work() called in load() for " + numCyclesOffline * Engine._idleSpeed + " milliseconds");
-                if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workForFaction(numCyclesOffline);
-                } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].createProgramWork(numCyclesOffline);
-                } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].takeClass(numCyclesOffline);
-                } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].commitCrime(numCyclesOffline);
-                } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workPartTime(numCyclesOffline);
+                if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workForFaction(numCyclesOffline);
+                } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].createProgramWork(numCyclesOffline);
+                } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].takeClass(numCyclesOffline);
+                } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].commitCrime(numCyclesOffline);
+                } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workPartTime(numCyclesOffline);
                 } else {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].work(numCyclesOffline);
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].work(numCyclesOffline);
                 }
             }
 
@@ -4828,18 +4836,18 @@ let Engine = {
             Object(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["j" /* processPassiveFactionRepGain */])(numCyclesOffline);
 
             //Gang progress for BitNode 2
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].bitNodeN != null && __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].bitNodeN === 2 && __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].inGang()) {
-                __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].gang.process(numCyclesOffline);
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].bitNodeN != null && __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].bitNodeN === 2 && __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].inGang()) {
+                __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].gang.process(numCyclesOffline);
             }
 
             //Update total playtime
             var time = numCyclesOffline * Engine._idleSpeed;
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].totalPlaytime == null) {__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].totalPlaytime = 0;}
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].playtimeSinceLastAug == null) {__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].playtimeSinceLastAug = 0;}
-            __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].totalPlaytime += time;
-            __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].playtimeSinceLastAug += time;
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime == null) {__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime = 0;}
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug == null) {__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug = 0;}
+            __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime += time;
+            __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug += time;
 
-            __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].lastUpdate = Engine._lastUpdate;
+            __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].lastUpdate = Engine._lastUpdate;
             Engine.start();                 //Run main game loop and Scripts loop
             Engine.removeLoadingScreen();
             Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])("While you were offline, your scripts generated $" +
@@ -4848,15 +4856,15 @@ let Engine = {
             //Close main menu accordions for loaded game
             var visibleMenuTabs = [terminal, createScript, activeScripts, stats,
                                    hacknetnodes, city, tutorial, options];
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstFacInvRecvd) {visibleMenuTabs.push(factions);}
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstFacInvRecvd) {visibleMenuTabs.push(factions);}
             else {factions.style.display = "none";}
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstAugPurchased) {visibleMenuTabs.push(augmentations);}
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstAugPurchased) {visibleMenuTabs.push(augmentations);}
             else {augmentations.style.display = "none";}
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstJobRecvd) {visibleMenuTabs.push(job);}
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstJobRecvd) {visibleMenuTabs.push(job);}
             else {job.style.display = "none";}
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstTimeTraveled) {visibleMenuTabs.push(travel);}
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstTimeTraveled) {visibleMenuTabs.push(travel);}
             else {travel.style.display = "none";}
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstProgramAvailable) {visibleMenuTabs.push(createProgram);}
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstProgramAvailable) {visibleMenuTabs.push(createProgram);}
             else {createProgram.style.display = "none";}
 
             Engine.closeMainMenuHeader(visibleMenuTabs);
@@ -4865,20 +4873,20 @@ let Engine = {
             console.log("Initializing new game");
             Object(__WEBPACK_IMPORTED_MODULE_8__BitNode_js__["d" /* initBitNodes */])();
             Object(__WEBPACK_IMPORTED_MODULE_8__BitNode_js__["c" /* initBitNodeMultipliers */])();
-            Object(__WEBPACK_IMPORTED_MODULE_28__SourceFile_js__["d" /* initSourceFiles */])();
-            Object(__WEBPACK_IMPORTED_MODULE_29__SpecialServerIps_js__["c" /* initSpecialServerIps */])();
+            Object(__WEBPACK_IMPORTED_MODULE_29__SourceFile_js__["d" /* initSourceFiles */])();
+            Object(__WEBPACK_IMPORTED_MODULE_30__SpecialServerIps_js__["c" /* initSpecialServerIps */])();
             Engine.setDisplayElements();        //Sets variables for important DOM elements
             Engine.start();                     //Run main game loop and Scripts loop
-            __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].init();
-            Object(__WEBPACK_IMPORTED_MODULE_26__Server_js__["f" /* initForeignServers */])();
+            __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].init();
+            Object(__WEBPACK_IMPORTED_MODULE_27__Server_js__["f" /* initForeignServers */])();
             Object(__WEBPACK_IMPORTED_MODULE_9__Company_js__["h" /* initCompanies */])();
             Object(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["f" /* initFactions */])();
             __WEBPACK_IMPORTED_MODULE_9__Company_js__["d" /* CompanyPositions */].init();
             Object(__WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["g" /* initAugmentations */])();
             Object(__WEBPACK_IMPORTED_MODULE_18__Message_js__["d" /* initMessages */])();
-            Object(__WEBPACK_IMPORTED_MODULE_30__StockMarket_js__["e" /* initStockSymbols */])();
+            Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["e" /* initStockSymbols */])();
             Object(__WEBPACK_IMPORTED_MODULE_17__Literature_js__["a" /* initLiterature */])();
-            Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptFunctions_js__["c" /* initSingularitySFFlags */])();
+            Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptFunctions_js__["c" /* initSingularitySFFlags */])();
 
             //Open main menu accordions for new game
             //Main menu accordions
@@ -4909,8 +4917,8 @@ let Engine = {
             Engine.removeLoadingScreen();
         }
         //Initialize labels on game settings
-        Object(__WEBPACK_IMPORTED_MODULE_27__Settings_js__["d" /* setSettingsLabels */])();
-        __WEBPACK_IMPORTED_MODULE_31__Terminal_js__["a" /* Terminal */].resetTerminalInput();
+        Object(__WEBPACK_IMPORTED_MODULE_28__Settings_js__["d" /* setSettingsLabels */])();
+        __WEBPACK_IMPORTED_MODULE_32__Terminal_js__["a" /* Terminal */].resetTerminalInput();
     },
 
     setDisplayElements: function() {
@@ -5005,7 +5013,7 @@ let Engine = {
 
         Engine.Clickables.tutorialNetscriptButton = document.getElementById("tutorial-netscript-link");
         Engine.Clickables.tutorialNetscriptButton.addEventListener("click", function() {
-            if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].bitNodeN === 4 || __WEBPACK_IMPORTED_MODULE_19__NetscriptFunctions_js__["b" /* hasSingularitySF */]) {
+            if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].bitNodeN === 4 || __WEBPACK_IMPORTED_MODULE_20__NetscriptFunctions_js__["b" /* hasSingularitySF */]) {
                 Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialNetscriptText + __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialSingularityFunctionsText);
             } else {
                 Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialNetscriptText);
@@ -5039,7 +5047,7 @@ let Engine = {
         });
 
         //If DarkWeb already purchased, disable the button
-        if (__WEBPACK_IMPORTED_MODULE_29__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) {
+        if (__WEBPACK_IMPORTED_MODULE_30__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) {
             document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");
         }
     },
@@ -5048,7 +5056,7 @@ let Engine = {
     init: function() {
         //Import game link
         document.getElementById("import-game-link").onclick = function() {
-            __WEBPACK_IMPORTED_MODULE_24__SaveObject_js__["b" /* saveObject */].importGame();
+            __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].importGame();
         };
 
         //Main menu accordions
@@ -5228,24 +5236,24 @@ let Engine = {
         //Save, Delete, Import/Export buttons
         Engine.Clickables.saveMainMenuButton = document.getElementById("save-game-link");
         Engine.Clickables.saveMainMenuButton.addEventListener("click", function() {
-            __WEBPACK_IMPORTED_MODULE_24__SaveObject_js__["b" /* saveObject */].saveGame();
+            __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].saveGame();
             return false;
         });
 
         Engine.Clickables.deleteMainMenuButton = document.getElementById("delete-game-link");
         Engine.Clickables.deleteMainMenuButton.addEventListener("click", function() {
-            __WEBPACK_IMPORTED_MODULE_24__SaveObject_js__["b" /* saveObject */].deleteGame();
+            __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].deleteGame();
             return false;
         });
 
         document.getElementById("export-game-link").addEventListener("click", function() {
-            __WEBPACK_IMPORTED_MODULE_24__SaveObject_js__["b" /* saveObject */].exportGame();
+            __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].exportGame();
             return false;
         });
 
         //Character Overview buttons
         document.getElementById("character-overview-save-button").addEventListener("click", function() {
-            __WEBPACK_IMPORTED_MODULE_24__SaveObject_js__["b" /* saveObject */].saveGame();
+            __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].saveGame();
             return false;
         });
 
@@ -5258,25 +5266,25 @@ let Engine = {
         Object(__WEBPACK_IMPORTED_MODULE_11__CreateProgram_js__["d" /* initCreateProgramButtons */])();
 
         //Message at the top of terminal
-        Object(__WEBPACK_IMPORTED_MODULE_31__Terminal_js__["c" /* postNetburnerText */])();
+        Object(__WEBPACK_IMPORTED_MODULE_32__Terminal_js__["c" /* postNetburnerText */])();
 
         //Player was working cancel button
-        if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].isWorking) {
+        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].isWorking) {
             var cancelButton = document.getElementById("work-in-progress-cancel-button");
             cancelButton.addEventListener("click", function() {
-                if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
-                    var fac = __WEBPACK_IMPORTED_MODULE_12__Faction_js__["b" /* Factions */][__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].currentWorkFactionName];
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].finishFactionWork(true);
-                } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].finishCreateProgramWork(true);
-                } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].finishClass();
-                } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].finishCrime(true);
-                } else if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].finishWorkPartTime();
+                if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
+                    var fac = __WEBPACK_IMPORTED_MODULE_12__Faction_js__["b" /* Factions */][__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].currentWorkFactionName];
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishFactionWork(true);
+                } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishCreateProgramWork(true);
+                } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishClass();
+                } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishCrime(true);
+                } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishWorkPartTime();
                 } else {
-                    __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].finishWork(true);
+                    __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishWork(true);
                 }
             });
             Engine.loadWorkInProgressContent();
@@ -5297,7 +5305,7 @@ let Engine = {
         //DEBUG Delete active Scripts on home
         document.getElementById("debug-delete-scripts-link").addEventListener("click", function() {
             console.log("Deleting running scripts on home computer");
-            __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].getHomeComputer().runningScripts = [];
+            __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].getHomeComputer().runningScripts = [];
             Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Forcefully deleted all running scripts on home computer. Please save and refresh page");
             Object(__WEBPACK_IMPORTED_MODULE_1__utils_GameOptions_js__["a" /* gameOptionsBoxClose */])();
             return false;
@@ -5306,7 +5314,7 @@ let Engine = {
         //DEBUG Soft Reset
         document.getElementById("debug-soft-reset").addEventListener("click", function() {
             Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Soft Reset!");
-            Object(__WEBPACK_IMPORTED_MODULE_22__Prestige_js__["a" /* prestigeAugmentation */])();
+            Object(__WEBPACK_IMPORTED_MODULE_23__Prestige_js__["a" /* prestigeAugmentation */])();
             Object(__WEBPACK_IMPORTED_MODULE_1__utils_GameOptions_js__["a" /* gameOptionsBoxClose */])();
             return false;
         });
@@ -5317,7 +5325,7 @@ let Engine = {
         Engine.idleTimer();
 
         //Scripts
-        Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptWorker_js__["f" /* runScriptsLoop */])();
+        Object(__WEBPACK_IMPORTED_MODULE_21__NetscriptWorker_js__["f" /* runScriptsLoop */])();
     }
 };
 
@@ -5434,7 +5442,7 @@ Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvai
     this.moneyMax = 25 * this.moneyAvailable * __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["a" /* BitNodeMultipliers */].ServerMaxMoney;
 	this.hackDifficulty = hackDifficulty * __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["a" /* BitNodeMultipliers */].ServerStartingSecurity;
     this.baseDifficulty = hackDifficulty * __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["a" /* BitNodeMultipliers */].ServerStartingSecurity;
-    this.minDifficulty = Math.max(1, Math.round(hackDifficulty / 3));
+    this.minDifficulty = Math.max(1, Math.round(this.hackDifficulty / 3));
 	this.serverGrowth = serverGrowth;
 }
 
@@ -16682,9 +16690,9 @@ function initBitNodeMultipliers() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__BitNode_js__ = __webpack_require__(9);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__FactionInfo_js__ = __webpack_require__(46);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__FactionInfo_js__ = __webpack_require__(47);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Location_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Missions_js__ = __webpack_require__(47);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Missions_js__ = __webpack_require__(38);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Settings_js__ = __webpack_require__(13);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(1);
@@ -17163,7 +17171,7 @@ function displayFactionContent(factionName) {
     newHackMissionButton.addEventListener("click", function() {
         __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadMissionContent();
         var mission = new __WEBPACK_IMPORTED_MODULE_6__Missions_js__["a" /* HackingMission */](faction.playerReputation, faction);
-        Object(__WEBPACK_IMPORTED_MODULE_6__Missions_js__["b" /* setInMission */])(true); //Sets inMission flag to true
+        Object(__WEBPACK_IMPORTED_MODULE_6__Missions_js__["d" /* setInMission */])(true, mission); //Sets inMission flag to true
         mission.init();
         return false;
     });
@@ -17812,7 +17820,7 @@ function initSpecialServerIps() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Crimes_js__ = __webpack_require__(37);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Infiltration_js__ = __webpack_require__(44);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Infiltration_js__ = __webpack_require__(45);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__ServerPurchases_js__ = __webpack_require__(65);
@@ -24198,19 +24206,19 @@ __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].construct
 /* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return postNetburnerText; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return post; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Terminal; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(40);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(41);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__ = __webpack_require__(41);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__ = __webpack_require__(42);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__HelpText_js__ = __webpack_require__(66);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__ = __webpack_require__(24);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Literature_js__ = __webpack_require__(42);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Literature_js__ = __webpack_require__(43);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(22);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptEvaluator_js__ = __webpack_require__(33);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__ = __webpack_require__(15);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__RedPill_js__ = __webpack_require__(43);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__RedPill_js__ = __webpack_require__(44);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Script_js__ = __webpack_require__(19);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__ = __webpack_require__(11);
@@ -32812,7 +32820,7 @@ Environment.prototype = {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(18);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__ = __webpack_require__(41);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__ = __webpack_require__(42);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__engine_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__HacknetNode_js__ = __webpack_require__(34);
@@ -38183,6 +38191,965 @@ function determineCrimeChanceHeist() {
 
 /***/ }),
 /* 38 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HackingMission; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return inMission; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return setInMission; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return currMission; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
+/* 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);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_jsplumb__ = __webpack_require__(48);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_jsplumb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_jsplumb__);
+
+
+
+
+
+
+
+let inMission = false; //Flag to denote whether a mission is running
+let currMission = null;
+function setInMission(bool, mission) {
+    inMission = bool;
+    if (bool) {
+        currMission = mission;
+    } else {
+        currMission = null;
+    }
+}
+/* Hacking Missions */
+
+/*You start with N CPU nodes dependent on home computer cores
+
+Three main stats:
+    Attack - Specific to a node. Affected by hacking skill, RAM (for home comp)
+    Defense - Universal defense - summed from all nodes
+    HP - Specific to a node. Affected by hacking skill, RAM (for home comp)
+
+Enemy has the following nodes:
+    Firewall Nodes - Essentially shields. Weak attack but large def
+    CPU Nodes - Defeating and capturing these will give you new nodes to use
+    Database Node - Main Target
+
+Misc Nodes (initially not owned by player or enemy):
+    Spam nodes - Increases time limit
+    Transfer Nodes - Slightly increases attack for all of your CPUs
+    Shield Node - Increases your defense
+
+Shapes for nodes:
+    Firewall - Rectangle
+    CPU - Circle
+    Database - Parralelogram
+    Spam - Diamond
+    Transfer - Cone
+    Shield - Shield shape
+
+*/
+let NodeTypes = {
+    Core: "CPU Core Node",      //All actions available
+    Firewall: "Firewall Node",  //No actions available
+    Database: "Database Node",  //No actions available
+    Spam: "Spam Node",          //No actions Available
+    Transfer: "Transfer Node",  //Can Weaken, Scan, and Overflow
+    Shield: "Shield Node"       //Can Fortify
+}
+
+let NodeActions = {
+    Attack: "Attacking", //Damaged based on attack stat + hacking level + opp def
+    Scan: "Scanning", //-Def for target, affected by hacking level
+    Weaken: "Weakening", //-Attack for target, affected by hacking level
+    Fortify: "Fortifying", //+Defense for Node, affected by hacking level
+    Overflow: "Overflowing", //+Attack but -Defense for Node, affected by hacking level
+}
+
+function Node(type, stats) {
+    this.type = type;
+    this.atk = stats.atk ? stats.atk : 0;
+    this.def = stats.def ? stats.def : 0;
+    this.hp = stats.hp ? stats.hp : 0;
+    this.maxhp = this.hp;
+    this.plyrCtrl = false;
+    this.enmyCtrl = false;
+    this.pos = [0, 0]; //x, y
+    this.el = null; //Holds the Node's DOM element
+    this.action = null;
+
+    //Holds the JsPlumb Connection object for this Node,
+    //where this Node is the Source (since each Node
+    //can only have 1 outgoing Connection)
+    this.conn = null;
+
+}
+
+Node.prototype.setPosition = function(x, y) {
+    this.pos = [x, y];
+}
+
+Node.prototype.setControlledByPlayer = function() {
+    this.plyrCtrl = true;
+    this.enmyCtrl = false;
+    if (this.el) {
+        this.el.classList.remove("hack-mission-enemy-node");
+        this.el.classList.add("hack-mission-player-node");
+    }
+}
+
+Node.prototype.setControlledByEnemy = function() {
+    this.plyrCtrl = false;
+    this.enmyCtrl = true;
+    if (this.el) {
+        this.el.classList.remove("hack-mission-player-node");
+        this.el.classList.add("hack-mission-enemy-node");
+    }
+}
+
+//Sets this node to be the active node
+Node.prototype.select = function(actionButtons) {
+    if (this.enmyCtrl) {return;}
+    this.el.classList.add("hack-mission-player-node-active");
+
+    //Make all buttons inactive
+    for (var i = 0; i < actionButtons.length; ++i) {
+        actionButtons[i].classList.remove("a-link-button");
+        actionButtons[i].classList.add("a-link-button-inactive");
+    }
+
+    switch(this.type) {
+        case NodeTypes.Core:
+            //All buttons active
+            for (var i = 0; i < actionButtons.length; ++i) {
+                actionButtons[i].classList.remove("a-link-button-inactive");
+                actionButtons[i].classList.add("a-link-button");
+            }
+            break;
+        case NodeTypes.Transfer:
+            actionButtons[1].classList.remove("a-link-button-inactive");
+            actionButtons[1].classList.add("a-link-button");
+            actionButtons[2].classList.remove("a-link-button-inactive");
+            actionButtons[2].classList.add("a-link-button");
+            actionButtons[4].classList.remove("a-link-button-inactive");
+            actionButtons[4].classList.add("a-link-button");
+            break;
+        default:
+            break;
+    }
+}
+
+Node.prototype.deselect = function(actionButtons) {
+    this.el.classList.remove("active");
+    for (var i = 0; i < actionButtons.length; ++i) {
+        actionButtons[i].classList.remove("a-link-button");
+        actionButtons[i].classList.add("a-link-button-inactive");
+    }
+}
+
+//Hacking mission instance
+//Takes in the reputation of the Faction for which the mission is
+//being conducted
+function HackingMission(rep, fac) {
+    this.faction = fac;
+
+    this.playerCores = [];
+    this.playerNodes = []; //Non-core nodes
+    this.playerDef = 0;
+
+    this.enemyCores = [];
+    this.enemyDatabases = [];
+    this.enemyNodes = []; //Non-core nodes
+    this.enemyDef = 0;
+
+    this.miscNodes = [];
+
+    this.selectedNode = null; //Which of the player's nodes is currently selected
+
+    this.actionButtons = []; //DOM buttons for actions
+
+    this.availablePositions = [];
+    for (var r = 0; r < 8; ++r) {
+        for (var c = 0; c < 8; ++c) {
+            this.availablePositions.push([r, c]);
+        }
+    }
+
+    this.map = [];
+    for (var i = 0; i < 8; ++i) {
+        this.map.push([null, null, null, null, null, null, null, null]);
+    }
+
+    this.jsplumbinstance = null;
+
+    //difficulty capped at 16
+    this.difficulty = Math.min(16, Math.round(rep / __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToDiffConversion) + 1);
+    console.log("difficulty: " + this.difficulty);
+    this.reward = 200 + (rep / __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToRewardConversion);
+}
+
+HackingMission.prototype.init = function() {
+    //Create Header DOM
+    this.createPageDom();
+
+    //Create player starting nodes
+    var home = __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].getHomeComputer()
+    for (var i = 0; i < home.cpuCores; ++i) {
+        var stats = {
+            atk: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 10),
+            def: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 25),
+            hp: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 5),
+        };
+        this.playerCores.push(new Node(NodeTypes.Core, stats));
+        this.playerCores[i].setControlledByPlayer();
+        this.setNodePosition(this.playerCores[i], 0, i);
+        this.removeAvailablePosition(0, i);
+    }
+
+    //Randomly generate enemy nodes (CPU and Firewall) based on difficulty
+    var numNodes = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 2);
+    var numFirewalls = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 5);
+    var numDatabases = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 1);
+    var totalNodes = numNodes + numFirewalls + numDatabases;
+    var xlimit = 7 - Math.floor(totalNodes / 8);
+    console.log("numNodes: " + numNodes);
+    console.log("numFirewalls: " + numFirewalls);
+    console.log("numDatabases: " + numDatabases);
+    console.log("totalNodes: " + totalNodes);
+    var randMult = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
+    for (var i = 0; i < numNodes; ++i) {
+        var stats = {
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(100, 250),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(40, 75),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(200, 300)
+        }
+        this.enemyCores.push(new Node(NodeTypes.Core, stats));
+        this.enemyCores[i].setControlledByEnemy();
+        this.setNodeRandomPosition(this.enemyCores[i], xlimit);
+    }
+    for (var i = 0; i < numFirewalls; ++i) {
+        var stats = {
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(10, 25),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 75),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(100, 250)
+        }
+        this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));
+        this.enemyNodes[i].setControlledByEnemy();
+        this.setNodeRandomPosition(this.enemyNodes[i], xlimit);
+    }
+    for (var i = 0; i < numDatabases; ++i) {
+        var stats = {
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(20, 30),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 40),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(200, 400)
+        }
+        var node = new Node(NodeTypes.Database, stats);
+        node.setControlledByEnemy();
+        this.setNodeRandomPosition(node, xlimit);
+        this.enemyDatabases.push(node);
+    }
+    this.calculateDefenses();
+    this.createMap();
+}
+
+HackingMission.prototype.createPageDom = function() {
+    var container = document.getElementById("mission-container");
+
+    var headerText = document.createElement("p");
+    headerText.innerHTML = "You are about to start a hacking mission! For more information " +
+                    "about how hacking missions work, click one of the guide links " +
+                    "below (one opens up an in-game guide and the other opens up " +
+                    "the guide from the wiki). Click the 'Start' button to begin.";
+    headerText.style.display = "block";
+    headerText.classList.add("hack-mission-header-element");
+    headerText.style.width = "80%";
+
+    var inGameGuideBtn = document.createElement("a");
+    inGameGuideBtn.innerText = "How to Play";
+    inGameGuideBtn.classList.add("a-link-button");
+    inGameGuideBtn.style.display = "inline-block";
+    inGameGuideBtn.classList.add("hack-mission-header-element");
+    inGameGuideBtn.addEventListener("click", function() {
+        Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionHowToPlay);
+        return false;
+    });
+
+    var wikiGuideBtn = document.createElement("a");
+    wikiGuideBtn.innerText = "Wiki Guide";
+    wikiGuideBtn.classList.add("a-link-button");
+    wikiGuideBtn.style.display = "inline-block";
+    wikiGuideBtn.classList.add("hack-mission-header-element");
+    wikiGuideBtn.target = "_blank";
+    //TODO Add link to wiki page     wikiGuideBtn.href =
+
+
+    //Start button will get replaced with forfeit when game is started
+    var startBtn = document.createElement("a");
+    startBtn.innerHTML = "Start";
+    startBtn.classList.add("a-link-button");
+    startBtn.classList.add("hack-mission-header-element");
+    startBtn.style.display = "inline-block";
+
+    //Create Action Buttons (Attack/Scan/Weaken/ etc...)
+    var actionsContainer = document.createElement("span");
+    actionsContainer.style.display = "block";
+    actionsContainer.classList.add("hack-mission-action-buttons-container");
+    for (var i = 0; i < 5; ++i) {
+        this.actionButtons.push(document.createElement("a"));
+        this.actionButtons[i].style.display = "inline-block";
+        this.actionButtons[i].classList.add("a-link-button-inactive"); //Disabled at start
+        this.actionButtons[i].classList.add("tooltip"); //Disabled at start
+        this.actionButtons[i].classList.add("hack-mission-header-element");
+        actionsContainer.appendChild(this.actionButtons[i]);
+    }
+    this.actionButtons[0].innerText = "Attack(a)";
+    var atkTooltip = document.createElement("span");
+    atkTooltip.classList.add("tooltiptext");
+    atkTooltip.innerText = "Lowers the targeted node's HP. The effectiveness of this depends on " +
+                           "this node's Attack level, your hacking level, and the opponents defense level.";
+    this.actionButtons[0].appendChild(atkTooltip);
+    this.actionButtons[1].innerText = "Scan(s)";
+    var scanTooltip = document.createElement("span");
+    scanTooltip.classList.add("tooltiptext");
+    scanTooltip.innerText = "Lowers the targeted node's defense. The effectiveness of this depends on " +
+                            "this node's Attack level and your hacking level";
+    this.actionButtons[1].appendChild(scanTooltip);
+    this.actionButtons[2].innerText = "Weaken(w)";
+    var WeakenTooltip = document.createElement("span");
+    WeakenTooltip.classList.add("tooltiptext");
+    WeakenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
+                              "this node's Attack level and your hacking level";
+    this.actionButtons[2].appendChild(WeakenTooltip);
+    this.actionButtons[3].innerText = "Fortify(f)";
+    var fortifyTooltip = document.createElement("span");
+    fortifyTooltip.classList.add("tooltiptext");
+    fortifyTooltip.innerText = "Raises this node's Defense level. The effectiveness of this depends on " +
+                               "your hacking level";
+    this.actionButtons[3].appendChild(fortifyTooltip);
+    this.actionButtons[4].innerText = "Overflow(r)";
+    var overflowTooltip = document.createElement("span");
+    overflowTooltip.classList.add("tooltiptext");
+    overflowTooltip.innerText = "Raises this node's Attack level but lowers its Defense level. The effectiveness " +
+                                "of this depends on your hacking level.";
+    this.actionButtons[4].appendChild(overflowTooltip);
+
+    //Set Action Button event listeners
+    this.actionButtons[0].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Attack, false); //Set attack button inactive
+        this.selectedNode.action = NodeActions.Attack;
+    });
+
+    this.actionButtons[1].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Scan, false); //Set scan button inactive
+        this.selectedNode.action = NodeActions.Scan;
+    });
+
+    this.actionButtons[2].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Weaken, false); //Set Weaken button inactive
+        this.selectedNode.action = NodeActions.Weaken;
+    });
+
+    this.actionButtons[3].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Fortify, false); //Set Fortify button inactive
+        this.selectedNode.action = NodeActions.Fortify;
+    });
+
+    this.actionButtons[4].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Overflow, false); //Set Overflow button inactive
+        this.selectedNode.action = NodeActions.Overflow;
+    });
+
+    var timeDisplay = document.createElement("p");
+
+    container.appendChild(headerText);
+    container.appendChild(inGameGuideBtn);
+    container.appendChild(wikiGuideBtn);
+    container.appendChild(startBtn);
+    container.appendChild(actionsContainer);
+    container.appendChild(timeDisplay);
+}
+
+HackingMission.prototype.setActionButtonsInactive = function() {
+    for (var i = 0; i < this.actionButtons.length; ++i) {
+        this.actionButtons[i].classList.remove("a-link-button");
+        this.actionButtons[i].classList.add("a-link-button-inactive");
+    }
+}
+
+HackingMission.prototype.setActionButtonsActive = function() {
+    for (var i = 0; i < this.actionButtons.length; ++i) {
+        this.actionButtons[i].classList.add("a-link-button");
+        this.actionButtons[i].classList.remove("a-link-button-inactive");
+    }
+}
+
+//True for active, false for inactive
+HackingMission.prototype.setActionButton = function(i, active=true) {
+    if (Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["f" /* isString */])(i)) {
+        switch (i) {
+            case NodeActions.Attack:
+                i = 0;
+                break;
+            case NodeActions.Scan:
+                i = 1;
+                break;
+            case NodeActions.Weaken:
+                i = 2;
+                break;
+            case NodeActions.Fortify:
+                i = 3;
+                break;
+            case NodeActions.Overflow:
+            default:
+                i = 4;
+                break;
+        }
+    }
+    if (active) {
+        this.actionButtons[i].classList.remove("a-link-button-inactive");
+        this.actionButtons[i].classList.add("a-link-button");
+    } else {
+        this.actionButtons[i].classList.remove("a-link-button");
+        this.actionButtons[i].classList.add("a-link-button-inactive");
+    }
+
+}
+
+//Should only be used at the start
+HackingMission.prototype.calculateDefenses = function() {
+    var total = 0;
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        total += this.playerCores[i].def;
+    }
+    for (var i = 0; i < this.playerNodes.length; ++i) {
+        total += this.playerNodes[i].def;
+    }
+    console.log("player defenses calculated to be: " + total);
+    this.playerDef = total;
+    total = 0;
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        total += this.enemyCores[i].def;
+    }
+    for (var i = 0; i < this.enemyDatabases.length; ++i) {
+        total += this.enemyDatabases[i].def;
+    }
+    for (var i = 0; i < this.enemyNodes.length; ++i) {
+        total += this.enemyNodes[i].def;
+    }
+    console.log("enemy defenses calculated to be: " + total);
+    this.enemyDef = total;
+}
+
+HackingMission.prototype.removeAvailablePosition = function(x, y) {
+    for (var i = 0; i < this.availablePositions.length; ++i) {
+        if (this.availablePositions[i][0] === x &&
+            this.availablePositions[i][1] === y) {
+            this.availablePositions.splice(i, 1);
+            return;
+        }
+    }
+    console.log("WARNING: removeAvailablePosition() did not remove " + x + ", " + y);
+}
+
+HackingMission.prototype.setNodePosition = function(nodeObj, x, y) {
+    if (!(nodeObj instanceof Node)) {
+        console.log("WARNING: Non-Node object passed into setNodePOsition");
+        return;
+    }
+    if (isNaN(x) || isNaN(y)) {
+        console.log("ERR: Invalid values passed as x and y for setNodePosition");
+        console.log(x);
+        console.log(y);
+        return;
+    }
+    nodeObj.pos = [x, y];
+    this.map[x][y] = nodeObj;
+}
+
+HackingMission.prototype.setNodeRandomPosition = function(nodeObj, xlimit=0) {
+    var i = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.availablePositions.length - 1);
+    var pos = this.availablePositions.splice(i, 1);
+    pos = pos[0];
+    this.setNodePosition(nodeObj, pos[0], pos[1]);
+}
+
+HackingMission.prototype.createMap = function() {
+    //Use a grid
+    var map = document.createElement("div");
+    map.classList.add("hack-mission-grid");
+    map.setAttribute("id", "hacking-mission-map");
+    document.getElementById("mission-container").appendChild(map);
+
+    //Create random Nodes for every space in the map that
+    //hasn't been filled yet
+    for (var x = 0; x < 8; ++x) {
+        for (var y = 0; y < 8; ++y) {
+            if (!(this.map[x][y] instanceof Node)) {
+                var node, type = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, 2);
+                var randMult = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
+                switch (type) {
+                    case 0: //Spam
+                        var stats = {
+                            atk: 0,
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(400, 800),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000)
+                        }
+                        node = new Node(NodeTypes.Spam, stats);
+                        break;
+                    case 1: //Transfer
+                        var stats = {
+                            atk: 0,
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(600, 1100)
+                        }
+                        node = new Node(NodeTypes.Transfer, stats);
+                        break;
+                    case 2: //Shield
+                    default:
+                        var stats = {
+                            atk: 0,
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(750, 1000),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(700, 1000)
+                        }
+                        node = new Node(NodeTypes.Shield, stats);
+                        break;
+                }
+                this.setNodePosition(node, x, y);
+                this.removeAvailablePosition(x, y);
+                this.miscNodes.push(node);
+            }
+        }
+    }
+
+    //Create DOM elements in order
+    for (var r = 0; r < 8; ++r) {
+        for (var c = 0; c < 8; ++c) {
+            this.createNodeDomElement(this.map[r][c]);
+        }
+    }
+
+    //Configure all Player CPUS
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        console.log("Configuring Player Node: " + this.playerCores[i].el.id);
+        this.configurePlayerNodeElement(this.playerCores[i].el);
+    }
+
+    console.log(this.map);
+    this.initJsPlumb();
+}
+
+HackingMission.prototype.createNodeDomElement = function(nodeObj) {
+    var nodeDiv = document.createElement("a");
+    nodeObj.el = nodeDiv;
+    document.getElementById("hacking-mission-map").appendChild(nodeDiv);
+
+    //Set the node element's id based on its coordinates
+    nodeDiv.setAttribute("id", "hacking-mission-node-" +
+                                nodeObj.pos[0] + "-" +
+                                nodeObj.pos[1]);
+
+    //Set node classes for owner
+    nodeDiv.classList.add("tooltip2");
+    nodeDiv.classList.add("hack-mission-node");
+    if (nodeObj.plyrCtrl) {
+        nodeDiv.classList.add("hack-mission-player-node");
+    } else if (nodeObj.enmyCtrl) {
+        nodeDiv.classList.add("hack-mission-enemy-node");
+    }
+
+    //Set node classes based on type
+    var txt;
+    switch (nodeObj.type) {
+        case NodeTypes.Core:
+            txt = "<p>CPU Core<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-cpu-node");
+            break;
+        case NodeTypes.Firewall:
+            txt = "<p>Firewall<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-firewall-node");
+            break;
+        case NodeTypes.Database:
+            txt = "<p>Database<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-database-node");
+            break;
+        case NodeTypes.Spam:
+            txt = "<p>Spam<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-spam-node");
+            break;
+        case NodeTypes.Transfer:
+            txt = "<p>Transfer<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-transfer-node");
+            break;
+        case NodeTypes.Shield:
+        default:
+            txt = "<p>Shield<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-shield-node");
+            break;
+    }
+
+    txt += "<br>Atk: " + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
+           "<br>Def: " + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1) + "</p>";
+    nodeDiv.innerHTML = txt;
+}
+
+HackingMission.prototype.updateNodeDomElement = function(nodeObj) {
+    if (nodeObj.el === null) {
+        console.log("ERR: Calling updateNodeDomElement on a Node without an element");
+        return;
+    }
+
+    var nodeDiv = document.getElementById("hacking-mission-node-" +
+                                          nodeObj.pos[0] + "-" +
+                                          nodeObj.pos[1]);
+
+    //Set node classes based on type
+    var txt;
+    switch (nodeObj.type) {
+        case NodeTypes.Core:
+            txt = "<p>CPU Core<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Firewall:
+            txt = "<p>Firewall<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Database:
+            txt = "<p>Database<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Spam:
+            txt = "<p>Spam<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Transfer:
+            txt = "<p>Transfer<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Shield:
+        default:
+            txt = "<p>Shield<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+    }
+
+    txt += "<br>Atk: " + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
+           "<br>Def: " + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1);
+    if (nodeObj.action) {
+        txt += "<br>" + nodeObj.action;
+    }
+    txt += "</p>";
+    nodeDiv.innerHTML = txt;
+}
+
+//Gets a Node DOM element's corresponding Node object using its
+//element id
+HackingMission.prototype.getNodeFromElement = function(el) {
+    var id = el.id;
+    id = id.replace("hacking-mission-node-", "");
+    var res = id.split('-');
+    if (res.length != 2) {
+        console.log("ERROR Parsing Hacking Mission Node Id. Could not find coordinates");
+        return null;
+    }
+    var x = res[0], y = res[1];
+    if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) {
+        console.log("ERROR: Unexpected values for x and y: " + x + ", " + y);
+        return null;
+    }
+    return this.map[x][y];
+}
+
+//Configures a DOM element representing a player-owned node to
+//be selectable and actionable
+//Note: Does NOT change its css class. This is handled by Node.setControlledBy...
+HackingMission.prototype.configurePlayerNodeElement = function(el) {
+    var nodeObj = this.getNodeFromElement(el);
+    if (nodeObj === null) {console.log("Error getting Node object");}
+
+    //Add event listener
+    el.addEventListener("click", ()=>{
+        if (this.selectedNode instanceof Node) {
+            this.selectedNode.deselect(this.actionButtons);
+            this.selectedNode = null;
+        }
+        console.log("Selecting node :" + el.id);
+        nodeObj.select(this.actionButtons);
+        this.selectedNode = nodeObj;
+    });
+}
+
+//Configures a DOM element representing an enemy-node by removing
+//any event listeners
+HackingMission.prototype.configureEnemyNodeElement = function(el) {
+    //Deselect node if it was the selected node
+    var nodeObj = this.getNodeFromElement(el);
+    if (this.selectedNode == nodeObj) {
+        nodeObj.deselect(this.actionButtons);
+    }
+}
+
+//Returns bool indicating whether a node is reachable by player
+//by checking if any of the adjacent nodes are owned by the player
+HackingMission.prototype.nodeReachable = function(node) {
+    var x = node.pos[0], y = node.pos[1];
+    if (x > 0 && this.map[x-1][y].plyrCtrl) {return true;}
+    if (x < 7 && this.map[x+1][y].plyrCtrl) {return true;}
+    if (y > 0 && this.map[x][y-1].plyrCtrl) {return true;}
+    if (y < 7 && this.map[x][y+1].plyrCtrl) {return true;}
+    return false;
+}
+
+HackingMission.prototype.initJsPlumb = function() {
+    var instance = jsPlumb.getInstance({
+        DragOptions:{cursor:"pointer", zIndex:2000},
+        PaintStyle: {
+            gradient: { stops: [
+                [ 0, "#FFFFFF" ],
+                [ 1, "#FFFFFF" ]
+            ] },
+            stroke: "#FFFFFF",
+            strokeWidth: 8
+        },
+    });
+
+    this.jsplumbinstance = instance;
+
+    //All player cores are sources
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        instance.makeSource(this.playerCores[i].el, {
+            deleteEndpointsOnEmpty:true,
+            maxConnections:1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+
+    //Everything else is a target
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        instance.makeTarget(this.enemyCores[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+    for (var i = 0; i < this.enemyDatabases.length; ++i) {
+        instance.makeTarget(this.enemyDatabases[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:["Straight"]
+        });
+    }
+    for (var i = 0; i < this.enemyNodes.length; ++i) {
+        instance.makeTarget(this.enemyNodes[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+    for (var i = 0; i < this.miscNodes.length; ++i) {
+        instance.makeTarget(this.miscNodes[i].el, {
+            maxConnections:-1,
+            anchor:"Center",
+            connector:"Straight"
+        });
+    }
+
+    //Clicking a connection drops it
+    instance.bind("click", function(conn, originalEvent) {
+        var endpoints = conn.endpoints;
+        endpoints[0].detachFrom(endpoints[1]);
+    });
+
+    //Connection events
+    instance.bind("connection", (info)=>{
+        var targetNode = this.getNodeFromElement(info.target);
+
+        //If the node is not reachable, drop the connection
+        if (!this.nodeReachable(targetNode)) {
+            info.sourceEndpoint.detachFrom(info.targetEndpoint);
+            return;
+        }
+
+        var sourceNode = this.getNodeFromElement(info.source);
+        sourceNode.conn = info.connection;
+    });
+
+    //Detach Connection events
+    instance.bind("connectionDetached", (info, originalEvent)=>{
+        var sourceNode = this.getNodeFromElement(info.source);
+        sourceNode.conn = null;
+    });
+}
+
+//Drops all connections where the specified node is the source
+HackingMission.prototype.dropAllConnectionsFromNode = function(node) {
+    var allConns = this.jsplumbinstance.getAllConnections();
+    for (var i = allConns.length-1; i >= 0; --i) {
+        if (allConns[i].source == node.el) {
+            allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
+        }
+    }
+}
+
+//Drops all connections where the specified node is the target
+HackingMission.prototype.dropAllConnectionsToNode = function(node) {
+    var allConns = this.jsplumbinstance.getAllConnections();
+    for (var i = allConns.length-1; i >= 0; --i) {
+        if (allConns[i].target == node.el) {
+            allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
+        }
+    }
+}
+
+HackingMission.prototype.process = function(numCycles=1) {
+    //Process actions of all player nodes
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        this.processNode(this.playerCores[i], numCycles);
+    }
+
+    //Process actions of all enemy nodes
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        this.processNode(this.enemyCores[i], numCycles);
+    }
+}
+
+HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
+    if (nodeObj.action === null) {return;}
+
+    var targetNode = null, def;
+    if (nodeObj.conn) {
+        targetNode = this.getNodeFromElement(nodeObj.conn.target);
+        if (targetNode.plyrCtrl) {
+            def = this.playerDef;
+        } else {
+            def = this.enemyDef;
+        }
+    }
+
+    //Calculations are per second, so divide everything by 5
+    switch(nodeObj.action) {
+        case NodeActions.Attack:
+            if (nodeObj.conn === null) {break;}
+            var dmg = this.calculateAttackDamage(nodeObj.atk, def, __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill);
+            targetNode.hp -= (dmg/5 * numCycles);
+            break;
+        case NodeActions.Scan:
+            if (nodeObj.conn === null) {break;}
+            var eff = this.calculateScanEffect(def, __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill);
+            targetNode.def -= (eff/5 * numCycles);
+            this.calculateDefenses();
+            break;
+        case NodeActions.Weaken:
+            if (nodeObj.conn === null) {break;}
+            var eff = this.calculateWeakenEffect(def, __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill);
+            targetNode.atk -= (eff/5 * numCycles);
+            break;
+        case NodeActions.Fortify:
+            var eff = this.calculateFortifyEffect(__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill);
+            nodeObj.def += (eff/5 * numCycles);
+            this.calculateDefenses();
+            break;
+        case NodeActions.Overflow:
+            var eff = this.calculateOverflowEffect(__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill);
+            if (nodeObj.def < eff) {break;}
+            nodeObj.def -= (eff/5 * numCycles);
+            nodeObj.atk += (eff/5 * numCycles);
+            this.calculateDefenses();
+            break;
+        default:
+            console.log("ERR: Invalid Node Action: " + nodeObj.action);
+            break;
+    }
+
+    //Stats can't go below 0
+    if (nodeObj.atk < 0) {nodeObj.atk = 0;}
+    if (nodeObj.def < 0) {nodeObj.def = 0;}
+    if (targetNode && targetNode.atk < 0) {targetNode.atk = 0;}
+    if (targetNode && targetNode.def < 0) {targetNode.def = 0;}
+
+    //Conquering a node
+    if (targetNode && targetNode.hp <= 0) {
+        var conqueredByPlayer = nodeObj.plyrCtrl;
+        targetNode.hp = targetNode.maxhp;
+        targetNode.action = null;
+        targetNode.conn = null;
+        if (this.selectedNode == targetNode) {
+            targetNode.deselect();
+        }
+        this.dropAllConnectionsToNode(targetNode);
+        this.dropAllConnectionsFromNode(targetNode);
+        if (conqueredByPlayer) {
+            targetNode.setControlledByPlayer()
+        } else { //Conquered by enemy
+            targetNode.setControlledByEnemy();
+        }
+    }
+    this.updateNodeDomElement(nodeObj);
+    if (targetNode) {this.updateNodeDomElement(targetNode);}
+}
+
+var hackEffWeightSelf = 100; //Weight for Node actions on self
+var hackEffWeightTarget = 10; //Weight for Node Actions against Target
+var hackEffWeightAttack = 100; //Weight for Attack action
+
+//Returns damage per cycle based on stats
+HackingMission.prototype.calculateAttackDamage = function(atk, def, hacking = 0) {
+    return Math.max(atk + (hacking / hackEffWeightAttack) - def, 0.1);
+}
+
+HackingMission.prototype.calculateScanEffect = function(def, hacking=0) {
+    return Math.max(hacking / hackEffWeightTarget - def, 0.1);
+}
+
+HackingMission.prototype.calculateWeakenEffect = function(def, hacking=0) {
+    return Math.max(hacking / hackEffWeightTarget - def, 0.1);
+}
+
+HackingMission.prototype.calculateFortifyEffect = function(hacking=0) {
+    return hacking / hackEffWeightSelf;
+}
+
+HackingMission.prototype.calculateOverflowEffect = function(hacking=0) {
+    return hacking / hackEffWeightSelf;
+}
+
+
+
+
+/***/ }),
+/* 39 */
 /***/ (function(module, exports) {
 
 module.exports = function() {
@@ -38191,14 +39158,14 @@ module.exports = function() {
 
 
 /***/ }),
-/* 39 */
+/* 40 */
 /***/ (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.column<point2.column;return point1.row<point2.row||point1.row==point2.row&&bColIsAfter}function $getTransformedPoint(delta,point,moveIfEqual){var deltaIsInsert=\"insert\"==delta.action,deltaRowShift=(deltaIsInsert?1:-1)*(delta.end.row-delta.start.row),deltaColShift=(deltaIsInsert?1:-1)*(delta.end.column-delta.start.column),deltaStart=delta.start,deltaEnd=deltaIsInsert?deltaStart:delta.end;return $pointsInOrder(point,deltaStart,moveIfEqual)?{row:point.row,column:point.column}:$pointsInOrder(deltaEnd,point,!moveIfEqual)?{row:point.row+deltaRowShift,column:point.column+(point.row==deltaEnd.row?deltaColShift:0)}:{row:deltaStart.row,column:deltaStart.column}}oop.implement(this,EventEmitter),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(delta){if(!(delta.start.row==delta.end.row&&delta.start.row!=this.row||delta.start.row>this.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,\"&#38;\").replace(/\"/g,\"&#34;\").replace(/'/g,\"&#39;\").replace(/</g,\"&#60;\")},exports.getMatchOffsets=function(string,regExp){var matches=[];return string.replace(regExp,function(str){matches.push({offset:arguments[arguments.length-2],length:str.length})}),matches},exports.deferredCall=function(fcn){var timer=null,callback=function(){timer=null,fcn()},deferred=function(timeout){return deferred.cancel(),timer=setTimeout(callback,timeout||0),deferred};return deferred.schedule=deferred,deferred.call=function(){return this.cancel(),fcn(),deferred},deferred.cancel=function(){return clearTimeout(timer),timer=null,deferred},deferred.isPending=function(){return timer},deferred},exports.delayedCall=function(fcn,defaultTimeout){var timer=null,callback=function(){timer=null,fcn()},_self=function(timeout){null==timer&&(timer=setTimeout(callback,timeout||defaultTimeout))};return _self.delay=function(timeout){timer&&clearTimeout(timer),timer=setTimeout(callback,timeout||defaultTimeout)},_self.schedule=_self,_self.call=function(){this.cancel(),fcn()},_self.cancel=function(){timer&&clearTimeout(timer),timer=null},_self.isPending=function(){return timer},_self}}),ace.define(\"ace/worker/mirror\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/document\",\"ace/lib/lang\"],function(acequire,exports){\"use strict\";acequire(\"../range\").Range;var Document=acequire(\"../document\").Document,lang=acequire(\"../lib/lang\"),Mirror=exports.Mirror=function(sender){this.sender=sender;var doc=this.doc=new Document(\"\"),deferredUpdate=this.deferredUpdate=lang.delayedCall(this.onUpdate.bind(this)),_self=this;sender.on(\"change\",function(e){var data=e.data;if(data[0].start)doc.applyDeltas(data);else for(var i=0;data.length>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&&currentRequire)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&&reg.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<state.tokens.next.lbp),isNecessary||warning(\"W126\",opening),ret.paren=!0),ret):void 0}),application(\"=>\"),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&&reg.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&&reg.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:[\"<non-printable>\"]}),\"\\\\\"===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<this.input.length){var inComment=this.inComment||startsWith.call(inputTrimmed,\"//\")||startsWith.call(inputTrimmed,\"/*\"),shouldTriggerError=!inComment||!reg.maxlenException.test(inputTrimmed);shouldTriggerError&&this.trigger(\"warning\",{code:\"W101\",line:this.line,character:this.input.length})}return!0},start:function(){this.nextLine()},token:function(){function isReserved(token,isProperty){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(isProperty)return!1}return!0}for(var token,checks=asyncTrigger(),create=function(type,value,isProperty,token){var obj;if(\"(endline)\"!==type&&\"(end)\"!==type&&(this.prereg=!1),\"(punctuator)\"===type){switch(value){case\".\":case\")\":case\"~\":case\"#\":case\"]\":case\"++\":case\"--\":this.prereg=!1;break;default:this.prereg=!0}obj=Object.create(state.syntax[value]||state.syntax[\"(error)\"])}return\"(identifier)\"===type&&((\"return\"===value||\"case\"===value||\"typeof\"===value)&&(this.prereg=!0),_.has(state.syntax,value)&&(obj=Object.create(state.syntax[value]||state.syntax[\"(error)\"]),isReserved(obj,isProperty&&\"(identifier)\"===type)||(obj=null))),obj||(obj=Object.create(state.syntax[type])),obj.identifier=\"(identifier)\"===type,obj.type=obj.type||type,obj.value=value,obj.line=this.line,obj.character=this.char,obj.from=this.from,obj.identifier&&token&&(obj.raw_text=token.text||token.value),token&&token.startLine&&token.startLine!==this.line&&(obj.startLine=token.startLine),token&&token.context&&(obj.context=token.context),token&&token.depth&&(obj.depth=token.depth),token&&token.isUnclosed&&(obj.isUnclosed=token.isUnclosed),isProperty&&obj.identifier&&(obj.isProperty=isProperty),obj.check=checks.check,obj}.bind(this);;){if(!this.input.length)return this.nextLine()?create(\"(endline)\",\"\"):this.exhausted?null:(this.exhausted=!0,create(\"(end)\",\"\"));if(token=this.next(checks))switch(token.type){case Token.StringLiteral:return this.triggerAsync(\"String\",{line:this.line,\"char\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value,quote:token.quote},checks,function(){return!0}),create(\"(string)\",token.value,null,token);case Token.TemplateHead:return this.trigger(\"TemplateHead\",{line:this.line,\"char\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\"(template)\",token.value,null,token);case Token.TemplateMiddle:return this.trigger(\"TemplateMiddle\",{line:this.line,\"char\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\"(template middle)\",token.value,null,token);case Token.TemplateTail:return this.trigger(\"TemplateTail\",{line:this.line,\"char\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\"(template tail)\",token.value,null,token);case Token.NoSubstTemplate:return this.trigger(\"NoSubstTemplate\",{line:this.line,\"char\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\"(no subst template)\",token.value,null,token);case Token.Identifier:this.triggerAsync(\"Identifier\",{line:this.line,\"char\":this.char,from:this.form,name:token.value,raw_name:token.text,isProperty:\".\"===state.tokens.curr.id},checks,function(){return!0});case Token.Keyword:case Token.NullLiteral:case Token.BooleanLiteral:return create(\"(identifier)\",token.value,\".\"===state.tokens.curr.id,token);case Token.NumericLiteral:return token.isMalformed&&this.trigger(\"warning\",{code:\"W045\",line:this.line,character:this.char,data:[token.value]}),this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"0x-\"]},checks,function(){return 16===token.base&&state.jsonMode}),this.triggerAsync(\"warning\",{code:\"W115\",line:this.line,character:this.char},checks,function(){return state.isStrict()&&8===token.base&&token.isLegacy}),this.trigger(\"Number\",{line:this.line,\"char\":this.char,from:this.from,value:token.value,base:token.base,isMalformed:token.malformed}),create(\"(number)\",token.value);case Token.RegExp:return create(\"(regexp)\",token.value);case Token.Comment:if(state.tokens.curr.comment=!0,token.isSpecial)return{id:\"(comment)\",value:token.value,body:token.body,type:token.commentType,isSpecial:token.isSpecial,line:this.line,character:this.char,from:this.from};break;case\"\":break;default:return create(\"(punctuator)\",token.value)}else this.input.length&&(this.trigger(\"error\",{code:\"E024\",line:this.line,character:this.char,data:[this.peek()]}),this.input=\"\")}}},exports.Lexer=Lexer,exports.Context=Context},{\"../data/ascii-identifier-data.js\":\"/node_modules/jshint/data/ascii-identifier-data.js\",\"../lodash\":\"/node_modules/jshint/lodash.js\",\"./reg.js\":\"/node_modules/jshint/src/reg.js\",\"./state.js\":\"/node_modules/jshint/src/state.js\",events:\"/node_modules/browserify/node_modules/events/events.js\"}],\"/node_modules/jshint/src/messages.js\":[function(_dereq_,module,exports){\"use strict\";var _=_dereq_(\"../lodash\"),errors={E001:\"Bad option: '{a}'.\",E002:\"Bad option value.\",E003:\"Expected a JSON value.\",E004:\"Input is neither a string nor an array of strings.\",E005:\"Input is empty.\",E006:\"Unexpected early end of program.\",E007:'Missing \"use strict\" statement.',E008:\"Strict violation.\",E009:\"Option 'validthis' can't be used in a global scope.\",E010:\"'with' is not allowed in strict mode.\",E011:\"'{a}' has already been declared.\",E012:\"const '{a}' is initialized to 'undefined'.\",E013:\"Attempting to override '{a}' which is a constant.\",E014:\"A regular expression literal can be confused with '/='.\",E015:\"Unclosed regular expression.\",E016:\"Invalid regular expression.\",E017:\"Unclosed comment.\",E018:\"Unbegun comment.\",E019:\"Unmatched '{a}'.\",E020:\"Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.\",E021:\"Expected '{a}' and instead saw '{b}'.\",E022:\"Line breaking error '{a}'.\",E023:\"Missing '{a}'.\",E024:\"Unexpected '{a}'.\",E025:\"Missing ':' on a case clause.\",E026:\"Missing '}' to match '{' from line {a}.\",E027:\"Missing ']' to match '[' from line {a}.\",E028:\"Illegal comma.\",E029:\"Unclosed string.\",E030:\"Expected an identifier and instead saw '{a}'.\",E031:\"Bad assignment.\",E032:\"Expected a small integer or 'false' and instead saw '{a}'.\",E033:\"Expected an operator and instead saw '{a}'.\",E034:\"get/set are ES5 features.\",E035:\"Missing property name.\",E036:\"Expected to see a statement and instead saw a block.\",E037:null,E038:null,E039:\"Function declarations are not invocable. Wrap the whole function invocation in parens.\",E040:\"Each value should have its own case label.\",E041:\"Unrecoverable syntax error.\",E042:\"Stopping.\",E043:\"Too many errors.\",E044:null,E045:\"Invalid for each loop.\",E046:\"A yield statement shall be within a generator function (with syntax: `function*`)\",E047:null,E048:\"{a} declaration not directly within block.\",E049:\"A {a} cannot be named '{b}'.\",E050:\"Mozilla acequires the yield expression to be parenthesized here.\",E051:null,E052:\"Unclosed template literal.\",E053:\"Export declaration must be in global scope.\",E054:\"Class properties must be methods. Expected '(' but instead saw '{a}'.\",E055:\"The '{a}' option cannot be set after any executable code.\",E056:\"'{a}' was used before it was declared, which is illegal for '{b}' variables.\",E057:\"Invalid meta property: '{a}.{b}'.\",E058:\"Missing semicolon.\"},warnings={W001:\"'hasOwnProperty' is a really bad name.\",W002:\"Value of '{a}' may be overwritten in IE 8 and earlier.\",W003:\"'{a}' was used before it was defined.\",W004:\"'{a}' is already defined.\",W005:\"A dot following a number can be confused with a decimal point.\",W006:\"Confusing minuses.\",W007:\"Confusing plusses.\",W008:\"A leading decimal point can be confused with a dot: '{a}'.\",W009:\"The array literal notation [] is preferable.\",W010:\"The object literal notation {} is preferable.\",W011:null,W012:null,W013:null,W014:\"Bad line breaking before '{a}'.\",W015:null,W016:\"Unexpected use of '{a}'.\",W017:\"Bad operand.\",W018:\"Confusing use of '{a}'.\",W019:\"Use the isNaN function to compare with NaN.\",W020:\"Read only.\",W021:\"Reassignment of '{a}', which is is a {b}. Use 'var' or 'let' to declare bindings that may change.\",W022:\"Do not assign to the exception parameter.\",W023:\"Expected an identifier in an assignment and instead saw a function invocation.\",W024:\"Expected an identifier and instead saw '{a}' (a reserved word).\",W025:\"Missing name in function declaration.\",W026:\"Inner functions should be listed at the top of the outer function.\",W027:\"Unreachable '{a}' after '{b}'.\",W028:\"Label '{a}' on {b} statement.\",W030:\"Expected an assignment or function call and instead saw an expression.\",W031:\"Do not use 'new' for side effects.\",W032:\"Unnecessary semicolon.\",W033:\"Missing semicolon.\",W034:'Unnecessary directive \"{a}\".',W035:\"Empty block.\",W036:\"Unexpected /*member '{a}'.\",W037:\"'{a}' is a statement label.\",W038:\"'{a}' used out of scope.\",W039:\"'{a}' is not allowed.\",W040:\"Possible strict violation.\",W041:\"Use '{a}' to compare with '{b}'.\",W042:\"Avoid EOL escaping.\",W043:\"Bad escaping of EOL. Use option multistr if needed.\",W044:\"Bad or unnecessary escaping.\",W045:\"Bad number '{a}'.\",W046:\"Don't use extra leading zeros '{a}'.\",W047:\"A trailing decimal point can be confused with a dot: '{a}'.\",W048:\"Unexpected control character in regular expression.\",W049:\"Unexpected escaped character '{a}' in regular expression.\",W050:\"JavaScript URL.\",W051:\"Variables should not be deleted.\",W052:\"Unexpected '{a}'.\",W053:\"Do not use {a} as a constructor.\",W054:\"The Function constructor is a form of eval.\",W055:\"A constructor name should start with an uppercase letter.\",W056:\"Bad constructor.\",W057:\"Weird construction. Is 'new' necessary?\",W058:\"Missing '()' invoking a constructor.\",W059:\"Avoid arguments.{a}.\",W060:\"document.write can be a form of eval.\",W061:\"eval can be harmful.\",W062:\"Wrap an immediate function invocation in parens to assist the reader in understanding that the expression is the result of a function, and not the function itself.\",W063:\"Math is not a function.\",W064:\"Missing 'new' prefix when invoking a constructor.\",W065:\"Missing radix parameter.\",W066:\"Implied eval. Consider passing a function instead of a string.\",W067:\"Bad invocation.\",W068:\"Wrapping non-IIFE function literals in parens is unnecessary.\",W069:\"['{a}'] is better written in dot notation.\",W070:\"Extra comma. (it breaks older versions of IE)\",W071:\"This function has too many statements. ({a})\",W072:\"This function has too many parameters. ({a})\",W073:\"Blocks are nested too deeply. ({a})\",W074:\"This function's cyclomatic complexity is too high. ({a})\",W075:\"Duplicate {a} '{b}'.\",W076:\"Unexpected parameter '{a}' in get {b} function.\",W077:\"Expected a single parameter in set {a} function.\",W078:\"Setter is defined without getter.\",W079:\"Redefinition of '{a}'.\",W080:\"It's not necessary to initialize '{a}' to 'undefined'.\",W081:null,W082:\"Function declarations should not be placed in blocks. Use a function expression or move the statement to the top of the outer function.\",W083:\"Don't make functions within a loop.\",W084:\"Assignment in conditional expression\",W085:\"Don't use 'with'.\",W086:\"Expected a 'break' statement before '{a}'.\",W087:\"Forgotten 'debugger' statement?\",W088:\"Creating global 'for' variable. Should be 'for (var {a} ...'.\",W089:\"The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.\",W090:\"'{a}' is not a statement label.\",W091:null,W093:\"Did you mean to return a conditional instead of an assignment?\",W094:\"Unexpected comma.\",W095:\"Expected a string and instead saw {a}.\",W096:\"The '{a}' key may produce unexpected results.\",W097:'Use the function form of \"use strict\".',W098:\"'{a}' is defined but never used.\",W099:null,W100:\"This character may get silently deleted by one or more browsers.\",W101:\"Line is too long.\",W102:null,W103:\"The '{a}' property is deprecated.\",W104:\"'{a}' is available in ES{b} (use 'esversion: {b}') or Mozilla JS extensions (use moz).\",W105:\"Unexpected {a} in '{b}'.\",W106:\"Identifier '{a}' is not in camel case.\",W107:\"Script URL.\",W108:\"Strings must use doublequote.\",W109:\"Strings must use singlequote.\",W110:\"Mixed double and single quotes.\",W112:\"Unclosed string.\",W113:\"Control character in string: {a}.\",W114:\"Avoid {a}.\",W115:\"Octal literals are not allowed in strict mode.\",W116:\"Expected '{a}' and instead saw '{b}'.\",W117:\"'{a}' is not defined.\",W118:\"'{a}' is only available in Mozilla JavaScript extensions (use moz option).\",W119:\"'{a}' is only available in ES{b} (use 'esversion: {b}').\",W120:\"You might be leaking a variable ({a}) here.\",W121:\"Extending prototype of native object: '{a}'.\",W122:\"Invalid typeof value '{a}'\",W123:\"'{a}' is already defined in outer scope.\",W124:\"A generator function shall contain a yield statement.\",W125:\"This line contains non-breaking spaces: http://jshint.com/doc/options/#nonbsp\",W126:\"Unnecessary grouping operator.\",W127:\"Unexpected use of a comma operator.\",W128:\"Empty array elements acequire elision=true.\",W129:\"'{a}' is defined in a future version of JavaScript. Use a different variable name to avoid migration issues.\",W130:\"Invalid element after rest element.\",W131:\"Invalid parameter after rest parameter.\",W132:\"`var` declarations are forbidden. Use `let` or `const` instead.\",W133:\"Invalid for-{a} loop left-hand-side: {b}.\",W134:\"The '{a}' option is only available when linting ECMAScript {b} code.\",W135:\"{a} may not be supported by non-browser environments.\",W136:\"'{a}' must be in function scope.\",W137:\"Empty destructuring.\",W138:\"Regular parameters should not come after default parameters.\"},info={I001:\"Comma warnings can be turned off with 'laxcomma'.\",I002:null,I003:\"ES5 option is now set per default\"};exports.errors={},exports.warnings={},exports.info={},_.each(errors,function(desc,code){exports.errors[code]={code:code,desc:desc}}),_.each(warnings,function(desc,code){exports.warnings[code]={code:code,desc:desc}}),_.each(info,function(desc,code){exports.info[code]={code:code,desc:desc}})},{\"../lodash\":\"/node_modules/jshint/lodash.js\"}],\"/node_modules/jshint/src/name-stack.js\":[function(_dereq_,module){\"use strict\";function NameStack(){this._stack=[]}Object.defineProperty(NameStack.prototype,\"length\",{get:function(){return this._stack.length}}),NameStack.prototype.push=function(){this._stack.push(null)},NameStack.prototype.pop=function(){this._stack.pop()},NameStack.prototype.set=function(token){this._stack[this.length-1]=token},NameStack.prototype.infer=function(){var type,nameToken=this._stack[this.length-1],prefix=\"\";return nameToken&&\"class\"!==nameToken.type||(nameToken=this._stack[this.length-2]),nameToken?(type=nameToken.type,\"(string)\"!==type&&\"(number)\"!==type&&\"(identifier)\"!==type&&\"default\"!==type?\"(expression)\":(nameToken.accessorType&&(prefix=nameToken.accessorType+\" \"),prefix+nameToken.value)):\"(empty)\"},module.exports=NameStack},{}],\"/node_modules/jshint/src/options.js\":[function(_dereq_,module,exports){\"use strict\";exports.bool={enforcing:{bitwise:!0,freeze:!0,camelcase:!0,curly:!0,eqeqeq:!0,futurehostile:!0,notypeof:!0,es3:!0,es5:!0,forin:!0,funcscope:!0,immed:!0,iterator:!0,newcap:!0,noarg:!0,nocomma:!0,noempty:!0,nonbsp:!0,nonew:!0,undef:!0,singleGroups:!1,varstmt:!1,enforceall:!1},relaxing:{asi:!0,multistr:!0,debug:!0,boss:!0,evil:!0,globalstrict:!0,plusplus:!0,proto:!0,scripturl:!0,sub:!0,supernew:!0,laxbreak:!0,laxcomma:!0,validthis:!0,withstmt:!0,moz:!0,noyield:!0,eqnull:!0,lastsemic:!0,loopfunc:!0,expr:!0,esnext:!0,elision:!0},environments:{mootools:!0,couch:!0,jasmine:!0,jquery:!0,node:!0,qunit:!0,rhino:!0,shelljs:!0,prototypejs:!0,yui:!0,mocha:!0,module:!0,wsh:!0,worker:!0,nonstandard:!0,browser:!0,browserify:!0,devel:!0,dojo:!0,typed:!0,phantom:!0},obsolete:{onecase:!0,regexp:!0,regexdash:!0}},exports.val={maxlen:!1,indent:!1,maxerr:!1,predef:!1,globals:!1,quotmark:!1,scope:!1,maxstatements:!1,maxdepth:!1,maxparams:!1,maxcomplexity:!1,shadow:!1,strict:!0,unused:!0,latedef:!1,ignore:!1,ignoreDelimiters:!1,esversion:5},exports.inverted={bitwise:!0,forin:!0,newcap:!0,plusplus:!0,regexp:!0,undef:!0,eqeqeq:!0,strict:!0},exports.validNames=Object.keys(exports.val).concat(Object.keys(exports.bool.relaxing)).concat(Object.keys(exports.bool.enforcing)).concat(Object.keys(exports.bool.obsolete)).concat(Object.keys(exports.bool.environments)),exports.renamed={eqeq:\"eqeqeq\",windows:\"wsh\",sloppy:\"strict\"},exports.removed={nomen:!0,onevar:!0,passfail:!0,white:!0,gcl:!0,smarttabs:!0,trailing:!0},exports.noenforceall={varstmt:!0,strict:!0}},{}],\"/node_modules/jshint/src/reg.js\":[function(_dereq_,module,exports){\"use strict\";exports.unsafeString=/@cc|<\\/?|script|\\]\\s*\\]|<\\s*!|&lt/i,exports.unsafeChars=/[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/,exports.needEsc=/[\\u0000-\\u001f&<\"\\/\\\\\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/,exports.needEscGlobal=/[\\u0000-\\u001f&<\"\\/\\\\\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,exports.starSlash=/\\*\\//,exports.identifier=/^([a-zA-Z_$][a-zA-Z0-9_$]*)$/,exports.javascriptURL=/^(?:javascript|jscript|ecmascript|vbscript|livescript)\\s*:/i,exports.fallsThrough=/^\\s*falls?\\sthrough\\s*$/,exports.maxlenException=/^(?:(?:\\/\\/|\\/\\*|\\*) ?)?[^ ]+$/},{}],\"/node_modules/jshint/src/scope-manager.js\":[function(_dereq_,module){\"use strict\";var _=_dereq_(\"../lodash\"),events=_dereq_(\"events\"),marker={},scopeManager=function(state,predefined,exported,declared){function _newScope(type){_current={\"(labels)\":Object.create(null),\"(usages)\":Object.create(null),\"(breakLabels)\":Object.create(null),\"(parent)\":_current,\"(type)\":type,\"(params)\":\"functionparams\"===type||\"catchparams\"===type?[]:null},_scopeStack.push(_current)}function warning(code,token){emitter.emit(\"warning\",{code:code,token:token,data:_.slice(arguments,2)})}function error(code,token){emitter.emit(\"warning\",{code:code,token:token,data:_.slice(arguments,2)})}function _setupUsages(labelName){_current[\"(usages)\"][labelName]||(_current[\"(usages)\"][labelName]={\"(modified)\":[],\"(reassigned)\":[],\"(tokens)\":[]})}function _checkForUnused(){if(\"functionparams\"===_current[\"(type)\"])return _checkParams(),void 0;var curentLabels=_current[\"(labels)\"];for(var labelName in curentLabels)curentLabels[labelName]&&\"exception\"!==curentLabels[labelName][\"(type)\"]&&curentLabels[labelName][\"(unused)\"]&&_warnUnused(labelName,curentLabels[labelName][\"(token)\"],\"var\")}function _checkParams(){var params=_current[\"(params)\"];if(params)for(var unused_opt,param=params.pop();param;){var label=_current[\"(labels)\"][param];if(unused_opt=_getUnusedOption(state.funct[\"(unusedOption)\"]),\"undefined\"===param)return;if(label[\"(unused)\"])_warnUnused(param,label[\"(token)\"],\"param\",state.funct[\"(unusedOption)\"]);else if(\"last-param\"===unused_opt)return;param=params.pop()}}function _getLabel(labelName){for(var i=_scopeStack.length-1;i>=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)\"]&&currentFunctParamScope[\"(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&&paramScope[\"(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)}});";
 
 /***/ }),
-/* 40 */
+/* 41 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -38327,7 +39294,7 @@ function substituteAliases(origCommand) {
 
 
 /***/ }),
-/* 41 */
+/* 42 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -38542,7 +39509,7 @@ let DarkWebItems = {
 
 
 /***/ }),
-/* 42 */
+/* 43 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -38876,7 +39843,7 @@ function initLiterature() {
 
 
 /***/ }),
-/* 43 */
+/* 44 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -39215,7 +40182,7 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) {
 /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
 
 /***/ }),
-/* 44 */
+/* 45 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -39225,7 +40192,7 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
 /* 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_InfiltrationBox_js__ = __webpack_require__(45);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_InfiltrationBox_js__ = __webpack_require__(46);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(4);
 
 
@@ -40043,7 +41010,7 @@ function getInfiltrationEscapeChance(inst) {
 
 
 /***/ }),
-/* 45 */
+/* 46 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -40165,7 +41132,7 @@ function infiltrationBoxCreate(inst) {
 
 
 /***/ }),
-/* 46 */
+/* 47 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -40304,633 +41271,6 @@ let FactionInfo = {
 
 
 
-/***/ }),
-/* 47 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HackingMission; });
-/* unused harmony export inMission */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return setInMission; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* 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);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_jsplumb__ = __webpack_require__(48);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_jsplumb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_jsplumb__);
-
-
-
-
-
-
-
-let inMission = false; //Flag to denote whether a mission is running
-function setInMission(bool) {
-    inMission = bool;
-}
-/* Hacking Missions */
-
-/*You start with N CPU nodes dependent on home computer cores
-
-Three main stats:
-    Attack - Specific to a node. Affected by hacking skill, RAM (for home comp)
-    Defense - Universal defense - summed from all nodes
-    HP - Specific to a node. Affected by hacking skill, RAM (for home comp)
-
-Enemy has the following nodes:
-    Firewall Nodes - Essentially shields. Weak attack but large def
-    CPU Nodes - Defeating and capturing these will give you new nodes to use
-    Database Node - Main Target
-
-Misc Nodes (initially not owned by player or enemy):
-    Spam nodes - Increases time limit
-    Transfer Nodes - Slightly increases attack for all of your CPUs
-    Shield Node - Increases your defense
-
-Shapes for nodes:
-    Firewall - Rectangle
-    CPU - Circle
-    Database - Parralelogram
-    Spam - Diamond
-    Transfer - Cone
-    Shield - Shield shape
-
-*/
-let NodeTypes = {
-    Core: "CPU Core Node",      //All actions available
-    Firewall: "Firewall Node",  //No actions available
-    Database: "Database Node",  //No actions available
-    Spam: "Spam Node",          //No actions Available
-    Transfer: "Transfer Node",  //Can Soften, Scan, and Overflow
-    Shield: "Shield Node"       //Can Fortify
-}
-
-let NodeActions = {
-    Attack: "Attack", //Damaged based on attack stat + hacking level + opp def
-    Scan: "Scan", //-Def for target, affected by hacking level
-    Soften: "Soften", //-Attack for target, affected by hacking level
-    Fortify: "Fortify", //+Defense for Node, affected by hacking level
-    Overflow: "Overflow", //+Attack but -Defense for Node, affected by hacking level
-}
-
-function Node(type, stats) {
-    this.type = type;
-    this.atk = stats.atk ? stats.atk : 0;
-    this.def = stats.def ? stats.def : 0;
-    this.hp = stats.hp ? stats.hp : 0;
-    this.maxhp = this.hp;
-    this.plyrCtrl = false;
-    this.enmyCtrl = false;
-    this.pos = [0, 0]; //x, y
-    this.el = null; //Holds the Node's DOM element
-    this.action = null;
-}
-
-Node.prototype.setPosition = function(x, y) {
-    this.pos = [x, y];
-}
-
-Node.prototype.setControlledByPlayer = function() {
-    this.plyrCtrl = true;
-    this.enmyCtrl = false;
-    if (this.el) {
-        this.classList.remove("hack-mission-enemy-node");
-        this.classList.add("hack-mission-player-node");
-    }
-}
-
-Node.prototype.setControlledByEnemy = function() {
-    this.plyrCtrl = false;
-    this.enmyCtrl = true;
-    if (this.el) {
-        this.classList.remove("hack-mission-player-node");
-        this.classList.add("hack-mission-enemy-node");
-    }
-}
-
-//Sets this node to be the active node
-Node.prototype.select = function(actionButtons) {
-    if (this.enmyCtrl) {return;}
-    this.el.classList.add("hack-mission-player-node-active");
-
-    //Make all buttons inactive
-    for (var i = 0; i < actionButtons.length; ++i) {
-        actionButtons[i].classList.remove("a-link-button");
-        actionButtons[i].classList.add("a-link-button-inactive");
-    }
-
-    switch(this.type) {
-        case NodeTypes.Core:
-            //All buttons active
-            for (var i = 0; i < actionButtons.length; ++i) {
-                actionButtons[i].classList.remove("a-link-button-inactive");
-                actionButtons[i].classList.add("a-link-button");
-            }
-            break;
-        case NodeTypes.Transfer:
-            actionButtons[1].classList.remove("a-link-button-inactive");
-            actionButtons[1].classList.add("a-link-button");
-            actionButtons[2].classList.remove("a-link-button-inactive");
-            actionButtons[2].classList.add("a-link-button");
-            actionButtons[4].classList.remove("a-link-button-inactive");
-            actionButtons[4].classList.add("a-link-button");
-            break;
-        default:
-            break;
-    }
-}
-
-Node.prototype.deselect = function(actionButtons) {
-    this.el.classList.remove("active");
-    for (var i = 0; i < actionButtons.length; ++i) {
-        actionButtons[i].classList.remove("a-link-button");
-        actionButtons[i].classList.add("a-link-button-inactive");
-    }
-}
-
-//Hacking mission instance
-//Takes in the reputation of the Faction for which the mission is
-//being conducted
-function HackingMission(rep, fac) {
-    this.faction = fac;
-
-    this.playerCores = [];
-    this.playerNodes = []; //Non-core nodes
-    this.playerDef = 0;
-
-    this.enemyCores = [];
-    this.enemyDatabases = [];
-    this.enemyNodes = []; //Non-core nodes
-    this.enemyDef = 0;
-
-    this.miscNodes = [];
-
-    this.selectedNode = null; //Which of the player's nodes is currently selected
-
-    this.actionButtons = []; //DOM buttons for actions
-
-    this.availablePositions = [];
-    for (var r = 0; r < 8; ++r) {
-        for (var c = 0; c < 8; ++c) {
-            this.availablePositions.push([r, c]);
-        }
-    }
-
-    //this.map = Array(8).fill(Array(8).fill(null)); //8x8 2d array of references to Nodes
-    this.map = [];
-    for (var i = 0; i < 8; ++i) {
-        this.map.push([null, null, null, null, null, null, null, null]);
-    }
-
-    //difficulty capped at 16
-    this.difficulty = Math.min(16, Math.round(rep / __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToDiffConversion) + 1);
-    console.log("difficulty: " + this.difficulty);
-    this.reward = 200 + (rep / __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToRewardConversion);
-}
-
-HackingMission.prototype.init = function() {
-    //Create Header DOM
-    this.createPageDom();
-
-    //Create player starting nodes
-    var home = __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].getHomeComputer()
-    for (var i = 0; i < home.cpuCores; ++i) {
-        var stats = {
-            atk: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 10) * (home.maxRam / 8),
-            def: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 20) * (home.maxRam / 2),
-            hp: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 5) * (home.maxRam / 4),
-        };
-        this.playerCores.push(new Node(NodeTypes.Core, stats));
-        this.playerCores[i].setControlledByPlayer();
-        this.setNodePosition(this.playerCores[i], 0, i);
-        this.removeAvailablePosition(0, i);
-    }
-
-    //Randomly generate enemy nodes (CPU and Firewall) based on difficulty
-    var numNodes = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 2);
-    var numFirewalls = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 5);
-    var numDatabases = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 1);
-    var totalNodes = numNodes + numFirewalls + numDatabases;
-    var xlimit = 7 - Math.floor(totalNodes / 8);
-    console.log("numNodes: " + numNodes);
-    console.log("numFirewalls: " + numFirewalls);
-    console.log("numDatabases: " + numDatabases);
-    console.log("totalNodes: " + totalNodes);
-    console.log("xlimit: " + xlimit);
-    var randMult = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
-    for (var i = 0; i < numNodes; ++i) {
-        var stats = {
-            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(400, 750),
-            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(400, 750),
-            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(800, 1200)
-        }
-        this.enemyCores.push(new Node(NodeTypes.Core, stats));
-        this.enemyCores[i].setControlledByEnemy();
-        this.setNodeRandomPosition(this.enemyCores[i], xlimit);
-    }
-    for (var i = 0; i < numFirewalls; ++i) {
-        var stats = {
-            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(100, 400),
-            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 2500),
-            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 2000)
-        }
-        this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));
-        this.enemyNodes[i].setControlledByEnemy();
-        this.setNodeRandomPosition(this.enemyNodes[i], xlimit);
-    }
-    for (var i = 0; i < numDatabases; ++i) {
-        var stats = {
-            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(100, 200),
-            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 1500),
-            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 2000)
-        }
-        var node = new Node(NodeTypes.Database, stats);
-        node.setControlledByEnemy();
-        this.setNodeRandomPosition(node, xlimit);
-        this.enemyDatabases.push(node);
-    }
-    this.calculateDefenses();
-    this.createMap();
-}
-
-HackingMission.prototype.createPageDom = function() {
-    var container = document.getElementById("mission-container");
-
-    var headerText = document.createElement("p");
-    headerText.innerHTML = "You are about to start a hacking mission! For more information " +
-                    "about how hacking missions work, click one of the guide links " +
-                    "below (one opens up an in-game guide and the other opens up " +
-                    "the guide from the wiki). Click the 'Start' button to begin.";
-    headerText.style.display = "block";
-    headerText.classList.add("hack-mission-header-element");
-    headerText.style.width = "80%";
-
-    var inGameGuideBtn = document.createElement("a");
-    inGameGuideBtn.innerText = "How to Play";
-    inGameGuideBtn.classList.add("a-link-button");
-    inGameGuideBtn.style.display = "inline-block";
-    inGameGuideBtn.classList.add("hack-mission-header-element");
-    inGameGuideBtn.addEventListener("click", function() {
-        Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionHowToPlay);
-        return false;
-    });
-
-    var wikiGuideBtn = document.createElement("a");
-    wikiGuideBtn.innerText = "Wiki Guide";
-    wikiGuideBtn.classList.add("a-link-button");
-    wikiGuideBtn.style.display = "inline-block";
-    wikiGuideBtn.classList.add("hack-mission-header-element");
-    wikiGuideBtn.target = "_blank";
-    //TODO Add link to wiki page     wikiGuideBtn.href =
-
-
-    //Start button will get replaced with forfeit when game is started
-    var startBtn = document.createElement("a");
-    startBtn.classList.add("hack-mission-header-element");
-    startBtn.style.display = "block";
-
-    //Create Action Buttons (Attack/Scan/Soften/ etc...)
-    var actionsContainer = document.createElement("span");
-    actionsContainer.classList.add("hack-mission-action-buttons-container");
-    for (var i = 0; i < 5; ++i) {
-        this.actionButtons.push(document.createElement("a"));
-        this.actionButtons[i].style.display = "inline-block";
-        this.actionButtons[i].classList.add("a-link-button-inactive"); //Disabled at start
-        this.actionButtons[i].classList.add("tooltip"); //Disabled at start
-        this.actionButtons[i].classList.add("hack-mission-header-element");
-        actionsContainer.appendChild(this.actionButtons[i]);
-    }
-    this.actionButtons[0].innerText = "Attack(1)";
-    var atkTooltip = document.createElement("span");
-    atkTooltip.classList.add("tooltiptext");
-    atkTooltip.innerText = "Lowers the targeted node's HP. The effectiveness of this depends on " +
-                           "this node's Attack level, your hacking level, and the opponents defense level.";
-    this.actionButtons[0].appendChild(atkTooltip);
-    this.actionButtons[1].innerText = "Scan(2)";
-    var scanTooltip = document.createElement("span");
-    scanTooltip.classList.add("tooltiptext");
-    scanTooltip.innerText = "Lowers the targeted node's defense. The effectiveness of this depends on " +
-                            "this node's Attack level and your hacking level";
-    this.actionButtons[1].appendChild(scanTooltip);
-    this.actionButtons[2].innerText = "Soften(3)";
-    var softenTooltip = document.createElement("span");
-    softenTooltip.classList.add("tooltiptext");
-    softenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
-                              "this node's Attack level and your hacking level";
-    this.actionButtons[2].appendChild(softenTooltip);
-    this.actionButtons[3].innerText = "Fortify(4)";
-    var fortifyTooltip = document.createElement("span");
-    fortifyTooltip.classList.add("tooltiptext");
-    fortifyTooltip.innerText = "Raises this node's Defense level. The effectiveness of this depends on " +
-                               "your hacking level";
-    this.actionButtons[3].appendChild(fortifyTooltip);
-    this.actionButtons[4].innerText = "Overflow(5)";
-    var overflowTooltip = document.createElement("span");
-    overflowTooltip.classList.add("tooltiptext");
-    overflowTooltip.innerText = "Raises this node's Attack level but lowers its Defense level. The effectiveness " +
-                                "of this depends on your hacking level.";
-    this.actionButtons[4].appendChild(overflowTooltip);
-
-    var timeDisplay = document.createElement("p");
-
-    container.appendChild(headerText);
-    container.appendChild(inGameGuideBtn);
-    container.appendChild(wikiGuideBtn);
-    container.appendChild(startBtn);
-    container.appendChild(actionsContainer);
-    container.appendChild(timeDisplay);
-}
-
-//Should only be used at the start
-HackingMission.prototype.calculateDefenses = function() {
-    var total = 0;
-    for (var i = 0; i < this.playerCores.length; ++i) {
-        total += this.playerCores[i].def;
-    }
-    for (var i = 0; i < this.playerNodes.length; ++i) {
-        total += this.playerNodes[i].def;
-    }
-    console.log("player defenses calculated to be: " + total);
-    this.playerDef = total;
-    total = 0;
-    for (var i = 0; i < this.enemyCores.length; ++i) {
-        total += this.enemyCores[i].def;
-    }
-    for (var i = 0; i < this.enemyDatabases.length; ++i) {
-        total += this.enemyDatabases[i].def;
-    }
-    for (var i = 0; i < this.enemyNodes.length; ++i) {
-        total += this.enemyNodes[i].def;
-    }
-    console.log("enemy defenses calculated to be: " + total);
-    this.enemyDef = total;
-}
-
-HackingMission.prototype.removeAvailablePosition = function(x, y) {
-    for (var i = 0; i < this.availablePositions.length; ++i) {
-        if (this.availablePositions[i][0] === x &&
-            this.availablePositions[i][1] === y) {
-            this.availablePositions.splice(i, 1);
-            return;
-        }
-    }
-    console.log("WARNING: removeAvailablePosition() did not remove " + x + ", " + y);
-}
-
-HackingMission.prototype.setNodePosition = function(nodeObj, x, y) {
-    if (!(nodeObj instanceof Node)) {
-        console.log("WARNING: Non-Node object passed into setNodePOsition");
-        return;
-    }
-    if (isNaN(x) || isNaN(y)) {
-        console.log("ERR: Invalid values passed as x and y for setNodePosition");
-        console.log(x);
-        console.log(y);
-        return;
-    }
-    nodeObj.pos = [x, y];
-    this.map[x][y] = nodeObj;
-}
-
-HackingMission.prototype.setNodeRandomPosition = function(nodeObj, xlimit=0) {
-    var i = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.availablePositions.length - 1);
-    var pos = this.availablePositions.splice(i, 1);
-    pos = pos[0];
-    this.setNodePosition(nodeObj, pos[0], pos[1]);
-}
-
-HackingMission.prototype.createMap = function() {
-    //Use a grid
-    var map = document.createElement("div");
-    map.classList.add("hack-mission-grid");
-    map.setAttribute("id", "hacking-mission-map");
-    document.getElementById("mission-container").appendChild(map);
-
-    //Create random Nodes for every space in the map that
-    //hasn't been filled yet
-    for (var x = 0; x < 8; ++x) {
-        for (var y = 0; y < 8; ++y) {
-            if (!(this.map[x][y] instanceof Node)) {
-                var node, type = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, 2);
-                var randMult = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
-                switch (type) {
-                    case 0: //Spam
-                        var stats = {
-                            atk: 0,
-                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(400, 800),
-                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000)
-                        }
-                        node = new Node(NodeTypes.Spam, stats);
-                        break;
-                    case 1: //Transfer
-                        var stats = {
-                            atk: 0,
-                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000),
-                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(600, 1100)
-                        }
-                        node = new Node(NodeTypes.Transfer, stats);
-                        break;
-                    case 2: //Shield
-                    default:
-                        var stats = {
-                            atk: 0,
-                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(750, 1000),
-                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(700, 1000)
-                        }
-                        node = new Node(NodeTypes.Shield, stats);
-                        break;
-                }
-                this.setNodePosition(node, x, y);
-                this.removeAvailablePosition(x, y);
-                this.miscNodes.push(node);
-            }
-        }
-    }
-
-    //Create DOM elements in order
-    for (var r = 0; r < 8; ++r) {
-        for (var c = 0; c < 8; ++c) {
-            this.createNodeDomElement(this.map[r][c]);
-        }
-    }
-
-    //Configure all Player CPUS
-    for (var i = 0; i < this.playerCores.length; ++i) {
-        console.log("Configuring Player Node: " + this.playerCores[i].el.id);
-        this.configurePlayerNodeElement(this.playerCores[i].el);
-    }
-
-    console.log(this.map);
-    this.initJsPlumb();
-}
-
-HackingMission.prototype.createNodeDomElement = function(nodeObj) {
-    var nodeDiv = document.createElement("a");
-    nodeObj.el = nodeDiv;
-    document.getElementById("hacking-mission-map").appendChild(nodeDiv);
-
-    //Set the node element's id based on its coordinates
-    nodeDiv.setAttribute("id", "hacking-mission-node-" +
-                                nodeObj.pos[0] + "-" +
-                                nodeObj.pos[1]);
-
-    //Set node classes for owner
-    nodeDiv.classList.add("hack-mission-node");
-    if (nodeObj.plyrCtrl) {
-        nodeDiv.classList.add("hack-mission-player-node");
-    } else if (nodeObj.enmyCtrl) {
-        nodeDiv.classList.add("hack-mission-enemy-node");
-    }
-
-    //Set node classes based on type
-    switch (nodeObj.type) {
-        case NodeTypes.Core:
-            nodeDiv.innerHTML = "<p>CPU Core<br>" + "HP: " +
-                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
-            nodeDiv.classList.add("hack-mission-cpu-node");
-            break;
-        case NodeTypes.Firewall:
-            nodeDiv.innerHTML = "<p>Firewall<br>" + "HP: " +
-                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
-            nodeDiv.classList.add("hack-mission-firewall-node");
-            break;
-        case NodeTypes.Database:
-            nodeDiv.innerHTML = "<p>Database<br>" + "HP: " +
-                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
-            nodeDiv.classList.add("hack-mission-database-node");
-            break;
-        case NodeTypes.Spam:
-            nodeDiv.innerHTML = "<p>Spam<br>" + "HP: " +
-                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
-            nodeDiv.classList.add("hack-mission-spam-node");
-            break;
-        case NodeTypes.Transfer:
-            nodeDiv.innerHTML = "<p>Transfer<br>" + "HP: " +
-                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
-            nodeDiv.classList.add("hack-mission-transfer-node");
-            break;
-        case NodeTypes.Shield:
-        default:
-            nodeDiv.innerHTML = "<p>Shield<br>" + "HP: " +
-                                Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1) + "</p>";
-            nodeDiv.classList.add("hack-mission-shield-node");
-            break;
-    }
-}
-
-//Gets a Node DOM element's corresponding Node object using its
-//element id
-HackingMission.prototype.getNodeFromElement = function(el) {
-    var id = el.id;
-    id = id.replace("hacking-mission-node-", "");
-    var res = id.split('-');
-    if (res.length != 2) {
-        console.log("ERROR Parsing Hacking Mission Node Id. Could not find coordinates");
-        return null;
-    }
-    var x = res[0], y = res[1];
-    if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) {
-        console.log("ERROR: Unexpected values for x and y: " + x + ", " + y);
-        return null;
-    }
-    return this.map[x][y];
-}
-
-//Configures a DOM element representing a player-owned node to
-//be selectable and actionable
-//Note: Does NOT change its css class. This is handled by Node.setControlledBy...
-HackingMission.prototype.configurePlayerNodeElement = function(el) {
-    var nodeObj = this.getNodeFromElement(el);
-    if (nodeObj === null) {console.log("Error getting Node object");}
-
-    //Add event listener
-    el.addEventListener("click", ()=>{
-        if (this.selectedNode instanceof Node) {
-            this.selectedNode.deselect(this.actionButtons);
-            this.selectedNode = null;
-        }
-        console.log("Selecting node :" + el.id);
-        nodeObj.select(this.actionButtons);
-        this.selectedNode = nodeObj;
-    });
-}
-
-//Configures a DOM element representing an enemy-node by removing
-//any event listeners
-HackingMission.prototype.configureEnemyNodeElement = function(el) {
-    //Deselect node if it was the selected node
-    var nodeObj = this.getNodeFromElement(el);
-    if (this.selectedNode == nodeObj) {
-        nodeObj.deselect(this.actionButtons);
-    }
-}
-
-HackingMission.prototype.initJsPlumb = function() {
-    var instance = jsPlumb.getInstance({
-        DragOptions:{cursor:"pointer", zIndex:2000},
-        PaintStyle: {
-            gradient: { stops: [
-                [ 0, "#FFFFFF" ],
-                [ 1, "#FFFFFF" ]
-            ] },
-            stroke: "#FFFFFF",
-            strokeWidth: 10
-        },
-    });
-
-    //All player cores are sources
-    for (var i = 0; i < this.playerCores.length; ++i) {
-        instance.makeSource(this.playerCores[i].el, {
-            deleteEndpointsOnEmpty:true,
-            maxConnections:1,
-            anchor:"Center",
-            connector:"Straight"
-        });
-    }
-
-    //Everything else is a target
-    for (var i = 0; i < this.enemyCores.length; ++i) {
-        instance.makeTarget(this.enemyCores[i].el, {
-            maxConnections:-1,
-            anchor:"Center",
-            connector:"Straight"
-        });
-    }
-    for (var i = 0; i < this.enemyDatabases.length; ++i) {
-        instance.makeTarget(this.enemyDatabases[i].el, {
-            maxConnections:-1,
-            anchor:"Center",
-            connector:["Straight"]
-        });
-    }
-    for (var i = 0; i < this.enemyNodes.length; ++i) {
-        instance.makeTarget(this.enemyNodes[i].el, {
-            maxConnections:-1,
-            anchor:"Center",
-            connector:"Straight"
-        });
-    }
-    for (var i = 0; i < this.miscNodes.length; ++i) {
-        instance.makeTarget(this.miscNodes[i].el, {
-            maxConnections:-1,
-            anchor:"Center",
-            connector:"Straight"
-        });
-    }
-
-    //Clicking a connection drops it
-    instance.bind("click", function(conn, originalEvent) {
-        console.log("test");
-        var endpoints = conn.endpoints;
-        endpoints[0].detachFrom(endpoints[1]);
-    });
-}
-
-
-
-
 /***/ }),
 /* 48 */
 /***/ (function(module, exports, __webpack_require__) {
@@ -59265,7 +59605,7 @@ init(true);function init(packaged) {
     if (!global || !global.document)
         return;
     
-    options.packaged = packaged || acequire.packaged || module.packaged || (global.define && __webpack_require__(38).packaged);
+    options.packaged = packaged || acequire.packaged || module.packaged || (global.define && __webpack_require__(39).packaged);
 
     var scriptOptions = {};
     var scriptUrl = "";
@@ -74563,7 +74903,7 @@ exports.config = acequire("./config");
 exports.acequire = acequire;
 
 if (true)
-    exports.define = __webpack_require__(38);
+    exports.define = __webpack_require__(39);
 exports.edit = function(el) {
     if (typeof el == "string") {
         var _id = el;
@@ -75458,7 +75798,7 @@ oop.inherits(Mode, TextMode);
     };
 
     this.createWorker = function(session) {
-        var worker = new WorkerClient(["ace"], __webpack_require__(39), "JavaScriptWorker");
+        var worker = new WorkerClient(["ace"], __webpack_require__(40), "JavaScriptWorker");
         worker.attachToDocument(session.getDocument());
 
         worker.on("annotate", function(results) {
@@ -76264,7 +76604,7 @@ oop.inherits(Mode, TextMode);
     };
 
     this.createWorker = function(session) {
-        var worker = new WorkerClient(["ace"], __webpack_require__(39), "JavaScriptWorker");
+        var worker = new WorkerClient(["ace"], __webpack_require__(40), "JavaScriptWorker");
         worker.attachToDocument(session.getDocument());
 
         worker.on("annotate", function(results) {
@@ -87933,7 +88273,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
 "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__(40);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(41);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(18);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(5);
diff --git a/src/Faction.js b/src/Faction.js
index 1b3191569..fa89f170d 100644
--- a/src/Faction.js
+++ b/src/Faction.js
@@ -471,7 +471,7 @@ function displayFactionContent(factionName) {
     newHackMissionButton.addEventListener("click", function() {
         Engine.loadMissionContent();
         var mission = new HackingMission(faction.playerReputation, faction);
-        setInMission(true); //Sets inMission flag to true
+        setInMission(true, mission); //Sets inMission flag to true
         mission.init();
         return false;
     });
diff --git a/src/Missions.js b/src/Missions.js
index 563984dc2..019a2a066 100644
--- a/src/Missions.js
+++ b/src/Missions.js
@@ -1,14 +1,21 @@
-import {Player}                                     from "./Player.js";
 import {CONSTANTS}                                  from "./Constants.js";
+import {Engine}                                     from "./engine.js";
+import {Player}                                     from "./Player.js";
 import {dialogBoxCreate}                            from "../utils/DialogBox.js";
 import {addOffset, getRandomInt,
         clearEventListenersEl}                      from "../utils/HelperFunctions.js";
-import {formatNumber}                               from "../utils/StringHelperFunctions.js";
+import {formatNumber, isString}                     from "../utils/StringHelperFunctions.js";
 import jsplumb                                      from 'jsplumb'
 
 let inMission = false; //Flag to denote whether a mission is running
-function setInMission(bool) {
+let currMission = null;
+function setInMission(bool, mission) {
     inMission = bool;
+    if (bool) {
+        currMission = mission;
+    } else {
+        currMission = null;
+    }
 }
 /* Hacking Missions */
 
@@ -43,16 +50,16 @@ let NodeTypes = {
     Firewall: "Firewall Node",  //No actions available
     Database: "Database Node",  //No actions available
     Spam: "Spam Node",          //No actions Available
-    Transfer: "Transfer Node",  //Can Soften, Scan, and Overflow
+    Transfer: "Transfer Node",  //Can Weaken, Scan, and Overflow
     Shield: "Shield Node"       //Can Fortify
 }
 
 let NodeActions = {
-    Attack: "Attack", //Damaged based on attack stat + hacking level + opp def
-    Scan: "Scan", //-Def for target, affected by hacking level
-    Soften: "Soften", //-Attack for target, affected by hacking level
-    Fortify: "Fortify", //+Defense for Node, affected by hacking level
-    Overflow: "Overflow", //+Attack but -Defense for Node, affected by hacking level
+    Attack: "Attacking", //Damaged based on attack stat + hacking level + opp def
+    Scan: "Scanning", //-Def for target, affected by hacking level
+    Weaken: "Weakening", //-Attack for target, affected by hacking level
+    Fortify: "Fortifying", //+Defense for Node, affected by hacking level
+    Overflow: "Overflowing", //+Attack but -Defense for Node, affected by hacking level
 }
 
 function Node(type, stats) {
@@ -66,6 +73,11 @@ function Node(type, stats) {
     this.pos = [0, 0]; //x, y
     this.el = null; //Holds the Node's DOM element
     this.action = null;
+
+    //Holds the JsPlumb Connection object for this Node,
+    //where this Node is the Source (since each Node
+    //can only have 1 outgoing Connection)
+    this.conn = null;
 }
 
 Node.prototype.setPosition = function(x, y) {
@@ -76,8 +88,8 @@ Node.prototype.setControlledByPlayer = function() {
     this.plyrCtrl = true;
     this.enmyCtrl = false;
     if (this.el) {
-        this.classList.remove("hack-mission-enemy-node");
-        this.classList.add("hack-mission-player-node");
+        this.el.classList.remove("hack-mission-enemy-node");
+        this.el.classList.add("hack-mission-player-node");
     }
 }
 
@@ -85,8 +97,8 @@ Node.prototype.setControlledByEnemy = function() {
     this.plyrCtrl = false;
     this.enmyCtrl = true;
     if (this.el) {
-        this.classList.remove("hack-mission-player-node");
-        this.classList.add("hack-mission-enemy-node");
+        this.el.classList.remove("hack-mission-player-node");
+        this.el.classList.add("hack-mission-enemy-node");
     }
 }
 
@@ -136,6 +148,8 @@ Node.prototype.deselect = function(actionButtons) {
 function HackingMission(rep, fac) {
     this.faction = fac;
 
+    this.time = 120000; //2 minutes, milliseconds
+
     this.playerCores = [];
     this.playerNodes = []; //Non-core nodes
     this.playerDef = 0;
@@ -158,12 +172,13 @@ function HackingMission(rep, fac) {
         }
     }
 
-    //this.map = Array(8).fill(Array(8).fill(null)); //8x8 2d array of references to Nodes
     this.map = [];
     for (var i = 0; i < 8; ++i) {
         this.map.push([null, null, null, null, null, null, null, null]);
     }
 
+    this.jsplumbinstance = null;
+
     //difficulty capped at 16
     this.difficulty = Math.min(16, Math.round(rep / CONSTANTS.HackingMissionRepToDiffConversion) + 1);
     console.log("difficulty: " + this.difficulty);
@@ -178,9 +193,9 @@ HackingMission.prototype.init = function() {
     var home = Player.getHomeComputer()
     for (var i = 0; i < home.cpuCores; ++i) {
         var stats = {
-            atk: (Player.hacking_skill / 10) * (home.maxRam / 8),
-            def: (Player.hacking_skill / 20) * (home.maxRam / 2),
-            hp: (Player.hacking_skill / 5) * (home.maxRam / 4),
+            atk: (Player.hacking_skill / 10),
+            def: (Player.hacking_skill / 25),
+            hp: (Player.hacking_skill / 5),
         };
         this.playerCores.push(new Node(NodeTypes.Core, stats));
         this.playerCores[i].setControlledByPlayer();
@@ -198,13 +213,12 @@ HackingMission.prototype.init = function() {
     console.log("numFirewalls: " + numFirewalls);
     console.log("numDatabases: " + numDatabases);
     console.log("totalNodes: " + totalNodes);
-    console.log("xlimit: " + xlimit);
     var randMult = addOffset(this.difficulty, 20);
     for (var i = 0; i < numNodes; ++i) {
         var stats = {
-            atk: randMult * getRandomInt(400, 750),
-            def: randMult * getRandomInt(400, 750),
-            hp: randMult * getRandomInt(800, 1200)
+            atk: randMult * getRandomInt(150, 200),
+            def: randMult * getRandomInt(40, 75),
+            hp: randMult * getRandomInt(225, 275)
         }
         this.enemyCores.push(new Node(NodeTypes.Core, stats));
         this.enemyCores[i].setControlledByEnemy();
@@ -212,9 +226,9 @@ HackingMission.prototype.init = function() {
     }
     for (var i = 0; i < numFirewalls; ++i) {
         var stats = {
-            atk: randMult * getRandomInt(100, 400),
-            def: randMult * getRandomInt(1000, 2500),
-            hp: randMult * getRandomInt(500, 2000)
+            atk: randMult * getRandomInt(10, 25),
+            def: randMult * getRandomInt(50, 75),
+            hp: randMult * getRandomInt(175, 200)
         }
         this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));
         this.enemyNodes[i].setControlledByEnemy();
@@ -222,9 +236,9 @@ HackingMission.prototype.init = function() {
     }
     for (var i = 0; i < numDatabases; ++i) {
         var stats = {
-            atk: randMult * getRandomInt(100, 200),
-            def: randMult * getRandomInt(1000, 1500),
-            hp: randMult * getRandomInt(1000, 2000)
+            atk: randMult * getRandomInt(20, 30),
+            def: randMult * getRandomInt(25, 40),
+            hp: randMult * getRandomInt(120, 150)
         }
         var node = new Node(NodeTypes.Database, stats);
         node.setControlledByEnemy();
@@ -268,11 +282,14 @@ HackingMission.prototype.createPageDom = function() {
 
     //Start button will get replaced with forfeit when game is started
     var startBtn = document.createElement("a");
+    startBtn.innerHTML = "Start";
+    startBtn.classList.add("a-link-button");
     startBtn.classList.add("hack-mission-header-element");
-    startBtn.style.display = "block";
+    startBtn.style.display = "inline-block";
 
-    //Create Action Buttons (Attack/Scan/Soften/ etc...)
+    //Create Action Buttons (Attack/Scan/Weaken/ etc...)
     var actionsContainer = document.createElement("span");
+    actionsContainer.style.display = "block";
     actionsContainer.classList.add("hack-mission-action-buttons-container");
     for (var i = 0; i < 5; ++i) {
         this.actionButtons.push(document.createElement("a"));
@@ -282,37 +299,88 @@ HackingMission.prototype.createPageDom = function() {
         this.actionButtons[i].classList.add("hack-mission-header-element");
         actionsContainer.appendChild(this.actionButtons[i]);
     }
-    this.actionButtons[0].innerText = "Attack(1)";
+    this.actionButtons[0].innerText = "Attack(a)";
     var atkTooltip = document.createElement("span");
     atkTooltip.classList.add("tooltiptext");
     atkTooltip.innerText = "Lowers the targeted node's HP. The effectiveness of this depends on " +
                            "this node's Attack level, your hacking level, and the opponents defense level.";
     this.actionButtons[0].appendChild(atkTooltip);
-    this.actionButtons[1].innerText = "Scan(2)";
+    this.actionButtons[1].innerText = "Scan(s)";
     var scanTooltip = document.createElement("span");
     scanTooltip.classList.add("tooltiptext");
     scanTooltip.innerText = "Lowers the targeted node's defense. The effectiveness of this depends on " +
                             "this node's Attack level and your hacking level";
     this.actionButtons[1].appendChild(scanTooltip);
-    this.actionButtons[2].innerText = "Soften(3)";
-    var softenTooltip = document.createElement("span");
-    softenTooltip.classList.add("tooltiptext");
-    softenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
+    this.actionButtons[2].innerText = "Weaken(w)";
+    var WeakenTooltip = document.createElement("span");
+    WeakenTooltip.classList.add("tooltiptext");
+    WeakenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
                               "this node's Attack level and your hacking level";
-    this.actionButtons[2].appendChild(softenTooltip);
-    this.actionButtons[3].innerText = "Fortify(4)";
+    this.actionButtons[2].appendChild(WeakenTooltip);
+    this.actionButtons[3].innerText = "Fortify(f)";
     var fortifyTooltip = document.createElement("span");
     fortifyTooltip.classList.add("tooltiptext");
     fortifyTooltip.innerText = "Raises this node's Defense level. The effectiveness of this depends on " +
                                "your hacking level";
     this.actionButtons[3].appendChild(fortifyTooltip);
-    this.actionButtons[4].innerText = "Overflow(5)";
+    this.actionButtons[4].innerText = "Overflow(r)";
     var overflowTooltip = document.createElement("span");
     overflowTooltip.classList.add("tooltiptext");
     overflowTooltip.innerText = "Raises this node's Attack level but lowers its Defense level. The effectiveness " +
                                 "of this depends on your hacking level.";
     this.actionButtons[4].appendChild(overflowTooltip);
 
+    //Set Action Button event listeners
+    this.actionButtons[0].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Attack, false); //Set attack button inactive
+        this.selectedNode.action = NodeActions.Attack;
+    });
+
+    this.actionButtons[1].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Scan, false); //Set scan button inactive
+        this.selectedNode.action = NodeActions.Scan;
+    });
+
+    this.actionButtons[2].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Weaken, false); //Set Weaken button inactive
+        this.selectedNode.action = NodeActions.Weaken;
+    });
+
+    this.actionButtons[3].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Fortify, false); //Set Fortify button inactive
+        this.selectedNode.action = NodeActions.Fortify;
+    });
+
+    this.actionButtons[4].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Overflow, false); //Set Overflow button inactive
+        this.selectedNode.action = NodeActions.Overflow;
+    });
+
     var timeDisplay = document.createElement("p");
 
     container.appendChild(headerText);
@@ -323,6 +391,52 @@ HackingMission.prototype.createPageDom = function() {
     container.appendChild(timeDisplay);
 }
 
+HackingMission.prototype.setActionButtonsInactive = function() {
+    for (var i = 0; i < this.actionButtons.length; ++i) {
+        this.actionButtons[i].classList.remove("a-link-button");
+        this.actionButtons[i].classList.add("a-link-button-inactive");
+    }
+}
+
+HackingMission.prototype.setActionButtonsActive = function() {
+    for (var i = 0; i < this.actionButtons.length; ++i) {
+        this.actionButtons[i].classList.add("a-link-button");
+        this.actionButtons[i].classList.remove("a-link-button-inactive");
+    }
+}
+
+//True for active, false for inactive
+HackingMission.prototype.setActionButton = function(i, active=true) {
+    if (isString(i)) {
+        switch (i) {
+            case NodeActions.Attack:
+                i = 0;
+                break;
+            case NodeActions.Scan:
+                i = 1;
+                break;
+            case NodeActions.Weaken:
+                i = 2;
+                break;
+            case NodeActions.Fortify:
+                i = 3;
+                break;
+            case NodeActions.Overflow:
+            default:
+                i = 4;
+                break;
+        }
+    }
+    if (active) {
+        this.actionButtons[i].classList.remove("a-link-button-inactive");
+        this.actionButtons[i].classList.add("a-link-button");
+    } else {
+        this.actionButtons[i].classList.remove("a-link-button");
+        this.actionButtons[i].classList.add("a-link-button-inactive");
+    }
+
+}
+
 //Should only be used at the start
 HackingMission.prototype.calculateDefenses = function() {
     var total = 0;
@@ -399,16 +513,16 @@ HackingMission.prototype.createMap = function() {
                     case 0: //Spam
                         var stats = {
                             atk: 0,
-                            def: randMult * getRandomInt(400, 800),
-                            hp: randMult * getRandomInt(500, 1000)
+                            def: randMult * getRandomInt(10, 20),
+                            hp: randMult * getRandomInt(60, 90)
                         }
                         node = new Node(NodeTypes.Spam, stats);
                         break;
                     case 1: //Transfer
                         var stats = {
                             atk: 0,
-                            def: randMult * getRandomInt(500, 1000),
-                            hp: randMult * getRandomInt(600, 1100)
+                            def: randMult * getRandomInt(35, 45),
+                            hp: randMult * getRandomInt(75, 90)
                         }
                         node = new Node(NodeTypes.Transfer, stats);
                         break;
@@ -416,8 +530,8 @@ HackingMission.prototype.createMap = function() {
                     default:
                         var stats = {
                             atk: 0,
-                            def: randMult * getRandomInt(750, 1000),
-                            hp: randMult * getRandomInt(700, 1000)
+                            def: randMult * getRandomInt(80, 100),
+                            hp: randMult * getRandomInt(100, 125)
                         }
                         node = new Node(NodeTypes.Shield, stats);
                         break;
@@ -442,7 +556,6 @@ HackingMission.prototype.createMap = function() {
         this.configurePlayerNodeElement(this.playerCores[i].el);
     }
 
-    console.log(this.map);
     this.initJsPlumb();
 }
 
@@ -465,39 +578,93 @@ HackingMission.prototype.createNodeDomElement = function(nodeObj) {
     }
 
     //Set node classes based on type
+    var txt;
     switch (nodeObj.type) {
         case NodeTypes.Core:
-            nodeDiv.innerHTML = "<p>CPU Core<br>" + "HP: " +
-                                formatNumber(nodeObj.hp, 1) + "</p>";
+            txt = "<p>CPU Core<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-cpu-node");
             break;
         case NodeTypes.Firewall:
-            nodeDiv.innerHTML = "<p>Firewall<br>" + "HP: " +
-                                formatNumber(nodeObj.hp, 1) + "</p>";
+            txt = "<p>Firewall<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-firewall-node");
             break;
         case NodeTypes.Database:
-            nodeDiv.innerHTML = "<p>Database<br>" + "HP: " +
-                                formatNumber(nodeObj.hp, 1) + "</p>";
+            txt = "<p>Database<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-database-node");
             break;
         case NodeTypes.Spam:
-            nodeDiv.innerHTML = "<p>Spam<br>" + "HP: " +
-                                formatNumber(nodeObj.hp, 1) + "</p>";
+            txt = "<p>Spam<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-spam-node");
             break;
         case NodeTypes.Transfer:
-            nodeDiv.innerHTML = "<p>Transfer<br>" + "HP: " +
-                                formatNumber(nodeObj.hp, 1) + "</p>";
+            txt = "<p>Transfer<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-transfer-node");
             break;
         case NodeTypes.Shield:
         default:
-            nodeDiv.innerHTML = "<p>Shield<br>" + "HP: " +
-                                formatNumber(nodeObj.hp, 1) + "</p>";
+            txt = "<p>Shield<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-shield-node");
             break;
     }
+
+    txt += "<br>Atk: " + formatNumber(nodeObj.atk, 1) +
+           "<br>Def: " + formatNumber(nodeObj.def, 1) + "</p>";
+    nodeDiv.innerHTML = txt;
+}
+
+HackingMission.prototype.updateNodeDomElement = function(nodeObj) {
+    if (nodeObj.el === null) {
+        console.log("ERR: Calling updateNodeDomElement on a Node without an element");
+        return;
+    }
+
+    var nodeDiv = document.getElementById("hacking-mission-node-" +
+                                          nodeObj.pos[0] + "-" +
+                                          nodeObj.pos[1]);
+
+    //Set node classes based on type
+    var txt;
+    switch (nodeObj.type) {
+        case NodeTypes.Core:
+            txt = "<p>CPU Core<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Firewall:
+            txt = "<p>Firewall<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Database:
+            txt = "<p>Database<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Spam:
+            txt = "<p>Spam<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Transfer:
+            txt = "<p>Transfer<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Shield:
+        default:
+            txt = "<p>Shield<br>" + "HP: " +
+                  formatNumber(nodeObj.hp, 1);
+            break;
+    }
+
+    txt += "<br>Atk: " + formatNumber(nodeObj.atk, 1) +
+           "<br>Def: " + formatNumber(nodeObj.def, 1);
+    if (nodeObj.action) {
+        txt += "<br>" + nodeObj.action;
+    }
+    txt += "</p>";
+    nodeDiv.innerHTML = txt;
 }
 
 //Gets a Node DOM element's corresponding Node object using its
@@ -547,6 +714,17 @@ HackingMission.prototype.configureEnemyNodeElement = function(el) {
     }
 }
 
+//Returns bool indicating whether a node is reachable by player
+//by checking if any of the adjacent nodes are owned by the player
+HackingMission.prototype.nodeReachable = function(node) {
+    var x = node.pos[0], y = node.pos[1];
+    if (x > 0 && this.map[x-1][y].plyrCtrl) {return true;}
+    if (x < 7 && this.map[x+1][y].plyrCtrl) {return true;}
+    if (y > 0 && this.map[x][y-1].plyrCtrl) {return true;}
+    if (y < 7 && this.map[x][y+1].plyrCtrl) {return true;}
+    return false;
+}
+
 HackingMission.prototype.initJsPlumb = function() {
     var instance = jsPlumb.getInstance({
         DragOptions:{cursor:"pointer", zIndex:2000},
@@ -556,10 +734,12 @@ HackingMission.prototype.initJsPlumb = function() {
                 [ 1, "#FFFFFF" ]
             ] },
             stroke: "#FFFFFF",
-            strokeWidth: 10
+            strokeWidth: 8
         },
     });
 
+    this.jsplumbinstance = instance;
+
     //All player cores are sources
     for (var i = 0; i < this.playerCores.length; ++i) {
         instance.makeSource(this.playerCores[i].el, {
@@ -602,10 +782,218 @@ HackingMission.prototype.initJsPlumb = function() {
 
     //Clicking a connection drops it
     instance.bind("click", function(conn, originalEvent) {
-        console.log("test");
         var endpoints = conn.endpoints;
         endpoints[0].detachFrom(endpoints[1]);
     });
+
+    //Connection events
+    instance.bind("connection", (info)=>{
+        var targetNode = this.getNodeFromElement(info.target);
+
+        //If the node is not reachable, drop the connection
+        if (!this.nodeReachable(targetNode)) {
+            info.sourceEndpoint.detachFrom(info.targetEndpoint);
+            return;
+        }
+
+        var sourceNode = this.getNodeFromElement(info.source);
+        sourceNode.conn = info.connection;
+    });
+
+    //Detach Connection events
+    instance.bind("connectionDetached", (info, originalEvent)=>{
+        var sourceNode = this.getNodeFromElement(info.source);
+        sourceNode.conn = null;
+    });
 }
 
-export {HackingMission, inMission, setInMission};
+//Drops all connections where the specified node is the source
+HackingMission.prototype.dropAllConnectionsFromNode = function(node) {
+    var allConns = this.jsplumbinstance.getAllConnections();
+    for (var i = allConns.length-1; i >= 0; --i) {
+        if (allConns[i].source == node.el) {
+            allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
+        }
+    }
+}
+
+//Drops all connections where the specified node is the target
+HackingMission.prototype.dropAllConnectionsToNode = function(node) {
+    var allConns = this.jsplumbinstance.getAllConnections();
+    for (var i = allConns.length-1; i >= 0; --i) {
+        if (allConns[i].target == node.el) {
+            allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
+        }
+    }
+}
+
+HackingMission.prototype.process = function(numCycles=1) {
+    var res = true;
+    //Process actions of all player nodes
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        res &= this.processNode(this.playerCores[i], numCycles);
+    }
+
+    //Process actions of all enemy nodes
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        res &= this.processNode(this.enemyCores[i], numCycles);
+    }
+
+    if (res) {this.calculateDefenses();}
+
+    //TODO Check if win/lose
+
+    //Update timer and check if player lost
+    this.time -= (numCycles * Engine._idleSpeed);
+    if (this.time <= 0) {
+        this.finishMission(false);
+    }
+}
+
+//Returns a bool representing whether defenses need to be re-calculated
+HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
+    if (nodeObj.action === null) {return;}
+
+    var targetNode = null, def;
+    if (nodeObj.conn) {
+        targetNode = this.getNodeFromElement(nodeObj.conn.target);
+        if (targetNode.plyrCtrl) {
+            def = this.playerDef;
+        } else if (targetNode.enmyCtrl) {
+            def = this.enemyDef;
+        } else { //Misc Node
+            def = targetNode.def;
+        }
+    }
+
+    //Calculations are per second, so divide everything by 5
+    var calcDefenses = false;
+    switch(nodeObj.action) {
+        case NodeActions.Attack:
+            if (nodeObj.conn === null) {break;}
+            var dmg = this.calculateAttackDamage(nodeObj.atk, def, Player.hacking_skill);
+            targetNode.hp -= (dmg/5 * numCycles);
+            break;
+        case NodeActions.Scan:
+            if (nodeObj.conn === null) {break;}
+            var eff = this.calculateScanEffect(def, Player.hacking_skill);
+            targetNode.def -= (eff/5 * numCycles);
+            calcDefenses = true;
+            break;
+        case NodeActions.Weaken:
+            if (nodeObj.conn === null) {break;}
+            var eff = this.calculateWeakenEffect(def, Player.hacking_skill);
+            targetNode.atk -= (eff/5 * numCycles);
+            break;
+        case NodeActions.Fortify:
+            var eff = this.calculateFortifyEffect(Player.hacking_skill);
+            nodeObj.def += (eff/5 * numCycles);
+            calcDefenses = true;
+            break;
+        case NodeActions.Overflow:
+            var eff = this.calculateOverflowEffect(Player.hacking_skill);
+            if (nodeObj.def < eff) {break;}
+            nodeObj.def -= (eff/5 * numCycles);
+            nodeObj.atk += (eff/5 * numCycles);
+            calcDefenses = true;
+            break;
+        default:
+            console.log("ERR: Invalid Node Action: " + nodeObj.action);
+            break;
+    }
+
+    //Stats can't go below 0
+    if (nodeObj.atk < 0) {nodeObj.atk = 0;}
+    if (nodeObj.def < 0) {nodeObj.def = 0;}
+    if (targetNode && targetNode.atk < 0) {targetNode.atk = 0;}
+    if (targetNode && targetNode.def < 0) {targetNode.def = 0;}
+
+    //Conquering a node
+    if (targetNode && targetNode.hp <= 0) {
+        var conqueredByPlayer = nodeObj.plyrCtrl;
+        targetNode.hp = targetNode.maxhp;
+        targetNode.action = null;
+        targetNode.conn = null;
+        if (this.selectedNode == targetNode) {
+            targetNode.deselect();
+        }
+        this.dropAllConnectionsToNode(targetNode);
+        this.dropAllConnectionsFromNode(targetNode);
+        if (conqueredByPlayer) {
+            targetNode.setControlledByPlayer()
+        } else { //Conquered by enemy
+            targetNode.setControlledByEnemy();
+        }
+        calcDefenses = true;
+
+        function swapNodes(orig, dest, targetNode) {
+            for (var i = 0; i < orig.length; ++i) {
+                if (orig[i] == targetNode) {
+                    var node = orig.splice(i, 1);
+                    dest.push(node);
+                    break;
+                }
+            }
+        }
+
+        switch(targetNode.type) {
+            case NodeTypes.Core:
+                if (conqueredByPlayer) {
+                    swapNodes(this.enemyCores, this.playerCores, targetNode);
+                } else {
+                    swapNodes(this.playerCores, this.enemyCores, targetNode);
+                }
+                break;
+            case NodeTypes.Firewall:
+                if (conqueredByPlayer) {
+                    swapNodes(this.enemyNodes, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(this.playerNodes, this.enemyNodes, targetNode);
+                }
+                break;
+            case NodeTypes.Database:
+                break;
+            case NodeTypes.Spam:
+                break;
+            case NodeTypes.Transfer:
+                break;
+            case NodeTypes.Shield:
+                break;
+        }
+    }
+    this.updateNodeDomElement(nodeObj);
+    if (targetNode) {this.updateNodeDomElement(targetNode);}
+    return calcDefenses;
+}
+
+var hackEffWeightSelf = 100; //Weight for Node actions on self
+var hackEffWeightTarget = 10; //Weight for Node Actions against Target
+var hackEffWeightAttack = 100; //Weight for Attack action
+
+//Returns damage per cycle based on stats
+HackingMission.prototype.calculateAttackDamage = function(atk, def, hacking = 0) {
+    return Math.max(atk + (hacking / hackEffWeightAttack) - def, 0.1);
+}
+
+HackingMission.prototype.calculateScanEffect = function(def, hacking=0) {
+    return Math.max(hacking / hackEffWeightTarget - def, 0.1);
+}
+
+HackingMission.prototype.calculateWeakenEffect = function(def, hacking=0) {
+    return Math.max(hacking / hackEffWeightTarget - def, 0.1);
+}
+
+HackingMission.prototype.calculateFortifyEffect = function(hacking=0) {
+    return hacking / hackEffWeightSelf;
+}
+
+HackingMission.prototype.calculateOverflowEffect = function(hacking=0) {
+    return hacking / hackEffWeightSelf;
+}
+
+//The 'win' argument is a bool for whether or not the player won
+HackingMission.prototype.finishMission = function(win) {
+
+}
+
+export {HackingMission, inMission, setInMission, currMission};
diff --git a/src/Player.js b/src/Player.js
index 99ca2c18f..9d412cf44 100644
--- a/src/Player.js
+++ b/src/Player.js
@@ -1224,7 +1224,9 @@ PlayerObject.prototype.finishCreateProgramWork = function(cancelled, sing=false)
         this.getHomeComputer().programs.push(incompleteName);
     }
 
-    this.gainIntelligenceExp(this.createProgramReqLvl / CONSTANTS.IntelligenceProgramBaseExpGain);
+    if (!cancelled) {
+        this.gainIntelligenceExp(this.createProgramReqLvl / CONSTANTS.IntelligenceProgramBaseExpGain);
+    }
 
     var mainMenu = document.getElementById("mainmenu-container");
     mainMenu.style.visibility = "visible";
diff --git a/src/Server.js b/src/Server.js
index 40ec51bc4..295cb1701 100644
--- a/src/Server.js
+++ b/src/Server.js
@@ -80,7 +80,7 @@ Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvai
     this.moneyMax = 25 * this.moneyAvailable * BitNodeMultipliers.ServerMaxMoney;
 	this.hackDifficulty = hackDifficulty * BitNodeMultipliers.ServerStartingSecurity;
     this.baseDifficulty = hackDifficulty * BitNodeMultipliers.ServerStartingSecurity;
-    this.minDifficulty = Math.max(1, Math.round(hackDifficulty / 3));
+    this.minDifficulty = Math.max(1, Math.round(this.hackDifficulty / 3));
 	this.serverGrowth = serverGrowth;
 }
 
diff --git a/src/engine.js b/src/engine.js
index de87ea2a7..dd8768492 100644
--- a/src/engine.js
+++ b/src/engine.js
@@ -30,6 +30,7 @@ import {displayHacknetNodesContent, processAllHacknetNodeEarnings,
 import {iTutorialStart}                         from "./InteractiveTutorial.js";
 import {initLiterature}                         from "./Literature.js";
 import {checkForMessagesToSend, initMessages}   from "./Message.js";
+import {inMission, currMission}                 from "./Missions.js";
 import {initSingularitySFFlags,
         hasSingularitySF}                       from "./NetscriptFunctions.js";
 import {updateOnlineScriptTimes,
@@ -70,7 +71,7 @@ import {Terminal, postNetburnerText, post}      from "./Terminal.js";
  *  Alt-o - Options
  */
 $(document).keydown(function(e) {
-    if (!Player.isWorking && !redPillFlag) {
+    if (!Player.isWorking && !redPillFlag && !inMission) {
         if (e.keyCode == 84 && e.altKey) {
             e.preventDefault();
             Engine.loadTerminalContent();
@@ -831,6 +832,10 @@ let Engine = {
             Player.gang.process(numCycles);
         }
 
+        if (inMission && currMission) {
+            currMission.process(numCycles);
+        }
+
         //Counters
         Engine.decrementAllCounters(numCycles);
         Engine.checkCounters();

From 25232225659c75007724a92abb61f48cb9424ee7 Mon Sep 17 00:00:00 2001
From: danielyxie <danielyxie@gmail.com>
Date: Mon, 25 Sep 2017 21:44:33 -0500
Subject: [PATCH 4/6] More work on Hacking mission

---
 css/styles.css            |    6 +
 dist/bundle.js            | 1245 +++++++++++++++++++++++--------------
 src/ActiveScriptsUI.js    |    6 +-
 src/Constants.js          |   83 ++-
 src/Missions.js           |  307 +++++++--
 src/NetscriptFunctions.js |   27 +
 src/Player.js             |   19 +-
 src/engine.js             |   10 +-
 8 files changed, 1149 insertions(+), 554 deletions(-)

diff --git a/css/styles.css b/css/styles.css
index db1ba27d7..60d6e6601 100644
--- a/css/styles.css
+++ b/css/styles.css
@@ -144,6 +144,12 @@ a:link, a:visited {
     background-color: #666;
 }
 
+.a-link-button:active {
+    -webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
+	-moz-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
+	box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
+}
+
 /* Make anchor tags ("a" elements) inactive (not clickable) */
 .a-link-button-inactive {
     text-decoration: none;
diff --git a/dist/bundle.js b/dist/bundle.js
index afec863d3..b4e4f2060 100644
--- a/dist/bundle.js
+++ b/dist/bundle.js
@@ -60,7 +60,7 @@
 /******/ 	__webpack_require__.p = "";
 /******/
 /******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(__webpack_require__.s = 5);
+/******/ 	return __webpack_require__(__webpack_require__.s = 4);
 /******/ })
 /************************************************************************/
 /******/ ([
@@ -76,7 +76,7 @@
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(14);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Crimes_js__ = __webpack_require__(37);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Gang_js__ = __webpack_require__(30);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Location_js__ = __webpack_require__(12);
@@ -88,8 +88,8 @@
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__ = __webpack_require__(1);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_IPAddress_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* 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);
 
 
 
@@ -179,8 +179,7 @@ function PlayerObject() {
 
     //Servers
     this.currentServer          = ""; //IP address of Server currently being accessed through terminal
-    this.discoveredServers      = []; //IP addresses of secret servers not in the network that you have discovered
-    this.purchasedServers       = [];
+    this.purchasedServers       = []; //IP Addresses of purchased servers
     this.hacknetNodes           = [];
     this.totalHacknetNodeProduction = 0;
 
@@ -273,6 +272,9 @@ function PlayerObject() {
 	this.lastUpdate = 0;
     this.totalPlaytime = 0;
     this.playtimeSinceLastAug = 0;
+
+    //Script production since last Aug installation
+    this.scriptProdSinceLastAug = 0;
 };
 
 PlayerObject.prototype.init = function() {
@@ -318,7 +320,6 @@ PlayerObject.prototype.prestigeAugmentation = function() {
     this.companyName = "";
     this.companyPosition = "";
 
-    this.discoveredServers = [];
     this.purchasedServers = [];
 
     this.factions = [];
@@ -397,7 +398,6 @@ PlayerObject.prototype.prestigeSourceFile = function() {
     this.companyName = "";
     this.companyPosition = "";
 
-    this.discoveredServers = [];
     this.purchasedServers = [];
 
     this.factions = [];
@@ -1449,6 +1449,7 @@ PlayerObject.prototype.takeClass = function(numCycles) {
 //through a Singularity Netscript function
 PlayerObject.prototype.finishClass = function(sing=false) {
     this.gainWorkExp();
+    this.gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].IntelligenceClassBaseExpGain * Math.round(this.timeWorked / 1000));
 
     if (this.workMoneyGained > 0) {
         throw new Error("ERR: Somehow gained money while taking class");
@@ -1599,6 +1600,14 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
                             Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility experience<br>" +
                             Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma experience");
         } else {
+            //Exp halved on failure
+            this.workHackExpGained  /= 2;
+            this.workStrExpGained   /= 2;
+            this.workDefExpGained   /= 2;
+            this.workDexExpGained   /= 2;
+            this.workAgiExpGained   /= 2;
+            this.workChaExpGained   /= 2;
+
             Object(__WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Crime failed! <br><br>" +
                     "You gained:<br>"+
                     Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking experience <br>" +
@@ -1612,8 +1621,6 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
         this.gainWorkExp();
     }
 
-
-
     var mainMenu = document.getElementById("mainmenu-container");
     mainMenu.style.visibility = "visible";
     this.isWorking = false;
@@ -2417,7 +2424,7 @@ function dialogBoxCreate(txt) {
 
 
 
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
 /* 2 */
@@ -2631,11 +2638,48 @@ let CONSTANTS = {
     IntelligenceProgramBaseExpGain: 1000, //Program required hack level divided by this to determine int exp gain
     IntelligenceTerminalHackBaseExpGain: 200, //Hacking exp divided by this to determine int exp gain
     IntelligenceSingFnBaseExpGain: 0.0005,
+    IntelligenceClassBaseExpGain: 0.0000001,
 
     //Hacking Missions
     HackingMissionRepToDiffConversion: 5000, //Faction rep is divided by this to get mission difficulty
     HackingMissionRepToRewardConversion: 20, //Faction rep divided byt his to get mission rep reward
-    HackingMissionHowToPlay: "Hacking missions are a minigame that, if won, will reward you with factin reputation",
+    HackingMissionSpamTimeIncrease: 20000, //How much time limit increase is gained when conquering a Spam Node (ms)
+    HackingMissionTransferAttackIncrease: 1.05, //Multiplier by which the attack for all Core Nodes is increased when conquering a Transfer Node
+    HackingMissionHowToPlay: "Hacking missions are a minigame that, if won, will reward you with faction reputation.<br><br>" +
+                             "In this game you control a set of Nodes and use them to try and defeat an enemy. Your Nodes " +
+                             "are colored blue, while the enemy's are red. There are also other nodes on the map colored gray" +
+                             "that initially belong to neither you nor the enemy. The goal of the game is " +
+                             "to capture all of the enemy's database nodes, which are the parallelogram-shaped ones, within the time limit. " +
+                             "If you cannot capture all of the enemy's database nodes in the time limit, you will lose.<br><br>" +
+                             "Each Node has three stats: Attack, Defense, and HP. There are five different actions that " +
+                             "a Node can take:<br><br> " +
+                             "Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the Node's Attack, the Player's " +
+                             "hacking level, and the enemy's defense.<br>" +
+                             "Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the Player's hacking level and the " +
+                             "enemy's defense.<br>"  +
+                             "Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the Player's hacking level and the enemy's " +
+                             "defense.<br>" +
+                             "Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.<br><br>" +
+                             "To capture a Node, you must lower its HP down to 0. " +
+                             "A Node's 'Attack' stats affects its effectiveness when attacking other Nodes. A Node's 'Defense' helps protect " +
+                             "against the actions of enemy Nodes. One important thing to note is that, when defending, your total 'Defense' " +
+                             "(sum of the Defense of all of your Nodes) is what's taken into account when determining the effect of offensive actions. " +
+                             "However, when attacking, only the 'Attack' of the Node being used to attack is taken into account.<br><br>" +
+                             "There are six different types of Nodes:<br><br>" +
+                             "CPU Core - These are your main Nodes that are used to perform actions<br>" +
+                             "Firewall - Nodes with high defense. These Nodes cannot perform any actions<br>" +
+                             "Database - A special type of Node. The player's objective is to conquer all of the enemy's Database Nodes within " +
+                             "the time limit. These Nodes cannot perform any actions<br>"  +
+                             "Spam - Conquering one of these Nodes will slow the enemy's trace, giving the player additional time to complete " +
+                             "the mission. These Nodes cannot perform any actions<br>" +
+                             "Transfer - Conquering one of these nodes will increase the Attack of all of your CPU Cores by a small fixed percentage. " +
+                             "These Nodes are capable of performing every action except the 'Attack' action<br>" +
+                             "Shield - Nodes with high defense. These Nodes cannot perform any actions<br><br>" +
+                             "For certain actions such as attacking, scanning, and weakening, the Node performing the action must have a target. To target " +
+                             "another node, simply click-and-drag from the 'source' Node to a target. A Node can only have one target, and you can only target " +
+                             "Nodes that are adjacent to one of your Nodes (immediately above, below, or to the side. NOT diagonal). Furthermore, only CPU Cores and Transfer Nodes " +
+                             "can target, since they are the only ones that can perform actions",
+
 
     //Gang constants
     GangRespectToReputationRatio: 2, //Respect is divided by this to get rep gain
@@ -2930,18 +2974,18 @@ let CONSTANTS = {
                            "the hostnames or IPs of the scanned servers should be output. If it is true then hostnames will be returned, and if false then IP addresses will. " +
                            "This second argument is optional and, if ommitted, the function will output " +
                            "the hostnames of the scanned servers. The hostnames/IPs in the returned array are strings.<br><br>" +
-                           "<i>nuke(hostname/ip)</i><br>Run NUKE.exe on the target server. NUKE.exe must exist on your home computer. Does NOT work while offline <br> Example: nuke('foodnstuff'); <br><br>" +
-                           "<i>brutessh(hostname/ip)</i><br>Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer. Does NOT work while offline <br> Example: brutessh('foodnstuff');<br><br>" +
-                           "<i>ftpcrack(hostname/ip)</i><br>Run FTPCrack.exe on the target server. FTPCrack.exe must exist on your home computer. Does NOT work while offline <br> Example: ftpcrack('foodnstuff');<br><br>" +
-                           "<i>relaysmtp(hostname/ip)</i><br>Run relaySMTP.exe on the target server. relaySMTP.exe must exist on your home computer. Does NOT work while offline <br> Example: relaysmtp('foodnstuff');<br><br>" +
-                           "<i>httpworm(hostname/ip)</i><br>Run HTTPWorm.exe on the target server. HTTPWorm.exe must exist on your home computer. Does NOT work while offline <br> Example: httpworm('foodnstuff');<br><br>" +
-                           "<i>sqlinject(hostname/ip)</i><br>Run SQLInject.exe on the target server. SQLInject.exe must exist on your home computer. Does NOT work while offline  <br> Example: sqlinject('foodnstuff');<br><br>" +
+                           "<i>nuke(hostname/ip)</i><br>Run NUKE.exe on the target server. NUKE.exe must exist on your home computer.<br> Example: nuke('foodnstuff'); <br><br>" +
+                           "<i>brutessh(hostname/ip)</i><br>Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer.<br> Example: brutessh('foodnstuff');<br><br>" +
+                           "<i>ftpcrack(hostname/ip)</i><br>Run FTPCrack.exe on the target server. FTPCrack.exe must exist on your home computer.<br> Example: ftpcrack('foodnstuff');<br><br>" +
+                           "<i>relaysmtp(hostname/ip)</i><br>Run relaySMTP.exe on the target server. relaySMTP.exe must exist on your home computer.<br> Example: relaysmtp('foodnstuff');<br><br>" +
+                           "<i>httpworm(hostname/ip)</i><br>Run HTTPWorm.exe on the target server. HTTPWorm.exe must exist on your home computer.<br> Example: httpworm('foodnstuff');<br><br>" +
+                           "<i>sqlinject(hostname/ip)</i><br>Run SQLInject.exe on the target server. SQLInject.exe must exist on your home computer.<br> Example: sqlinject('foodnstuff');<br><br>" +
                            "<i>run(script, [numThreads], [args...])</i> <br> Run a script as a separate process. The first argument that is passed in is the name of the script as a string. This function can only " +
                            "be used to run scripts located on the current server (the server running the script that calls this function). The second argument " +
                            "is optional, and it specifies how many threads to run the script with. This argument must be a number greater than 0. If it is omitted, then the script will be run single-threaded. Any additional arguments will specify " +
                            "arguments to pass into the new script that is being run. If arguments are specified for the new script, then the second argument numThreads argument must be filled in with a value.<br><br>" +
                            "Returns true if the script is successfully started, and false otherwise. Requires a significant amount " +
-                           "of RAM to run this command. Does NOT work while offline <br><br>" +
+                           "of RAM to run this command.<br><br>" +
                            "The simplest way to use the run command is to call it with just the script name. The following example will run 'foo.script' single-threaded with no arguments:<br><br>" +
                            "run('foo.script');<br><br>" +
                            "The following example will run 'foo.script' but with 5 threads instead of single-threaded:<br><br>" +
@@ -2953,7 +2997,7 @@ let CONSTANTS = {
                            "The third argument is optional, and it specifies how many threads to run the script with. If it is omitted, then the script will be run single-threaded. " +
                            "This argument must be a number that is greater than 0. Any additional arguments will specify arguments to pass into the new script that is being run. If " +
                            "arguments are specified for the new script, then the third argument numThreads must be filled in with a value.<br><br>Returns " +
-                           "true if the script is successfully started, and false otherwise. Does NOT work while offline<br><br> " +
+                           "true if the script is successfully started, and false otherwise.<br><br> " +
                            "The simplest way to use the exec command is to call it with just the script name and the target server. The following example will try to run 'generic-hack.script' " +
                            "on the 'foodnstuff' server:<br><br>" +
                            "exec('generic-hack.script', 'foodnstuff');<br><br>" +
@@ -2991,11 +3035,11 @@ let CONSTANTS = {
                            "<i>ls(hostname/ip)</i><br>Returns an array containing the names of all files on the specified server. The argument must be a " +
                            "string with the hostname or IP of the target server.<br><br>" +
                            "<i>hasRootAccess(hostname/ip)</i><br> Returns a boolean (true or false) indicating whether or not the Player has root access to a server. " +
-                           "The argument passed in must be a string with either the hostname or IP of the target server. Does NOT work while offline.<br> " +
+                           "The argument passed in must be a string with either the hostname or IP of the target server.<br> " +
                            "Example:<br>if (hasRootAccess('foodnstuff') == false) {<br>&nbsp;&nbsp;&nbsp;&nbsp;nuke('foodnstuff');<br>}<br><br>" +
                            "<i>getIp()</i><br>Returns a string with the IP Address of the server that the script is running on <br><br>" +
                            "<i>getHostname()</i><br>Returns a string with the hostname of the server that the script is running on<br><br>" +
-                           "<i>getHackingLevel()</i><br>Returns the Player's current hacking level. Does NOT work while offline<br><br> " +
+                           "<i>getHackingLevel()</i><br>Returns the Player's current hacking level.<br><br> " +
                            "<i>getIntelligence()</i><br>Returns the Player's current intelligence level. Requires Source-File 5 to run<br><br>" +
                            "<i>getHackingMultipliers()</i><br>Returns an object containing the Player's hacking related multipliers. " +
                            "These multipliers are returned in integer forms, not percentages (e.g. 1.5 instead of 150%). " +
@@ -3040,24 +3084,26 @@ let CONSTANTS = {
                            "print(mults.ServerMaxMoney);<br>" +
                            "print(mults.HackExpGain);<br><br>" +
                            "<i>getServerMoneyAvailable(hostname/ip)</i><br> Returns the amount of money available on a server. The argument passed in must be a string with either the " +
-                           "hostname or IP of the target server. Does NOT work while offline <br> Example: getServerMoneyAvailable('foodnstuff');<br><br>" +
+                           "hostname or IP of the target server.<br> Example: getServerMoneyAvailable('foodnstuff');<br><br>" +
                            "<i>getServerMaxMoney(hostname/ip)</i><br>Returns the maximum amount of money that can be available on a server. The argument passed in must be a string with " +
-                           "the hostname or IP of the target server. Does NOT work while offline<br>Example: getServerMaxMoney('foodnstuff');<br><br>" +
+                           "the hostname or IP of the target server.<br>Example: getServerMaxMoney('foodnstuff');<br><br>" +
                            "<i>getServerGrowth(hostname/ip)</i><br>Returns the server's intrinsic 'growth parameter'. This growth parameter is a number " +
                            "between 1 and 100 that represents how quickly the server's money grows. This parameter affects the percentage by which this server's " +
                            "money is increased when using the grow() function. A higher growth parameter will result in a higher percentage from grow().<br><br>" +
                            "The argument passed in must be a string with the hostname or IP of the target server.<br><br>" +
                            "<i>getServerSecurityLevel(hostname/ip)</i><br>Returns the security level of a server. The argument passed in must be a string with either the " +
-                           "hostname or IP of the target server. A server's security is denoted by a number between 1 and 100. Does NOT work while offline.<br><br>" +
-                           "<i>getServerBaseSecurityLevel(hostname/ip)</i><br> Returns the base security level of a server. This is the security level that the server starts out with. " +
+                           "hostname or IP of the target server. A server's security is denoted by a number, typically between 1 and 100.<br><br>" +
+                           "<i>getServerBaseSecurityLevel(hostname/ip)</i><br>Returns the base security level of a server. This is the security level that the server starts out with. " +
                            "This is different than getServerSecurityLevel() because getServerSecurityLevel() returns the current security level of a server, which can constantly change " +
                            "due to hack(), grow(), and weaken() calls on that server. The base security level will stay the same until you reset by installing an Augmentation. <br><br>" +
-                           "The argument passed in must be a string with either the hostname or IP of the target server. A server's base security is denoted by a number between 1 and 100. " +
-                           "Does NOT work while offline.<br><br>" +
+                           "The argument passed in must be a string with either the hostname or IP of the target server. A server's base security is denoted by a number, typically between 1 and 100. " +
+                           "<br><br>" +
+                           "<i>getServerMinSecurityLevel(hostname/ip)</i>Returns the minimum security level of a server. The argument passed in must be a string with " +
+                           "either the hostname or IP of the target server.<br><br>" +
                            "<i>getServerRequiredHackingLevel(hostname/ip)</i><br>Returns the required hacking level of a server. The argument passed in must be a string with either the " +
-                           "hostname or IP or the target server. Does NOT work while offline <br><br>" +
+                           "hostname or IP or the target server.<br><br>" +
                            "<i>getServerNumPortsRequired(hostname/ip)</i><br>Returns the number of open ports required to successfully run NUKE.exe on a server. The argument " +
-                           "passed in must be a string with either the hostname or IP of the target server. Does NOT work while offline<br><br>" +
+                           "passed in must be a string with either the hostname or IP of the target server.<br><br>" +
                            "<i>getServerRam(hostname/ip)</i><br>Returns an array with two elements that gives information about the target server's RAM. The first " +
                            "element in the array is the amount of RAM that the server has (in GB). The second element in the array is the amount of RAM that " +
                            "is currently being used on the server.<br><br>" +
@@ -3471,6 +3517,12 @@ let CONSTANTS = {
     LatestUpdate:
     "v0.29.1<br>" +
     "-Added continue statement for for/while loops<br>" +
+    "-Added getServerMinSecurityLevel() Netscript function<br>" +
+    "-Added Javascript's Date module to Netscript. Since 'new' is not supported in Netscript yet, only the Date module's " +
+    "static methods will work (now(), UTC(), parse(), etc.).<br>" +
+    "-Failing a crime now gives half the experience it did before<br>" +
+    "-The repeated 'Find The-Cave' message after installing The Red Pill Augmentation now only happens " +
+    "if you've never destroyed a BitNode before<br>" +
     "-fileExists() function now works on literature files<br><br>" +
     "v0.29.0<br>" +
     "-Added BitNode-5: Artificial Intelligence<br>" +
@@ -3495,166 +3547,6 @@ let CONSTANTS = {
 /* 4 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
-"use strict";
-/* unused harmony export getIndicesOf */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return convertTimeMsToTimeElapsedString; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return longestCommonStart; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isString; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isPositiveNumber; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return containsAllStrings; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return formatNumber; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return numOccurrences; });
-/* unused harmony export numNetscriptOperators */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isHTML; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__DialogBox_js__ = __webpack_require__(1);
-
-
-//Netburner String helper functions
-
-//Searches for every occurence of searchStr within str and returns an array of the indices of
-//all these occurences
-function getIndicesOf(searchStr, str, caseSensitive) {
-    var searchStrLen = searchStr.length;
-    if (searchStrLen == 0) {
-        return [];
-    }
-    var startIndex = 0, index, indices = [];
-    if (!caseSensitive) {
-        str = str.toLowerCase();
-        searchStr = searchStr.toLowerCase();
-    }
-    while ((index = str.indexOf(searchStr, startIndex)) > -1) {
-        indices.push(index);
-        startIndex = index + searchStrLen;
-    }
-    return indices;
-}
-
-//Replaces the character at an index with a new character
-String.prototype.replaceAt=function(index, character) {
-    return this.substr(0, index) + character + this.substr(index+character.length);
-}
-
-//Converts a date representing time in milliseconds to a string with the format
-//      H hours M minutes and S seconds
-// e.g. 10000 -> "0 hours 0 minutes and 10 seconds"
-//      120000 -> "0 0 hours 2 minutes and 0 seconds"
-function convertTimeMsToTimeElapsedString(time) {
-    //Convert ms to seconds, since we only have second-level precision
-    time = Math.floor(time / 1000);
-
-    var days = Math.floor(time / 86400);
-    time %= 86400;
-
-    var hours = Math.floor(time / 3600);
-    time %= 3600;
-
-    var minutes = Math.floor(time / 60);
-    time %= 60;
-
-    var seconds = time;
-
-    var res = "";
-    if (days) {res += days + " days ";}
-    if (hours) {res += hours + " hours ";}
-    if (minutes) {res += minutes + " minutes ";}
-    res += seconds + " seconds ";
-    return res;
-}
-
-//Finds the longest common starting substring in a set of strings
-function longestCommonStart(strings) {
-    if (!containsAllStrings(strings)) {return;}
-    if (strings.length == 0) {return;}
-
-    var A = strings.concat().sort(),
-    a1= A[0], a2= A[A.length-1], L= a1.length, i= 0;
-    while(i<L && a1.charAt(i).toLowerCase() === a2.charAt(i).toLowerCase()) i++;
-    return a1.substring(0, i);
-}
-
-
-//Returns whether a variable is a string
-function isString(str) {
-    return (typeof str === 'string' || str instanceof String);
-}
-
-//Returns true if string contains only digits (meaning it would be a positive number)
-function isPositiveNumber(str) {
-    return /^\d+$/.test(str);
-}
-
-//Returns whether an array contains entirely of string objects
-function containsAllStrings(arr) {
-    return arr.every(isString);
-}
-
-//Formats a number with commas and a specific number of decimal digits
-function formatNumber(num, numFractionDigits) {
-    return num.toLocaleString(undefined, {
-        minimumFractionDigits: numFractionDigits,
-        maximumFractionDigits: numFractionDigits
-    });
-}
-
-//Count the number of times a substring occurs in a string
-function numOccurrences(string, subString) {
-    string += "";
-    subString += "";
-    if (subString.length <= 0) return (string.length + 1);
-
-    var n = 0, pos = 0, step = subString.length;
-
-    while (true) {
-        pos = string.indexOf(subString, pos);
-        if (pos >= 0) {
-            ++n;
-            pos += step;
-        } else break;
-    }
-    return n;
-}
-
-//Counters the number of Netscript operators in a string
-function numNetscriptOperators(string) {
-    var total = 0;
-    total += numOccurrences(string, "+");
-    total += numOccurrences(string, "-");
-    total += numOccurrences(string, "*");
-    total += numOccurrences(string, "/");
-    total += numOccurrences(string, "%");
-    total += numOccurrences(string, "&&");
-    total += numOccurrences(string, "||");
-    total += numOccurrences(string, "<");
-    total += numOccurrences(string, ">");
-    total += numOccurrences(string, "<=");
-    total += numOccurrences(string, ">=");
-    total += numOccurrences(string, "==");
-    total += numOccurrences(string, "!=");
-    if (isNaN(total)) {
-        Object(__WEBPACK_IMPORTED_MODULE_0__DialogBox_js__["a" /* dialogBoxCreate */])("ERROR in counting number of operators in script. This is a bug, please report to game developer");
-        total = 0;
-    }
-    return total;
-}
-
-//Checks if a string contains HTML elements
-function isHTML(str) {
-    var a = document.createElement('div');
-    a.innerHTML = str;
-    for (var c = a.childNodes, i = c.length; i--; ) {
-        if (c[i].nodeType == 1) return true;
-    }
-    return false;
-}
-
-
-
-
-/***/ }),
-/* 5 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
 "use strict";
 Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
 /* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Engine", function() { return Engine; });
@@ -3663,7 +3555,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__ = __webpack_require__(36);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(27);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__ = __webpack_require__(23);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__ = __webpack_require__(17);
@@ -3922,6 +3814,7 @@ let Engine = {
         Engine.hideAllContent();
         Engine.Display.activeScriptsContent.style.visibility = "visible";
         Object(__WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__["c" /* setActiveScriptsClickHandlers */])();
+        Object(__WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__["d" /* updateActiveScriptsItems */])();
         Engine.currentPage = Engine.Page.ActiveScripts;
         document.getElementById("active-scripts-menu-link").classList.add("active");
     },
@@ -4069,6 +3962,7 @@ let Engine = {
         document.getElementById("mainmenu-container").style.visibility = "hidden";
         document.getElementById("character-overview-wrapper").style.visibility = "hidden";
         Engine.Display.missionContent.style.visibility = "visible";
+        Engine.currentPage = Engine.Page.Mission;
     },
 
     //Helper function that hides all content
@@ -4151,6 +4045,11 @@ let Engine = {
         if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyPosition != "") {
             companyPosition = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyPosition.positionName;
         }
+
+        var bnText = "";
+        if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].sourceFiles.length !== 0) {
+            bnText = "<br>Current BitNode: " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].bitNodeN;
+        }
         Engine.Display.characterInfo.innerHTML =
        ('<b>General</b><br><br>' +
         'Current City: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].city + '<br><br>' +
@@ -4202,7 +4101,8 @@ let Engine = {
         'Hacknet Nodes owned: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknetNodes.length + '<br>' +
         'Augmentations installed: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].augmentations.length + '<br>' +
         'Time played since last Augmentation: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug) + '<br>' +
-        'Time played: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime) + '<br><br><br>').replace( / /g, "&nbsp;" );
+        'Time played: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime) +
+        bnText + '<br><br><br>').replace( / /g, "&nbsp;" );
     },
 
     /* Display locations in the world*/
@@ -5335,7 +5235,167 @@ window.onload = function() {
 
 
 
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
+
+/***/ }),
+/* 5 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* unused harmony export getIndicesOf */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return convertTimeMsToTimeElapsedString; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return longestCommonStart; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isString; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isPositiveNumber; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return containsAllStrings; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return formatNumber; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return numOccurrences; });
+/* unused harmony export numNetscriptOperators */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isHTML; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__DialogBox_js__ = __webpack_require__(1);
+
+
+//Netburner String helper functions
+
+//Searches for every occurence of searchStr within str and returns an array of the indices of
+//all these occurences
+function getIndicesOf(searchStr, str, caseSensitive) {
+    var searchStrLen = searchStr.length;
+    if (searchStrLen == 0) {
+        return [];
+    }
+    var startIndex = 0, index, indices = [];
+    if (!caseSensitive) {
+        str = str.toLowerCase();
+        searchStr = searchStr.toLowerCase();
+    }
+    while ((index = str.indexOf(searchStr, startIndex)) > -1) {
+        indices.push(index);
+        startIndex = index + searchStrLen;
+    }
+    return indices;
+}
+
+//Replaces the character at an index with a new character
+String.prototype.replaceAt=function(index, character) {
+    return this.substr(0, index) + character + this.substr(index+character.length);
+}
+
+//Converts a date representing time in milliseconds to a string with the format
+//      H hours M minutes and S seconds
+// e.g. 10000 -> "0 hours 0 minutes and 10 seconds"
+//      120000 -> "0 0 hours 2 minutes and 0 seconds"
+function convertTimeMsToTimeElapsedString(time) {
+    //Convert ms to seconds, since we only have second-level precision
+    time = Math.floor(time / 1000);
+
+    var days = Math.floor(time / 86400);
+    time %= 86400;
+
+    var hours = Math.floor(time / 3600);
+    time %= 3600;
+
+    var minutes = Math.floor(time / 60);
+    time %= 60;
+
+    var seconds = time;
+
+    var res = "";
+    if (days) {res += days + " days ";}
+    if (hours) {res += hours + " hours ";}
+    if (minutes) {res += minutes + " minutes ";}
+    res += seconds + " seconds ";
+    return res;
+}
+
+//Finds the longest common starting substring in a set of strings
+function longestCommonStart(strings) {
+    if (!containsAllStrings(strings)) {return;}
+    if (strings.length == 0) {return;}
+
+    var A = strings.concat().sort(),
+    a1= A[0], a2= A[A.length-1], L= a1.length, i= 0;
+    while(i<L && a1.charAt(i).toLowerCase() === a2.charAt(i).toLowerCase()) i++;
+    return a1.substring(0, i);
+}
+
+
+//Returns whether a variable is a string
+function isString(str) {
+    return (typeof str === 'string' || str instanceof String);
+}
+
+//Returns true if string contains only digits (meaning it would be a positive number)
+function isPositiveNumber(str) {
+    return /^\d+$/.test(str);
+}
+
+//Returns whether an array contains entirely of string objects
+function containsAllStrings(arr) {
+    return arr.every(isString);
+}
+
+//Formats a number with commas and a specific number of decimal digits
+function formatNumber(num, numFractionDigits) {
+    return num.toLocaleString(undefined, {
+        minimumFractionDigits: numFractionDigits,
+        maximumFractionDigits: numFractionDigits
+    });
+}
+
+//Count the number of times a substring occurs in a string
+function numOccurrences(string, subString) {
+    string += "";
+    subString += "";
+    if (subString.length <= 0) return (string.length + 1);
+
+    var n = 0, pos = 0, step = subString.length;
+
+    while (true) {
+        pos = string.indexOf(subString, pos);
+        if (pos >= 0) {
+            ++n;
+            pos += step;
+        } else break;
+    }
+    return n;
+}
+
+//Counters the number of Netscript operators in a string
+function numNetscriptOperators(string) {
+    var total = 0;
+    total += numOccurrences(string, "+");
+    total += numOccurrences(string, "-");
+    total += numOccurrences(string, "*");
+    total += numOccurrences(string, "/");
+    total += numOccurrences(string, "%");
+    total += numOccurrences(string, "&&");
+    total += numOccurrences(string, "||");
+    total += numOccurrences(string, "<");
+    total += numOccurrences(string, ">");
+    total += numOccurrences(string, "<=");
+    total += numOccurrences(string, ">=");
+    total += numOccurrences(string, "==");
+    total += numOccurrences(string, "!=");
+    if (isNaN(total)) {
+        Object(__WEBPACK_IMPORTED_MODULE_0__DialogBox_js__["a" /* dialogBoxCreate */])("ERROR in counting number of operators in script. This is a bug, please report to game developer");
+        total = 0;
+    }
+    return total;
+}
+
+//Checks if a string contains HTML elements
+function isHTML(str) {
+    var a = document.createElement('div');
+    a.innerHTML = str;
+    for (var c = a.childNodes, i = c.length; i--; ) {
+        if (c[i].nodeType == 1) return true;
+    }
+    return false;
+}
+
+
+
 
 /***/ }),
 /* 6 */
@@ -5360,7 +5420,7 @@ window.onload = function() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__ = __webpack_require__(11);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(8);
 
 
 
@@ -6130,87 +6190,6 @@ function PrintAllServers() {
 
 /***/ }),
 /* 7 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Reviver; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Generic_toJSON; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Generic_fromJSON; });
-/* Generic Reviver, toJSON, and fromJSON functions used for saving and loading objects */
-
-// A generic "smart reviver" function.
-// Looks for object values with a `ctor` property and
-// a `data` property. If it finds them, and finds a matching
-// constructor that has a `fromJSON` property on it, it hands
-// off to that `fromJSON` fuunction, passing in the value.
-function Reviver(key, value) {
-	var ctor;
-    if (value == null) {
-        console.log("Reviver WRONGLY called with key: " + key + ", and value: " + value);
-        return 0;
-    }
-	if (typeof value === "object" &&
-		typeof value.ctor === "string" &&
-		typeof value.data !== "undefined") {
-			ctor = Reviver.constructors[value.ctor] || window[value.ctor];
-			if (typeof ctor === "function" &&
-				typeof ctor.fromJSON === "function") {
-
-					return ctor.fromJSON(value);
-			}
-	}
-	return value;
-}
-Reviver.constructors = {}; // A list of constructors the smart reviver should know about
-
-// A generic "toJSON" function that creates the data expected
-// by Reviver.
-// `ctorName`  The name of the constructor to use to revive it
-// `obj`       The object being serialized
-// `keys`      (Optional) Array of the properties to serialize,
-//             if not given then all of the objects "own" properties
-//             that don't have function values will be serialized.
-//             (Note: If you list a property in `keys`, it will be serialized
-//             regardless of whether it's an "own" property.)
-// Returns:    The structure (which will then be turned into a string
-//             as part of the JSON.stringify algorithm)
-function Generic_toJSON(ctorName, obj, keys) {
-  var data, index, key;
-
-  if (!keys) {
-    keys = Object.keys(obj); // Only "own" properties are included
-  }
-
-  data = {};
-  for (index = 0; index < keys.length; ++index) {
-    key = keys[index];
-    data[key] = obj[key];
-  }
-  return {ctor: ctorName, data: data};
-}
-
-// A generic "fromJSON" function for use with Reviver: Just calls the
-// constructor function with no arguments, then applies all of the
-// key/value pairs from the raw data to the instance. Only useful for
-// constructors that can be reasonably called without arguments!
-// `ctor`      The constructor to call
-// `data`      The data to apply
-// Returns:    The object
-function Generic_fromJSON(ctor, data) {
-  var obj, name;
-
-  obj = new ctor();
-  for (name in data) {
-    obj[name] = data[name];
-  }
-  return obj;
-}
-
-
-
-
-/***/ }),
-/* 8 */
 /***/ (function(module, exports, __webpack_require__) {
 
 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
@@ -16469,6 +16448,87 @@ return jQuery;
 } );
 
 
+/***/ }),
+/* 8 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Reviver; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Generic_toJSON; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Generic_fromJSON; });
+/* Generic Reviver, toJSON, and fromJSON functions used for saving and loading objects */
+
+// A generic "smart reviver" function.
+// Looks for object values with a `ctor` property and
+// a `data` property. If it finds them, and finds a matching
+// constructor that has a `fromJSON` property on it, it hands
+// off to that `fromJSON` fuunction, passing in the value.
+function Reviver(key, value) {
+	var ctor;
+    if (value == null) {
+        console.log("Reviver WRONGLY called with key: " + key + ", and value: " + value);
+        return 0;
+    }
+	if (typeof value === "object" &&
+		typeof value.ctor === "string" &&
+		typeof value.data !== "undefined") {
+			ctor = Reviver.constructors[value.ctor] || window[value.ctor];
+			if (typeof ctor === "function" &&
+				typeof ctor.fromJSON === "function") {
+
+					return ctor.fromJSON(value);
+			}
+	}
+	return value;
+}
+Reviver.constructors = {}; // A list of constructors the smart reviver should know about
+
+// A generic "toJSON" function that creates the data expected
+// by Reviver.
+// `ctorName`  The name of the constructor to use to revive it
+// `obj`       The object being serialized
+// `keys`      (Optional) Array of the properties to serialize,
+//             if not given then all of the objects "own" properties
+//             that don't have function values will be serialized.
+//             (Note: If you list a property in `keys`, it will be serialized
+//             regardless of whether it's an "own" property.)
+// Returns:    The structure (which will then be turned into a string
+//             as part of the JSON.stringify algorithm)
+function Generic_toJSON(ctorName, obj, keys) {
+  var data, index, key;
+
+  if (!keys) {
+    keys = Object.keys(obj); // Only "own" properties are included
+  }
+
+  data = {};
+  for (index = 0; index < keys.length; ++index) {
+    key = keys[index];
+    data[key] = obj[key];
+  }
+  return {ctor: ctorName, data: data};
+}
+
+// A generic "fromJSON" function for use with Reviver: Just calls the
+// constructor function with no arguments, then applies all of the
+// key/value pairs from the raw data to the instance. Only useful for
+// constructors that can be reasonably called without arguments!
+// `ctor`      The constructor to call
+// `data`      The data to apply
+// Returns:    The object
+function Generic_fromJSON(ctor, data) {
+  var obj, name;
+
+  obj = new ctor();
+  for (name in data) {
+    obj[name] = data[name];
+  }
+  return obj;
+}
+
+
+
+
 /***/ }),
 /* 9 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -16689,7 +16749,7 @@ function initBitNodeMultipliers() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(17);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__BitNode_js__ = __webpack_require__(9);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__FactionInfo_js__ = __webpack_require__(47);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Location_js__ = __webpack_require__(12);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Missions_js__ = __webpack_require__(38);
@@ -16698,8 +16758,8 @@ function initBitNodeMultipliers() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(1);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_FactionInvitationBox_js__ = __webpack_require__(49);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_JSONReviver_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__ = __webpack_require__(21);
 
 
@@ -17744,7 +17804,7 @@ function processPassiveFactionRepGain(numCycles) {
 
 
 
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
 /* 11 */
@@ -17757,7 +17817,7 @@ function processPassiveFactionRepGain(numCycles) {
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return loadSpecialServerIps; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return prestigeSpecialServerIps; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return initSpecialServerIps; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__ = __webpack_require__(8);
 
 
 /* Holds IP of Special Servers */
@@ -17819,7 +17879,7 @@ function initSpecialServerIps() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Company_js__ = __webpack_require__(18);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Crimes_js__ = __webpack_require__(37);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Infiltration_js__ = __webpack_require__(45);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Server_js__ = __webpack_require__(6);
@@ -17828,7 +17888,7 @@ function initSpecialServerIps() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(1);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_IPAddress_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__ = __webpack_require__(21);
 
 
@@ -20164,7 +20224,7 @@ function initCreateProgramButtons() {
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return prestigeWorkerScripts; });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(23);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(28);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(33);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
@@ -20452,7 +20512,7 @@ function isValidIPAddress(ipaddress) {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(32);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Faction_js__ = __webpack_require__(10);
 /* 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__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(8);
 
 
 
@@ -22421,7 +22481,7 @@ function giveAllAugmentations() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Location_js__ = __webpack_require__(12);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_JSONReviver_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_JSONReviver_js__ = __webpack_require__(8);
 
 
 
@@ -23583,16 +23643,16 @@ function getJobRequirementText(company, pos, tooltiptext=false) {
 /* 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 import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__InteractiveTutorial_js__ = __webpack_require__(24);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptWorker_js__ = __webpack_require__(15);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(13);
 /* 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__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(8);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 var ace = __webpack_require__(50);
 __webpack_require__(53);
 __webpack_require__(54);
@@ -24196,7 +24256,7 @@ __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].construct
 
 
 
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
 /* 20 */
@@ -24210,7 +24270,7 @@ __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].construct
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__ = __webpack_require__(14);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__ = __webpack_require__(42);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__HelpText_js__ = __webpack_require__(66);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__ = __webpack_require__(24);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Literature_js__ = __webpack_require__(43);
@@ -24222,7 +24282,7 @@ __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].construct
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Script_js__ = __webpack_require__(19);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_LogBox_js__ = __webpack_require__(27);
 
@@ -25898,7 +25958,7 @@ let Terminal = {
 
 
 
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
 /* 21 */
@@ -26015,7 +26075,7 @@ function yesNoTxtInpBoxCreate(txt) {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Settings_js__ = __webpack_require__(13);
 /* 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__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(8);
 
 
 
@@ -26212,11 +26272,13 @@ function initMessages()  {
 /* 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__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Server_js__ = __webpack_require__(6);
-/* 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);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_LogBox_js__ = __webpack_require__(27);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* 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__(27);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+
 
 
 
@@ -26329,7 +26391,7 @@ function deleteActiveScriptsServerPanel(server) {
 
 function addActiveScriptsItem(workerscript) {
     //Get server panel
-    var server = Object(__WEBPACK_IMPORTED_MODULE_1__Server_js__["e" /* getServer */])(workerscript.serverIp);
+    var server = Object(__WEBPACK_IMPORTED_MODULE_2__Server_js__["e" /* getServer */])(workerscript.serverIp);
     if (server == null) {
         console.log("ERROR: Invalid server IP for workerscript.");
         return;
@@ -26372,7 +26434,7 @@ function addActiveScriptsItem(workerscript) {
 }
 
 function deleteActiveScriptsItem(workerscript) {
-    var server = Object(__WEBPACK_IMPORTED_MODULE_1__Server_js__["e" /* getServer */])(workerscript.serverIp);
+    var server = Object(__WEBPACK_IMPORTED_MODULE_2__Server_js__["e" /* getServer */])(workerscript.serverIp);
     if (server == null) {
         console.log("ERROR: Invalid server IP for workerscript.");
         return;
@@ -26399,13 +26461,16 @@ function updateActiveScriptsItems() {
         total += updateActiveScriptsItemContent(__WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["h" /* workerScripts */][i]);
     }
     document.getElementById("active-scripts-total-prod").innerHTML =
-        "Total online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(total, 2) + " / second";
+        "Total online production of Active Scripts: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(total, 2) + " / second<br>" +
+        "Total online production since last Augmentation installation: $" +
+        Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].scriptProdSinceLastAug, 2) + " ($" +
+        Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].scriptProdSinceLastAug / __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].playtimeSinceLastAug, 2) + " / second)";
     return total;
 }
 
 //Updates the content of the given item in the Active Scripts list
 function updateActiveScriptsItemContent(workerscript) {
-    var server = Object(__WEBPACK_IMPORTED_MODULE_1__Server_js__["e" /* getServer */])(workerscript.serverIp);
+    var server = Object(__WEBPACK_IMPORTED_MODULE_2__Server_js__["e" /* getServer */])(workerscript.serverIp);
     if (server == null) {
         console.log("ERROR: Invalid server IP for workerscript.");
         return;
@@ -26429,7 +26494,7 @@ function createActiveScriptsText(workerscript, item) {
 
     //Server ip/hostname
     var threads = "Threads: " + workerscript.scriptRef.threads;
-    var args = "Args: " + Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["f" /* printArray */])(workerscript.args);
+    var args = "Args: " + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* printArray */])(workerscript.args);
 
     itemTextHeader.innerHTML = threads + "<br>" + args + "<br>";
 
@@ -26445,12 +26510,12 @@ function createActiveScriptsText(workerscript, item) {
     logButton.setAttribute("class", "active-scripts-button");
     killButton.setAttribute("class", "active-scripts-button");
     logButton.addEventListener("click", function() {
-        Object(__WEBPACK_IMPORTED_MODULE_4__utils_LogBox_js__["a" /* logBoxCreate */])(workerscript.scriptRef);
+        Object(__WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__["a" /* logBoxCreate */])(workerscript.scriptRef);
         return false;
     });
     killButton.addEventListener("click", function() {
         Object(__WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["d" /* killWorkerScript */])(workerscript.scriptRef, workerscript.scriptRef.scriptRef.server);
-        Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Killing script, may take a few minutes to complete...");
+        Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Killing script, may take a few minutes to complete...");
         return false;
     });
     item.appendChild(logButton);
@@ -26469,22 +26534,22 @@ function updateActiveScriptsText(workerscript, item, statsEl=null) {
 
     //Updates statistics only
     //Online
-    var onlineTotalMoneyMade = "Total online production: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineMoneyMade, 2);
-    var onlineTotalExpEarned = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
+    var onlineTotalMoneyMade = "Total online production: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineMoneyMade, 2);
+    var onlineTotalExpEarned = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
 
     var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
-    var onlineMpsText = "Online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineMps, 2) + "/second";
+    var onlineMpsText = "Online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineMps, 2) + "/second";
     var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
-    var onlineEpsText = (Array(25).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineEps, 4) + " hacking exp/second").replace( / /g, "&nbsp;");
+    var onlineEpsText = (Array(25).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineEps, 4) + " hacking exp/second").replace( / /g, "&nbsp;");
 
     //Offline
-    var offlineTotalMoneyMade = "Total offline production: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineMoneyMade, 2);
-    var offlineTotalExpEarned = (Array(27).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
+    var offlineTotalMoneyMade = "Total offline production: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineMoneyMade, 2);
+    var offlineTotalExpEarned = (Array(27).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
 
     var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
-    var offlineMpsText = "Offline production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineMps, 2) + "/second";
+    var offlineMpsText = "Offline production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineMps, 2) + "/second";
     var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
-    var offlineEpsText = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineEps, 4) +  " hacking exp/second").replace( / /g, "&nbsp;");
+    var offlineEpsText = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineEps, 4) +  " hacking exp/second").replace( / /g, "&nbsp;");
 
     itemTextStats.innerHTML = onlineTotalMoneyMade + "<br>" + onlineTotalExpEarned + "<br>" +
                               onlineMpsText + "<br>" + onlineEpsText + "<br>" + offlineTotalMoneyMade + "<br>" + offlineTotalExpEarned + "<br>" +
@@ -26506,7 +26571,7 @@ function updateActiveScriptsText(workerscript, item, statsEl=null) {
 /* 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__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__ = __webpack_require__(1);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(2);
 
@@ -32011,13 +32076,13 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v7.2.3 https://github.com/MikeM
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return loadStockMarket; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return setStockMarketContentCreated; });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Location_js__ = __webpack_require__(12);
 /* 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_JSONReviver_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 
 
 
@@ -32699,7 +32764,7 @@ function logBoxUpdateText() {
 
 
 
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
 /* 28 */
@@ -32821,7 +32886,7 @@ Environment.prototype = {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__ = __webpack_require__(14);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__ = __webpack_require__(42);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__HacknetNode_js__ = __webpack_require__(34);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Location_js__ = __webpack_require__(12);
@@ -32841,7 +32906,7 @@ Environment.prototype = {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__utils_DialogBox_js__ = __webpack_require__(1);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__utils_IPAddress_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 
 
 
@@ -32893,6 +32958,7 @@ function initSingularitySFFlags() {
 function NetscriptFunctions(workerScript) {
     return {
         Math : Math,
+        Date : Date,
         hacknetnodes : __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacknetNodes,
         scan : function(ip=workerScript.serverIp, hostnames=true){
             var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip);
@@ -32964,6 +33030,7 @@ function NetscriptFunctions(workerScript) {
 
                     __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainMoney(moneyGained);
                     workerScript.scriptRef.onlineMoneyMade += moneyGained;
+                    __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].scriptProdSinceLastAug += moneyGained;
                     workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);
                     __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainHackingExp(expGainedOnSuccess);
                     workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
@@ -33532,6 +33599,15 @@ function NetscriptFunctions(workerScript) {
             workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.baseDifficulty, 3) + " for " + server.hostname);
             return server.baseDifficulty;
         },
+        getServerMinSecurityLevel : function(ip) {
+            var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip);
+            if (server == null) {
+                workerScript.scriptRef.log("getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+                throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+            }
+            workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.minDifficulty, 3) + " for " + server.hostname);
+            return server.minDifficulty;
+        },
         getServerRequiredHackingLevel : function(ip){
             var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip);
             if (server == null) {
@@ -33701,6 +33777,7 @@ function NetscriptFunctions(workerScript) {
             var netProfit = ((stock.price - stock.playerAvgPx) * shares) - __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].StockMarketCommission;
             if (isNaN(netProfit)) {netProfit = 0;}
             workerScript.scriptRef.onlineMoneyMade += netProfit;
+            __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].scriptProdSinceLastAug += netProfit;
 
             stock.playerShares -= shares;
             if (stock.playerShares == 0) {
@@ -33813,6 +33890,21 @@ function NetscriptFunctions(workerScript) {
                                        "as a purchased server. This is likely a bug please contact game dev");
             return false;
         },
+        getPurchasedServers : function(hostname=true) {
+            var res = [];
+            __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].purchasedServers.forEach(function(ip) {
+                if (hostname) {
+                    var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip);
+                    if (server == null) {
+                        throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "ERR: Could not find server in getPurchasedServers(). This is a bug please report to game dev");
+                    }
+                    res.push(server.hostname);
+                } else {
+                    res.push(ip);
+                }
+            });
+            return res;
+        },
         round : function(n) {
             if (isNaN(n)) {return 0;}
             return Math.round(n);
@@ -34794,16 +34886,16 @@ function NetscriptFunctions(workerScript) {
 /* 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__(5);
+/* 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__Location_js__ = __webpack_require__(12);
 /* 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__(7);
+/* 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__(36);
 /* 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__(4);
+/* 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__(21);
 
 
@@ -36103,7 +36195,7 @@ function setGangMemberTaskDescription(memberObj, taskName) {
 
 
 
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
 /* 31 */
@@ -36258,7 +36350,7 @@ function applySourceFile(srcFile) {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__BitNode_js__ = __webpack_require__(9);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(18);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Location_js__ = __webpack_require__(12);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(22);
@@ -36492,7 +36584,7 @@ function prestigeSourceFile() {
 
 
 
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
 /* 33 */
@@ -36520,7 +36612,7 @@ function prestigeSourceFile() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Script_js__ = __webpack_require__(19);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__ = __webpack_require__(2);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_IPAddress_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 
 
 
@@ -37355,13 +37447,13 @@ function scriptCalculateWeakenTime(server) {
 /* unused harmony export getHacknetNode */
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(9);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__InteractiveTutorial_js__ = __webpack_require__(24);
 /* 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);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 
 
 
@@ -37913,7 +38005,7 @@ function gameOptionsBoxOpen() {
 
 
 
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
 /* 36 */
@@ -38194,17 +38286,21 @@ function determineCrimeChanceHeist() {
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HackingMission; });
+/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HackingMission; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return inMission; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return setInMission; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return currMission; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* 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);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_jsplumb__ = __webpack_require__(48);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_jsplumb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_jsplumb__);
+/* 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_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__(48);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_jsplumb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_jsplumb__);
+
+
 
 
 
@@ -38222,47 +38318,48 @@ function setInMission(bool, mission) {
         currMission = null;
     }
 }
-/* Hacking Missions */
 
-/*You start with N CPU nodes dependent on home computer cores
+//Keyboard shortcuts
+$(document).keydown(function(e) {
+    if (inMission && currMission && currMission.selectedNode != null) {
+        switch (e.keyCode) {
+            case 65: //a for Attack
+                currMission.actionButtons[0].click();
+                break;
+            case 83: //s for Scan
+                currMission.actionButtons[1].click();
+                break;
+            case 87: //w for Weaken
+                currMission.actionButtons[2].click();
+                break;
+            case 70: //f for Fortify
+                currMission.actionButtons[3].click();
+                break;
+            case 82: //r for Overflow
+                currMission.actionButtons[4].click();
+                break;
+            case 68: //d for Detach connection
+                currMission.actionButtons[5].click();
+                break;
+            default:
+                break;
+        }
+    }
+});
 
-Three main stats:
-    Attack - Specific to a node. Affected by hacking skill, RAM (for home comp)
-    Defense - Universal defense - summed from all nodes
-    HP - Specific to a node. Affected by hacking skill, RAM (for home comp)
-
-Enemy has the following nodes:
-    Firewall Nodes - Essentially shields. Weak attack but large def
-    CPU Nodes - Defeating and capturing these will give you new nodes to use
-    Database Node - Main Target
-
-Misc Nodes (initially not owned by player or enemy):
-    Spam nodes - Increases time limit
-    Transfer Nodes - Slightly increases attack for all of your CPUs
-    Shield Node - Increases your defense
-
-Shapes for nodes:
-    Firewall - Rectangle
-    CPU - Circle
-    Database - Parralelogram
-    Spam - Diamond
-    Transfer - Cone
-    Shield - Shield shape
-
-*/
 let NodeTypes = {
     Core: "CPU Core Node",      //All actions available
     Firewall: "Firewall Node",  //No actions available
     Database: "Database Node",  //No actions available
     Spam: "Spam Node",          //No actions Available
-    Transfer: "Transfer Node",  //Can Weaken, Scan, and Overflow
+    Transfer: "Transfer Node",  //Can Weaken, Scan, Fortify and Overflow
     Shield: "Shield Node"       //Can Fortify
 }
 
 let NodeActions = {
     Attack: "Attacking", //Damaged based on attack stat + hacking level + opp def
-    Scan: "Scanning", //-Def for target, affected by hacking level
-    Weaken: "Weakening", //-Attack for target, affected by hacking level
+    Scan: "Scanning", //-Def for target, affected by attack and hacking level
+    Weaken: "Weakening", //-Attack for target, affected by attack and hacking level
     Fortify: "Fortifying", //+Defense for Node, affected by hacking level
     Overflow: "Overflowing", //+Attack but -Defense for Node, affected by hacking level
 }
@@ -38283,7 +38380,6 @@ function Node(type, stats) {
     //where this Node is the Source (since each Node
     //can only have 1 outgoing Connection)
     this.conn = null;
-
 }
 
 Node.prototype.setPosition = function(x, y) {
@@ -38332,8 +38428,12 @@ Node.prototype.select = function(actionButtons) {
             actionButtons[1].classList.add("a-link-button");
             actionButtons[2].classList.remove("a-link-button-inactive");
             actionButtons[2].classList.add("a-link-button");
+            actionButtons[3].classList.remove("a-link-button-inactive");
+            actionButtons[3].classList.add("a-link-button");
             actionButtons[4].classList.remove("a-link-button-inactive");
             actionButtons[4].classList.add("a-link-button");
+            actionButtons[5].classList.remove("a-link-button-inactive");
+            actionButtons[5].classList.add("a-link-button");
             break;
         default:
             break;
@@ -38341,7 +38441,7 @@ Node.prototype.select = function(actionButtons) {
 }
 
 Node.prototype.deselect = function(actionButtons) {
-    this.el.classList.remove("active");
+    this.el.classList.remove("hack-mission-player-node-active");
     for (var i = 0; i < actionButtons.length; ++i) {
         actionButtons[i].classList.remove("a-link-button");
         actionButtons[i].classList.add("a-link-button-inactive");
@@ -38354,6 +38454,9 @@ Node.prototype.deselect = function(actionButtons) {
 function HackingMission(rep, fac) {
     this.faction = fac;
 
+    this.started = false;
+    this.time = 120000; //2 minutes, milliseconds
+
     this.playerCores = [];
     this.playerNodes = []; //Non-core nodes
     this.playerDef = 0;
@@ -38384,9 +38487,9 @@ function HackingMission(rep, fac) {
     this.jsplumbinstance = null;
 
     //difficulty capped at 16
-    this.difficulty = Math.min(16, Math.round(rep / __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToDiffConversion) + 1);
+    this.difficulty = Math.min(16, Math.round(rep / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToDiffConversion) + 1);
     console.log("difficulty: " + this.difficulty);
-    this.reward = 200 + (rep / __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToRewardConversion);
+    this.reward = 200 + (rep / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToRewardConversion);
 }
 
 HackingMission.prototype.init = function() {
@@ -38394,12 +38497,12 @@ HackingMission.prototype.init = function() {
     this.createPageDom();
 
     //Create player starting nodes
-    var home = __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].getHomeComputer()
+    var home = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].getHomeComputer()
     for (var i = 0; i < home.cpuCores; ++i) {
         var stats = {
-            atk: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 10),
-            def: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 25),
-            hp: (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill / 5),
+            atk: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 10),
+            def: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 25),
+            hp: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 5),
         };
         this.playerCores.push(new Node(NodeTypes.Core, stats));
         this.playerCores[i].setControlledByPlayer();
@@ -38408,21 +38511,21 @@ HackingMission.prototype.init = function() {
     }
 
     //Randomly generate enemy nodes (CPU and Firewall) based on difficulty
-    var numNodes = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 2);
-    var numFirewalls = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 5);
-    var numDatabases = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 1);
+    var numNodes = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 1);
+    var numFirewalls = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 2);
+    var numDatabases = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 1);
     var totalNodes = numNodes + numFirewalls + numDatabases;
     var xlimit = 7 - Math.floor(totalNodes / 8);
     console.log("numNodes: " + numNodes);
     console.log("numFirewalls: " + numFirewalls);
     console.log("numDatabases: " + numDatabases);
     console.log("totalNodes: " + totalNodes);
-    var randMult = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
+    var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
     for (var i = 0; i < numNodes; ++i) {
         var stats = {
-            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(100, 250),
-            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(40, 75),
-            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(200, 300)
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(125, 175),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(30, 50),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(225, 275)
         }
         this.enemyCores.push(new Node(NodeTypes.Core, stats));
         this.enemyCores[i].setControlledByEnemy();
@@ -38430,9 +38533,9 @@ HackingMission.prototype.init = function() {
     }
     for (var i = 0; i < numFirewalls; ++i) {
         var stats = {
-            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(10, 25),
-            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 75),
-            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(100, 250)
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(10, 25),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 75),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(175, 200)
         }
         this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));
         this.enemyNodes[i].setControlledByEnemy();
@@ -38440,9 +38543,9 @@ HackingMission.prototype.init = function() {
     }
     for (var i = 0; i < numDatabases; ++i) {
         var stats = {
-            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(20, 30),
-            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 40),
-            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(200, 400)
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(20, 30),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 40),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(120, 150)
         }
         var node = new Node(NodeTypes.Database, stats);
         node.setControlledByEnemy();
@@ -38471,7 +38574,7 @@ HackingMission.prototype.createPageDom = function() {
     inGameGuideBtn.style.display = "inline-block";
     inGameGuideBtn.classList.add("hack-mission-header-element");
     inGameGuideBtn.addEventListener("click", function() {
-        Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HackingMissionHowToPlay);
+        Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])(__WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionHowToPlay);
         return false;
     });
 
@@ -38487,15 +38590,23 @@ HackingMission.prototype.createPageDom = function() {
     //Start button will get replaced with forfeit when game is started
     var startBtn = document.createElement("a");
     startBtn.innerHTML = "Start";
+    startBtn.setAttribute("id", "hack-mission-start-btn");
     startBtn.classList.add("a-link-button");
     startBtn.classList.add("hack-mission-header-element");
     startBtn.style.display = "inline-block";
+    startBtn.addEventListener("click", ()=>{
+        this.start();
+    });
+
+    var timer = document.createElement("p");
+    timer.setAttribute("id", "hacking-mission-timer");
+    timer.style.display = "inline-block";
 
     //Create Action Buttons (Attack/Scan/Weaken/ etc...)
     var actionsContainer = document.createElement("span");
     actionsContainer.style.display = "block";
     actionsContainer.classList.add("hack-mission-action-buttons-container");
-    for (var i = 0; i < 5; ++i) {
+    for (var i = 0; i < 6; ++i) {
         this.actionButtons.push(document.createElement("a"));
         this.actionButtons[i].style.display = "inline-block";
         this.actionButtons[i].classList.add("a-link-button-inactive"); //Disabled at start
@@ -38507,19 +38618,19 @@ HackingMission.prototype.createPageDom = function() {
     var atkTooltip = document.createElement("span");
     atkTooltip.classList.add("tooltiptext");
     atkTooltip.innerText = "Lowers the targeted node's HP. The effectiveness of this depends on " +
-                           "this node's Attack level, your hacking level, and the opponents defense level.";
+                           "this node's Attack level, your hacking level, and the opponent's defense level.";
     this.actionButtons[0].appendChild(atkTooltip);
     this.actionButtons[1].innerText = "Scan(s)";
     var scanTooltip = document.createElement("span");
     scanTooltip.classList.add("tooltiptext");
     scanTooltip.innerText = "Lowers the targeted node's defense. The effectiveness of this depends on " +
-                            "this node's Attack level and your hacking level";
+                            "this node's Attack level, your hacking level, and the opponent's defense level.";
     this.actionButtons[1].appendChild(scanTooltip);
     this.actionButtons[2].innerText = "Weaken(w)";
     var WeakenTooltip = document.createElement("span");
     WeakenTooltip.classList.add("tooltiptext");
     WeakenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
-                              "this node's Attack level and your hacking level";
+                              "this node's Attack level, your hacking level, and the opponent's defense level.";
     this.actionButtons[2].appendChild(WeakenTooltip);
     this.actionButtons[3].innerText = "Fortify(f)";
     var fortifyTooltip = document.createElement("span");
@@ -38533,6 +38644,26 @@ HackingMission.prototype.createPageDom = function() {
     overflowTooltip.innerText = "Raises this node's Attack level but lowers its Defense level. The effectiveness " +
                                 "of this depends on your hacking level.";
     this.actionButtons[4].appendChild(overflowTooltip);
+    this.actionButtons[5].innerText = "Drop Connection(d)";
+    var dropconnTooltip = document.createElement("span");
+    dropconnTooltip.classList.add("tooltiptext");
+    dropconnTooltip.innerText = "Removes this Node's current connection to some target Node, if it has one. This can " +
+                                "also be done by simply clicking the white connection line.";
+    this.actionButtons[5].appendChild(dropconnTooltip);
+
+    //Player/enemy defense displays will be in action container
+    var playerDefense = document.createElement("p");
+    var enemyDefense = document.createElement("p");
+    playerDefense.style.display = "inline-block";
+    enemyDefense.style.display = "inline-block";
+    playerDefense.style.color = "blue";
+    enemyDefense.style.color = "red";
+    playerDefense.style.margin = "4px";
+    enemyDefense.style.margin = "4px";
+    playerDefense.setAttribute("id", "hacking-mission-player-def");
+    enemyDefense.setAttribute("id", "hacking-mission-enemy-def");
+    actionsContainer.appendChild(playerDefense);
+    actionsContainer.appendChild(enemyDefense);
 
     //Set Action Button event listeners
     this.actionButtons[0].addEventListener("click", ()=>{
@@ -38585,12 +38716,24 @@ HackingMission.prototype.createPageDom = function() {
         this.selectedNode.action = NodeActions.Overflow;
     });
 
+    this.actionButtons[5].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        if (this.selectedNode.conn) {
+            var endpoints = this.selectedNode.conn.endpoints;
+            endpoints[0].detachFrom(endpoints[1]);
+        }
+    })
+
     var timeDisplay = document.createElement("p");
 
     container.appendChild(headerText);
     container.appendChild(inGameGuideBtn);
     container.appendChild(wikiGuideBtn);
     container.appendChild(startBtn);
+    container.appendChild(timer);
     container.appendChild(actionsContainer);
     container.appendChild(timeDisplay);
 }
@@ -38611,7 +38754,7 @@ HackingMission.prototype.setActionButtonsActive = function() {
 
 //True for active, false for inactive
 HackingMission.prototype.setActionButton = function(i, active=true) {
-    if (Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["f" /* isString */])(i)) {
+    if (Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["f" /* isString */])(i)) {
         switch (i) {
             case NodeActions.Attack:
                 i = 0;
@@ -38650,8 +38793,9 @@ HackingMission.prototype.calculateDefenses = function() {
     for (var i = 0; i < this.playerNodes.length; ++i) {
         total += this.playerNodes[i].def;
     }
-    console.log("player defenses calculated to be: " + total);
     this.playerDef = total;
+    document.getElementById("hacking-mission-player-def").innerText =
+        "Player Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerDef, 1);
     total = 0;
     for (var i = 0; i < this.enemyCores.length; ++i) {
         total += this.enemyCores[i].def;
@@ -38662,8 +38806,9 @@ HackingMission.prototype.calculateDefenses = function() {
     for (var i = 0; i < this.enemyNodes.length; ++i) {
         total += this.enemyNodes[i].def;
     }
-    console.log("enemy defenses calculated to be: " + total);
     this.enemyDef = total;
+    document.getElementById("hacking-mission-enemy-def").innerText =
+        "Enemy Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyDef, 1);
 }
 
 HackingMission.prototype.removeAvailablePosition = function(x, y) {
@@ -38693,7 +38838,7 @@ HackingMission.prototype.setNodePosition = function(nodeObj, x, y) {
 }
 
 HackingMission.prototype.setNodeRandomPosition = function(nodeObj, xlimit=0) {
-    var i = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.availablePositions.length - 1);
+    var i = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.availablePositions.length - 1);
     var pos = this.availablePositions.splice(i, 1);
     pos = pos[0];
     this.setNodePosition(nodeObj, pos[0], pos[1]);
@@ -38711,22 +38856,22 @@ HackingMission.prototype.createMap = function() {
     for (var x = 0; x < 8; ++x) {
         for (var y = 0; y < 8; ++y) {
             if (!(this.map[x][y] instanceof Node)) {
-                var node, type = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, 2);
-                var randMult = Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
+                var node, type = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, 2);
+                var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
                 switch (type) {
                     case 0: //Spam
                         var stats = {
                             atk: 0,
-                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(400, 800),
-                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000)
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(30, 40),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 90)
                         }
                         node = new Node(NodeTypes.Spam, stats);
                         break;
                     case 1: //Transfer
                         var stats = {
                             atk: 0,
-                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000),
-                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(600, 1100)
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 70),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(80, 95)
                         }
                         node = new Node(NodeTypes.Transfer, stats);
                         break;
@@ -38734,8 +38879,8 @@ HackingMission.prototype.createMap = function() {
                     default:
                         var stats = {
                             atk: 0,
-                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(750, 1000),
-                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["d" /* getRandomInt */])(700, 1000)
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(90, 105),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(130, 150)
                         }
                         node = new Node(NodeTypes.Shield, stats);
                         break;
@@ -38759,9 +38904,6 @@ HackingMission.prototype.createMap = function() {
         console.log("Configuring Player Node: " + this.playerCores[i].el.id);
         this.configurePlayerNodeElement(this.playerCores[i].el);
     }
-
-    console.log(this.map);
-    this.initJsPlumb();
 }
 
 HackingMission.prototype.createNodeDomElement = function(nodeObj) {
@@ -38775,7 +38917,6 @@ HackingMission.prototype.createNodeDomElement = function(nodeObj) {
                                 nodeObj.pos[1]);
 
     //Set node classes for owner
-    nodeDiv.classList.add("tooltip2");
     nodeDiv.classList.add("hack-mission-node");
     if (nodeObj.plyrCtrl) {
         nodeDiv.classList.add("hack-mission-player-node");
@@ -38788,39 +38929,39 @@ HackingMission.prototype.createNodeDomElement = function(nodeObj) {
     switch (nodeObj.type) {
         case NodeTypes.Core:
             txt = "<p>CPU Core<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-cpu-node");
             break;
         case NodeTypes.Firewall:
             txt = "<p>Firewall<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-firewall-node");
             break;
         case NodeTypes.Database:
             txt = "<p>Database<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-database-node");
             break;
         case NodeTypes.Spam:
             txt = "<p>Spam<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-spam-node");
             break;
         case NodeTypes.Transfer:
             txt = "<p>Transfer<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-transfer-node");
             break;
         case NodeTypes.Shield:
         default:
             txt = "<p>Shield<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             nodeDiv.classList.add("hack-mission-shield-node");
             break;
     }
 
-    txt += "<br>Atk: " + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
-           "<br>Def: " + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1) + "</p>";
+    txt += "<br>Atk: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
+           "<br>Def: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1) + "</p>";
     nodeDiv.innerHTML = txt;
 }
 
@@ -38839,33 +38980,33 @@ HackingMission.prototype.updateNodeDomElement = function(nodeObj) {
     switch (nodeObj.type) {
         case NodeTypes.Core:
             txt = "<p>CPU Core<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             break;
         case NodeTypes.Firewall:
             txt = "<p>Firewall<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             break;
         case NodeTypes.Database:
             txt = "<p>Database<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             break;
         case NodeTypes.Spam:
             txt = "<p>Spam<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             break;
         case NodeTypes.Transfer:
             txt = "<p>Transfer<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             break;
         case NodeTypes.Shield:
         default:
             txt = "<p>Shield<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
             break;
     }
 
-    txt += "<br>Atk: " + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
-           "<br>Def: " + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1);
+    txt += "<br>Atk: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
+           "<br>Def: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1);
     if (nodeObj.action) {
         txt += "<br>" + nodeObj.action;
     }
@@ -38918,6 +39059,8 @@ HackingMission.prototype.configureEnemyNodeElement = function(el) {
     if (this.selectedNode == nodeObj) {
         nodeObj.deselect(this.actionButtons);
     }
+
+    //TODO Need to remove event listeners
 }
 
 //Returns bool indicating whether a node is reachable by player
@@ -38931,6 +39074,17 @@ HackingMission.prototype.nodeReachable = function(node) {
     return false;
 }
 
+HackingMission.prototype.start = function() {
+    this.started = true;
+    this.initJsPlumb();
+    var startBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hack-mission-start-btn");
+    startBtn.innerHTML = "Forfeit Mission";
+    startBtn.addEventListener("click", ()=>{
+        this.finishMission(false);
+        return false;
+    });
+}
+
 HackingMission.prototype.initJsPlumb = function() {
     var instance = jsPlumb.getInstance({
         DragOptions:{cursor:"pointer", zIndex:2000},
@@ -39034,59 +39188,94 @@ HackingMission.prototype.dropAllConnectionsToNode = function(node) {
 }
 
 HackingMission.prototype.process = function(numCycles=1) {
+    if (!this.started) {return;}
+    var res = false;
     //Process actions of all player nodes
-    for (var i = 0; i < this.playerCores.length; ++i) {
-        this.processNode(this.playerCores[i], numCycles);
-    }
+    this.playerCores.forEach((node)=>{
+        res |= this.processNode(node, numCycles);
+    });
+
+    this.playerNodes.forEach((node)=>{
+        if (node.type === NodeTypes.Transfer) {
+            res |= this.processNode(node, numCycles);
+        }
+    });
 
     //Process actions of all enemy nodes
-    for (var i = 0; i < this.enemyCores.length; ++i) {
-        this.processNode(this.enemyCores[i], numCycles);
+    this.enemyCores.forEach((node)=>{
+        res |= this.processNode(node, numCycles);
+    });
+
+    this.enemyNodes.forEach((node)=>{
+        if (node.type === NodeTypes.Transfer) {
+            res |= this.processNode(node, numCycles);
+        }
+    });
+
+    if (res) {this.calculateDefenses();}
+
+    if (this.enemyDatabases.length === 0) {
+        this.finishMission(true);
+        return;
     }
+
+    //Update timer and check if player lost
+    this.time -= (numCycles * __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"]._idleSpeed);
+    if (this.time <= 0) {
+        this.finishMission(false);
+        return;
+    }
+    this.updateTimer();
 }
 
+//Returns a bool representing whether defenses need to be re-calculated
 HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
-    if (nodeObj.action === null) {return;}
+    if (nodeObj.action === null) {
+        return;
+    }
 
     var targetNode = null, def;
     if (nodeObj.conn) {
         targetNode = this.getNodeFromElement(nodeObj.conn.target);
         if (targetNode.plyrCtrl) {
             def = this.playerDef;
-        } else {
+        } else if (targetNode.enmyCtrl) {
             def = this.enemyDef;
+        } else { //Misc Node
+            def = targetNode.def;
         }
     }
 
     //Calculations are per second, so divide everything by 5
+    var calcDefenses = false;
     switch(nodeObj.action) {
         case NodeActions.Attack:
             if (nodeObj.conn === null) {break;}
-            var dmg = this.calculateAttackDamage(nodeObj.atk, def, __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill);
+            var dmg = this.calculateAttackDamage(nodeObj.atk, def, __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
             targetNode.hp -= (dmg/5 * numCycles);
             break;
         case NodeActions.Scan:
             if (nodeObj.conn === null) {break;}
-            var eff = this.calculateScanEffect(def, __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill);
+            var eff = this.calculateScanEffect(nodeObj.atk, def, __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
             targetNode.def -= (eff/5 * numCycles);
-            this.calculateDefenses();
+            calcDefenses = true;
             break;
         case NodeActions.Weaken:
             if (nodeObj.conn === null) {break;}
-            var eff = this.calculateWeakenEffect(def, __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill);
+            var eff = this.calculateWeakenEffect(nodeObj.atk, def, __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
             targetNode.atk -= (eff/5 * numCycles);
             break;
         case NodeActions.Fortify:
-            var eff = this.calculateFortifyEffect(__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill);
+            var eff = this.calculateFortifyEffect(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
             nodeObj.def += (eff/5 * numCycles);
-            this.calculateDefenses();
+            calcDefenses = true;
             break;
         case NodeActions.Overflow:
-            var eff = this.calculateOverflowEffect(__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_skill);
+            var eff = this.calculateOverflowEffect(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
             if (nodeObj.def < eff) {break;}
             nodeObj.def -= (eff/5 * numCycles);
             nodeObj.atk += (eff/5 * numCycles);
-            this.calculateDefenses();
+            calcDefenses = true;
             break;
         default:
             console.log("ERR: Invalid Node Action: " + nodeObj.action);
@@ -39108,20 +39297,118 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
         if (this.selectedNode == targetNode) {
             targetNode.deselect();
         }
+
+        //Flag for whether the target node was a misc node
+        var isMiscNode = !targetNode.plyrCtrl && !targetNode.enmyCtrl;
+        console.log("isMiscNode: " + isMiscNode);
+
+        //Remove all connections from Node
         this.dropAllConnectionsToNode(targetNode);
         this.dropAllConnectionsFromNode(targetNode);
+
+        //Changes the css class and turn the node into a JsPlumb Source/Target
         if (conqueredByPlayer) {
-            targetNode.setControlledByPlayer()
-        } else { //Conquered by enemy
+            targetNode.setControlledByPlayer();
+            this.jsplumbinstance.unmakeTarget(targetNode.el);
+            this.jsplumbinstance.makeSource(targetNode.el, {
+                deleteEndpointsOnEmpty:true,
+                maxConnections:1,
+                anchor:"Center",
+                connector:"Straight"
+            });
+        } else {
             targetNode.setControlledByEnemy();
+            this.jsplumbinstance.unmakeSource(targetNode.el);
+            this.jsplumbinstance.makeTarget(targetNode.el, {
+                maxConnections:-1,
+                anchor:"Center",
+                connector:["Straight"]
+            });
+        }
+
+        calcDefenses = true;
+
+        //Helper function to swap nodes between the respective enemyNodes/playerNodes arrays
+        function swapNodes(orig, dest, targetNode) {
+            console.log("swapNodes called");
+            for (var i = 0; i < orig.length; ++i) {
+                if (orig[i] == targetNode) {
+                    console.log("Swapping nodes");
+                    var node = orig.splice(i, 1);
+                    node = node[0];
+                    dest.push(node);
+                    break;
+                }
+            }
+        }
+
+        //Whether conquered node was a misc node
+        switch(targetNode.type) {
+            case NodeTypes.Core:
+                if (conqueredByPlayer) {
+                    swapNodes(this.enemyCores, this.playerCores, targetNode);
+                    this.configurePlayerNodeElement(targetNode.el);
+                } else {
+                    swapNodes(this.playerCores, this.enemyCores, targetNode);
+                    this.configureEnemyNodeElement(targetNode.el);
+                }
+                break;
+            case NodeTypes.Firewall:
+                if (conqueredByPlayer) {
+                    swapNodes(this.enemyNodes, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(this.playerNodes, this.enemyNodes, targetNode);
+                }
+                break;
+            case NodeTypes.Database:
+                if (conqueredByPlayer) {
+                    swapNodes(this.enemyDatabases, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(this.playerNodes, this.enemyDatabases, targetNode);
+                }
+                break;
+            case NodeTypes.Spam:
+                if (conqueredByPlayer) {
+                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+                }
+
+                //Conquering spam node increases time limit
+                this.time += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionSpamTimeIncrease;
+                break;
+            case NodeTypes.Transfer:
+                //Conquering a Transfer node increases the attack of all cores by some percentages
+                if (conqueredByPlayer) {
+                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+                    this.playerCores.forEach(function(node) {
+                        node.atk *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionTransferAttackIncrease;
+                    });
+                    this.configurePlayerNodeElement(targetNode.el);
+                } else {
+                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+                    this.enemyCores.forEach(function(node) {
+                        node.atk *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionTransferAttackIncrease;
+                    });
+                    this.configureEnemyNodeElement(targetNode.el);
+                }
+                break;
+            case NodeTypes.Shield:
+                if (conqueredByPlayer) {
+                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+                }
+                break;
         }
     }
     this.updateNodeDomElement(nodeObj);
     if (targetNode) {this.updateNodeDomElement(targetNode);}
+    return calcDefenses;
 }
 
 var hackEffWeightSelf = 100; //Weight for Node actions on self
-var hackEffWeightTarget = 10; //Weight for Node Actions against Target
+var hackEffWeightTarget = 15; //Weight for Node Actions against Target
 var hackEffWeightAttack = 100; //Weight for Attack action
 
 //Returns damage per cycle based on stats
@@ -39129,12 +39416,12 @@ HackingMission.prototype.calculateAttackDamage = function(atk, def, hacking = 0)
     return Math.max(atk + (hacking / hackEffWeightAttack) - def, 0.1);
 }
 
-HackingMission.prototype.calculateScanEffect = function(def, hacking=0) {
-    return Math.max(hacking / hackEffWeightTarget - def, 0.1);
+HackingMission.prototype.calculateScanEffect = function(atk, def, hacking=0) {
+    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 0.1);
 }
 
-HackingMission.prototype.calculateWeakenEffect = function(def, hacking=0) {
-    return Math.max(hacking / hackEffWeightTarget - def, 0.1);
+HackingMission.prototype.calculateWeakenEffect = function(atk, def, hacking=0) {
+    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 0.1);
 }
 
 HackingMission.prototype.calculateFortifyEffect = function(hacking=0) {
@@ -39145,9 +39432,46 @@ HackingMission.prototype.calculateOverflowEffect = function(hacking=0) {
     return hacking / hackEffWeightSelf;
 }
 
+//Updates timer display
+HackingMission.prototype.updateTimer = function() {
+    var timer = document.getElementById("hacking-mission-timer");
+
+    //Convert time remaining to a string of the form m:ss
+    var seconds = Math.round(this.time / 1000);
+    var minutes = Math.trunc(seconds / 60);
+    seconds %= 60;
+    var str = ("0" + minutes).slice(-2) + ":" + ("0" + seconds).slice(-2);
+    timer.innerText = "Time left: " + str;
+}
+
+//The 'win' argument is a bool for whether or not the player won
+HackingMission.prototype.finishMission = function(win) {
+    inMission = false;
+    currMission = null;
+
+    if (win) {
+        Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Mission won!");
+    } else {
+        Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Mission lost!");
+    }
+
+    //Clear mission container
+    var container = document.getElementById("mission-container");
+    while(container.firstChild) {
+        container.removeChild(container.firstChild);
+    }
+
+    //Return to Faction page
+    document.getElementById("mainmenu-container").style.visibility = "visible";
+    document.getElementById("character-overview-wrapper").style.visibility = "visible";
+    __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadFactionContent();
+    Object(__WEBPACK_IMPORTED_MODULE_2__Faction_js__["c" /* displayFactionContent */])(this.faction.name);
+}
 
 
 
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
+
 /***/ }),
 /* 39 */
 /***/ (function(module, exports) {
@@ -39309,7 +39633,7 @@ function substituteAliases(origCommand) {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__ = __webpack_require__(11);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Terminal_js__ = __webpack_require__(20);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 
 
 
@@ -39850,7 +40174,7 @@ function initLiterature() {
 /* 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__(9);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(5);
+/* 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__(32);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(31);
@@ -40179,7 +40503,7 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) {
 
 
 
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
 /* 45 */
@@ -40188,12 +40512,12 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) {
 "use strict";
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return beginInfiltration; });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(5);
+/* 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__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_InfiltrationBox_js__ = __webpack_require__(46);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 
 
 
@@ -41020,7 +41344,7 @@ function getInfiltrationEscapeChance(inst) {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DialogBox_js__ = __webpack_require__(1);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__ = __webpack_require__(5);
 
 
 
@@ -75892,11 +76216,12 @@ var NetscriptHighlightRules = function(options) {
             "SyntaxError|TypeError|URIError|"                                          +
             "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
             "isNaN|parseFloat|parseInt|"                                               +
-            "hack|sleep|grow|wewaken|print|tprint|scan|nuke|brutessh|ftpcrack|"        + //Netscript functions
+            "hack|sleep|grow|weaken|print|tprint|scan|nuke|brutessh|ftpcrack|"         + //Netscript functions
             "relaysmtp|httpworm|sqlinject|run|exec|kill|killall|scp|ls|hasRootAccess|" +
-            "getIp|getHackingMultipliers|getBitNodeMultipliers|"                       + 
+            "getIp|getHackingMultipliers|getBitNodeMultipliers|"                       +
             "getHostname|getHackingLevel|getServerMoneyAvailable|getServerMaxMoney|"   +
             "getServerGrowth|getServerSecurityLevel|getServerBaseSecurityLevel|"       +
+            "getServerMinSecurityLevel|"                                               +
             "getServerRequiredHackingLevel|getServerNumPortsRequired|getServerRam|"    +
             "serverExists|fileExists|isRunning|getNextHacknetNodeCost|"                +
             "purchaseHacknetNode|" +
@@ -88276,7 +88601,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(41);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(18);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Gang_js__ = __webpack_require__(30);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__HacknetNode_js__ = __webpack_require__(34);
@@ -88290,8 +88615,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
 /* 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__(35);
 /* 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__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* 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__(25);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__);
 
@@ -88840,7 +89165,7 @@ function openImportFileHandler(evt) {
 
 
 
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ })
 /******/ ]);
\ No newline at end of file
diff --git a/src/ActiveScriptsUI.js b/src/ActiveScriptsUI.js
index 5349022f6..d1ad0fa07 100644
--- a/src/ActiveScriptsUI.js
+++ b/src/ActiveScriptsUI.js
@@ -1,6 +1,7 @@
 import {workerScripts,
         addWorkerScript,
         killWorkerScript}           from "./NetscriptWorker.js";
+import {Player}                     from "./Player.js";
 import {getServer}                  from "./Server.js";
 import {dialogBoxCreate}            from "../utils/DialogBox.js";
 import {printArray}                 from "../utils/HelperFunctions.js";
@@ -182,7 +183,10 @@ function updateActiveScriptsItems() {
         total += updateActiveScriptsItemContent(workerScripts[i]);
     }
     document.getElementById("active-scripts-total-prod").innerHTML =
-        "Total online production rate: $" + formatNumber(total, 2) + " / second";
+        "Total online production of Active Scripts: $" + formatNumber(total, 2) + " / second<br>" +
+        "Total online production since last Augmentation installation: $" +
+        formatNumber(Player.scriptProdSinceLastAug, 2) + " ($" +
+        formatNumber(Player.scriptProdSinceLastAug / Player.playtimeSinceLastAug, 2) + " / second)";
     return total;
 }
 
diff --git a/src/Constants.js b/src/Constants.js
index 382a882f9..9ae13cb7c 100644
--- a/src/Constants.js
+++ b/src/Constants.js
@@ -120,11 +120,48 @@ let CONSTANTS = {
     IntelligenceProgramBaseExpGain: 1000, //Program required hack level divided by this to determine int exp gain
     IntelligenceTerminalHackBaseExpGain: 200, //Hacking exp divided by this to determine int exp gain
     IntelligenceSingFnBaseExpGain: 0.0005,
+    IntelligenceClassBaseExpGain: 0.0000001,
 
     //Hacking Missions
     HackingMissionRepToDiffConversion: 5000, //Faction rep is divided by this to get mission difficulty
     HackingMissionRepToRewardConversion: 20, //Faction rep divided byt his to get mission rep reward
-    HackingMissionHowToPlay: "Hacking missions are a minigame that, if won, will reward you with factin reputation",
+    HackingMissionSpamTimeIncrease: 20000, //How much time limit increase is gained when conquering a Spam Node (ms)
+    HackingMissionTransferAttackIncrease: 1.05, //Multiplier by which the attack for all Core Nodes is increased when conquering a Transfer Node
+    HackingMissionHowToPlay: "Hacking missions are a minigame that, if won, will reward you with faction reputation.<br><br>" +
+                             "In this game you control a set of Nodes and use them to try and defeat an enemy. Your Nodes " +
+                             "are colored blue, while the enemy's are red. There are also other nodes on the map colored gray" +
+                             "that initially belong to neither you nor the enemy. The goal of the game is " +
+                             "to capture all of the enemy's database nodes, which are the parallelogram-shaped ones, within the time limit. " +
+                             "If you cannot capture all of the enemy's database nodes in the time limit, you will lose.<br><br>" +
+                             "Each Node has three stats: Attack, Defense, and HP. There are five different actions that " +
+                             "a Node can take:<br><br> " +
+                             "Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the Node's Attack, the Player's " +
+                             "hacking level, and the enemy's defense.<br>" +
+                             "Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the Player's hacking level and the " +
+                             "enemy's defense.<br>"  +
+                             "Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the Player's hacking level and the enemy's " +
+                             "defense.<br>" +
+                             "Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.<br><br>" +
+                             "To capture a Node, you must lower its HP down to 0. " +
+                             "A Node's 'Attack' stats affects its effectiveness when attacking other Nodes. A Node's 'Defense' helps protect " +
+                             "against the actions of enemy Nodes. One important thing to note is that, when defending, your total 'Defense' " +
+                             "(sum of the Defense of all of your Nodes) is what's taken into account when determining the effect of offensive actions. " +
+                             "However, when attacking, only the 'Attack' of the Node being used to attack is taken into account.<br><br>" +
+                             "There are six different types of Nodes:<br><br>" +
+                             "CPU Core - These are your main Nodes that are used to perform actions<br>" +
+                             "Firewall - Nodes with high defense. These Nodes cannot perform any actions<br>" +
+                             "Database - A special type of Node. The player's objective is to conquer all of the enemy's Database Nodes within " +
+                             "the time limit. These Nodes cannot perform any actions<br>"  +
+                             "Spam - Conquering one of these Nodes will slow the enemy's trace, giving the player additional time to complete " +
+                             "the mission. These Nodes cannot perform any actions<br>" +
+                             "Transfer - Conquering one of these nodes will increase the Attack of all of your CPU Cores by a small fixed percentage. " +
+                             "These Nodes are capable of performing every action except the 'Attack' action<br>" +
+                             "Shield - Nodes with high defense. These Nodes cannot perform any actions<br><br>" +
+                             "For certain actions such as attacking, scanning, and weakening, the Node performing the action must have a target. To target " +
+                             "another node, simply click-and-drag from the 'source' Node to a target. A Node can only have one target, and you can only target " +
+                             "Nodes that are adjacent to one of your Nodes (immediately above, below, or to the side. NOT diagonal). Furthermore, only CPU Cores and Transfer Nodes " +
+                             "can target, since they are the only ones that can perform actions",
+
 
     //Gang constants
     GangRespectToReputationRatio: 2, //Respect is divided by this to get rep gain
@@ -419,18 +456,18 @@ let CONSTANTS = {
                            "the hostnames or IPs of the scanned servers should be output. If it is true then hostnames will be returned, and if false then IP addresses will. " +
                            "This second argument is optional and, if ommitted, the function will output " +
                            "the hostnames of the scanned servers. The hostnames/IPs in the returned array are strings.<br><br>" +
-                           "<i>nuke(hostname/ip)</i><br>Run NUKE.exe on the target server. NUKE.exe must exist on your home computer. Does NOT work while offline <br> Example: nuke('foodnstuff'); <br><br>" +
-                           "<i>brutessh(hostname/ip)</i><br>Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer. Does NOT work while offline <br> Example: brutessh('foodnstuff');<br><br>" +
-                           "<i>ftpcrack(hostname/ip)</i><br>Run FTPCrack.exe on the target server. FTPCrack.exe must exist on your home computer. Does NOT work while offline <br> Example: ftpcrack('foodnstuff');<br><br>" +
-                           "<i>relaysmtp(hostname/ip)</i><br>Run relaySMTP.exe on the target server. relaySMTP.exe must exist on your home computer. Does NOT work while offline <br> Example: relaysmtp('foodnstuff');<br><br>" +
-                           "<i>httpworm(hostname/ip)</i><br>Run HTTPWorm.exe on the target server. HTTPWorm.exe must exist on your home computer. Does NOT work while offline <br> Example: httpworm('foodnstuff');<br><br>" +
-                           "<i>sqlinject(hostname/ip)</i><br>Run SQLInject.exe on the target server. SQLInject.exe must exist on your home computer. Does NOT work while offline  <br> Example: sqlinject('foodnstuff');<br><br>" +
+                           "<i>nuke(hostname/ip)</i><br>Run NUKE.exe on the target server. NUKE.exe must exist on your home computer.<br> Example: nuke('foodnstuff'); <br><br>" +
+                           "<i>brutessh(hostname/ip)</i><br>Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer.<br> Example: brutessh('foodnstuff');<br><br>" +
+                           "<i>ftpcrack(hostname/ip)</i><br>Run FTPCrack.exe on the target server. FTPCrack.exe must exist on your home computer.<br> Example: ftpcrack('foodnstuff');<br><br>" +
+                           "<i>relaysmtp(hostname/ip)</i><br>Run relaySMTP.exe on the target server. relaySMTP.exe must exist on your home computer.<br> Example: relaysmtp('foodnstuff');<br><br>" +
+                           "<i>httpworm(hostname/ip)</i><br>Run HTTPWorm.exe on the target server. HTTPWorm.exe must exist on your home computer.<br> Example: httpworm('foodnstuff');<br><br>" +
+                           "<i>sqlinject(hostname/ip)</i><br>Run SQLInject.exe on the target server. SQLInject.exe must exist on your home computer.<br> Example: sqlinject('foodnstuff');<br><br>" +
                            "<i>run(script, [numThreads], [args...])</i> <br> Run a script as a separate process. The first argument that is passed in is the name of the script as a string. This function can only " +
                            "be used to run scripts located on the current server (the server running the script that calls this function). The second argument " +
                            "is optional, and it specifies how many threads to run the script with. This argument must be a number greater than 0. If it is omitted, then the script will be run single-threaded. Any additional arguments will specify " +
                            "arguments to pass into the new script that is being run. If arguments are specified for the new script, then the second argument numThreads argument must be filled in with a value.<br><br>" +
                            "Returns true if the script is successfully started, and false otherwise. Requires a significant amount " +
-                           "of RAM to run this command. Does NOT work while offline <br><br>" +
+                           "of RAM to run this command.<br><br>" +
                            "The simplest way to use the run command is to call it with just the script name. The following example will run 'foo.script' single-threaded with no arguments:<br><br>" +
                            "run('foo.script');<br><br>" +
                            "The following example will run 'foo.script' but with 5 threads instead of single-threaded:<br><br>" +
@@ -442,7 +479,7 @@ let CONSTANTS = {
                            "The third argument is optional, and it specifies how many threads to run the script with. If it is omitted, then the script will be run single-threaded. " +
                            "This argument must be a number that is greater than 0. Any additional arguments will specify arguments to pass into the new script that is being run. If " +
                            "arguments are specified for the new script, then the third argument numThreads must be filled in with a value.<br><br>Returns " +
-                           "true if the script is successfully started, and false otherwise. Does NOT work while offline<br><br> " +
+                           "true if the script is successfully started, and false otherwise.<br><br> " +
                            "The simplest way to use the exec command is to call it with just the script name and the target server. The following example will try to run 'generic-hack.script' " +
                            "on the 'foodnstuff' server:<br><br>" +
                            "exec('generic-hack.script', 'foodnstuff');<br><br>" +
@@ -480,11 +517,11 @@ let CONSTANTS = {
                            "<i>ls(hostname/ip)</i><br>Returns an array containing the names of all files on the specified server. The argument must be a " +
                            "string with the hostname or IP of the target server.<br><br>" +
                            "<i>hasRootAccess(hostname/ip)</i><br> Returns a boolean (true or false) indicating whether or not the Player has root access to a server. " +
-                           "The argument passed in must be a string with either the hostname or IP of the target server. Does NOT work while offline.<br> " +
+                           "The argument passed in must be a string with either the hostname or IP of the target server.<br> " +
                            "Example:<br>if (hasRootAccess('foodnstuff') == false) {<br>&nbsp;&nbsp;&nbsp;&nbsp;nuke('foodnstuff');<br>}<br><br>" +
                            "<i>getIp()</i><br>Returns a string with the IP Address of the server that the script is running on <br><br>" +
                            "<i>getHostname()</i><br>Returns a string with the hostname of the server that the script is running on<br><br>" +
-                           "<i>getHackingLevel()</i><br>Returns the Player's current hacking level. Does NOT work while offline<br><br> " +
+                           "<i>getHackingLevel()</i><br>Returns the Player's current hacking level.<br><br> " +
                            "<i>getIntelligence()</i><br>Returns the Player's current intelligence level. Requires Source-File 5 to run<br><br>" +
                            "<i>getHackingMultipliers()</i><br>Returns an object containing the Player's hacking related multipliers. " +
                            "These multipliers are returned in integer forms, not percentages (e.g. 1.5 instead of 150%). " +
@@ -529,24 +566,26 @@ let CONSTANTS = {
                            "print(mults.ServerMaxMoney);<br>" +
                            "print(mults.HackExpGain);<br><br>" +
                            "<i>getServerMoneyAvailable(hostname/ip)</i><br> Returns the amount of money available on a server. The argument passed in must be a string with either the " +
-                           "hostname or IP of the target server. Does NOT work while offline <br> Example: getServerMoneyAvailable('foodnstuff');<br><br>" +
+                           "hostname or IP of the target server.<br> Example: getServerMoneyAvailable('foodnstuff');<br><br>" +
                            "<i>getServerMaxMoney(hostname/ip)</i><br>Returns the maximum amount of money that can be available on a server. The argument passed in must be a string with " +
-                           "the hostname or IP of the target server. Does NOT work while offline<br>Example: getServerMaxMoney('foodnstuff');<br><br>" +
+                           "the hostname or IP of the target server.<br>Example: getServerMaxMoney('foodnstuff');<br><br>" +
                            "<i>getServerGrowth(hostname/ip)</i><br>Returns the server's intrinsic 'growth parameter'. This growth parameter is a number " +
                            "between 1 and 100 that represents how quickly the server's money grows. This parameter affects the percentage by which this server's " +
                            "money is increased when using the grow() function. A higher growth parameter will result in a higher percentage from grow().<br><br>" +
                            "The argument passed in must be a string with the hostname or IP of the target server.<br><br>" +
                            "<i>getServerSecurityLevel(hostname/ip)</i><br>Returns the security level of a server. The argument passed in must be a string with either the " +
-                           "hostname or IP of the target server. A server's security is denoted by a number between 1 and 100. Does NOT work while offline.<br><br>" +
-                           "<i>getServerBaseSecurityLevel(hostname/ip)</i><br> Returns the base security level of a server. This is the security level that the server starts out with. " +
+                           "hostname or IP of the target server. A server's security is denoted by a number, typically between 1 and 100.<br><br>" +
+                           "<i>getServerBaseSecurityLevel(hostname/ip)</i><br>Returns the base security level of a server. This is the security level that the server starts out with. " +
                            "This is different than getServerSecurityLevel() because getServerSecurityLevel() returns the current security level of a server, which can constantly change " +
                            "due to hack(), grow(), and weaken() calls on that server. The base security level will stay the same until you reset by installing an Augmentation. <br><br>" +
-                           "The argument passed in must be a string with either the hostname or IP of the target server. A server's base security is denoted by a number between 1 and 100. " +
-                           "Does NOT work while offline.<br><br>" +
+                           "The argument passed in must be a string with either the hostname or IP of the target server. A server's base security is denoted by a number, typically between 1 and 100. " +
+                           "<br><br>" +
+                           "<i>getServerMinSecurityLevel(hostname/ip)</i>Returns the minimum security level of a server. The argument passed in must be a string with " +
+                           "either the hostname or IP of the target server.<br><br>" +
                            "<i>getServerRequiredHackingLevel(hostname/ip)</i><br>Returns the required hacking level of a server. The argument passed in must be a string with either the " +
-                           "hostname or IP or the target server. Does NOT work while offline <br><br>" +
+                           "hostname or IP or the target server.<br><br>" +
                            "<i>getServerNumPortsRequired(hostname/ip)</i><br>Returns the number of open ports required to successfully run NUKE.exe on a server. The argument " +
-                           "passed in must be a string with either the hostname or IP of the target server. Does NOT work while offline<br><br>" +
+                           "passed in must be a string with either the hostname or IP of the target server.<br><br>" +
                            "<i>getServerRam(hostname/ip)</i><br>Returns an array with two elements that gives information about the target server's RAM. The first " +
                            "element in the array is the amount of RAM that the server has (in GB). The second element in the array is the amount of RAM that " +
                            "is currently being used on the server.<br><br>" +
@@ -960,6 +999,12 @@ let CONSTANTS = {
     LatestUpdate:
     "v0.29.1<br>" +
     "-Added continue statement for for/while loops<br>" +
+    "-Added getServerMinSecurityLevel() Netscript function<br>" +
+    "-Added Javascript's Date module to Netscript. Since 'new' is not supported in Netscript yet, only the Date module's " +
+    "static methods will work (now(), UTC(), parse(), etc.).<br>" +
+    "-Failing a crime now gives half the experience it did before<br>" +
+    "-The repeated 'Find The-Cave' message after installing The Red Pill Augmentation now only happens " +
+    "if you've never destroyed a BitNode before<br>" +
     "-fileExists() function now works on literature files<br><br>" +
     "v0.29.0<br>" +
     "-Added BitNode-5: Artificial Intelligence<br>" +
diff --git a/src/Missions.js b/src/Missions.js
index 019a2a066..2932d622d 100644
--- a/src/Missions.js
+++ b/src/Missions.js
@@ -1,9 +1,11 @@
 import {CONSTANTS}                                  from "./Constants.js";
 import {Engine}                                     from "./engine.js";
+import {displayFactionContent}                      from "./Faction.js";
 import {Player}                                     from "./Player.js";
 import {dialogBoxCreate}                            from "../utils/DialogBox.js";
 import {addOffset, getRandomInt,
-        clearEventListenersEl}                      from "../utils/HelperFunctions.js";
+        clearEventListenersEl,
+        clearEventListeners}                        from "../utils/HelperFunctions.js";
 import {formatNumber, isString}                     from "../utils/StringHelperFunctions.js";
 import jsplumb                                      from 'jsplumb'
 
@@ -17,47 +19,48 @@ function setInMission(bool, mission) {
         currMission = null;
     }
 }
-/* Hacking Missions */
 
-/*You start with N CPU nodes dependent on home computer cores
+//Keyboard shortcuts
+$(document).keydown(function(e) {
+    if (inMission && currMission && currMission.selectedNode != null) {
+        switch (e.keyCode) {
+            case 65: //a for Attack
+                currMission.actionButtons[0].click();
+                break;
+            case 83: //s for Scan
+                currMission.actionButtons[1].click();
+                break;
+            case 87: //w for Weaken
+                currMission.actionButtons[2].click();
+                break;
+            case 70: //f for Fortify
+                currMission.actionButtons[3].click();
+                break;
+            case 82: //r for Overflow
+                currMission.actionButtons[4].click();
+                break;
+            case 68: //d for Detach connection
+                currMission.actionButtons[5].click();
+                break;
+            default:
+                break;
+        }
+    }
+});
 
-Three main stats:
-    Attack - Specific to a node. Affected by hacking skill, RAM (for home comp)
-    Defense - Universal defense - summed from all nodes
-    HP - Specific to a node. Affected by hacking skill, RAM (for home comp)
-
-Enemy has the following nodes:
-    Firewall Nodes - Essentially shields. Weak attack but large def
-    CPU Nodes - Defeating and capturing these will give you new nodes to use
-    Database Node - Main Target
-
-Misc Nodes (initially not owned by player or enemy):
-    Spam nodes - Increases time limit
-    Transfer Nodes - Slightly increases attack for all of your CPUs
-    Shield Node - Increases your defense
-
-Shapes for nodes:
-    Firewall - Rectangle
-    CPU - Circle
-    Database - Parralelogram
-    Spam - Diamond
-    Transfer - Cone
-    Shield - Shield shape
-
-*/
 let NodeTypes = {
     Core: "CPU Core Node",      //All actions available
     Firewall: "Firewall Node",  //No actions available
     Database: "Database Node",  //No actions available
     Spam: "Spam Node",          //No actions Available
-    Transfer: "Transfer Node",  //Can Weaken, Scan, and Overflow
+    Transfer: "Transfer Node",  //Can Weaken, Scan, Fortify and Overflow
     Shield: "Shield Node"       //Can Fortify
 }
 
 let NodeActions = {
     Attack: "Attacking", //Damaged based on attack stat + hacking level + opp def
-    Scan: "Scanning", //-Def for target, affected by hacking level
-    Weaken: "Weakening", //-Attack for target, affected by hacking level
+    Scan: "Scanning", //-Def for target, affected by attack and hacking level
+    Weaken: "Weakening", //-Attack for target, affected by attack and hacking level
     Fortify: "Fortifying", //+Defense for Node, affected by hacking level
     Overflow: "Overflowing", //+Attack but -Defense for Node, affected by hacking level
 }
@@ -126,8 +129,12 @@ Node.prototype.select = function(actionButtons) {
             actionButtons[1].classList.add("a-link-button");
             actionButtons[2].classList.remove("a-link-button-inactive");
             actionButtons[2].classList.add("a-link-button");
+            actionButtons[3].classList.remove("a-link-button-inactive");
+            actionButtons[3].classList.add("a-link-button");
             actionButtons[4].classList.remove("a-link-button-inactive");
             actionButtons[4].classList.add("a-link-button");
+            actionButtons[5].classList.remove("a-link-button-inactive");
+            actionButtons[5].classList.add("a-link-button");
             break;
         default:
             break;
@@ -135,7 +142,7 @@ Node.prototype.select = function(actionButtons) {
 }
 
 Node.prototype.deselect = function(actionButtons) {
-    this.el.classList.remove("active");
+    this.el.classList.remove("hack-mission-player-node-active");
     for (var i = 0; i < actionButtons.length; ++i) {
         actionButtons[i].classList.remove("a-link-button");
         actionButtons[i].classList.add("a-link-button-inactive");
@@ -148,6 +155,7 @@ Node.prototype.deselect = function(actionButtons) {
 function HackingMission(rep, fac) {
     this.faction = fac;
 
+    this.started = false;
     this.time = 120000; //2 minutes, milliseconds
 
     this.playerCores = [];
@@ -204,8 +212,8 @@ HackingMission.prototype.init = function() {
     }
 
     //Randomly generate enemy nodes (CPU and Firewall) based on difficulty
-    var numNodes = getRandomInt(this.difficulty, this.difficulty + 2);
-    var numFirewalls = getRandomInt(this.difficulty, this.difficulty + 5);
+    var numNodes = getRandomInt(this.difficulty, this.difficulty + 1);
+    var numFirewalls = getRandomInt(this.difficulty, this.difficulty + 2);
     var numDatabases = getRandomInt(this.difficulty, this.difficulty + 1);
     var totalNodes = numNodes + numFirewalls + numDatabases;
     var xlimit = 7 - Math.floor(totalNodes / 8);
@@ -216,8 +224,8 @@ HackingMission.prototype.init = function() {
     var randMult = addOffset(this.difficulty, 20);
     for (var i = 0; i < numNodes; ++i) {
         var stats = {
-            atk: randMult * getRandomInt(150, 200),
-            def: randMult * getRandomInt(40, 75),
+            atk: randMult * getRandomInt(125, 175),
+            def: randMult * getRandomInt(30, 50),
             hp: randMult * getRandomInt(225, 275)
         }
         this.enemyCores.push(new Node(NodeTypes.Core, stats));
@@ -283,15 +291,23 @@ HackingMission.prototype.createPageDom = function() {
     //Start button will get replaced with forfeit when game is started
     var startBtn = document.createElement("a");
     startBtn.innerHTML = "Start";
+    startBtn.setAttribute("id", "hack-mission-start-btn");
     startBtn.classList.add("a-link-button");
     startBtn.classList.add("hack-mission-header-element");
     startBtn.style.display = "inline-block";
+    startBtn.addEventListener("click", ()=>{
+        this.start();
+    });
+
+    var timer = document.createElement("p");
+    timer.setAttribute("id", "hacking-mission-timer");
+    timer.style.display = "inline-block";
 
     //Create Action Buttons (Attack/Scan/Weaken/ etc...)
     var actionsContainer = document.createElement("span");
     actionsContainer.style.display = "block";
     actionsContainer.classList.add("hack-mission-action-buttons-container");
-    for (var i = 0; i < 5; ++i) {
+    for (var i = 0; i < 6; ++i) {
         this.actionButtons.push(document.createElement("a"));
         this.actionButtons[i].style.display = "inline-block";
         this.actionButtons[i].classList.add("a-link-button-inactive"); //Disabled at start
@@ -303,19 +319,19 @@ HackingMission.prototype.createPageDom = function() {
     var atkTooltip = document.createElement("span");
     atkTooltip.classList.add("tooltiptext");
     atkTooltip.innerText = "Lowers the targeted node's HP. The effectiveness of this depends on " +
-                           "this node's Attack level, your hacking level, and the opponents defense level.";
+                           "this node's Attack level, your hacking level, and the opponent's defense level.";
     this.actionButtons[0].appendChild(atkTooltip);
     this.actionButtons[1].innerText = "Scan(s)";
     var scanTooltip = document.createElement("span");
     scanTooltip.classList.add("tooltiptext");
     scanTooltip.innerText = "Lowers the targeted node's defense. The effectiveness of this depends on " +
-                            "this node's Attack level and your hacking level";
+                            "this node's Attack level, your hacking level, and the opponent's defense level.";
     this.actionButtons[1].appendChild(scanTooltip);
     this.actionButtons[2].innerText = "Weaken(w)";
     var WeakenTooltip = document.createElement("span");
     WeakenTooltip.classList.add("tooltiptext");
     WeakenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
-                              "this node's Attack level and your hacking level";
+                              "this node's Attack level, your hacking level, and the opponent's defense level.";
     this.actionButtons[2].appendChild(WeakenTooltip);
     this.actionButtons[3].innerText = "Fortify(f)";
     var fortifyTooltip = document.createElement("span");
@@ -329,6 +345,26 @@ HackingMission.prototype.createPageDom = function() {
     overflowTooltip.innerText = "Raises this node's Attack level but lowers its Defense level. The effectiveness " +
                                 "of this depends on your hacking level.";
     this.actionButtons[4].appendChild(overflowTooltip);
+    this.actionButtons[5].innerText = "Drop Connection(d)";
+    var dropconnTooltip = document.createElement("span");
+    dropconnTooltip.classList.add("tooltiptext");
+    dropconnTooltip.innerText = "Removes this Node's current connection to some target Node, if it has one. This can " +
+                                "also be done by simply clicking the white connection line.";
+    this.actionButtons[5].appendChild(dropconnTooltip);
+
+    //Player/enemy defense displays will be in action container
+    var playerDefense = document.createElement("p");
+    var enemyDefense = document.createElement("p");
+    playerDefense.style.display = "inline-block";
+    enemyDefense.style.display = "inline-block";
+    playerDefense.style.color = "blue";
+    enemyDefense.style.color = "red";
+    playerDefense.style.margin = "4px";
+    enemyDefense.style.margin = "4px";
+    playerDefense.setAttribute("id", "hacking-mission-player-def");
+    enemyDefense.setAttribute("id", "hacking-mission-enemy-def");
+    actionsContainer.appendChild(playerDefense);
+    actionsContainer.appendChild(enemyDefense);
 
     //Set Action Button event listeners
     this.actionButtons[0].addEventListener("click", ()=>{
@@ -381,12 +417,24 @@ HackingMission.prototype.createPageDom = function() {
         this.selectedNode.action = NodeActions.Overflow;
     });
 
+    this.actionButtons[5].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        if (this.selectedNode.conn) {
+            var endpoints = this.selectedNode.conn.endpoints;
+            endpoints[0].detachFrom(endpoints[1]);
+        }
+    })
+
     var timeDisplay = document.createElement("p");
 
     container.appendChild(headerText);
     container.appendChild(inGameGuideBtn);
     container.appendChild(wikiGuideBtn);
     container.appendChild(startBtn);
+    container.appendChild(timer);
     container.appendChild(actionsContainer);
     container.appendChild(timeDisplay);
 }
@@ -446,8 +494,9 @@ HackingMission.prototype.calculateDefenses = function() {
     for (var i = 0; i < this.playerNodes.length; ++i) {
         total += this.playerNodes[i].def;
     }
-    console.log("player defenses calculated to be: " + total);
     this.playerDef = total;
+    document.getElementById("hacking-mission-player-def").innerText =
+        "Player Defense: " + formatNumber(this.playerDef, 1);
     total = 0;
     for (var i = 0; i < this.enemyCores.length; ++i) {
         total += this.enemyCores[i].def;
@@ -458,8 +507,9 @@ HackingMission.prototype.calculateDefenses = function() {
     for (var i = 0; i < this.enemyNodes.length; ++i) {
         total += this.enemyNodes[i].def;
     }
-    console.log("enemy defenses calculated to be: " + total);
     this.enemyDef = total;
+    document.getElementById("hacking-mission-enemy-def").innerText =
+        "Enemy Defense: " + formatNumber(this.enemyDef, 1);
 }
 
 HackingMission.prototype.removeAvailablePosition = function(x, y) {
@@ -513,16 +563,16 @@ HackingMission.prototype.createMap = function() {
                     case 0: //Spam
                         var stats = {
                             atk: 0,
-                            def: randMult * getRandomInt(10, 20),
-                            hp: randMult * getRandomInt(60, 90)
+                            def: randMult * getRandomInt(30, 40),
+                            hp: randMult * getRandomInt(70, 90)
                         }
                         node = new Node(NodeTypes.Spam, stats);
                         break;
                     case 1: //Transfer
                         var stats = {
                             atk: 0,
-                            def: randMult * getRandomInt(35, 45),
-                            hp: randMult * getRandomInt(75, 90)
+                            def: randMult * getRandomInt(50, 70),
+                            hp: randMult * getRandomInt(80, 95)
                         }
                         node = new Node(NodeTypes.Transfer, stats);
                         break;
@@ -530,8 +580,8 @@ HackingMission.prototype.createMap = function() {
                     default:
                         var stats = {
                             atk: 0,
-                            def: randMult * getRandomInt(80, 100),
-                            hp: randMult * getRandomInt(100, 125)
+                            def: randMult * getRandomInt(90, 105),
+                            hp: randMult * getRandomInt(130, 150)
                         }
                         node = new Node(NodeTypes.Shield, stats);
                         break;
@@ -555,8 +605,6 @@ HackingMission.prototype.createMap = function() {
         console.log("Configuring Player Node: " + this.playerCores[i].el.id);
         this.configurePlayerNodeElement(this.playerCores[i].el);
     }
-
-    this.initJsPlumb();
 }
 
 HackingMission.prototype.createNodeDomElement = function(nodeObj) {
@@ -712,6 +760,8 @@ HackingMission.prototype.configureEnemyNodeElement = function(el) {
     if (this.selectedNode == nodeObj) {
         nodeObj.deselect(this.actionButtons);
     }
+
+    //TODO Need to remove event listeners
 }
 
 //Returns bool indicating whether a node is reachable by player
@@ -725,6 +775,17 @@ HackingMission.prototype.nodeReachable = function(node) {
     return false;
 }
 
+HackingMission.prototype.start = function() {
+    this.started = true;
+    this.initJsPlumb();
+    var startBtn = clearEventListeners("hack-mission-start-btn");
+    startBtn.innerHTML = "Forfeit Mission";
+    startBtn.addEventListener("click", ()=>{
+        this.finishMission(false);
+        return false;
+    });
+}
+
 HackingMission.prototype.initJsPlumb = function() {
     var instance = jsPlumb.getInstance({
         DragOptions:{cursor:"pointer", zIndex:2000},
@@ -828,31 +889,51 @@ HackingMission.prototype.dropAllConnectionsToNode = function(node) {
 }
 
 HackingMission.prototype.process = function(numCycles=1) {
-    var res = true;
+    if (!this.started) {return;}
+    var res = false;
     //Process actions of all player nodes
-    for (var i = 0; i < this.playerCores.length; ++i) {
-        res &= this.processNode(this.playerCores[i], numCycles);
-    }
+    this.playerCores.forEach((node)=>{
+        res |= this.processNode(node, numCycles);
+    });
+
+    this.playerNodes.forEach((node)=>{
+        if (node.type === NodeTypes.Transfer) {
+            res |= this.processNode(node, numCycles);
+        }
+    });
 
     //Process actions of all enemy nodes
-    for (var i = 0; i < this.enemyCores.length; ++i) {
-        res &= this.processNode(this.enemyCores[i], numCycles);
-    }
+    this.enemyCores.forEach((node)=>{
+        res |= this.processNode(node, numCycles);
+    });
+
+    this.enemyNodes.forEach((node)=>{
+        if (node.type === NodeTypes.Transfer) {
+            res |= this.processNode(node, numCycles);
+        }
+    });
 
     if (res) {this.calculateDefenses();}
 
-    //TODO Check if win/lose
+    if (this.enemyDatabases.length === 0) {
+        this.finishMission(true);
+        return;
+    }
 
     //Update timer and check if player lost
     this.time -= (numCycles * Engine._idleSpeed);
     if (this.time <= 0) {
         this.finishMission(false);
+        return;
     }
+    this.updateTimer();
 }
 
 //Returns a bool representing whether defenses need to be re-calculated
 HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
-    if (nodeObj.action === null) {return;}
+    if (nodeObj.action === null) {
+        return;
+    }
 
     var targetNode = null, def;
     if (nodeObj.conn) {
@@ -876,13 +957,13 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
             break;
         case NodeActions.Scan:
             if (nodeObj.conn === null) {break;}
-            var eff = this.calculateScanEffect(def, Player.hacking_skill);
+            var eff = this.calculateScanEffect(nodeObj.atk, def, Player.hacking_skill);
             targetNode.def -= (eff/5 * numCycles);
             calcDefenses = true;
             break;
         case NodeActions.Weaken:
             if (nodeObj.conn === null) {break;}
-            var eff = this.calculateWeakenEffect(def, Player.hacking_skill);
+            var eff = this.calculateWeakenEffect(nodeObj.atk, def, Player.hacking_skill);
             targetNode.atk -= (eff/5 * numCycles);
             break;
         case NodeActions.Fortify:
@@ -917,31 +998,60 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
         if (this.selectedNode == targetNode) {
             targetNode.deselect();
         }
+
+        //Flag for whether the target node was a misc node
+        var isMiscNode = !targetNode.plyrCtrl && !targetNode.enmyCtrl;
+        console.log("isMiscNode: " + isMiscNode);
+
+        //Remove all connections from Node
         this.dropAllConnectionsToNode(targetNode);
         this.dropAllConnectionsFromNode(targetNode);
+
+        //Changes the css class and turn the node into a JsPlumb Source/Target
         if (conqueredByPlayer) {
-            targetNode.setControlledByPlayer()
-        } else { //Conquered by enemy
+            targetNode.setControlledByPlayer();
+            this.jsplumbinstance.unmakeTarget(targetNode.el);
+            this.jsplumbinstance.makeSource(targetNode.el, {
+                deleteEndpointsOnEmpty:true,
+                maxConnections:1,
+                anchor:"Center",
+                connector:"Straight"
+            });
+        } else {
             targetNode.setControlledByEnemy();
+            this.jsplumbinstance.unmakeSource(targetNode.el);
+            this.jsplumbinstance.makeTarget(targetNode.el, {
+                maxConnections:-1,
+                anchor:"Center",
+                connector:["Straight"]
+            });
         }
+
         calcDefenses = true;
 
+        //Helper function to swap nodes between the respective enemyNodes/playerNodes arrays
         function swapNodes(orig, dest, targetNode) {
+            console.log("swapNodes called");
             for (var i = 0; i < orig.length; ++i) {
                 if (orig[i] == targetNode) {
+                    console.log("Swapping nodes");
                     var node = orig.splice(i, 1);
+                    node = node[0];
                     dest.push(node);
                     break;
                 }
             }
         }
 
+        //Whether conquered node was a misc node
         switch(targetNode.type) {
             case NodeTypes.Core:
                 if (conqueredByPlayer) {
                     swapNodes(this.enemyCores, this.playerCores, targetNode);
+                    this.configurePlayerNodeElement(targetNode.el);
                 } else {
                     swapNodes(this.playerCores, this.enemyCores, targetNode);
+                    this.configureEnemyNodeElement(targetNode.el);
                 }
                 break;
             case NodeTypes.Firewall:
@@ -952,12 +1062,44 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
                 }
                 break;
             case NodeTypes.Database:
+                if (conqueredByPlayer) {
+                    swapNodes(this.enemyDatabases, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(this.playerNodes, this.enemyDatabases, targetNode);
+                }
                 break;
             case NodeTypes.Spam:
+                if (conqueredByPlayer) {
+                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+                }
+
+                //Conquering spam node increases time limit
+                this.time += CONSTANTS.HackingMissionSpamTimeIncrease;
                 break;
             case NodeTypes.Transfer:
+                //Conquering a Transfer node increases the attack of all cores by some percentages
+                if (conqueredByPlayer) {
+                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+                    this.playerCores.forEach(function(node) {
+                        node.atk *= CONSTANTS.HackingMissionTransferAttackIncrease;
+                    });
+                    this.configurePlayerNodeElement(targetNode.el);
+                } else {
+                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+                    this.enemyCores.forEach(function(node) {
+                        node.atk *= CONSTANTS.HackingMissionTransferAttackIncrease;
+                    });
+                    this.configureEnemyNodeElement(targetNode.el);
+                }
                 break;
             case NodeTypes.Shield:
+                if (conqueredByPlayer) {
+                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+                }
                 break;
         }
     }
@@ -967,7 +1109,7 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
 }
 
 var hackEffWeightSelf = 100; //Weight for Node actions on self
-var hackEffWeightTarget = 10; //Weight for Node Actions against Target
+var hackEffWeightTarget = 15; //Weight for Node Actions against Target
 var hackEffWeightAttack = 100; //Weight for Attack action
 
 //Returns damage per cycle based on stats
@@ -975,12 +1117,12 @@ HackingMission.prototype.calculateAttackDamage = function(atk, def, hacking = 0)
     return Math.max(atk + (hacking / hackEffWeightAttack) - def, 0.1);
 }
 
-HackingMission.prototype.calculateScanEffect = function(def, hacking=0) {
-    return Math.max(hacking / hackEffWeightTarget - def, 0.1);
+HackingMission.prototype.calculateScanEffect = function(atk, def, hacking=0) {
+    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 0.1);
 }
 
-HackingMission.prototype.calculateWeakenEffect = function(def, hacking=0) {
-    return Math.max(hacking / hackEffWeightTarget - def, 0.1);
+HackingMission.prototype.calculateWeakenEffect = function(atk, def, hacking=0) {
+    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 0.1);
 }
 
 HackingMission.prototype.calculateFortifyEffect = function(hacking=0) {
@@ -991,9 +1133,40 @@ HackingMission.prototype.calculateOverflowEffect = function(hacking=0) {
     return hacking / hackEffWeightSelf;
 }
 
+//Updates timer display
+HackingMission.prototype.updateTimer = function() {
+    var timer = document.getElementById("hacking-mission-timer");
+
+    //Convert time remaining to a string of the form m:ss
+    var seconds = Math.round(this.time / 1000);
+    var minutes = Math.trunc(seconds / 60);
+    seconds %= 60;
+    var str = ("0" + minutes).slice(-2) + ":" + ("0" + seconds).slice(-2);
+    timer.innerText = "Time left: " + str;
+}
+
 //The 'win' argument is a bool for whether or not the player won
 HackingMission.prototype.finishMission = function(win) {
+    inMission = false;
+    currMission = null;
 
+    if (win) {
+        dialogBoxCreate("Mission won!");
+    } else {
+        dialogBoxCreate("Mission lost!");
+    }
+
+    //Clear mission container
+    var container = document.getElementById("mission-container");
+    while(container.firstChild) {
+        container.removeChild(container.firstChild);
+    }
+
+    //Return to Faction page
+    document.getElementById("mainmenu-container").style.visibility = "visible";
+    document.getElementById("character-overview-wrapper").style.visibility = "visible";
+    Engine.loadFactionContent();
+    displayFactionContent(this.faction.name);
 }
 
 export {HackingMission, inMission, setInMission, currMission};
diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js
index b049da8e4..089c23b70 100644
--- a/src/NetscriptFunctions.js
+++ b/src/NetscriptFunctions.js
@@ -64,6 +64,7 @@ function initSingularitySFFlags() {
 function NetscriptFunctions(workerScript) {
     return {
         Math : Math,
+        Date : Date,
         hacknetnodes : Player.hacknetNodes,
         scan : function(ip=workerScript.serverIp, hostnames=true){
             var server = getServer(ip);
@@ -135,6 +136,7 @@ function NetscriptFunctions(workerScript) {
 
                     Player.gainMoney(moneyGained);
                     workerScript.scriptRef.onlineMoneyMade += moneyGained;
+                    Player.scriptProdSinceLastAug += moneyGained;
                     workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);
                     Player.gainHackingExp(expGainedOnSuccess);
                     workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
@@ -703,6 +705,15 @@ function NetscriptFunctions(workerScript) {
             workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + formatNumber(server.baseDifficulty, 3) + " for " + server.hostname);
             return server.baseDifficulty;
         },
+        getServerMinSecurityLevel : function(ip) {
+            var server = getServer(ip);
+            if (server == null) {
+                workerScript.scriptRef.log("getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+                throw makeRuntimeRejectMsg(workerScript, "getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+            }
+            workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + formatNumber(server.minDifficulty, 3) + " for " + server.hostname);
+            return server.minDifficulty;
+        },
         getServerRequiredHackingLevel : function(ip){
             var server = getServer(ip);
             if (server == null) {
@@ -872,6 +883,7 @@ function NetscriptFunctions(workerScript) {
             var netProfit = ((stock.price - stock.playerAvgPx) * shares) - CONSTANTS.StockMarketCommission;
             if (isNaN(netProfit)) {netProfit = 0;}
             workerScript.scriptRef.onlineMoneyMade += netProfit;
+            Player.scriptProdSinceLastAug += netProfit;
 
             stock.playerShares -= shares;
             if (stock.playerShares == 0) {
@@ -984,6 +996,21 @@ function NetscriptFunctions(workerScript) {
                                        "as a purchased server. This is likely a bug please contact game dev");
             return false;
         },
+        getPurchasedServers : function(hostname=true) {
+            var res = [];
+            Player.purchasedServers.forEach(function(ip) {
+                if (hostname) {
+                    var server = getServer(ip);
+                    if (server == null) {
+                        throw makeRuntimeRejectMsg(workerScript, "ERR: Could not find server in getPurchasedServers(). This is a bug please report to game dev");
+                    }
+                    res.push(server.hostname);
+                } else {
+                    res.push(ip);
+                }
+            });
+            return res;
+        },
         round : function(n) {
             if (isNaN(n)) {return 0;}
             return Math.round(n);
diff --git a/src/Player.js b/src/Player.js
index 9d412cf44..40aa25b72 100644
--- a/src/Player.js
+++ b/src/Player.js
@@ -93,8 +93,7 @@ function PlayerObject() {
 
     //Servers
     this.currentServer          = ""; //IP address of Server currently being accessed through terminal
-    this.discoveredServers      = []; //IP addresses of secret servers not in the network that you have discovered
-    this.purchasedServers       = [];
+    this.purchasedServers       = []; //IP Addresses of purchased servers
     this.hacknetNodes           = [];
     this.totalHacknetNodeProduction = 0;
 
@@ -187,6 +186,9 @@ function PlayerObject() {
 	this.lastUpdate = 0;
     this.totalPlaytime = 0;
     this.playtimeSinceLastAug = 0;
+
+    //Script production since last Aug installation
+    this.scriptProdSinceLastAug = 0;
 };
 
 PlayerObject.prototype.init = function() {
@@ -232,7 +234,6 @@ PlayerObject.prototype.prestigeAugmentation = function() {
     this.companyName = "";
     this.companyPosition = "";
 
-    this.discoveredServers = [];
     this.purchasedServers = [];
 
     this.factions = [];
@@ -311,7 +312,6 @@ PlayerObject.prototype.prestigeSourceFile = function() {
     this.companyName = "";
     this.companyPosition = "";
 
-    this.discoveredServers = [];
     this.purchasedServers = [];
 
     this.factions = [];
@@ -1363,6 +1363,7 @@ PlayerObject.prototype.takeClass = function(numCycles) {
 //through a Singularity Netscript function
 PlayerObject.prototype.finishClass = function(sing=false) {
     this.gainWorkExp();
+    this.gainIntelligenceExp(CONSTANTS.IntelligenceClassBaseExpGain * Math.round(this.timeWorked / 1000));
 
     if (this.workMoneyGained > 0) {
         throw new Error("ERR: Somehow gained money while taking class");
@@ -1513,6 +1514,14 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
                             formatNumber(this.workAgiExpGained, 4) + " agility experience<br>" +
                             formatNumber(this.workChaExpGained, 4) + " charisma experience");
         } else {
+            //Exp halved on failure
+            this.workHackExpGained  /= 2;
+            this.workStrExpGained   /= 2;
+            this.workDefExpGained   /= 2;
+            this.workDexExpGained   /= 2;
+            this.workAgiExpGained   /= 2;
+            this.workChaExpGained   /= 2;
+
             dialogBoxCreate("Crime failed! <br><br>" +
                     "You gained:<br>"+
                     formatNumber(this.workHackExpGained, 4) + " hacking experience <br>" +
@@ -1526,8 +1535,6 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
         this.gainWorkExp();
     }
 
-
-
     var mainMenu = document.getElementById("mainmenu-container");
     mainMenu.style.visibility = "visible";
     this.isWorking = false;
diff --git a/src/engine.js b/src/engine.js
index dd8768492..5409d21fd 100644
--- a/src/engine.js
+++ b/src/engine.js
@@ -248,6 +248,7 @@ let Engine = {
         Engine.hideAllContent();
         Engine.Display.activeScriptsContent.style.visibility = "visible";
         setActiveScriptsClickHandlers();
+        updateActiveScriptsItems();
         Engine.currentPage = Engine.Page.ActiveScripts;
         document.getElementById("active-scripts-menu-link").classList.add("active");
     },
@@ -395,6 +396,7 @@ let Engine = {
         document.getElementById("mainmenu-container").style.visibility = "hidden";
         document.getElementById("character-overview-wrapper").style.visibility = "hidden";
         Engine.Display.missionContent.style.visibility = "visible";
+        Engine.currentPage = Engine.Page.Mission;
     },
 
     //Helper function that hides all content
@@ -477,6 +479,11 @@ let Engine = {
         if (Player.companyPosition != "") {
             companyPosition = Player.companyPosition.positionName;
         }
+
+        var bnText = "";
+        if (Player.sourceFiles.length !== 0) {
+            bnText = "<br>Current BitNode: " + Player.bitNodeN;
+        }
         Engine.Display.characterInfo.innerHTML =
        ('<b>General</b><br><br>' +
         'Current City: ' + Player.city + '<br><br>' +
@@ -528,7 +535,8 @@ let Engine = {
         'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '<br>' +
         'Augmentations installed: ' + Player.augmentations.length + '<br>' +
         'Time played since last Augmentation: ' + convertTimeMsToTimeElapsedString(Player.playtimeSinceLastAug) + '<br>' +
-        'Time played: ' + convertTimeMsToTimeElapsedString(Player.totalPlaytime) + '<br><br><br>').replace( / /g, "&nbsp;" );
+        'Time played: ' + convertTimeMsToTimeElapsedString(Player.totalPlaytime) +
+        bnText + '<br><br><br>').replace( / /g, "&nbsp;" );
     },
 
     /* Display locations in the world*/

From 22a5d3b3cc23b6008f4d415a9b8fd116b44faea6 Mon Sep 17 00:00:00 2001
From: danielyxie <danielyxie@gmail.com>
Date: Wed, 27 Sep 2017 10:13:42 -0500
Subject: [PATCH 5/6] Finished BETA version of Missions. All other changes for
 v0.29.1

---
 css/missions.css          |    1 -
 dist/bundle.js            | 3470 +++++++++++++++++++------------------
 src/ActiveScriptsUI.js    |    9 +-
 src/Constants.js          |   73 +-
 src/Message.js            |   11 +-
 src/Missions.js           |  197 ++-
 src/NetscriptFunctions.js |   18 +-
 src/Player.js             |    2 +
 src/engine.js             |    3 +-
 9 files changed, 1989 insertions(+), 1795 deletions(-)

diff --git a/css/missions.css b/css/missions.css
index 4a5052378..6abafebda 100644
--- a/css/missions.css
+++ b/css/missions.css
@@ -34,7 +34,6 @@
     background-color:blue;
 }
 
-.hack-mission-player-node:hover,
 .hack-mission-player-node-active {
     border: 2px solid white;
     color: #6666ff;
diff --git a/dist/bundle.js b/dist/bundle.js
index a27d4caee..5ef1fe5f0 100644
--- a/dist/bundle.js
+++ b/dist/bundle.js
@@ -75,14 +75,14 @@
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Company_js__ = __webpack_require__(18);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Crimes_js__ = __webpack_require__(37);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Crimes_js__ = __webpack_require__(39);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Gang_js__ = __webpack_require__(30);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Gang_js__ = __webpack_require__(32);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Location_js__ = __webpack_require__(12);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__SpecialServerIps_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SourceFile_js__ = __webpack_require__(31);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SourceFile_js__ = __webpack_require__(33);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_decimal_js__ = __webpack_require__(25);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_13__utils_decimal_js__);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__ = __webpack_require__(1);
@@ -360,6 +360,7 @@ PlayerObject.prototype.prestigeAugmentation = function() {
     this.lastUpdate = new Date().getTime();
 
     this.playtimeSinceLastAug = 0;
+    this.scriptProdSinceLastAug = 0;
 
     this.hacknetNodes.length = 0;
     this.totalHacknetNodeProduction = 0;
@@ -450,6 +451,7 @@ PlayerObject.prototype.prestigeSourceFile = function() {
     this.hasTixApiAccess = false;
 
     this.playtimeSinceLastAug = 0;
+    this.scriptProdSinceLastAug = 0;
 }
 
 PlayerObject.prototype.getCurrentServer = function() {
@@ -2642,31 +2644,30 @@ let CONSTANTS = {
 
     //Hacking Missions
     HackingMissionRepToDiffConversion: 5000, //Faction rep is divided by this to get mission difficulty
-    HackingMissionRepToRewardConversion: 20, //Faction rep divided byt his to get mission rep reward
+    HackingMissionRepToRewardConversion: 12, //Faction rep divided byt his to get mission rep reward
     HackingMissionSpamTimeIncrease: 20000, //How much time limit increase is gained when conquering a Spam Node (ms)
     HackingMissionTransferAttackIncrease: 1.05, //Multiplier by which the attack for all Core Nodes is increased when conquering a Transfer Node
     HackingMissionHowToPlay: "Hacking missions are a minigame that, if won, will reward you with faction reputation.<br><br>" +
                              "In this game you control a set of Nodes and use them to try and defeat an enemy. Your Nodes " +
-                             "are colored blue, while the enemy's are red. There are also other nodes on the map colored gray" +
+                             "are colored blue, while the enemy's are red. There are also other nodes on the map colored gray " +
                              "that initially belong to neither you nor the enemy. The goal of the game is " +
                              "to capture all of the enemy's database nodes, which are the parallelogram-shaped ones, within the time limit. " +
                              "If you cannot capture all of the enemy's database nodes in the time limit, you will lose.<br><br>" +
                              "Each Node has three stats: Attack, Defense, and HP. There are five different actions that " +
                              "a Node can take:<br><br> " +
-                             "Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the Node's Attack, the Player's " +
+                             "Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the owner's Attack, the Player's " +
                              "hacking level, and the enemy's defense.<br>" +
-                             "Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the Player's hacking level and the " +
+                             "Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the " +
                              "enemy's defense.<br>"  +
-                             "Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the Player's hacking level and the enemy's " +
+                             "Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the enemy's " +
                              "defense.<br>" +
-                             "Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.<br><br>" +
-                             "To capture a Node, you must lower its HP down to 0. " +
-                             "A Node's 'Attack' stats affects its effectiveness when attacking other Nodes. A Node's 'Defense' helps protect " +
-                             "against the actions of enemy Nodes. One important thing to note is that, when defending, your total 'Defense' " +
-                             "(sum of the Defense of all of your Nodes) is what's taken into account when determining the effect of offensive actions. " +
-                             "However, when attacking, only the 'Attack' of the Node being used to attack is taken into account.<br><br>" +
+                             "Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.<br>" +
+                             "Overflow - Raises the Node's Attack but lowers its Defense. The effectiveness is determined by your hacking level.<br><br>" +
+                             "Note that when determining the effectiveness of the above actions, the TOTAL Attack or Defense of the team is used, not just the " +
+                             "Attack/Defense of the individual Node that is performing the action.<br><br." +
+                             "To capture a Node, you must lower its HP down to 0.<br><br>" +
                              "There are six different types of Nodes:<br><br>" +
-                             "CPU Core - These are your main Nodes that are used to perform actions<br>" +
+                             "CPU Core - These are your main Nodes that are used to perform actions. Capable of performing every action<br>" +
                              "Firewall - Nodes with high defense. These Nodes cannot perform any actions<br>" +
                              "Database - A special type of Node. The player's objective is to conquer all of the enemy's Database Nodes within " +
                              "the time limit. These Nodes cannot perform any actions<br>"  +
@@ -2675,10 +2676,16 @@ let CONSTANTS = {
                              "Transfer - Conquering one of these nodes will increase the Attack of all of your CPU Cores by a small fixed percentage. " +
                              "These Nodes are capable of performing every action except the 'Attack' action<br>" +
                              "Shield - Nodes with high defense. These Nodes cannot perform any actions<br><br>" +
+                             "To assign an action to a Node, you must first select one of your Nodes. This can be done by simply clicking on it. Only " +
+                             "one Node can be selected at a time, and it will be denoted with a white highlight. After selecting the Node, " +
+                             "select its action using the Action Buttons near the top of the screen. Every action also has a corresponding keyboard " +
+                             "shortcut that can be used as well.<br><br>" +
                              "For certain actions such as attacking, scanning, and weakening, the Node performing the action must have a target. To target " +
                              "another node, simply click-and-drag from the 'source' Node to a target. A Node can only have one target, and you can only target " +
                              "Nodes that are adjacent to one of your Nodes (immediately above, below, or to the side. NOT diagonal). Furthermore, only CPU Cores and Transfer Nodes " +
-                             "can target, since they are the only ones that can perform actions",
+                             "can target, since they are the only ones that can perform actions. To remove a target, you can simply click on the line that represents " +
+                             "the connection between one of your Nodes and its target. Alternatively, you can select the 'source' Node and click the 'Drop Connection' button, " +
+                             "or press 'd',",
 
 
     //Gang constants
@@ -2936,6 +2943,9 @@ let CONSTANTS = {
                            "args.length<br><br>" +
                            "Note that none of the other functions that typically work with arrays, such as remove(), insert(), clear(), etc., will work on the " +
                            "args array.<br><br>" +
+                           "<u><h1>Javascript Modules</h1></u><br>" +
+                           "Netscript supports the following Javascript Modules:<br><br>" +
+                           "Math<br>Date (static functions only)<br><br>" +
                            "<u><h1> Functions </h1></u><br>" +
                            "You can NOT define you own functions in Netscript (yet), but there are several built in functions that " +
                            "you may use: <br><br> " +
@@ -3167,8 +3177,9 @@ let CONSTANTS = {
                            "on the server specified by the hostname/ip. The argument must be a string with the hostname/ip of the target server.<br><br>" +
                            "<i>getScriptIncome([scriptname], [hostname/ip], [args...])</i><br>" +
                            "Returns the amount of income the specified script generates while online (when the game is open, does not apply for " +
-                           "offline income). This function can also return the total income of all of your active scripts by running the function " +
-                           "with no arguments.<br><br>" +
+                           "offline income). This function can also be called with no arguments. If called with no arguments, then this function " +
+                           "will return an array of two values. The first value is the total income ($/sec) of all of your active scripts (currently running). " +
+                           "The second value is the total income ($/sec) from scripts since you last installed Augmentations (or destroyed a BitNode).<br><br>" +
                            "Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script " +
                            "with the arguments 'foodnstuff' and '5' then in order to use this function to get that script's income you must " +
                            "specify those arguments in this function call.<br><br>" +
@@ -3187,6 +3198,8 @@ let CONSTANTS = {
                            "The second argument must be a string with the hostname/IP of the target server. If the first argument is specified " +
                            "then the second argument must be specified as well. Any additional arguments passed to the function will specify " +
                            "the arguments passed into the target script.<br><br>" +
+                           "<i>getTimeSinceLastAug()</i><br>" +
+                           "Returns the amount of time in milliseconds that have passed since you last installed Augmentations (or destroyed a BitNode).<br><br>" +
                            "<u><h1>Hacknet Nodes API</h1></u><br>" +
                            "Netscript provides the following API for accessing and upgrading your Hacknet Nodes through scripts. This API does NOT work offline.<br><br>" +
                            "<i>hacknetnodes</i><br> A special variable. This is an array that maps to the Player's Hacknet Nodes. The Hacknet Nodes are accessed through " +
@@ -3516,28 +3529,24 @@ let CONSTANTS = {
 
     LatestUpdate:
     "v0.29.1<br>" +
+    "-New gameplay feature that is currently in BETA: Hacking Missions. Hacking Missions is an active gameplay mechanic (its a minigame) " +
+    "that is meant to be used to earn faction reputation. However, since this is currently in beta, hacking missions will NOT grant reputation " +
+    "for the time being, since the feature likely has many bugs, balance problems, and other issues. If you have any feedback " +
+    "regarding the new feature, feel free to let me know<br>" +
+    "-CHANGED THE RETURN VALUE OF getScriptIncome() WHEN RAN WITH NO ARGUMENTS. It will now return an array of " +
+    "two values rather than a single value. This may break your scripts, so make sure to update them!<br>" +
     "-Added continue statement for for/while loops<br>" +
-    "-Added getServerMinSecurityLevel() Netscript function<br>" +
+    "-Added getServerMinSecurityLevel(), getPurchasedServers(), and getTimeSinceLastAug() Netscript functions<br>" +
+    "-Netscript scp() function can now take an array as the first argument, and will try to copy " +
+    "every file specified in the array (it will just call scp() normally for every element in the array). " +
+    "If an array is passed in, then the scp() function returns true if at least one element from the array is successfully copied<br>" +
     "-Added Javascript's Date module to Netscript. Since 'new' is not supported in Netscript yet, only the Date module's " +
     "static methods will work (now(), UTC(), parse(), etc.).<br>" +
     "-Failing a crime now gives half the experience it did before<br>" +
-    "-The repeated 'Find The-Cave' message after installing The Red Pill Augmentation now only happens " +
-    "if you've never destroyed a BitNode before<br>" +
-    "-fileExists() function now works on literature files<br><br>" +
-    "v0.29.0<br>" +
-    "-Added BitNode-5: Artificial Intelligence<br>" +
-    "-Added getIp(), getIntelligence(), getHackingMultipliers(), and getBitNodeMultipliers() Netscript functions (requires Source-File 5)<br>" +
-    "-Updated scan() Netscript function so that you can choose to have it print IPs rather than hostnames<br>" +
-    "-Refactored scp() Netscript function so that it takes an optional 'source server' argument<br>" +
-    "-For Infiltration, decreased the percentage by which the security level increases by " +
-    "about 10% for every location<br>" +
-    "-Using :w in the script editor's Vim keybinding mode should now save and quit to Terminal<br>" +
-    "-Some minor optimizations that should reduce the size of the save file<br>" +
-    "-scan-analyze Terminal command will no longer show your purchased servers, unless you pass a '-a' flag into the command<br>" +
-    "-After installing the Red Pill augmentation from Daedalus, the message telling you to find 'The-Cave' " +
-    "will now repeatedly pop up regardless of whether or not you have messages suppressed<br>" +
-    "-Various bugfixes",
-
+    "-The forced repeated 'Find The-Cave' message after installing The Red Pill Augmentation now only happens " +
+    "if you've never destroyed a BitNode before, and will only popup every 15 minutes. If you have already destroyed a BitNode, " +
+    "the message will not pop up if you have messages suppressed (if you don't have messages suppressed it WILL still repeatedly popup)<br>" +
+    "-fileExists() function now works on literature files<br><br>",
 }
 
 
@@ -3551,12 +3560,12 @@ let CONSTANTS = {
 Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
 /* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Engine", function() { return Engine; });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_GameOptions_js__ = __webpack_require__(35);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_GameOptions_js__ = __webpack_require__(38);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__ = __webpack_require__(36);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__ = __webpack_require__(27);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(27);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(28);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__ = __webpack_require__(23);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__ = __webpack_require__(17);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__BitNode_js__ = __webpack_require__(9);
@@ -3565,22 +3574,22 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__CreateProgram_js__ = __webpack_require__(14);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Location_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Gang_js__ = __webpack_require__(30);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__ = __webpack_require__(34);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Gang_js__ = __webpack_require__(32);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__ = __webpack_require__(37);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__InteractiveTutorial_js__ = __webpack_require__(24);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__Literature_js__ = __webpack_require__(43);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__Literature_js__ = __webpack_require__(44);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__Message_js__ = __webpack_require__(22);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__Missions_js__ = __webpack_require__(38);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__NetscriptFunctions_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__Missions_js__ = __webpack_require__(31);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__NetscriptFunctions_js__ = __webpack_require__(30);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__NetscriptWorker_js__ = __webpack_require__(15);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__Prestige_js__ = __webpack_require__(32);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__RedPill_js__ = __webpack_require__(44);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__Prestige_js__ = __webpack_require__(34);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__RedPill_js__ = __webpack_require__(35);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__ = __webpack_require__(68);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__Script_js__ = __webpack_require__(19);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__Settings_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__SourceFile_js__ = __webpack_require__(31);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__SourceFile_js__ = __webpack_require__(33);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__SpecialServerIps_js__ = __webpack_require__(11);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__StockMarket_js__ = __webpack_require__(26);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__Terminal_js__ = __webpack_require__(20);
@@ -4406,6 +4415,7 @@ let Engine = {
             __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].gang.process(numCycles);
         }
 
+        //Mission
         if (__WEBPACK_IMPORTED_MODULE_19__Missions_js__["c" /* inMission */] && __WEBPACK_IMPORTED_MODULE_19__Missions_js__["b" /* currMission */]) {
             __WEBPACK_IMPORTED_MODULE_19__Missions_js__["b" /* currMission */].process(numCycles);
         }
@@ -4533,7 +4543,7 @@ let Engine = {
         if (Engine.Counters.messages <= 0) {
             Object(__WEBPACK_IMPORTED_MODULE_18__Message_js__["c" /* checkForMessagesToSend */])();
             if (__WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) {
-                Engine.Counters.messages = 600; //2 minutes for Red pill message
+                Engine.Counters.messages = 4500; //15 minutes for Red pill message
             } else {
                 Engine.Counters.messages = 150;
             }
@@ -16752,7 +16762,7 @@ function initBitNodeMultipliers() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__FactionInfo_js__ = __webpack_require__(47);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Location_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Missions_js__ = __webpack_require__(38);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Missions_js__ = __webpack_require__(31);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Settings_js__ = __webpack_require__(13);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(1);
@@ -17878,7 +17888,7 @@ function initSpecialServerIps() {
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return initLocationButtons; });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Company_js__ = __webpack_require__(18);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Crimes_js__ = __webpack_require__(37);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Crimes_js__ = __webpack_require__(39);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Infiltration_js__ = __webpack_require__(45);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Player_js__ = __webpack_require__(0);
@@ -20225,8 +20235,8 @@ function initCreateProgramButtons() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(23);
 /* 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__NetscriptEnvironment_js__ = __webpack_require__(28);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(33);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(36);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(13);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__ = __webpack_require__(67);
@@ -20509,7 +20519,7 @@ function isValidIPAddress(ipaddress) {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(9);
 /* 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__Prestige_js__ = __webpack_require__(32);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(34);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Faction_js__ = __webpack_require__(10);
 /* 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);
@@ -24266,25 +24276,25 @@ __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].construct
 /* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return postNetburnerText; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return post; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Terminal; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(41);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(42);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__ = __webpack_require__(42);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__ = __webpack_require__(43);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__HelpText_js__ = __webpack_require__(66);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__ = __webpack_require__(24);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Literature_js__ = __webpack_require__(43);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Literature_js__ = __webpack_require__(44);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(22);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptEvaluator_js__ = __webpack_require__(33);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptEvaluator_js__ = __webpack_require__(36);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__ = __webpack_require__(15);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__RedPill_js__ = __webpack_require__(44);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__RedPill_js__ = __webpack_require__(35);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Script_js__ = __webpack_require__(19);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__ = __webpack_require__(11);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__ = __webpack_require__(5);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_LogBox_js__ = __webpack_require__(27);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_LogBox_js__ = __webpack_require__(28);
 
 
 
@@ -26071,11 +26081,15 @@ function yesNoTxtInpBoxCreate(txt) {
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Message; });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(17);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Settings_js__ = __webpack_require__(13);
-/* 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_2__Missions_js__ = __webpack_require__(31);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__RedPill_js__ = __webpack_require__(35);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(13);
+/* 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);
+
+
 
 
 
@@ -26092,21 +26106,21 @@ function Message(filename="", msg="") {
 }
 
 Message.prototype.toJSON = function() {
-    return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Message", this);
+    return Object(__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Message", this);
 }
 
 
 Message.fromJSON = function(value) {
-    return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Message, value.data);
+    return Object(__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Message, value.data);
 }
 
-__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.Message = Message;
+__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_4__Settings_js__["a" /* Settings */].SuppressMessages) {
+    if (forced || !__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].SuppressMessages) {
         showMessage(msg);
     }
     addMessageToServer(msg, "home");
@@ -26116,12 +26130,12 @@ function showMessage(msg) {
     var txt = "Message received from unknown sender: <br><br>" +
               "<i>" + msg.msg + "</i><br><br>" +
               "This message was saved as " + msg.filename + " onto your home computer.";
-    Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);
+    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_3__Server_js__["c" /* GetServerByHostname */])(serverHostname);
+    var server = Object(__WEBPACK_IMPORTED_MODULE_5__Server_js__["c" /* GetServerByHostname */])(serverHostname);
     if (server == null) {
         console.log("WARNING: Did not locate " + serverHostname);
         return;
@@ -26151,29 +26165,32 @@ function checkForMessagesToSend() {
         redpillOwned = true;
     }
 
-    if (redpill && redpillOwned && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.length === 0) {
-        if (!__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["b" /* dialogBoxOpened */]) {
+    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 (jumper0 && !jumper0.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 25) {
-        sendMessage(jumper0);
-        __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__["a" /* Programs */].Flight);
-    } else if (jumper1 && !jumper1.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 40) {
-        sendMessage(jumper1);
-    } else if (cybersecTest && !cybersecTest.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 50) {
-        sendMessage(cybersecTest);
-    } else if (jumper2 && !jumper2.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 175) {
-        sendMessage(jumper2);
-    } else if (nitesecTest && !nitesecTest.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 200) {
-        sendMessage(nitesecTest);
-    } else if (jumper3 && !jumper3.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 350) {
-        sendMessage(jumper3);
-    } else if (jumper4 && !jumper4.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 490) {
-        sendMessage(jumper4);
-    } else if (bitrunnersTest && !bitrunnersTest.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 500) {
-        sendMessage(bitrunnersTest);
     } else if (redpill && redpillOwned) {
-        sendMessage(redpill);
+        //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);
     }
 }
 
@@ -26184,7 +26201,7 @@ function AddToAllMessages(msg) {
 let Messages = {}
 
 function loadMessages(saveString) {
-    Messages = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */]);
+    Messages = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */]);
 }
 
 let MessageFilenames = {
@@ -26278,8 +26295,11 @@ function initMessages()  {
 /* 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__(27);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(28);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js__ = __webpack_require__(27);
+/* 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);
+
 
 
 
@@ -26463,10 +26483,10 @@ function updateActiveScriptsItems() {
         total += updateActiveScriptsItemContent(__WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["h" /* workerScripts */][i]);
     }
     document.getElementById("active-scripts-total-prod").innerHTML =
-        "Total online production of Active Scripts: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(total, 2) + " / second<br>" +
-        "Total online production since last Augmentation installation: $" +
-        Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].scriptProdSinceLastAug, 2) + " ($" +
-        Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].scriptProdSinceLastAug / __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].playtimeSinceLastAug, 2) + " / second)";
+        "Total online production of Active Scripts: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(total).format('$0.000a') + " / sec<br>" +
+        "Total online production since last Aug installation: " +
+        __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].scriptProdSinceLastAug).format('$0.000a') + " (" +
+        __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].scriptProdSinceLastAug / (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].playtimeSinceLastAug/1000)).format('$0.000a') + " / sec)";
     return total;
 }
 
@@ -26536,22 +26556,22 @@ function updateActiveScriptsText(workerscript, item, statsEl=null) {
 
     //Updates statistics only
     //Online
-    var onlineTotalMoneyMade = "Total online production: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineMoneyMade, 2);
-    var onlineTotalExpEarned = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
+    var onlineTotalMoneyMade = "Total online production: $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineMoneyMade, 2);
+    var onlineTotalExpEarned = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
 
     var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
-    var onlineMpsText = "Online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineMps, 2) + "/second";
+    var onlineMpsText = "Online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineMps, 2) + "/second";
     var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
-    var onlineEpsText = (Array(25).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineEps, 4) + " hacking exp/second").replace( / /g, "&nbsp;");
+    var onlineEpsText = (Array(25).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineEps, 4) + " hacking exp/second").replace( / /g, "&nbsp;");
 
     //Offline
-    var offlineTotalMoneyMade = "Total offline production: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineMoneyMade, 2);
-    var offlineTotalExpEarned = (Array(27).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
+    var offlineTotalMoneyMade = "Total offline production: $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineMoneyMade, 2);
+    var offlineTotalExpEarned = (Array(27).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
 
     var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
-    var offlineMpsText = "Offline production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineMps, 2) + "/second";
+    var offlineMpsText = "Offline production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineMps, 2) + "/second";
     var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
-    var offlineEpsText = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineEps, 4) +  " hacking exp/second").replace( / /g, "&nbsp;");
+    var offlineEpsText = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineEps, 4) +  " hacking exp/second").replace( / /g, "&nbsp;");
 
     itemTextStats.innerHTML = onlineTotalMoneyMade + "<br>" + onlineTotalExpEarned + "<br>" +
                               onlineMpsText + "<br>" + onlineEpsText + "<br>" + offlineTotalMoneyMade + "<br>" + offlineTotalExpEarned + "<br>" +
@@ -32699,6 +32719,23 @@ function updateStockPlayerPosition(stock) {
 
 /***/ }),
 /* 27 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @preserve
+ * numeral.js
+ * version : 2.0.6
+ * author : Adam Draper
+ * license : MIT
+ * http://adamwdraper.github.com/Numeral-js/
+ */
+!function(a,b){ true?!(__WEBPACK_AMD_DEFINE_FACTORY__ = (b),
+				__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
+				(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
+				__WEBPACK_AMD_DEFINE_FACTORY__),
+				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):"object"==typeof module&&module.exports?module.exports=b():a.numeral=b()}(this,function(){function a(a,b){this._input=a,this._value=b}var b,c,d="2.0.6",e={},f={},g={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},h={currentLocale:g.currentLocale,zeroFormat:g.zeroFormat,nullFormat:g.nullFormat,defaultFormat:g.defaultFormat,scalePercentBy100:g.scalePercentBy100};return b=function(d){var f,g,i,j;if(b.isNumeral(d))f=d.value();else if(0===d||"undefined"==typeof d)f=0;else if(null===d||c.isNaN(d))f=null;else if("string"==typeof d)if(h.zeroFormat&&d===h.zeroFormat)f=0;else if(h.nullFormat&&d===h.nullFormat||!d.replace(/[^0-9]+/g,"").length)f=null;else{for(g in e)if(j="function"==typeof e[g].regexps.unformat?e[g].regexps.unformat():e[g].regexps.unformat,j&&d.match(j)){i=e[g].unformat;break}i=i||b._.stringToNumber,f=i(d)}else f=Number(d)||null;return new a(d,f)},b.version=d,b.isNumeral=function(b){return b instanceof a},b._=c={numberToFormat:function(a,c,d){var e,g,h,i,j,k,l,m=f[b.options.currentLocale],n=!1,o=!1,p=0,q="",r=1e12,s=1e9,t=1e6,u=1e3,v="",w=!1;if(a=a||0,g=Math.abs(a),b._.includes(c,"(")?(n=!0,c=c.replace(/[\(|\)]/g,"")):(b._.includes(c,"+")||b._.includes(c,"-"))&&(j=b._.includes(c,"+")?c.indexOf("+"):0>a?c.indexOf("-"):-1,c=c.replace(/[\+|\-]/g,"")),b._.includes(c,"a")&&(e=c.match(/a(k|m|b|t)?/),e=e?e[1]:!1,b._.includes(c," a")&&(q=" "),c=c.replace(new RegExp(q+"a[kmbt]?"),""),g>=r&&!e||"t"===e?(q+=m.abbreviations.trillion,a/=r):r>g&&g>=s&&!e||"b"===e?(q+=m.abbreviations.billion,a/=s):s>g&&g>=t&&!e||"m"===e?(q+=m.abbreviations.million,a/=t):(t>g&&g>=u&&!e||"k"===e)&&(q+=m.abbreviations.thousand,a/=u)),b._.includes(c,"[.]")&&(o=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],k=c.indexOf(","),p=(c.split(".")[0].split(",")[0].match(/0/g)||[]).length,i?(b._.includes(i,"[")?(i=i.replace("]",""),i=i.split("["),v=b._.toFixed(a,i[0].length+i[1].length,d,i[1].length)):v=b._.toFixed(a,i.length,d),h=v.split(".")[0],v=b._.includes(v,".")?m.delimiters.decimal+v.split(".")[1]:"",o&&0===Number(v.slice(1))&&(v="")):h=b._.toFixed(a,0,d),q&&!e&&Number(h)>=1e3&&q!==m.abbreviations.trillion)switch(h=String(Number(h)/1e3),q){case m.abbreviations.thousand:q=m.abbreviations.million;break;case m.abbreviations.million:q=m.abbreviations.billion;break;case m.abbreviations.billion:q=m.abbreviations.trillion}if(b._.includes(h,"-")&&(h=h.slice(1),w=!0),h.length<p)for(var x=p-h.length;x>0;x--)h="0"+h;return k>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+m.delimiters.thousands)),0===c.indexOf(".")&&(h=""),l=h+v+(q?q:""),n?l=(n&&w?"(":"")+l+(n&&w?")":""):j>=0?l=0===j?(w?"-":"+")+l:l+(w?"-":"+"):w&&(l="-"+l),l},stringToNumber:function(a){var b,c,d,e=f[h.currentLocale],g=a,i={thousand:3,million:6,billion:9,trillion:12};if(h.zeroFormat&&a===h.zeroFormat)c=0;else if(h.nullFormat&&a===h.nullFormat||!a.replace(/[^0-9]+/g,"").length)c=null;else{c=1,"."!==e.delimiters.decimal&&(a=a.replace(/\./g,"").replace(e.delimiters.decimal,"."));for(b in i)if(d=new RegExp("[^a-zA-Z]"+e.abbreviations[b]+"(?:\\)|(\\"+e.currency.symbol+")?(?:\\))?)?$"),g.match(d)){c*=Math.pow(10,i[b]);break}c*=(a.split("-").length+Math.min(a.split("(").length-1,a.split(")").length-1))%2?1:-1,a=a.replace(/[^0-9\.]+/g,""),c*=Number(a)}return c},isNaN:function(a){return"number"==typeof a&&isNaN(a)},includes:function(a,b){return-1!==a.indexOf(b)},insert:function(a,b,c){return a.slice(0,c)+b+a.slice(c)},reduce:function(a,b){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof b)throw new TypeError(b+" is not a function");var c,d=Object(a),e=d.length>>>0,f=0;if(3===arguments.length)c=arguments[2];else{for(;e>f&&!(f in d);)f++;if(f>=e)throw new TypeError("Reduce of empty array with no initial value");c=d[f++]}for(;e>f;f++)f in d&&(c=b(c,d[f],f,d));return c},multiplier:function(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)},correctionFactor:function(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var d=c.multiplier(b);return a>d?a:d},1)},toFixed:function(a,b,c,d){var e,f,g,h,i=a.toString().split("."),j=b-(d||0);return e=2===i.length?Math.min(Math.max(i[1].length,j),b):j,g=Math.pow(10,e),h=(c(a+"e+"+e)/g).toFixed(e),d>b-e&&(f=new RegExp("\\.?0{1,"+(d-(b-e))+"}$"),h=h.replace(f,"")),h}},b.options=h,b.formats=e,b.locales=f,b.locale=function(a){return a&&(h.currentLocale=a.toLowerCase()),h.currentLocale},b.localeData=function(a){if(!a)return f[h.currentLocale];if(a=a.toLowerCase(),!f[a])throw new Error("Unknown locale : "+a);return f[a]},b.reset=function(){for(var a in g)h[a]=g[a]},b.zeroFormat=function(a){h.zeroFormat="string"==typeof a?a:null},b.nullFormat=function(a){h.nullFormat="string"==typeof a?a:null},b.defaultFormat=function(a){h.defaultFormat="string"==typeof a?a:"0.0"},b.register=function(a,b,c){if(b=b.toLowerCase(),this[a+"s"][b])throw new TypeError(b+" "+a+" already registered.");return this[a+"s"][b]=c,c},b.validate=function(a,c){var d,e,f,g,h,i,j,k;if("string"!=typeof a&&(a+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a.match(/^\d+$/))return!0;if(""===a)return!1;try{j=b.localeData(c)}catch(l){j=b.localeData(b.locale())}return f=j.currency.symbol,h=j.abbreviations,d=j.delimiters.decimal,e="."===j.delimiters.thousands?"\\.":j.delimiters.thousands,k=a.match(/^[^\d]+/),null!==k&&(a=a.substr(1),k[0]!==f)?!1:(k=a.match(/[^\d]+$/),null!==k&&(a=a.slice(0,-1),k[0]!==h.thousand&&k[0]!==h.million&&k[0]!==h.billion&&k[0]!==h.trillion)?!1:(i=new RegExp(e+"{2}"),a.match(/[^\d.,]/g)?!1:(g=a.split(d),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i):1===g[0].length?!!g[0].match(/^\d+$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/))))},b.fn=a.prototype={clone:function(){return b(this)},format:function(a,c){var d,f,g,i=this._value,j=a||h.defaultFormat;if(c=c||Math.round,0===i&&null!==h.zeroFormat)f=h.zeroFormat;else if(null===i&&null!==h.nullFormat)f=h.nullFormat;else{for(d in e)if(j.match(e[d].regexps.format)){g=e[d].format;break}g=g||b._.numberToFormat,f=g(i,j,c)}return f},value:function(){return this._value},input:function(){return this._input},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b,c,e){return a+Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([this._value,a],b,0)/d,this},subtract:function(a){function b(a,b,c,e){return a-Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([a],b,Math.round(this._value*d))/d,this},multiply:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)*Math.round(b*f)/Math.round(f*f)}return this._value=c.reduce([this._value,a],b,1),this},divide:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)/Math.round(b*f)}return this._value=c.reduce([this._value,a],b),this},difference:function(a){return Math.abs(b(this._value).subtract(a).value())}},b.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),function(){b.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(a,c,d){var e,f=b._.includes(c," BPS")?" ":"";return a=1e4*a,c=c.replace(/\s?BPS/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"BPS"),e=e.join("")):e=e+f+"BPS",e},unformat:function(a){return+(1e-4*b._.stringToNumber(a)).toFixed(15)}})}(),function(){var a={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},c={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},d=a.suffixes.concat(c.suffixes.filter(function(b){return a.suffixes.indexOf(b)<0})),e=d.join("|");e="("+e.replace("B","B(?!PS)")+")",b.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(e)},format:function(d,e,f){var g,h,i,j,k=b._.includes(e,"ib")?c:a,l=b._.includes(e," b")||b._.includes(e," ib")?" ":"";for(e=e.replace(/\s?i?b/,""),h=0;h<=k.suffixes.length;h++)if(i=Math.pow(k.base,h),j=Math.pow(k.base,h+1),null===d||0===d||d>=i&&j>d){l+=k.suffixes[h],i>0&&(d/=i);break}return g=b._.numberToFormat(d,e,f),g+l},unformat:function(d){var e,f,g=b._.stringToNumber(d);if(g){for(e=a.suffixes.length-1;e>=0;e--){if(b._.includes(d,a.suffixes[e])){f=Math.pow(a.base,e);break}if(b._.includes(d,c.suffixes[e])){f=Math.pow(c.base,e);break}}g*=f||1}return g}})}(),function(){b.register("format","currency",{regexps:{format:/(\$)/},format:function(a,c,d){var e,f,g,h=b.locales[b.options.currentLocale],i={before:c.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:c.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(c=c.replace(/\s?\$\s?/,""),e=b._.numberToFormat(a,c,d),a>=0?(i.before=i.before.replace(/[\-\(]/,""),i.after=i.after.replace(/[\-\)]/,"")):0>a&&!b._.includes(i.before,"-")&&!b._.includes(i.before,"(")&&(i.before="-"+i.before),g=0;g<i.before.length;g++)switch(f=i.before[g]){case"$":e=b._.insert(e,h.currency.symbol,g);break;case" ":e=b._.insert(e," ",g+h.currency.symbol.length-1)}for(g=i.after.length-1;g>=0;g--)switch(f=i.after[g]){case"$":e=g===i.after.length-1?e+h.currency.symbol:b._.insert(e,h.currency.symbol,-(i.after.length-(1+g)));break;case" ":e=g===i.after.length-1?e+" ":b._.insert(e," ",-(i.after.length-(1+g)+h.currency.symbol.length-1))}return e}})}(),function(){b.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(a,c,d){var e,f="number"!=typeof a||b._.isNaN(a)?"0e+0":a.toExponential(),g=f.split("e");return c=c.replace(/e[\+|\-]{1}0/,""),e=b._.numberToFormat(Number(g[0]),c,d),e+"e"+g[1]},unformat:function(a){function c(a,c,d,e){var f=b._.correctionFactor(a,c),g=a*f*(c*f)/(f*f);return g}var d=b._.includes(a,"e+")?a.split("e+"):a.split("e-"),e=Number(d[0]),f=Number(d[1]);return f=b._.includes(a,"e-")?f*=-1:f,b._.reduce([e,Math.pow(10,f)],c,1)}})}(),function(){b.register("format","ordinal",{regexps:{format:/(o)/},format:function(a,c,d){var e,f=b.locales[b.options.currentLocale],g=b._.includes(c," o")?" ":"";return c=c.replace(/\s?o/,""),g+=f.ordinal(a),e=b._.numberToFormat(a,c,d),e+g}})}(),function(){b.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(a,c,d){var e,f=b._.includes(c," %")?" ":"";return b.options.scalePercentBy100&&(a=100*a),c=c.replace(/\s?\%/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"%"),e=e.join("")):e=e+f+"%",e},unformat:function(a){var c=b._.stringToNumber(a);return b.options.scalePercentBy100?.01*c:c}})}(),function(){b.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(a,b,c){var d=Math.floor(a/60/60),e=Math.floor((a-60*d*60)/60),f=Math.round(a-60*d*60-60*e);return d+":"+(10>e?"0"+e:e)+":"+(10>f?"0"+f:f)},unformat:function(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}})}(),b});
+
+/***/ }),
+/* 28 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -32769,12 +32806,12 @@ function logBoxUpdateText() {
 /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
-/* 28 */
+/* 29 */
 /***/ (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__NetscriptFunctions_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__NetscriptFunctions_js__ = __webpack_require__(30);
 
 /* Environment
  * 	NetScript program environment
@@ -32874,7 +32911,7 @@ Environment.prototype = {
 
 
 /***/ }),
-/* 29 */
+/* 30 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -32887,10 +32924,10 @@ Environment.prototype = {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(18);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Constants_js__ = __webpack_require__(3);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__ = __webpack_require__(42);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__ = __webpack_require__(43);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__engine_js__ = __webpack_require__(4);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__HacknetNode_js__ = __webpack_require__(34);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__HacknetNode_js__ = __webpack_require__(37);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Location_js__ = __webpack_require__(12);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Message_js__ = __webpack_require__(22);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Player_js__ = __webpack_require__(0);
@@ -32901,8 +32938,8 @@ Environment.prototype = {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__StockMarket_js__ = __webpack_require__(26);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__Terminal_js__ = __webpack_require__(20);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__NetscriptWorker_js__ = __webpack_require__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__ = __webpack_require__(33);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__NetscriptEnvironment_js__ = __webpack_require__(28);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__ = __webpack_require__(36);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__NetscriptEnvironment_js__ = __webpack_require__(29);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__utils_decimal_js__ = __webpack_require__(25);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_22__utils_decimal_js__);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__utils_DialogBox_js__ = __webpack_require__(1);
@@ -33365,6 +33402,16 @@ function NetscriptFunctions(workerScript) {
             if (arguments.length !== 2 && arguments.length !== 3) {
                 throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
             }
+            if (scriptname && scriptname.constructor === Array) {
+                //Recursively call scp on all elements of array
+                var res = false;
+                scriptname.forEach(function(script) {
+                    if (NetscriptFunctions(workerScript).scp(script, ip1, ip2)) {
+                        res = true;
+                    };
+                });
+                return res;
+            }
             if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) {
                 throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() only works for .script and .lit files");
             }
@@ -34020,7 +34067,10 @@ function NetscriptFunctions(workerScript) {
         getScriptIncome : function(scriptname, ip) {
             if (arguments.length === 0) {
                 //Get total script income
-                return Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["d" /* updateActiveScriptsItems */])();
+                var res = [];
+                res.push(Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["d" /* updateActiveScriptsItems */])());
+                res.push(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].scriptProdSinceLastAug / (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].playtimeSinceLastAug/1000));
+                return res;
             } else {
                 //Get income for a particular script
                 var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip);
@@ -34066,6 +34116,9 @@ function NetscriptFunctions(workerScript) {
                 return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime;
             }
         },
+        getTimeSinceLastAug : function() {
+            return __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].playtimeSinceLastAug;
+        },
 
         /* Singularity Functions */
         universityCourse(universityName, className) {
@@ -34877,7 +34930,1261 @@ function NetscriptFunctions(workerScript) {
 
 
 /***/ }),
-/* 30 */
+/* 31 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HackingMission; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return inMission; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return setInMission; });
+/* 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__(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__(48);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_jsplumb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_jsplumb__);
+
+
+
+
+
+
+
+
+
+let inMission = false; //Flag to denote whether a mission is running
+let currMission = null;
+function setInMission(bool, mission) {
+    inMission = bool;
+    if (bool) {
+        currMission = mission;
+    } else {
+        currMission = null;
+    }
+}
+
+//Keyboard shortcuts
+$(document).keydown(function(e) {
+    if (inMission && currMission && currMission.selectedNode != null) {
+        switch (e.keyCode) {
+            case 65: //a for Attack
+                currMission.actionButtons[0].click();
+                break;
+            case 83: //s for Scan
+                currMission.actionButtons[1].click();
+                break;
+            case 87: //w for Weaken
+                currMission.actionButtons[2].click();
+                break;
+            case 70: //f for Fortify
+                currMission.actionButtons[3].click();
+                break;
+            case 82: //r for Overflow
+                currMission.actionButtons[4].click();
+                break;
+            case 68: //d for Detach connection
+                currMission.actionButtons[5].click();
+                break;
+            default:
+                break;
+        }
+    }
+});
+
+let NodeTypes = {
+    Core: "CPU Core Node",      //All actions available
+    Firewall: "Firewall Node",  //No actions available
+    Database: "Database Node",  //No actions available
+    Spam: "Spam Node",          //No actions Available
+    Transfer: "Transfer Node",  //Can Weaken, Scan, Fortify and Overflow
+    Shield: "Shield Node"       //Can Fortify
+}
+
+let NodeActions = {
+    Attack: "Attacking", //Damaged based on attack stat + hacking level + opp def
+    Scan: "Scanning", //-Def for target, affected by attack and hacking level
+    Weaken: "Weakening", //-Attack for target, affected by attack and hacking level
+    Fortify: "Fortifying", //+Defense for Node, affected by hacking level
+    Overflow: "Overflowing", //+Attack but -Defense for Node, affected by hacking level
+}
+
+function Node(type, stats) {
+    this.type = type;
+    this.atk = stats.atk ? stats.atk : 0;
+    this.def = stats.def ? stats.def : 0;
+    this.hp = stats.hp ? stats.hp : 0;
+    this.maxhp = this.hp;
+    this.plyrCtrl = false;
+    this.enmyCtrl = false;
+    this.pos = [0, 0]; //x, y
+    this.el = null; //Holds the Node's DOM element
+    this.action = null;
+
+    //Holds the JsPlumb Connection object for this Node,
+    //where this Node is the Source (since each Node
+    //can only have 1 outgoing Connection)
+    this.conn = null;
+}
+
+Node.prototype.setPosition = function(x, y) {
+    this.pos = [x, y];
+}
+
+Node.prototype.setControlledByPlayer = function() {
+    this.plyrCtrl = true;
+    this.enmyCtrl = false;
+    if (this.el) {
+        this.el.classList.remove("hack-mission-enemy-node");
+        this.el.classList.add("hack-mission-player-node");
+    }
+}
+
+Node.prototype.setControlledByEnemy = function() {
+    this.plyrCtrl = false;
+    this.enmyCtrl = true;
+    if (this.el) {
+        this.el.classList.remove("hack-mission-player-node");
+        this.el.classList.add("hack-mission-enemy-node");
+    }
+}
+
+//Sets this node to be the active node
+Node.prototype.select = function(actionButtons) {
+    if (this.enmyCtrl) {return;}
+    this.el.classList.add("hack-mission-player-node-active");
+
+    //Make all buttons inactive
+    for (var i = 0; i < actionButtons.length; ++i) {
+        actionButtons[i].classList.remove("a-link-button");
+        actionButtons[i].classList.add("a-link-button-inactive");
+    }
+
+    switch(this.type) {
+        case NodeTypes.Core:
+            //All buttons active
+            for (var i = 0; i < actionButtons.length; ++i) {
+                actionButtons[i].classList.remove("a-link-button-inactive");
+                actionButtons[i].classList.add("a-link-button");
+            }
+            break;
+        case NodeTypes.Transfer:
+            actionButtons[1].classList.remove("a-link-button-inactive");
+            actionButtons[1].classList.add("a-link-button");
+            actionButtons[2].classList.remove("a-link-button-inactive");
+            actionButtons[2].classList.add("a-link-button");
+            actionButtons[3].classList.remove("a-link-button-inactive");
+            actionButtons[3].classList.add("a-link-button");
+            actionButtons[4].classList.remove("a-link-button-inactive");
+            actionButtons[4].classList.add("a-link-button");
+            actionButtons[5].classList.remove("a-link-button-inactive");
+            actionButtons[5].classList.add("a-link-button");
+            break;
+        default:
+            break;
+    }
+}
+
+Node.prototype.deselect = function(actionButtons) {
+    this.el.classList.remove("hack-mission-player-node-active");
+    for (var i = 0; i < actionButtons.length; ++i) {
+        actionButtons[i].classList.remove("a-link-button");
+        actionButtons[i].classList.add("a-link-button-inactive");
+    }
+}
+
+//Hacking mission instance
+//Takes in the reputation of the Faction for which the mission is
+//being conducted
+function HackingMission(rep, fac) {
+    this.faction = fac;
+
+    this.started = false;
+    this.time = 180000; //2 minutes, milliseconds
+
+    this.playerCores = [];
+    this.playerNodes = []; //Non-core nodes
+    this.playerAtk = 0;
+    this.playerDef = 0;
+
+    this.enemyCores = [];
+    this.enemyDatabases = [];
+    this.enemyNodes = []; //Non-core nodes
+    this.enemyAtk = 0;
+    this.enemyDef = 0;
+
+    this.miscNodes = [];
+
+    this.selectedNode = null; //Which of the player's nodes is currently selected
+
+    this.actionButtons = []; //DOM buttons for actions
+
+    this.availablePositions = [];
+    for (var r = 0; r < 8; ++r) {
+        for (var c = 0; c < 8; ++c) {
+            this.availablePositions.push([r, c]);
+        }
+    }
+
+    this.map = [];
+    for (var i = 0; i < 8; ++i) {
+        this.map.push([null, null, null, null, null, null, null, null]);
+    }
+
+    this.jsplumbinstance = null;
+
+    //difficulty capped at 16
+    this.difficulty = Math.min(16, Math.round(rep / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToDiffConversion) + 1);
+    console.log("difficulty: " + this.difficulty);
+    this.reward = 250 + (rep / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToRewardConversion);
+}
+
+HackingMission.prototype.init = function() {
+    //Create Header DOM
+    this.createPageDom();
+
+    //Create player starting nodes
+    var home = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].getHomeComputer()
+    for (var i = 0; i < home.cpuCores; ++i) {
+        var stats = {
+            atk: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 10),
+            def: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 25),
+            hp: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 5),
+        };
+        this.playerCores.push(new Node(NodeTypes.Core, stats));
+        this.playerCores[i].setControlledByPlayer();
+        this.setNodePosition(this.playerCores[i], 0, i);
+        this.removeAvailablePosition(0, i);
+    }
+
+    //Randomly generate enemy nodes (CPU and Firewall) based on difficulty
+    var numNodes = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 1);
+    var numFirewalls = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 1);
+    var numDatabases = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 1);
+    var totalNodes = numNodes + numFirewalls + numDatabases;
+    var xlimit = 7 - Math.floor(totalNodes / 8);
+    console.log("numNodes: " + numNodes);
+    console.log("numFirewalls: " + numFirewalls);
+    console.log("numDatabases: " + numDatabases);
+    console.log("totalNodes: " + totalNodes);
+    var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
+    for (var i = 0; i < numNodes; ++i) {
+        var stats = {
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(125, 175),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(30, 50),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(225, 275)
+        }
+        this.enemyCores.push(new Node(NodeTypes.Core, stats));
+        this.enemyCores[i].setControlledByEnemy();
+        this.setNodeRandomPosition(this.enemyCores[i], xlimit);
+    }
+    for (var i = 0; i < numFirewalls; ++i) {
+        var stats = {
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(10, 25),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 75),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(175, 200)
+        }
+        this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));
+        this.enemyNodes[i].setControlledByEnemy();
+        this.setNodeRandomPosition(this.enemyNodes[i], xlimit);
+    }
+    for (var i = 0; i < numDatabases; ++i) {
+        var stats = {
+            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(20, 30),
+            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 40),
+            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(120, 150)
+        }
+        var node = new Node(NodeTypes.Database, stats);
+        node.setControlledByEnemy();
+        this.setNodeRandomPosition(node, xlimit);
+        this.enemyDatabases.push(node);
+    }
+    this.calculateDefenses();
+    this.calculateAttacks();
+    this.createMap();
+}
+
+HackingMission.prototype.createPageDom = function() {
+    var container = document.getElementById("mission-container");
+
+    var headerText = document.createElement("p");
+    headerText.innerHTML = "You are about to start a hacking mission! For more information " +
+                    "about how hacking missions work, click one of the guide links " +
+                    "below (one opens up an in-game guide and the other opens up " +
+                    "the guide from the wiki). Click the 'Start' button to begin.";
+    headerText.style.display = "block";
+    headerText.classList.add("hack-mission-header-element");
+    headerText.style.width = "80%";
+
+    var inGameGuideBtn = document.createElement("a");
+    inGameGuideBtn.innerText = "How to Play";
+    inGameGuideBtn.classList.add("a-link-button");
+    inGameGuideBtn.style.display = "inline-block";
+    inGameGuideBtn.classList.add("hack-mission-header-element");
+    inGameGuideBtn.addEventListener("click", function() {
+        Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])(__WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionHowToPlay);
+        return false;
+    });
+
+    var wikiGuideBtn = document.createElement("a");
+    wikiGuideBtn.innerText = "Wiki Guide";
+    wikiGuideBtn.classList.add("a-link-button");
+    wikiGuideBtn.style.display = "inline-block";
+    wikiGuideBtn.classList.add("hack-mission-header-element");
+    wikiGuideBtn.target = "_blank";
+    //TODO Add link to wiki page     wikiGuideBtn.href =
+
+
+    //Start button will get replaced with forfeit when game is started
+    var startBtn = document.createElement("a");
+    startBtn.innerHTML = "Start";
+    startBtn.setAttribute("id", "hack-mission-start-btn");
+    startBtn.classList.add("a-link-button");
+    startBtn.classList.add("hack-mission-header-element");
+    startBtn.style.display = "inline-block";
+    startBtn.addEventListener("click", ()=>{
+        this.start();
+        return false;
+    });
+
+    var forfeitMission = document.createElement("a");
+    forfeitMission.innerHTML = "Forfeit Mission (Exit)";
+    forfeitMission.classList.add("a-link-button");
+    forfeitMission.classList.add("hack-mission-header-element");
+    forfeitMission.style.display = "inline-block";
+    forfeitMission.addEventListener("click", ()=> {
+        this.finishMission(false);
+        return false;
+    });
+
+    var timer = document.createElement("p");
+    timer.setAttribute("id", "hacking-mission-timer");
+    timer.style.display = "inline-block";
+    timer.style.margin = "6px";
+
+    //Create Action Buttons (Attack/Scan/Weaken/ etc...)
+    var actionsContainer = document.createElement("span");
+    actionsContainer.style.display = "block";
+    actionsContainer.classList.add("hack-mission-action-buttons-container");
+    for (var i = 0; i < 6; ++i) {
+        this.actionButtons.push(document.createElement("a"));
+        this.actionButtons[i].style.display = "inline-block";
+        this.actionButtons[i].classList.add("a-link-button-inactive"); //Disabled at start
+        this.actionButtons[i].classList.add("tooltip"); //Disabled at start
+        this.actionButtons[i].classList.add("hack-mission-header-element");
+        actionsContainer.appendChild(this.actionButtons[i]);
+    }
+    this.actionButtons[0].innerText = "Attack(a)";
+    var atkTooltip = document.createElement("span");
+    atkTooltip.classList.add("tooltiptext");
+    atkTooltip.innerText = "Lowers the targeted node's HP. The effectiveness of this depends on " +
+                           "this node's Attack level, your hacking level, and the opponent's defense level.";
+    this.actionButtons[0].appendChild(atkTooltip);
+    this.actionButtons[1].innerText = "Scan(s)";
+    var scanTooltip = document.createElement("span");
+    scanTooltip.classList.add("tooltiptext");
+    scanTooltip.innerText = "Lowers the targeted node's defense. The effectiveness of this depends on " +
+                            "this node's Attack level, your hacking level, and the opponent's defense level.";
+    this.actionButtons[1].appendChild(scanTooltip);
+    this.actionButtons[2].innerText = "Weaken(w)";
+    var WeakenTooltip = document.createElement("span");
+    WeakenTooltip.classList.add("tooltiptext");
+    WeakenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
+                              "this node's Attack level, your hacking level, and the opponent's defense level.";
+    this.actionButtons[2].appendChild(WeakenTooltip);
+    this.actionButtons[3].innerText = "Fortify(f)";
+    var fortifyTooltip = document.createElement("span");
+    fortifyTooltip.classList.add("tooltiptext");
+    fortifyTooltip.innerText = "Raises this node's Defense level. The effectiveness of this depends on " +
+                               "your hacking level";
+    this.actionButtons[3].appendChild(fortifyTooltip);
+    this.actionButtons[4].innerText = "Overflow(r)";
+    var overflowTooltip = document.createElement("span");
+    overflowTooltip.classList.add("tooltiptext");
+    overflowTooltip.innerText = "Raises this node's Attack level but lowers its Defense level. The effectiveness " +
+                                "of this depends on your hacking level.";
+    this.actionButtons[4].appendChild(overflowTooltip);
+    this.actionButtons[5].innerText = "Drop Connection(d)";
+    var dropconnTooltip = document.createElement("span");
+    dropconnTooltip.classList.add("tooltiptext");
+    dropconnTooltip.innerText = "Removes this Node's current connection to some target Node, if it has one. This can " +
+                                "also be done by simply clicking the white connection line.";
+    this.actionButtons[5].appendChild(dropconnTooltip);
+
+    //Player/enemy defense displays will be in action container
+    var playerStats = document.createElement("p");
+    var enemyStats = document.createElement("p");
+    playerStats.style.display = "inline-block";
+    enemyStats.style.display = "inline-block";
+    playerStats.style.color = "#00ccff";
+    enemyStats.style.color = "red";
+    playerStats.style.margin = "4px";
+    enemyStats.style.margin = "4px";
+    playerStats.setAttribute("id", "hacking-mission-player-stats");
+    enemyStats.setAttribute("id", "hacking-mission-enemy-stats");
+    actionsContainer.appendChild(playerStats);
+    actionsContainer.appendChild(enemyStats);
+
+    //Set Action Button event listeners
+    this.actionButtons[0].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Attack, false); //Set attack button inactive
+        this.selectedNode.action = NodeActions.Attack;
+    });
+
+    this.actionButtons[1].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Scan, false); //Set scan button inactive
+        this.selectedNode.action = NodeActions.Scan;
+    });
+
+    this.actionButtons[2].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Weaken, false); //Set Weaken button inactive
+        this.selectedNode.action = NodeActions.Weaken;
+    });
+
+    this.actionButtons[3].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Fortify, false); //Set Fortify button inactive
+        this.selectedNode.action = NodeActions.Fortify;
+    });
+
+    this.actionButtons[4].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        this.setActionButtonsActive();
+        this.setActionButton(NodeActions.Overflow, false); //Set Overflow button inactive
+        this.selectedNode.action = NodeActions.Overflow;
+    });
+
+    this.actionButtons[5].addEventListener("click", ()=>{
+        if (!(this.selectedNode instanceof Node)) {
+            console.log("ERR: Pressing Action button without selected node");
+            return;
+        }
+        if (this.selectedNode.conn) {
+            var endpoints = this.selectedNode.conn.endpoints;
+            endpoints[0].detachFrom(endpoints[1]);
+        }
+    })
+
+    var timeDisplay = document.createElement("p");
+
+    container.appendChild(headerText);
+    container.appendChild(inGameGuideBtn);
+    container.appendChild(wikiGuideBtn);
+    container.appendChild(startBtn);
+    container.appendChild(forfeitMission);
+    container.appendChild(timer);
+    container.appendChild(actionsContainer);
+    container.appendChild(timeDisplay);
+}
+
+HackingMission.prototype.setActionButtonsInactive = function() {
+    for (var i = 0; i < this.actionButtons.length; ++i) {
+        this.actionButtons[i].classList.remove("a-link-button");
+        this.actionButtons[i].classList.add("a-link-button-inactive");
+    }
+}
+
+HackingMission.prototype.setActionButtonsActive = function() {
+    for (var i = 0; i < this.actionButtons.length; ++i) {
+        this.actionButtons[i].classList.add("a-link-button");
+        this.actionButtons[i].classList.remove("a-link-button-inactive");
+    }
+}
+
+//True for active, false for inactive
+HackingMission.prototype.setActionButton = function(i, active=true) {
+    if (Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["f" /* isString */])(i)) {
+        switch (i) {
+            case NodeActions.Attack:
+                i = 0;
+                break;
+            case NodeActions.Scan:
+                i = 1;
+                break;
+            case NodeActions.Weaken:
+                i = 2;
+                break;
+            case NodeActions.Fortify:
+                i = 3;
+                break;
+            case NodeActions.Overflow:
+            default:
+                i = 4;
+                break;
+        }
+    }
+    if (active) {
+        this.actionButtons[i].classList.remove("a-link-button-inactive");
+        this.actionButtons[i].classList.add("a-link-button");
+    } else {
+        this.actionButtons[i].classList.remove("a-link-button");
+        this.actionButtons[i].classList.add("a-link-button-inactive");
+    }
+
+}
+
+HackingMission.prototype.calculateAttacks = function() {
+    var total = 0;
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        total += this.playerCores[i].atk;
+    }
+    for (var i = 0; i < this.playerNodes.length; ++i) {
+        total += this.playerNodes[i].atk;
+    }
+    this.playerAtk = total;
+    document.getElementById("hacking-mission-player-stats").innerHTML =
+        "Player Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerAtk, 1) + "<br>" +
+        "Player Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerDef, 1);
+    total = 0;
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        total += this.enemyCores[i].atk;
+    }
+    for (var i = 0; i < this.enemyDatabases.length; ++i) {
+        total += this.enemyDatabases[i].atk;
+    }
+    for (var i = 0; i < this.enemyNodes.length; ++i) {
+        total += this.enemyNodes[i].atk;
+    }
+    this.enemyAtk = total;
+    document.getElementById("hacking-mission-enemy-stats").innerHTML =
+        "Enemy Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyAtk, 1) + "<br>" +
+        "Enemy Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyDef, 1);
+}
+
+HackingMission.prototype.calculateDefenses = function() {
+    var total = 0;
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        total += this.playerCores[i].def;
+    }
+    for (var i = 0; i < this.playerNodes.length; ++i) {
+        total += this.playerNodes[i].def;
+    }
+    this.playerDef = total;
+    document.getElementById("hacking-mission-player-stats").innerHTML =
+        "Player Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerAtk, 1) + "<br>" +
+        "Player Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerDef, 1);
+    total = 0;
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        total += this.enemyCores[i].def;
+    }
+    for (var i = 0; i < this.enemyDatabases.length; ++i) {
+        total += this.enemyDatabases[i].def;
+    }
+    for (var i = 0; i < this.enemyNodes.length; ++i) {
+        total += this.enemyNodes[i].def;
+    }
+    this.enemyDef = total;
+    document.getElementById("hacking-mission-enemy-stats").innerHTML =
+        "Enemy Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyAtk, 1) + "<br>" +
+        "Enemy Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyDef, 1);
+}
+
+HackingMission.prototype.removeAvailablePosition = function(x, y) {
+    for (var i = 0; i < this.availablePositions.length; ++i) {
+        if (this.availablePositions[i][0] === x &&
+            this.availablePositions[i][1] === y) {
+            this.availablePositions.splice(i, 1);
+            return;
+        }
+    }
+    console.log("WARNING: removeAvailablePosition() did not remove " + x + ", " + y);
+}
+
+HackingMission.prototype.setNodePosition = function(nodeObj, x, y) {
+    if (!(nodeObj instanceof Node)) {
+        console.log("WARNING: Non-Node object passed into setNodePOsition");
+        return;
+    }
+    if (isNaN(x) || isNaN(y)) {
+        console.log("ERR: Invalid values passed as x and y for setNodePosition");
+        console.log(x);
+        console.log(y);
+        return;
+    }
+    nodeObj.pos = [x, y];
+    this.map[x][y] = nodeObj;
+}
+
+HackingMission.prototype.setNodeRandomPosition = function(nodeObj, xlimit=0) {
+    var i = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.availablePositions.length - 1);
+    var pos = this.availablePositions.splice(i, 1);
+    pos = pos[0];
+    this.setNodePosition(nodeObj, pos[0], pos[1]);
+}
+
+HackingMission.prototype.createMap = function() {
+    //Use a grid
+    var map = document.createElement("div");
+    map.classList.add("hack-mission-grid");
+    map.setAttribute("id", "hacking-mission-map");
+    document.getElementById("mission-container").appendChild(map);
+
+    //Create random Nodes for every space in the map that
+    //hasn't been filled yet
+    for (var x = 0; x < 8; ++x) {
+        for (var y = 0; y < 8; ++y) {
+            if (!(this.map[x][y] instanceof Node)) {
+                var node, type = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, 2);
+                var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
+                switch (type) {
+                    case 0: //Spam
+                        var stats = {
+                            atk: 0,
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(35, 55),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(125, 150)
+                        }
+                        node = new Node(NodeTypes.Spam, stats);
+                        break;
+                    case 1: //Transfer
+                        var stats = {
+                            atk: 0,
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(45, 65),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(150, 175)
+                        }
+                        node = new Node(NodeTypes.Transfer, stats);
+                        break;
+                    case 2: //Shield
+                    default:
+                        var stats = {
+                            atk: 0,
+                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 80),
+                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(200, 250)
+                        }
+                        node = new Node(NodeTypes.Shield, stats);
+                        break;
+                }
+                this.setNodePosition(node, x, y);
+                this.removeAvailablePosition(x, y);
+                this.miscNodes.push(node);
+            }
+        }
+    }
+
+    //Create DOM elements in order
+    for (var r = 0; r < 8; ++r) {
+        for (var c = 0; c < 8; ++c) {
+            this.createNodeDomElement(this.map[r][c]);
+        }
+    }
+
+    //Configure all Player CPUS
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        console.log("Configuring Player Node: " + this.playerCores[i].el.id);
+        this.configurePlayerNodeElement(this.playerCores[i].el);
+    }
+}
+
+HackingMission.prototype.createNodeDomElement = function(nodeObj) {
+    var nodeDiv = document.createElement("a");
+    nodeObj.el = nodeDiv;
+    document.getElementById("hacking-mission-map").appendChild(nodeDiv);
+
+    //Set the node element's id based on its coordinates
+    nodeDiv.setAttribute("id", "hacking-mission-node-" +
+                                nodeObj.pos[0] + "-" +
+                                nodeObj.pos[1]);
+
+    //Set node classes for owner
+    nodeDiv.classList.add("hack-mission-node");
+    if (nodeObj.plyrCtrl) {
+        nodeDiv.classList.add("hack-mission-player-node");
+    } else if (nodeObj.enmyCtrl) {
+        nodeDiv.classList.add("hack-mission-enemy-node");
+    }
+
+    //Set node classes based on type
+    var txt;
+    switch (nodeObj.type) {
+        case NodeTypes.Core:
+            txt = "<p>CPU Core<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-cpu-node");
+            break;
+        case NodeTypes.Firewall:
+            txt = "<p>Firewall<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-firewall-node");
+            break;
+        case NodeTypes.Database:
+            txt = "<p>Database<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-database-node");
+            break;
+        case NodeTypes.Spam:
+            txt = "<p>Spam<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-spam-node");
+            break;
+        case NodeTypes.Transfer:
+            txt = "<p>Transfer<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-transfer-node");
+            break;
+        case NodeTypes.Shield:
+        default:
+            txt = "<p>Shield<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            nodeDiv.classList.add("hack-mission-shield-node");
+            break;
+    }
+
+    txt += "<br>Atk: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
+           "<br>Def: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1) + "</p>";
+    nodeDiv.innerHTML = txt;
+}
+
+HackingMission.prototype.updateNodeDomElement = function(nodeObj) {
+    if (nodeObj.el === null) {
+        console.log("ERR: Calling updateNodeDomElement on a Node without an element");
+        return;
+    }
+
+    var nodeDiv = document.getElementById("hacking-mission-node-" +
+                                          nodeObj.pos[0] + "-" +
+                                          nodeObj.pos[1]);
+
+    //Set node classes based on type
+    var txt;
+    switch (nodeObj.type) {
+        case NodeTypes.Core:
+            txt = "<p>CPU Core<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Firewall:
+            txt = "<p>Firewall<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Database:
+            txt = "<p>Database<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Spam:
+            txt = "<p>Spam<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Transfer:
+            txt = "<p>Transfer<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+        case NodeTypes.Shield:
+        default:
+            txt = "<p>Shield<br>" + "HP: " +
+                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+            break;
+    }
+
+    txt += "<br>Atk: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
+           "<br>Def: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1);
+    if (nodeObj.action) {
+        txt += "<br>" + nodeObj.action;
+    }
+    txt += "</p>";
+    nodeDiv.innerHTML = txt;
+}
+
+//Gets a Node DOM element's corresponding Node object using its
+//element id
+HackingMission.prototype.getNodeFromElement = function(el) {
+    var id = el.id;
+    id = id.replace("hacking-mission-node-", "");
+    var res = id.split('-');
+    if (res.length != 2) {
+        console.log("ERROR Parsing Hacking Mission Node Id. Could not find coordinates");
+        return null;
+    }
+    var x = res[0], y = res[1];
+    if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) {
+        console.log("ERROR: Unexpected values for x and y: " + x + ", " + y);
+        return null;
+    }
+    return this.map[x][y];
+}
+
+//Configures a DOM element representing a player-owned node to
+//be selectable and actionable
+//Note: Does NOT change its css class. This is handled by Node.setControlledBy...
+HackingMission.prototype.configurePlayerNodeElement = function(el) {
+    var nodeObj = this.getNodeFromElement(el);
+    if (nodeObj === null) {console.log("Error getting Node object");}
+
+    //Add event listener
+    el.addEventListener("click", ()=>{
+        if (this.selectedNode instanceof Node) {
+            this.selectedNode.deselect(this.actionButtons);
+            this.selectedNode = null;
+        }
+        console.log("Selecting node :" + el.id);
+        nodeObj.select(this.actionButtons);
+        this.selectedNode = nodeObj;
+    });
+}
+
+//Configures a DOM element representing an enemy-node by removing
+//any event listeners
+HackingMission.prototype.configureEnemyNodeElement = function(el) {
+    //Deselect node if it was the selected node
+    var nodeObj = this.getNodeFromElement(el);
+    if (this.selectedNode == nodeObj) {
+        nodeObj.deselect(this.actionButtons);
+    }
+
+    //TODO Need to remove event listeners
+}
+
+//Returns bool indicating whether a node is reachable by player
+//by checking if any of the adjacent nodes are owned by the player
+HackingMission.prototype.nodeReachable = function(node) {
+    var x = node.pos[0], y = node.pos[1];
+    if (x > 0 && this.map[x-1][y].plyrCtrl) {return true;}
+    if (x < 7 && this.map[x+1][y].plyrCtrl) {return true;}
+    if (y > 0 && this.map[x][y-1].plyrCtrl) {return true;}
+    if (y < 7 && this.map[x][y+1].plyrCtrl) {return true;}
+    return false;
+}
+
+HackingMission.prototype.start = function() {
+    this.started = true;
+    this.initJsPlumb();
+    var startBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hack-mission-start-btn");
+    startBtn.classList.remove("a-link-button");
+    startBtn.classList.add("a-link-button-inactive");
+}
+
+HackingMission.prototype.initJsPlumb = function() {
+    var instance = jsPlumb.getInstance({
+        DragOptions:{cursor:"pointer", zIndex:2000},
+        PaintStyle: {
+            gradient: { stops: [
+                [ 0, "#FFFFFF" ],
+                [ 1, "#FFFFFF" ]
+            ] },
+            stroke: "#FFFFFF",
+            strokeWidth: 8
+        },
+    });
+
+    this.jsplumbinstance = instance;
+
+    //All player cores are sources
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        instance.makeSource(this.playerCores[i].el, {
+            deleteEndpointsOnEmpty:true,
+            maxConnections:1,
+            anchor:"Continuous",
+            connector:"Flowchart"
+        });
+    }
+
+    //Everything else is a target
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        instance.makeTarget(this.enemyCores[i].el, {
+            maxConnections:-1,
+            anchor:"Continuous",
+            connector:"Flowchart"
+        });
+    }
+    for (var i = 0; i < this.enemyDatabases.length; ++i) {
+        instance.makeTarget(this.enemyDatabases[i].el, {
+            maxConnections:-1,
+            anchor:"Continuous",
+            connector:["Flowchart"]
+        });
+    }
+    for (var i = 0; i < this.enemyNodes.length; ++i) {
+        instance.makeTarget(this.enemyNodes[i].el, {
+            maxConnections:-1,
+            anchor:"Continuous",
+            connector:"Flowchart"
+        });
+    }
+    for (var i = 0; i < this.miscNodes.length; ++i) {
+        instance.makeTarget(this.miscNodes[i].el, {
+            maxConnections:-1,
+            anchor:"Continuous",
+            connector:"Flowchart"
+        });
+    }
+
+    //Clicking a connection drops it
+    instance.bind("click", function(conn, originalEvent) {
+        var endpoints = conn.endpoints;
+        endpoints[0].detachFrom(endpoints[1]);
+    });
+
+    //Connection events
+    instance.bind("connection", (info)=>{
+        var targetNode = this.getNodeFromElement(info.target);
+
+        //If the node is not reachable, drop the connection
+        if (!this.nodeReachable(targetNode)) {
+            info.sourceEndpoint.detachFrom(info.targetEndpoint);
+            return;
+        }
+
+        var sourceNode = this.getNodeFromElement(info.source);
+        sourceNode.conn = info.connection;
+    });
+
+    //Detach Connection events
+    instance.bind("connectionDetached", (info, originalEvent)=>{
+        var sourceNode = this.getNodeFromElement(info.source);
+        sourceNode.conn = null;
+    });
+}
+
+//Drops all connections where the specified node is the source
+HackingMission.prototype.dropAllConnectionsFromNode = function(node) {
+    var allConns = this.jsplumbinstance.getAllConnections();
+    for (var i = allConns.length-1; i >= 0; --i) {
+        if (allConns[i].source == node.el) {
+            allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
+        }
+    }
+}
+
+//Drops all connections where the specified node is the target
+HackingMission.prototype.dropAllConnectionsToNode = function(node) {
+    var allConns = this.jsplumbinstance.getAllConnections();
+    for (var i = allConns.length-1; i >= 0; --i) {
+        if (allConns[i].target == node.el) {
+            allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
+        }
+    }
+}
+
+var storedCycles = 0;
+HackingMission.prototype.process = function(numCycles=1) {
+    if (!this.started) {return;}
+    storedCycles += numCycles;
+    if (storedCycles < 3) {return;} //Only process every 2 cycles minimum
+
+    var res = false;
+    //Process actions of all player nodes
+    this.playerCores.forEach((node)=>{
+        res |= this.processNode(node, storedCycles);
+    });
+
+    this.playerNodes.forEach((node)=>{
+        if (node.type === NodeTypes.Transfer) {
+            res |= this.processNode(node, storedCycles);
+        }
+    });
+
+    //Process actions of all enemy nodes
+    this.enemyCores.forEach((node)=>{
+        res |= this.processNode(node, storedCycles);
+    });
+
+    this.enemyNodes.forEach((node)=>{
+        if (node.type === NodeTypes.Transfer) {
+            res |= this.processNode(node, storedCycles);
+        }
+    });
+
+    if (res) {
+        this.calculateAttacks();
+        this.calculateDefenses();
+    }
+
+    if (this.enemyDatabases.length === 0) {
+        this.finishMission(true);
+        return;
+    }
+
+    //Defense of every misc Node increase by 1 per second
+    this.miscNodes.forEach((node)=>{
+        node.def += (0.1 * storedCycles);
+        this.updateNodeDomElement(node);
+    });
+
+    //Update timer and check if player lost
+    this.time -= (storedCycles * __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"]._idleSpeed);
+    if (this.time <= 0) {
+        this.finishMission(false);
+        return;
+    }
+    this.updateTimer();
+
+    storedCycles = 0;
+}
+
+//Returns a bool representing whether defenses need to be re-calculated
+HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
+    if (nodeObj.action === null) {
+        return;
+    }
+
+    var targetNode = null, def, atk;
+    if (nodeObj.conn) {
+        targetNode = this.getNodeFromElement(nodeObj.conn.target);
+        if (targetNode.plyrCtrl) {
+            def = this.playerDef;
+            atk = this.enemyAtk;
+        } else if (targetNode.enmyCtrl) {
+            def = this.enemyDef;
+            atk = this.playerAtk;
+        } else { //Misc Node
+            def = targetNode.def;
+            nodeObj.plyrCtrl ? atk = this.playerAtk : atk = this.enemyAtk;
+        }
+    }
+
+    //Calculations are per second, so divide everything by 5
+    var calcStats = false;
+    switch(nodeObj.action) {
+        case NodeActions.Attack:
+            if (nodeObj.conn === null) {break;}
+            var dmg = this.calculateAttackDamage(atk, def, __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
+            targetNode.hp -= (dmg/5 * numCycles);
+            break;
+        case NodeActions.Scan:
+            if (nodeObj.conn === null) {break;}
+            var eff = this.calculateScanEffect(atk, def, __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
+            targetNode.def -= (eff/5 * numCycles);
+            calcStats = true;
+            break;
+        case NodeActions.Weaken:
+            if (nodeObj.conn === null) {break;}
+            var eff = this.calculateWeakenEffect(atk, def, __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
+            targetNode.atk -= (eff/5 * numCycles);
+            calcStats = true;
+            break;
+        case NodeActions.Fortify:
+            var eff = this.calculateFortifyEffect(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
+            nodeObj.def += (eff/5 * numCycles);
+            calcStats = true;
+            break;
+        case NodeActions.Overflow:
+            var eff = this.calculateOverflowEffect(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
+            if (nodeObj.def < eff) {break;}
+            nodeObj.def -= (eff/5 * numCycles);
+            nodeObj.atk += (eff/5 * numCycles);
+            calcStats = true;
+            break;
+        default:
+            console.log("ERR: Invalid Node Action: " + nodeObj.action);
+            break;
+    }
+
+    //Stats can't go below 0
+    if (nodeObj.atk < 0) {nodeObj.atk = 0;}
+    if (nodeObj.def < 0) {nodeObj.def = 0;}
+    if (targetNode && targetNode.atk < 0) {targetNode.atk = 0;}
+    if (targetNode && targetNode.def < 0) {targetNode.def = 0;}
+
+    //Conquering a node
+    if (targetNode && targetNode.hp <= 0) {
+        var conqueredByPlayer = nodeObj.plyrCtrl;
+        targetNode.hp = targetNode.maxhp;
+        targetNode.action = null;
+        targetNode.conn = null;
+        if (this.selectedNode == targetNode) {
+            targetNode.deselect();
+        }
+
+        //Flag for whether the target node was a misc node
+        var isMiscNode = !targetNode.plyrCtrl && !targetNode.enmyCtrl;
+        console.log("isMiscNode: " + isMiscNode);
+
+        //Remove all connections from Node
+        this.dropAllConnectionsToNode(targetNode);
+        this.dropAllConnectionsFromNode(targetNode);
+
+        //Changes the css class and turn the node into a JsPlumb Source/Target
+        if (conqueredByPlayer) {
+            targetNode.setControlledByPlayer();
+            this.jsplumbinstance.unmakeTarget(targetNode.el);
+            this.jsplumbinstance.makeSource(targetNode.el, {
+                deleteEndpointsOnEmpty:true,
+                maxConnections:1,
+                anchor:"Continuous",
+                connector:"Flowchart"
+            });
+        } else {
+            targetNode.setControlledByEnemy();
+            this.jsplumbinstance.unmakeSource(targetNode.el);
+            this.jsplumbinstance.makeTarget(targetNode.el, {
+                maxConnections:-1,
+                anchor:"Continuous",
+                connector:["Flowchart"]
+            });
+        }
+
+        calcStats = true;
+
+        //Helper function to swap nodes between the respective enemyNodes/playerNodes arrays
+        function swapNodes(orig, dest, targetNode) {
+            console.log("swapNodes called");
+            for (var i = 0; i < orig.length; ++i) {
+                if (orig[i] == targetNode) {
+                    console.log("Swapping nodes");
+                    var node = orig.splice(i, 1);
+                    node = node[0];
+                    dest.push(node);
+                    break;
+                }
+            }
+        }
+
+        //Whether conquered node was a misc node
+        switch(targetNode.type) {
+            case NodeTypes.Core:
+                if (conqueredByPlayer) {
+                    swapNodes(this.enemyCores, this.playerCores, targetNode);
+                    this.configurePlayerNodeElement(targetNode.el);
+                } else {
+                    swapNodes(this.playerCores, this.enemyCores, targetNode);
+                    this.configureEnemyNodeElement(targetNode.el);
+                }
+                break;
+            case NodeTypes.Firewall:
+                if (conqueredByPlayer) {
+                    swapNodes(this.enemyNodes, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(this.playerNodes, this.enemyNodes, targetNode);
+                }
+                break;
+            case NodeTypes.Database:
+                if (conqueredByPlayer) {
+                    swapNodes(this.enemyDatabases, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(this.playerNodes, this.enemyDatabases, targetNode);
+                }
+                break;
+            case NodeTypes.Spam:
+                if (conqueredByPlayer) {
+                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+                }
+
+                //Conquering spam node increases time limit
+                this.time += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionSpamTimeIncrease;
+                break;
+            case NodeTypes.Transfer:
+                //Conquering a Transfer node increases the attack of all cores by some percentages
+                if (conqueredByPlayer) {
+                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+                    this.playerCores.forEach(function(node) {
+                        node.atk *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionTransferAttackIncrease;
+                    });
+                    this.configurePlayerNodeElement(targetNode.el);
+                } else {
+                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+                    this.enemyCores.forEach(function(node) {
+                        node.atk *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionTransferAttackIncrease;
+                    });
+                    this.configureEnemyNodeElement(targetNode.el);
+                }
+                break;
+            case NodeTypes.Shield:
+                if (conqueredByPlayer) {
+                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+                } else {
+                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+                }
+                break;
+        }
+    }
+    this.updateNodeDomElement(nodeObj);
+    if (targetNode) {this.updateNodeDomElement(targetNode);}
+    return calcStats;
+}
+
+var hackEffWeightSelf = 150; //Weight for Node actions on self
+var hackEffWeightTarget = 25; //Weight for Node Actions against Target
+var hackEffWeightAttack = 110; //Weight for Attack action
+
+//Returns damage per cycle based on stats
+HackingMission.prototype.calculateAttackDamage = function(atk, def, hacking = 0) {
+    return Math.max(atk + (hacking / hackEffWeightAttack) - def, 1);
+}
+
+HackingMission.prototype.calculateScanEffect = function(atk, def, hacking=0) {
+    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 1);
+}
+
+HackingMission.prototype.calculateWeakenEffect = function(atk, def, hacking=0) {
+    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 1);
+}
+
+HackingMission.prototype.calculateFortifyEffect = function(hacking=0) {
+    return hacking / hackEffWeightSelf;
+}
+
+HackingMission.prototype.calculateOverflowEffect = function(hacking=0) {
+    return hacking / hackEffWeightSelf;
+}
+
+//Updates timer display
+HackingMission.prototype.updateTimer = function() {
+    var timer = document.getElementById("hacking-mission-timer");
+
+    //Convert time remaining to a string of the form m:ss
+    var seconds = Math.round(this.time / 1000);
+    var minutes = Math.trunc(seconds / 60);
+    seconds %= 60;
+    var str = ("0" + minutes).slice(-2) + ":" + ("0" + seconds).slice(-2);
+    timer.innerText = "Time left: " + str;
+}
+
+//The 'win' argument is a bool for whether or not the player won
+HackingMission.prototype.finishMission = function(win) {
+    inMission = false;
+    currMission = null;
+
+    if (win) {
+        Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Mission won! This feature is currently in " +
+                        "beta so you did not earn anything, but normally you would have won " +
+                        this.reward + " reputation with " + this.faction.name);
+    } else {
+        Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Mission lost/forfeited!");
+    }
+
+    //Clear mission container
+    var container = document.getElementById("mission-container");
+    while(container.firstChild) {
+        container.removeChild(container.firstChild);
+    }
+
+    //Return to Faction page
+    document.getElementById("mainmenu-container").style.visibility = "visible";
+    document.getElementById("character-overview-wrapper").style.visibility = "visible";
+    __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadFactionContent();
+    Object(__WEBPACK_IMPORTED_MODULE_2__Faction_js__["c" /* displayFactionContent */])(this.faction.name);
+}
+
+
+
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
+
+/***/ }),
+/* 32 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -34895,7 +36202,7 @@ function NetscriptFunctions(workerScript) {
 /* 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__(36);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js__ = __webpack_require__(27);
 /* 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__(21);
@@ -36200,7 +37507,7 @@ function setGangMemberTaskDescription(memberObj, taskName) {
 /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
-/* 31 */
+/* 33 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -36341,7 +37648,7 @@ function applySourceFile(srcFile) {
 
 
 /***/ }),
-/* 32 */
+/* 34 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -36356,7 +37663,7 @@ function applySourceFile(srcFile) {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(10);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Location_js__ = __webpack_require__(12);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(22);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__ = __webpack_require__(30);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__ = __webpack_require__(15);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Server_js__ = __webpack_require__(6);
@@ -36589,7 +37896,346 @@ function prestigeSourceFile() {
 /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
-/* 33 */
+/* 35 */
+/***/ (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__(9);
+/* 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__(34);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(33);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Terminal_js__ = __webpack_require__(20);
+/* 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__(21);
+
+
+
+
+
+
+
+
+
+
+
+/* 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 + "<span class='typed-cursor'> &#9608; </span>";
+            var promise = writeRedPillLetter(pElem, line, i+1);
+            promise.then(function(res) {
+                resolve(res);
+            }, function(e) {
+                reject(e);
+            });
+        }, 30);
+    });
+}
+
+let redPillFlag = false;
+function hackWorldDaemon(currentNodeNumber) {
+    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);
+    }).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!<br><br>" +
+                        sourceFile.name + "<br><br>" + sourceFile.info);
+    }
+}
+
+function loadBitVerse(destroyedBitNodeNum) {
+    //Clear the screen
+    var container = document.getElementById("red-pill-container");
+    while (container.firstChild) {
+        container.removeChild(container.firstChild);
+    }
+
+    //Create the Bit Verse
+    var bitVerseImage = document.createElement("pre");
+    var bitNodes = [];
+    for (var i = 1; i <= 12; ++i) {
+        bitNodes.push(createBitNode(i));
+    }
+
+    bitVerseImage.innerHTML =
+    "                          O                          <br>" +
+    "             |  O  O      |      O  O  |             <br>" +
+    "        O    |  | /     __|       \\ |  |    O        <br>" +
+    "      O |    O  | |  O /  |  O    | |  O    | O      <br>" +
+    "    | | |    |  |_/  |/   |   \\_  \\_|  |    | | |    <br>" +
+    "  O | | | O  |  | O__/    |   / \\__ |  |  O | | | O  <br>" +
+    "  | | | | |  |  |   /    /|  O  /  \\|  |  | | | | |  <br>" +
+    "O | | |  \\|  |  O  /   _/ |    /    O  |  |/  | | | O<br>" +
+    "| | | |O  /  |  | O   /   |   O   O |  |  \\  O| | | |<br>" +
+    "| | |/  \\/  / __| | |/ \\  |   \\   | |__ \\  \\/  \\| | |<br>" +
+    " \\| O   |  |_/    |\\|   \\ O    \\__|    \\_|  |   O |/ <br>" +
+    "  | |   |_/       | |    \\|    /  |       \\_|   | |  <br>" +
+    "   \\|   /          \\|     |   /  /          \\   |/   <br>" +
+    "    |  "+bitNodes[9]+"            |     |  /  |            "+bitNodes[10]+"  |    <br>" +
+    "  "+bitNodes[8]+" |  |            |     |     |            |  | "+bitNodes[11]+"  <br>" +
+    "  | |  |            /    / \\    \\            |  | |  <br>" +
+    "   \\|  |           /  "+bitNodes[6]+" /   \\ "+bitNodes[7]+"  \\           |  |/   <br>" +
+    "    \\  |          /  / |     | \\  \\          |  /    <br>" +
+    "     \\ \\JUMP "+bitNodes[4]+"3R |  |  |     |  |  | R3"+bitNodes[5]+" PMUJ/ /     <br>" +
+    "      \\||    |   |  |  |     |  |  |   |    ||/      <br>" +
+    "       \\|     \\_ |  |  |     |  |  | _/     |/       <br>" +
+    "        \\       \\| /    \\   /    \\ |/       /        <br>" +
+    "         "+bitNodes[0]+"       |/   "+bitNodes[1]+"  | |  "+bitNodes[2]+"   \\|       "+bitNodes[3]+"         <br>" +
+    "         |       |    |  | |  |    |       |         <br>" +
+    "          \\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/          <br><br><br><br>";
+
+
+    /*
+    "                          O                          <br>" +
+    "             |  O  O      |      O  O  |             <br>" +
+    "        O    |  | /     __|       \ |  |    O        <br>" +
+    "      O |    O  | |  O /  |  O    | |  O    | O      <br>" +
+    "    | | |    |  |_/  |/   |   \_  \_|  |    | | |    <br>" +
+    "  O | | | O  |  | O__/    |   / \__ |  |  O | | | O  <br>" +
+    "  | | | | |  |  |   /    /|  O  /  \|  |  | | | | |  <br>" +
+    "O | | |  \|  |  O  /   _/ |    /    O  |  |/  | | | O<br>" +
+    "| | | |O  /  |  | O   /   |   O   O |  |  \  O| | | |<br>" +
+    "| | |/  \/  / __| | |/ \  |   \   | |__ \  \/  \| | |<br>" +
+    " \| O   |  |_/    |\|   \ O    \__|    \_|  |   O |/ <br>" +
+    "  | |   |_/       | |    \|    /  |       \_|   | |  <br>" +
+    "   \|   /          \|     |   /  /          \   |/   <br>" +
+    "    |  O            |     |  /  |            O  |    <br>" +
+    "  O |  |            |     |     |            |  | O  <br>" +
+    "  | |  |            /    / \    \            |  | |  <br>" +
+    "   \|  |           /  O /   \ O  \           |  |/   <br>" +
+    "    \  |          /  / |     | \  \          |  /    <br>" +
+    "     \ \JUMP O3R |  |  |     |  |  | R3O PMUJ/ /     <br>" +
+    "      \||    |   |  |  |     |  |  |   |    ||/      <br>" +
+    "       \|     \_ |  |  |     |  |  | _/     |/       <br>" +
+    "        \       \| /    \   /    \ |/       /        <br>" +
+    "         O       |/   O  | |  O   \|       O         <br>" +
+    "         |       |    |  | |  |    |       |         <br>" +
+    "          \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/          <br>";
+    */
+
+    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 === 4 || i === 5 || 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 + "<br><br>" + bitNode.info);
+                    createBitNodeYesNoEventListeners(i, destroyedBitNodeNum);
+                });
+            } 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 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  "<a class='bitnode tooltip' id='bitnode-" + bitNode.number.toString() + "'><strong>O</strong>" +
+             "<span class='tooltiptext'>" +
+             "<strong>BitNode-" + bitNode.number.toString() + "<br>" + bitNode.name+ "</strong><br>" +
+             bitNode.desc + "<br>" +
+             "</span></a>";
+}
+
+function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) {
+    var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])();
+    yesBtn.innerHTML = "Enter BitNode-" + newBitNode;
+    yesBtn.addEventListener("click", function() {
+        giveSourceFile(destroyedBitNode);
+        redPillFlag = false;
+        var container = document.getElementById("red-pill-container");
+        while (container.firstChild) {
+            container.removeChild(container.firstChild);
+        }
+
+        //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 type="text" id="terminal-input-text-box" class="terminal-input" tabindex="1"/>';
+        $('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__(7)))
+
+/***/ }),
+/* 36 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -36607,7 +38253,7 @@ function prestigeSourceFile() {
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(9);
 /* 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__(28);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(29);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(15);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(13);
@@ -37432,7 +39078,7 @@ function scriptCalculateWeakenTime(server) {
 
 
 /***/ }),
-/* 34 */
+/* 37 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -37955,7 +39601,7 @@ function getHacknetNode(name) {
 
 
 /***/ }),
-/* 35 */
+/* 38 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -38010,24 +39656,7 @@ function gameOptionsBoxOpen() {
 /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
 
 /***/ }),
-/* 36 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @preserve
- * numeral.js
- * version : 2.0.6
- * author : Adam Draper
- * license : MIT
- * http://adamwdraper.github.com/Numeral-js/
- */
-!function(a,b){ true?!(__WEBPACK_AMD_DEFINE_FACTORY__ = (b),
-				__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
-				(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
-				__WEBPACK_AMD_DEFINE_FACTORY__),
-				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):"object"==typeof module&&module.exports?module.exports=b():a.numeral=b()}(this,function(){function a(a,b){this._input=a,this._value=b}var b,c,d="2.0.6",e={},f={},g={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},h={currentLocale:g.currentLocale,zeroFormat:g.zeroFormat,nullFormat:g.nullFormat,defaultFormat:g.defaultFormat,scalePercentBy100:g.scalePercentBy100};return b=function(d){var f,g,i,j;if(b.isNumeral(d))f=d.value();else if(0===d||"undefined"==typeof d)f=0;else if(null===d||c.isNaN(d))f=null;else if("string"==typeof d)if(h.zeroFormat&&d===h.zeroFormat)f=0;else if(h.nullFormat&&d===h.nullFormat||!d.replace(/[^0-9]+/g,"").length)f=null;else{for(g in e)if(j="function"==typeof e[g].regexps.unformat?e[g].regexps.unformat():e[g].regexps.unformat,j&&d.match(j)){i=e[g].unformat;break}i=i||b._.stringToNumber,f=i(d)}else f=Number(d)||null;return new a(d,f)},b.version=d,b.isNumeral=function(b){return b instanceof a},b._=c={numberToFormat:function(a,c,d){var e,g,h,i,j,k,l,m=f[b.options.currentLocale],n=!1,o=!1,p=0,q="",r=1e12,s=1e9,t=1e6,u=1e3,v="",w=!1;if(a=a||0,g=Math.abs(a),b._.includes(c,"(")?(n=!0,c=c.replace(/[\(|\)]/g,"")):(b._.includes(c,"+")||b._.includes(c,"-"))&&(j=b._.includes(c,"+")?c.indexOf("+"):0>a?c.indexOf("-"):-1,c=c.replace(/[\+|\-]/g,"")),b._.includes(c,"a")&&(e=c.match(/a(k|m|b|t)?/),e=e?e[1]:!1,b._.includes(c," a")&&(q=" "),c=c.replace(new RegExp(q+"a[kmbt]?"),""),g>=r&&!e||"t"===e?(q+=m.abbreviations.trillion,a/=r):r>g&&g>=s&&!e||"b"===e?(q+=m.abbreviations.billion,a/=s):s>g&&g>=t&&!e||"m"===e?(q+=m.abbreviations.million,a/=t):(t>g&&g>=u&&!e||"k"===e)&&(q+=m.abbreviations.thousand,a/=u)),b._.includes(c,"[.]")&&(o=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],k=c.indexOf(","),p=(c.split(".")[0].split(",")[0].match(/0/g)||[]).length,i?(b._.includes(i,"[")?(i=i.replace("]",""),i=i.split("["),v=b._.toFixed(a,i[0].length+i[1].length,d,i[1].length)):v=b._.toFixed(a,i.length,d),h=v.split(".")[0],v=b._.includes(v,".")?m.delimiters.decimal+v.split(".")[1]:"",o&&0===Number(v.slice(1))&&(v="")):h=b._.toFixed(a,0,d),q&&!e&&Number(h)>=1e3&&q!==m.abbreviations.trillion)switch(h=String(Number(h)/1e3),q){case m.abbreviations.thousand:q=m.abbreviations.million;break;case m.abbreviations.million:q=m.abbreviations.billion;break;case m.abbreviations.billion:q=m.abbreviations.trillion}if(b._.includes(h,"-")&&(h=h.slice(1),w=!0),h.length<p)for(var x=p-h.length;x>0;x--)h="0"+h;return k>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+m.delimiters.thousands)),0===c.indexOf(".")&&(h=""),l=h+v+(q?q:""),n?l=(n&&w?"(":"")+l+(n&&w?")":""):j>=0?l=0===j?(w?"-":"+")+l:l+(w?"-":"+"):w&&(l="-"+l),l},stringToNumber:function(a){var b,c,d,e=f[h.currentLocale],g=a,i={thousand:3,million:6,billion:9,trillion:12};if(h.zeroFormat&&a===h.zeroFormat)c=0;else if(h.nullFormat&&a===h.nullFormat||!a.replace(/[^0-9]+/g,"").length)c=null;else{c=1,"."!==e.delimiters.decimal&&(a=a.replace(/\./g,"").replace(e.delimiters.decimal,"."));for(b in i)if(d=new RegExp("[^a-zA-Z]"+e.abbreviations[b]+"(?:\\)|(\\"+e.currency.symbol+")?(?:\\))?)?$"),g.match(d)){c*=Math.pow(10,i[b]);break}c*=(a.split("-").length+Math.min(a.split("(").length-1,a.split(")").length-1))%2?1:-1,a=a.replace(/[^0-9\.]+/g,""),c*=Number(a)}return c},isNaN:function(a){return"number"==typeof a&&isNaN(a)},includes:function(a,b){return-1!==a.indexOf(b)},insert:function(a,b,c){return a.slice(0,c)+b+a.slice(c)},reduce:function(a,b){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof b)throw new TypeError(b+" is not a function");var c,d=Object(a),e=d.length>>>0,f=0;if(3===arguments.length)c=arguments[2];else{for(;e>f&&!(f in d);)f++;if(f>=e)throw new TypeError("Reduce of empty array with no initial value");c=d[f++]}for(;e>f;f++)f in d&&(c=b(c,d[f],f,d));return c},multiplier:function(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)},correctionFactor:function(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var d=c.multiplier(b);return a>d?a:d},1)},toFixed:function(a,b,c,d){var e,f,g,h,i=a.toString().split("."),j=b-(d||0);return e=2===i.length?Math.min(Math.max(i[1].length,j),b):j,g=Math.pow(10,e),h=(c(a+"e+"+e)/g).toFixed(e),d>b-e&&(f=new RegExp("\\.?0{1,"+(d-(b-e))+"}$"),h=h.replace(f,"")),h}},b.options=h,b.formats=e,b.locales=f,b.locale=function(a){return a&&(h.currentLocale=a.toLowerCase()),h.currentLocale},b.localeData=function(a){if(!a)return f[h.currentLocale];if(a=a.toLowerCase(),!f[a])throw new Error("Unknown locale : "+a);return f[a]},b.reset=function(){for(var a in g)h[a]=g[a]},b.zeroFormat=function(a){h.zeroFormat="string"==typeof a?a:null},b.nullFormat=function(a){h.nullFormat="string"==typeof a?a:null},b.defaultFormat=function(a){h.defaultFormat="string"==typeof a?a:"0.0"},b.register=function(a,b,c){if(b=b.toLowerCase(),this[a+"s"][b])throw new TypeError(b+" "+a+" already registered.");return this[a+"s"][b]=c,c},b.validate=function(a,c){var d,e,f,g,h,i,j,k;if("string"!=typeof a&&(a+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a.match(/^\d+$/))return!0;if(""===a)return!1;try{j=b.localeData(c)}catch(l){j=b.localeData(b.locale())}return f=j.currency.symbol,h=j.abbreviations,d=j.delimiters.decimal,e="."===j.delimiters.thousands?"\\.":j.delimiters.thousands,k=a.match(/^[^\d]+/),null!==k&&(a=a.substr(1),k[0]!==f)?!1:(k=a.match(/[^\d]+$/),null!==k&&(a=a.slice(0,-1),k[0]!==h.thousand&&k[0]!==h.million&&k[0]!==h.billion&&k[0]!==h.trillion)?!1:(i=new RegExp(e+"{2}"),a.match(/[^\d.,]/g)?!1:(g=a.split(d),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i):1===g[0].length?!!g[0].match(/^\d+$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/))))},b.fn=a.prototype={clone:function(){return b(this)},format:function(a,c){var d,f,g,i=this._value,j=a||h.defaultFormat;if(c=c||Math.round,0===i&&null!==h.zeroFormat)f=h.zeroFormat;else if(null===i&&null!==h.nullFormat)f=h.nullFormat;else{for(d in e)if(j.match(e[d].regexps.format)){g=e[d].format;break}g=g||b._.numberToFormat,f=g(i,j,c)}return f},value:function(){return this._value},input:function(){return this._input},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b,c,e){return a+Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([this._value,a],b,0)/d,this},subtract:function(a){function b(a,b,c,e){return a-Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([a],b,Math.round(this._value*d))/d,this},multiply:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)*Math.round(b*f)/Math.round(f*f)}return this._value=c.reduce([this._value,a],b,1),this},divide:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)/Math.round(b*f)}return this._value=c.reduce([this._value,a],b),this},difference:function(a){return Math.abs(b(this._value).subtract(a).value())}},b.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),function(){b.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(a,c,d){var e,f=b._.includes(c," BPS")?" ":"";return a=1e4*a,c=c.replace(/\s?BPS/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"BPS"),e=e.join("")):e=e+f+"BPS",e},unformat:function(a){return+(1e-4*b._.stringToNumber(a)).toFixed(15)}})}(),function(){var a={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},c={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},d=a.suffixes.concat(c.suffixes.filter(function(b){return a.suffixes.indexOf(b)<0})),e=d.join("|");e="("+e.replace("B","B(?!PS)")+")",b.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(e)},format:function(d,e,f){var g,h,i,j,k=b._.includes(e,"ib")?c:a,l=b._.includes(e," b")||b._.includes(e," ib")?" ":"";for(e=e.replace(/\s?i?b/,""),h=0;h<=k.suffixes.length;h++)if(i=Math.pow(k.base,h),j=Math.pow(k.base,h+1),null===d||0===d||d>=i&&j>d){l+=k.suffixes[h],i>0&&(d/=i);break}return g=b._.numberToFormat(d,e,f),g+l},unformat:function(d){var e,f,g=b._.stringToNumber(d);if(g){for(e=a.suffixes.length-1;e>=0;e--){if(b._.includes(d,a.suffixes[e])){f=Math.pow(a.base,e);break}if(b._.includes(d,c.suffixes[e])){f=Math.pow(c.base,e);break}}g*=f||1}return g}})}(),function(){b.register("format","currency",{regexps:{format:/(\$)/},format:function(a,c,d){var e,f,g,h=b.locales[b.options.currentLocale],i={before:c.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:c.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(c=c.replace(/\s?\$\s?/,""),e=b._.numberToFormat(a,c,d),a>=0?(i.before=i.before.replace(/[\-\(]/,""),i.after=i.after.replace(/[\-\)]/,"")):0>a&&!b._.includes(i.before,"-")&&!b._.includes(i.before,"(")&&(i.before="-"+i.before),g=0;g<i.before.length;g++)switch(f=i.before[g]){case"$":e=b._.insert(e,h.currency.symbol,g);break;case" ":e=b._.insert(e," ",g+h.currency.symbol.length-1)}for(g=i.after.length-1;g>=0;g--)switch(f=i.after[g]){case"$":e=g===i.after.length-1?e+h.currency.symbol:b._.insert(e,h.currency.symbol,-(i.after.length-(1+g)));break;case" ":e=g===i.after.length-1?e+" ":b._.insert(e," ",-(i.after.length-(1+g)+h.currency.symbol.length-1))}return e}})}(),function(){b.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(a,c,d){var e,f="number"!=typeof a||b._.isNaN(a)?"0e+0":a.toExponential(),g=f.split("e");return c=c.replace(/e[\+|\-]{1}0/,""),e=b._.numberToFormat(Number(g[0]),c,d),e+"e"+g[1]},unformat:function(a){function c(a,c,d,e){var f=b._.correctionFactor(a,c),g=a*f*(c*f)/(f*f);return g}var d=b._.includes(a,"e+")?a.split("e+"):a.split("e-"),e=Number(d[0]),f=Number(d[1]);return f=b._.includes(a,"e-")?f*=-1:f,b._.reduce([e,Math.pow(10,f)],c,1)}})}(),function(){b.register("format","ordinal",{regexps:{format:/(o)/},format:function(a,c,d){var e,f=b.locales[b.options.currentLocale],g=b._.includes(c," o")?" ":"";return c=c.replace(/\s?o/,""),g+=f.ordinal(a),e=b._.numberToFormat(a,c,d),e+g}})}(),function(){b.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(a,c,d){var e,f=b._.includes(c," %")?" ":"";return b.options.scalePercentBy100&&(a=100*a),c=c.replace(/\s?\%/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"%"),e=e.join("")):e=e+f+"%",e},unformat:function(a){var c=b._.stringToNumber(a);return b.options.scalePercentBy100?.01*c:c}})}(),function(){b.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(a,b,c){var d=Math.floor(a/60/60),e=Math.floor((a-60*d*60)/60),f=Math.round(a-60*d*60-60*e);return d+":"+(10>e?"0"+e:e)+":"+(10>f?"0"+f:f)},unformat:function(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}})}(),b});
-
-/***/ }),
-/* 37 */
+/* 39 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -38284,1198 +39913,7 @@ function determineCrimeChanceHeist() {
 
 
 /***/ }),
-/* 38 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HackingMission; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return inMission; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return setInMission; });
-/* 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__(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__(48);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_jsplumb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_jsplumb__);
-
-
-
-
-
-
-
-
-
-let inMission = false; //Flag to denote whether a mission is running
-let currMission = null;
-function setInMission(bool, mission) {
-    inMission = bool;
-    if (bool) {
-        currMission = mission;
-    } else {
-        currMission = null;
-    }
-}
-
-//Keyboard shortcuts
-$(document).keydown(function(e) {
-    if (inMission && currMission && currMission.selectedNode != null) {
-        switch (e.keyCode) {
-            case 65: //a for Attack
-                currMission.actionButtons[0].click();
-                break;
-            case 83: //s for Scan
-                currMission.actionButtons[1].click();
-                break;
-            case 87: //w for Weaken
-                currMission.actionButtons[2].click();
-                break;
-            case 70: //f for Fortify
-                currMission.actionButtons[3].click();
-                break;
-            case 82: //r for Overflow
-                currMission.actionButtons[4].click();
-                break;
-            case 68: //d for Detach connection
-                currMission.actionButtons[5].click();
-                break;
-            default:
-                break;
-        }
-    }
-});
-
-let NodeTypes = {
-    Core: "CPU Core Node",      //All actions available
-    Firewall: "Firewall Node",  //No actions available
-    Database: "Database Node",  //No actions available
-    Spam: "Spam Node",          //No actions Available
-    Transfer: "Transfer Node",  //Can Weaken, Scan, Fortify and Overflow
-    Shield: "Shield Node"       //Can Fortify
-}
-
-let NodeActions = {
-    Attack: "Attacking", //Damaged based on attack stat + hacking level + opp def
-    Scan: "Scanning", //-Def for target, affected by attack and hacking level
-    Weaken: "Weakening", //-Attack for target, affected by attack and hacking level
-    Fortify: "Fortifying", //+Defense for Node, affected by hacking level
-    Overflow: "Overflowing", //+Attack but -Defense for Node, affected by hacking level
-}
-
-function Node(type, stats) {
-    this.type = type;
-    this.atk = stats.atk ? stats.atk : 0;
-    this.def = stats.def ? stats.def : 0;
-    this.hp = stats.hp ? stats.hp : 0;
-    this.maxhp = this.hp;
-    this.plyrCtrl = false;
-    this.enmyCtrl = false;
-    this.pos = [0, 0]; //x, y
-    this.el = null; //Holds the Node's DOM element
-    this.action = null;
-
-    //Holds the JsPlumb Connection object for this Node,
-    //where this Node is the Source (since each Node
-    //can only have 1 outgoing Connection)
-    this.conn = null;
-}
-
-Node.prototype.setPosition = function(x, y) {
-    this.pos = [x, y];
-}
-
-Node.prototype.setControlledByPlayer = function() {
-    this.plyrCtrl = true;
-    this.enmyCtrl = false;
-    if (this.el) {
-        this.el.classList.remove("hack-mission-enemy-node");
-        this.el.classList.add("hack-mission-player-node");
-    }
-}
-
-Node.prototype.setControlledByEnemy = function() {
-    this.plyrCtrl = false;
-    this.enmyCtrl = true;
-    if (this.el) {
-        this.el.classList.remove("hack-mission-player-node");
-        this.el.classList.add("hack-mission-enemy-node");
-    }
-}
-
-//Sets this node to be the active node
-Node.prototype.select = function(actionButtons) {
-    if (this.enmyCtrl) {return;}
-    this.el.classList.add("hack-mission-player-node-active");
-
-    //Make all buttons inactive
-    for (var i = 0; i < actionButtons.length; ++i) {
-        actionButtons[i].classList.remove("a-link-button");
-        actionButtons[i].classList.add("a-link-button-inactive");
-    }
-
-    switch(this.type) {
-        case NodeTypes.Core:
-            //All buttons active
-            for (var i = 0; i < actionButtons.length; ++i) {
-                actionButtons[i].classList.remove("a-link-button-inactive");
-                actionButtons[i].classList.add("a-link-button");
-            }
-            break;
-        case NodeTypes.Transfer:
-            actionButtons[1].classList.remove("a-link-button-inactive");
-            actionButtons[1].classList.add("a-link-button");
-            actionButtons[2].classList.remove("a-link-button-inactive");
-            actionButtons[2].classList.add("a-link-button");
-            actionButtons[3].classList.remove("a-link-button-inactive");
-            actionButtons[3].classList.add("a-link-button");
-            actionButtons[4].classList.remove("a-link-button-inactive");
-            actionButtons[4].classList.add("a-link-button");
-            actionButtons[5].classList.remove("a-link-button-inactive");
-            actionButtons[5].classList.add("a-link-button");
-            break;
-        default:
-            break;
-    }
-}
-
-Node.prototype.deselect = function(actionButtons) {
-    this.el.classList.remove("hack-mission-player-node-active");
-    for (var i = 0; i < actionButtons.length; ++i) {
-        actionButtons[i].classList.remove("a-link-button");
-        actionButtons[i].classList.add("a-link-button-inactive");
-    }
-}
-
-//Hacking mission instance
-//Takes in the reputation of the Faction for which the mission is
-//being conducted
-function HackingMission(rep, fac) {
-    this.faction = fac;
-
-    this.started = false;
-    this.time = 120000; //2 minutes, milliseconds
-
-    this.playerCores = [];
-    this.playerNodes = []; //Non-core nodes
-    this.playerDef = 0;
-
-    this.enemyCores = [];
-    this.enemyDatabases = [];
-    this.enemyNodes = []; //Non-core nodes
-    this.enemyDef = 0;
-
-    this.miscNodes = [];
-
-    this.selectedNode = null; //Which of the player's nodes is currently selected
-
-    this.actionButtons = []; //DOM buttons for actions
-
-    this.availablePositions = [];
-    for (var r = 0; r < 8; ++r) {
-        for (var c = 0; c < 8; ++c) {
-            this.availablePositions.push([r, c]);
-        }
-    }
-
-    this.map = [];
-    for (var i = 0; i < 8; ++i) {
-        this.map.push([null, null, null, null, null, null, null, null]);
-    }
-
-    this.jsplumbinstance = null;
-
-    //difficulty capped at 16
-    this.difficulty = Math.min(16, Math.round(rep / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToDiffConversion) + 1);
-    console.log("difficulty: " + this.difficulty);
-    this.reward = 200 + (rep / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToRewardConversion);
-}
-
-HackingMission.prototype.init = function() {
-    //Create Header DOM
-    this.createPageDom();
-
-    //Create player starting nodes
-    var home = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].getHomeComputer()
-    for (var i = 0; i < home.cpuCores; ++i) {
-        var stats = {
-            atk: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 10),
-            def: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 25),
-            hp: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 5),
-        };
-        this.playerCores.push(new Node(NodeTypes.Core, stats));
-        this.playerCores[i].setControlledByPlayer();
-        this.setNodePosition(this.playerCores[i], 0, i);
-        this.removeAvailablePosition(0, i);
-    }
-
-    //Randomly generate enemy nodes (CPU and Firewall) based on difficulty
-    var numNodes = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 1);
-    var numFirewalls = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 2);
-    var numDatabases = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(this.difficulty, this.difficulty + 1);
-    var totalNodes = numNodes + numFirewalls + numDatabases;
-    var xlimit = 7 - Math.floor(totalNodes / 8);
-    console.log("numNodes: " + numNodes);
-    console.log("numFirewalls: " + numFirewalls);
-    console.log("numDatabases: " + numDatabases);
-    console.log("totalNodes: " + totalNodes);
-    var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
-    for (var i = 0; i < numNodes; ++i) {
-        var stats = {
-            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(125, 175),
-            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(30, 50),
-            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(225, 275)
-        }
-        this.enemyCores.push(new Node(NodeTypes.Core, stats));
-        this.enemyCores[i].setControlledByEnemy();
-        this.setNodeRandomPosition(this.enemyCores[i], xlimit);
-    }
-    for (var i = 0; i < numFirewalls; ++i) {
-        var stats = {
-            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(10, 25),
-            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 75),
-            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(175, 200)
-        }
-        this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));
-        this.enemyNodes[i].setControlledByEnemy();
-        this.setNodeRandomPosition(this.enemyNodes[i], xlimit);
-    }
-    for (var i = 0; i < numDatabases; ++i) {
-        var stats = {
-            atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(20, 30),
-            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 40),
-            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(120, 150)
-        }
-        var node = new Node(NodeTypes.Database, stats);
-        node.setControlledByEnemy();
-        this.setNodeRandomPosition(node, xlimit);
-        this.enemyDatabases.push(node);
-    }
-    this.calculateDefenses();
-    this.createMap();
-}
-
-HackingMission.prototype.createPageDom = function() {
-    var container = document.getElementById("mission-container");
-
-    var headerText = document.createElement("p");
-    headerText.innerHTML = "You are about to start a hacking mission! For more information " +
-                    "about how hacking missions work, click one of the guide links " +
-                    "below (one opens up an in-game guide and the other opens up " +
-                    "the guide from the wiki). Click the 'Start' button to begin.";
-    headerText.style.display = "block";
-    headerText.classList.add("hack-mission-header-element");
-    headerText.style.width = "80%";
-
-    var inGameGuideBtn = document.createElement("a");
-    inGameGuideBtn.innerText = "How to Play";
-    inGameGuideBtn.classList.add("a-link-button");
-    inGameGuideBtn.style.display = "inline-block";
-    inGameGuideBtn.classList.add("hack-mission-header-element");
-    inGameGuideBtn.addEventListener("click", function() {
-        Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])(__WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionHowToPlay);
-        return false;
-    });
-
-    var wikiGuideBtn = document.createElement("a");
-    wikiGuideBtn.innerText = "Wiki Guide";
-    wikiGuideBtn.classList.add("a-link-button");
-    wikiGuideBtn.style.display = "inline-block";
-    wikiGuideBtn.classList.add("hack-mission-header-element");
-    wikiGuideBtn.target = "_blank";
-    //TODO Add link to wiki page     wikiGuideBtn.href =
-
-
-    //Start button will get replaced with forfeit when game is started
-    var startBtn = document.createElement("a");
-    startBtn.innerHTML = "Start";
-    startBtn.setAttribute("id", "hack-mission-start-btn");
-    startBtn.classList.add("a-link-button");
-    startBtn.classList.add("hack-mission-header-element");
-    startBtn.style.display = "inline-block";
-    startBtn.addEventListener("click", ()=>{
-        this.start();
-    });
-
-    var timer = document.createElement("p");
-    timer.setAttribute("id", "hacking-mission-timer");
-    timer.style.display = "inline-block";
-
-    //Create Action Buttons (Attack/Scan/Weaken/ etc...)
-    var actionsContainer = document.createElement("span");
-    actionsContainer.style.display = "block";
-    actionsContainer.classList.add("hack-mission-action-buttons-container");
-    for (var i = 0; i < 6; ++i) {
-        this.actionButtons.push(document.createElement("a"));
-        this.actionButtons[i].style.display = "inline-block";
-        this.actionButtons[i].classList.add("a-link-button-inactive"); //Disabled at start
-        this.actionButtons[i].classList.add("tooltip"); //Disabled at start
-        this.actionButtons[i].classList.add("hack-mission-header-element");
-        actionsContainer.appendChild(this.actionButtons[i]);
-    }
-    this.actionButtons[0].innerText = "Attack(a)";
-    var atkTooltip = document.createElement("span");
-    atkTooltip.classList.add("tooltiptext");
-    atkTooltip.innerText = "Lowers the targeted node's HP. The effectiveness of this depends on " +
-                           "this node's Attack level, your hacking level, and the opponent's defense level.";
-    this.actionButtons[0].appendChild(atkTooltip);
-    this.actionButtons[1].innerText = "Scan(s)";
-    var scanTooltip = document.createElement("span");
-    scanTooltip.classList.add("tooltiptext");
-    scanTooltip.innerText = "Lowers the targeted node's defense. The effectiveness of this depends on " +
-                            "this node's Attack level, your hacking level, and the opponent's defense level.";
-    this.actionButtons[1].appendChild(scanTooltip);
-    this.actionButtons[2].innerText = "Weaken(w)";
-    var WeakenTooltip = document.createElement("span");
-    WeakenTooltip.classList.add("tooltiptext");
-    WeakenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
-                              "this node's Attack level, your hacking level, and the opponent's defense level.";
-    this.actionButtons[2].appendChild(WeakenTooltip);
-    this.actionButtons[3].innerText = "Fortify(f)";
-    var fortifyTooltip = document.createElement("span");
-    fortifyTooltip.classList.add("tooltiptext");
-    fortifyTooltip.innerText = "Raises this node's Defense level. The effectiveness of this depends on " +
-                               "your hacking level";
-    this.actionButtons[3].appendChild(fortifyTooltip);
-    this.actionButtons[4].innerText = "Overflow(r)";
-    var overflowTooltip = document.createElement("span");
-    overflowTooltip.classList.add("tooltiptext");
-    overflowTooltip.innerText = "Raises this node's Attack level but lowers its Defense level. The effectiveness " +
-                                "of this depends on your hacking level.";
-    this.actionButtons[4].appendChild(overflowTooltip);
-    this.actionButtons[5].innerText = "Drop Connection(d)";
-    var dropconnTooltip = document.createElement("span");
-    dropconnTooltip.classList.add("tooltiptext");
-    dropconnTooltip.innerText = "Removes this Node's current connection to some target Node, if it has one. This can " +
-                                "also be done by simply clicking the white connection line.";
-    this.actionButtons[5].appendChild(dropconnTooltip);
-
-    //Player/enemy defense displays will be in action container
-    var playerDefense = document.createElement("p");
-    var enemyDefense = document.createElement("p");
-    playerDefense.style.display = "inline-block";
-    enemyDefense.style.display = "inline-block";
-    playerDefense.style.color = "blue";
-    enemyDefense.style.color = "red";
-    playerDefense.style.margin = "4px";
-    enemyDefense.style.margin = "4px";
-    playerDefense.setAttribute("id", "hacking-mission-player-def");
-    enemyDefense.setAttribute("id", "hacking-mission-enemy-def");
-    actionsContainer.appendChild(playerDefense);
-    actionsContainer.appendChild(enemyDefense);
-
-    //Set Action Button event listeners
-    this.actionButtons[0].addEventListener("click", ()=>{
-        if (!(this.selectedNode instanceof Node)) {
-            console.log("ERR: Pressing Action button without selected node");
-            return;
-        }
-        this.setActionButtonsActive();
-        this.setActionButton(NodeActions.Attack, false); //Set attack button inactive
-        this.selectedNode.action = NodeActions.Attack;
-    });
-
-    this.actionButtons[1].addEventListener("click", ()=>{
-        if (!(this.selectedNode instanceof Node)) {
-            console.log("ERR: Pressing Action button without selected node");
-            return;
-        }
-        this.setActionButtonsActive();
-        this.setActionButton(NodeActions.Scan, false); //Set scan button inactive
-        this.selectedNode.action = NodeActions.Scan;
-    });
-
-    this.actionButtons[2].addEventListener("click", ()=>{
-        if (!(this.selectedNode instanceof Node)) {
-            console.log("ERR: Pressing Action button without selected node");
-            return;
-        }
-        this.setActionButtonsActive();
-        this.setActionButton(NodeActions.Weaken, false); //Set Weaken button inactive
-        this.selectedNode.action = NodeActions.Weaken;
-    });
-
-    this.actionButtons[3].addEventListener("click", ()=>{
-        if (!(this.selectedNode instanceof Node)) {
-            console.log("ERR: Pressing Action button without selected node");
-            return;
-        }
-        this.setActionButtonsActive();
-        this.setActionButton(NodeActions.Fortify, false); //Set Fortify button inactive
-        this.selectedNode.action = NodeActions.Fortify;
-    });
-
-    this.actionButtons[4].addEventListener("click", ()=>{
-        if (!(this.selectedNode instanceof Node)) {
-            console.log("ERR: Pressing Action button without selected node");
-            return;
-        }
-        this.setActionButtonsActive();
-        this.setActionButton(NodeActions.Overflow, false); //Set Overflow button inactive
-        this.selectedNode.action = NodeActions.Overflow;
-    });
-
-    this.actionButtons[5].addEventListener("click", ()=>{
-        if (!(this.selectedNode instanceof Node)) {
-            console.log("ERR: Pressing Action button without selected node");
-            return;
-        }
-        if (this.selectedNode.conn) {
-            var endpoints = this.selectedNode.conn.endpoints;
-            endpoints[0].detachFrom(endpoints[1]);
-        }
-    })
-
-    var timeDisplay = document.createElement("p");
-
-    container.appendChild(headerText);
-    container.appendChild(inGameGuideBtn);
-    container.appendChild(wikiGuideBtn);
-    container.appendChild(startBtn);
-    container.appendChild(timer);
-    container.appendChild(actionsContainer);
-    container.appendChild(timeDisplay);
-}
-
-HackingMission.prototype.setActionButtonsInactive = function() {
-    for (var i = 0; i < this.actionButtons.length; ++i) {
-        this.actionButtons[i].classList.remove("a-link-button");
-        this.actionButtons[i].classList.add("a-link-button-inactive");
-    }
-}
-
-HackingMission.prototype.setActionButtonsActive = function() {
-    for (var i = 0; i < this.actionButtons.length; ++i) {
-        this.actionButtons[i].classList.add("a-link-button");
-        this.actionButtons[i].classList.remove("a-link-button-inactive");
-    }
-}
-
-//True for active, false for inactive
-HackingMission.prototype.setActionButton = function(i, active=true) {
-    if (Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["f" /* isString */])(i)) {
-        switch (i) {
-            case NodeActions.Attack:
-                i = 0;
-                break;
-            case NodeActions.Scan:
-                i = 1;
-                break;
-            case NodeActions.Weaken:
-                i = 2;
-                break;
-            case NodeActions.Fortify:
-                i = 3;
-                break;
-            case NodeActions.Overflow:
-            default:
-                i = 4;
-                break;
-        }
-    }
-    if (active) {
-        this.actionButtons[i].classList.remove("a-link-button-inactive");
-        this.actionButtons[i].classList.add("a-link-button");
-    } else {
-        this.actionButtons[i].classList.remove("a-link-button");
-        this.actionButtons[i].classList.add("a-link-button-inactive");
-    }
-
-}
-
-//Should only be used at the start
-HackingMission.prototype.calculateDefenses = function() {
-    var total = 0;
-    for (var i = 0; i < this.playerCores.length; ++i) {
-        total += this.playerCores[i].def;
-    }
-    for (var i = 0; i < this.playerNodes.length; ++i) {
-        total += this.playerNodes[i].def;
-    }
-    this.playerDef = total;
-    document.getElementById("hacking-mission-player-def").innerText =
-        "Player Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerDef, 1);
-    total = 0;
-    for (var i = 0; i < this.enemyCores.length; ++i) {
-        total += this.enemyCores[i].def;
-    }
-    for (var i = 0; i < this.enemyDatabases.length; ++i) {
-        total += this.enemyDatabases[i].def;
-    }
-    for (var i = 0; i < this.enemyNodes.length; ++i) {
-        total += this.enemyNodes[i].def;
-    }
-    this.enemyDef = total;
-    document.getElementById("hacking-mission-enemy-def").innerText =
-        "Enemy Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyDef, 1);
-}
-
-HackingMission.prototype.removeAvailablePosition = function(x, y) {
-    for (var i = 0; i < this.availablePositions.length; ++i) {
-        if (this.availablePositions[i][0] === x &&
-            this.availablePositions[i][1] === y) {
-            this.availablePositions.splice(i, 1);
-            return;
-        }
-    }
-    console.log("WARNING: removeAvailablePosition() did not remove " + x + ", " + y);
-}
-
-HackingMission.prototype.setNodePosition = function(nodeObj, x, y) {
-    if (!(nodeObj instanceof Node)) {
-        console.log("WARNING: Non-Node object passed into setNodePOsition");
-        return;
-    }
-    if (isNaN(x) || isNaN(y)) {
-        console.log("ERR: Invalid values passed as x and y for setNodePosition");
-        console.log(x);
-        console.log(y);
-        return;
-    }
-    nodeObj.pos = [x, y];
-    this.map[x][y] = nodeObj;
-}
-
-HackingMission.prototype.setNodeRandomPosition = function(nodeObj, xlimit=0) {
-    var i = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.availablePositions.length - 1);
-    var pos = this.availablePositions.splice(i, 1);
-    pos = pos[0];
-    this.setNodePosition(nodeObj, pos[0], pos[1]);
-}
-
-HackingMission.prototype.createMap = function() {
-    //Use a grid
-    var map = document.createElement("div");
-    map.classList.add("hack-mission-grid");
-    map.setAttribute("id", "hacking-mission-map");
-    document.getElementById("mission-container").appendChild(map);
-
-    //Create random Nodes for every space in the map that
-    //hasn't been filled yet
-    for (var x = 0; x < 8; ++x) {
-        for (var y = 0; y < 8; ++y) {
-            if (!(this.map[x][y] instanceof Node)) {
-                var node, type = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, 2);
-                var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(this.difficulty, 20);
-                switch (type) {
-                    case 0: //Spam
-                        var stats = {
-                            atk: 0,
-                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(30, 40),
-                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 90)
-                        }
-                        node = new Node(NodeTypes.Spam, stats);
-                        break;
-                    case 1: //Transfer
-                        var stats = {
-                            atk: 0,
-                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 70),
-                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(80, 95)
-                        }
-                        node = new Node(NodeTypes.Transfer, stats);
-                        break;
-                    case 2: //Shield
-                    default:
-                        var stats = {
-                            atk: 0,
-                            def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(90, 105),
-                            hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(130, 150)
-                        }
-                        node = new Node(NodeTypes.Shield, stats);
-                        break;
-                }
-                this.setNodePosition(node, x, y);
-                this.removeAvailablePosition(x, y);
-                this.miscNodes.push(node);
-            }
-        }
-    }
-
-    //Create DOM elements in order
-    for (var r = 0; r < 8; ++r) {
-        for (var c = 0; c < 8; ++c) {
-            this.createNodeDomElement(this.map[r][c]);
-        }
-    }
-
-    //Configure all Player CPUS
-    for (var i = 0; i < this.playerCores.length; ++i) {
-        console.log("Configuring Player Node: " + this.playerCores[i].el.id);
-        this.configurePlayerNodeElement(this.playerCores[i].el);
-    }
-}
-
-HackingMission.prototype.createNodeDomElement = function(nodeObj) {
-    var nodeDiv = document.createElement("a");
-    nodeObj.el = nodeDiv;
-    document.getElementById("hacking-mission-map").appendChild(nodeDiv);
-
-    //Set the node element's id based on its coordinates
-    nodeDiv.setAttribute("id", "hacking-mission-node-" +
-                                nodeObj.pos[0] + "-" +
-                                nodeObj.pos[1]);
-
-    //Set node classes for owner
-    nodeDiv.classList.add("hack-mission-node");
-    if (nodeObj.plyrCtrl) {
-        nodeDiv.classList.add("hack-mission-player-node");
-    } else if (nodeObj.enmyCtrl) {
-        nodeDiv.classList.add("hack-mission-enemy-node");
-    }
-
-    //Set node classes based on type
-    var txt;
-    switch (nodeObj.type) {
-        case NodeTypes.Core:
-            txt = "<p>CPU Core<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            nodeDiv.classList.add("hack-mission-cpu-node");
-            break;
-        case NodeTypes.Firewall:
-            txt = "<p>Firewall<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            nodeDiv.classList.add("hack-mission-firewall-node");
-            break;
-        case NodeTypes.Database:
-            txt = "<p>Database<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            nodeDiv.classList.add("hack-mission-database-node");
-            break;
-        case NodeTypes.Spam:
-            txt = "<p>Spam<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            nodeDiv.classList.add("hack-mission-spam-node");
-            break;
-        case NodeTypes.Transfer:
-            txt = "<p>Transfer<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            nodeDiv.classList.add("hack-mission-transfer-node");
-            break;
-        case NodeTypes.Shield:
-        default:
-            txt = "<p>Shield<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            nodeDiv.classList.add("hack-mission-shield-node");
-            break;
-    }
-
-    txt += "<br>Atk: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
-           "<br>Def: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1) + "</p>";
-    nodeDiv.innerHTML = txt;
-}
-
-HackingMission.prototype.updateNodeDomElement = function(nodeObj) {
-    if (nodeObj.el === null) {
-        console.log("ERR: Calling updateNodeDomElement on a Node without an element");
-        return;
-    }
-
-    var nodeDiv = document.getElementById("hacking-mission-node-" +
-                                          nodeObj.pos[0] + "-" +
-                                          nodeObj.pos[1]);
-
-    //Set node classes based on type
-    var txt;
-    switch (nodeObj.type) {
-        case NodeTypes.Core:
-            txt = "<p>CPU Core<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            break;
-        case NodeTypes.Firewall:
-            txt = "<p>Firewall<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            break;
-        case NodeTypes.Database:
-            txt = "<p>Database<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            break;
-        case NodeTypes.Spam:
-            txt = "<p>Spam<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            break;
-        case NodeTypes.Transfer:
-            txt = "<p>Transfer<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            break;
-        case NodeTypes.Shield:
-        default:
-            txt = "<p>Shield<br>" + "HP: " +
-                  Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
-            break;
-    }
-
-    txt += "<br>Atk: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
-           "<br>Def: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1);
-    if (nodeObj.action) {
-        txt += "<br>" + nodeObj.action;
-    }
-    txt += "</p>";
-    nodeDiv.innerHTML = txt;
-}
-
-//Gets a Node DOM element's corresponding Node object using its
-//element id
-HackingMission.prototype.getNodeFromElement = function(el) {
-    var id = el.id;
-    id = id.replace("hacking-mission-node-", "");
-    var res = id.split('-');
-    if (res.length != 2) {
-        console.log("ERROR Parsing Hacking Mission Node Id. Could not find coordinates");
-        return null;
-    }
-    var x = res[0], y = res[1];
-    if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) {
-        console.log("ERROR: Unexpected values for x and y: " + x + ", " + y);
-        return null;
-    }
-    return this.map[x][y];
-}
-
-//Configures a DOM element representing a player-owned node to
-//be selectable and actionable
-//Note: Does NOT change its css class. This is handled by Node.setControlledBy...
-HackingMission.prototype.configurePlayerNodeElement = function(el) {
-    var nodeObj = this.getNodeFromElement(el);
-    if (nodeObj === null) {console.log("Error getting Node object");}
-
-    //Add event listener
-    el.addEventListener("click", ()=>{
-        if (this.selectedNode instanceof Node) {
-            this.selectedNode.deselect(this.actionButtons);
-            this.selectedNode = null;
-        }
-        console.log("Selecting node :" + el.id);
-        nodeObj.select(this.actionButtons);
-        this.selectedNode = nodeObj;
-    });
-}
-
-//Configures a DOM element representing an enemy-node by removing
-//any event listeners
-HackingMission.prototype.configureEnemyNodeElement = function(el) {
-    //Deselect node if it was the selected node
-    var nodeObj = this.getNodeFromElement(el);
-    if (this.selectedNode == nodeObj) {
-        nodeObj.deselect(this.actionButtons);
-    }
-
-    //TODO Need to remove event listeners
-}
-
-//Returns bool indicating whether a node is reachable by player
-//by checking if any of the adjacent nodes are owned by the player
-HackingMission.prototype.nodeReachable = function(node) {
-    var x = node.pos[0], y = node.pos[1];
-    if (x > 0 && this.map[x-1][y].plyrCtrl) {return true;}
-    if (x < 7 && this.map[x+1][y].plyrCtrl) {return true;}
-    if (y > 0 && this.map[x][y-1].plyrCtrl) {return true;}
-    if (y < 7 && this.map[x][y+1].plyrCtrl) {return true;}
-    return false;
-}
-
-HackingMission.prototype.start = function() {
-    this.started = true;
-    this.initJsPlumb();
-    var startBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hack-mission-start-btn");
-    startBtn.innerHTML = "Forfeit Mission";
-    startBtn.addEventListener("click", ()=>{
-        this.finishMission(false);
-        return false;
-    });
-}
-
-HackingMission.prototype.initJsPlumb = function() {
-    var instance = jsPlumb.getInstance({
-        DragOptions:{cursor:"pointer", zIndex:2000},
-        PaintStyle: {
-            gradient: { stops: [
-                [ 0, "#FFFFFF" ],
-                [ 1, "#FFFFFF" ]
-            ] },
-            stroke: "#FFFFFF",
-            strokeWidth: 8
-        },
-    });
-
-    this.jsplumbinstance = instance;
-
-    //All player cores are sources
-    for (var i = 0; i < this.playerCores.length; ++i) {
-        instance.makeSource(this.playerCores[i].el, {
-            deleteEndpointsOnEmpty:true,
-            maxConnections:1,
-            anchor:"Center",
-            connector:"Straight"
-        });
-    }
-
-    //Everything else is a target
-    for (var i = 0; i < this.enemyCores.length; ++i) {
-        instance.makeTarget(this.enemyCores[i].el, {
-            maxConnections:-1,
-            anchor:"Center",
-            connector:"Straight"
-        });
-    }
-    for (var i = 0; i < this.enemyDatabases.length; ++i) {
-        instance.makeTarget(this.enemyDatabases[i].el, {
-            maxConnections:-1,
-            anchor:"Center",
-            connector:["Straight"]
-        });
-    }
-    for (var i = 0; i < this.enemyNodes.length; ++i) {
-        instance.makeTarget(this.enemyNodes[i].el, {
-            maxConnections:-1,
-            anchor:"Center",
-            connector:"Straight"
-        });
-    }
-    for (var i = 0; i < this.miscNodes.length; ++i) {
-        instance.makeTarget(this.miscNodes[i].el, {
-            maxConnections:-1,
-            anchor:"Center",
-            connector:"Straight"
-        });
-    }
-
-    //Clicking a connection drops it
-    instance.bind("click", function(conn, originalEvent) {
-        var endpoints = conn.endpoints;
-        endpoints[0].detachFrom(endpoints[1]);
-    });
-
-    //Connection events
-    instance.bind("connection", (info)=>{
-        var targetNode = this.getNodeFromElement(info.target);
-
-        //If the node is not reachable, drop the connection
-        if (!this.nodeReachable(targetNode)) {
-            info.sourceEndpoint.detachFrom(info.targetEndpoint);
-            return;
-        }
-
-        var sourceNode = this.getNodeFromElement(info.source);
-        sourceNode.conn = info.connection;
-    });
-
-    //Detach Connection events
-    instance.bind("connectionDetached", (info, originalEvent)=>{
-        var sourceNode = this.getNodeFromElement(info.source);
-        sourceNode.conn = null;
-    });
-}
-
-//Drops all connections where the specified node is the source
-HackingMission.prototype.dropAllConnectionsFromNode = function(node) {
-    var allConns = this.jsplumbinstance.getAllConnections();
-    for (var i = allConns.length-1; i >= 0; --i) {
-        if (allConns[i].source == node.el) {
-            allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
-        }
-    }
-}
-
-//Drops all connections where the specified node is the target
-HackingMission.prototype.dropAllConnectionsToNode = function(node) {
-    var allConns = this.jsplumbinstance.getAllConnections();
-    for (var i = allConns.length-1; i >= 0; --i) {
-        if (allConns[i].target == node.el) {
-            allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
-        }
-    }
-}
-
-HackingMission.prototype.process = function(numCycles=1) {
-    if (!this.started) {return;}
-    var res = false;
-    //Process actions of all player nodes
-    this.playerCores.forEach((node)=>{
-        res |= this.processNode(node, numCycles);
-    });
-
-    this.playerNodes.forEach((node)=>{
-        if (node.type === NodeTypes.Transfer) {
-            res |= this.processNode(node, numCycles);
-        }
-    });
-
-    //Process actions of all enemy nodes
-    this.enemyCores.forEach((node)=>{
-        res |= this.processNode(node, numCycles);
-    });
-
-    this.enemyNodes.forEach((node)=>{
-        if (node.type === NodeTypes.Transfer) {
-            res |= this.processNode(node, numCycles);
-        }
-    });
-
-    if (res) {this.calculateDefenses();}
-
-    if (this.enemyDatabases.length === 0) {
-        this.finishMission(true);
-        return;
-    }
-
-    //Update timer and check if player lost
-    this.time -= (numCycles * __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"]._idleSpeed);
-    if (this.time <= 0) {
-        this.finishMission(false);
-        return;
-    }
-    this.updateTimer();
-}
-
-//Returns a bool representing whether defenses need to be re-calculated
-HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
-    if (nodeObj.action === null) {
-        return;
-    }
-
-    var targetNode = null, def;
-    if (nodeObj.conn) {
-        targetNode = this.getNodeFromElement(nodeObj.conn.target);
-        if (targetNode.plyrCtrl) {
-            def = this.playerDef;
-        } else if (targetNode.enmyCtrl) {
-            def = this.enemyDef;
-        } else { //Misc Node
-            def = targetNode.def;
-        }
-    }
-
-    //Calculations are per second, so divide everything by 5
-    var calcDefenses = false;
-    switch(nodeObj.action) {
-        case NodeActions.Attack:
-            if (nodeObj.conn === null) {break;}
-            var dmg = this.calculateAttackDamage(nodeObj.atk, def, __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
-            targetNode.hp -= (dmg/5 * numCycles);
-            break;
-        case NodeActions.Scan:
-            if (nodeObj.conn === null) {break;}
-            var eff = this.calculateScanEffect(nodeObj.atk, def, __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
-            targetNode.def -= (eff/5 * numCycles);
-            calcDefenses = true;
-            break;
-        case NodeActions.Weaken:
-            if (nodeObj.conn === null) {break;}
-            var eff = this.calculateWeakenEffect(nodeObj.atk, def, __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
-            targetNode.atk -= (eff/5 * numCycles);
-            break;
-        case NodeActions.Fortify:
-            var eff = this.calculateFortifyEffect(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
-            nodeObj.def += (eff/5 * numCycles);
-            calcDefenses = true;
-            break;
-        case NodeActions.Overflow:
-            var eff = this.calculateOverflowEffect(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
-            if (nodeObj.def < eff) {break;}
-            nodeObj.def -= (eff/5 * numCycles);
-            nodeObj.atk += (eff/5 * numCycles);
-            calcDefenses = true;
-            break;
-        default:
-            console.log("ERR: Invalid Node Action: " + nodeObj.action);
-            break;
-    }
-
-    //Stats can't go below 0
-    if (nodeObj.atk < 0) {nodeObj.atk = 0;}
-    if (nodeObj.def < 0) {nodeObj.def = 0;}
-    if (targetNode && targetNode.atk < 0) {targetNode.atk = 0;}
-    if (targetNode && targetNode.def < 0) {targetNode.def = 0;}
-
-    //Conquering a node
-    if (targetNode && targetNode.hp <= 0) {
-        var conqueredByPlayer = nodeObj.plyrCtrl;
-        targetNode.hp = targetNode.maxhp;
-        targetNode.action = null;
-        targetNode.conn = null;
-        if (this.selectedNode == targetNode) {
-            targetNode.deselect();
-        }
-
-        //Flag for whether the target node was a misc node
-        var isMiscNode = !targetNode.plyrCtrl && !targetNode.enmyCtrl;
-        console.log("isMiscNode: " + isMiscNode);
-
-        //Remove all connections from Node
-        this.dropAllConnectionsToNode(targetNode);
-        this.dropAllConnectionsFromNode(targetNode);
-
-        //Changes the css class and turn the node into a JsPlumb Source/Target
-        if (conqueredByPlayer) {
-            targetNode.setControlledByPlayer();
-            this.jsplumbinstance.unmakeTarget(targetNode.el);
-            this.jsplumbinstance.makeSource(targetNode.el, {
-                deleteEndpointsOnEmpty:true,
-                maxConnections:1,
-                anchor:"Center",
-                connector:"Straight"
-            });
-        } else {
-            targetNode.setControlledByEnemy();
-            this.jsplumbinstance.unmakeSource(targetNode.el);
-            this.jsplumbinstance.makeTarget(targetNode.el, {
-                maxConnections:-1,
-                anchor:"Center",
-                connector:["Straight"]
-            });
-        }
-
-        calcDefenses = true;
-
-        //Helper function to swap nodes between the respective enemyNodes/playerNodes arrays
-        function swapNodes(orig, dest, targetNode) {
-            console.log("swapNodes called");
-            for (var i = 0; i < orig.length; ++i) {
-                if (orig[i] == targetNode) {
-                    console.log("Swapping nodes");
-                    var node = orig.splice(i, 1);
-                    node = node[0];
-                    dest.push(node);
-                    break;
-                }
-            }
-        }
-
-        //Whether conquered node was a misc node
-        switch(targetNode.type) {
-            case NodeTypes.Core:
-                if (conqueredByPlayer) {
-                    swapNodes(this.enemyCores, this.playerCores, targetNode);
-                    this.configurePlayerNodeElement(targetNode.el);
-                } else {
-                    swapNodes(this.playerCores, this.enemyCores, targetNode);
-                    this.configureEnemyNodeElement(targetNode.el);
-                }
-                break;
-            case NodeTypes.Firewall:
-                if (conqueredByPlayer) {
-                    swapNodes(this.enemyNodes, this.playerNodes, targetNode);
-                } else {
-                    swapNodes(this.playerNodes, this.enemyNodes, targetNode);
-                }
-                break;
-            case NodeTypes.Database:
-                if (conqueredByPlayer) {
-                    swapNodes(this.enemyDatabases, this.playerNodes, targetNode);
-                } else {
-                    swapNodes(this.playerNodes, this.enemyDatabases, targetNode);
-                }
-                break;
-            case NodeTypes.Spam:
-                if (conqueredByPlayer) {
-                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
-                } else {
-                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
-                }
-
-                //Conquering spam node increases time limit
-                this.time += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionSpamTimeIncrease;
-                break;
-            case NodeTypes.Transfer:
-                //Conquering a Transfer node increases the attack of all cores by some percentages
-                if (conqueredByPlayer) {
-                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
-                    this.playerCores.forEach(function(node) {
-                        node.atk *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionTransferAttackIncrease;
-                    });
-                    this.configurePlayerNodeElement(targetNode.el);
-                } else {
-                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
-                    this.enemyCores.forEach(function(node) {
-                        node.atk *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionTransferAttackIncrease;
-                    });
-                    this.configureEnemyNodeElement(targetNode.el);
-                }
-                break;
-            case NodeTypes.Shield:
-                if (conqueredByPlayer) {
-                    swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
-                } else {
-                    swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
-                }
-                break;
-        }
-    }
-    this.updateNodeDomElement(nodeObj);
-    if (targetNode) {this.updateNodeDomElement(targetNode);}
-    return calcDefenses;
-}
-
-var hackEffWeightSelf = 100; //Weight for Node actions on self
-var hackEffWeightTarget = 15; //Weight for Node Actions against Target
-var hackEffWeightAttack = 100; //Weight for Attack action
-
-//Returns damage per cycle based on stats
-HackingMission.prototype.calculateAttackDamage = function(atk, def, hacking = 0) {
-    return Math.max(atk + (hacking / hackEffWeightAttack) - def, 0.1);
-}
-
-HackingMission.prototype.calculateScanEffect = function(atk, def, hacking=0) {
-    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 0.1);
-}
-
-HackingMission.prototype.calculateWeakenEffect = function(atk, def, hacking=0) {
-    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 0.1);
-}
-
-HackingMission.prototype.calculateFortifyEffect = function(hacking=0) {
-    return hacking / hackEffWeightSelf;
-}
-
-HackingMission.prototype.calculateOverflowEffect = function(hacking=0) {
-    return hacking / hackEffWeightSelf;
-}
-
-//Updates timer display
-HackingMission.prototype.updateTimer = function() {
-    var timer = document.getElementById("hacking-mission-timer");
-
-    //Convert time remaining to a string of the form m:ss
-    var seconds = Math.round(this.time / 1000);
-    var minutes = Math.trunc(seconds / 60);
-    seconds %= 60;
-    var str = ("0" + minutes).slice(-2) + ":" + ("0" + seconds).slice(-2);
-    timer.innerText = "Time left: " + str;
-}
-
-//The 'win' argument is a bool for whether or not the player won
-HackingMission.prototype.finishMission = function(win) {
-    inMission = false;
-    currMission = null;
-
-    if (win) {
-        Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Mission won!");
-    } else {
-        Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Mission lost!");
-    }
-
-    //Clear mission container
-    var container = document.getElementById("mission-container");
-    while(container.firstChild) {
-        container.removeChild(container.firstChild);
-    }
-
-    //Return to Faction page
-    document.getElementById("mainmenu-container").style.visibility = "visible";
-    document.getElementById("character-overview-wrapper").style.visibility = "visible";
-    __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadFactionContent();
-    Object(__WEBPACK_IMPORTED_MODULE_2__Faction_js__["c" /* displayFactionContent */])(this.faction.name);
-}
-
-
-
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(7)))
-
-/***/ }),
-/* 39 */
+/* 40 */
 /***/ (function(module, exports) {
 
 module.exports = function() {
@@ -39484,14 +39922,14 @@ module.exports = function() {
 
 
 /***/ }),
-/* 40 */
+/* 41 */
 /***/ (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.column<point2.column;return point1.row<point2.row||point1.row==point2.row&&bColIsAfter}function $getTransformedPoint(delta,point,moveIfEqual){var deltaIsInsert=\"insert\"==delta.action,deltaRowShift=(deltaIsInsert?1:-1)*(delta.end.row-delta.start.row),deltaColShift=(deltaIsInsert?1:-1)*(delta.end.column-delta.start.column),deltaStart=delta.start,deltaEnd=deltaIsInsert?deltaStart:delta.end;return $pointsInOrder(point,deltaStart,moveIfEqual)?{row:point.row,column:point.column}:$pointsInOrder(deltaEnd,point,!moveIfEqual)?{row:point.row+deltaRowShift,column:point.column+(point.row==deltaEnd.row?deltaColShift:0)}:{row:deltaStart.row,column:deltaStart.column}}oop.implement(this,EventEmitter),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(delta){if(!(delta.start.row==delta.end.row&&delta.start.row!=this.row||delta.start.row>this.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,\"&#38;\").replace(/\"/g,\"&#34;\").replace(/'/g,\"&#39;\").replace(/</g,\"&#60;\")},exports.getMatchOffsets=function(string,regExp){var matches=[];return string.replace(regExp,function(str){matches.push({offset:arguments[arguments.length-2],length:str.length})}),matches},exports.deferredCall=function(fcn){var timer=null,callback=function(){timer=null,fcn()},deferred=function(timeout){return deferred.cancel(),timer=setTimeout(callback,timeout||0),deferred};return deferred.schedule=deferred,deferred.call=function(){return this.cancel(),fcn(),deferred},deferred.cancel=function(){return clearTimeout(timer),timer=null,deferred},deferred.isPending=function(){return timer},deferred},exports.delayedCall=function(fcn,defaultTimeout){var timer=null,callback=function(){timer=null,fcn()},_self=function(timeout){null==timer&&(timer=setTimeout(callback,timeout||defaultTimeout))};return _self.delay=function(timeout){timer&&clearTimeout(timer),timer=setTimeout(callback,timeout||defaultTimeout)},_self.schedule=_self,_self.call=function(){this.cancel(),fcn()},_self.cancel=function(){timer&&clearTimeout(timer),timer=null},_self.isPending=function(){return timer},_self}}),ace.define(\"ace/worker/mirror\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/document\",\"ace/lib/lang\"],function(acequire,exports){\"use strict\";acequire(\"../range\").Range;var Document=acequire(\"../document\").Document,lang=acequire(\"../lib/lang\"),Mirror=exports.Mirror=function(sender){this.sender=sender;var doc=this.doc=new Document(\"\"),deferredUpdate=this.deferredUpdate=lang.delayedCall(this.onUpdate.bind(this)),_self=this;sender.on(\"change\",function(e){var data=e.data;if(data[0].start)doc.applyDeltas(data);else for(var i=0;data.length>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&&currentRequire)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&&reg.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<state.tokens.next.lbp),isNecessary||warning(\"W126\",opening),ret.paren=!0),ret):void 0}),application(\"=>\"),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&&reg.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&&reg.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:[\"<non-printable>\"]}),\"\\\\\"===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<this.input.length){var inComment=this.inComment||startsWith.call(inputTrimmed,\"//\")||startsWith.call(inputTrimmed,\"/*\"),shouldTriggerError=!inComment||!reg.maxlenException.test(inputTrimmed);shouldTriggerError&&this.trigger(\"warning\",{code:\"W101\",line:this.line,character:this.input.length})}return!0},start:function(){this.nextLine()},token:function(){function isReserved(token,isProperty){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(isProperty)return!1}return!0}for(var token,checks=asyncTrigger(),create=function(type,value,isProperty,token){var obj;if(\"(endline)\"!==type&&\"(end)\"!==type&&(this.prereg=!1),\"(punctuator)\"===type){switch(value){case\".\":case\")\":case\"~\":case\"#\":case\"]\":case\"++\":case\"--\":this.prereg=!1;break;default:this.prereg=!0}obj=Object.create(state.syntax[value]||state.syntax[\"(error)\"])}return\"(identifier)\"===type&&((\"return\"===value||\"case\"===value||\"typeof\"===value)&&(this.prereg=!0),_.has(state.syntax,value)&&(obj=Object.create(state.syntax[value]||state.syntax[\"(error)\"]),isReserved(obj,isProperty&&\"(identifier)\"===type)||(obj=null))),obj||(obj=Object.create(state.syntax[type])),obj.identifier=\"(identifier)\"===type,obj.type=obj.type||type,obj.value=value,obj.line=this.line,obj.character=this.char,obj.from=this.from,obj.identifier&&token&&(obj.raw_text=token.text||token.value),token&&token.startLine&&token.startLine!==this.line&&(obj.startLine=token.startLine),token&&token.context&&(obj.context=token.context),token&&token.depth&&(obj.depth=token.depth),token&&token.isUnclosed&&(obj.isUnclosed=token.isUnclosed),isProperty&&obj.identifier&&(obj.isProperty=isProperty),obj.check=checks.check,obj}.bind(this);;){if(!this.input.length)return this.nextLine()?create(\"(endline)\",\"\"):this.exhausted?null:(this.exhausted=!0,create(\"(end)\",\"\"));if(token=this.next(checks))switch(token.type){case Token.StringLiteral:return this.triggerAsync(\"String\",{line:this.line,\"char\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value,quote:token.quote},checks,function(){return!0}),create(\"(string)\",token.value,null,token);case Token.TemplateHead:return this.trigger(\"TemplateHead\",{line:this.line,\"char\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\"(template)\",token.value,null,token);case Token.TemplateMiddle:return this.trigger(\"TemplateMiddle\",{line:this.line,\"char\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\"(template middle)\",token.value,null,token);case Token.TemplateTail:return this.trigger(\"TemplateTail\",{line:this.line,\"char\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\"(template tail)\",token.value,null,token);case Token.NoSubstTemplate:return this.trigger(\"NoSubstTemplate\",{line:this.line,\"char\":this.char,from:this.from,startLine:token.startLine,startChar:token.startChar,value:token.value}),create(\"(no subst template)\",token.value,null,token);case Token.Identifier:this.triggerAsync(\"Identifier\",{line:this.line,\"char\":this.char,from:this.form,name:token.value,raw_name:token.text,isProperty:\".\"===state.tokens.curr.id},checks,function(){return!0});case Token.Keyword:case Token.NullLiteral:case Token.BooleanLiteral:return create(\"(identifier)\",token.value,\".\"===state.tokens.curr.id,token);case Token.NumericLiteral:return token.isMalformed&&this.trigger(\"warning\",{code:\"W045\",line:this.line,character:this.char,data:[token.value]}),this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"0x-\"]},checks,function(){return 16===token.base&&state.jsonMode}),this.triggerAsync(\"warning\",{code:\"W115\",line:this.line,character:this.char},checks,function(){return state.isStrict()&&8===token.base&&token.isLegacy}),this.trigger(\"Number\",{line:this.line,\"char\":this.char,from:this.from,value:token.value,base:token.base,isMalformed:token.malformed}),create(\"(number)\",token.value);case Token.RegExp:return create(\"(regexp)\",token.value);case Token.Comment:if(state.tokens.curr.comment=!0,token.isSpecial)return{id:\"(comment)\",value:token.value,body:token.body,type:token.commentType,isSpecial:token.isSpecial,line:this.line,character:this.char,from:this.from};break;case\"\":break;default:return create(\"(punctuator)\",token.value)}else this.input.length&&(this.trigger(\"error\",{code:\"E024\",line:this.line,character:this.char,data:[this.peek()]}),this.input=\"\")}}},exports.Lexer=Lexer,exports.Context=Context},{\"../data/ascii-identifier-data.js\":\"/node_modules/jshint/data/ascii-identifier-data.js\",\"../lodash\":\"/node_modules/jshint/lodash.js\",\"./reg.js\":\"/node_modules/jshint/src/reg.js\",\"./state.js\":\"/node_modules/jshint/src/state.js\",events:\"/node_modules/browserify/node_modules/events/events.js\"}],\"/node_modules/jshint/src/messages.js\":[function(_dereq_,module,exports){\"use strict\";var _=_dereq_(\"../lodash\"),errors={E001:\"Bad option: '{a}'.\",E002:\"Bad option value.\",E003:\"Expected a JSON value.\",E004:\"Input is neither a string nor an array of strings.\",E005:\"Input is empty.\",E006:\"Unexpected early end of program.\",E007:'Missing \"use strict\" statement.',E008:\"Strict violation.\",E009:\"Option 'validthis' can't be used in a global scope.\",E010:\"'with' is not allowed in strict mode.\",E011:\"'{a}' has already been declared.\",E012:\"const '{a}' is initialized to 'undefined'.\",E013:\"Attempting to override '{a}' which is a constant.\",E014:\"A regular expression literal can be confused with '/='.\",E015:\"Unclosed regular expression.\",E016:\"Invalid regular expression.\",E017:\"Unclosed comment.\",E018:\"Unbegun comment.\",E019:\"Unmatched '{a}'.\",E020:\"Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.\",E021:\"Expected '{a}' and instead saw '{b}'.\",E022:\"Line breaking error '{a}'.\",E023:\"Missing '{a}'.\",E024:\"Unexpected '{a}'.\",E025:\"Missing ':' on a case clause.\",E026:\"Missing '}' to match '{' from line {a}.\",E027:\"Missing ']' to match '[' from line {a}.\",E028:\"Illegal comma.\",E029:\"Unclosed string.\",E030:\"Expected an identifier and instead saw '{a}'.\",E031:\"Bad assignment.\",E032:\"Expected a small integer or 'false' and instead saw '{a}'.\",E033:\"Expected an operator and instead saw '{a}'.\",E034:\"get/set are ES5 features.\",E035:\"Missing property name.\",E036:\"Expected to see a statement and instead saw a block.\",E037:null,E038:null,E039:\"Function declarations are not invocable. Wrap the whole function invocation in parens.\",E040:\"Each value should have its own case label.\",E041:\"Unrecoverable syntax error.\",E042:\"Stopping.\",E043:\"Too many errors.\",E044:null,E045:\"Invalid for each loop.\",E046:\"A yield statement shall be within a generator function (with syntax: `function*`)\",E047:null,E048:\"{a} declaration not directly within block.\",E049:\"A {a} cannot be named '{b}'.\",E050:\"Mozilla acequires the yield expression to be parenthesized here.\",E051:null,E052:\"Unclosed template literal.\",E053:\"Export declaration must be in global scope.\",E054:\"Class properties must be methods. Expected '(' but instead saw '{a}'.\",E055:\"The '{a}' option cannot be set after any executable code.\",E056:\"'{a}' was used before it was declared, which is illegal for '{b}' variables.\",E057:\"Invalid meta property: '{a}.{b}'.\",E058:\"Missing semicolon.\"},warnings={W001:\"'hasOwnProperty' is a really bad name.\",W002:\"Value of '{a}' may be overwritten in IE 8 and earlier.\",W003:\"'{a}' was used before it was defined.\",W004:\"'{a}' is already defined.\",W005:\"A dot following a number can be confused with a decimal point.\",W006:\"Confusing minuses.\",W007:\"Confusing plusses.\",W008:\"A leading decimal point can be confused with a dot: '{a}'.\",W009:\"The array literal notation [] is preferable.\",W010:\"The object literal notation {} is preferable.\",W011:null,W012:null,W013:null,W014:\"Bad line breaking before '{a}'.\",W015:null,W016:\"Unexpected use of '{a}'.\",W017:\"Bad operand.\",W018:\"Confusing use of '{a}'.\",W019:\"Use the isNaN function to compare with NaN.\",W020:\"Read only.\",W021:\"Reassignment of '{a}', which is is a {b}. Use 'var' or 'let' to declare bindings that may change.\",W022:\"Do not assign to the exception parameter.\",W023:\"Expected an identifier in an assignment and instead saw a function invocation.\",W024:\"Expected an identifier and instead saw '{a}' (a reserved word).\",W025:\"Missing name in function declaration.\",W026:\"Inner functions should be listed at the top of the outer function.\",W027:\"Unreachable '{a}' after '{b}'.\",W028:\"Label '{a}' on {b} statement.\",W030:\"Expected an assignment or function call and instead saw an expression.\",W031:\"Do not use 'new' for side effects.\",W032:\"Unnecessary semicolon.\",W033:\"Missing semicolon.\",W034:'Unnecessary directive \"{a}\".',W035:\"Empty block.\",W036:\"Unexpected /*member '{a}'.\",W037:\"'{a}' is a statement label.\",W038:\"'{a}' used out of scope.\",W039:\"'{a}' is not allowed.\",W040:\"Possible strict violation.\",W041:\"Use '{a}' to compare with '{b}'.\",W042:\"Avoid EOL escaping.\",W043:\"Bad escaping of EOL. Use option multistr if needed.\",W044:\"Bad or unnecessary escaping.\",W045:\"Bad number '{a}'.\",W046:\"Don't use extra leading zeros '{a}'.\",W047:\"A trailing decimal point can be confused with a dot: '{a}'.\",W048:\"Unexpected control character in regular expression.\",W049:\"Unexpected escaped character '{a}' in regular expression.\",W050:\"JavaScript URL.\",W051:\"Variables should not be deleted.\",W052:\"Unexpected '{a}'.\",W053:\"Do not use {a} as a constructor.\",W054:\"The Function constructor is a form of eval.\",W055:\"A constructor name should start with an uppercase letter.\",W056:\"Bad constructor.\",W057:\"Weird construction. Is 'new' necessary?\",W058:\"Missing '()' invoking a constructor.\",W059:\"Avoid arguments.{a}.\",W060:\"document.write can be a form of eval.\",W061:\"eval can be harmful.\",W062:\"Wrap an immediate function invocation in parens to assist the reader in understanding that the expression is the result of a function, and not the function itself.\",W063:\"Math is not a function.\",W064:\"Missing 'new' prefix when invoking a constructor.\",W065:\"Missing radix parameter.\",W066:\"Implied eval. Consider passing a function instead of a string.\",W067:\"Bad invocation.\",W068:\"Wrapping non-IIFE function literals in parens is unnecessary.\",W069:\"['{a}'] is better written in dot notation.\",W070:\"Extra comma. (it breaks older versions of IE)\",W071:\"This function has too many statements. ({a})\",W072:\"This function has too many parameters. ({a})\",W073:\"Blocks are nested too deeply. ({a})\",W074:\"This function's cyclomatic complexity is too high. ({a})\",W075:\"Duplicate {a} '{b}'.\",W076:\"Unexpected parameter '{a}' in get {b} function.\",W077:\"Expected a single parameter in set {a} function.\",W078:\"Setter is defined without getter.\",W079:\"Redefinition of '{a}'.\",W080:\"It's not necessary to initialize '{a}' to 'undefined'.\",W081:null,W082:\"Function declarations should not be placed in blocks. Use a function expression or move the statement to the top of the outer function.\",W083:\"Don't make functions within a loop.\",W084:\"Assignment in conditional expression\",W085:\"Don't use 'with'.\",W086:\"Expected a 'break' statement before '{a}'.\",W087:\"Forgotten 'debugger' statement?\",W088:\"Creating global 'for' variable. Should be 'for (var {a} ...'.\",W089:\"The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.\",W090:\"'{a}' is not a statement label.\",W091:null,W093:\"Did you mean to return a conditional instead of an assignment?\",W094:\"Unexpected comma.\",W095:\"Expected a string and instead saw {a}.\",W096:\"The '{a}' key may produce unexpected results.\",W097:'Use the function form of \"use strict\".',W098:\"'{a}' is defined but never used.\",W099:null,W100:\"This character may get silently deleted by one or more browsers.\",W101:\"Line is too long.\",W102:null,W103:\"The '{a}' property is deprecated.\",W104:\"'{a}' is available in ES{b} (use 'esversion: {b}') or Mozilla JS extensions (use moz).\",W105:\"Unexpected {a} in '{b}'.\",W106:\"Identifier '{a}' is not in camel case.\",W107:\"Script URL.\",W108:\"Strings must use doublequote.\",W109:\"Strings must use singlequote.\",W110:\"Mixed double and single quotes.\",W112:\"Unclosed string.\",W113:\"Control character in string: {a}.\",W114:\"Avoid {a}.\",W115:\"Octal literals are not allowed in strict mode.\",W116:\"Expected '{a}' and instead saw '{b}'.\",W117:\"'{a}' is not defined.\",W118:\"'{a}' is only available in Mozilla JavaScript extensions (use moz option).\",W119:\"'{a}' is only available in ES{b} (use 'esversion: {b}').\",W120:\"You might be leaking a variable ({a}) here.\",W121:\"Extending prototype of native object: '{a}'.\",W122:\"Invalid typeof value '{a}'\",W123:\"'{a}' is already defined in outer scope.\",W124:\"A generator function shall contain a yield statement.\",W125:\"This line contains non-breaking spaces: http://jshint.com/doc/options/#nonbsp\",W126:\"Unnecessary grouping operator.\",W127:\"Unexpected use of a comma operator.\",W128:\"Empty array elements acequire elision=true.\",W129:\"'{a}' is defined in a future version of JavaScript. Use a different variable name to avoid migration issues.\",W130:\"Invalid element after rest element.\",W131:\"Invalid parameter after rest parameter.\",W132:\"`var` declarations are forbidden. Use `let` or `const` instead.\",W133:\"Invalid for-{a} loop left-hand-side: {b}.\",W134:\"The '{a}' option is only available when linting ECMAScript {b} code.\",W135:\"{a} may not be supported by non-browser environments.\",W136:\"'{a}' must be in function scope.\",W137:\"Empty destructuring.\",W138:\"Regular parameters should not come after default parameters.\"},info={I001:\"Comma warnings can be turned off with 'laxcomma'.\",I002:null,I003:\"ES5 option is now set per default\"};exports.errors={},exports.warnings={},exports.info={},_.each(errors,function(desc,code){exports.errors[code]={code:code,desc:desc}}),_.each(warnings,function(desc,code){exports.warnings[code]={code:code,desc:desc}}),_.each(info,function(desc,code){exports.info[code]={code:code,desc:desc}})},{\"../lodash\":\"/node_modules/jshint/lodash.js\"}],\"/node_modules/jshint/src/name-stack.js\":[function(_dereq_,module){\"use strict\";function NameStack(){this._stack=[]}Object.defineProperty(NameStack.prototype,\"length\",{get:function(){return this._stack.length}}),NameStack.prototype.push=function(){this._stack.push(null)},NameStack.prototype.pop=function(){this._stack.pop()},NameStack.prototype.set=function(token){this._stack[this.length-1]=token},NameStack.prototype.infer=function(){var type,nameToken=this._stack[this.length-1],prefix=\"\";return nameToken&&\"class\"!==nameToken.type||(nameToken=this._stack[this.length-2]),nameToken?(type=nameToken.type,\"(string)\"!==type&&\"(number)\"!==type&&\"(identifier)\"!==type&&\"default\"!==type?\"(expression)\":(nameToken.accessorType&&(prefix=nameToken.accessorType+\" \"),prefix+nameToken.value)):\"(empty)\"},module.exports=NameStack},{}],\"/node_modules/jshint/src/options.js\":[function(_dereq_,module,exports){\"use strict\";exports.bool={enforcing:{bitwise:!0,freeze:!0,camelcase:!0,curly:!0,eqeqeq:!0,futurehostile:!0,notypeof:!0,es3:!0,es5:!0,forin:!0,funcscope:!0,immed:!0,iterator:!0,newcap:!0,noarg:!0,nocomma:!0,noempty:!0,nonbsp:!0,nonew:!0,undef:!0,singleGroups:!1,varstmt:!1,enforceall:!1},relaxing:{asi:!0,multistr:!0,debug:!0,boss:!0,evil:!0,globalstrict:!0,plusplus:!0,proto:!0,scripturl:!0,sub:!0,supernew:!0,laxbreak:!0,laxcomma:!0,validthis:!0,withstmt:!0,moz:!0,noyield:!0,eqnull:!0,lastsemic:!0,loopfunc:!0,expr:!0,esnext:!0,elision:!0},environments:{mootools:!0,couch:!0,jasmine:!0,jquery:!0,node:!0,qunit:!0,rhino:!0,shelljs:!0,prototypejs:!0,yui:!0,mocha:!0,module:!0,wsh:!0,worker:!0,nonstandard:!0,browser:!0,browserify:!0,devel:!0,dojo:!0,typed:!0,phantom:!0},obsolete:{onecase:!0,regexp:!0,regexdash:!0}},exports.val={maxlen:!1,indent:!1,maxerr:!1,predef:!1,globals:!1,quotmark:!1,scope:!1,maxstatements:!1,maxdepth:!1,maxparams:!1,maxcomplexity:!1,shadow:!1,strict:!0,unused:!0,latedef:!1,ignore:!1,ignoreDelimiters:!1,esversion:5},exports.inverted={bitwise:!0,forin:!0,newcap:!0,plusplus:!0,regexp:!0,undef:!0,eqeqeq:!0,strict:!0},exports.validNames=Object.keys(exports.val).concat(Object.keys(exports.bool.relaxing)).concat(Object.keys(exports.bool.enforcing)).concat(Object.keys(exports.bool.obsolete)).concat(Object.keys(exports.bool.environments)),exports.renamed={eqeq:\"eqeqeq\",windows:\"wsh\",sloppy:\"strict\"},exports.removed={nomen:!0,onevar:!0,passfail:!0,white:!0,gcl:!0,smarttabs:!0,trailing:!0},exports.noenforceall={varstmt:!0,strict:!0}},{}],\"/node_modules/jshint/src/reg.js\":[function(_dereq_,module,exports){\"use strict\";exports.unsafeString=/@cc|<\\/?|script|\\]\\s*\\]|<\\s*!|&lt/i,exports.unsafeChars=/[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/,exports.needEsc=/[\\u0000-\\u001f&<\"\\/\\\\\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/,exports.needEscGlobal=/[\\u0000-\\u001f&<\"\\/\\\\\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,exports.starSlash=/\\*\\//,exports.identifier=/^([a-zA-Z_$][a-zA-Z0-9_$]*)$/,exports.javascriptURL=/^(?:javascript|jscript|ecmascript|vbscript|livescript)\\s*:/i,exports.fallsThrough=/^\\s*falls?\\sthrough\\s*$/,exports.maxlenException=/^(?:(?:\\/\\/|\\/\\*|\\*) ?)?[^ ]+$/},{}],\"/node_modules/jshint/src/scope-manager.js\":[function(_dereq_,module){\"use strict\";var _=_dereq_(\"../lodash\"),events=_dereq_(\"events\"),marker={},scopeManager=function(state,predefined,exported,declared){function _newScope(type){_current={\"(labels)\":Object.create(null),\"(usages)\":Object.create(null),\"(breakLabels)\":Object.create(null),\"(parent)\":_current,\"(type)\":type,\"(params)\":\"functionparams\"===type||\"catchparams\"===type?[]:null},_scopeStack.push(_current)}function warning(code,token){emitter.emit(\"warning\",{code:code,token:token,data:_.slice(arguments,2)})}function error(code,token){emitter.emit(\"warning\",{code:code,token:token,data:_.slice(arguments,2)})}function _setupUsages(labelName){_current[\"(usages)\"][labelName]||(_current[\"(usages)\"][labelName]={\"(modified)\":[],\"(reassigned)\":[],\"(tokens)\":[]})}function _checkForUnused(){if(\"functionparams\"===_current[\"(type)\"])return _checkParams(),void 0;var curentLabels=_current[\"(labels)\"];for(var labelName in curentLabels)curentLabels[labelName]&&\"exception\"!==curentLabels[labelName][\"(type)\"]&&curentLabels[labelName][\"(unused)\"]&&_warnUnused(labelName,curentLabels[labelName][\"(token)\"],\"var\")}function _checkParams(){var params=_current[\"(params)\"];if(params)for(var unused_opt,param=params.pop();param;){var label=_current[\"(labels)\"][param];if(unused_opt=_getUnusedOption(state.funct[\"(unusedOption)\"]),\"undefined\"===param)return;if(label[\"(unused)\"])_warnUnused(param,label[\"(token)\"],\"param\",state.funct[\"(unusedOption)\"]);else if(\"last-param\"===unused_opt)return;param=params.pop()}}function _getLabel(labelName){for(var i=_scopeStack.length-1;i>=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)\"]&&currentFunctParamScope[\"(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&&paramScope[\"(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)}});";
 
 /***/ }),
-/* 41 */
+/* 42 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -39620,7 +40058,7 @@ function substituteAliases(origCommand) {
 
 
 /***/ }),
-/* 42 */
+/* 43 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -39835,7 +40273,7 @@ let DarkWebItems = {
 
 
 /***/ }),
-/* 43 */
+/* 44 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -40168,345 +40606,6 @@ function initLiterature() {
 
 
 
-/***/ }),
-/* 44 */
-/***/ (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__(9);
-/* 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__(32);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(31);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Terminal_js__ = __webpack_require__(20);
-/* 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__(21);
-
-
-
-
-
-
-
-
-
-
-
-/* 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 + "<span class='typed-cursor'> &#9608; </span>";
-            var promise = writeRedPillLetter(pElem, line, i+1);
-            promise.then(function(res) {
-                resolve(res);
-            }, function(e) {
-                reject(e);
-            });
-        }, 30);
-    });
-}
-
-let redPillFlag = false;
-function hackWorldDaemon(currentNodeNumber) {
-    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);
-    }).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!<br><br>" +
-                        sourceFile.name + "<br><br>" + sourceFile.info);
-    }
-}
-
-function loadBitVerse(destroyedBitNodeNum) {
-    //Clear the screen
-    var container = document.getElementById("red-pill-container");
-    while (container.firstChild) {
-        container.removeChild(container.firstChild);
-    }
-
-    //Create the Bit Verse
-    var bitVerseImage = document.createElement("pre");
-    var bitNodes = [];
-    for (var i = 1; i <= 12; ++i) {
-        bitNodes.push(createBitNode(i));
-    }
-
-    bitVerseImage.innerHTML =
-    "                          O                          <br>" +
-    "             |  O  O      |      O  O  |             <br>" +
-    "        O    |  | /     __|       \\ |  |    O        <br>" +
-    "      O |    O  | |  O /  |  O    | |  O    | O      <br>" +
-    "    | | |    |  |_/  |/   |   \\_  \\_|  |    | | |    <br>" +
-    "  O | | | O  |  | O__/    |   / \\__ |  |  O | | | O  <br>" +
-    "  | | | | |  |  |   /    /|  O  /  \\|  |  | | | | |  <br>" +
-    "O | | |  \\|  |  O  /   _/ |    /    O  |  |/  | | | O<br>" +
-    "| | | |O  /  |  | O   /   |   O   O |  |  \\  O| | | |<br>" +
-    "| | |/  \\/  / __| | |/ \\  |   \\   | |__ \\  \\/  \\| | |<br>" +
-    " \\| O   |  |_/    |\\|   \\ O    \\__|    \\_|  |   O |/ <br>" +
-    "  | |   |_/       | |    \\|    /  |       \\_|   | |  <br>" +
-    "   \\|   /          \\|     |   /  /          \\   |/   <br>" +
-    "    |  "+bitNodes[9]+"            |     |  /  |            "+bitNodes[10]+"  |    <br>" +
-    "  "+bitNodes[8]+" |  |            |     |     |            |  | "+bitNodes[11]+"  <br>" +
-    "  | |  |            /    / \\    \\            |  | |  <br>" +
-    "   \\|  |           /  "+bitNodes[6]+" /   \\ "+bitNodes[7]+"  \\           |  |/   <br>" +
-    "    \\  |          /  / |     | \\  \\          |  /    <br>" +
-    "     \\ \\JUMP "+bitNodes[4]+"3R |  |  |     |  |  | R3"+bitNodes[5]+" PMUJ/ /     <br>" +
-    "      \\||    |   |  |  |     |  |  |   |    ||/      <br>" +
-    "       \\|     \\_ |  |  |     |  |  | _/     |/       <br>" +
-    "        \\       \\| /    \\   /    \\ |/       /        <br>" +
-    "         "+bitNodes[0]+"       |/   "+bitNodes[1]+"  | |  "+bitNodes[2]+"   \\|       "+bitNodes[3]+"         <br>" +
-    "         |       |    |  | |  |    |       |         <br>" +
-    "          \\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/          <br><br><br><br>";
-
-
-    /*
-    "                          O                          <br>" +
-    "             |  O  O      |      O  O  |             <br>" +
-    "        O    |  | /     __|       \ |  |    O        <br>" +
-    "      O |    O  | |  O /  |  O    | |  O    | O      <br>" +
-    "    | | |    |  |_/  |/   |   \_  \_|  |    | | |    <br>" +
-    "  O | | | O  |  | O__/    |   / \__ |  |  O | | | O  <br>" +
-    "  | | | | |  |  |   /    /|  O  /  \|  |  | | | | |  <br>" +
-    "O | | |  \|  |  O  /   _/ |    /    O  |  |/  | | | O<br>" +
-    "| | | |O  /  |  | O   /   |   O   O |  |  \  O| | | |<br>" +
-    "| | |/  \/  / __| | |/ \  |   \   | |__ \  \/  \| | |<br>" +
-    " \| O   |  |_/    |\|   \ O    \__|    \_|  |   O |/ <br>" +
-    "  | |   |_/       | |    \|    /  |       \_|   | |  <br>" +
-    "   \|   /          \|     |   /  /          \   |/   <br>" +
-    "    |  O            |     |  /  |            O  |    <br>" +
-    "  O |  |            |     |     |            |  | O  <br>" +
-    "  | |  |            /    / \    \            |  | |  <br>" +
-    "   \|  |           /  O /   \ O  \           |  |/   <br>" +
-    "    \  |          /  / |     | \  \          |  /    <br>" +
-    "     \ \JUMP O3R |  |  |     |  |  | R3O PMUJ/ /     <br>" +
-    "      \||    |   |  |  |     |  |  |   |    ||/      <br>" +
-    "       \|     \_ |  |  |     |  |  | _/     |/       <br>" +
-    "        \       \| /    \   /    \ |/       /        <br>" +
-    "         O       |/   O  | |  O   \|       O         <br>" +
-    "         |       |    |  | |  |    |       |         <br>" +
-    "          \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/          <br>";
-    */
-
-    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 === 4 || i === 5 || 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 + "<br><br>" + bitNode.info);
-                    createBitNodeYesNoEventListeners(i, destroyedBitNodeNum);
-                });
-            } 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 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  "<a class='bitnode tooltip' id='bitnode-" + bitNode.number.toString() + "'><strong>O</strong>" +
-             "<span class='tooltiptext'>" +
-             "<strong>BitNode-" + bitNode.number.toString() + "<br>" + bitNode.name+ "</strong><br>" +
-             bitNode.desc + "<br>" +
-             "</span></a>";
-}
-
-function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) {
-    var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])();
-    yesBtn.innerHTML = "Enter BitNode-" + newBitNode;
-    yesBtn.addEventListener("click", function() {
-        giveSourceFile(destroyedBitNode);
-        redPillFlag = false;
-        var container = document.getElementById("red-pill-container");
-        while (container.firstChild) {
-            container.removeChild(container.firstChild);
-        }
-
-        //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 type="text" id="terminal-input-text-box" class="terminal-input" tabindex="1"/>';
-        $('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__(7)))
-
 /***/ }),
 /* 45 */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -59931,7 +60030,7 @@ init(true);function init(packaged) {
     if (!global || !global.document)
         return;
     
-    options.packaged = packaged || acequire.packaged || module.packaged || (global.define && __webpack_require__(39).packaged);
+    options.packaged = packaged || acequire.packaged || module.packaged || (global.define && __webpack_require__(40).packaged);
 
     var scriptOptions = {};
     var scriptUrl = "";
@@ -75229,7 +75328,7 @@ exports.config = acequire("./config");
 exports.acequire = acequire;
 
 if (true)
-    exports.define = __webpack_require__(39);
+    exports.define = __webpack_require__(40);
 exports.edit = function(el) {
     if (typeof el == "string") {
         var _id = el;
@@ -76124,7 +76223,7 @@ oop.inherits(Mode, TextMode);
     };
 
     this.createWorker = function(session) {
-        var worker = new WorkerClient(["ace"], __webpack_require__(40), "JavaScriptWorker");
+        var worker = new WorkerClient(["ace"], __webpack_require__(41), "JavaScriptWorker");
         worker.attachToDocument(session.getDocument());
 
         worker.on("annotate", function(results) {
@@ -76226,10 +76325,11 @@ var NetscriptHighlightRules = function(options) {
             "getServerMinSecurityLevel|"                                               +
             "getServerRequiredHackingLevel|getServerNumPortsRequired|getServerRam|"    +
             "serverExists|fileExists|isRunning|getNextHacknetNodeCost|"                +
-            "purchaseHacknetNode|" +
+            "purchaseHacknetNode|deleteServer|getPurchasedServers|"                    +
             "purchaseServer|round|write|read|scriptRunning|scriptKill|getScriptRam|"   +
             "getHackTime|getGrowTime|getWeakenTime|getScriptIncome|getScriptExpGain|"  +
-            "universityCourse|"  +
+            "getTimeSinceLastAug|"                                                     +
+            "universityCourse|"                                                        +
             "gymWorkout|travelToCity|purchaseTor|purchaseProgram|upgradeHomeRam|"      +
             "getUpgradeHomeRamCost|workForCompany|applyToCompany|getCompanyRep|"       +
             "checkFactionInvitations|joinFaction|workForFaction|getFactionRep|"        +
@@ -76931,7 +77031,7 @@ oop.inherits(Mode, TextMode);
     };
 
     this.createWorker = function(session) {
-        var worker = new WorkerClient(["ace"], __webpack_require__(40), "JavaScriptWorker");
+        var worker = new WorkerClient(["ace"], __webpack_require__(41), "JavaScriptWorker");
         worker.attachToDocument(session.getDocument());
 
         worker.on("annotate", function(results) {
@@ -88600,13 +88700,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
 "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__(41);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(42);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(18);
 /* 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__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Gang_js__ = __webpack_require__(30);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__HacknetNode_js__ = __webpack_require__(34);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Gang_js__ = __webpack_require__(32);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__HacknetNode_js__ = __webpack_require__(37);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Message_js__ = __webpack_require__(22);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Player_js__ = __webpack_require__(0);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Script_js__ = __webpack_require__(19);
@@ -88615,7 +88715,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__ = __webpack_require__(11);
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__StockMarket_js__ = __webpack_require__(26);
 /* 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__(35);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_GameOptions_js__ = __webpack_require__(38);
 /* 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);
diff --git a/src/ActiveScriptsUI.js b/src/ActiveScriptsUI.js
index d1ad0fa07..5b279ac40 100644
--- a/src/ActiveScriptsUI.js
+++ b/src/ActiveScriptsUI.js
@@ -6,6 +6,7 @@ import {getServer}                  from "./Server.js";
 import {dialogBoxCreate}            from "../utils/DialogBox.js";
 import {printArray}                 from "../utils/HelperFunctions.js";
 import {logBoxCreate}               from "../utils/LogBox.js";
+import numeral                      from "../utils/numeral.min.js";
 import {formatNumber}               from "../utils/StringHelperFunctions.js";
 
 
@@ -183,10 +184,10 @@ function updateActiveScriptsItems() {
         total += updateActiveScriptsItemContent(workerScripts[i]);
     }
     document.getElementById("active-scripts-total-prod").innerHTML =
-        "Total online production of Active Scripts: $" + formatNumber(total, 2) + " / second<br>" +
-        "Total online production since last Augmentation installation: $" +
-        formatNumber(Player.scriptProdSinceLastAug, 2) + " ($" +
-        formatNumber(Player.scriptProdSinceLastAug / Player.playtimeSinceLastAug, 2) + " / second)";
+        "Total online production of Active Scripts: " + numeral(total).format('$0.000a') + " / sec<br>" +
+        "Total online production since last Aug installation: " +
+        numeral(Player.scriptProdSinceLastAug).format('$0.000a') + " (" +
+        numeral(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug/1000)).format('$0.000a') + " / sec)";
     return total;
 }
 
diff --git a/src/Constants.js b/src/Constants.js
index 9ae13cb7c..75a2a6339 100644
--- a/src/Constants.js
+++ b/src/Constants.js
@@ -124,31 +124,30 @@ let CONSTANTS = {
 
     //Hacking Missions
     HackingMissionRepToDiffConversion: 5000, //Faction rep is divided by this to get mission difficulty
-    HackingMissionRepToRewardConversion: 20, //Faction rep divided byt his to get mission rep reward
+    HackingMissionRepToRewardConversion: 12, //Faction rep divided byt his to get mission rep reward
     HackingMissionSpamTimeIncrease: 20000, //How much time limit increase is gained when conquering a Spam Node (ms)
     HackingMissionTransferAttackIncrease: 1.05, //Multiplier by which the attack for all Core Nodes is increased when conquering a Transfer Node
     HackingMissionHowToPlay: "Hacking missions are a minigame that, if won, will reward you with faction reputation.<br><br>" +
                              "In this game you control a set of Nodes and use them to try and defeat an enemy. Your Nodes " +
-                             "are colored blue, while the enemy's are red. There are also other nodes on the map colored gray" +
+                             "are colored blue, while the enemy's are red. There are also other nodes on the map colored gray " +
                              "that initially belong to neither you nor the enemy. The goal of the game is " +
                              "to capture all of the enemy's database nodes, which are the parallelogram-shaped ones, within the time limit. " +
                              "If you cannot capture all of the enemy's database nodes in the time limit, you will lose.<br><br>" +
                              "Each Node has three stats: Attack, Defense, and HP. There are five different actions that " +
                              "a Node can take:<br><br> " +
-                             "Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the Node's Attack, the Player's " +
+                             "Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the owner's Attack, the Player's " +
                              "hacking level, and the enemy's defense.<br>" +
-                             "Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the Player's hacking level and the " +
+                             "Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the " +
                              "enemy's defense.<br>"  +
-                             "Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the Player's hacking level and the enemy's " +
+                             "Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the enemy's " +
                              "defense.<br>" +
-                             "Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.<br><br>" +
-                             "To capture a Node, you must lower its HP down to 0. " +
-                             "A Node's 'Attack' stats affects its effectiveness when attacking other Nodes. A Node's 'Defense' helps protect " +
-                             "against the actions of enemy Nodes. One important thing to note is that, when defending, your total 'Defense' " +
-                             "(sum of the Defense of all of your Nodes) is what's taken into account when determining the effect of offensive actions. " +
-                             "However, when attacking, only the 'Attack' of the Node being used to attack is taken into account.<br><br>" +
+                             "Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.<br>" +
+                             "Overflow - Raises the Node's Attack but lowers its Defense. The effectiveness is determined by your hacking level.<br><br>" +
+                             "Note that when determining the effectiveness of the above actions, the TOTAL Attack or Defense of the team is used, not just the " +
+                             "Attack/Defense of the individual Node that is performing the action.<br><br." +
+                             "To capture a Node, you must lower its HP down to 0.<br><br>" +
                              "There are six different types of Nodes:<br><br>" +
-                             "CPU Core - These are your main Nodes that are used to perform actions<br>" +
+                             "CPU Core - These are your main Nodes that are used to perform actions. Capable of performing every action<br>" +
                              "Firewall - Nodes with high defense. These Nodes cannot perform any actions<br>" +
                              "Database - A special type of Node. The player's objective is to conquer all of the enemy's Database Nodes within " +
                              "the time limit. These Nodes cannot perform any actions<br>"  +
@@ -157,10 +156,16 @@ let CONSTANTS = {
                              "Transfer - Conquering one of these nodes will increase the Attack of all of your CPU Cores by a small fixed percentage. " +
                              "These Nodes are capable of performing every action except the 'Attack' action<br>" +
                              "Shield - Nodes with high defense. These Nodes cannot perform any actions<br><br>" +
+                             "To assign an action to a Node, you must first select one of your Nodes. This can be done by simply clicking on it. Only " +
+                             "one Node can be selected at a time, and it will be denoted with a white highlight. After selecting the Node, " +
+                             "select its action using the Action Buttons near the top of the screen. Every action also has a corresponding keyboard " +
+                             "shortcut that can be used as well.<br><br>" +
                              "For certain actions such as attacking, scanning, and weakening, the Node performing the action must have a target. To target " +
                              "another node, simply click-and-drag from the 'source' Node to a target. A Node can only have one target, and you can only target " +
                              "Nodes that are adjacent to one of your Nodes (immediately above, below, or to the side. NOT diagonal). Furthermore, only CPU Cores and Transfer Nodes " +
-                             "can target, since they are the only ones that can perform actions",
+                             "can target, since they are the only ones that can perform actions. To remove a target, you can simply click on the line that represents " +
+                             "the connection between one of your Nodes and its target. Alternatively, you can select the 'source' Node and click the 'Drop Connection' button, " +
+                             "or press 'd',",
 
 
     //Gang constants
@@ -418,6 +423,9 @@ let CONSTANTS = {
                            "args.length<br><br>" +
                            "Note that none of the other functions that typically work with arrays, such as remove(), insert(), clear(), etc., will work on the " +
                            "args array.<br><br>" +
+                           "<u><h1>Javascript Modules</h1></u><br>" +
+                           "Netscript supports the following Javascript Modules:<br><br>" +
+                           "Math<br>Date (static functions only)<br><br>" +
                            "<u><h1> Functions </h1></u><br>" +
                            "You can NOT define you own functions in Netscript (yet), but there are several built in functions that " +
                            "you may use: <br><br> " +
@@ -649,8 +657,9 @@ let CONSTANTS = {
                            "on the server specified by the hostname/ip. The argument must be a string with the hostname/ip of the target server.<br><br>" +
                            "<i>getScriptIncome([scriptname], [hostname/ip], [args...])</i><br>" +
                            "Returns the amount of income the specified script generates while online (when the game is open, does not apply for " +
-                           "offline income). This function can also return the total income of all of your active scripts by running the function " +
-                           "with no arguments.<br><br>" +
+                           "offline income). This function can also be called with no arguments. If called with no arguments, then this function " +
+                           "will return an array of two values. The first value is the total income ($/sec) of all of your active scripts (currently running). " +
+                           "The second value is the total income ($/sec) from scripts since you last installed Augmentations (or destroyed a BitNode).<br><br>" +
                            "Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script " +
                            "with the arguments 'foodnstuff' and '5' then in order to use this function to get that script's income you must " +
                            "specify those arguments in this function call.<br><br>" +
@@ -669,6 +678,8 @@ let CONSTANTS = {
                            "The second argument must be a string with the hostname/IP of the target server. If the first argument is specified " +
                            "then the second argument must be specified as well. Any additional arguments passed to the function will specify " +
                            "the arguments passed into the target script.<br><br>" +
+                           "<i>getTimeSinceLastAug()</i><br>" +
+                           "Returns the amount of time in milliseconds that have passed since you last installed Augmentations (or destroyed a BitNode).<br><br>" +
                            "<u><h1>Hacknet Nodes API</h1></u><br>" +
                            "Netscript provides the following API for accessing and upgrading your Hacknet Nodes through scripts. This API does NOT work offline.<br><br>" +
                            "<i>hacknetnodes</i><br> A special variable. This is an array that maps to the Player's Hacknet Nodes. The Hacknet Nodes are accessed through " +
@@ -998,28 +1009,24 @@ let CONSTANTS = {
 
     LatestUpdate:
     "v0.29.1<br>" +
+    "-New gameplay feature that is currently in BETA: Hacking Missions. Hacking Missions is an active gameplay mechanic (its a minigame) " +
+    "that is meant to be used to earn faction reputation. However, since this is currently in beta, hacking missions will NOT grant reputation " +
+    "for the time being, since the feature likely has many bugs, balance problems, and other issues. If you have any feedback " +
+    "regarding the new feature, feel free to let me know<br>" +
+    "-CHANGED THE RETURN VALUE OF getScriptIncome() WHEN RAN WITH NO ARGUMENTS. It will now return an array of " +
+    "two values rather than a single value. This may break your scripts, so make sure to update them!<br>" +
     "-Added continue statement for for/while loops<br>" +
-    "-Added getServerMinSecurityLevel() Netscript function<br>" +
+    "-Added getServerMinSecurityLevel(), getPurchasedServers(), and getTimeSinceLastAug() Netscript functions<br>" +
+    "-Netscript scp() function can now take an array as the first argument, and will try to copy " +
+    "every file specified in the array (it will just call scp() normally for every element in the array). " +
+    "If an array is passed in, then the scp() function returns true if at least one element from the array is successfully copied<br>" +
     "-Added Javascript's Date module to Netscript. Since 'new' is not supported in Netscript yet, only the Date module's " +
     "static methods will work (now(), UTC(), parse(), etc.).<br>" +
     "-Failing a crime now gives half the experience it did before<br>" +
-    "-The repeated 'Find The-Cave' message after installing The Red Pill Augmentation now only happens " +
-    "if you've never destroyed a BitNode before<br>" +
-    "-fileExists() function now works on literature files<br><br>" +
-    "v0.29.0<br>" +
-    "-Added BitNode-5: Artificial Intelligence<br>" +
-    "-Added getIp(), getIntelligence(), getHackingMultipliers(), and getBitNodeMultipliers() Netscript functions (requires Source-File 5)<br>" +
-    "-Updated scan() Netscript function so that you can choose to have it print IPs rather than hostnames<br>" +
-    "-Refactored scp() Netscript function so that it takes an optional 'source server' argument<br>" +
-    "-For Infiltration, decreased the percentage by which the security level increases by " +
-    "about 10% for every location<br>" +
-    "-Using :w in the script editor's Vim keybinding mode should now save and quit to Terminal<br>" +
-    "-Some minor optimizations that should reduce the size of the save file<br>" +
-    "-scan-analyze Terminal command will no longer show your purchased servers, unless you pass a '-a' flag into the command<br>" +
-    "-After installing the Red Pill augmentation from Daedalus, the message telling you to find 'The-Cave' " +
-    "will now repeatedly pop up regardless of whether or not you have messages suppressed<br>" +
-    "-Various bugfixes",
-
+    "-The forced repeated 'Find The-Cave' message after installing The Red Pill Augmentation now only happens " +
+    "if you've never destroyed a BitNode before, and will only popup every 15 minutes. If you have already destroyed a BitNode, " +
+    "the message will not pop up if you have messages suppressed (if you don't have messages suppressed it WILL still repeatedly popup)<br>" +
+    "-fileExists() function now works on literature files<br><br>",
 }
 
 export {CONSTANTS};
diff --git a/src/Message.js b/src/Message.js
index 94096bec3..667c8d147 100644
--- a/src/Message.js
+++ b/src/Message.js
@@ -1,7 +1,9 @@
 import {Augmentations, Augmentation,
         AugmentationNames}                      from "./Augmentations.js";
 import {Programs}                               from "./CreateProgram.js";
+import {inMission}                              from "./Missions.js";
 import {Player}                                 from "./Player.js";
+import {redPillFlag}                            from "./RedPill.js";
 import {GetServerByHostname}                    from "./Server.js";
 import {Settings}                               from "./Settings.js";
 import {dialogBoxCreate, dialogBoxOpened}       from "../utils/DialogBox.js";
@@ -75,10 +77,15 @@ function checkForMessagesToSend() {
         redpillOwned = true;
     }
 
-    if (redpill && redpillOwned && Player.sourceFiles.length === 0) {
+    if (redpill && redpillOwned && Player.sourceFiles.length === 0 && !redPillFlag && !inMission) {
         if (!dialogBoxOpened) {
             sendMessage(redpill, true);
         }
+    } else if (redpill && redpillOwned) {
+        //If player has already destroyed a BitNode, message is not forced
+        if (!redPillFlag && !inMission && !dialogBoxOpened) {
+            sendMessage(redpill);
+        }
     } else if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) {
         sendMessage(jumper0);
         Player.getHomeComputer().programs.push(Programs.Flight);
@@ -96,8 +103,6 @@ function checkForMessagesToSend() {
         sendMessage(jumper4);
     } else if (bitrunnersTest && !bitrunnersTest.recvd && Player.hacking_skill >= 500) {
         sendMessage(bitrunnersTest);
-    } else if (redpill && redpillOwned) {
-        sendMessage(redpill);
     }
 }
 
diff --git a/src/Missions.js b/src/Missions.js
index 2932d622d..2120b0255 100644
--- a/src/Missions.js
+++ b/src/Missions.js
@@ -156,15 +156,17 @@ function HackingMission(rep, fac) {
     this.faction = fac;
 
     this.started = false;
-    this.time = 120000; //2 minutes, milliseconds
+    this.time = 180000; //2 minutes, milliseconds
 
     this.playerCores = [];
     this.playerNodes = []; //Non-core nodes
+    this.playerAtk = 0;
     this.playerDef = 0;
 
     this.enemyCores = [];
     this.enemyDatabases = [];
     this.enemyNodes = []; //Non-core nodes
+    this.enemyAtk = 0;
     this.enemyDef = 0;
 
     this.miscNodes = [];
@@ -190,7 +192,7 @@ function HackingMission(rep, fac) {
     //difficulty capped at 16
     this.difficulty = Math.min(16, Math.round(rep / CONSTANTS.HackingMissionRepToDiffConversion) + 1);
     console.log("difficulty: " + this.difficulty);
-    this.reward = 200 + (rep / CONSTANTS.HackingMissionRepToRewardConversion);
+    this.reward = 250 + (rep / CONSTANTS.HackingMissionRepToRewardConversion);
 }
 
 HackingMission.prototype.init = function() {
@@ -213,7 +215,7 @@ HackingMission.prototype.init = function() {
 
     //Randomly generate enemy nodes (CPU and Firewall) based on difficulty
     var numNodes = getRandomInt(this.difficulty, this.difficulty + 1);
-    var numFirewalls = getRandomInt(this.difficulty, this.difficulty + 2);
+    var numFirewalls = getRandomInt(this.difficulty, this.difficulty + 1);
     var numDatabases = getRandomInt(this.difficulty, this.difficulty + 1);
     var totalNodes = numNodes + numFirewalls + numDatabases;
     var xlimit = 7 - Math.floor(totalNodes / 8);
@@ -254,6 +256,7 @@ HackingMission.prototype.init = function() {
         this.enemyDatabases.push(node);
     }
     this.calculateDefenses();
+    this.calculateAttacks();
     this.createMap();
 }
 
@@ -297,11 +300,23 @@ HackingMission.prototype.createPageDom = function() {
     startBtn.style.display = "inline-block";
     startBtn.addEventListener("click", ()=>{
         this.start();
+        return false;
+    });
+
+    var forfeitMission = document.createElement("a");
+    forfeitMission.innerHTML = "Forfeit Mission (Exit)";
+    forfeitMission.classList.add("a-link-button");
+    forfeitMission.classList.add("hack-mission-header-element");
+    forfeitMission.style.display = "inline-block";
+    forfeitMission.addEventListener("click", ()=> {
+        this.finishMission(false);
+        return false;
     });
 
     var timer = document.createElement("p");
     timer.setAttribute("id", "hacking-mission-timer");
     timer.style.display = "inline-block";
+    timer.style.margin = "6px";
 
     //Create Action Buttons (Attack/Scan/Weaken/ etc...)
     var actionsContainer = document.createElement("span");
@@ -353,18 +368,18 @@ HackingMission.prototype.createPageDom = function() {
     this.actionButtons[5].appendChild(dropconnTooltip);
 
     //Player/enemy defense displays will be in action container
-    var playerDefense = document.createElement("p");
-    var enemyDefense = document.createElement("p");
-    playerDefense.style.display = "inline-block";
-    enemyDefense.style.display = "inline-block";
-    playerDefense.style.color = "blue";
-    enemyDefense.style.color = "red";
-    playerDefense.style.margin = "4px";
-    enemyDefense.style.margin = "4px";
-    playerDefense.setAttribute("id", "hacking-mission-player-def");
-    enemyDefense.setAttribute("id", "hacking-mission-enemy-def");
-    actionsContainer.appendChild(playerDefense);
-    actionsContainer.appendChild(enemyDefense);
+    var playerStats = document.createElement("p");
+    var enemyStats = document.createElement("p");
+    playerStats.style.display = "inline-block";
+    enemyStats.style.display = "inline-block";
+    playerStats.style.color = "#00ccff";
+    enemyStats.style.color = "red";
+    playerStats.style.margin = "4px";
+    enemyStats.style.margin = "4px";
+    playerStats.setAttribute("id", "hacking-mission-player-stats");
+    enemyStats.setAttribute("id", "hacking-mission-enemy-stats");
+    actionsContainer.appendChild(playerStats);
+    actionsContainer.appendChild(enemyStats);
 
     //Set Action Button event listeners
     this.actionButtons[0].addEventListener("click", ()=>{
@@ -434,6 +449,7 @@ HackingMission.prototype.createPageDom = function() {
     container.appendChild(inGameGuideBtn);
     container.appendChild(wikiGuideBtn);
     container.appendChild(startBtn);
+    container.appendChild(forfeitMission);
     container.appendChild(timer);
     container.appendChild(actionsContainer);
     container.appendChild(timeDisplay);
@@ -485,7 +501,34 @@ HackingMission.prototype.setActionButton = function(i, active=true) {
 
 }
 
-//Should only be used at the start
+HackingMission.prototype.calculateAttacks = function() {
+    var total = 0;
+    for (var i = 0; i < this.playerCores.length; ++i) {
+        total += this.playerCores[i].atk;
+    }
+    for (var i = 0; i < this.playerNodes.length; ++i) {
+        total += this.playerNodes[i].atk;
+    }
+    this.playerAtk = total;
+    document.getElementById("hacking-mission-player-stats").innerHTML =
+        "Player Attack: " + formatNumber(this.playerAtk, 1) + "<br>" +
+        "Player Defense: " + formatNumber(this.playerDef, 1);
+    total = 0;
+    for (var i = 0; i < this.enemyCores.length; ++i) {
+        total += this.enemyCores[i].atk;
+    }
+    for (var i = 0; i < this.enemyDatabases.length; ++i) {
+        total += this.enemyDatabases[i].atk;
+    }
+    for (var i = 0; i < this.enemyNodes.length; ++i) {
+        total += this.enemyNodes[i].atk;
+    }
+    this.enemyAtk = total;
+    document.getElementById("hacking-mission-enemy-stats").innerHTML =
+        "Enemy Attack: " + formatNumber(this.enemyAtk, 1) + "<br>" +
+        "Enemy Defense: " + formatNumber(this.enemyDef, 1);
+}
+
 HackingMission.prototype.calculateDefenses = function() {
     var total = 0;
     for (var i = 0; i < this.playerCores.length; ++i) {
@@ -495,7 +538,8 @@ HackingMission.prototype.calculateDefenses = function() {
         total += this.playerNodes[i].def;
     }
     this.playerDef = total;
-    document.getElementById("hacking-mission-player-def").innerText =
+    document.getElementById("hacking-mission-player-stats").innerHTML =
+        "Player Attack: " + formatNumber(this.playerAtk, 1) + "<br>" +
         "Player Defense: " + formatNumber(this.playerDef, 1);
     total = 0;
     for (var i = 0; i < this.enemyCores.length; ++i) {
@@ -508,7 +552,8 @@ HackingMission.prototype.calculateDefenses = function() {
         total += this.enemyNodes[i].def;
     }
     this.enemyDef = total;
-    document.getElementById("hacking-mission-enemy-def").innerText =
+    document.getElementById("hacking-mission-enemy-stats").innerHTML =
+        "Enemy Attack: " + formatNumber(this.enemyAtk, 1) + "<br>" +
         "Enemy Defense: " + formatNumber(this.enemyDef, 1);
 }
 
@@ -563,16 +608,16 @@ HackingMission.prototype.createMap = function() {
                     case 0: //Spam
                         var stats = {
                             atk: 0,
-                            def: randMult * getRandomInt(30, 40),
-                            hp: randMult * getRandomInt(70, 90)
+                            def: randMult * getRandomInt(35, 55),
+                            hp: randMult * getRandomInt(125, 150)
                         }
                         node = new Node(NodeTypes.Spam, stats);
                         break;
                     case 1: //Transfer
                         var stats = {
                             atk: 0,
-                            def: randMult * getRandomInt(50, 70),
-                            hp: randMult * getRandomInt(80, 95)
+                            def: randMult * getRandomInt(45, 65),
+                            hp: randMult * getRandomInt(150, 175)
                         }
                         node = new Node(NodeTypes.Transfer, stats);
                         break;
@@ -580,8 +625,8 @@ HackingMission.prototype.createMap = function() {
                     default:
                         var stats = {
                             atk: 0,
-                            def: randMult * getRandomInt(90, 105),
-                            hp: randMult * getRandomInt(130, 150)
+                            def: randMult * getRandomInt(60, 80),
+                            hp: randMult * getRandomInt(200, 250)
                         }
                         node = new Node(NodeTypes.Shield, stats);
                         break;
@@ -779,11 +824,8 @@ HackingMission.prototype.start = function() {
     this.started = true;
     this.initJsPlumb();
     var startBtn = clearEventListeners("hack-mission-start-btn");
-    startBtn.innerHTML = "Forfeit Mission";
-    startBtn.addEventListener("click", ()=>{
-        this.finishMission(false);
-        return false;
-    });
+    startBtn.classList.remove("a-link-button");
+    startBtn.classList.add("a-link-button-inactive");
 }
 
 HackingMission.prototype.initJsPlumb = function() {
@@ -806,8 +848,8 @@ HackingMission.prototype.initJsPlumb = function() {
         instance.makeSource(this.playerCores[i].el, {
             deleteEndpointsOnEmpty:true,
             maxConnections:1,
-            anchor:"Center",
-            connector:"Straight"
+            anchor:"Continuous",
+            connector:"Flowchart"
         });
     }
 
@@ -815,29 +857,29 @@ HackingMission.prototype.initJsPlumb = function() {
     for (var i = 0; i < this.enemyCores.length; ++i) {
         instance.makeTarget(this.enemyCores[i].el, {
             maxConnections:-1,
-            anchor:"Center",
-            connector:"Straight"
+            anchor:"Continuous",
+            connector:"Flowchart"
         });
     }
     for (var i = 0; i < this.enemyDatabases.length; ++i) {
         instance.makeTarget(this.enemyDatabases[i].el, {
             maxConnections:-1,
-            anchor:"Center",
-            connector:["Straight"]
+            anchor:"Continuous",
+            connector:["Flowchart"]
         });
     }
     for (var i = 0; i < this.enemyNodes.length; ++i) {
         instance.makeTarget(this.enemyNodes[i].el, {
             maxConnections:-1,
-            anchor:"Center",
-            connector:"Straight"
+            anchor:"Continuous",
+            connector:"Flowchart"
         });
     }
     for (var i = 0; i < this.miscNodes.length; ++i) {
         instance.makeTarget(this.miscNodes[i].el, {
             maxConnections:-1,
-            anchor:"Center",
-            connector:"Straight"
+            anchor:"Continuous",
+            connector:"Flowchart"
         });
     }
 
@@ -888,45 +930,60 @@ HackingMission.prototype.dropAllConnectionsToNode = function(node) {
     }
 }
 
+var storedCycles = 0;
 HackingMission.prototype.process = function(numCycles=1) {
     if (!this.started) {return;}
+    storedCycles += numCycles;
+    if (storedCycles < 3) {return;} //Only process every 2 cycles minimum
+
     var res = false;
     //Process actions of all player nodes
     this.playerCores.forEach((node)=>{
-        res |= this.processNode(node, numCycles);
+        res |= this.processNode(node, storedCycles);
     });
 
     this.playerNodes.forEach((node)=>{
         if (node.type === NodeTypes.Transfer) {
-            res |= this.processNode(node, numCycles);
+            res |= this.processNode(node, storedCycles);
         }
     });
 
     //Process actions of all enemy nodes
     this.enemyCores.forEach((node)=>{
-        res |= this.processNode(node, numCycles);
+        res |= this.processNode(node, storedCycles);
     });
 
     this.enemyNodes.forEach((node)=>{
         if (node.type === NodeTypes.Transfer) {
-            res |= this.processNode(node, numCycles);
+            res |= this.processNode(node, storedCycles);
         }
     });
 
-    if (res) {this.calculateDefenses();}
+    if (res) {
+        this.calculateAttacks();
+        this.calculateDefenses();
+    }
 
     if (this.enemyDatabases.length === 0) {
         this.finishMission(true);
         return;
     }
 
+    //Defense of every misc Node increase by 1 per second
+    this.miscNodes.forEach((node)=>{
+        node.def += (0.1 * storedCycles);
+        this.updateNodeDomElement(node);
+    });
+
     //Update timer and check if player lost
-    this.time -= (numCycles * Engine._idleSpeed);
+    this.time -= (storedCycles * Engine._idleSpeed);
     if (this.time <= 0) {
         this.finishMission(false);
         return;
     }
     this.updateTimer();
+
+    storedCycles = 0;
 }
 
 //Returns a bool representing whether defenses need to be re-calculated
@@ -935,48 +992,52 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
         return;
     }
 
-    var targetNode = null, def;
+    var targetNode = null, def, atk;
     if (nodeObj.conn) {
         targetNode = this.getNodeFromElement(nodeObj.conn.target);
         if (targetNode.plyrCtrl) {
             def = this.playerDef;
+            atk = this.enemyAtk;
         } else if (targetNode.enmyCtrl) {
             def = this.enemyDef;
+            atk = this.playerAtk;
         } else { //Misc Node
             def = targetNode.def;
+            nodeObj.plyrCtrl ? atk = this.playerAtk : atk = this.enemyAtk;
         }
     }
 
     //Calculations are per second, so divide everything by 5
-    var calcDefenses = false;
+    var calcStats = false;
     switch(nodeObj.action) {
         case NodeActions.Attack:
             if (nodeObj.conn === null) {break;}
-            var dmg = this.calculateAttackDamage(nodeObj.atk, def, Player.hacking_skill);
+            var dmg = this.calculateAttackDamage(atk, def, Player.hacking_skill);
             targetNode.hp -= (dmg/5 * numCycles);
             break;
         case NodeActions.Scan:
             if (nodeObj.conn === null) {break;}
-            var eff = this.calculateScanEffect(nodeObj.atk, def, Player.hacking_skill);
+            var eff = this.calculateScanEffect(atk, def, Player.hacking_skill);
             targetNode.def -= (eff/5 * numCycles);
-            calcDefenses = true;
+            calcStats = true;
             break;
         case NodeActions.Weaken:
             if (nodeObj.conn === null) {break;}
-            var eff = this.calculateWeakenEffect(nodeObj.atk, def, Player.hacking_skill);
+            var eff = this.calculateWeakenEffect(atk, def, Player.hacking_skill);
             targetNode.atk -= (eff/5 * numCycles);
+            calcStats = true;
             break;
         case NodeActions.Fortify:
             var eff = this.calculateFortifyEffect(Player.hacking_skill);
             nodeObj.def += (eff/5 * numCycles);
-            calcDefenses = true;
+            calcStats = true;
             break;
         case NodeActions.Overflow:
             var eff = this.calculateOverflowEffect(Player.hacking_skill);
             if (nodeObj.def < eff) {break;}
             nodeObj.def -= (eff/5 * numCycles);
             nodeObj.atk += (eff/5 * numCycles);
-            calcDefenses = true;
+            calcStats = true;
             break;
         default:
             console.log("ERR: Invalid Node Action: " + nodeObj.action);
@@ -1014,20 +1075,20 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
             this.jsplumbinstance.makeSource(targetNode.el, {
                 deleteEndpointsOnEmpty:true,
                 maxConnections:1,
-                anchor:"Center",
-                connector:"Straight"
+                anchor:"Continuous",
+                connector:"Flowchart"
             });
         } else {
             targetNode.setControlledByEnemy();
             this.jsplumbinstance.unmakeSource(targetNode.el);
             this.jsplumbinstance.makeTarget(targetNode.el, {
                 maxConnections:-1,
-                anchor:"Center",
-                connector:["Straight"]
+                anchor:"Continuous",
+                connector:["Flowchart"]
             });
         }
 
-        calcDefenses = true;
+        calcStats = true;
 
         //Helper function to swap nodes between the respective enemyNodes/playerNodes arrays
         function swapNodes(orig, dest, targetNode) {
@@ -1105,24 +1166,24 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
     }
     this.updateNodeDomElement(nodeObj);
     if (targetNode) {this.updateNodeDomElement(targetNode);}
-    return calcDefenses;
+    return calcStats;
 }
 
-var hackEffWeightSelf = 100; //Weight for Node actions on self
-var hackEffWeightTarget = 15; //Weight for Node Actions against Target
-var hackEffWeightAttack = 100; //Weight for Attack action
+var hackEffWeightSelf = 150; //Weight for Node actions on self
+var hackEffWeightTarget = 25; //Weight for Node Actions against Target
+var hackEffWeightAttack = 110; //Weight for Attack action
 
 //Returns damage per cycle based on stats
 HackingMission.prototype.calculateAttackDamage = function(atk, def, hacking = 0) {
-    return Math.max(atk + (hacking / hackEffWeightAttack) - def, 0.1);
+    return Math.max(atk + (hacking / hackEffWeightAttack) - def, 1);
 }
 
 HackingMission.prototype.calculateScanEffect = function(atk, def, hacking=0) {
-    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 0.1);
+    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 1);
 }
 
 HackingMission.prototype.calculateWeakenEffect = function(atk, def, hacking=0) {
-    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 0.1);
+    return Math.max((atk/2) + hacking / hackEffWeightTarget - def, 1);
 }
 
 HackingMission.prototype.calculateFortifyEffect = function(hacking=0) {
@@ -1151,9 +1212,11 @@ HackingMission.prototype.finishMission = function(win) {
     currMission = null;
 
     if (win) {
-        dialogBoxCreate("Mission won!");
+        dialogBoxCreate("Mission won! This feature is currently in " +
+                        "beta so you did not earn anything, but normally you would have won " +
+                        this.reward + " reputation with " + this.faction.name);
     } else {
-        dialogBoxCreate("Mission lost!");
+        dialogBoxCreate("Mission lost/forfeited!");
     }
 
     //Clear mission container
diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js
index 089c23b70..076bcea8f 100644
--- a/src/NetscriptFunctions.js
+++ b/src/NetscriptFunctions.js
@@ -469,6 +469,16 @@ function NetscriptFunctions(workerScript) {
             if (arguments.length !== 2 && arguments.length !== 3) {
                 throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
             }
+            if (scriptname && scriptname.constructor === Array) {
+                //Recursively call scp on all elements of array
+                var res = false;
+                scriptname.forEach(function(script) {
+                    if (NetscriptFunctions(workerScript).scp(script, ip1, ip2)) {
+                        res = true;
+                    };
+                });
+                return res;
+            }
             if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) {
                 throw makeRuntimeRejectMsg(workerScript, "Error: scp() only works for .script and .lit files");
             }
@@ -1124,7 +1134,10 @@ function NetscriptFunctions(workerScript) {
         getScriptIncome : function(scriptname, ip) {
             if (arguments.length === 0) {
                 //Get total script income
-                return updateActiveScriptsItems();
+                var res = [];
+                res.push(updateActiveScriptsItems());
+                res.push(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug/1000));
+                return res;
             } else {
                 //Get income for a particular script
                 var server = getServer(ip);
@@ -1170,6 +1183,9 @@ function NetscriptFunctions(workerScript) {
                 return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime;
             }
         },
+        getTimeSinceLastAug : function() {
+            return Player.playtimeSinceLastAug;
+        },
 
         /* Singularity Functions */
         universityCourse(universityName, className) {
diff --git a/src/Player.js b/src/Player.js
index f45f669c7..cfecd0043 100644
--- a/src/Player.js
+++ b/src/Player.js
@@ -275,6 +275,7 @@ PlayerObject.prototype.prestigeAugmentation = function() {
     this.lastUpdate = new Date().getTime();
 
     this.playtimeSinceLastAug = 0;
+    this.scriptProdSinceLastAug = 0;
 
     this.hacknetNodes.length = 0;
     this.totalHacknetNodeProduction = 0;
@@ -365,6 +366,7 @@ PlayerObject.prototype.prestigeSourceFile = function() {
     this.hasTixApiAccess = false;
 
     this.playtimeSinceLastAug = 0;
+    this.scriptProdSinceLastAug = 0;
 }
 
 PlayerObject.prototype.getCurrentServer = function() {
diff --git a/src/engine.js b/src/engine.js
index 5409d21fd..bb81b6248 100644
--- a/src/engine.js
+++ b/src/engine.js
@@ -840,6 +840,7 @@ let Engine = {
             Player.gang.process(numCycles);
         }
 
+        //Mission
         if (inMission && currMission) {
             currMission.process(numCycles);
         }
@@ -967,7 +968,7 @@ let Engine = {
         if (Engine.Counters.messages <= 0) {
             checkForMessagesToSend();
             if (Augmentations[AugmentationNames.TheRedPill].owned) {
-                Engine.Counters.messages = 600; //2 minutes for Red pill message
+                Engine.Counters.messages = 4500; //15 minutes for Red pill message
             } else {
                 Engine.Counters.messages = 150;
             }

From 1233d487d94dfada3036752a84656158f1cf46b7 Mon Sep 17 00:00:00 2001
From: danielyxie <danielyxie@gmail.com>
Date: Wed, 27 Sep 2017 10:15:48 -0500
Subject: [PATCH 6/6] Updated version to 0.29.1

---
 dist/bundle.js   | 2 +-
 src/Constants.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dist/bundle.js b/dist/bundle.js
index 5ef1fe5f0..56d5f3a3d 100644
--- a/dist/bundle.js
+++ b/dist/bundle.js
@@ -2519,7 +2519,7 @@ function powerOfTwo(n) {
 "use strict";
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CONSTANTS; });
 let CONSTANTS = {
-    Version:                "0.29.0",
+    Version:                "0.29.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
diff --git a/src/Constants.js b/src/Constants.js
index 75a2a6339..bfd6df1af 100644
--- a/src/Constants.js
+++ b/src/Constants.js
@@ -1,5 +1,5 @@
 let CONSTANTS = {
-    Version:                "0.29.0",
+    Version:                "0.29.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