From 73ec97db87673bd424003734530f2ea78c5f0288 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 01:21:37 -0400 Subject: [PATCH 01/12] first pass at monaco. --- css/scripteditor.scss | 1 - package-lock.json | 80 ++++++++++++- package.json | 2 + src/Fconf/Fconf.d.ts | 1 + src/IEngine.ts | 1 + src/Monaco/ui/Config.ts | 3 + src/Monaco/ui/ConfigPopup.tsx | 34 ++++++ src/Monaco/ui/Root.tsx | 204 ++++++++++++++++++++++++++++++++++ src/Terminal.jsx | 1 + src/engine.jsx | 18 +-- src/index.html | 15 ++- 11 files changed, 345 insertions(+), 15 deletions(-) create mode 100644 src/Fconf/Fconf.d.ts create mode 100644 src/Monaco/ui/Config.ts create mode 100644 src/Monaco/ui/ConfigPopup.tsx create mode 100644 src/Monaco/ui/Root.tsx diff --git a/css/scripteditor.scss b/css/scripteditor.scss index 56e04a6b9..1fe1412fe 100644 --- a/css/scripteditor.scss +++ b/css/scripteditor.scss @@ -47,7 +47,6 @@ #script-editor-filename-wrapper { background-color: #555; - margin-left: 6px; margin-right: 0; padding-left: 6px; width: 100%; diff --git a/package-lock.json b/package-lock.json index abb8e7733..67d2fa071 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,17 @@ { "name": "bitburner", - "version": "0.52.0", + "version": "0.52.5", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.52.0", + "version": "0.52.5", "hasInstallScript": true, "license": "SEE LICENSE IN license.txt", "dependencies": { "@material-ui/core": "^4.11.3", + "@monaco-editor/react": "^4.2.2", + "@types/js-beautify": "^1.13.2", "@types/numeral": "0.0.25", "@types/react": "^16.8.6", "@types/react-dom": "^16.8.2", @@ -688,6 +690,31 @@ "node": ">=8.0.0" } }, + "node_modules/@monaco-editor/loader": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@monaco-editor/loader/-/loader-1.1.1.tgz", + "integrity": "sha512-mkT4r4xDjIyOG9o9M6rJDSzEIeonwF80sYErxEvAAL4LncFVdcbNli8Qv6NDqF6nyv6sunuKkDzo4iFjxPL+uQ==", + "dependencies": { + "state-local": "^1.0.6" + }, + "peerDependencies": { + "monaco-editor": ">= 0.21.0 < 1" + } + }, + "node_modules/@monaco-editor/react": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@monaco-editor/react/-/react-4.2.2.tgz", + "integrity": "sha512-yDDct+f/mZ946tJEXudvmMC8zXDygkELNujpJGjqJ0gS3WePZmS/IwBBsuJ8JyKQQC3Dy/+Ivg1sSpW+UvCv9g==", + "dependencies": { + "@monaco-editor/loader": "^1.1.1", + "prop-types": "^15.7.2" + }, + "peerDependencies": { + "monaco-editor": ">= 0.25.0 < 1", + "react": "^16.8.0 || ^17.0.0", + "react-dom": "^16.8.0 || ^17.0.0" + } + }, "node_modules/@mrmlnc/readdir-enhanced": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", @@ -751,6 +778,11 @@ "integrity": "sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==", "dev": true }, + "node_modules/@types/js-beautify": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@types/js-beautify/-/js-beautify-1.13.2.tgz", + "integrity": "sha512-crV/441NhrynLIclg94i1wV6nX/6rU9ByUyn4muCrsL0HPd3nBzrt6kpQ9MQOB+HeYgLcRARteNJcbnYkp5OwA==" + }, "node_modules/@types/json-schema": { "version": "7.0.7", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", @@ -10432,6 +10464,12 @@ "yarn": "*" } }, + "node_modules/monaco-editor": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.27.0.tgz", + "integrity": "sha512-UhwP78Wb8w0ZSYoKXQNTV/0CHObp6NS3nCt51QfKE6sKyBo5PBsvuDOHoI2ooBakc6uIwByRLHVeT7+yXQe2fQ==", + "peer": true + }, "node_modules/move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", @@ -15040,6 +15078,11 @@ "safe-buffer": "^5.1.1" } }, + "node_modules/state-local": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/state-local/-/state-local-1.0.7.tgz", + "integrity": "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w==" + }, "node_modules/state-toggle": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.1.tgz", @@ -19336,6 +19379,23 @@ "react-is": "^16.8.0 || ^17.0.0" } }, + "@monaco-editor/loader": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@monaco-editor/loader/-/loader-1.1.1.tgz", + "integrity": "sha512-mkT4r4xDjIyOG9o9M6rJDSzEIeonwF80sYErxEvAAL4LncFVdcbNli8Qv6NDqF6nyv6sunuKkDzo4iFjxPL+uQ==", + "requires": { + "state-local": "^1.0.6" + } + }, + "@monaco-editor/react": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@monaco-editor/react/-/react-4.2.2.tgz", + "integrity": "sha512-yDDct+f/mZ946tJEXudvmMC8zXDygkELNujpJGjqJ0gS3WePZmS/IwBBsuJ8JyKQQC3Dy/+Ivg1sSpW+UvCv9g==", + "requires": { + "@monaco-editor/loader": "^1.1.1", + "prop-types": "^15.7.2" + } + }, "@mrmlnc/readdir-enhanced": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", @@ -19386,6 +19446,11 @@ "integrity": "sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==", "dev": true }, + "@types/js-beautify": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@types/js-beautify/-/js-beautify-1.13.2.tgz", + "integrity": "sha512-crV/441NhrynLIclg94i1wV6nX/6rU9ByUyn4muCrsL0HPd3nBzrt6kpQ9MQOB+HeYgLcRARteNJcbnYkp5OwA==" + }, "@types/json-schema": { "version": "7.0.7", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", @@ -27520,6 +27585,12 @@ } } }, + "monaco-editor": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.27.0.tgz", + "integrity": "sha512-UhwP78Wb8w0ZSYoKXQNTV/0CHObp6NS3nCt51QfKE6sKyBo5PBsvuDOHoI2ooBakc6uIwByRLHVeT7+yXQe2fQ==", + "peer": true + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", @@ -31433,6 +31504,11 @@ "safe-buffer": "^5.1.1" } }, + "state-local": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/state-local/-/state-local-1.0.7.tgz", + "integrity": "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w==" + }, "state-toggle": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.1.tgz", diff --git a/package.json b/package.json index bbcaf2b8d..fda0a0d6f 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ }, "dependencies": { "@material-ui/core": "^4.11.3", + "@monaco-editor/react": "^4.2.2", + "@types/js-beautify": "^1.13.2", "@types/numeral": "0.0.25", "@types/react": "^16.8.6", "@types/react-dom": "^16.8.2", diff --git a/src/Fconf/Fconf.d.ts b/src/Fconf/Fconf.d.ts new file mode 100644 index 000000000..01f636bfd --- /dev/null +++ b/src/Fconf/Fconf.d.ts @@ -0,0 +1 @@ +export declare function parseFconfSettings(config: string): void; \ No newline at end of file diff --git a/src/IEngine.ts b/src/IEngine.ts index d95b89fed..a2961b683 100644 --- a/src/IEngine.ts +++ b/src/IEngine.ts @@ -13,4 +13,5 @@ export interface IEngine { loadMissionContent: () => void; loadResleevingContent: () => void; loadStockMarketContent: () => void; + loadTerminalContent: () => void; } diff --git a/src/Monaco/ui/Config.ts b/src/Monaco/ui/Config.ts new file mode 100644 index 000000000..de5530a69 --- /dev/null +++ b/src/Monaco/ui/Config.ts @@ -0,0 +1,3 @@ +export interface Config { + theme: string; +} \ No newline at end of file diff --git a/src/Monaco/ui/ConfigPopup.tsx b/src/Monaco/ui/ConfigPopup.tsx new file mode 100644 index 000000000..d9b72cc62 --- /dev/null +++ b/src/Monaco/ui/ConfigPopup.tsx @@ -0,0 +1,34 @@ +import React, { useState } from 'react'; +import { Config } from "./Config"; +import { StdButton } from "../../ui/React/StdButton"; +import { removePopup } from "../../ui/React/createPopup"; + +interface IProps { + id: string; + config: Config; + save: (config: Config) => void; +} + +export function ConfigPopup(props: IProps): React.ReactElement { + const [config, setConfig] = useState(props.config); + function save() { + props.save(config); + removePopup(props.id); + } + + function setTheme(event: React.ChangeEvent): void { + setConfig(old => { + old.theme = event.target.value; + return old; + }); + } + + return (<> + +
+ + ); +} \ No newline at end of file diff --git a/src/Monaco/ui/Root.tsx b/src/Monaco/ui/Root.tsx new file mode 100644 index 000000000..6f99ab61a --- /dev/null +++ b/src/Monaco/ui/Root.tsx @@ -0,0 +1,204 @@ +import React, { useState, useEffect } from 'react'; +import { StdButton } from "../../ui/React/StdButton"; +import Editor from "@monaco-editor/react"; +import { createPopup } from "../../ui/React/createPopup"; +import { ConfigPopup } from "./ConfigPopup"; +import { Config } from "./Config"; +import { js_beautify as beautifyCode } from 'js-beautify'; +import { isValidFilePath } from "../../Terminal/DirectoryHelpers"; +import { IPlayer } from "../../PersonObjects/IPlayer"; +import { IEngine } from "../../IEngine"; +import { dialogBoxCreate } from "../../../utils/DialogBox"; +import { parseFconfSettings } from "../../Fconf/Fconf"; +import { isScriptFilename } from "../../Script/ScriptHelpersTS"; +import { Script } from "../../Script/Script"; +import { TextFile } from "../../TextFile"; +import { calculateRamUsage } from "../../Script/RamCalculations"; +import { RamCalculationErrorCode } from "../../Script/RamCalculationErrorCodes"; +import { numeralWrapper } from "../../ui/numeralFormat"; + +interface IProps { + filename: string; + code: string; + player: IPlayer; + engine: IEngine; +}; + +// How to load function definition in monaco +// https://github.com/Microsoft/monaco-editor/issues/1415 +// https://microsoft.github.io/monaco-editor/api/modules/monaco.languages.html +// https://www.npmjs.com/package/@monaco-editor/react#development-playground + +export function Root(props: IProps): React.ReactElement { + const [filename, setFilename] = useState(props.filename); + const [code, setCode] = useState(props.code); + const [ram, setRAM] = useState(''); + const [config, setConfig] = useState({theme: 'vs-dark'}); + + function save(): void { + //CursorPositions.saveCursor(filename, cursor); + + // TODO(hydroflame): re-enable the tutorial. + // if (ITutorial.isRunning && ITutorial.currStep === iTutorialSteps.TerminalTypeScript) { + // //Make sure filename + code properly follow tutorial + // if (filename !== "n00dles.script") { + // dialogBoxCreate("Leave the script name as 'n00dles'!"); + // return; + // } + // code = code.replace(/\s/g, ""); + // if (code.indexOf("while(true){hack('n00dles');}") == -1) { + // dialogBoxCreate("Please copy and paste the code from the tutorial!"); + // return; + // } + + // //Save the script + // let s = Player.getCurrentServer(); + // for (var i = 0; i < s.scripts.length; i++) { + // if (filename == s.scripts[i].filename) { + // s.scripts[i].saveScript(getCurrentEditor().getCode(), Player.currentServer, Player.getCurrentServer().scripts); + // Engine.loadTerminalContent(); + // return iTutorialNextStep(); + // } + // } + + // // If the current script does NOT exist, create a new one + // let script = new Script(); + // script.saveScript(getCurrentEditor().getCode(), Player.currentServer, Player.getCurrentServer().scripts); + // s.scripts.push(script); + + // return iTutorialNextStep(); + // } + + if (filename == "") { + dialogBoxCreate("You must specify a filename!"); + return; + } + + if (filename !== ".fconf" && !isValidFilePath(filename)) { + dialogBoxCreate("Script filename can contain only alphanumerics, hyphens, and underscores, and must end with an extension."); + return; + } + + const s = props.player.getCurrentServer(); + if (filename === ".fconf") { + try { + parseFconfSettings(code); + } catch(e) { + dialogBoxCreate(`Invalid .fconf file: ${e}`); + return; + } + } else if (isScriptFilename(filename)) { + //If the current script already exists on the server, overwrite it + for (let i = 0; i < s.scripts.length; i++) { + if (filename == s.scripts[i].filename) { + s.scripts[i].saveScript(code, props.player.currentServer, props.player.getCurrentServer().scripts); + props.engine.loadTerminalContent(); + return; + } + } + + //If the current script does NOT exist, create a new one + const script = new Script(); + script.saveScript(code, props.player.currentServer, props.player.getCurrentServer().scripts); + s.scripts.push(script); + } else if (filename.endsWith(".txt")) { + for (let i = 0; i < s.textFiles.length; ++i) { + if (s.textFiles[i].fn === filename) { + s.textFiles[i].write(code); + props.engine.loadTerminalContent(); + return; + } + } + const textFile = new TextFile(filename, code); + s.textFiles.push(textFile); + } else { + dialogBoxCreate("Invalid filename. Must be either a script (.script) or " + + " or text file (.txt)") + return; + } + props.engine.loadTerminalContent(); + } + + function beautify(): void { + setCode(code => beautifyCode(code, { + indent_size: 4, + brace_style: "preserve-inline", + })); + } + + function onFilenameChange(event: React.ChangeEvent): void { + setFilename(event.target.value); + } + + function openConfig(): void { + const id="script-editor-config-options-popup"; + createPopup(id, ConfigPopup, { + id: id, + config: {theme: config.theme}, + save: (config: Config) => setConfig(config), + }); + } + + function updateCode(newCode?: string): void { + if(newCode === undefined) return; + + setCode(newCode); + } + + useEffect(() => { + async function updateRAM() { + const codeCopy = code.repeat(1); + const ramUsage = await calculateRamUsage(codeCopy, props.player.getCurrentServer().scripts); + if (ramUsage > 0) { + console.log(ramUsage); + setRAM("RAM: " + numeralWrapper.formatRAM(ramUsage)); + return; + } + switch (ramUsage) { + case RamCalculationErrorCode.ImportError: { + setRAM("RAM: Import Error"); + break; + } + case RamCalculationErrorCode.URLImportError: { + setRAM("RAM: HTTP Import Error"); + break; + } + case RamCalculationErrorCode.SyntaxError: + default: { + setRAM("RAM: Syntax Error"); + break; + } + } + return new Promise(() => undefined); + } + const id = setInterval(() => { + console.log(code); + updateRAM(); + }, 10000); + return () => clearInterval(id); + }, []); + + return (
+
+

Script name:

+ + +
+ Loading script editor!

} + height="80%" + defaultLanguage="javascript" + defaultValue={code} + value={code} + onChange={updateCode} + theme="vs-dark" + options={config} + /> +
+ +

{ram}

+ + Netscript Documentation +
+
); +} \ No newline at end of file diff --git a/src/Terminal.jsx b/src/Terminal.jsx index aae32f0a9..26c465eaa 100644 --- a/src/Terminal.jsx +++ b/src/Terminal.jsx @@ -100,6 +100,7 @@ import * as JSZip from "jszip"; import * as FileSaver from "file-saver"; import * as libarg from 'arg'; import React from "react"; +import ReactDOM from 'react-dom'; function postNetburnerText() { diff --git a/src/engine.jsx b/src/engine.jsx index 284127d25..9da5821e2 100644 --- a/src/engine.jsx +++ b/src/engine.jsx @@ -71,6 +71,7 @@ import { scriptEditorInit, updateScriptEditorContent, } from "./Script/ScriptHelpers"; +import { Root as ScriptEditorRoot } from "./Monaco/ui/Root"; import { initForeignServers, AllServers } from "./Server/AllServers"; import { Settings } from "./Settings/Settings"; import { updateSourceFileFlags } from "./SourceFile/SourceFileFlags"; @@ -260,14 +261,16 @@ const Engine = { loadScriptEditorContent: function(filename = "", code = "") { Engine.hideAllContent(); Engine.Display.scriptEditorContent.style.display = "block"; - try { - getCurrentEditor().openScript(filename, code); - } catch(e) { - exceptionAlert(e); - } - - updateScriptEditorContent(); routing.navigateTo(Page.ScriptEditor); + + + const monaco = document.getElementById('monaco-editor'); + //https://www.npmjs.com/package/@monaco-editor/react#development-playground + ReactDOM.render( + , + Engine.Display.scriptEditorContent, + ); + MainMenuLinks.ScriptEditor.classList.add("active"); }, @@ -504,6 +507,7 @@ const Engine = { Engine.Display.terminalContent.style.display = "none"; Engine.Display.characterContent.style.display = "none"; Engine.Display.scriptEditorContent.style.display = "none"; + ReactDOM.unmountComponentAtNode(Engine.Display.scriptEditorContent); Engine.Display.activeScriptsContent.style.display = "none"; ReactDOM.unmountComponentAtNode(Engine.Display.activeScriptsContent); diff --git a/src/index.html b/src/index.html index 6a1fd5f9d..4bc0c086a 100644 --- a/src/index.html +++ b/src/index.html @@ -125,11 +125,8 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %> -
-
-
- Key Buffer: -
+
+
@@ -175,6 +172,14 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
+ + + + + + From 258716388ec53579bf729c8e1410d817a459f79e Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 01:57:32 -0400 Subject: [PATCH 02/12] focus works --- package-lock.json | 1602 +---------------------------------- package.json | 1 + src/Monaco/ui/Root.tsx | 83 +- src/Script/ScriptHelpers.js | 238 +----- src/engine.jsx | 20 - 5 files changed, 57 insertions(+), 1887 deletions(-) diff --git a/package-lock.json b/package-lock.json index 67d2fa071..979eae393 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,6 +38,7 @@ "loader-runner": "^2.3.0", "loader-utils": "^1.1.0", "memory-fs": "~0.4.1", + "monaco-editor": "^0.27.0", "node-sass": "^6.0.1", "normalize.css": "^8.0.0", "numeral": "2.0.6", @@ -166,12 +167,6 @@ "node": ">=6" } }, - "node_modules/@babel/core/node_modules/lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "node_modules/@babel/core/node_modules/minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", @@ -218,12 +213,6 @@ "node": ">=4" } }, - "node_modules/@babel/generator/node_modules/lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "node_modules/@babel/generator/node_modules/source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -458,12 +447,6 @@ "ms": "^2.1.1" } }, - "node_modules/@babel/traverse/node_modules/lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "node_modules/@babel/traverse/node_modules/ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", @@ -481,12 +464,6 @@ "to-fast-properties": "^2.0.0" } }, - "node_modules/@babel/types/node_modules/lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "node_modules/@emotion/hash": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", @@ -1953,11 +1930,6 @@ "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", "dev": true }, - "node_modules/async/node_modules/lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" - }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -2163,15 +2135,6 @@ "node": ">=0.10.0" } }, - "node_modules/base/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/base64-js": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", @@ -2225,12 +2188,6 @@ "platform": "^1.3.3" } }, - "node_modules/benchmark/node_modules/lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "node_modules/big.js": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", @@ -2600,15 +2557,6 @@ "node": ">=0.10.0" } }, - "node_modules/cache-base/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -2841,368 +2789,6 @@ "fsevents": "^1.1.2" } }, - "node_modules/chokidar/node_modules/anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "dependencies": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "node_modules/chokidar/node_modules/arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "dependencies": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/braces/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/chokidar/node_modules/expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "dependencies": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/expand-brackets/node_modules/define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "dependencies": { - "is-descriptor": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/expand-brackets/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/expand-brackets/node_modules/is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "dependencies": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/expand-brackets/node_modules/kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "dependencies": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/extglob/node_modules/define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "dependencies": { - "is-descriptor": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/extglob/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "dependencies": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/fill-range/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "dependencies": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "node_modules/chokidar/node_modules/glob-parent/node_modules/is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/is-accessor-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/is-data-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/is-glob": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", - "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/is-number/node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/chownr": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", @@ -3338,15 +2924,6 @@ "node": ">=0.10.0" } }, - "node_modules/class-utils/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/class-utils/node_modules/kind-of": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", @@ -4162,14 +3739,6 @@ "node": ">=0.10" } }, - "node_modules/dashdash/node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "engines": { - "node": ">=0.8" - } - }, "node_modules/data-urls": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", @@ -4347,15 +3916,6 @@ "node": ">=0.10.0" } }, - "node_modules/define-property/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/defined": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", @@ -6815,14 +6375,6 @@ "assert-plus": "^1.0.0" } }, - "node_modules/getpass/node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "engines": { - "node": ">=0.8" - } - }, "node_modules/glob": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", @@ -7184,15 +6736,6 @@ "node": ">=0.10.0" } }, - "node_modules/has-value/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/has-values": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", @@ -7206,30 +6749,6 @@ "node": ">=0.10.0" } }, - "node_modules/has-values/node_modules/is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-values/node_modules/is-number/node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/has-values/node_modules/kind-of": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", @@ -7434,12 +6953,6 @@ "object-assign": "^4.0.1" } }, - "node_modules/html-webpack-plugin/node_modules/lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "node_modules/htmlparser2": { "version": "3.9.2", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", @@ -7510,12 +7023,6 @@ "node": ">=4.0.0" } }, - "node_modules/http-proxy-middleware/node_modules/lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "node_modules/http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -8171,15 +7678,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-plain-object/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/is-posix-bracket": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", @@ -8622,11 +8120,6 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" }, - "node_modules/jshint/node_modules/lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" - }, "node_modules/jshint/node_modules/readable-stream": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", @@ -8734,14 +8227,6 @@ "verror": "1.10.0" } }, - "node_modules/jsprim/node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "engines": { - "node": ">=0.8" - } - }, "node_modules/jss": { "version": "10.6.0", "resolved": "https://registry.npmjs.org/jss/-/jss-10.6.0.tgz", @@ -9152,27 +8637,6 @@ "node": ">=4" } }, - "node_modules/log-symbols/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/log-symbols/node_modules/supports-color": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", - "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/loglevel": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", @@ -10413,12 +9877,6 @@ "node": ">=4" } }, - "node_modules/mochapack/node_modules/lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "node_modules/mochapack/node_modules/pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -10467,8 +9925,7 @@ "node_modules/monaco-editor": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.27.0.tgz", - "integrity": "sha512-UhwP78Wb8w0ZSYoKXQNTV/0CHObp6NS3nCt51QfKE6sKyBo5PBsvuDOHoI2ooBakc6uIwByRLHVeT7+yXQe2fQ==", - "peer": true + "integrity": "sha512-UhwP78Wb8w0ZSYoKXQNTV/0CHObp6NS3nCt51QfKE6sKyBo5PBsvuDOHoI2ooBakc6uIwByRLHVeT7+yXQe2fQ==" }, "node_modules/move-concurrently": { "version": "1.0.1", @@ -10543,24 +10000,6 @@ "node": ">=0.10.0" } }, - "node_modules/nanomatch/node_modules/arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nanomatch/node_modules/array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/nanomatch/node_modules/kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", @@ -11213,15 +10652,6 @@ "node": ">=0.10.0" } }, - "node_modules/object-visit/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/object.assign": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", @@ -11275,15 +10705,6 @@ "node": ">=0.10.0" } }, - "node_modules/object.pick/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/obuf": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", @@ -12381,12 +11802,6 @@ "node": ">=4" } }, - "node_modules/postcss-reporter/node_modules/lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "node_modules/postcss-reporter/node_modules/postcss": { "version": "6.0.23", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.23.tgz", @@ -12641,12 +12056,6 @@ "node": ">=4" } }, - "node_modules/postcss-sorting/node_modules/lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "node_modules/postcss-sorting/node_modules/postcss": { "version": "6.0.23", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.23.tgz", @@ -12920,7 +12329,6 @@ "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true, "engines": { "node": ">=0.6" } @@ -13594,12 +13002,6 @@ "node": ">=0.10.0" } }, - "node_modules/request-promise-core/node_modules/lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "node_modules/request-promise-native": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.7.tgz", @@ -13643,14 +13045,6 @@ "node": ">= 0.6" } }, - "node_modules/request/node_modules/qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "engines": { - "node": ">=0.6" - } - }, "node_modules/request/node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -14658,15 +14052,6 @@ "node": ">=0.10.0" } }, - "node_modules/snapdragon-node/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/snapdragon-util": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", @@ -15061,14 +14446,6 @@ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" }, - "node_modules/sshpk/node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "engines": { - "node": ">=0.8" - } - }, "node_modules/ssri": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", @@ -15516,12 +14893,6 @@ "node": ">=4" } }, - "node_modules/stylelint-order/node_modules/lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "node_modules/stylelint-order/node_modules/postcss": { "version": "6.0.23", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.23.tgz", @@ -15659,12 +15030,6 @@ "node": ">=4" } }, - "node_modules/stylelint/node_modules/electron-to-chromium": { - "version": "1.3.50", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.50.tgz", - "integrity": "sha1-dDi3b5K0G5GfP73TUPvQdX2s3fc=", - "dev": true - }, "node_modules/stylelint/node_modules/expand-brackets": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", @@ -15778,12 +15143,6 @@ "node": ">=4" } }, - "node_modules/stylelint/node_modules/lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "node_modules/stylelint/node_modules/map-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", @@ -15939,15 +15298,6 @@ "node": ">=4" } }, - "node_modules/stylelint/node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/stylelint/node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -16180,12 +15530,6 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "node_modules/table/node_modules/lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "node_modules/tapable": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.0.0.tgz", @@ -16376,18 +15720,6 @@ "node": ">=0.10.0" } }, - "node_modules/to-regex-range/node_modules/is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/toposort": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/toposort/-/toposort-1.0.7.tgz", @@ -16735,12 +16067,6 @@ "node": ">= 4.8 < 5.0.0 || >= 5.10" } }, - "node_modules/uglifyjs-webpack-plugin/node_modules/commander": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", - "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", - "dev": true - }, "node_modules/uglifyjs-webpack-plugin/node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -16750,22 +16076,6 @@ "node": ">=0.10.0" } }, - "node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es": { - "version": "3.3.9", - "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", - "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", - "dev": true, - "dependencies": { - "commander": "~2.13.0", - "source-map": "~0.6.1" - }, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/unherit": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.1.tgz", @@ -16967,15 +16277,6 @@ "node": ">=0.10.0" } }, - "node_modules/unset-value/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/upath": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/upath/-/upath-1.0.4.tgz", @@ -17043,36 +16344,6 @@ "node": ">= 6.9.0 || >= 8.9.0" } }, - "node_modules/url-loader/node_modules/ajv": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.1.tgz", - "integrity": "sha512-pgZos1vgOHDiC7gKNbZW8eKvCnNXARv2oqrGQT7Hzbq5Azp7aZG6DJzADnkuSq7RH6qkXp4J/m68yPX/2uBHyQ==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.1" - } - }, - "node_modules/url-loader/node_modules/ajv-keywords": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", - "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", - "dev": true - }, - "node_modules/url-loader/node_modules/fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "node_modules/url-loader/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, "node_modules/url-loader/node_modules/mime": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", @@ -17085,19 +16356,6 @@ "node": ">=4.0.0" } }, - "node_modules/url-loader/node_modules/schema-utils": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", - "integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", - "dev": true, - "dependencies": { - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0" - }, - "engines": { - "node": ">= 4.8.0 || >= 6.9.0 || >= 8.9.0" - } - }, "node_modules/url-parse": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.4.tgz", @@ -17225,14 +16483,6 @@ "extsprintf": "^1.2.0" } }, - "node_modules/verror/node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "engines": { - "node": ">=0.8" - } - }, "node_modules/vfile": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/vfile/-/vfile-2.3.0.tgz", @@ -17449,20 +16699,6 @@ "node": ">=4.8" } }, - "node_modules/webpack-cli/node_modules/enhanced-resolve": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.0.0.tgz", - "integrity": "sha512-jox/62b2GofV1qTUQTMPEJSDIGycS43evqYzD/KVtEb9OCoki9cnacUPxCrZa7JfPzZSYOCZhu9O9luaMxAX8g==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.4.0", - "tapable": "^1.0.0" - }, - "engines": { - "node": ">=6.11.5" - } - }, "node_modules/webpack-cli/node_modules/external-editor": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.0.tgz", @@ -17513,12 +16749,6 @@ "node": ">=6.0.0" } }, - "node_modules/webpack-cli/node_modules/lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "node_modules/webpack-cli/node_modules/strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", @@ -17531,15 +16761,6 @@ "node": ">=4" } }, - "node_modules/webpack-cli/node_modules/tapable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.0.0.tgz", - "integrity": "sha512-dQRhbNQkRnaqauC7WqSJ21EEksgT0fYZX2lqXzGkpo8JNig9zGZTYoMGvyI2nWmXlE2VSVXVDu7wLVGu/mQEsg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/webpack-dev-middleware": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-3.1.3.tgz", @@ -18134,36 +17355,6 @@ "node": ">=4" } }, - "node_modules/webpack-log/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/webpack-log/node_modules/supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/webpack-log/node_modules/uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", - "dev": true, - "bin": { - "uuid": "bin/uuid" - } - }, "node_modules/webpack-sources": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz", @@ -18378,49 +17569,6 @@ "node": ">= 6.9.0 || >= 8.9.0" } }, - "node_modules/worker-loader/node_modules/ajv": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.1.tgz", - "integrity": "sha512-pgZos1vgOHDiC7gKNbZW8eKvCnNXARv2oqrGQT7Hzbq5Azp7aZG6DJzADnkuSq7RH6qkXp4J/m68yPX/2uBHyQ==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.1" - } - }, - "node_modules/worker-loader/node_modules/ajv-keywords": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", - "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", - "dev": true - }, - "node_modules/worker-loader/node_modules/fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "node_modules/worker-loader/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "node_modules/worker-loader/node_modules/schema-utils": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", - "integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", - "dev": true, - "dependencies": { - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0" - }, - "engines": { - "node": ">= 4.8.0 || >= 6.9.0 || >= 8.9.0" - } - }, "node_modules/wrap-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", @@ -18692,12 +17840,6 @@ "node": ">=6" } }, - "node_modules/yargs-unparser/node_modules/lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "node_modules/yargs-unparser/node_modules/mem": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", @@ -18902,12 +18044,6 @@ "minimist": "^1.2.0" } }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", @@ -18947,12 +18083,6 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -19178,12 +18308,6 @@ "ms": "^2.1.1" } }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", @@ -19201,14 +18325,6 @@ "esutils": "^2.0.2", "lodash": "^4.17.11", "to-fast-properties": "^2.0.0" - }, - "dependencies": { - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - } } }, "@emotion/hash": { @@ -20426,13 +19542,6 @@ "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", "requires": { "lodash": "^4.17.10" - }, - "dependencies": { - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" - } } }, "async-each": { @@ -20619,12 +19728,6 @@ "requires": { "is-descriptor": "^1.0.0" } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true } } }, @@ -20677,14 +19780,6 @@ "requires": { "lodash": "^4.17.4", "platform": "^1.3.3" - }, - "dependencies": { - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - } } }, "big.js": { @@ -21027,14 +20122,6 @@ "to-object-path": "^0.3.0", "union-value": "^1.0.0", "unset-value": "^1.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } } }, "call-bind": { @@ -21230,308 +20317,6 @@ "path-is-absolute": "^1.0.0", "readdirp": "^2.0.0", "upath": "^1.0.0" - }, - "dependencies": { - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-glob": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", - "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - } } }, "chownr": { @@ -21646,12 +20431,6 @@ "kind-of": "^5.0.0" } }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, "kind-of": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", @@ -22355,13 +21134,6 @@ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "requires": { "assert-plus": "^1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } } }, "data-urls": { @@ -22511,14 +21283,6 @@ "requires": { "is-descriptor": "^1.0.2", "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } } }, "defined": { @@ -24572,13 +23336,6 @@ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "requires": { "assert-plus": "^1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } } }, "glob": { @@ -24877,14 +23634,6 @@ "get-value": "^2.0.6", "has-values": "^1.0.0", "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } } }, "has-values": { @@ -24897,26 +23646,6 @@ "kind-of": "^4.0.0" }, "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, "kind-of": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", @@ -25088,12 +23817,6 @@ "json5": "^0.5.0", "object-assign": "^4.0.1" } - }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true } } }, @@ -25156,14 +23879,6 @@ "is-glob": "^4.0.0", "lodash": "^4.17.11", "micromatch": "^3.1.10" - }, - "dependencies": { - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - } } }, "http-signature": { @@ -25682,14 +24397,6 @@ "dev": true, "requires": { "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } } }, "is-posix-bracket": { @@ -26056,11 +24763,6 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" - }, "readable-stream": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", @@ -26158,13 +24860,6 @@ "extsprintf": "1.3.0", "json-schema": "0.2.3", "verror": "1.10.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } } }, "jss": { @@ -26530,21 +25225,6 @@ "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "supports-color": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", - "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } } } }, @@ -27545,12 +26225,6 @@ "slash": "^1.0.0" } }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -27588,8 +26262,7 @@ "monaco-editor": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.27.0.tgz", - "integrity": "sha512-UhwP78Wb8w0ZSYoKXQNTV/0CHObp6NS3nCt51QfKE6sKyBo5PBsvuDOHoI2ooBakc6uIwByRLHVeT7+yXQe2fQ==", - "peer": true + "integrity": "sha512-UhwP78Wb8w0ZSYoKXQNTV/0CHObp6NS3nCt51QfKE6sKyBo5PBsvuDOHoI2ooBakc6uIwByRLHVeT7+yXQe2fQ==" }, "move-concurrently": { "version": "1.0.1", @@ -27658,18 +26331,6 @@ "to-regex": "^3.0.1" }, "dependencies": { - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", @@ -28189,14 +26850,6 @@ "dev": true, "requires": { "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } } }, "object.assign": { @@ -28238,14 +26891,6 @@ "dev": true, "requires": { "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } } }, "obuf": { @@ -29214,12 +27859,6 @@ "supports-color": "^5.3.0" } }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "postcss": { "version": "6.0.23", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.23.tgz", @@ -29431,12 +28070,6 @@ "supports-color": "^5.3.0" } }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "postcss": { "version": "6.0.23", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.23.tgz", @@ -29653,8 +28286,7 @@ "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, "query-string": { "version": "4.3.4", @@ -30247,11 +28879,6 @@ "mime-db": "~1.37.0" } }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -30271,14 +28898,6 @@ "dev": true, "requires": { "lodash": "^4.17.11" - }, - "dependencies": { - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - } } }, "request-promise-native": { @@ -31223,12 +29842,6 @@ "requires": { "is-descriptor": "^1.0.0" } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true } } }, @@ -31487,11 +30100,6 @@ "version": "0.2.3", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" } } }, @@ -31921,12 +30529,6 @@ "supports-color": "^5.3.0" } }, - "electron-to-chromium": { - "version": "1.3.50", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.50.tgz", - "integrity": "sha1-dDi3b5K0G5GfP73TUPvQdX2s3fc=", - "dev": true - }, "expand-brackets": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", @@ -32013,12 +30615,6 @@ "strip-bom": "^3.0.0" } }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "map-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", @@ -32141,12 +30737,6 @@ "strip-indent": "^2.0.0" } }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -32216,12 +30806,6 @@ "supports-color": "^5.3.0" } }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "postcss": { "version": "6.0.23", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.23.tgz", @@ -32404,12 +30988,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true - }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true } } }, @@ -32572,17 +31150,6 @@ "requires": { "is-number": "^3.0.0", "repeat-string": "^1.6.1" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - } } }, "toposort": { @@ -32868,27 +31435,11 @@ "worker-farm": "^1.5.2" }, "dependencies": { - "commander": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", - "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", - "dev": true - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true - }, - "uglify-es": { - "version": "3.3.9", - "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", - "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", - "dev": true, - "requires": { - "commander": "~2.13.0", - "source-map": "~0.6.1" - } } } }, @@ -33072,12 +31623,6 @@ "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true } } }, @@ -33149,51 +31694,11 @@ "schema-utils": "^0.4.3" }, "dependencies": { - "ajv": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.1.tgz", - "integrity": "sha512-pgZos1vgOHDiC7gKNbZW8eKvCnNXARv2oqrGQT7Hzbq5Azp7aZG6DJzADnkuSq7RH6qkXp4J/m68yPX/2uBHyQ==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.1" - } - }, - "ajv-keywords": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", - "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", - "dev": true - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, "mime": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", "dev": true - }, - "schema-utils": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", - "integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0" - } } } }, @@ -33300,13 +31805,6 @@ "assert-plus": "^1.0.0", "core-util-is": "1.0.2", "extsprintf": "^1.2.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } } }, "vfile": { @@ -33548,17 +32046,6 @@ "which": "^1.2.9" } }, - "enhanced-resolve": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.0.0.tgz", - "integrity": "sha512-jox/62b2GofV1qTUQTMPEJSDIGycS43evqYzD/KVtEb9OCoki9cnacUPxCrZa7JfPzZSYOCZhu9O9luaMxAX8g==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.4.0", - "tapable": "^1.0.0" - } - }, "external-editor": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.0.tgz", @@ -33600,12 +32087,6 @@ "through": "^2.3.6" } }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", @@ -33614,12 +32095,6 @@ "requires": { "ansi-regex": "^3.0.0" } - }, - "tapable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.0.0.tgz", - "integrity": "sha512-dQRhbNQkRnaqauC7WqSJ21EEksgT0fYZX2lqXzGkpo8JNig9zGZTYoMGvyI2nWmXlE2VSVXVDu7wLVGu/mQEsg==", - "dev": true } } }, @@ -34101,27 +32576,6 @@ "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", - "dev": true } } }, @@ -34260,48 +32714,6 @@ "requires": { "loader-utils": "^1.0.0", "schema-utils": "^0.4.0" - }, - "dependencies": { - "ajv": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.1.tgz", - "integrity": "sha512-pgZos1vgOHDiC7gKNbZW8eKvCnNXARv2oqrGQT7Hzbq5Azp7aZG6DJzADnkuSq7RH6qkXp4J/m68yPX/2uBHyQ==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.1" - } - }, - "ajv-keywords": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", - "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", - "dev": true - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "schema-utils": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", - "integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0" - } - } } }, "wrap-ansi": { @@ -34562,12 +32974,6 @@ "path-exists": "^3.0.0" } }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, "mem": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", diff --git a/package.json b/package.json index fda0a0d6f..2ba11f68a 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "loader-runner": "^2.3.0", "loader-utils": "^1.1.0", "memory-fs": "~0.4.1", + "monaco-editor": "^0.27.0", "node-sass": "^6.0.1", "normalize.css": "^8.0.0", "numeral": "2.0.6", diff --git a/src/Monaco/ui/Root.tsx b/src/Monaco/ui/Root.tsx index 6f99ab61a..53ab29dba 100644 --- a/src/Monaco/ui/Root.tsx +++ b/src/Monaco/ui/Root.tsx @@ -1,6 +1,8 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import { StdButton } from "../../ui/React/StdButton"; import Editor from "@monaco-editor/react"; +import * as monaco from "monaco-editor"; +import IStandaloneCodeEditor = monaco.editor.IStandaloneCodeEditor; import { createPopup } from "../../ui/React/createPopup"; import { ConfigPopup } from "./ConfigPopup"; import { Config } from "./Config"; @@ -16,6 +18,7 @@ import { TextFile } from "../../TextFile"; import { calculateRamUsage } from "../../Script/RamCalculations"; import { RamCalculationErrorCode } from "../../Script/RamCalculationErrorCodes"; import { numeralWrapper } from "../../ui/numeralFormat"; +import { CursorPositions } from "../../ScriptEditor/CursorPositions"; interface IProps { filename: string; @@ -30,13 +33,22 @@ interface IProps { // https://www.npmjs.com/package/@monaco-editor/react#development-playground export function Root(props: IProps): React.ReactElement { + const editorRef = useRef(null); const [filename, setFilename] = useState(props.filename); const [code, setCode] = useState(props.code); const [ram, setRAM] = useState(''); const [config, setConfig] = useState({theme: 'vs-dark'}); function save(): void { - //CursorPositions.saveCursor(filename, cursor); + if(editorRef.current !== null) { + const position = editorRef.current.getPosition(); + if(position !== null) { + CursorPositions.saveCursor(filename, { + row: position.lineNumber, + column: position.column, + }); + } + } // TODO(hydroflame): re-enable the tutorial. // if (ITutorial.isRunning && ITutorial.currStep === iTutorialSteps.TerminalTypeScript) { @@ -141,42 +153,46 @@ export function Root(props: IProps): React.ReactElement { function updateCode(newCode?: string): void { if(newCode === undefined) return; - setCode(newCode); } - useEffect(() => { - async function updateRAM() { - const codeCopy = code.repeat(1); - const ramUsage = await calculateRamUsage(codeCopy, props.player.getCurrentServer().scripts); - if (ramUsage > 0) { - console.log(ramUsage); - setRAM("RAM: " + numeralWrapper.formatRAM(ramUsage)); - return; - } - switch (ramUsage) { - case RamCalculationErrorCode.ImportError: { - setRAM("RAM: Import Error"); - break; - } - case RamCalculationErrorCode.URLImportError: { - setRAM("RAM: HTTP Import Error"); - break; - } - case RamCalculationErrorCode.SyntaxError: - default: { - setRAM("RAM: Syntax Error"); - break; - } - } - return new Promise(() => undefined); + async function updateRAM(): Promise { + const codeCopy = code+""; + const ramUsage = await calculateRamUsage(codeCopy, props.player.getCurrentServer().scripts); + if (ramUsage > 0) { + setRAM("RAM: " + numeralWrapper.formatRAM(ramUsage)); + return; } - const id = setInterval(() => { - console.log(code); - updateRAM(); - }, 10000); + switch (ramUsage) { + case RamCalculationErrorCode.ImportError: { + setRAM("RAM: Import Error"); + break; + } + case RamCalculationErrorCode.URLImportError: { + setRAM("RAM: HTTP Import Error"); + break; + } + case RamCalculationErrorCode.SyntaxError: + default: { + setRAM("RAM: Syntax Error"); + break; + } + } + return new Promise(() => undefined); + } + + useEffect(() => { + const id = setInterval(updateRAM, 1000); return () => clearInterval(id); - }, []); + }, [code]); + + function onMount(editor: IStandaloneCodeEditor): void { + editorRef.current = editor; + if(editorRef.current === null) return; + const position = CursorPositions.getCursor(filename); + editorRef.current.setPosition({lineNumber: position.row, column: position.column}); + editorRef.current.focus(); + } return (
@@ -185,6 +201,7 @@ export function Root(props: IProps): React.ReactElement {
Loading script editor!

} height="80%" defaultLanguage="javascript" diff --git a/src/Script/ScriptHelpers.js b/src/Script/ScriptHelpers.js index 2be4903e5..dad34cfe7 100644 --- a/src/Script/ScriptHelpers.js +++ b/src/Script/ScriptHelpers.js @@ -31,111 +31,6 @@ import { compareArrays } from "../../utils/helpers/compareArrays"; import { createElement } from "../../utils/uiHelpers/createElement"; var scriptEditorRamText = null; -export function scriptEditorInit() { - // Wrapper container that holds all the buttons below the script editor - const wrapper = document.getElementById("script-editor-buttons-wrapper"); - if (wrapper == null) { - console.error("Could not find 'script-editor-buttons-wrapper'"); - return false; - } - - // Beautify button - const beautifyButton = createElement("button", { - class: "std-button", - display: "inline-block", - innerText: "Beautify", - clickListener:()=>{ - let editor = getCurrentEditor(); - if (editor != null) { - editor.beautifyScript(); - } - return false; - }, - }); - - // Text that displays RAM calculation - scriptEditorRamText = createElement("p", { - display:"inline-block", margin:"10px", id:"script-editor-status-text", - }); - - // Link to Netscript documentation - const documentationButton = createElement("a", { - class: "std-button", - display: "inline-block", - href:"https://bitburner.readthedocs.io/en/latest/index.html", - innerText:"Netscript Documentation", - target:"_blank", - }); - - // Save and Close button - const closeButton = createElement("button", { - class: "std-button", - display: "inline-block", - innerText: "Save & Close (Ctrl/Cmd + b)", - clickListener:()=>{ - saveAndCloseScriptEditor(); - return false; - }, - }); - - // Add all buttons to the UI - wrapper.appendChild(beautifyButton); - wrapper.appendChild(closeButton); - wrapper.appendChild(scriptEditorRamText); - wrapper.appendChild(documentationButton); - - // Initialize editors - const initParams = { - saveAndCloseFn: saveAndCloseScriptEditor, - quitFn: Engine.loadTerminalContent, - } - - AceEditor.init(initParams); - CodeMirrorEditor.init(initParams); - - // Setup the selector for which Editor to use - const editorSelector = document.getElementById("script-editor-option-editor"); - if (editorSelector == null) { - console.error(`Could not find DOM Element for editor selector (id=script-editor-option-editor)`); - return false; - } - - for (let i = 0; i < editorSelector.options.length; ++i) { - if (editorSelector.options[i].value === Settings.Editor) { - editorSelector.selectedIndex = i; - break; - } - } - - editorSelector.onchange = () => { - const opt = editorSelector.value; - switch (opt) { - case EditorSetting.Ace: { - const codeMirrorCode = CodeMirrorEditor.getCode(); - const codeMirrorFn = CodeMirrorEditor.getFilename(); - AceEditor.create(); - CodeMirrorEditor.setInvisible(); - AceEditor.openScript(codeMirrorFn, codeMirrorCode); - break; - } - case EditorSetting.CodeMirror: { - const aceCode = AceEditor.getCode(); - const aceFn = AceEditor.getFilename(); - CodeMirrorEditor.create(); - AceEditor.setInvisible(); - CodeMirrorEditor.openScript(aceFn, aceCode); - break; - } - default: - console.error(`Unrecognized Editor Setting: ${opt}`); - return; - } - - Settings.Editor = opt; - } - - editorSelector.onchange(); // Trigger the onchange event handler -} export function getCurrentEditor() { switch (Settings.Editor) { @@ -149,43 +44,7 @@ export function getCurrentEditor() { } } -//Updates RAM usage in script -export async function updateScriptEditorContent() { - var filename = document.getElementById("script-editor-filename").value; - if (!isScriptFilename(filename)) { - scriptEditorRamText.innerText = "RAM: N/A"; - return; - } - - let code; - try { - code = getCurrentEditor().getCode(); - } catch(e) { - scriptEditorRamText.innerText = "RAM: ERROR"; - return; - } - - var codeCopy = code.repeat(1); - var ramUsage = await calculateRamUsage(codeCopy, Player.getCurrentServer().scripts); - if (ramUsage > 0) { - scriptEditorRamText.innerText = "RAM: " + numeralWrapper.formatRAM(ramUsage); - } else { - switch (ramUsage) { - case RamCalculationErrorCode.ImportError: - scriptEditorRamText.innerText = "RAM: Import Error"; - break; - case RamCalculationErrorCode.URLImportError: - scriptEditorRamText.innerText = "RAM: HTTP Import Error"; - break; - case RamCalculationErrorCode.SyntaxError: - default: - scriptEditorRamText.innerText = "RAM: Syntax Error"; - break; - } - - } -} - +// TODO(hydroflame): move to Monaco mount/unmount //Define key commands in script editor (ctrl o to save + close, etc.) $(document).keydown(function(e) { if (Settings.DisableHotkeys === true) {return;} @@ -193,104 +52,11 @@ $(document).keydown(function(e) { //Ctrl + b if (e.keyCode == 66 && (e.ctrlKey || e.metaKey)) { e.preventDefault(); - saveAndCloseScriptEditor(); + saveAndCloseScriptEditor(); // deleted function } } }); -function saveAndCloseScriptEditor() { - var filename = document.getElementById("script-editor-filename").value; - - let code, cursor; - try { - code = getCurrentEditor().getCode(); - cursor = getCurrentEditor().getCursor(); - CursorPositions.saveCursor(filename, cursor); - } catch(e) { - dialogBoxCreate("Something went wrong when trying to save (getCurrentEditor().getCode() or getCurrentEditor().getCursor()). Please report to game developer with details"); - return; - } - - if (ITutorial.isRunning && ITutorial.currStep === iTutorialSteps.TerminalTypeScript) { - //Make sure filename + code properly follow tutorial - if (filename !== "n00dles.script") { - dialogBoxCreate("Leave the script name as 'n00dles'!"); - return; - } - code = code.replace(/\s/g, ""); - if (code.indexOf("while(true){hack('n00dles');}") == -1) { - dialogBoxCreate("Please copy and paste the code from the tutorial!"); - return; - } - - //Save the script - let s = Player.getCurrentServer(); - for (var i = 0; i < s.scripts.length; i++) { - if (filename == s.scripts[i].filename) { - s.scripts[i].saveScript(getCurrentEditor().getCode(), Player.currentServer, Player.getCurrentServer().scripts); - Engine.loadTerminalContent(); - return iTutorialNextStep(); - } - } - - // If the current script does NOT exist, create a new one - let script = new Script(); - script.saveScript(getCurrentEditor().getCode(), Player.currentServer, Player.getCurrentServer().scripts); - s.scripts.push(script); - - return iTutorialNextStep(); - } - - if (filename == "") { - dialogBoxCreate("You must specify a filename!"); - return; - } - - if (filename !== ".fconf" && !isValidFilePath(filename)) { - dialogBoxCreate("Script filename can contain only alphanumerics, hyphens, and underscores, and must end with an extension."); - return; - } - - var s = Player.getCurrentServer(); - if (filename === ".fconf") { - try { - parseFconfSettings(code); - } catch(e) { - dialogBoxCreate(`Invalid .fconf file: ${e}`); - return; - } - } else if (isScriptFilename(filename)) { - //If the current script already exists on the server, overwrite it - for (let i = 0; i < s.scripts.length; i++) { - if (filename == s.scripts[i].filename) { - s.scripts[i].saveScript(getCurrentEditor().getCode(), Player.currentServer, Player.getCurrentServer().scripts); - Engine.loadTerminalContent(); - return; - } - } - - //If the current script does NOT exist, create a new one - const script = new Script(); - script.saveScript(getCurrentEditor().getCode(), Player.currentServer, Player.getCurrentServer().scripts); - s.scripts.push(script); - } else if (filename.endsWith(".txt")) { - for (let i = 0; i < s.textFiles.length; ++i) { - if (s.textFiles[i].fn === filename) { - s.textFiles[i].write(code); - Engine.loadTerminalContent(); - return; - } - } - const textFile = new TextFile(filename, code); - s.textFiles.push(textFile); - } else { - dialogBoxCreate("Invalid filename. Must be either a script (.script) or " + - " or text file (.txt)") - return; - } - Engine.loadTerminalContent(); -} - export function scriptCalculateOfflineProduction(runningScriptObj) { //The Player object stores the last update time from when we were online const thisUpdate = new Date().getTime(); diff --git a/src/engine.jsx b/src/engine.jsx index 9da5821e2..ed2c02d1e 100644 --- a/src/engine.jsx +++ b/src/engine.jsx @@ -66,11 +66,6 @@ import { } from "./Programs/ProgramHelpers"; import { redPillFlag } from "./RedPill"; import { saveObject, loadGame } from "./SaveObject"; -import { - getCurrentEditor, - scriptEditorInit, - updateScriptEditorContent, -} from "./Script/ScriptHelpers"; import { Root as ScriptEditorRoot } from "./Monaco/ui/Root"; import { initForeignServers, AllServers } from "./Server/AllServers"; import { Settings } from "./Settings/Settings"; @@ -136,13 +131,6 @@ import ReactDOM from "react-dom"; $(document).keydown(function(e) { if (Settings.DisableHotkeys === true) {return;} - // These hotkeys should be disabled if the player is writing scripts - try { - if (getCurrentEditor().isFocused()) { - return; - } - } catch(error) {} - if (!Player.isWorking && !redPillFlag && !inMission && !cinematicTextFlag) { if (e.keyCode == KEY.T && e.altKey) { e.preventDefault(); @@ -797,13 +785,6 @@ const Engine = { Engine.Counters.updateDisplaysMed = 9; } - if (Engine.Counters.updateDisplaysLong <= 0) { - if (routing.isOn(Page.ScriptEditor)) { - updateScriptEditorContent(); - } - Engine.Counters.updateDisplaysLong = 15; - } - if (Engine.Counters.createProgramNotifications <= 0) { var num = getNumAvailableCreateProgram(); var elem = document.getElementById("create-program-notification"); @@ -1207,7 +1188,6 @@ const Engine = { } // Initialize labels on game settings setSettingsLabels(); - scriptEditorInit(); Terminal.resetTerminalInput(); }, From ed62a3ebc24f6a1290c68b44742795903145b5ba Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 02:00:25 -0400 Subject: [PATCH 03/12] deleted ace and monaco --- src/Script/ScriptHelpers.js | 16 - src/ScriptEditor/Ace.js | 329 ------- src/ScriptEditor/AceNetscriptMode.js | 807 ----------------- src/ScriptEditor/CodeMirror.js | 596 ------------- src/ScriptEditor/CodeMirrorNetscriptLint.js | 83 -- src/ScriptEditor/CodeMirrorNetscriptMode.js | 939 -------------------- src/ScriptEditor/ScriptEditor.js | 61 -- src/Terminal.jsx | 2 - 8 files changed, 2833 deletions(-) delete mode 100644 src/ScriptEditor/Ace.js delete mode 100644 src/ScriptEditor/AceNetscriptMode.js delete mode 100644 src/ScriptEditor/CodeMirror.js delete mode 100644 src/ScriptEditor/CodeMirrorNetscriptLint.js delete mode 100644 src/ScriptEditor/CodeMirrorNetscriptMode.js delete mode 100644 src/ScriptEditor/ScriptEditor.js diff --git a/src/Script/ScriptHelpers.js b/src/Script/ScriptHelpers.js index dad34cfe7..07129f4f2 100644 --- a/src/Script/ScriptHelpers.js +++ b/src/Script/ScriptHelpers.js @@ -13,8 +13,6 @@ import { ITutorial, } from "../InteractiveTutorial"; import { Player } from "../Player"; -import { AceEditor } from "../ScriptEditor/Ace"; -import { CodeMirrorEditor } from "../ScriptEditor/CodeMirror"; import { CursorPositions } from "../ScriptEditor/CursorPositions"; import { AllServers } from "../Server/AllServers"; import { processSingleServerGrowth } from "../Server/ServerHelpers"; @@ -30,20 +28,6 @@ import { dialogBoxCreate } from "../../utils/DialogBox"; import { compareArrays } from "../../utils/helpers/compareArrays"; import { createElement } from "../../utils/uiHelpers/createElement"; -var scriptEditorRamText = null; - -export function getCurrentEditor() { - switch (Settings.Editor) { - case EditorSetting.Ace: - return AceEditor; - case EditorSetting.CodeMirror: - return CodeMirrorEditor; - default: - throw new Error(`Invalid Editor Setting: ${Settings.Editor}`); - return null; - } -} - // TODO(hydroflame): move to Monaco mount/unmount //Define key commands in script editor (ctrl o to save + close, etc.) $(document).keydown(function(e) { diff --git a/src/ScriptEditor/Ace.js b/src/ScriptEditor/Ace.js deleted file mode 100644 index 78f25f0ec..000000000 --- a/src/ScriptEditor/Ace.js +++ /dev/null @@ -1,329 +0,0 @@ -import { ScriptEditor } from "./ScriptEditor"; - -import ace from 'brace'; - -import 'brace/mode/javascript'; -import './AceNetscriptMode'; -import 'brace/theme/chaos'; -import 'brace/theme/chrome'; -import 'brace/theme/monokai'; -import 'brace/theme/solarized_dark'; -import 'brace/theme/solarized_light'; -import 'brace/theme/terminal'; -import 'brace/theme/twilight'; -import 'brace/theme/xcode'; -import "brace/keybinding/vim"; -import "brace/keybinding/emacs"; -import "brace/ext/language_tools"; - -import { NetscriptFunctions } from "../NetscriptFunctions"; -import { Settings } from "../Settings/Settings"; -import { AceKeybindingSetting } from "../Settings/SettingEnums"; - -import { clearEventListeners } from "../../utils/uiHelpers/clearEventListeners"; -import { createElement } from "../../utils/uiHelpers/createElement"; -import { createOptionElement } from "../../utils/uiHelpers/createOptionElement"; -import { removeChildrenFromElement } from "../../utils/uiHelpers/removeChildrenFromElement"; - -// Wrapper for Ace editor -const Keybindings = { - ace: null, - vim: "ace/keyboard/vim", - emacs: "ace/keyboard/emacs", -}; - -function validateInitializationParamters(params) { - if (params.saveAndCloseFn == null) { return false; } // Save & close button function - if (params.quitFn == null) { return false; } // Quitting editor, aka Engine.loadTerminalContent - - return true; -} - -class AceEditorWrapper extends ScriptEditor { - constructor() { - super(); - this.vimCommandDisplayWrapper = null; - } - - init(params) { - if (this.editor != null) { - console.error(`AceEditor.init() called when it's already initialized`); - return false; - } - - // Validate/Sanitize input - if (!validateInitializationParamters(params)) { - console.error(`'params' argument passed into initAceEditor() does not have proper properties`); - return false; - } - - // Store the filename input - this.filenameInput = document.getElementById("script-editor-filename"); - if (this.filenameInput == null) { - console.error(`Could not get Script Editor filename element (id=script-editor-filename)`); - return false; - } - - // Initialize ACE Script editor - this.editor = ace.edit('ace-editor'); - this.editor.getSession().setMode('ace/mode/netscript'); - this.editor.setTheme('ace/theme/monokai'); - const editorElement = document.getElementById('ace-editor'); - if (editorElement == null) { return false; } - editorElement.style.fontSize = '16px'; - this.editor.setOption("showPrintMargin", false); - - // Configure some of the VIM keybindings - ace.config.loadModule('ace/keyboard/vim', function(module) { - var VimApi = module.CodeMirror.Vim; - VimApi.defineEx('write', 'w', function(/*cm, input*/) { - params.saveAndCloseFn(); - }); - VimApi.defineEx('quit', 'q', function(/*cm, input*/) { - params.quitFn(); - }); - VimApi.defineEx('xwritequit', 'x', function(/*cm, input*/) { - params.saveAndCloseFn(); - }); - VimApi.defineEx('wqwritequit', 'wq', function(/*cm, input*/) { - params.saveAndCloseFn(); - }); - }); - - // Store a reference to the VIM command display - this.vimCommandDisplayWrapper = document.getElementById("codemirror-vim-command-display-wrapper"); - if (this.vimCommandDisplayWrapper == null) { - console.error(`Could not get Vim Command Display element (id=codemirror-vim-command-display-wrapper)`); - return false; - } - - //Function autocompleter - this.editor.setOption("enableBasicAutocompletion", true); - var autocompleter = { - getCompletions: function(editor, session, pos, prefix, callback) { - if (prefix.length === 0) {callback(null, []); return;} - var words = []; - var fns = NetscriptFunctions(null); - for (let name in fns) { - if (fns.hasOwnProperty(name)) { - words.push({ - name: name, - value: name, - }); - - //Get functions from namespaces - const namespaces = ["bladeburner", "hacknet", "codingcontract", "gang", "sleeve"]; - if (namespaces.includes(name)) { - let namespace = fns[name]; - if (typeof namespace !== "object") {continue;} - let namespaceFns = Object.keys(namespace); - for (let i = 0; i < namespaceFns.length; ++i) { - words.push({ - name: namespaceFns[i], - value: namespaceFns[i], - }); - } - } - } - } - callback(null, words); - }, - } - this.editor.completers = [autocompleter]; - - return true; - } - - initialized() { - return (this.editor != null); - } - - // Create the configurable Options for this Editor - create() { - function safeGetElementById(id, whatFor="") { - const elem = document.getElementById(id); - if (elem == null) { - throw new Error(`Could not find ${whatFor} DOM element(id=${id})`); - } - - return elem; - } - - function safeClearEventListeners(id, whatFor="") { - const elem = clearEventListeners(id); - if (elem == null) { - throw new Error(`Could not find ${whatFor} DOM element(id=${id})`); - } - - return elem; - } - - try { - // Set editor to visible - const elem = document.getElementById("ace-editor"); - if (elem instanceof HTMLElement) { - elem.style.display = "block"; - } - - // Make sure the Vim command display from CodeMirror is invisible - if (this.vimCommandDisplayWrapper instanceof HTMLElement) { - this.vimCommandDisplayWrapper.style.display = "none"; - } - - // Theme - const themeDropdown = safeClearEventListeners("script-editor-option-theme", "Theme Selector"); - removeChildrenFromElement(themeDropdown); - themeDropdown.add(createOptionElement("Chaos")); - themeDropdown.add(createOptionElement("Chrome")); - themeDropdown.add(createOptionElement("Monokai")); - themeDropdown.add(createOptionElement("Solarized Dark", "Solarized_Dark")); - themeDropdown.add(createOptionElement("Solarized Light", "Solarized_Light")); - themeDropdown.add(createOptionElement("Terminal")); - themeDropdown.add(createOptionElement("Twilight")); - themeDropdown.add(createOptionElement("XCode")); - if (Settings.EditorTheme) { - var initialIndex = 2; - for (var i = 0; i < themeDropdown.options.length; ++i) { - if (themeDropdown.options[i].value === Settings.EditorTheme) { - initialIndex = i; - break; - } - } - themeDropdown.selectedIndex = initialIndex; - } else { - themeDropdown.selectedIndex = 2; - } - - themeDropdown.onchange = () => { - const val = themeDropdown.value; - Settings.EditorTheme = val; - const themePath = "ace/theme/" + val.toLowerCase(); - this.editor.setTheme(themePath); - }; - themeDropdown.onchange(); - - // Keybinding - const keybindingDropdown = safeClearEventListeners("script-editor-option-keybinding", "Keybinding Selector"); - removeChildrenFromElement(keybindingDropdown); - keybindingDropdown.add(createOptionElement("Ace", AceKeybindingSetting.Ace)); - keybindingDropdown.add(createOptionElement("Vim", AceKeybindingSetting.Vim)); - keybindingDropdown.add(createOptionElement("Emacs", AceKeybindingSetting.Emacs)); - if (Settings.EditorKeybinding) { - // Sanitize the Keybinding setting - if (!(Object.values(AceKeybindingSetting).includes(Settings.EditorKeybinding))) { - Settings.EditorKeybinding = AceKeybindingSetting.Ace; - } - var initialIndex = 0; - for (var i = 0; i < keybindingDropdown.options.length; ++i) { - if (keybindingDropdown.options[i].value === Settings.EditorKeybinding) { - initialIndex = i; - break; - } - } - keybindingDropdown.selectedIndex = initialIndex; - } else { - keybindingDropdown.selectedIndex = 0; - } - keybindingDropdown.onchange = () => { - var val = keybindingDropdown.value; - Settings.EditorKeybinding = val; - this.editor.setKeyboardHandler(Keybindings[val.toLowerCase()]); - }; - keybindingDropdown.onchange(); - - // Highlight Active line - const highlightActiveChkBox = safeClearEventListeners("script-editor-option-highlightactiveline", "Active Line Checkbox"); - highlightActiveChkBox.checked = Settings.EditorHighlightActiveLine; - highlightActiveChkBox.onchange = () => { - Settings.EditorHighlightActiveLine = highlightActiveChkBox.checked; - this.editor.setHighlightActiveLine(highlightActiveChkBox.checked); - }; - - // Show Invisibles - const showInvisiblesChkBox = safeClearEventListeners("script-editor-option-showinvisibles", "Show Invisible Checkbox"); - showInvisiblesChkBox.checked = Settings.EditorShowInvisibles; - showInvisiblesChkBox.onchange = () => { - Settings.EditorShowInvisibles = showInvisiblesChkBox.checked; - this.editor.setShowInvisibles(showInvisiblesChkBox.checked); - }; - - // Use Soft Tab - const softTabChkBox = safeClearEventListeners("script-editor-option-usesofttab", "Soft Tab Checkbox"); - softTabChkBox.checked = Settings.EditorUseSoftTab; - softTabChkBox.onchange = () => { - Settings.EditorUseSoftTab = softTabChkBox.checked; - this.editor.getSession().setUseSoftTabs(softTabChkBox.checked); - }; - - // Some helper functions for dealing with flexible options - function resetFlexibleOption(id) { - const fieldset = safeGetElementById(id); - removeChildrenFromElement(fieldset); - fieldset.style.display = "block"; - return fieldset; - } - - function removeFlexibleOption(id) { - // This doesn't really remove it, just sets it to invisible - const fieldset = resetFlexibleOption(id); - fieldset.style.display = "none"; - return fieldset; - } - - // Jshint Maxerr (Flex 1) - const flex1Fieldset = resetFlexibleOption("script-editor-option-flex1-fieldset"); - const flex1Id = "script-editor-option-maxerr"; - const flex1ValueLabel = createElement("em", { innerText: "200" }); - flex1Fieldset.appendChild(createElement("label", { - for: flex1Id, - innerText: "Max Error Count", - })); - const flex1Input = createElement("input", { - id: flex1Id, - max: "1000", - min: "50", - name: flex1Id, - step: "1", - type: "range", - value: "200", - changeListener: () => { - this.editor.getSession().$worker.send("changeOptions", [{maxerr:flex1Input.value}]); - flex1ValueLabel.innerText = flex1Input.value; - }, - }); - flex1Fieldset.appendChild(flex1Input); - flex1Fieldset.appendChild(flex1ValueLabel); - - // Nothing for Flex Options 2-4 - removeFlexibleOption("script-editor-option-flex2-fieldset"); - removeFlexibleOption("script-editor-option-flex3-fieldset"); - removeFlexibleOption("script-editor-option-flex4-fieldset"); - } catch(e) { - console.error(`Exception caught: ${e}`); - return false; - } - } - - isFocused() { - if (this.editor == null) { return false; } - return this.editor.isFocused(); - } - - // Sets the editor to be invisible. Does not require this class to be initialized - setInvisible() { - const elem = document.getElementById("ace-editor"); - if (elem instanceof HTMLElement) { - elem.style.display = "none"; - } - } - - getCursor() { - return this.editor.getCursorPosition(); - } - - setCursor(pos) { - this.editor.gotoLine(pos.row+1, pos.column); - } -} - -export const AceEditor = new AceEditorWrapper(); diff --git a/src/ScriptEditor/AceNetscriptMode.js b/src/ScriptEditor/AceNetscriptMode.js deleted file mode 100644 index d8d6c2233..000000000 --- a/src/ScriptEditor/AceNetscriptMode.js +++ /dev/null @@ -1,807 +0,0 @@ -//This file should be copied into brace/mode/netscript.js -import { NetscriptFunctions } from '../NetscriptFunctions'; - -ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports) { -"use strict"; - -var oop = acequire("../lib/oop"); -var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules; - -var DocCommentHighlightRules = function() { - this.$rules = { - "start" : [ { - token : "comment.doc.tag", - regex : "@[\\w\\d_]+", // TODO: fix email addresses - }, - DocCommentHighlightRules.getTagRule(), - { - defaultToken : "comment.doc", - caseInsensitive: true, - }], - }; -}; - -oop.inherits(DocCommentHighlightRules, TextHighlightRules); - -DocCommentHighlightRules.getTagRule = function() { - return { - token : "comment.doc.tag.storage.type", - regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b", - }; -} - -DocCommentHighlightRules.getStartRule = function(start) { - return { - token : "comment.doc", // doc comment - regex : "\\/\\*(?=\\*)", - next : start, - }; -}; - -DocCommentHighlightRules.getEndRule = function (start) { - return { - token : "comment.doc", // closing comment - regex : "\\*\\/", - next : start, - }; -}; - -exports.DocCommentHighlightRules = DocCommentHighlightRules; - -}); - -ace.define("ace/mode/netscript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(acequire, exports) { -"use strict"; - -var oop = acequire("../lib/oop"); -var DocCommentHighlightRules = acequire("./doc_comment_highlight_rules").DocCommentHighlightRules; -var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules; -var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*"; - -let functions = (function(){ - function recursiveKeywords(namespace) { - let keywords = []; - for(const elem of Object.keys(namespace)) { - keywords.push(elem); - if(typeof namespace[elem] == 'object') { - keywords = keywords.concat(recursiveKeywords(namespace[elem])); - } - } - return keywords; - } - - const ns = NetscriptFunctions(null); - // reverse is important so that both clearLog and clear are highlighted. - return recursiveKeywords(ns).sort().reverse().join("|"); -})(); - -var NetscriptHighlightRules = function(options) { - var keywordMapper = this.createKeywordMapper({ - "variable.language": - "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors - "Namespace|QName|XML|XMLList|" + // E4X - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors - "SyntaxError|TypeError|URIError|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions - "isNaN|parseFloat|parseInt|" + - "ns|" + functions +"|" + - "JSON|Math|" + // Other - "this|arguments|prototype|window|document" , // Pseudo - "keyword": - "const|yield|import|get|set|async|await|" + - "break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + - "__parent__|__count__|escape|unescape|with|__proto__|" + - "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", - "storage.type": - "const|let|var|function", - "constant.language": - "null|Infinity|NaN|undefined", - "support.function": - "alert", - "constant.language.boolean": "true|false", - }, "identifier"); - var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; - - var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex - "u[0-9a-fA-F]{4}|" + // unicode - "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode - "[0-2][0-7]{0,2}|" + // oct - "3[0-7][0-7]?|" + // oct - "[4-7][0-7]?|" + //oct - ".)"; - - this.$rules = { - "no_regex" : [ - DocCommentHighlightRules.getStartRule("doc-start"), - comments("no_regex"), - { - token : "string", - regex : "'(?=.)", - next : "qstring", - }, { - token : "string", - regex : '"(?=.)', - next : "qqstring", - }, { - token : "constant.numeric", // hex - regex : /0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/, - }, { - token : "constant.numeric", // float - regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/, - }, { - token : [ - "storage.type", "punctuation.operator", "support.function", - "punctuation.operator", "entity.name.function", "text","keyword.operator", - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", - next: "function_arguments", - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", "storage.type", "text", "paren.lparen", - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments", - }, { - token : [ - "entity.name.function", "text", "keyword.operator", "text", "storage.type", - "text", "paren.lparen", - ], - regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments", - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen", - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", - next: "function_arguments", - }, { - token : [ - "storage.type", "text", "entity.name.function", "text", "paren.lparen", - ], - regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", - next: "function_arguments", - }, { - token : [ - "entity.name.function", "text", "punctuation.operator", - "text", "storage.type", "text", "paren.lparen", - ], - regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments", - }, { - token : [ - "text", "text", "storage.type", "text", "paren.lparen", - ], - regex : "(:)(\\s*)(function)(\\s*)(\\()", - next: "function_arguments", - }, { - token : "keyword", - regex : "(?:" + kwBeforeRe + ")\\b", - next : "start", - }, { - token : ["support.constant"], - regex : /that\b/, - }, { - token : ["storage.type", "punctuation.operator", "support.function.firebug"], - regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/, - }, { - token : keywordMapper, - regex : identifierRe, - }, { - token : "punctuation.operator", - regex : /[.](?![.])/, - next : "property", - }, { - token : "keyword.operator", - regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, - next : "start", - }, { - token : "punctuation.operator", - regex : /[?:,;.]/, - next : "start", - }, { - token : "paren.lparen", - regex : /[\[({]/, - next : "start", - }, { - token : "paren.rparen", - regex : /[\])}]/, - }, { - token: "comment", - regex: /^#!.*$/, - }, - ], - property: [{ - token : "text", - regex : "\\s+", - }, { - token : [ - "storage.type", "punctuation.operator", "entity.name.function", "text", - "keyword.operator", "text", - "storage.type", "text", "entity.name.function", "text", "paren.lparen", - ], - regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()", - next: "function_arguments", - }, { - token : "punctuation.operator", - regex : /[.](?![.])/, - }, { - token : "support.function", - regex : "/|" + functions + "|/", - }, { - token : "support.function", - regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/, - }, { - token : "support.function.dom", - regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/, - }, { - token : "support.constant", - regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/, - }, { - token : "identifier", - regex : identifierRe, - }, { - regex: "", - token: "empty", - next: "no_regex", - }, - ], - "start": [ - DocCommentHighlightRules.getStartRule("doc-start"), - comments("start"), - { - token: "string.regexp", - regex: "\\/", - next: "regex", - }, { - token : "text", - regex : "\\s+|^$", - next : "start", - }, { - token: "empty", - regex: "", - next: "no_regex", - }, - ], - "regex": [ - { - token: "regexp.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)", - }, { - token: "string.regexp", - regex: "/[sxngimy]*", - next: "no_regex", - }, { - token : "invalid", - regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/, - }, { - token : "constant.language.escape", - regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/, - }, { - token : "constant.language.delimiter", - regex: /\|/, - }, { - token: "constant.language.escape", - regex: /\[\^?/, - next: "regex_character_class", - }, { - token: "empty", - regex: "$", - next: "no_regex", - }, { - defaultToken: "string.regexp", - }, - ], - "regex_character_class": [ - { - token: "regexp.charclass.keyword.operator", - regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)", - }, { - token: "constant.language.escape", - regex: "]", - next: "regex", - }, { - token: "constant.language.escape", - regex: "-", - }, { - token: "empty", - regex: "$", - next: "no_regex", - }, { - defaultToken: "string.regexp.charachterclass", - }, - ], - "function_arguments": [ - { - token: "variable.parameter", - regex: identifierRe, - }, { - token: "punctuation.operator", - regex: "[, ]+", - }, { - token: "punctuation.operator", - regex: "$", - }, { - token: "empty", - regex: "", - next: "no_regex", - }, - ], - "qqstring" : [ - { - token : "constant.language.escape", - regex : escapedRe, - }, { - token : "string", - regex : "\\\\$", - next : "qqstring", - }, { - token : "string", - regex : '"|$', - next : "no_regex", - }, { - defaultToken: "string", - }, - ], - "qstring" : [ - { - token : "constant.language.escape", - regex : escapedRe, - }, { - token : "string", - regex : "\\\\$", - next : "qstring", - }, { - token : "string", - regex : "'|$", - next : "no_regex", - }, { - defaultToken: "string", - }, - ], - }; - - - if (!options || !options.noES6) { - this.$rules.no_regex.unshift({ - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = val == "{" ? this.nextState : ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - } - else if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1) - return "paren.quasi.end"; - } - return val == "{" ? "paren.lparen" : "paren.rparen"; - }, - nextState: "start", - }, { - token : "string.quasi.start", - regex : /`/, - push : [{ - token : "constant.language.escape", - regex : escapedRe, - }, { - token : "paren.quasi.start", - regex : /\${/, - push : "start", - }, { - token : "string.quasi.end", - regex : /`/, - next : "pop", - }, { - defaultToken: "string.quasi", - }], - }); - - if (!options || options.jsx != false) - JSX.call(this); - } - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("no_regex") ]); - - this.normalizeRules(); -}; - -oop.inherits(NetscriptHighlightRules, TextHighlightRules); - -function JSX() { - var tagRegex = identifierRe.replace("\\d", "\\d\\-"); - var jsxTag = { - onMatch : function(val, state, stack) { - var offset = val.charAt(1) == "/" ? 2 : 1; - if (offset == 1) { - if (state != this.nextState) - stack.unshift(this.next, this.nextState, 0); - else - stack.unshift(this.next); - stack[2]++; - } else if (offset == 2) { - if (state == this.nextState) { - stack[1]--; - if (!stack[1] || stack[1] < 0) { - stack.shift(); - stack.shift(); - } - } - } - return [{ - type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml", - value: val.slice(0, offset), - }, { - type: "meta.tag.tag-name.xml", - value: val.substr(offset), - }]; - }, - regex : "", - onMatch : function(value, currentState, stack) { - if (currentState == stack[0]) - stack.shift(); - if (value.length == 2) { - if (stack[0] == this.nextState) - stack[1]--; - if (!stack[1] || stack[1] < 0) { - stack.splice(0, 2); - } - } - this.next = stack[0] || "start"; - return [{type: this.token, value: value}]; - }, - nextState: "jsx", - }, - jsxJsRule, - comments("jsxAttributes"), - { - token : "entity.other.attribute-name.xml", - regex : tagRegex, - }, { - token : "keyword.operator.attribute-equals.xml", - regex : "=", - }, { - token : "text.tag-whitespace.xml", - regex : "\\s+", - }, { - token : "string.attribute-value.xml", - regex : "'", - stateName : "jsx_attr_q", - push : [ - {token : "string.attribute-value.xml", regex: "'", next: "pop"}, - {include : "reference"}, - {defaultToken : "string.attribute-value.xml"}, - ], - }, { - token : "string.attribute-value.xml", - regex : '"', - stateName : "jsx_attr_qq", - push : [ - {token : "string.attribute-value.xml", regex: '"', next: "pop"}, - {include : "reference"}, - {defaultToken : "string.attribute-value.xml"}, - ], - }, - jsxTag, - ]; - this.$rules.reference = [{ - token : "constant.language.escape.reference.xml", - regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)", - }]; -} - -function comments(next) { - return [ - { - token : "comment", // multi line comment - regex : /\/\*/, - next: [ - DocCommentHighlightRules.getTagRule(), - {token : "comment", regex : "\\*\\/", next : next || "pop"}, - {defaultToken : "comment", caseInsensitive: true}, - ], - }, { - token : "comment", - regex : "\\/\\/", - next: [ - DocCommentHighlightRules.getTagRule(), - {token : "comment", regex : "$|^", next : next || "pop"}, - {defaultToken : "comment", caseInsensitive: true}, - ], - }, - ]; -} -exports.NetscriptHighlightRules = NetscriptHighlightRules; -}); - -ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports) { -"use strict"; - -var Range = acequire("../range").Range; - -var MatchingBraceOutdent = function() { - // do nothing. -}; - -(function() { - - this.checkOutdent = function(line, input) { - if (! /^\s+$/.test(line)) - return false; - - return /^\s*\}/.test(input); - }; - - this.autoOutdent = function(doc, row) { - var line = doc.getLine(row); - var match = line.match(/^(\s*\})/); - - if (!match) return 0; - - var column = match[1].length; - var openBracePos = doc.findMatchingBracket({row: row, column: column}); - - if (!openBracePos || openBracePos.row == row) return 0; - - var indent = this.$getIndent(doc.getLine(openBracePos.row)); - doc.replace(new Range(row, 0, row, column-1), indent); - }; - - this.$getIndent = function(line) { - return line.match(/^\s*/)[0]; - }; - -}).call(MatchingBraceOutdent.prototype); - -exports.MatchingBraceOutdent = MatchingBraceOutdent; -}); - -ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports) { -"use strict"; - -var oop = acequire("../../lib/oop"); -var Range = acequire("../../range").Range; -var BaseFoldMode = acequire("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start), - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end), - ); - } -}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/; - this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/; - this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; - this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; - this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; - this._getFoldWidgetBase = this.getFoldWidget; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - - if (this.singleLineBlockCommentRe.test(line)) { - if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) - return ""; - } - - var fw = this._getFoldWidgetBase(session, foldStyle, row); - - if (!fw && this.startRegionRe.test(line)) - return "start"; // lineCommentRegionStart - - return fw; - }; - - this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { - var line = session.getLine(row); - - if (this.startRegionRe.test(line)) - return this.getCommentRegionBlock(session, line, row); - - var match = line.match(this.foldingStartMarker); - if (match) { - var i = match.index; - - if (match[1]) - return this.openingBracketBlock(session, match[1], row, i); - - var range = session.getCommentFoldRange(row, i + match[0].length, 1); - - if (range && !range.isMultiLine()) { - if (forceMultiline) { - range = this.getSectionRange(session, row); - } else if (foldStyle != "all") - range = null; - } - - return range; - } - - if (foldStyle === "markbegin") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - - this.getSectionRange = function(session, row) { - var line = session.getLine(row); - var startIndent = line.search(/\S/); - var startRow = row; - var startColumn = line.length; - row = row + 1; - var endRow = row; - var maxRow = session.getLength(); - while (++row < maxRow) { - line = session.getLine(row); - var indent = line.search(/\S/); - if (indent === -1) - continue; - if (startIndent > indent) - break; - var subRange = this.getFoldWidgetRange(session, "all", row); - - if (subRange) { - if (subRange.start.row <= startRow) { - break; - } else if (subRange.isMultiLine()) { - row = subRange.end.row; - } else if (startIndent == indent) { - break; - } - } - endRow = row; - } - - return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); - }; - this.getCommentRegionBlock = function(session, line, row) { - var startColumn = line.search(/\s*$/); - var maxRow = session.getLength(); - var startRow = row; - - var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; - var depth = 1; - while (++row < maxRow) { - line = session.getLine(row); - var m = re.exec(line); - if (!m) continue; - if (m[1]) depth--; - else depth++; - - if (!depth) break; - } - - var endRow = row; - if (endRow > startRow) { - return new Range(startRow, startColumn, endRow, line.length); - } - }; - -}).call(FoldMode.prototype); - -}); - -ace.define("ace/mode/netscript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/netscript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(acequire, exports) { -"use strict"; - -var oop = acequire("../lib/oop"); -var TextMode = acequire("./text").Mode; -var NetscriptHighlightRules = acequire("./netscript_highlight_rules").NetscriptHighlightRules; -var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent; -var WorkerClient = acequire("../worker/worker_client").WorkerClient; -var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour; -var CStyleFoldMode = acequire("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = NetscriptHighlightRules; - - this.$outdent = new MatchingBraceOutdent(); - this.$behaviour = new CstyleBehaviour(); - this.foldingRules = new CStyleFoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - - this.lineCommentStart = "//"; - this.blockComment = {start: "/*", end: "*/"}; - - this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - - var tokenizedLine = this.getTokenizer().getLineTokens(line, state); - var tokens = tokenizedLine.tokens; - var endState = tokenizedLine.state; - - if (tokens.length && tokens[tokens.length-1].type == "comment") { - return indent; - } - - if (state == "start" || state == "no_regex") { - var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); - if (match) { - indent += tab; - } - } else if (state == "doc-start") { - if (endState == "start" || endState == "no_regex") { - return ""; - } - var match = line.match(/^\s*(\/?)\*/); - if (match) { - if (match[1]) { - indent += " "; - } - indent += "* "; - } - } - - return indent; - }; - - this.checkOutdent = function(state, line, input) { - return this.$outdent.checkOutdent(line, input); - }; - - this.autoOutdent = function(state, doc, row) { - this.$outdent.autoOutdent(doc, row); - }; - - this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], require("brace/worker/javascript"), "JavaScriptWorker"); - worker.attachToDocument(session.getDocument()); - - worker.on("annotate", function(results) { - session.setAnnotations(results.data); - }); - - worker.on("terminate", function() { - session.clearAnnotations(); - }); - - return worker; - }; - - this.$id = "ace/mode/netscript"; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); diff --git a/src/ScriptEditor/CodeMirror.js b/src/ScriptEditor/CodeMirror.js deleted file mode 100644 index 4093fdf69..000000000 --- a/src/ScriptEditor/CodeMirror.js +++ /dev/null @@ -1,596 +0,0 @@ -// Wrapper for CodeMirror editor -// https://github.com/codemirror/codemirror -import { ScriptEditor } from "./ScriptEditor"; - -import 'codemirror/lib/codemirror.css'; - -import 'codemirror/theme/monokai.css'; -import 'codemirror/theme/3024-day.css'; -import 'codemirror/theme/3024-night.css'; -import 'codemirror/theme/abcdef.css'; -import 'codemirror/theme/ambiance-mobile.css'; -import 'codemirror/theme/ambiance.css'; -import 'codemirror/theme/base16-dark.css'; -import 'codemirror/theme/base16-light.css'; -import 'codemirror/theme/bespin.css'; -import 'codemirror/theme/blackboard.css'; -import 'codemirror/theme/cobalt.css'; -import 'codemirror/theme/colorforth.css'; -import 'codemirror/theme/darcula.css'; -import 'codemirror/theme/dracula.css'; -import 'codemirror/theme/duotone-dark.css'; -import 'codemirror/theme/duotone-light.css'; -import 'codemirror/theme/eclipse.css'; -import 'codemirror/theme/elegant.css'; -import 'codemirror/theme/erlang-dark.css'; -import 'codemirror/theme/gruvbox-dark.css'; -import 'codemirror/theme/hopscotch.css'; -import 'codemirror/theme/icecoder.css'; -import 'codemirror/theme/idea.css'; -import 'codemirror/theme/isotope.css'; -import 'codemirror/theme/lesser-dark.css'; -import 'codemirror/theme/liquibyte.css'; -import 'codemirror/theme/lucario.css'; -import 'codemirror/theme/material.css'; -import 'codemirror/theme/mbo.css'; -import 'codemirror/theme/mdn-like.css'; -import 'codemirror/theme/midnight.css'; -import 'codemirror/theme/neat.css'; -import 'codemirror/theme/neo.css'; -import 'codemirror/theme/night.css'; -import 'codemirror/theme/oceanic-next.css'; -import 'codemirror/theme/panda-syntax.css'; -import 'codemirror/theme/paraiso-dark.css'; -import 'codemirror/theme/paraiso-light.css'; -import 'codemirror/theme/pastel-on-dark.css'; -import 'codemirror/theme/railscasts.css'; -import 'codemirror/theme/rubyblue.css'; -import 'codemirror/theme/seti.css'; -import 'codemirror/theme/shadowfox.css'; -import 'codemirror/theme/solarized.css'; -import 'codemirror/theme/ssms.css'; -import 'codemirror/theme/the-matrix.css'; -import 'codemirror/theme/tomorrow-night-bright.css'; -import 'codemirror/theme/tomorrow-night-eighties.css'; -import 'codemirror/theme/ttcn.css'; -import 'codemirror/theme/twilight.css'; -import 'codemirror/theme/vibrant-ink.css'; -import 'codemirror/theme/xq-dark.css'; -import 'codemirror/theme/xq-light.css'; -import 'codemirror/theme/yeti.css'; -import 'codemirror/theme/zenburn.css'; - -import CodeMirror from "codemirror/lib/codemirror.js"; -import "codemirror/mode/javascript/javascript.js"; -import "./CodeMirrorNetscriptMode"; - -import 'codemirror/keymap/sublime.js'; -import 'codemirror/keymap/vim.js'; -import 'codemirror/keymap/emacs.js'; - -import 'codemirror/addon/comment/continuecomment.js'; -import 'codemirror/addon/dialog/dialog.css'; -import 'codemirror/addon/dialog/dialog.js'; -import 'codemirror/addon/edit/closebrackets.js'; -import 'codemirror/addon/edit/matchbrackets.js'; -import 'codemirror/addon/fold/foldcode.js'; -import 'codemirror/addon/fold/foldgutter.js'; -import 'codemirror/addon/fold/foldgutter.css'; -import 'codemirror/addon/fold/brace-fold.js'; -import 'codemirror/addon/fold/indent-fold.js'; -import 'codemirror/addon/fold/comment-fold.js'; -import 'codemirror/addon/hint/javascript-hint.js'; -import 'codemirror/addon/hint/show-hint.js'; -import 'codemirror/addon/hint/show-hint.css'; -import 'codemirror/addon/lint/lint.js'; -import 'codemirror/addon/lint/lint.css'; -import 'codemirror/addon/search/match-highlighter.js'; -import 'codemirror/addon/selection/active-line.js'; - -import { JSHINT } from 'jshint'; -import './CodeMirrorNetscriptLint.js'; - -import { NetscriptFunctions } from "../NetscriptFunctions"; -import { CodeMirrorKeybindingSetting, - CodeMirrorThemeSetting } from "../Settings/SettingEnums"; -import { Settings } from "../Settings/Settings"; - -import { clearEventListeners } from "../../utils/uiHelpers/clearEventListeners"; -import { createElement } from "../../utils/uiHelpers/createElement"; -import { createOptionElement } from "../../utils/uiHelpers/createOptionElement"; -import { removeChildrenFromElement } from "../../utils/uiHelpers/removeChildrenFromElement"; - -(function() { - window.JSHINT = JSHINT; -})(); - -// Max number of invisibles to be shown in a group if the "Show Invisibles" option -// is marked -const MaxInvisibles = 20; - -function validateInitializationParamters(params) { - if (params.saveAndCloseFn == null) { return false; } // Save & close button function - if (params.quitFn == null) { return false; } // Quitting editor, aka Engine.loadTerminalContent - - return true; -} - -class CodeMirrorEditorWrapper extends ScriptEditor { - constructor() { - super(); - this.vimCommandDisplay = null; - this.vimCommandDisplayWrapper = null; - this.tabsStyleElement = null; - } - - init(params) { - if (this.editor != null) { - console.error(`CodeMirrorEditor.init() called when it's already initialized`); - return false; - } - - // Validate/Sanitize input - if (!validateInitializationParamters(params)) { - console.error(`'params' argument passed into CodeMirrorEditor.init() does not have proper properties`); - return false; - } - - // Store the filename input - this.filenameInput = document.getElementById("script-editor-filename"); - if (this.filenameInput == null) { - console.error(`Could not get Script Editor filename element (id=script-editor-filename)`); - return false; - } - - // Add styling for the "Show Invisibles" option for spaces - const classBase = '.CodeMirror .cm-whitespace-'; - const spaceChar = '·'; - const style = document.createElement('style'); - - style.setAttribute('data-name', 'js-show-invisibles'); - - let rules = ''; - let spaceChars = ''; - - for (let i = 1; i <= MaxInvisibles; ++i) { - spaceChars += spaceChar; - - const rule = classBase + i + '::before { content: "' + spaceChars + '";}\n'; - rules += rule; - } - - style.textContent = rules; - document.head.appendChild(style); - - // Add an element for the "Show Invisible" option for tabs - this.tabsStyleElement = document.createElement('style'); - document.head.appendChild(this.tabsStyleElement); - - // Store a reference to the VIM command display - this.vimCommandDisplay = document.getElementById("codemirror-vim-command-display"); - this.vimCommandDisplayWrapper = document.getElementById("codemirror-vim-command-display-wrapper"); - - // Define a "Save" command for CodeMirror so shortcuts like Ctrl + s - // will save in-game - CodeMirror.commands.save = function() { params.saveAndCloseFn(); } - - // Add Netscript Functions to the autocompleter - const netscriptFns = []; - var fnsObj = NetscriptFunctions(null); - for (let name in fnsObj) { - if (fnsObj.hasOwnProperty(name)) { - netscriptFns.push(name); - - //Get functions from namespaces - const namespaces = ["bladeburner", "hacknet", "codingcontract", "gang", "sleeve", "heart", "formulas"]; - if (namespaces.includes(name)) { - let namespace = fnsObj[name]; - if (typeof namespace !== "object") {continue;} - let namespaceFns = Object.keys(namespace); - for (let i = 0; i < namespaceFns.length; ++i) { - netscriptFns.push(namespaceFns[i]); - } - } - } - } - - CodeMirror.hint.netscript = function(editor) { - const origList = CodeMirror.hint.javascript(editor) || {from: editor.getCursor(), to: editor.getCursor(), list: []}; - origList.list.push(...netscriptFns); - let list = origList.list || []; - let cursor = editor.getCursor(); - let currentLine = editor.getLine(cursor.line); - let start = cursor.ch; - let end = start; - while (end < currentLine.length && /[\w$]+/.test(currentLine.charAt(end))) ++end; - while (start && /[\w$]+/.test(currentLine.charAt(start - 1))) --start; - let curWord = start != end && currentLine.slice(start, end); - let regex = new RegExp('^' + curWord, 'i'); - let result = { - list: (!curWord ? list : list.filter(function (item) { - return item.match(regex); - })).sort(), - from: CodeMirror.Pos(cursor.line, start), - to: CodeMirror.Pos(cursor.line, end), - }; - - return result; - }; - - // Configure VIM keybindings - var VimApi = CodeMirror.Vim; - VimApi.defineEx('write', 'w', function() { - params.saveAndCloseFn(); - }); - VimApi.defineEx('quit', 'q', function() { - params.quitFn(); - }); - VimApi.defineEx('xwritequit', 'x', function() { - params.saveAndCloseFn(); - }); - VimApi.defineEx('wqwritequit', 'wq', function() { - params.saveAndCloseFn(); - }); - } - - initialized() { - return (this.filenameInput != null); - } - - create() { - function safeGetElementById(id, whatFor="") { - const elem = document.getElementById(id); - if (elem == null) { - throw new Error(`Could not find ${whatFor} DOM element(id=${id})`); - } - - return elem; - } - - function safeClearEventListeners(id, whatFor="") { - const elem = clearEventListeners(id); - if (elem == null) { - throw new Error(`Could not find ${whatFor} DOM element(id=${id})`); - } - - return elem; - } - - try { - if (!this.initialized()) { - console.warn(`CodeMirrorEditor.create() called when editor was not initialized`); - return; - } - - // Get and sanitize the keybinding (keymap) setting - if (!(Object.values(CodeMirrorKeybindingSetting).includes(Settings.EditorKeybinding))) { - Settings.EditorKeybinding = CodeMirrorKeybindingSetting.Default; - } - - // Initialize CodeMirror Editor - const textAreaElement = safeGetElementById("codemirror-editor", "CodeMirror Textarea"); - const formElement = safeGetElementById("codemirror-form-wrapper", "CodeMirror Form Wrapper"); - formElement.style.display = "block"; - - this.editor = CodeMirror.fromTextArea(textAreaElement, { - autofocus: true, - extraKeys: { "Ctrl-Space": "autocomplete" }, - foldGutter: true, - gutters: ["CodeMirror-lint-markers", "CodeMirror-linenumbers", "CodeMirror-foldgutter"], - highlightSelectionMatches: true, - hintOptions: { hint: CodeMirror.hint.netscript }, - indentUnit: 4, - keyMap: "default", - lineNumbers: true, - matchBrackets: true, - maxInvisibles: 32, - mode: "netscript", - theme: Settings.EditorTheme, - }); - - // Setup Theme Option - const themeDropdown = safeClearEventListeners("script-editor-option-theme", "Theme Selector"); - removeChildrenFromElement(themeDropdown); - const themeOptions = Object.keys(CodeMirrorThemeSetting); - for (let i = 0; i < themeOptions.length; ++i) { - const themeKey = themeOptions[i]; - const themeValue = CodeMirrorThemeSetting[themeKey]; - themeDropdown.add(createOptionElement(themeKey, themeValue)); - } - if (Settings.EditorTheme) { - var initialIndex = 0; - for (var i = 0; i < themeDropdown.options.length; ++i) { - if (themeDropdown.options[i].value === Settings.EditorTheme) { - initialIndex = i; - break; - } - } - themeDropdown.selectedIndex = initialIndex; - } else { - themeDropdown.selectedIndex = 0; - } - - themeDropdown.onchange = () => { - const val = themeDropdown.value; - Settings.EditorTheme = val; - this.editor.setOption("theme", val); - }; - themeDropdown.onchange(); - - // Setup Keymap Option - const keybindingDropdown = safeClearEventListeners("script-editor-option-keybinding", "Keymap Selector"); - if (keybindingDropdown == null) { - console.error(`Could not find Script Editor's keybinding selector element (id="script-editor-option-keybinding")`); - return false; - } - removeChildrenFromElement(keybindingDropdown); - keybindingDropdown.add(createOptionElement("Default", CodeMirrorKeybindingSetting.Default)); - keybindingDropdown.add(createOptionElement("Sublime", CodeMirrorKeybindingSetting.Sublime)); - keybindingDropdown.add(createOptionElement("Vim", CodeMirrorKeybindingSetting.Vim)); - keybindingDropdown.add(createOptionElement("Emacs", CodeMirrorKeybindingSetting.Emacs)); - if (Settings.EditorKeybinding) { - var initialIndex = 0; - for (var i = 0; i < keybindingDropdown.options.length; ++i) { - if (keybindingDropdown.options[i].value === Settings.EditorKeybinding) { - initialIndex = i; - break; - } - } - keybindingDropdown.selectedIndex = initialIndex; - } else { - keybindingDropdown.selectedIndex = 0; - } - keybindingDropdown.onchange = () => { - // Set Vim command display to be invisible initially - this.vimCommandDisplayWrapper.style.display = "none"; - - const val = keybindingDropdown.value; - Settings.EditorKeybinding = val; - this.editor.removeKeyMap(CodeMirror.keyMap.default); - this.editor.removeKeyMap(CodeMirror.keyMap.sublime); - this.editor.removeKeyMap(CodeMirror.keyMap.emacs); - this.editor.removeKeyMap(CodeMirror.keyMap.vim); - - // Setup the VIM command display - let keys = ''; - const handleVimKeyPress = (key) => { - keys = keys + key; - this.vimCommandDisplay.innerHTML = keys; - } - const handleVimCommandDone = () => { - keys = ''; - this.vimCommandDisplay.innerHTML = keys; - } - if (val === CodeMirrorKeybindingSetting.Vim) { - this.vimCommandDisplayWrapper.style.display = "block"; - this.editor.on('vim-keypress', handleVimKeyPress); - this.editor.on('vim-command-done', handleVimCommandDone); - - } else { - this.vimCommandDisplayWrapper.style.display = "none"; - this.editor.off('vim-keypress', handleVimKeyPress); - this.editor.off('vim-command-done', handleVimCommandDone); - } - - this.editor.addKeyMap(val); - this.editor.setOption("keyMap", val); - }; - keybindingDropdown.onchange(); - - // Highlight Active line - const highlightActiveChkBox = safeClearEventListeners("script-editor-option-highlightactiveline", "Active Line Checkbox"); - highlightActiveChkBox.checked = Settings.EditorHighlightActiveLine; - highlightActiveChkBox.onchange = () => { - Settings.EditorHighlightActiveLine = highlightActiveChkBox.checked; - this.editor.setOption("styleActiveLine", highlightActiveChkBox.checked); - }; - highlightActiveChkBox.onchange(); - - // Show Invisibles - const showInvisiblesChkBox = safeClearEventListeners("script-editor-option-showinvisibles", "Show Invisible Checkbox"); - showInvisiblesChkBox.checked = Settings.EditorShowInvisibles; - showInvisiblesChkBox.onchange = () => { - Settings.EditorShowInvisibles = showInvisiblesChkBox.checked; - const overlayMode = { - name: 'invisibles', - token: function(stream) { - var ret, - spaces = 0, - space = stream.peek() === ' '; - - if (space) { - while (space && spaces < MaxInvisibles) { - ++spaces; - - stream.next(); - space = stream.peek() === ' '; - } - - ret = 'whitespace whitespace-' + spaces; - } else { - while (!stream.eol() && !space) { - stream.next(); - - space = stream.peek() === ' '; - } - - ret = 'cm-eol'; - } - - return ret; - }, - }; - - if (showInvisiblesChkBox.checked) { - // Spaces - this.editor.addOverlay(overlayMode); - - // Tabs - this.tabsStyleElement.innerHTML = ".cm-tab {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABDSURBVEhLYxgFo2BkAGYH/9r/QFoAxIGyhx6AORzZA4xD1TcHNjYzQplDB2CLgaECYHkADIZqqgGBoZdsRsHgBgwMAB8iFHF42AERAAAAAElFTkSuQmCC);background-position: right;background-repeat: no-repeat;}"; - } else { - this.editor.removeOverlay("invisibles"); - this.tabsStyleElement.innerHTML = ""; - } - }; - showInvisiblesChkBox.onchange(); - - //Use Soft Tab - const softTabChkBox = safeClearEventListeners("script-editor-option-usesofttab", "Soft Tab Checkbox"); - softTabChkBox.checked = Settings.EditorUseSoftTab; - softTabChkBox.onchange = () => { - Settings.EditorUseSoftTab = softTabChkBox.checked; - this.editor.setOption("indentWithTabs", !softTabChkBox.checked); - if (softTabChkBox.checked) { - this.editor.addKeyMap({ - name: "soft-tabs-keymap", - "Tab": function (cm) { - if (cm.somethingSelected()) { - var sel = cm.getSelection("\n"); - // Indent only if there are multiple lines selected, or if the selection spans a full line - if (sel.length > 0 && (sel.indexOf("\n") > -1 || sel.length === cm.getLine(cm.getCursor().line).length)) { - cm.indentSelection("add"); - return; - } - } - - if (cm.options.indentWithTabs) - cm.execCommand("insertTab"); - else - cm.execCommand("insertSoftTab"); - }, - "Shift-Tab": function (cm) { - cm.indentSelection("subtract"); - }, - }); - } else { - this.editor.removeKeyMap("soft-tabs-keymap"); - } - }; - softTabChkBox.onchange(); - - // Some helper functions for dealing with flexible options - function resetFlexibleOption(id) { - const fieldset = safeGetElementById(id); - removeChildrenFromElement(fieldset); - fieldset.style.display = "block"; - return fieldset; - } - - function removeFlexibleOption(id) { - // This doesn't really remove it, just sets it to invisible - const fieldset = resetFlexibleOption(id); - fieldset.style.display = "none"; - return fieldset; - } - - // Flex 1: Automatically Close Brackets and Quotes - const flex1Fieldset = resetFlexibleOption("script-editor-option-flex1-fieldset"); - const flex1Id = "script-editor-option-flex1"; - flex1Fieldset.appendChild(createElement("label", { - for: flex1Id, - innerText: "Auto-Close Brackets/Quotes", - })); - - const flex1Checkbox = createElement("input", { - checked: Settings.EditorAutoCloseBrackets, - id: flex1Id, - name: flex1Id, - type: "checkbox", - }); - flex1Fieldset.appendChild(flex1Checkbox); - flex1Checkbox.onchange = () => { - Settings.EditorAutoCloseBrackets = flex1Checkbox.checked; - this.editor.setOption("autoCloseBrackets", flex1Checkbox.checked); - }; - flex1Checkbox.onchange(); - - // Flex 2: Disable/Enable Linting - const flex2Fieldset = resetFlexibleOption("script-editor-option-flex2-fieldset"); - const flex2Id = "script-editor-option-flex2"; - flex2Fieldset.appendChild(createElement("label", { - for: flex2Id, - innerText: "Enable Linting", - })); - - const flex2Checkbox = createElement("input", { - checked: Settings.EditorEnableLinting, - id: flex2Id, - name: flex2Id, - type: "checkbox", - }); - flex2Fieldset.appendChild(flex2Checkbox); - flex2Checkbox.onchange = () => { - if (flex2Checkbox.checked) { - Settings.EditorEnableLinting = true; - this.editor.setOption("lint", CodeMirror.lint.netscript); - } else { - Settings.EditorEnableLinting = false; - this.editor.setOption("lint", false); - } - } - flex2Checkbox.onchange(); - - // Flex 3: Continue Comments - const flex3Fieldset = resetFlexibleOption("script-editor-option-flex3-fieldset"); - const flex3Id = "script-editor-option-flex3"; - flex3Fieldset.appendChild(createElement("label", { - for: flex3Id, - innerText: "Continue Comments", - })); - - const flex3Checkbox = createElement("input", { - checked: Settings.EditorContinueComments, - id: flex3Id, - name: flex3Id, - type: "checkbox", - }); - flex3Fieldset.appendChild(flex3Checkbox); - flex3Checkbox.onchange = () => { - Settings.EditorContinueComments = flex3Checkbox.checked; - this.editor.setOption("continueComments", flex3Checkbox.checked); - } - flex3Checkbox.onchange(); - - removeFlexibleOption("script-editor-option-flex4-fieldset"); - - this.editor.refresh(); - } catch(e) { - console.error(`Exception caught: ${e}. ${e.stack}`); - return false; - } - } - - isFocused() { - if (this.editor == null) { return false; } - return this.editor.hasFocus(); - } - - // Sets the editor to be invisible - setInvisible() { - if (!this.initialized()) { - console.warn(`CodeMirrorEditor.setInvisible() called when editor was not initialized`); - return; - } - - if (this.editor != null) { - this.editor.toTextArea(); - this.editor = null; - } - - const elem = document.getElementById("codemirror-form-wrapper"); - if (elem instanceof HTMLElement) { - elem.style.display = "none"; - } - } - - getCursor() { - const c = this.editor.getCursor(); //I need to get the cursor position - return {row: c.line, column: c.ch}; - } - - setCursor(pos) { - this.editor.setCursor({line: pos.row, ch: pos.column}); - } -} - -export const CodeMirrorEditor = new CodeMirrorEditorWrapper(); diff --git a/src/ScriptEditor/CodeMirrorNetscriptLint.js b/src/ScriptEditor/CodeMirrorNetscriptLint.js deleted file mode 100644 index c0a2a776f..000000000 --- a/src/ScriptEditor/CodeMirrorNetscriptLint.js +++ /dev/null @@ -1,83 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("codemirror/lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["codemirror/lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - // declare global: JSHINT - - function validator(text, options) { - if (!window.JSHINT) { - if (window.console) { - window.console.error("Error: window.JSHINT not defined, CodeMirror JavaScript linting cannot run."); - } - return []; - } - - // To ignore the 'async/await' errors, we'll manually edit the code ('text') - // that gets processed by JSHINT to include the ignore directory - const splitText = text.split("\n"); - const ignoreDirective = " // jshint ignore:line"; - for (let i = 0; i < splitText.length; ++i) { - if (splitText[i].match(/.*async function.+{/g)) { - splitText[i] += ignoreDirective; - } else if (splitText[i].match(/.*await.+;/g)) { - splitText[i] += ignoreDirective; - } - } - const sanitizedText = splitText.join("\n"); - - // Configure JSHINT options - if (!options.indent) // JSHint error.character actually is a column index, this fixes underlining on lines using tabs for indentation - options.indent = 1; // JSHint default value is 4 - - options.esversion = 9; - - JSHINT(sanitizedText, options, options.globals); - var errors = JSHINT.data().errors, result = []; - if (errors) parseErrors(errors, result); - return result; - } - - CodeMirror.registerHelper("lint", "netscript", validator); - - function parseErrors(errors, output) { - for ( var i = 0; i < errors.length; i++) { - var error = errors[i]; - if (error) { - if (error.line == 0) { continue; } - if (error.line < 0) { - if (window.console) { - window.console.warn("Cannot display JSHint error (invalid line " + error.line + ")", error); - } - continue; - } - - var start = error.character - 1, end = start + 1; - if (error.evidence) { - var index = error.evidence.substring(start).search(/.\b/); - if (index > -1) { - end += index; - } - } - - // Convert to format expected by validation service - var hint = { - message: error.reason, - severity: error.code ? (error.code.startsWith('W') ? "warning" : "error") : "error", - from: CodeMirror.Pos(error.line - 1, start), - to: CodeMirror.Pos(error.line - 1, end), - }; - - output.push(hint); - } - } - } -}); diff --git a/src/ScriptEditor/CodeMirrorNetscriptMode.js b/src/ScriptEditor/CodeMirrorNetscriptMode.js deleted file mode 100644 index 7ffb2b14c..000000000 --- a/src/ScriptEditor/CodeMirrorNetscriptMode.js +++ /dev/null @@ -1,939 +0,0 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE -import CodeMirror from "codemirror/lib/codemirror.js"; -import { NetscriptFunctions } from "../NetscriptFunctions"; - -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("codemirror/lib/codemirror.js")); - else if (typeof define == "function" && define.amd) // AMD - define(["codemirror/lib/codemirror.js"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("netscript", function(config, parserConfig) { - var indentUnit = config.indentUnit; - var statementIndent = parserConfig.statementIndent; - var jsonldMode = parserConfig.jsonld; - var jsonMode = parserConfig.json || jsonldMode; - var isTS = parserConfig.typescript; - var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/; - - // Tokenizer - - var keywords = (function(){ - function kw(type) {return {type: type, style: "keyword"};} - var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"), D = kw("keyword d"); - var operator = kw("operator"), atom = {type: "atom", style: "atom"}; - - const ret = { - "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, - "return": D, "break": D, "continue": D, "new": kw("new"), "delete": C, "void": C, "throw": C, - "debugger": kw("debugger"), "var": kw("var"), "const": kw("var"), "let": kw("var"), - "function": kw("function"), "catch": kw("catch"), - "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"), - "in": operator, "typeof": operator, "instanceof": operator, - "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom, - "this": kw("this"), "class": kw("class"), "super": kw("atom"), - "yield": C, "export": kw("export"), "import": kw("import"), "extends": C, - "await": C, - - // Netscript Basic Functions - "hack": atom, - }; - - function push(obj) { - for(const key of Object.keys(obj)) { - if(typeof obj[key] === 'function') ret[key] = atom; - if(typeof obj[key] === 'object') push(obj[key]); - } - } - push(NetscriptFunctions(null)); - return ret; - }()); - - var isOperatorChar = /[+\-*&%=<>!?|~^@]/; - var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/; - - function readRegexp(stream) { - var escaped = false, next, inSet = false; - while ((next = stream.next()) != null) { - if (!escaped) { - if (next == "/" && !inSet) return; - if (next == "[") inSet = true; - else if (inSet && next == "]") inSet = false; - } - escaped = !escaped && next == "\\"; - } - } - - // Used as scratch variables to communicate multiple values without - // consing up tons of objects. - var type, content; - function ret(tp, style, cont) { - type = tp; content = cont; - return style; - } - function tokenBase(stream, state) { - var ch = stream.next(); - if (ch == '"' || ch == "'") { - state.tokenize = tokenString(ch); - return state.tokenize(stream, state); - } else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) { - return ret("number", "number"); - } else if (ch == "." && stream.match("..")) { - return ret("spread", "meta"); - } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) { - return ret(ch); - } else if (ch == "=" && stream.eat(">")) { - return ret("=>", "operator"); - } else if (ch == "0" && stream.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i)) { - return ret("number", "number"); - } else if (/\d/.test(ch)) { - stream.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/); - return ret("number", "number"); - } else if (ch == "/") { - if (stream.eat("*")) { - state.tokenize = tokenComment; - return tokenComment(stream, state); - } else if (stream.eat("/")) { - stream.skipToEnd(); - return ret("comment", "comment"); - } else if (expressionAllowed(stream, state, 1)) { - readRegexp(stream); - stream.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/); - return ret("regexp", "string-2"); - } else { - stream.eat("="); - return ret("operator", "operator", stream.current()); - } - } else if (ch == "`") { - state.tokenize = tokenQuasi; - return tokenQuasi(stream, state); - } else if (ch == "#") { - stream.skipToEnd(); - return ret("error", "error"); - } else if (isOperatorChar.test(ch)) { - if (ch != ">" || !state.lexical || state.lexical.type != ">") { - if (stream.eat("=")) { - if (ch == "!" || ch == "=") stream.eat("=") - } else if (/[<>*+\-]/.test(ch)) { - stream.eat(ch) - if (ch == ">") stream.eat(ch) - } - } - return ret("operator", "operator", stream.current()); - } else if (wordRE.test(ch)) { - stream.eatWhile(wordRE); - var word = stream.current() - if (state.lastType != ".") { - if (keywords.propertyIsEnumerable(word)) { - var kw = keywords[word] - return ret(kw.type, kw.style, word) - } - if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false)) - return ret("async", "keyword", word) - } - return ret("variable", "variable", word) - } - } - - function tokenString(quote) { - return function(stream, state) { - var escaped = false, next; - if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){ - state.tokenize = tokenBase; - return ret("jsonld-keyword", "meta"); - } - while ((next = stream.next()) != null) { - if (next == quote && !escaped) break; - escaped = !escaped && next == "\\"; - } - if (!escaped) state.tokenize = tokenBase; - return ret("string", "string"); - }; - } - - function tokenComment(stream, state) { - var maybeEnd = false, ch; - while (ch = stream.next()) { - if (ch == "/" && maybeEnd) { - state.tokenize = tokenBase; - break; - } - maybeEnd = (ch == "*"); - } - return ret("comment", "comment"); - } - - function tokenQuasi(stream, state) { - var escaped = false, next; - while ((next = stream.next()) != null) { - if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) { - state.tokenize = tokenBase; - break; - } - escaped = !escaped && next == "\\"; - } - return ret("quasi", "string-2", stream.current()); - } - - var brackets = "([{}])"; - // This is a crude lookahead trick to try and notice that we're - // parsing the argument patterns for a fat-arrow function before we - // actually hit the arrow token. It only works if the arrow is on - // the same line as the arguments and there's no strange noise - // (comments) in between. Fallback is to only notice when we hit the - // arrow, and not declare the arguments as locals for the arrow - // body. - function findFatArrow(stream, state) { - if (state.fatArrowAt) state.fatArrowAt = null; - var arrow = stream.string.indexOf("=>", stream.start); - if (arrow < 0) return; - - if (isTS) { // Try to skip TypeScript return type declarations after the arguments - var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow)) - if (m) arrow = m.index - } - - var depth = 0, sawSomething = false; - for (var pos = arrow - 1; pos >= 0; --pos) { - var ch = stream.string.charAt(pos); - var bracket = brackets.indexOf(ch); - if (bracket >= 0 && bracket < 3) { - if (!depth) { ++pos; break; } - if (--depth == 0) { if (ch == "(") sawSomething = true; break; } - } else if (bracket >= 3 && bracket < 6) { - ++depth; - } else if (wordRE.test(ch)) { - sawSomething = true; - } else if (/["'\/]/.test(ch)) { - return; - } else if (sawSomething && !depth) { - ++pos; - break; - } - } - if (sawSomething && !depth) state.fatArrowAt = pos; - } - - // Parser - - var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true}; - - function JSLexical(indented, column, type, align, prev, info) { - this.indented = indented; - this.column = column; - this.type = type; - this.prev = prev; - this.info = info; - if (align != null) this.align = align; - } - - function inScope(state, varname) { - for (var v = state.localVars; v; v = v.next) - if (v.name == varname) return true; - for (var cx = state.context; cx; cx = cx.prev) { - for (var v = cx.vars; v; v = v.next) - if (v.name == varname) return true; - } - } - - function parseJS(state, style, type, content, stream) { - var cc = state.cc; - // Communicate our context to the combinators. - // (Less wasteful than consing up a hundred closures on every call.) - cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style; - - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = true; - - while(true) { - var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement; - if (combinator(type, content)) { - while(cc.length && cc[cc.length - 1].lex) - cc.pop()(); - if (cx.marked) return cx.marked; - if (type == "variable" && inScope(state, content)) return "variable-2"; - return style; - } - } - } - - // Combinator utils - - var cx = {state: null, column: null, marked: null, cc: null}; - function pass() { - for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); - } - function cont() { - pass.apply(null, arguments); - return true; - } - function inList(name, list) { - for (var v = list; v; v = v.next) if (v.name == name) return true - return false; - } - function register(varname) { - var state = cx.state; - cx.marked = "def"; - if (state.context) { - if (state.lexical.info == "var" && state.context && state.context.block) { - // FIXME function decls are also not block scoped - var newContext = registerVarScoped(varname, state.context) - if (newContext != null) { - state.context = newContext - return - } - } else if (!inList(varname, state.localVars)) { - state.localVars = new Var(varname, state.localVars) - return - } - } - // Fall through means this is global - if (parserConfig.globalVars && !inList(varname, state.globalVars)) - state.globalVars = new Var(varname, state.globalVars) - } - function registerVarScoped(varname, context) { - if (!context) { - return null - } else if (context.block) { - var inner = registerVarScoped(varname, context.prev) - if (!inner) return null - if (inner == context.prev) return context - return new Context(inner, context.vars, true) - } else if (inList(varname, context.vars)) { - return context - } else { - return new Context(context.prev, new Var(varname, context.vars), false) - } - } - - function isModifier(name) { - return name == "public" || name == "private" || name == "protected" || name == "abstract" || name == "readonly" - } - - // Combinators - - function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block } - function Var(name, next) { this.name = name; this.next = next } - - var defaultVars = new Var("this", new Var("arguments", null)) - function pushcontext() { - cx.state.context = new Context(cx.state.context, cx.state.localVars, false) - cx.state.localVars = defaultVars - } - function pushblockcontext() { - cx.state.context = new Context(cx.state.context, cx.state.localVars, true) - cx.state.localVars = null - } - function popcontext() { - cx.state.localVars = cx.state.context.vars - cx.state.context = cx.state.context.prev - } - popcontext.lex = true - function pushlex(type, info) { - var result = function() { - var state = cx.state, indent = state.indented; - if (state.lexical.type == "stat") indent = state.lexical.indented; - else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev) - indent = outer.indented; - state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info); - }; - result.lex = true; - return result; - } - function poplex() { - var state = cx.state; - if (state.lexical.prev) { - if (state.lexical.type == ")") - state.indented = state.lexical.indented; - state.lexical = state.lexical.prev; - } - } - poplex.lex = true; - - function expect(wanted) { - function exp(type) { - if (type == wanted) return cont(); - else if (wanted == ";" || type == "}" || type == ")" || type == "]") return pass(); - else return cont(exp); - } - return exp; - } - - function statement(type, value) { - if (type == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex); - if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex); - if (type == "keyword b") return cont(pushlex("form"), statement, poplex); - if (type == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex); - if (type == "debugger") return cont(expect(";")); - if (type == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext); - if (type == ";") return cont(); - if (type == "if") { - if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex) - cx.state.cc.pop()(); - return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse); - } - if (type == "function") return cont(functiondef); - if (type == "for") return cont(pushlex("form"), forspec, statement, poplex); - if (type == "class" || (isTS && value == "interface")) { - cx.marked = "keyword" - return cont(pushlex("form", type == "class" ? type : value), className, poplex) - } - if (type == "variable") { - if (isTS && value == "declare") { - cx.marked = "keyword" - return cont(statement) - } else if (isTS && (value == "module" || value == "enum" || value == "type") && cx.stream.match(/^\s*\w/, false)) { - cx.marked = "keyword" - if (value == "enum") return cont(enumdef); - else if (value == "type") return cont(typename, expect("operator"), typeexpr, expect(";")); - else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex) - } else if (isTS && value == "namespace") { - cx.marked = "keyword" - return cont(pushlex("form"), expression, statement, poplex) - } else if (isTS && value == "abstract") { - cx.marked = "keyword" - return cont(statement) - } else { - return cont(pushlex("stat"), maybelabel); - } - } - if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), pushblockcontext, - block, poplex, poplex, popcontext); - if (type == "case") return cont(expression, expect(":")); - if (type == "default") return cont(expect(":")); - if (type == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext); - if (type == "export") return cont(pushlex("stat"), afterExport, poplex); - if (type == "import") return cont(pushlex("stat"), afterImport, poplex); - if (type == "async") return cont(statement) - if (value == "@") return cont(expression, statement) - return pass(pushlex("stat"), expression, expect(";"), poplex); - } - function maybeCatchBinding(type) { - if (type == "(") return cont(funarg, expect(")")) - } - function expression(type, value) { - return expressionInner(type, value, false); - } - function expressionNoComma(type, value) { - return expressionInner(type, value, true); - } - function parenExpr(type) { - if (type != "(") return pass() - return cont(pushlex(")"), expression, expect(")"), poplex) - } - function expressionInner(type, value, noComma) { - if (cx.state.fatArrowAt == cx.stream.start) { - var body = noComma ? arrowBodyNoComma : arrowBody; - if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, expect("=>"), body, popcontext); - else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext); - } - - var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; - if (atomicTypes.hasOwnProperty(type)) return cont(maybeop); - if (type == "function") return cont(functiondef, maybeop); - if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), classExpression, poplex); } - if (type == "keyword c" || type == "async") return cont(noComma ? expressionNoComma : expression); - if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop); - if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression); - if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop); - if (type == "{") return contCommasep(objprop, "}", null, maybeop); - if (type == "quasi") return pass(quasi, maybeop); - if (type == "new") return cont(maybeTarget(noComma)); - if (type == "import") return cont(expression); - return cont(); - } - function maybeexpression(type) { - if (type.match(/[;\}\)\],]/)) return pass(); - return pass(expression); - } - - function maybeoperatorComma(type, value) { - if (type == ",") return cont(expression); - return maybeoperatorNoComma(type, value, false); - } - function maybeoperatorNoComma(type, value, noComma) { - var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma; - var expr = noComma == false ? expression : expressionNoComma; - if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); - if (type == "operator") { - if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me); - if (isTS && value == "<" && cx.stream.match(/^([^>]|<.*?>)*>\s*\(/, false)) - return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me); - if (value == "?") return cont(expression, expect(":"), expr); - return cont(expr); - } - if (type == "quasi") { return pass(quasi, me); } - if (type == ";") return; - if (type == "(") return contCommasep(expressionNoComma, ")", "call", me); - if (type == ".") return cont(property, me); - if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me); - if (isTS && value == "as") { cx.marked = "keyword"; return cont(typeexpr, me) } - if (type == "regexp") { - cx.state.lastType = cx.marked = "operator" - cx.stream.backUp(cx.stream.pos - cx.stream.start - 1) - return cont(expr) - } - } - function quasi(type, value) { - if (type != "quasi") return pass(); - if (value.slice(value.length - 2) != "${") return cont(quasi); - return cont(expression, continueQuasi); - } - function continueQuasi(type) { - if (type == "}") { - cx.marked = "string-2"; - cx.state.tokenize = tokenQuasi; - return cont(quasi); - } - } - function arrowBody(type) { - findFatArrow(cx.stream, cx.state); - return pass(type == "{" ? statement : expression); - } - function arrowBodyNoComma(type) { - findFatArrow(cx.stream, cx.state); - return pass(type == "{" ? statement : expressionNoComma); - } - function maybeTarget(noComma) { - return function(type) { - if (type == ".") return cont(noComma ? targetNoComma : target); - else if (type == "variable" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma) - else return pass(noComma ? expressionNoComma : expression); - }; - } - function target(_, value) { - if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); } - } - function targetNoComma(_, value) { - if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); } - } - function maybelabel(type) { - if (type == ":") return cont(poplex, statement); - return pass(maybeoperatorComma, expect(";"), poplex); - } - function property(type) { - if (type == "variable") {cx.marked = "property"; return cont();} - } - function objprop(type, value) { - if (type == "async") { - cx.marked = "property"; - return cont(objprop); - } else if (type == "variable" || cx.style == "keyword") { - cx.marked = "property"; - if (value == "get" || value == "set") return cont(getterSetter); - var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params - if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\s*:\s*/, false))) - cx.state.fatArrowAt = cx.stream.pos + m[0].length - return cont(afterprop); - } else if (type == "number" || type == "string") { - cx.marked = jsonldMode ? "property" : (cx.style + " property"); - return cont(afterprop); - } else if (type == "jsonld-keyword") { - return cont(afterprop); - } else if (isTS && isModifier(value)) { - cx.marked = "keyword" - return cont(objprop) - } else if (type == "[") { - return cont(expression, maybetype, expect("]"), afterprop); - } else if (type == "spread") { - return cont(expressionNoComma, afterprop); - } else if (value == "*") { - cx.marked = "keyword"; - return cont(objprop); - } else if (type == ":") { - return pass(afterprop) - } - } - function getterSetter(type) { - if (type != "variable") return pass(afterprop); - cx.marked = "property"; - return cont(functiondef); - } - function afterprop(type) { - if (type == ":") return cont(expressionNoComma); - if (type == "(") return pass(functiondef); - } - function commasep(what, end, sep) { - function proceed(type, value) { - if (sep ? sep.indexOf(type) > -1 : type == ",") { - var lex = cx.state.lexical; - if (lex.info == "call") lex.pos = (lex.pos || 0) + 1; - return cont(function(type, value) { - if (type == end || value == end) return pass() - return pass(what) - }, proceed); - } - if (type == end || value == end) return cont(); - if (sep && sep.indexOf(";") > -1) return pass(what) - return cont(expect(end)); - } - return function(type, value) { - if (type == end || value == end) return cont(); - return pass(what, proceed); - }; - } - function contCommasep(what, end, info) { - for (var i = 3; i < arguments.length; i++) - cx.cc.push(arguments[i]); - return cont(pushlex(end, info), commasep(what, end), poplex); - } - function block(type) { - if (type == "}") return cont(); - return pass(statement, block); - } - function maybetype(type, value) { - if (isTS) { - if (type == ":" || value == "in") return cont(typeexpr); - if (value == "?") return cont(maybetype); - } - } - function mayberettype(type) { - if (isTS && type == ":") { - if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr) - else return cont(typeexpr) - } - } - function isKW(_, value) { - if (value == "is") { - cx.marked = "keyword" - return cont() - } - } - function typeexpr(type, value) { - if (value == "keyof" || value == "typeof" || value == "infer") { - cx.marked = "keyword" - return cont(value == "typeof" ? expressionNoComma : typeexpr) - } - if (type == "variable" || value == "void") { - cx.marked = "type" - return cont(afterType) - } - if (type == "string" || type == "number" || type == "atom") return cont(afterType); - if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType) - if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType) - if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType) - if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr) - } - function maybeReturnType(type) { - if (type == "=>") return cont(typeexpr) - } - function typeprop(type, value) { - if (type == "variable" || cx.style == "keyword") { - cx.marked = "property" - return cont(typeprop) - } else if (value == "?" || type == "number" || type == "string") { - return cont(typeprop) - } else if (type == ":") { - return cont(typeexpr) - } else if (type == "[") { - return cont(expect("variable"), maybetype, expect("]"), typeprop) - } else if (type == "(") { - return pass(functiondecl, typeprop) - } - } - function typearg(type, value) { - if (type == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg) - if (type == ":") return cont(typeexpr) - if (type == "spread") return cont(typearg) - return pass(typeexpr) - } - function afterType(type, value) { - if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType) - if (value == "|" || type == "." || value == "&") return cont(typeexpr) - if (type == "[") return cont(typeexpr, expect("]"), afterType) - if (value == "extends" || value == "implements") { cx.marked = "keyword"; return cont(typeexpr) } - if (value == "?") return cont(typeexpr, expect(":"), typeexpr) - } - function maybeTypeArgs(_, value) { - if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType) - } - function typeparam() { - return pass(typeexpr, maybeTypeDefault) - } - function maybeTypeDefault(_, value) { - if (value == "=") return cont(typeexpr) - } - function vardef(_, value) { - if (value == "enum") {cx.marked = "keyword"; return cont(enumdef)} - return pass(pattern, maybetype, maybeAssign, vardefCont); - } - function pattern(type, value) { - if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(pattern) } - if (type == "variable") { register(value); return cont(); } - if (type == "spread") return cont(pattern); - if (type == "[") return contCommasep(eltpattern, "]"); - if (type == "{") return contCommasep(proppattern, "}"); - } - function proppattern(type, value) { - if (type == "variable" && !cx.stream.match(/^\s*:/, false)) { - register(value); - return cont(maybeAssign); - } - if (type == "variable") cx.marked = "property"; - if (type == "spread") return cont(pattern); - if (type == "}") return pass(); - if (type == "[") return cont(expression, expect(']'), expect(':'), proppattern); - return cont(expect(":"), pattern, maybeAssign); - } - function eltpattern() { - return pass(pattern, maybeAssign) - } - function maybeAssign(_type, value) { - if (value == "=") return cont(expressionNoComma); - } - function vardefCont(type) { - if (type == ",") return cont(vardef); - } - function maybeelse(type, value) { - if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex); - } - function forspec(type, value) { - if (value == "await") return cont(forspec); - if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex); - } - function forspec1(type) { - if (type == "var") return cont(vardef, expect(";"), forspec2); - if (type == ";") return cont(forspec2); - if (type == "variable") return cont(formaybeinof); - return pass(expression, expect(";"), forspec2); - } - function formaybeinof(_type, value) { - if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } - return cont(maybeoperatorComma, forspec2); - } - function forspec2(type, value) { - if (type == ";") return cont(forspec3); - if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } - return pass(expression, expect(";"), forspec3); - } - function forspec3(type) { - if (type != ")") cont(expression); - } - function functiondef(type, value) { - if (value == "*") {cx.marked = "keyword"; return cont(functiondef);} - if (type == "variable") {register(value); return cont(functiondef);} - if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, statement, popcontext); - if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondef) - } - function functiondecl(type, value) { - if (value == "*") {cx.marked = "keyword"; return cont(functiondecl);} - if (type == "variable") {register(value); return cont(functiondecl);} - if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, popcontext); - if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondecl) - } - function typename(type, value) { - if (type == "keyword" || type == "variable") { - cx.marked = "type" - return cont(typename) - } else if (value == "<") { - return cont(pushlex(">"), commasep(typeparam, ">"), poplex) - } - } - function funarg(type, value) { - if (value == "@") cont(expression, funarg) - if (type == "spread") return cont(funarg); - if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(funarg); } - return pass(pattern, maybetype, maybeAssign); - } - function classExpression(type, value) { - // Class expressions may have an optional name. - if (type == "variable") return className(type, value); - return classNameAfter(type, value); - } - function className(type, value) { - if (type == "variable") {register(value); return cont(classNameAfter);} - } - function classNameAfter(type, value) { - if (value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, classNameAfter) - if (value == "extends" || value == "implements" || (isTS && type == ",")) { - if (value == "implements") cx.marked = "keyword"; - return cont(isTS ? typeexpr : expression, classNameAfter); - } - if (type == "{") return cont(pushlex("}"), classBody, poplex); - } - function classBody(type, value) { - if (type == "async" || - (type == "variable" && - (value == "static" || value == "get" || value == "set" || (isTS && isModifier(value))) && - cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) { - cx.marked = "keyword"; - return cont(classBody); - } - if (type == "variable" || cx.style == "keyword") { - cx.marked = "property"; - return cont(isTS ? classfield : functiondef, classBody); - } - if (type == "number" || type == "string") return cont(isTS ? classfield : functiondef, classBody); - if (type == "[") - return cont(expression, maybetype, expect("]"), isTS ? classfield : functiondef, classBody) - if (value == "*") { - cx.marked = "keyword"; - return cont(classBody); - } - if (isTS && type == "(") return pass(functiondecl, classBody) - if (type == ";" || type == ",") return cont(classBody); - if (type == "}") return cont(); - if (value == "@") return cont(expression, classBody) - } - function classfield(type, value) { - if (value == "?") return cont(classfield) - if (type == ":") return cont(typeexpr, maybeAssign) - if (value == "=") return cont(expressionNoComma) - var context = cx.state.lexical.prev, isInterface = context && context.info == "interface" - return pass(isInterface ? functiondecl : functiondef) - } - function afterExport(type, value) { - if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); } - if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); } - if (type == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";")); - return pass(statement); - } - function exportField(type, value) { - if (value == "as") { cx.marked = "keyword"; return cont(expect("variable")); } - if (type == "variable") return pass(expressionNoComma, exportField); - } - function afterImport(type) { - if (type == "string") return cont(); - if (type == "(") return pass(expression); - return pass(importSpec, maybeMoreImports, maybeFrom); - } - function importSpec(type, value) { - if (type == "{") return contCommasep(importSpec, "}"); - if (type == "variable") register(value); - if (value == "*") cx.marked = "keyword"; - return cont(maybeAs); - } - function maybeMoreImports(type) { - if (type == ",") return cont(importSpec, maybeMoreImports) - } - function maybeAs(_type, value) { - if (value == "as") { cx.marked = "keyword"; return cont(importSpec); } - } - function maybeFrom(_type, value) { - if (value == "from") { cx.marked = "keyword"; return cont(expression); } - } - function arrayLiteral(type) { - if (type == "]") return cont(); - return pass(commasep(expressionNoComma, "]")); - } - function enumdef() { - return pass(pushlex("form"), pattern, expect("{"), pushlex("}"), commasep(enummember, "}"), poplex, poplex) - } - function enummember() { - return pass(pattern, maybeAssign); - } - - function isContinuedStatement(state, textAfter) { - return state.lastType == "operator" || state.lastType == "," || - isOperatorChar.test(textAfter.charAt(0)) || - /[,.]/.test(textAfter.charAt(0)); - } - - function expressionAllowed(stream, state, backUp) { - return state.tokenize == tokenBase && - /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(state.lastType) || - (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0)))) - } - - // Interface - - return { - startState: function(basecolumn) { - var state = { - tokenize: tokenBase, - lastType: "sof", - cc: [], - lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false), - localVars: parserConfig.localVars, - context: parserConfig.localVars && new Context(null, null, false), - indented: basecolumn || 0, - }; - if (parserConfig.globalVars && typeof parserConfig.globalVars == "object") - state.globalVars = parserConfig.globalVars; - return state; - }, - - token: function(stream, state) { - if (stream.sol()) { - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = false; - state.indented = stream.indentation(); - findFatArrow(stream, state); - } - if (state.tokenize != tokenComment && stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - if (type == "comment") return style; - state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type; - return parseJS(state, style, type, content, stream); - }, - - indent: function(state, textAfter) { - if (state.tokenize == tokenComment) return CodeMirror.Pass; - if (state.tokenize != tokenBase) return 0; - var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top - // Kludge to prevent 'maybelse' from blocking lexical scope pops - if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) { - var c = state.cc[i]; - if (c == poplex) lexical = lexical.prev; - else if (c != maybeelse) break; - } - while ((lexical.type == "stat" || lexical.type == "form") && - (firstChar == "}" || ((top = state.cc[state.cc.length - 1]) && - (top == maybeoperatorComma || top == maybeoperatorNoComma) && - !/^[,\.=+\-*:?[\(]/.test(textAfter)))) - lexical = lexical.prev; - if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat") - lexical = lexical.prev; - var type = lexical.type, closing = firstChar == type; - - if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info.length + 1 : 0); - else if (type == "form" && firstChar == "{") return lexical.indented; - else if (type == "form") return lexical.indented + indentUnit; - else if (type == "stat") - return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0); - else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false) - return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); - else if (lexical.align) return lexical.column + (closing ? 0 : 1); - else return lexical.indented + (closing ? 0 : indentUnit); - }, - - electricInput: /^\s*(?:case .*?:|default:|\{|\})$/, - blockCommentStart: jsonMode ? null : "/*", - blockCommentEnd: jsonMode ? null : "*/", - blockCommentContinue: jsonMode ? null : " * ", - lineComment: jsonMode ? null : "//", - fold: "brace", - closeBrackets: "()[]{}''\"\"``", - - helperType: jsonMode ? "json" : "netscript", - jsonldMode: jsonldMode, - jsonMode: jsonMode, - - expressionAllowed: expressionAllowed, - - skipExpression: function(state) { - var top = state.cc[state.cc.length - 1] - if (top == expression || top == expressionNoComma) state.cc.pop() - }, - }; -}); - -CodeMirror.registerHelper("wordChars", "netscript", /[\w$]/); - -CodeMirror.defineMIME("text/netscript", "netscript"); -CodeMirror.defineMIME("text/ecmascript", "netscript"); -CodeMirror.defineMIME("application/netscript", "netscript"); -CodeMirror.defineMIME("application/x-netscript", "netscript"); -CodeMirror.defineMIME("application/ecmascript", "netscript"); -CodeMirror.defineMIME("application/json", {name: "netscript", json: true}); -CodeMirror.defineMIME("application/x-json", {name: "netscript", json: true}); -CodeMirror.defineMIME("application/ld+json", {name: "netscript", jsonld: true}); -CodeMirror.defineMIME("text/typescript", { name: "netscript", typescript: true }); -CodeMirror.defineMIME("application/typescript", { name: "netscript", typescript: true }); - -}); diff --git a/src/ScriptEditor/ScriptEditor.js b/src/ScriptEditor/ScriptEditor.js deleted file mode 100644 index dc2b301a7..000000000 --- a/src/ScriptEditor/ScriptEditor.js +++ /dev/null @@ -1,61 +0,0 @@ -import { CursorPositions } from './CursorPositions'; - -// Base Script Editor class for the Ace/CodeMirror/etc. wrappers -import { js_beautify as beautify } from 'js-beautify'; - -export class ScriptEditor { - constructor() { - this.editor = null; // Stores the CodeMirror editor reference - this.filenameInput = null; // Stores the filename input DOM element - } - - init() { - throw new Error(`Tried to initialize base ScriptEditor class`); - } - - beautifyScript() { - if (this.editor == null) { - console.warn(`ScriptEditor.beautifyScript() called when editor was not initialized`); - return; - } - let code = this.editor.getValue(); - code = beautify(code, { - indent_size: 4, - brace_style: "preserve-inline", - }); - this.editor.setValue(code); - } - - openScript(filename="", code="") { - if (this.editor == null || this.filenameInput == null) { - console.warn(`ScriptEditor.openScript() called when editor was not initialized`); - return; - } - - if (filename != "") { - this.filenameInput.value = filename; - this.editor.setValue(code); - this.setCursor(CursorPositions.getCursor(filename)); - } - - this.editor.focus(); - } - - getCode() { - if (this.editor == null) { - console.warn(`ScriptEditor.getCode() called when editor was not initialized`); - return ""; - } - - return this.editor.getValue(); - } - - getFilename() { - if (this.filenameInput == null) { - console.warn(`ScriptEditor.getFilename() called when editor was not initialized`); - return ""; - } - - return this.filenameInput.value; - } -} diff --git a/src/Terminal.jsx b/src/Terminal.jsx index 26c465eaa..25953f472 100644 --- a/src/Terminal.jsx +++ b/src/Terminal.jsx @@ -56,7 +56,6 @@ import { RunningScript } from "./Script/RunningScript"; import { compareArrays } from "../utils/helpers/compareArrays"; import { getRamUsageFromRunningScript } from "./Script/RunningScriptHelpers"; import { - getCurrentEditor, findRunningScript, findRunningScriptByPid, } from "./Script/ScriptHelpers"; @@ -1888,7 +1887,6 @@ let Terminal = { }`; } Engine.loadScriptEditorContent(filepath, code); - getCurrentEditor().setCursor({row: 1, column: 4}); } else { Engine.loadScriptEditorContent(filepath, script.code); } From 0e2402079659b11869e6e299e219a887260f21cb Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 02:03:16 -0400 Subject: [PATCH 04/12] Move monaco UI back where it belongs ish --- src/{Monaco => ScriptEditor}/ui/Config.ts | 0 src/{Monaco => ScriptEditor}/ui/ConfigPopup.tsx | 0 src/{Monaco => ScriptEditor}/ui/Root.tsx | 0 src/engine.jsx | 2 +- 4 files changed, 1 insertion(+), 1 deletion(-) rename src/{Monaco => ScriptEditor}/ui/Config.ts (100%) rename src/{Monaco => ScriptEditor}/ui/ConfigPopup.tsx (100%) rename src/{Monaco => ScriptEditor}/ui/Root.tsx (100%) diff --git a/src/Monaco/ui/Config.ts b/src/ScriptEditor/ui/Config.ts similarity index 100% rename from src/Monaco/ui/Config.ts rename to src/ScriptEditor/ui/Config.ts diff --git a/src/Monaco/ui/ConfigPopup.tsx b/src/ScriptEditor/ui/ConfigPopup.tsx similarity index 100% rename from src/Monaco/ui/ConfigPopup.tsx rename to src/ScriptEditor/ui/ConfigPopup.tsx diff --git a/src/Monaco/ui/Root.tsx b/src/ScriptEditor/ui/Root.tsx similarity index 100% rename from src/Monaco/ui/Root.tsx rename to src/ScriptEditor/ui/Root.tsx diff --git a/src/engine.jsx b/src/engine.jsx index ed2c02d1e..16af158d9 100644 --- a/src/engine.jsx +++ b/src/engine.jsx @@ -66,7 +66,7 @@ import { } from "./Programs/ProgramHelpers"; import { redPillFlag } from "./RedPill"; import { saveObject, loadGame } from "./SaveObject"; -import { Root as ScriptEditorRoot } from "./Monaco/ui/Root"; +import { Root as ScriptEditorRoot } from "./ScriptEditor/ui/Root"; import { initForeignServers, AllServers } from "./Server/AllServers"; import { Settings } from "./Settings/Settings"; import { updateSourceFileFlags } from "./SourceFile/SourceFileFlags"; From 2dfd19c9e0e61fe08ab61b08fcb50ff53d1904e2 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 02:14:27 -0400 Subject: [PATCH 05/12] rename, kinda add option for tabs vs space --- src/ScriptEditor/ui/Config.ts | 3 --- src/ScriptEditor/ui/Options.ts | 4 +++ .../ui/{ConfigPopup.tsx => OptionsPopup.tsx} | 17 ++++++------ src/ScriptEditor/ui/Root.tsx | 26 +++++++++++-------- 4 files changed, 28 insertions(+), 22 deletions(-) delete mode 100644 src/ScriptEditor/ui/Config.ts create mode 100644 src/ScriptEditor/ui/Options.ts rename src/ScriptEditor/ui/{ConfigPopup.tsx => OptionsPopup.tsx} (67%) diff --git a/src/ScriptEditor/ui/Config.ts b/src/ScriptEditor/ui/Config.ts deleted file mode 100644 index de5530a69..000000000 --- a/src/ScriptEditor/ui/Config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface Config { - theme: string; -} \ No newline at end of file diff --git a/src/ScriptEditor/ui/Options.ts b/src/ScriptEditor/ui/Options.ts new file mode 100644 index 000000000..23386c1f3 --- /dev/null +++ b/src/ScriptEditor/ui/Options.ts @@ -0,0 +1,4 @@ +export interface Options { + theme: string; + insertSpaces: boolean; +} \ No newline at end of file diff --git a/src/ScriptEditor/ui/ConfigPopup.tsx b/src/ScriptEditor/ui/OptionsPopup.tsx similarity index 67% rename from src/ScriptEditor/ui/ConfigPopup.tsx rename to src/ScriptEditor/ui/OptionsPopup.tsx index d9b72cc62..dea303c2d 100644 --- a/src/ScriptEditor/ui/ConfigPopup.tsx +++ b/src/ScriptEditor/ui/OptionsPopup.tsx @@ -1,30 +1,31 @@ import React, { useState } from 'react'; -import { Config } from "./Config"; +import { Options } from "./Options"; import { StdButton } from "../../ui/React/StdButton"; import { removePopup } from "../../ui/React/createPopup"; interface IProps { id: string; - config: Config; - save: (config: Config) => void; + options: Options; + save: (options: Options) => void; } -export function ConfigPopup(props: IProps): React.ReactElement { - const [config, setConfig] = useState(props.config); +export function OptionsPopup(props: IProps): React.ReactElement { + const [options, setOptions] = useState(props.options); function save() { - props.save(config); + props.save(options); removePopup(props.id); } function setTheme(event: React.ChangeEvent): void { - setConfig(old => { + setOptions(old => { old.theme = event.target.value; return old; }); } return (<> - diff --git a/src/ScriptEditor/ui/Root.tsx b/src/ScriptEditor/ui/Root.tsx index 53ab29dba..e410fe9dc 100644 --- a/src/ScriptEditor/ui/Root.tsx +++ b/src/ScriptEditor/ui/Root.tsx @@ -4,8 +4,8 @@ import Editor from "@monaco-editor/react"; import * as monaco from "monaco-editor"; import IStandaloneCodeEditor = monaco.editor.IStandaloneCodeEditor; import { createPopup } from "../../ui/React/createPopup"; -import { ConfigPopup } from "./ConfigPopup"; -import { Config } from "./Config"; +import { OptionsPopup } from "./OptionsPopup"; +import { Options } from "./Options"; import { js_beautify as beautifyCode } from 'js-beautify'; import { isValidFilePath } from "../../Terminal/DirectoryHelpers"; import { IPlayer } from "../../PersonObjects/IPlayer"; @@ -37,7 +37,7 @@ export function Root(props: IProps): React.ReactElement { const [filename, setFilename] = useState(props.filename); const [code, setCode] = useState(props.code); const [ram, setRAM] = useState(''); - const [config, setConfig] = useState({theme: 'vs-dark'}); + const [options, setOptions] = useState({theme: 'vs-dark', insertSpaces: false}); function save(): void { if(editorRef.current !== null) { @@ -133,6 +133,7 @@ export function Root(props: IProps): React.ReactElement { function beautify(): void { setCode(code => beautifyCode(code, { + indent_with_tabs: !options.insertSpaces, indent_size: 4, brace_style: "preserve-inline", })); @@ -142,12 +143,15 @@ export function Root(props: IProps): React.ReactElement { setFilename(event.target.value); } - function openConfig(): void { - const id="script-editor-config-options-popup"; - createPopup(id, ConfigPopup, { + function openOptions(): void { + const id="script-editor-options-popup"; + createPopup(id, OptionsPopup, { id: id, - config: {theme: config.theme}, - save: (config: Config) => setConfig(config), + options: { + theme: options.theme, + insertSpaces: options.insertSpaces, + }, + save: (options: Options) => setOptions(options), }); } @@ -196,9 +200,9 @@ export function Root(props: IProps): React.ReactElement { return (
-

Script name:

+

Script name:

- +
From b1caea796a216086eaac6c8520e0edd108e78d4e Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 04:03:00 -0400 Subject: [PATCH 06/12] another link --- src/ScriptEditor/ui/Root.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ScriptEditor/ui/Root.tsx b/src/ScriptEditor/ui/Root.tsx index e410fe9dc..cb4ca4cba 100644 --- a/src/ScriptEditor/ui/Root.tsx +++ b/src/ScriptEditor/ui/Root.tsx @@ -31,6 +31,7 @@ interface IProps { // https://github.com/Microsoft/monaco-editor/issues/1415 // https://microsoft.github.io/monaco-editor/api/modules/monaco.languages.html // https://www.npmjs.com/package/@monaco-editor/react#development-playground +// https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-custom-languages export function Root(props: IProps): React.ReactElement { const editorRef = useRef(null); From fb87385704d1dec99c7390c6369cda64a685fd78 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 13:33:52 -0400 Subject: [PATCH 07/12] Added function definition for netscritp in typescript --- src/ScriptEditor/NetscriptDefinitions.ts | 144 +++++++++++++++++++++++ src/ScriptEditor/ui/Root.tsx | 1 + 2 files changed, 145 insertions(+) create mode 100644 src/ScriptEditor/NetscriptDefinitions.ts diff --git a/src/ScriptEditor/NetscriptDefinitions.ts b/src/ScriptEditor/NetscriptDefinitions.ts new file mode 100644 index 000000000..ea74d4311 --- /dev/null +++ b/src/ScriptEditor/NetscriptDefinitions.ts @@ -0,0 +1,144 @@ +export declare function scan(ip: string, hostnames: boolean): string[]; +export declare function hack(ip: string, threads: number, stock: boolean): Promise; +export declare function hackAnalyzeThreads(ip: string, hackAmount: number): number; +export declare function hackAnalyzePercent(ip: string): number; +export declare function hackChance(ip: string): number; +export declare function sleep(time: number): Promise; +export declare function grow(ip: string, threads: number, stock: boolean): Promise; +export declare function growthAnalyze(ip: string, growth: number): number; +export declare function weaken(ip: string, threads: boolean): Promise; +export declare function print(): void; +export declare function tprint(): void; +export declare function clearLog(): void; +export declare function disableLog(fn: string): void; +export declare function enableLog(fn: string): void; +export declare function isLogEnabled(fn: string): boolean; +export declare function getScriptLogs(fn: string, ip: string, ...scriptArgs: any[]): string[]; +export declare function tail(fn: string, ip: string, ...scriptArgs: any[]): void; +export declare function nuke(ip: string): boolean; +export declare function brutessh(ip: string): boolean; +export declare function ftpcrack(ip: string): boolean; +export declare function relaysmtp(ip: string): boolean; +export declare function httpworm(ip: string): boolean; +export declare function sqlinject(ip: string): boolean; +export declare function run(scriptname: string, threads: number): number; +export declare function exec(scriptname: string, ip: string, threads: number): number; +export declare function spawn(scriptname: string, threads: number): void; +export declare function kill(filename: string, ip: string, ...scriptArgs: any[]): boolean; +export declare function killall(ip: string): boolean; +export declare function exit(): void; +export declare function scp(scriptname: string, ip1: string, ip2: string): boolean; +export declare function ls(ip: string, grep: string): string[]; +export declare function ps(ip: string): {filename: string, threads: number, args: string[], pid: number}[]; +export declare function hasRootAccess(ip: string): boolean; +export declare function getIp(): string; +export declare function getHostname(): string; +export declare function getHackingLevel(): number; +export declare function getHackingMultipliers(): number; +export declare function getHacknetMultipliers(): number; +export declare function getBitNodeMultipliers(): number; +export declare function getServer(ip: string): any; +export declare function getServerMoneyAvailable(ip: string): number; +export declare function getServerSecurityLevel(ip: string): number; +export declare function getServerBaseSecurityLevel(ip: string): number; +export declare function getServerMinSecurityLevel(ip: string): number; +export declare function getServerRequiredHackingLevel(ip: string): number; +export declare function getServerMaxMoney(ip: string): number; +export declare function getServerGrowth(ip: string): number; +export declare function getServerNumPortsRequired(ip: string): number; +export declare function getServerRam(ip: string): number[]; +export declare function getServerMaxRam(ip: string): number; +export declare function getServerUsedRam(ip: string): number; +export declare function serverExists(ip: string): boolean; +export declare function fileExists(filename: string, ip: string): boolean; +export declare function isRunning(fn: string, ip: string, ...scriptArgs: any[]): boolean; +export declare function getStockSymbols(): string[]; +export declare function getStockPrice(symbol: string): number; +export declare function getStockAskPrice(symbol: string): number; +export declare function getStockBidPrice(symbol: string): number; +export declare function getStockPosition(symbol: string): number; +export declare function getStockMaxShares(symbol: string): number; +export declare function getStockPurchaseCost(symbol: string, shares: number, posType: string): number; +export declare function getStockSaleGain(symbol: string, shares: number, posType: string): number; +export declare function buyStock(symbol: string, shares: number): number; +export declare function sellStock(symbol: string, shares: number): number; +export declare function shortStock(symbol: string, shares: number): number; +export declare function sellShort(symbol: string, shares: number): number; +export declare function placeOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean; +export declare function cancelOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean; +export declare function getOrders(): any; +export declare function getStockVolatility(symbol: string): number; +export declare function getStockForecast(symbol: string): number; +export declare function getPurchasedServerLimit(): number; +export declare function getPurchasedServerMaxRam(): number; +export declare function getPurchasedServerCost(ram: number): number; +export declare function purchaseServer(hostname: string, ram: number): string; +export declare function deleteServer(hostname: string): boolean; +export declare function getPurchasedServers(hostname: string): string[]; +export declare function write(port: number, data: string, mode: string): boolean; +export declare function tryWrite(port: number, data: string): boolean; +export declare function read(port: number): any; +export declare function peek(port: number): any; +export declare function clear(port: number): number; +export declare function getPortHandle(port: number): any; // netscript port +export declare function rm(fn: string, ip: string): boolean; +export declare function scriptRunning(scriptname: string, ip: string): boolean; +export declare function scriptKill(scriptname: string, ip: string): boolean; +export declare function getScriptName(): string; +export declare function getScriptRam(scriptname: string, ip: string): number; +export declare function getRunningScript(fn: string, ip: string): any; // running script +export declare function getHackTime(ip: string): number; +export declare function getGrowTime(ip: string): number; +export declare function getWeakenTime(ip: string): number; +export declare function getScriptIncome(scriptname: string, ip: string): number; +export declare function getScriptExpGain(scriptname: string, ip: string): number; +export declare function nFormat(n: number, format: string): string; +export declare function tFormat(milliseconds: number, milliPrecision: boolean): string; +export declare function getTimeSinceLastAug(): number; +export declare function prompt(txt: string): Promise; +export declare function getFavorToDonate(): number; +export declare function universityCourse(universityName: string, className: string): boolean; +export declare function gymWorkout(gymName: string, stat: string): boolean; +export declare function travelToCity(cityname: string): boolean; +export declare function purchaseTor(): boolean; +export declare function purchaseProgram(programName: string): boolean; +export declare function getCurrentServer(): any; // server object +export declare function connect(hostname: string): boolean; +export declare function manualHack(): Promise; +export declare function installBackdoor(): Promise; +export declare function getStats(): any; // complex type +export declare function getCharacterInformation(): any; // complex type +export declare function getPlayer(): any; // complex type +export declare function hospitalize(): number; +export declare function isBusy(): boolean; +export declare function stopAction(): boolean; +export declare function upgradeHomeRam(): number; +export declare function getUpgradeHomeRamCost(): number; +export declare function workForCompany(companyName: string): boolean; +export declare function applyToCompany(companyName: string, field: string): boolean; +export declare function getCompanyRep(companyName: string): number; +export declare function getCompanyFavor(companyName: string): number; +export declare function getCompanyFavorGain(companyName: string): number; +export declare function checkFactionInvitations(): string[]; +export declare function joinFaction(name: string): boolean; +export declare function workForFaction(name: string, type: string): boolean; +export declare function getFactionRep(name: string): number; +export declare function getFactionFavor(name: string): number; +export declare function getFactionFavorGain(name: string): number; +export declare function donateToFaction(name: string, amt: number): boolean; +export declare function createProgram(name: string): boolean; +export declare function commitCrime(crimeRoughName: string): number; +export declare function getCrimeChance(crimeRoughName: string): boolean; +export declare function getCrimeStats(crimeRoughName: string): any; // complex type +export declare function getOwnedAugmentations(purchased: boolean): string[]; +export declare function getOwnedSourceFiles(): any; // complex type +export declare function getAugmentationsFromFaction(facname: string): string[]; +export declare function getAugmentationPrereq(name: string): string[]; +export declare function getAugmentationCost(name: string): number; +export declare function getAugmentationStats(name: string): any; // complex type +export declare function purchaseAugmentation(faction: string, name: string): boolean; +export declare function softReset(cbScript: string): void; +export declare function installAugmentations(cbScript: string): void; +export declare function exploit(): void; +export declare function bypass(doc: any): void; +export declare function flags(data: any): any; \ No newline at end of file diff --git a/src/ScriptEditor/ui/Root.tsx b/src/ScriptEditor/ui/Root.tsx index cb4ca4cba..114d18ddc 100644 --- a/src/ScriptEditor/ui/Root.tsx +++ b/src/ScriptEditor/ui/Root.tsx @@ -19,6 +19,7 @@ import { calculateRamUsage } from "../../Script/RamCalculations"; import { RamCalculationErrorCode } from "../../Script/RamCalculationErrorCodes"; import { numeralWrapper } from "../../ui/numeralFormat"; import { CursorPositions } from "../../ScriptEditor/CursorPositions"; +import * as NetscriptDefinitions from "../NetscriptDefinitions"; interface IProps { filename: string; From 86de11e79464b92cc6d5aebc403744c2ef5c8284 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 13:57:32 -0400 Subject: [PATCH 08/12] link for monaco --- src/ScriptEditor/ui/Root.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ScriptEditor/ui/Root.tsx b/src/ScriptEditor/ui/Root.tsx index 114d18ddc..876787799 100644 --- a/src/ScriptEditor/ui/Root.tsx +++ b/src/ScriptEditor/ui/Root.tsx @@ -33,6 +33,7 @@ interface IProps { // https://microsoft.github.io/monaco-editor/api/modules/monaco.languages.html // https://www.npmjs.com/package/@monaco-editor/react#development-playground // https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-custom-languages +// https://github.com/threehams/typescript-error-guide/blob/master/stories/components/Editor.tsx#L11-L39 export function Root(props: IProps): React.ReactElement { const editorRef = useRef(null); From 0b3c48827ba87c197959242428d22413040bcc17 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 15:30:19 -0400 Subject: [PATCH 09/12] Ok we can load a thing but it has no effect. --- src/ScriptEditor/ui/Root.tsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ScriptEditor/ui/Root.tsx b/src/ScriptEditor/ui/Root.tsx index 876787799..0733d33a3 100644 --- a/src/ScriptEditor/ui/Root.tsx +++ b/src/ScriptEditor/ui/Root.tsx @@ -201,6 +201,27 @@ export function Root(props: IProps): React.ReactElement { editorRef.current.focus(); } + function beforeMount(monaco: any): void { + + // extra libraries + const libSource = ` +export declare function upgradeHomeRam(): number; +export declare function getUpgradeHomeRamCost(): number; +export declare function workForCompany(companyName: string): boolean; +export declare function applyToCompany(companyName: string, field: string): boolean; +export declare function getCompanyRep(companyName: string): number; +export declare function getCompanyFavor(companyName: string): number; +export declare function getCompanyFavorGain(companyName: string): number; +export declare function checkFactionInvitations(): string[]; +export declare function joinFaction(name: string): boolean; +export declare function workForFaction(name: string, type: string): boolean; +export declare function getFactionRep(name: string): number; +export declare function getFactionFavor(name: string): number;`; + + monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource); + monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource); + } + return (

Script name:

@@ -208,6 +229,7 @@ export function Root(props: IProps): React.ReactElement {
Loading script editor!

} height="80%" From 449714378512529d1b3c2ba0eea29017f69066b0 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 16:11:49 -0400 Subject: [PATCH 10/12] basic autocomplete working --- src/ScriptEditor/NetscriptDefinitions.ts | 294 ++++++++++++----------- src/ScriptEditor/ui/Root.tsx | 24 +- 2 files changed, 154 insertions(+), 164 deletions(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.ts b/src/ScriptEditor/NetscriptDefinitions.ts index ea74d4311..9450fc1f1 100644 --- a/src/ScriptEditor/NetscriptDefinitions.ts +++ b/src/ScriptEditor/NetscriptDefinitions.ts @@ -1,144 +1,150 @@ -export declare function scan(ip: string, hostnames: boolean): string[]; -export declare function hack(ip: string, threads: number, stock: boolean): Promise; -export declare function hackAnalyzeThreads(ip: string, hackAmount: number): number; -export declare function hackAnalyzePercent(ip: string): number; -export declare function hackChance(ip: string): number; -export declare function sleep(time: number): Promise; -export declare function grow(ip: string, threads: number, stock: boolean): Promise; -export declare function growthAnalyze(ip: string, growth: number): number; -export declare function weaken(ip: string, threads: boolean): Promise; -export declare function print(): void; -export declare function tprint(): void; -export declare function clearLog(): void; -export declare function disableLog(fn: string): void; -export declare function enableLog(fn: string): void; -export declare function isLogEnabled(fn: string): boolean; -export declare function getScriptLogs(fn: string, ip: string, ...scriptArgs: any[]): string[]; -export declare function tail(fn: string, ip: string, ...scriptArgs: any[]): void; -export declare function nuke(ip: string): boolean; -export declare function brutessh(ip: string): boolean; -export declare function ftpcrack(ip: string): boolean; -export declare function relaysmtp(ip: string): boolean; -export declare function httpworm(ip: string): boolean; -export declare function sqlinject(ip: string): boolean; -export declare function run(scriptname: string, threads: number): number; -export declare function exec(scriptname: string, ip: string, threads: number): number; -export declare function spawn(scriptname: string, threads: number): void; -export declare function kill(filename: string, ip: string, ...scriptArgs: any[]): boolean; -export declare function killall(ip: string): boolean; -export declare function exit(): void; -export declare function scp(scriptname: string, ip1: string, ip2: string): boolean; -export declare function ls(ip: string, grep: string): string[]; -export declare function ps(ip: string): {filename: string, threads: number, args: string[], pid: number}[]; -export declare function hasRootAccess(ip: string): boolean; -export declare function getIp(): string; -export declare function getHostname(): string; -export declare function getHackingLevel(): number; -export declare function getHackingMultipliers(): number; -export declare function getHacknetMultipliers(): number; -export declare function getBitNodeMultipliers(): number; -export declare function getServer(ip: string): any; -export declare function getServerMoneyAvailable(ip: string): number; -export declare function getServerSecurityLevel(ip: string): number; -export declare function getServerBaseSecurityLevel(ip: string): number; -export declare function getServerMinSecurityLevel(ip: string): number; -export declare function getServerRequiredHackingLevel(ip: string): number; -export declare function getServerMaxMoney(ip: string): number; -export declare function getServerGrowth(ip: string): number; -export declare function getServerNumPortsRequired(ip: string): number; -export declare function getServerRam(ip: string): number[]; -export declare function getServerMaxRam(ip: string): number; -export declare function getServerUsedRam(ip: string): number; -export declare function serverExists(ip: string): boolean; -export declare function fileExists(filename: string, ip: string): boolean; -export declare function isRunning(fn: string, ip: string, ...scriptArgs: any[]): boolean; -export declare function getStockSymbols(): string[]; -export declare function getStockPrice(symbol: string): number; -export declare function getStockAskPrice(symbol: string): number; -export declare function getStockBidPrice(symbol: string): number; -export declare function getStockPosition(symbol: string): number; -export declare function getStockMaxShares(symbol: string): number; -export declare function getStockPurchaseCost(symbol: string, shares: number, posType: string): number; -export declare function getStockSaleGain(symbol: string, shares: number, posType: string): number; -export declare function buyStock(symbol: string, shares: number): number; -export declare function sellStock(symbol: string, shares: number): number; -export declare function shortStock(symbol: string, shares: number): number; -export declare function sellShort(symbol: string, shares: number): number; -export declare function placeOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean; -export declare function cancelOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean; -export declare function getOrders(): any; -export declare function getStockVolatility(symbol: string): number; -export declare function getStockForecast(symbol: string): number; -export declare function getPurchasedServerLimit(): number; -export declare function getPurchasedServerMaxRam(): number; -export declare function getPurchasedServerCost(ram: number): number; -export declare function purchaseServer(hostname: string, ram: number): string; -export declare function deleteServer(hostname: string): boolean; -export declare function getPurchasedServers(hostname: string): string[]; -export declare function write(port: number, data: string, mode: string): boolean; -export declare function tryWrite(port: number, data: string): boolean; -export declare function read(port: number): any; -export declare function peek(port: number): any; -export declare function clear(port: number): number; -export declare function getPortHandle(port: number): any; // netscript port -export declare function rm(fn: string, ip: string): boolean; -export declare function scriptRunning(scriptname: string, ip: string): boolean; -export declare function scriptKill(scriptname: string, ip: string): boolean; -export declare function getScriptName(): string; -export declare function getScriptRam(scriptname: string, ip: string): number; -export declare function getRunningScript(fn: string, ip: string): any; // running script -export declare function getHackTime(ip: string): number; -export declare function getGrowTime(ip: string): number; -export declare function getWeakenTime(ip: string): number; -export declare function getScriptIncome(scriptname: string, ip: string): number; -export declare function getScriptExpGain(scriptname: string, ip: string): number; -export declare function nFormat(n: number, format: string): string; -export declare function tFormat(milliseconds: number, milliPrecision: boolean): string; -export declare function getTimeSinceLastAug(): number; -export declare function prompt(txt: string): Promise; -export declare function getFavorToDonate(): number; -export declare function universityCourse(universityName: string, className: string): boolean; -export declare function gymWorkout(gymName: string, stat: string): boolean; -export declare function travelToCity(cityname: string): boolean; -export declare function purchaseTor(): boolean; -export declare function purchaseProgram(programName: string): boolean; -export declare function getCurrentServer(): any; // server object -export declare function connect(hostname: string): boolean; -export declare function manualHack(): Promise; -export declare function installBackdoor(): Promise; -export declare function getStats(): any; // complex type -export declare function getCharacterInformation(): any; // complex type -export declare function getPlayer(): any; // complex type -export declare function hospitalize(): number; -export declare function isBusy(): boolean; -export declare function stopAction(): boolean; -export declare function upgradeHomeRam(): number; -export declare function getUpgradeHomeRamCost(): number; -export declare function workForCompany(companyName: string): boolean; -export declare function applyToCompany(companyName: string, field: string): boolean; -export declare function getCompanyRep(companyName: string): number; -export declare function getCompanyFavor(companyName: string): number; -export declare function getCompanyFavorGain(companyName: string): number; -export declare function checkFactionInvitations(): string[]; -export declare function joinFaction(name: string): boolean; -export declare function workForFaction(name: string, type: string): boolean; -export declare function getFactionRep(name: string): number; -export declare function getFactionFavor(name: string): number; -export declare function getFactionFavorGain(name: string): number; -export declare function donateToFaction(name: string, amt: number): boolean; -export declare function createProgram(name: string): boolean; -export declare function commitCrime(crimeRoughName: string): number; -export declare function getCrimeChance(crimeRoughName: string): boolean; -export declare function getCrimeStats(crimeRoughName: string): any; // complex type -export declare function getOwnedAugmentations(purchased: boolean): string[]; -export declare function getOwnedSourceFiles(): any; // complex type -export declare function getAugmentationsFromFaction(facname: string): string[]; -export declare function getAugmentationPrereq(name: string): string[]; -export declare function getAugmentationCost(name: string): number; -export declare function getAugmentationStats(name: string): any; // complex type -export declare function purchaseAugmentation(faction: string, name: string): boolean; -export declare function softReset(cbScript: string): void; -export declare function installAugmentations(cbScript: string): void; -export declare function exploit(): void; -export declare function bypass(doc: any): void; -export declare function flags(data: any): any; \ No newline at end of file +export const libSource = `interface NS { + args: string[]; + /** + * Example documentation for scan. + */ + scan(ip: string, hostnames: boolean): string[]; + hack(ip: string, threads: number, stock: boolean): Promise; + hackAnalyzeThreads(ip: string, hackAmount: number): number; + hackAnalyzePercent(ip: string): number; + hackChance(ip: string): number; + sleep(time: number): Promise; + grow(ip: string, threads: number, stock: boolean): Promise; + growthAnalyze(ip: string, growth: number): number; + weaken(ip: string, threads: boolean): Promise; + print(...args: any[]): void; + tprint(...args: any[]): void; + clearLog(): void; + disableLog(fn: string): void; + enableLog(fn: string): void; + isLogEnabled(fn: string): boolean; + getScriptLogs(fn: string, ip: string, ...scriptArgs: any[]): string[]; + tail(fn: string, ip: string, ...scriptArgs: any[]): void; + nuke(ip: string): boolean; + brutessh(ip: string): boolean; + ftpcrack(ip: string): boolean; + relaysmtp(ip: string): boolean; + httpworm(ip: string): boolean; + sqlinject(ip: string): boolean; + run(scriptname: string, threads: number): number; + exec(scriptname: string, ip: string, threads: number): number; + spawn(scriptname: string, threads: number): void; + kill(filename: string, ip: string, ...scriptArgs: any[]): boolean; + killall(ip: string): boolean; + exit(): void; + scp(scriptname: string, ip1: string, ip2: string): boolean; + ls(ip: string, grep: string): string[]; + ps(ip: string): {filename: string, threads: number, args: string[], pid: number}[]; + hasRootAccess(ip: string): boolean; + getIp(): string; + getHostname(): string; + getHackingLevel(): number; + getHackingMultipliers(): number; + getHacknetMultipliers(): number; + getBitNodeMultipliers(): number; + getServer(ip: string): any; + getServerMoneyAvailable(ip: string): number; + getServerSecurityLevel(ip: string): number; + getServerBaseSecurityLevel(ip: string): number; + getServerMinSecurityLevel(ip: string): number; + getServerRequiredHackingLevel(ip: string): number; + getServerMaxMoney(ip: string): number; + getServerGrowth(ip: string): number; + getServerNumPortsRequired(ip: string): number; + getServerRam(ip: string): number[]; + getServerMaxRam(ip: string): number; + getServerUsedRam(ip: string): number; + serverExists(ip: string): boolean; + fileExists(filename: string, ip: string): boolean; + isRunning(fn: string, ip: string, ...scriptArgs: any[]): boolean; + getStockSymbols(): string[]; + getStockPrice(symbol: string): number; + getStockAskPrice(symbol: string): number; + getStockBidPrice(symbol: string): number; + getStockPosition(symbol: string): number; + getStockMaxShares(symbol: string): number; + getStockPurchaseCost(symbol: string, shares: number, posType: string): number; + getStockSaleGain(symbol: string, shares: number, posType: string): number; + buyStock(symbol: string, shares: number): number; + sellStock(symbol: string, shares: number): number; + shortStock(symbol: string, shares: number): number; + sellShort(symbol: string, shares: number): number; + placeOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean; + cancelOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean; + getOrders(): any; + getStockVolatility(symbol: string): number; + getStockForecast(symbol: string): number; + getPurchasedServerLimit(): number; + getPurchasedServerMaxRam(): number; + getPurchasedServerCost(ram: number): number; + purchaseServer(hostname: string, ram: number): string; + deleteServer(hostname: string): boolean; + getPurchasedServers(hostname: string): string[]; + write(port: number, data: string, mode: string): boolean; + tryWrite(port: number, data: string): boolean; + read(port: number): any; + peek(port: number): any; + clear(port: number): number; + getPortHandle(port: number): any; // netscript port + rm(fn: string, ip: string): boolean; + scriptRunning(scriptname: string, ip: string): boolean; + scriptKill(scriptname: string, ip: string): boolean; + getScriptName(): string; + getScriptRam(scriptname: string, ip: string): number; + getRunningScript(fn: string, ip: string): any; // running script + getHackTime(ip: string): number; + getGrowTime(ip: string): number; + getWeakenTime(ip: string): number; + getScriptIncome(scriptname: string, ip: string): number; + getScriptExpGain(scriptname: string, ip: string): number; + nFormat(n: number, format: string): string; + tFormat(milliseconds: number, milliPrecision: boolean): string; + getTimeSinceLastAug(): number; + prompt(txt: string): Promise; + getFavorToDonate(): number; + universityCourse(universityName: string, className: string): boolean; + gymWorkout(gymName: string, stat: string): boolean; + travelToCity(cityname: string): boolean; + purchaseTor(): boolean; + purchaseProgram(programName: string): boolean; + getCurrentServer(): any; // server object + connect(hostname: string): boolean; + manualHack(): Promise; + installBackdoor(): Promise; + getStats(): any; // complex type + getCharacterInformation(): any; // complex type + getPlayer(): any; // complex type + hospitalize(): number; + isBusy(): boolean; + stopAction(): boolean; + upgradeHomeRam(): number; + getUpgradeHomeRamCost(): number; + workForCompany(companyName: string): boolean; + applyToCompany(companyName: string, field: string): boolean; + getCompanyRep(companyName: string): number; + getCompanyFavor(companyName: string): number; + getCompanyFavorGain(companyName: string): number; + checkFactionInvitations(): string[]; + joinFaction(name: string): boolean; + workForFaction(name: string, type: string): boolean; + getFactionRep(name: string): number; + getFactionFavor(name: string): number; + getFactionFavorGain(name: string): number; + donateToFaction(name: string, amt: number): boolean; + createProgram(name: string): boolean; + commitCrime(crimeRoughName: string): number; + getCrimeChance(crimeRoughName: string): boolean; + getCrimeStats(crimeRoughName: string): any; // complex type + getOwnedAugmentations(purchased: boolean): string[]; + getOwnedSourceFiles(): any; // complex type + getAugmentationsFromFaction(facname: string): string[]; + getAugmentationPrereq(name: string): string[]; + getAugmentationCost(name: string): number; + getAugmentationStats(name: string): any; // complex type + purchaseAugmentation(faction: string, name: string): boolean; + softReset(cbScript: string): void; + installAugmentations(cbScript: string): void; + exploit(): void; + bypass(doc: any): void; + flags(data: any): any; +}` \ No newline at end of file diff --git a/src/ScriptEditor/ui/Root.tsx b/src/ScriptEditor/ui/Root.tsx index 0733d33a3..fa275b9d1 100644 --- a/src/ScriptEditor/ui/Root.tsx +++ b/src/ScriptEditor/ui/Root.tsx @@ -19,7 +19,7 @@ import { calculateRamUsage } from "../../Script/RamCalculations"; import { RamCalculationErrorCode } from "../../Script/RamCalculationErrorCodes"; import { numeralWrapper } from "../../ui/numeralFormat"; import { CursorPositions } from "../../ScriptEditor/CursorPositions"; -import * as NetscriptDefinitions from "../NetscriptDefinitions"; +import { libSource } from "../NetscriptDefinitions"; interface IProps { filename: string; @@ -202,24 +202,8 @@ export function Root(props: IProps): React.ReactElement { } function beforeMount(monaco: any): void { - - // extra libraries - const libSource = ` -export declare function upgradeHomeRam(): number; -export declare function getUpgradeHomeRamCost(): number; -export declare function workForCompany(companyName: string): boolean; -export declare function applyToCompany(companyName: string, field: string): boolean; -export declare function getCompanyRep(companyName: string): number; -export declare function getCompanyFavor(companyName: string): number; -export declare function getCompanyFavorGain(companyName: string): number; -export declare function checkFactionInvitations(): string[]; -export declare function joinFaction(name: string): boolean; -export declare function workForFaction(name: string, type: string): boolean; -export declare function getFactionRep(name: string): number; -export declare function getFactionFavor(name: string): number;`; - - monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource); - monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource); + monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, 'netscript.d.ts'); + monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource, 'netscript.d.ts'); } return (
@@ -233,7 +217,7 @@ export declare function getFactionFavor(name: string): number;`; onMount={onMount} loading={

Loading script editor!

} height="80%" - defaultLanguage="javascript" + defaultLanguage="typescript" defaultValue={code} value={code} onChange={updateCode} From f02c6443cca7586e6394ca1f8956b4f5da014297 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 17:14:20 -0400 Subject: [PATCH 11/12] ok figured out how to make the javascript autocomplete. --- src/ScriptEditor/NetscriptDefinitions.ts | 8 ++++++++ src/ScriptEditor/ui/Root.tsx | 21 ++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.ts b/src/ScriptEditor/NetscriptDefinitions.ts index 9450fc1f1..8220487c5 100644 --- a/src/ScriptEditor/NetscriptDefinitions.ts +++ b/src/ScriptEditor/NetscriptDefinitions.ts @@ -1,6 +1,14 @@ export const libSource = `interface NS { args: string[]; /** + * Example documentation for scan. + * Example documentation for scan. + * Example documentation for scan. + * Example documentation for scan. + * Example documentation for scan. + * Example documentation for scan. + * Example documentation for scan. + * Example documentation for scan. * Example documentation for scan. */ scan(ip: string, hostnames: boolean): string[]; diff --git a/src/ScriptEditor/ui/Root.tsx b/src/ScriptEditor/ui/Root.tsx index fa275b9d1..1fcda2855 100644 --- a/src/ScriptEditor/ui/Root.tsx +++ b/src/ScriptEditor/ui/Root.tsx @@ -202,6 +202,25 @@ export function Root(props: IProps): React.ReactElement { } function beforeMount(monaco: any): void { + monaco.languages.registerCompletionItemProvider('javascript', { + provideCompletionItems: () => { + return { suggestions: [ + { + label: 'upgradeHomeRam', + kind: monaco.languages.CompletionItemKind.Function, + insertText: 'upgradeHomeRam()', + documentation: 'Hello javascript documentation', + }, + { + label: 'connect', + kind: monaco.languages.CompletionItemKind.Function, + insertText: 'connect(${1:server})', + insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet, + documentation: 'Hello javascript documentation', + }, + ] }; + } + }); monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, 'netscript.d.ts'); monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource, 'netscript.d.ts'); } @@ -217,7 +236,7 @@ export function Root(props: IProps): React.ReactElement { onMount={onMount} loading={

Loading script editor!

} height="80%" - defaultLanguage="typescript" + defaultLanguage="javascript" defaultValue={code} value={code} onChange={updateCode} From 5aa24f22c4c005e2b613e0675bcb31994df0c874 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sat, 21 Aug 2021 00:17:26 -0400 Subject: [PATCH 12/12] final changes for monac --- css/scripteditor.scss | 34 +- dist/engine.bundle.js | 4 +- dist/engineStyle.bundle.js | 2 +- dist/engineStyle.css | 32 +- dist/vendor.bundle.js | 83 +- dist/vendor.css | 5536 -------------------------- index.html | 15 +- src/NetscriptFunctions.d.ts | 2 + src/SaveObject.jsx | 1 + src/ScriptEditor/ui/Options.ts | 1 + src/ScriptEditor/ui/OptionsPopup.tsx | 38 +- src/ScriptEditor/ui/Root.tsx | 69 +- src/Settings/Settings.ts | 62 +- 13 files changed, 134 insertions(+), 5745 deletions(-) create mode 100644 src/NetscriptFunctions.d.ts diff --git a/css/scripteditor.scss b/css/scripteditor.scss index 1fe1412fe..ce3add27e 100644 --- a/css/scripteditor.scss +++ b/css/scripteditor.scss @@ -9,19 +9,6 @@ background-color: transparent; } -#ace-editor { - margin: 10px; - height: 80%; - width: 100%; - margin-left: 6px; - padding-left: 6px; - padding-top: 6px; - padding-bottom: 6px; - border: 2px solid var(--my-highlight-color); - z-index: 1; - font-family: $fontFamily; -} - /* This temp element is used for auto adjusting filename field */ .tmp-element { visibility: hidden; @@ -107,17 +94,14 @@ } } -/* Specific overrides for Ace Editor */ -.ace_line, -.ace_line * { - background-color: transparent; - margin: 0; - padding: 0; +.editor-options-container { + display: flex; + flex-flow: column; } -.ace_text-input { - font-size: $defaultFontSize; - background-color: transparent; -} - -/* Specified overrides for Code mirror Editor are defined in codemirror-override.scss */ +.editor-options-line { + display: flex; + flex: row nowrap; + align-items: center; + justify-content: start; +} \ No newline at end of file diff --git a/dist/engine.bundle.js b/dist/engine.bundle.js index 75b7b4503..b5de4f340 100644 --- a/dist/engine.bundle.js +++ b/dist/engine.bundle.js @@ -1,4 +1,4 @@ -!function(e){function t(t){for(var a,o,s=t[0],l=t[1],c=t[2],m=0,p=[];m${e}`;r.getElementById("terminal-input").insertAdjacentHTML("beforebegin",a),function(){const e=r.getElementById("terminal-container");e.scrollTop=e.scrollHeight}()}t.post=function(e){i(e)},t.postError=function(e){i(`ERROR: ${e}`,{color:"#ff2929"})},t.hackProgressBarPost=function(e){i(e,{id:"hack-progress-bar"})},t.hackProgressPost=function(e){i(e,{id:"hack-progress"})},t.postElement=function(e){i(a.renderToStaticMarkup(e))},t.postContent=i},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRamCost=t.RamCosts=t.RamCostConstants=void 0,t.RamCostConstants={ScriptBaseRamCost:1.6,ScriptDomRamCost:25,ScriptHackRamCost:.1,ScriptHackAnalyzeRamCost:1,ScriptGrowRamCost:.15,ScriptGrowthAnalyzeRamCost:1,ScriptWeakenRamCost:.15,ScriptScanRamCost:.2,ScriptPortProgramRamCost:.05,ScriptRunRamCost:1,ScriptExecRamCost:1.3,ScriptSpawnRamCost:2,ScriptScpRamCost:.6,ScriptKillRamCost:.5,ScriptHasRootAccessRamCost:.05,ScriptGetHostnameRamCost:.05,ScriptGetHackingLevelRamCost:.05,ScriptGetMultipliersRamCost:4,ScriptGetServerRamCost:.1,ScriptGetServerMaxRam:.05,ScriptGetServerUsedRam:.05,ScriptFileExistsRamCost:.1,ScriptIsRunningRamCost:.1,ScriptHacknetNodesRamCost:4,ScriptHNUpgLevelRamCost:.4,ScriptHNUpgRamRamCost:.6,ScriptHNUpgCoreRamCost:.8,ScriptGetStockRamCost:2,ScriptBuySellStockRamCost:2.5,ScriptGetPurchaseServerRamCost:.25,ScriptPurchaseServerRamCost:2.25,ScriptGetPurchasedServerLimit:.05,ScriptGetPurchasedServerMaxRam:.05,ScriptRoundRamCost:.05,ScriptReadWriteRamCost:1,ScriptArbScriptRamCost:1,ScriptGetScriptRamCost:.1,ScriptGetRunningScriptRamCost:.3,ScriptGetHackTimeRamCost:.05,ScriptGetFavorToDonate:.1,ScriptCodingContractBaseRamCost:10,ScriptSleeveBaseRamCost:4,ScriptSingularityFn1RamCost:2,ScriptSingularityFn2RamCost:3,ScriptSingularityFn3RamCost:5,ScriptGangApiBaseRamCost:4,ScriptBladeburnerApiBaseRamCost:4},t.RamCosts={hacknet:{numNodes:()=>0,purchaseNode:()=>0,getPurchaseNodeCost:()=>0,getNodeStats:()=>0,upgradeLevel:()=>0,upgradeRam:()=>0,upgradeCore:()=>0,upgradeCache:()=>0,getLevelUpgradeCost:()=>0,getRamUpgradeCost:()=>0,getCoreUpgradeCost:()=>0,getCacheUpgradeCost:()=>0,numHashes:()=>0,hashCost:()=>0,spendHashes:()=>0},sprintf:()=>0,vsprintf:()=>0,scan:()=>t.RamCostConstants.ScriptScanRamCost,hack:()=>t.RamCostConstants.ScriptHackRamCost,hackAnalyzeThreads:()=>t.RamCostConstants.ScriptHackAnalyzeRamCost,hackAnalyzePercent:()=>t.RamCostConstants.ScriptHackAnalyzeRamCost,hackChance:()=>t.RamCostConstants.ScriptHackAnalyzeRamCost,sleep:()=>0,grow:()=>t.RamCostConstants.ScriptGrowRamCost,growthAnalyze:()=>t.RamCostConstants.ScriptGrowthAnalyzeRamCost,weaken:()=>t.RamCostConstants.ScriptWeakenRamCost,print:()=>0,tprint:()=>0,clearLog:()=>0,disableLog:()=>0,enableLog:()=>0,isLogEnabled:()=>0,getScriptLogs:()=>0,nuke:()=>t.RamCostConstants.ScriptPortProgramRamCost,brutessh:()=>t.RamCostConstants.ScriptPortProgramRamCost,ftpcrack:()=>t.RamCostConstants.ScriptPortProgramRamCost,relaysmtp:()=>t.RamCostConstants.ScriptPortProgramRamCost,httpworm:()=>t.RamCostConstants.ScriptPortProgramRamCost,sqlinject:()=>t.RamCostConstants.ScriptPortProgramRamCost,run:()=>t.RamCostConstants.ScriptRunRamCost,exec:()=>t.RamCostConstants.ScriptExecRamCost,spawn:()=>t.RamCostConstants.ScriptSpawnRamCost,kill:()=>t.RamCostConstants.ScriptKillRamCost,killall:()=>t.RamCostConstants.ScriptKillRamCost,exit:()=>0,scp:()=>t.RamCostConstants.ScriptScpRamCost,ls:()=>t.RamCostConstants.ScriptScanRamCost,ps:()=>t.RamCostConstants.ScriptScanRamCost,hasRootAccess:()=>t.RamCostConstants.ScriptHasRootAccessRamCost,getIp:()=>t.RamCostConstants.ScriptGetHostnameRamCost,getHostname:()=>t.RamCostConstants.ScriptGetHostnameRamCost,getHackingLevel:()=>t.RamCostConstants.ScriptGetHackingLevelRamCost,getHackingMultipliers:()=>t.RamCostConstants.ScriptGetMultipliersRamCost,getHacknetMultipliers:()=>t.RamCostConstants.ScriptGetMultipliersRamCost,getBitNodeMultipliers:()=>t.RamCostConstants.ScriptGetMultipliersRamCost,getServer:()=>t.RamCostConstants.ScriptGetMultipliersRamCost/2,getServerMoneyAvailable:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerSecurityLevel:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerBaseSecurityLevel:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerMinSecurityLevel:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerRequiredHackingLevel:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerMaxMoney:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerGrowth:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerNumPortsRequired:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerRam:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerMaxRam:()=>t.RamCostConstants.ScriptGetServerMaxRam,getServerUsedRam:()=>t.RamCostConstants.ScriptGetServerUsedRam,serverExists:()=>t.RamCostConstants.ScriptGetServerRamCost,fileExists:()=>t.RamCostConstants.ScriptFileExistsRamCost,isRunning:()=>t.RamCostConstants.ScriptIsRunningRamCost,getStockSymbols:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockPrice:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockAskPrice:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockBidPrice:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockPosition:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockMaxShares:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockPurchaseCost:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockSaleGain:()=>t.RamCostConstants.ScriptGetStockRamCost,buyStock:()=>t.RamCostConstants.ScriptBuySellStockRamCost,sellStock:()=>t.RamCostConstants.ScriptBuySellStockRamCost,shortStock:()=>t.RamCostConstants.ScriptBuySellStockRamCost,sellShort:()=>t.RamCostConstants.ScriptBuySellStockRamCost,placeOrder:()=>t.RamCostConstants.ScriptBuySellStockRamCost,cancelOrder:()=>t.RamCostConstants.ScriptBuySellStockRamCost,getOrders:()=>t.RamCostConstants.ScriptBuySellStockRamCost,getStockVolatility:()=>t.RamCostConstants.ScriptBuySellStockRamCost,getStockForecast:()=>t.RamCostConstants.ScriptBuySellStockRamCost,purchase4SMarketData:()=>t.RamCostConstants.ScriptBuySellStockRamCost,purchase4SMarketDataTixApi:()=>t.RamCostConstants.ScriptBuySellStockRamCost,getPurchasedServerLimit:()=>t.RamCostConstants.ScriptGetPurchasedServerLimit,getPurchasedServerMaxRam:()=>t.RamCostConstants.ScriptGetPurchasedServerMaxRam,getPurchasedServerCost:()=>t.RamCostConstants.ScriptGetPurchaseServerRamCost,purchaseServer:()=>t.RamCostConstants.ScriptPurchaseServerRamCost,deleteServer:()=>t.RamCostConstants.ScriptPurchaseServerRamCost,getPurchasedServers:()=>t.RamCostConstants.ScriptPurchaseServerRamCost,write:()=>t.RamCostConstants.ScriptReadWriteRamCost,tryWrite:()=>t.RamCostConstants.ScriptReadWriteRamCost,read:()=>t.RamCostConstants.ScriptReadWriteRamCost,peek:()=>t.RamCostConstants.ScriptReadWriteRamCost,clear:()=>t.RamCostConstants.ScriptReadWriteRamCost,getPortHandle:()=>10*t.RamCostConstants.ScriptReadWriteRamCost,rm:()=>t.RamCostConstants.ScriptReadWriteRamCost,scriptRunning:()=>t.RamCostConstants.ScriptArbScriptRamCost,scriptKill:()=>t.RamCostConstants.ScriptArbScriptRamCost,getScriptName:()=>0,getScriptRam:()=>t.RamCostConstants.ScriptGetScriptRamCost,getHackTime:()=>t.RamCostConstants.ScriptGetHackTimeRamCost,getGrowTime:()=>t.RamCostConstants.ScriptGetHackTimeRamCost,getWeakenTime:()=>t.RamCostConstants.ScriptGetHackTimeRamCost,getScriptIncome:()=>t.RamCostConstants.ScriptGetScriptRamCost,getScriptExpGain:()=>t.RamCostConstants.ScriptGetScriptRamCost,getRunningScript:()=>t.RamCostConstants.ScriptGetRunningScriptRamCost,nFormat:()=>0,getTimeSinceLastAug:()=>t.RamCostConstants.ScriptGetHackTimeRamCost,prompt:()=>0,wget:()=>0,getFavorToDonate:()=>t.RamCostConstants.ScriptGetFavorToDonate,universityCourse:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,gymWorkout:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,travelToCity:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,purchaseTor:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,purchaseProgram:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,getCurrentServer:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,connect:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,manualHack:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,installBackdoor:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,getStats:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/4,getCharacterInformation:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/4,getPlayer:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/4,hospitalize:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/4,isBusy:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/4,stopAction:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/2,upgradeHomeRam:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,getUpgradeHomeRamCost:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/2,workForCompany:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,applyToCompany:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,getCompanyRep:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/3,getCompanyFavor:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/3,getCompanyFavorGain:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/4,checkFactionInvitations:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,joinFaction:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,workForFaction:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,getFactionRep:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/3,getFactionFavor:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/3,getFactionFavorGain:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/4,donateToFaction:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,createProgram:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,commitCrime:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getCrimeChance:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getCrimeStats:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getOwnedAugmentations:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getOwnedSourceFiles:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getAugmentationsFromFaction:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getAugmentationPrereq:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getAugmentationCost:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getAugmentationStats:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,purchaseAugmentation:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,softReset:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,installAugmentations:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,gang:{createGang:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,inGang:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,getMemberNames:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,getGangInformation:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getOtherGangInformation:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getMemberInformation:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,canRecruitMember:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,recruitMember:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getTaskNames:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,getTaskStats:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,setMemberTask:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getEquipmentNames:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,getEquipmentCost:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getEquipmentType:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getEquipmentStats:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,purchaseEquipment:()=>t.RamCostConstants.ScriptGangApiBaseRamCost,ascendMember:()=>t.RamCostConstants.ScriptGangApiBaseRamCost,setTerritoryWarfare:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getChanceToWinClash:()=>t.RamCostConstants.ScriptGangApiBaseRamCost,getBonusTime:()=>0},bladeburner:{getContractNames:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/10,getOperationNames:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/10,getBlackOpNames:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/10,getBlackOpRank:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/2,getGeneralActionNames:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/10,getSkillNames:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/10,startAction:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,stopBladeburnerAction:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/2,getCurrentAction:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/4,getActionTime:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionEstimatedSuccessChance:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionRepGain:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionCountRemaining:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionMaxLevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionCurrentLevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionAutolevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,setActionAutolevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,setActionLevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getRank:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getSkillPoints:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getSkillLevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getSkillUpgradeCost:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,upgradeSkill:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getTeamSize:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,setTeamSize:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getCityEstimatedPopulation:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getCityEstimatedCommunities:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getCityChaos:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getCity:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,switchCity:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getStamina:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,joinBladeburnerFaction:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,joinBladeburnerDivision:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getBonusTime:()=>0},codingcontract:{attempt:()=>t.RamCostConstants.ScriptCodingContractBaseRamCost,getContractType:()=>t.RamCostConstants.ScriptCodingContractBaseRamCost/2,getData:()=>t.RamCostConstants.ScriptCodingContractBaseRamCost/2,getDescription:()=>t.RamCostConstants.ScriptCodingContractBaseRamCost/2,getNumTriesRemaining:()=>t.RamCostConstants.ScriptCodingContractBaseRamCost/5},sleeve:{getNumSleeves:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToShockRecovery:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToSynchronize:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToCommitCrime:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToUniversityCourse:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,travel:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToCompanyWork:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToFactionWork:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToGymWorkout:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,getSleeveStats:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,getTask:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,getInformation:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,getSleeveAugmentations:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,getSleevePurchasableAugs:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,purchaseSleeveAug:()=>t.RamCostConstants.ScriptSleeveBaseRamCost},heart:{break:()=>0}},t.getRamCost=function(...e){if(0===e.length)return console.warn("No arguments passed to getRamCost()"),0;let n=t.RamCosts[e[0]];for(let t=1;t
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 within the time limit. If you fail to do this, you will lose.

Each Node has three stats: Attack, Defense, and HP. There are five different actions that a Node can take:

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.

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.

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.

Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.

Overflow - Raises the Node's Attack but lowers its Defense. The effectiveness is determined by your hacking level.

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.

To capture a Node, you must lower its HP down to 0.

There are six different types of Nodes:

CPU Core - These are your main Nodes that are used to perform actions. Capable of performing every action

Firewall - Nodes with high defense. These Nodes can 'Fortify'

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

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

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

Shield - Nodes with high defense. These Nodes can 'Fortify'

To assign an action to a Node, you must first select one of your Nodes. This can be done by simply clicking on it. Double-clicking a node will select all of your Nodes of the same type (e.g. select all CPU Core Nodes or all Transfer Nodes). Note that only Nodes that can perform actions (CPU Core, Transfer, Shield, Firewall) can be selected. Selected Nodes will be denoted with a white highlight. After selecting a Node or multiple Nodes, select its action using the Action Buttons near the top of the screen. Every action also has a corresponding keyboard shortcut.

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 target any Node that is 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 the related 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'.

Other Notes:

-Whenever a miscellenaous Node (not owned by the player or enemy) is conquered, the defense of all remaining miscellaneous Nodes that are not actively being targeted will increase by a fixed percentage.

-Whenever a Node is conquered, its stats are significantly reduced

-Miscellaneous Nodes slowly raise their defense over time

-Nodes slowly regenerate health over time.",MillisecondsPer20Hours:72e6,GameCyclesPer20Hours:36e4,MillisecondsPer10Hours:36e6,GameCyclesPer10Hours:18e4,MillisecondsPer8Hours:288e5,GameCyclesPer8Hours:144e3,MillisecondsPer4Hours:144e5,GameCyclesPer4Hours:72e3,MillisecondsPer2Hours:72e5,GameCyclesPer2Hours:36e3,MillisecondsPerHour:36e5,GameCyclesPerHour:18e3,MillisecondsPerHalfHour:18e5,GameCyclesPerHalfHour:9e3,MillisecondsPerQuarterHour:9e5,GameCyclesPerQuarterHour:4500,MillisecondsPerFiveMinutes:3e5,GameCyclesPerFiveMinutes:1500,FactionWorkHacking:"Faction Hacking Work",FactionWorkField:"Faction Field Work",FactionWorkSecurity:"Faction Security Work",WorkTypeCompany:"Working for Company",WorkTypeCompanyPartTime:"Working for Company part-time",WorkTypeFaction:"Working for Faction",WorkTypeCreateProgram:"Working on Create a Program",WorkTypeStudyClass:"Studying or Taking a class at university",WorkTypeCrime:"Committing a crime",ClassStudyComputerScience:"studying Computer Science",ClassDataStructures:"taking a Data Structures course",ClassNetworks:"taking a Networks course",ClassAlgorithms:"taking an Algorithms course",ClassManagement:"taking a Management course",ClassLeadership:"taking a Leadership course",ClassGymStrength:"training your strength at a gym",ClassGymDefense:"training your defense at a gym",ClassGymDexterity:"training your dexterity at a gym",ClassGymAgility:"training your agility at a gym",ClassDataStructuresBaseCost:40,ClassNetworksBaseCost:80,ClassAlgorithmsBaseCost:320,ClassManagementBaseCost:160,ClassLeadershipBaseCost:320,ClassGymBaseCost:120,ClassStudyComputerScienceBaseExp:.5,ClassDataStructuresBaseExp:1,ClassNetworksBaseExp:2,ClassAlgorithmsBaseExp:4,ClassManagementBaseExp:2,ClassLeadershipBaseExp:4,CrimeShoplift:"shoplift",CrimeRobStore:"rob a store",CrimeMug:"mug someone",CrimeLarceny:"commit larceny",CrimeDrugs:"deal drugs",CrimeBondForgery:"forge corporate bonds",CrimeTraffickArms:"traffick illegal arms",CrimeHomicide:"commit homicide",CrimeGrandTheftAuto:"commit grand theft auto",CrimeKidnap:"kidnap someone for ransom",CrimeAssassination:"assassinate a high-profile target",CrimeHeist:"pull off the ultimate heist",CodingContractBaseFactionRepGain:2500,CodingContractBaseCompanyRepGain:4e3,CodingContractBaseMoneyGain:75e6,TotalNumBitNodes:24,LatestUpdate:"\n v0.52.5 - 2021-07-19 CPU cores are useful!? (hydroflame)\n -------------------------------------------\n\n ** Terminal ** \n\n * When executing 'run SCRIPT' any script can now add '--tail' to\n automatically bring up the logs.\n\n ** Netscript ** \n\n * The 'flags' function now works with single letter flags but they only take\n one dash.\n * Fix several broken bladeburner netscript functions.\n * Fix gang.getMemberInformation returning inconsistent data after the gang\n rework.\n\n ** CPU Cores **\n\n * CPU Cores on the home computer now provide a bonus to grow() money gain\n and makes weaken lower more security. Only for scripts running on 'home'\n\n ** Misc. **\n\n * Fix weird scrolling in the new Bladeburner React console.\n * nerf noodle bar\n"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.dialogBoxCreate=t.MessagePopup=void 0;const r=n(103),i=n(36),o=a(n(0));function s(e){return o.default.createElement(o.default.Fragment,null,e.content)}t.MessagePopup=s,t.dialogBoxCreate=function(e,t=!1){const n="popup-"+Array.from(Array(16)).map(()=>`${i.getRandomInt(0,9)}`).join("");"string"==typeof e?t?r.createPopup(n,s,{content:o.default.createElement("pre",{dangerouslySetInnerHTML:{__html:e}})}):r.createPopup(n,s,{content:o.default.createElement("p",{dangerouslySetInnerHTML:{__html:e.replace(/(?:\r\n|\r|\n)/g,"
")}})}):r.createPopup(n,s,{content:e})}},function(e,t,n){"use strict";function a(e,t={}){const n=document.createElement(e);return void 0!==t.id&&(n.id=t.id),void 0!==t.class&&(n.className=t.class),void 0!==t.innerHTML&&(n.innerHTML=t.innerHTML),void 0!==t.innerText&&(n.innerText=t.innerText),void 0!==t.tabIndex&&(n.tabIndex=t.tabIndex),function(e,t){void 0!==t.text&&(e.text=t.text),void 0!==t.href&&(e.href=t.href),void 0!==t.target&&(e.target=t.target)}(n,t),function(e,t){void 0!==t.name&&(e.name=t.name),void 0!==t.value&&(e.value=t.value),void 0!==t.type&&(e.type=t.type),void 0!==t.checked&&(e.checked=t.checked),void 0!==t.pattern&&(e.pattern=t.pattern),void 0!==t.maxLength&&(e.maxLength=t.maxLength),void 0!==t.placeholder&&(e.placeholder=t.placeholder),void 0!==t.max&&(e.max=t.max),void 0!==t.min&&(e.min=t.min),void 0!==t.step&&(e.step=t.step)}(n,t),function(e,t){void 0!==t.for&&(e.htmlFor=t.for)}(n,t),function(e,t){void 0!==t.clickListener&&e.addEventListener("click",t.clickListener),void 0!==t.inputListener&&e.addEventListener("input",t.inputListener),void 0!==t.changeListener&&e.addEventListener("change",t.changeListener),void 0!==t.onkeyup&&e.addEventListener("keyup",t.onkeyup),void 0!==t.onkeydown&&e.addEventListener("keydown",t.onkeydown),void 0!==t.onfocus&&e.addEventListener("focus",t.onfocus)}(n,t),function(e,t){void 0!==t.display&&(e.style.display=t.display),void 0!==t.visibility&&(e.style.visibility=t.visibility),void 0!==t.margin&&(e.style.margin=t.margin),void 0!==t.marginLeft&&(e.style.marginLeft=t.marginLeft),void 0!==t.marginTop&&(e.style.marginTop=t.marginTop),void 0!==t.padding&&(e.style.padding=t.padding),void 0!==t.color&&(e.style.color=t.color),void 0!==t.border&&(e.style.border=t.border),void 0!==t.float&&(e.style.cssFloat=t.float),void 0!==t.fontSize&&(e.style.fontSize=t.fontSize),void 0!==t.whiteSpace&&(e.style.whiteSpace=t.whiteSpace),void 0!==t.width&&(e.style.width=t.width),void 0!==t.height&&(e.style.height=t.height),void 0!==t.top&&(e.style.top=t.top),void 0!==t.left&&(e.style.left=t.left),void 0!==t.backgroundColor&&(e.style.backgroundColor=t.backgroundColor),void 0!==t.position&&(e.style.position=t.position),void 0!==t.overflow&&(e.style.overflow=t.overflow)}(n,t),function(e,t){void 0!==t.tooltip&&""!==t.tooltip?(e.className+=" tooltip",e.appendChild(a("span",{class:"tooltiptext",innerHTML:t.tooltip}))):void 0!==t.tooltipleft?(e.className+=" tooltip",e.appendChild(a("span",{class:"tooltiptextleft",innerHTML:t.tooltipleft}))):void 0!==t.tooltipsmall?(e.className+=" tooltip",e.appendChild(a("span",{class:"tooltiptext smallfont",innerHTML:t.tooltipsmall}))):void 0!==t.tooltiplow&&(e.className+="tooltip",e.appendChild(a("span",{class:"tooltiptextlow",innerHTML:t.tooltiplow})))}(n,t),n}Object.defineProperty(t,"__esModule",{value:!0}),t.createElement=void 0,t.createElement=a},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Augmentations=void 0,t.Augmentations={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Settings=void 0;const a=n(64),r={AutosaveInterval:60,CodeInstructionRunTime:50,DisableASCIIArt:!1,DisableHotkeys:!1,DisableTextEffects:!1,Locale:"en",MaxLogCapacity:50,MaxPortCapacity:50,SuppressBuyAugmentationConfirmation:!1,SuppressFactionInvites:!1,SuppressHospitalizationPopup:!1,SuppressMessages:!1,SuppressTravelConfirmation:!1,SuppressBladeburnerPopup:!1};t.Settings={AutosaveInterval:r.AutosaveInterval,CodeInstructionRunTime:25,DisableASCIIArt:r.DisableASCIIArt,DisableHotkeys:r.DisableHotkeys,DisableTextEffects:r.DisableTextEffects,Editor:a.EditorSetting.CodeMirror,EditorKeybinding:a.CodeMirrorKeybindingSetting.Default,EditorTheme:"Monokai",Locale:"en",MaxLogCapacity:r.MaxLogCapacity,MaxPortCapacity:r.MaxPortCapacity,OwnedAugmentationsOrder:a.OwnedAugmentationsOrderSetting.AcquirementTime,PurchaseAugmentationsOrder:a.PurchaseAugmentationsOrderSetting.Default,SuppressBuyAugmentationConfirmation:r.SuppressBuyAugmentationConfirmation,SuppressFactionInvites:r.SuppressFactionInvites,SuppressHospitalizationPopup:r.SuppressHospitalizationPopup,SuppressMessages:r.SuppressMessages,SuppressTravelConfirmation:r.SuppressTravelConfirmation,SuppressBladeburnerPopup:r.SuppressBladeburnerPopup,EditorHighlightActiveLine:!0,EditorShowInvisibles:!1,EditorUseSoftTab:!0,EditorAutoCloseBrackets:!0,EditorEnableLinting:!0,EditorContinueComments:!0,init(){Object.assign(t.Settings,r)},load(e){Object.assign(t.Settings,JSON.parse(e))}}},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"Engine",function(){return de}),n.d(t,"indexedDb",function(){return indexedDb});var a=n(21),r=(n(146),n(14)),i=n(86),o=n(4),s=n(133),l=n(101),c=n(744),u=n(448),m=n(177),p=n(34),d=n(41),h=n(10),_=n(525),g=n(18),f=n(79),y=n(743),b=n(742),E=n(741),v=n(740),k=n(116),C=n(46),P=n(28),S=n(49),O=n(47),M=n(456),T=n(95),x=n(89),w=n(118),A=n(88),R=n(1),N=n(173),D=n(307),B=n(110),I=n(120),L=n(87),W=n(23),j=n(15),F=n(43),U=n(45),H=n(53),G=n(692),K=n(81),q=n(179),$=n(453),z=n(520),Y=n(149),V=n(691),J=n(19),X=n(690),Q=n(31),Z=n(132),ee=n(67),te=n(519),ne=n(689),ae=n(33),re=n(11),ie=n(306),oe=n(92),se=n(518),le=n(44),ce=(n(857),n(856),n(0)),ue=n.n(ce),me=n(24),pe=n.n(me);e(document).keydown(function(e){if(!0!==j.Settings.DisableHotkeys){try{if(Object(L.c)().isFocused())return}catch(e){}if(!(R.Player.isWorking||B.redPillFlag||x.c||u.a))if(e.keyCode==le.KEY.T&&e.altKey)e.preventDefault(),de.loadTerminalContent();else if(e.keyCode===le.KEY.C&&e.altKey)e.preventDefault(),de.loadCharacterContent();else if(e.keyCode===le.KEY.E&&e.altKey)e.preventDefault(),de.loadScriptEditorContent();else if(e.keyCode===le.KEY.S&&e.altKey)e.preventDefault(),de.loadActiveScriptsContent();else if(e.keyCode===le.KEY.H&&e.altKey)e.preventDefault(),de.loadHacknetNodesContent();else if(e.keyCode===le.KEY.W&&e.altKey)e.preventDefault(),de.loadLocationContent();else if(e.keyCode===le.KEY.J&&e.altKey)e.preventDefault(),de.loadJobContent();else if(e.keyCode===le.KEY.R&&e.altKey)e.preventDefault(),de.loadTravelContent();else if(e.keyCode===le.KEY.P&&e.altKey)e.preventDefault(),de.loadCreateProgramContent();else if(e.keyCode===le.KEY.F&&e.altKey){if(J.routing.isOn(J.Page.Terminal)&&C.FconfSettings.ENABLE_BASH_HOTKEYS)return;e.preventDefault(),de.loadFactionsContent()}else e.keyCode===le.KEY.A&&e.altKey?(e.preventDefault(),de.loadAugmentationsContent()):e.keyCode===le.KEY.U&&e.altKey?(e.preventDefault(),de.loadTutorialContent()):e.keyCode===le.KEY.B&&e.altKey?(e.preventDefault(),de.loadBladeburnerContent()):e.keyCode===le.KEY.G&&e.altKey&&(e.preventDefault(),de.loadGangContent());e.keyCode===le.KEY.O&&e.altKey&&(e.preventDefault(),Object(ie.b)())}});const de={Clickables:{saveMainMenuButton:null,deleteMainMenuButton:null},Display:{terminalContent:null,characterContent:null,scriptEditorContent:null,activeScriptsContent:null,hacknetNodesContent:null,createProgramContent:null,factionsContent:null,factionContent:null,augmentationsContent:null,milestonesContent:null,tutorialContent:null,infiltrationContent:null,stockMarketContent:null,gangContent:null,bladeburnerContent:null,locationContent:null,workInProgressContent:null,redPillContent:null,cinematicTextContent:null,missionContent:null,characterInfo:null},indexedDb:void 0,_lastUpdate:(new Date).getTime(),_idleSpeed:200,loadTerminalContent:function(){de.hideAllContent(),de.Display.terminalContent.style.display="block",J.routing.navigateTo(J.Page.Terminal),ae.MainMenuLinks.Terminal.classList.add("active")},loadCharacterContent:function(){de.hideAllContent(),de.Display.characterContent.style.display="block",de.updateCharacterInfo(),J.routing.navigateTo(J.Page.CharacterInfo),ae.MainMenuLinks.Stats.classList.add("active")},loadScriptEditorContent:function(e="",t=""){de.hideAllContent(),de.Display.scriptEditorContent.style.display="block";try{Object(L.c)().openScript(e,t)}catch(e){Object(oe.exceptionAlert)(e)}Object(L.f)(),J.routing.navigateTo(J.Page.ScriptEditor),ae.MainMenuLinks.ScriptEditor.classList.add("active")},loadActiveScriptsContent:function(){de.hideAllContent(),de.Display.activeScriptsContent.style.display="block",J.routing.navigateTo(J.Page.ActiveScripts),pe.a.render(ue.a.createElement(te.ActiveScriptsRoot,{p:R.Player,workerScripts:w.workerScripts}),de.Display.activeScriptsContent),ae.MainMenuLinks.ActiveScripts.classList.add("active")},loadHacknetNodesContent:function(){de.hideAllContent(),de.Display.hacknetNodesContent.style.display="block",J.routing.navigateTo(J.Page.HacknetNodes),Object(P.q)(),ae.MainMenuLinks.HacknetNodes.classList.add("active")},loadCreateProgramContent:function(){de.hideAllContent(),de.Display.createProgramContent.style.display="block",Object(D.a)(),J.routing.navigateTo(J.Page.CreateProgram),ae.MainMenuLinks.CreateProgram.classList.add("active")},loadFactionsContent:function(){de.hideAllContent(),de.Display.factionsContent.style.display="block",J.routing.navigateTo(J.Page.Factions),pe.a.render(ue.a.createElement(y.FactionList,{player:R.Player,engine:this}),de.Display.factionsContent),ae.MainMenuLinks.Factions.classList.add("active")},loadFactionContent:function(){de.hideAllContent(),de.Display.factionContent.style.display="block",J.routing.navigateTo(J.Page.Faction)},loadAugmentationsContent:function(){de.hideAllContent(),de.Display.augmentationsContent.style.display="block",J.routing.navigateTo(J.Page.Augmentations),Object(i.c)(de.Display.augmentationsContent),ae.MainMenuLinks.Augmentations.classList.add("active")},loadMilestonesContent:function(){de.hideAllContent(),de.Display.milestonesContent.style.display="block",J.routing.navigateTo(J.Page.Milestones),Object(G.displayMilestonesContent)(),ae.MainMenuLinks.Milestones.classList.add("active")},loadTutorialContent:function(){de.hideAllContent(),de.Display.tutorialContent.style.display="block",J.routing.navigateTo(J.Page.Tutorial),ae.MainMenuLinks.Tutorial.classList.add("active")},loadDevMenuContent:function(){de.hideAllContent(),Object(_.b)(),J.routing.navigateTo(J.Page.DevMenu),ae.MainMenuLinks.DevMenu.classList.add("active")},loadLocationContent:function(e=!0){de.hideAllContent(),de.Display.locationContent.style.display="block",ae.MainMenuLinks.City.classList.add("active"),J.routing.navigateTo(J.Page.Location);const t=ue.a.createElement(M.LocationRoot,{initiallyInCity:e,engine:de,p:R.Player});pe.a.render(t,de.Display.locationContent)},loadTravelContent:function(){de.hideAllContent(),R.Player.gotoLocation(O.LocationName.TravelAgency),de.Display.locationContent.style.display="block",ae.MainMenuLinks.Travel.classList.add("active"),J.routing.navigateTo(J.Page.Location);const e=ue.a.createElement(M.LocationRoot,{initiallyInCity:!1,engine:de,p:R.Player});pe.a.render(e,de.Display.locationContent)},loadJobContent:function(){if(""==R.Player.companyName)return void Object(re.dialogBoxCreate)("You do not currently have a job! You can visit various companies in the city and try to find a job.");de.hideAllContent(),R.Player.gotoLocation(R.Player.companyName),de.Display.locationContent.style.display="block",ae.MainMenuLinks.Job.classList.add("active"),J.routing.navigateTo(J.Page.Location);const e=ue.a.createElement(M.LocationRoot,{initiallyInCity:!1,engine:de,p:R.Player});pe.a.render(e,de.Display.locationContent)},loadWorkInProgressContent:function(){de.hideAllContent(),document.getElementById("mainmenu-container").style.visibility="hidden",de.Display.workInProgressContent.style.display="block",J.routing.navigateTo(J.Page.WorkInProgress)},loadRedPillContent:function(){de.hideAllContent(),document.getElementById("mainmenu-container").style.visibility="hidden",de.Display.redPillContent.style.display="block",J.routing.navigateTo(J.Page.RedPill)},loadCinematicTextContent:function(){de.hideAllContent(),document.getElementById("mainmenu-container").style.visibility="hidden",de.Display.cinematicTextContent.style.display="block",J.routing.navigateTo(J.Page.CinematicText)},loadInfiltrationContent:function(e,t,n){de.hideAllContent(),document.getElementById("mainmenu-container").style.visibility="hidden",de.Display.infiltrationContent.style.display="block",J.routing.navigateTo(J.Page.Infiltration),Object(v.displayInfiltrationContent)(this,R.Player,e,t,n)},loadStockMarketContent:function(){de.hideAllContent(),de.Display.stockMarketContent.style.display="block",J.routing.navigateTo(J.Page.StockMarket),Object(H.displayStockMarketContent)()},loadGangContent:function(){de.hideAllContent(),R.Player.inGang()?(de.Display.gangContent.style.display="block",J.routing.navigateTo(J.Page.Gang),Object(b.displayGangContent)(this,R.Player.gang,R.Player)):(de.loadTerminalContent(),J.routing.navigateTo(J.Page.Terminal))},loadMissionContent:function(){de.hideAllContent(),document.getElementById("mainmenu-container").style.visibility="hidden",document.getElementById("character-overview-wrapper").style.visibility="hidden",de.Display.missionContent.style.display="block",J.routing.navigateTo(J.Page.Mission)},loadCorporationContent:function(){R.Player.corporation instanceof d.c&&(de.hideAllContent(),J.routing.navigateTo(J.Page.Corporation),R.Player.corporation.createUI())},loadBladeburnerContent:function(){R.Player.bladeburner instanceof l.Bladeburner&&(de.hideAllContent(),J.routing.navigateTo(J.Page.Bladeburner),de.Display.bladeburnerContent.style.display="block",pe.a.render(ue.a.createElement(E.Root,{bladeburner:R.Player.bladeburner,player:R.Player,engine:this}),de.Display.bladeburnerContent),ae.MainMenuLinks.Bladeburner.classList.add("active"))},loadSleevesContent:function(){try{de.hideAllContent(),J.routing.navigateTo(J.Page.Sleeves),Object($.createSleevesPage)(R.Player)}catch(e){Object(oe.exceptionAlert)(e)}},loadResleevingContent:function(){try{de.hideAllContent(),J.routing.navigateTo(J.Page.Resleeves),Object(z.createResleevesPage)(R.Player)}catch(e){Object(oe.exceptionAlert)(e)}},hideAllContent:function(){de.Display.terminalContent.style.display="none",de.Display.characterContent.style.display="none",de.Display.scriptEditorContent.style.display="none",de.Display.activeScriptsContent.style.display="none",pe.a.unmountComponentAtNode(de.Display.activeScriptsContent),de.Display.infiltrationContent.style.display="none",pe.a.unmountComponentAtNode(de.Display.infiltrationContent),Object(P.a)(),de.Display.createProgramContent.style.display="none",de.Display.factionsContent.style.display="none",pe.a.unmountComponentAtNode(de.Display.factionsContent),de.Display.factionContent.style.display="none",pe.a.unmountComponentAtNode(de.Display.factionContent),de.Display.augmentationsContent.style.display="none",pe.a.unmountComponentAtNode(de.Display.augmentationsContent),de.Display.milestonesContent.style.display="none",de.Display.tutorialContent.style.display="none",de.Display.locationContent.style.display="none",pe.a.unmountComponentAtNode(de.Display.locationContent),de.Display.gangContent.style.display="none",pe.a.unmountComponentAtNode(de.Display.gangContent),de.Display.bladeburnerContent.style.display="none",pe.a.unmountComponentAtNode(de.Display.bladeburnerContent),de.Display.workInProgressContent.style.display="none",de.Display.redPillContent.style.display="none",de.Display.cinematicTextContent.style.display="none",de.Display.stockMarketContent.style.display="none",de.Display.missionContent.style.display="none",document.getElementById("gang-container")&&(document.getElementById("gang-container").style.display="none"),R.Player.corporation instanceof d.c&&R.Player.corporation.clearUI(),Object(z.clearResleevesPage)(),Object($.clearSleevesPage)(),de.inactivateMainMenuLinks(),Object(_.a)()},inactivateMainMenuLinks:function(){ae.MainMenuLinks.Terminal.classList.remove("active"),ae.MainMenuLinks.ScriptEditor.classList.remove("active"),ae.MainMenuLinks.ActiveScripts.classList.remove("active"),ae.MainMenuLinks.CreateProgram.classList.remove("active"),ae.MainMenuLinks.Stats.classList.remove("active"),ae.MainMenuLinks.Factions.classList.remove("active"),ae.MainMenuLinks.Augmentations.classList.remove("active"),ae.MainMenuLinks.HacknetNodes.classList.remove("active"),ae.MainMenuLinks.Sleeves.classList.remove("active"),ae.MainMenuLinks.City.classList.remove("active"),ae.MainMenuLinks.Travel.classList.remove("active"),ae.MainMenuLinks.Job.classList.remove("active"),ae.MainMenuLinks.StockMarket.classList.remove("active"),ae.MainMenuLinks.Gang.classList.remove("active"),ae.MainMenuLinks.Bladeburner.classList.remove("active"),ae.MainMenuLinks.Corporation.classList.remove("active"),ae.MainMenuLinks.Gang.classList.remove("active"),ae.MainMenuLinks.Milestones.classList.remove("active"),ae.MainMenuLinks.Tutorial.classList.remove("active"),ae.MainMenuLinks.Options.classList.remove("active"),ae.MainMenuLinks.DevMenu.classList.remove("active")},displayCharacterOverviewInfo:function(){pe.a.render(ue.a.createElement(c.a,null),document.getElementById("character-overview-text"));const e=document.getElementById("character-overview-save-button");j.Settings.AutosaveInterval?e.classList.remove("flashing-button"):e.classList.add("flashing-button")},updateCharacterInfo:function(){pe.a.render(Object(V.CharacterInfo)(R.Player),de.Display.characterInfo)},idleTimer:function(){const e=(new Date).getTime();let t=e-de._lastUpdate;const n=t%de._idleSpeed;(t=Math.floor(t/de._idleSpeed))>0&&(de._lastUpdate=e-n,R.Player.lastUpdate=e-n,de.updateGame(t)),window.requestAnimationFrame(de.idleTimer)},updateGame:function(e=1){const t=e*de._idleSpeed;null==R.Player.totalPlaytime&&(R.Player.totalPlaytime=0),null==R.Player.playtimeSinceLastAug&&(R.Player.playtimeSinceLastAug=0),null==R.Player.playtimeSinceLastBitnode&&(R.Player.playtimeSinceLastBitnode=0),R.Player.totalPlaytime+=t,R.Player.playtimeSinceLastAug+=t,R.Player.playtimeSinceLastBitnode+=t,!0===K.a.actionStarted&&(de._totalActionTime=K.a.actionTime,de._actionTimeLeft=K.a.actionTime,de._actionInProgress=!0,de._actionProgressBarCount=1,de._actionProgressStr="[ ]",de._actionTimeStr="Time left: ",K.a.actionStarted=!1),R.Player.isWorking&&(R.Player.workType==h.CONSTANTS.WorkTypeFaction?R.Player.workForFaction(e):R.Player.workType==h.CONSTANTS.WorkTypeCreateProgram?R.Player.createProgramWork(e):R.Player.workType==h.CONSTANTS.WorkTypeStudyClass?R.Player.takeClass(e):R.Player.workType==h.CONSTANTS.WorkTypeCrime?R.Player.commitCrime(e):R.Player.workType==h.CONSTANTS.WorkTypeCompanyPartTime?R.Player.workPartTime(e):R.Player.work(e)),R.Player.hasWseAccount&&Object(H.processStockPrices)(e),R.Player.inGang()&&R.Player.gang.process(e,R.Player),x.c&&x.b&&x.b.process(e),R.Player.corporation instanceof d.c&&R.Player.corporation.storeCycles(e),R.Player.bladeburner instanceof l.Bladeburner&&R.Player.bladeburner.storeCycles(e);for(let t=0;t0?(t.innerHTML=e,t.setAttribute("class","notification-on")):(t.innerHTML="",t.setAttribute("class","notification-off")),de.Counters.createProgramNotifications=10}if(de.Counters.augmentationsNotifications<=0){e=R.Player.queuedAugmentations.length,t=document.getElementById("augmentations-notification");e>0?(t.innerHTML=e,t.setAttribute("class","notification-on")):(t.innerHTML="",t.setAttribute("class","notification-off")),de.Counters.augmentationsNotifications=10}if(de.Counters.checkFactionInvitations<=0){var n=R.Player.checkForFactionInvitations();if(n.length>0){!1===R.Player.firstFacInvRecvd&&(R.Player.firstFacInvRecvd=!0,document.getElementById("factions-tab").style.display="list-item",document.getElementById("character-menu-header").click(),document.getElementById("character-menu-header").click());var a=n[Math.floor(Math.random()*n.length)];Object(f.inviteToFaction)(a)}const e=R.Player.factionInvitations.length,t=document.getElementById("factions-notification");e>0?(t.innerHTML=e,t.setAttribute("class","notification-on")):(t.innerHTML="",t.setAttribute("class","notification-off")),de.Counters.checkFactionInvitations=100}if(de.Counters.passiveFactionGrowth<=0){var i=Math.floor(5-de.Counters.passiveFactionGrowth);Object(f.processPassiveFactionRepGain)(i),de.Counters.passiveFactionGrowth=5}if(de.Counters.messages<=0&&(Object(T.b)(),r.Augmentations[o.AugmentationNames.TheRedPill].owned?de.Counters.messages=4500:de.Counters.messages=150),de.Counters.mechanicProcess<=0){if(R.Player.corporation instanceof d.c&&R.Player.corporation.process(),R.Player.bladeburner instanceof l.Bladeburner)try{R.Player.bladeburner.process(R.Player)}catch(e){Object(oe.exceptionAlert)("Exception caught in Bladeburner.process(): "+e)}de.Counters.mechanicProcess=5}de.Counters.contractGeneration<=0&&(Math.random()<=.25&&Object(m.generateRandomContract)(),de.Counters.contractGeneration=3e3)},_totalActionTime:0,_actionTimeLeft:0,_actionTimeStr:"Time left: ",_actionProgressStr:"[ ]",_actionProgressBarCount:1,_actionInProgress:!1,updateHackProgress:function(e=1){var t=e*de._idleSpeed;de._actionTimeLeft-=t/1e3,de._actionTimeLeft=Math.max(de._actionTimeLeft,0);for(var n=Math.round(100*(1-de._actionTimeLeft/de._totalActionTime));2*de._actionProgressBarCount<=n;)de._actionProgressStr=Object(a.replaceAt)(de._actionProgressStr,de._actionProgressBarCount,"|"),de._actionProgressBarCount+=1;de._actionTimeStr="Time left: "+Math.max(0,Math.round(de._actionTimeLeft)).toString()+"s",document.getElementById("hack-progress").innerHTML=de._actionTimeStr,document.getElementById("hack-progress-bar").innerHTML=de._actionProgressStr.replace(/ /g," "),n>=100&&(de._actionInProgress=!1,K.a.finishAction())},closeMainMenuHeader:function(e){for(var t=0;te===1.0777-1?"7.77%":e===1.777-1?"77.7%":c.numeralWrapper.formatPercentage(e,t);let r=o.createElement(o.Fragment,null,"Effects:");return e.hacking_mult&&e.hacking_mult==e.strength_mult&&e.hacking_mult==e.defense_mult&&e.hacking_mult==e.dexterity_mult&&e.hacking_mult==e.agility_mult&&e.hacking_mult==e.charisma_mult?r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.hacking_mult-1)," all skills"):(e.hacking_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.hacking_mult-1)," hacking skill")),e.strength_mult&&e.strength_mult==e.defense_mult&&e.strength_mult==e.dexterity_mult&&e.strength_mult==e.agility_mult?r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.strength_mult-1)," combat skills"):(e.strength_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.strength_mult-1)," strength skill")),e.defense_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.defense_mult-1)," defense skill")),e.dexterity_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.dexterity_mult-1)," dexterity skill")),e.agility_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.agility_mult-1)," agility skill"))),e.charisma_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.charisma_mult-1)," Charisma skill"))),e.hacking_exp_mult&&e.hacking_exp_mult===e.strength_exp_mult&&e.hacking_exp_mult===e.defense_exp_mult&&e.hacking_exp_mult===e.dexterity_exp_mult&&e.hacking_exp_mult===e.agility_exp_mult&&e.hacking_exp_mult===e.charisma_exp_mult?r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.hacking_exp_mult-1)," exp for all skills"):(e.hacking_exp_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.hacking_exp_mult-1)," hacking exp")),e.strength_exp_mult&&e.strength_exp_mult===e.defense_exp_mult&&e.strength_exp_mult===e.dexterity_exp_mult&&e.strength_exp_mult===e.agility_exp_mult?r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.strength_exp_mult-1)," combat exp"):(e.strength_exp_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.strength_exp_mult-1)," strength exp")),e.defense_exp_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.defense_exp_mult-1)," defense exp")),e.dexterity_exp_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.dexterity_exp_mult-1)," dexterity exp")),e.agility_exp_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.agility_exp_mult-1)," agility exp"))),e.charisma_exp_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.charisma_exp_mult-1)," charisma exp"))),e.hacking_speed_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.hacking_speed_mult-1)," faster hacking")),e.hacking_chance_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.hacking_chance_mult-1)," hack() success chance")),e.hacking_money_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.hacking_money_mult-1)," hack() power")),e.hacking_grow_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.hacking_grow_mult-1)," grow() power")),e.faction_rep_mult&&e.faction_rep_mult===e.company_rep_mult?r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.faction_rep_mult-1)," reputation from factions and companies"):(e.faction_rep_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.faction_rep_mult-1)," reputation from factions")),e.company_rep_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.company_rep_mult-1)," reputation from companies"))),e.crime_money_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.crime_money_mult-1)," crime money")),e.crime_success_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.crime_success_mult-1)," crime success rate")),e.work_money_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.work_money_mult-1)," work money")),e.hacknet_node_money_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.hacknet_node_money_mult-1)," hacknet production")),e.hacknet_node_purchase_cost_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"-",a(-(e.hacknet_node_purchase_cost_mult-1))," hacknet nodes cost")),e.hacknet_node_level_cost_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"-",a(-(e.hacknet_node_level_cost_mult-1))," hacknet nodes upgrade cost")),e.bladeburner_max_stamina_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.bladeburner_max_stamina_mult-1)," Bladeburner Max Stamina")),e.bladeburner_stamina_gain_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.bladeburner_stamina_gain_mult-1)," Bladeburner Stamina gain")),e.bladeburner_analysis_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.bladeburner_analysis_mult-1)," Bladeburner Field Analysis effectiveness")),e.bladeburner_success_chance_mult&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"+",a(e.bladeburner_success_chance_mult-1)," Bladeburner Contracts and Operations success chance")),n&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"Start with ",u.Money(n)," after installing Augmentations.")),t&&(r=o.createElement(o.Fragment,null,r,o.createElement("br",null),"Start with ",t.join(" and ")," after installing Augmentations.")),r}(this.mults,e.programs,e.startingMoney)}addToFactions(e){for(let t=0;t{let t=`${e%1e3}`;for(;t.length<3;)t="0"+t;return t})(),u=t?`${l}.${c}`:`${l}`;let m="";return a>0&&(m+=`${a} days `),i>0&&(m+=`${i} hours `),s>0&&(m+=`${s} minutes `),m+=`${u} seconds`},t.longestCommonStart=function(e){if(!r(e))return"";if(0===e.length)return"";const t=e.concat().sort(),n=t[0],a=t[t.length-1],i=n.length;let o=0;const s=(e,t)=>e.toUpperCase()===t.toUpperCase();for(;o=0;e--)if(1===n[e].nodeType)return!0;return!1},t.generateRandomString=function(e){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let a=0;a{switch(typeof e){case"number":return e;case"object":return s.getRandomInt(e.min,e.max);default:throw Error(`Do not know how to convert the type '${typeof e}' to a number`)}};for(const e of i.serverMetadata){const i={hostname:e.hostname,ip:u(),numOpenPortsRequired:e.numOpenPortsRequired,organizationName:e.organizationName};void 0!==e.maxRamExponent&&(i.maxRam=Math.pow(2,o(e.maxRamExponent)));for(const t of n)void 0!==e[t]&&(i[t]=o(e[t]));const s=new a.Server(i);for(const t of e.literature||[])s.messages.push(t);void 0!==e.specialName&&r.SpecialServerIps.addIp(e.specialName,s.ip),m(s),void 0!==e.networkLayer&&t[o(e.networkLayer)-1].push(s)}const l=(e,t)=>{e.serversOnNetwork.push(t.ip),t.serversOnNetwork.push(e.ip)},c=e=>e[Math.floor(Math.random()*e.length)],p=(e,t)=>{for(const n of e)l(n,t())};p(t[0],()=>e);for(let e=1;ec(t[e-1]))},t.prestigeAllServers=function(){for(const e in t.AllServers)delete t.AllServers[e];t.AllServers={}},t.loadAllServers=function(e){t.AllServers=JSON.parse(e,l.Reviver)}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isBackdoorInstalled=t.getServerOnNetwork=t.getServer=t.GetServerByHostname=t.prestigeHomeComputer=t.processSingleServerGrowth=t.numCycleForGrowth=t.safetlyCreateUniqueServer=void 0;const a=n(23),r=n(487),i=n(516),o=n(22),s=n(10),l=n(32),c=n(139),u=n(1215),m=n(675);function p(e,t,n){let a=1+(s.CONSTANTS.ServerBaseGrowthRate-1)/e.hackDifficulty;a>s.CONSTANTS.ServerMaxGrowthRate&&(a=s.CONSTANTS.ServerMaxGrowthRate);const r=e.serverGrowth/100;return Math.log(t)/(Math.log(a)*n.hacking_grow_mult*r*o.BitNodeMultipliers.ServerGrowthRate)}function d(e){for(const t in a.AllServers)if(a.AllServers.hasOwnProperty(t)&&a.AllServers[t].hostname==e)return a.AllServers[t];return null}t.safetlyCreateUniqueServer=function(e){if(null!=e.ip&&a.ipExists(e.ip)&&(e.ip=a.createUniqueRandomIp()),null!=d(e.hostname)){let t=e.hostname;for(let n=0;n<200&&null!=d(t=`${e.hostname}-${n}`);++n);e.hostname=t}return new r.Server(e)},t.numCycleForGrowth=p,t.processSingleServerGrowth=function(e,t,n,a=1){let r=i.calculateServerGrowth(e,t,n,a);r<1&&(console.warn("serverGrowth calculated to be less than 1"),r=1);const o=e.moneyAvailable;if(e.moneyAvailable*=r,u.isValidNumber(e.moneyMax)&&isNaN(e.moneyAvailable)&&(e.moneyAvailable=e.moneyMax),u.isValidNumber(e.moneyMax)&&e.moneyAvailable>e.moneyMax&&(e.moneyAvailable=e.moneyMax),o!==e.moneyAvailable){let t=p(e,e.moneyAvailable/o,n);t=Math.max(0,t),e.fortify(2*s.CONSTANTS.ServerFortifyAmount*Math.ceil(t))}return e.moneyAvailable/o},t.prestigeHomeComputer=function(e){const t=e.programs.includes(l.Programs.BitFlume.name);e.programs.length=0,e.runningScripts=[],e.serversOnNetwork=[],e.isConnectedTo=!0,e.ramUsed=0,e.programs.push(l.Programs.NukeProgram.name),t&&e.programs.push(l.Programs.BitFlume.name),e.scripts.forEach(function(t){t.updateRamUsage(e.scripts)}),e.messages.length=0,e.messages.push(c.LiteratureNames.HackersStartingHandbook)},t.GetServerByHostname=d,t.getServer=function(e){return m.isValidIPAddress(e)?void 0!==a.AllServers[e]?a.AllServers[e]:null:d(e)},t.getServerOnNetwork=function(e,t){return t>e.serversOnNetwork.length?(console.error("Tried to get server on network that was out of range"),null):a.AllServers[e.serversOnNetwork[t]]},t.isBackdoorInstalled=function(e){return"backdoorInstalled"in e&&e.backdoorInstalled}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmployeePositions=void 0,t.EmployeePositions={Operations:"Operations",Engineer:"Engineer",Business:"Business",Management:"Management",RandD:"Research & Development",Training:"Training",Unassigned:"Unassigned"}},function(e,t,n){"use strict";function a(e,t){var n;if(null==t)return console.log("Reviver WRONGLY called with key: "+e+", and value: "+t),0;if("object"==typeof t&&"string"==typeof t.ctor&&void 0!==t.data){if("AllServersMap"===t.ctor)return console.log("Converting AllServersMap for v0.43.1"),t.data;if("function"==typeof(n=a.constructors[t.ctor]||window[t.ctor])&&"function"==typeof n.fromJSON)return n.fromJSON(t)}return t}function r(e,t,n){var a,r;n||(n=Object.keys(t)),a={};for(let e=0;e0}function P(){if(m.a.isRunning){if(m.a.currStep!==m.d.HacknetNodesIntroduction)return;Object(m.b)()}const e=p.Player.hacknetNodes.length;if(C()){const t=M();if(isNaN(t))throw new Error("Calculated cost of purchasing HacknetServer is NaN");return p.Player.canAfford(t)?(p.Player.loseMoney(t),p.Player.createHacknetServer(),F(),e):-1}{const t=O();if(isNaN(t))throw new Error("Calculated cost of purchasing HacknetNode is NaN");if(!p.Player.canAfford(t))return-1;const n="hacknet-node-"+e,r=new a.HacknetNode(n,p.Player.hacknet_node_money_mult);return p.Player.loseMoney(t),p.Player.hacknetNodes.push(r),e}}function S(){return C()&&p.Player.hacknetNodes.length>=o.HacknetServerConstants.MaxServers}function O(){return Object(r.calculateNodeCost)(p.Player.hacknetNodes.length+1,p.Player.hacknet_node_purchase_cost_mult)}function M(){return Object(i.calculateServerCost)(p.Player.hacknetNodes.length+1,p.Player.hacknet_node_purchase_cost_mult)}function T(e,t){if(null==t)throw new Error("getMaxNumberLevelUpgrades() called without maxLevel arg");if(p.Player.money.lt(e.calculateLevelUpgradeCost(1,p.Player.hacknet_node_level_cost_mult)))return 0;let n=1,a=t-1,r=t-e.level;if(p.Player.money.gt(e.calculateLevelUpgradeCost(r,p.Player.hacknet_node_level_cost_mult)))return r;for(;n<=a;){var i=(n+a)/2|0;if(i!==t&&p.Player.money.gt(e.calculateLevelUpgradeCost(i,p.Player.hacknet_node_level_cost_mult))&&p.Player.money.lt(e.calculateLevelUpgradeCost(i+1,p.Player.hacknet_node_level_cost_mult)))return Math.min(r,i);if(p.Player.money.lt(e.calculateLevelUpgradeCost(i,p.Player.hacknet_node_level_cost_mult)))a=i-1;else{if(!p.Player.money.gt(e.calculateLevelUpgradeCost(i,p.Player.hacknet_node_level_cost_mult)))return Math.min(r,i);n=i+1}}return 0}function x(e,t){if(null==t)throw new Error("getMaxNumberRamUpgrades() called without maxLevel arg");if(p.Player.money.lt(e.calculateRamUpgradeCost(1,p.Player.hacknet_node_ram_cost_mult)))return 0;let n;if(n=e instanceof s.HacknetServer?Math.round(Math.log2(t/e.maxRam)):Math.round(Math.log2(t/e.ram)),p.Player.money.gt(e.calculateRamUpgradeCost(n,p.Player.hacknet_node_ram_cost_mult)))return n;for(let t=n-1;t>=0;--t)if(p.Player.money.gt(e.calculateRamUpgradeCost(t,p.Player.hacknet_node_ram_cost_mult)))return t;return 0}function w(e,t){if(null==t)throw new Error("getMaxNumberCoreUpgrades() called without maxLevel arg");if(p.Player.money.lt(e.calculateCoreUpgradeCost(1,p.Player.hacknet_node_core_cost_mult)))return 0;let n=1,a=t-1;const r=t-e.cores;if(p.Player.money.gt(e.calculateCoreUpgradeCost(r,p.Player.hacknet_node_core_cost_mult)))return r;for(;n<=a;){let i=(n+a)/2|0;if(i!=t&&p.Player.money.gt(e.calculateCoreUpgradeCost(i,p.Player.hacknet_node_core_cost_mult))&&p.Player.money.lt(e.calculateCoreUpgradeCost(i+1,p.Player.hacknet_node_core_cost_mult)))return Math.min(r,i);if(p.Player.money.lt(e.calculateCoreUpgradeCost(i,p.Player.hacknet_node_core_cost_mult)))a=i-1;else{if(!p.Player.money.gt(e.calculateCoreUpgradeCost(i,p.Player.hacknet_node_core_cost_mult)))return Math.min(r,i);n=i+1}}return 0}function A(e,t){if(null==t)throw new Error("getMaxNumberCacheUpgrades() called without maxLevel arg");if(!p.Player.canAfford(e.calculateCacheUpgradeCost(1)))return 0;let n=1,a=t-1;const r=t-e.cache;if(p.Player.canAfford(e.calculateCacheUpgradeCost(r)))return r;for(;n<=a;){let i=(n+a)/2|0;if(i!=t&&p.Player.canAfford(e.calculateCacheUpgradeCost(i))&&!p.Player.canAfford(e.calculateCacheUpgradeCost(i+1)))return Math.min(r,i);if(p.Player.canAfford(e.calculateCacheUpgradeCost(i))){if(!p.Player.canAfford(e.calculateCacheUpgradeCost(i)))return Math.min(r,i);n=i+1}else a=i-1}return 0}function R(e,t=1){const n=Math.round(t),a=e.calculateLevelUpgradeCost(n,p.Player.hacknet_node_level_cost_mult);if(isNaN(a)||a<=0||n<0)return!1;const r=e instanceof s.HacknetServer;if(e.level>=(r?o.HacknetServerConstants.MaxLevel:o.HacknetNodeConstants.MaxLevel))return!1;if(e.level+n>(r?o.HacknetServerConstants.MaxLevel:o.HacknetNodeConstants.MaxLevel)){return R(e,Math.max(0,(r?o.HacknetServerConstants.MaxLevel:o.HacknetNodeConstants.MaxLevel)-e.level))}return!!p.Player.canAfford(a)&&(p.Player.loseMoney(a),e.upgradeLevel(n,p.Player.hacknet_node_money_mult),!0)}function N(e,t=1){const n=Math.round(t),a=e.calculateRamUpgradeCost(n,p.Player.hacknet_node_ram_cost_mult);if(isNaN(a)||a<=0||n<0)return!1;const r=e instanceof s.HacknetServer;if(e.ram>=(r?o.HacknetServerConstants.MaxRam:o.HacknetNodeConstants.MaxRam))return!1;if(r){if(e.maxRam*Math.pow(2,n)>o.HacknetServerConstants.MaxRam){return N(e,Math.max(0,Math.log2(Math.round(o.HacknetServerConstants.MaxRam/e.maxRam))))}}else if(e.ram*Math.pow(2,n)>o.HacknetNodeConstants.MaxRam){return N(e,Math.max(0,Math.log2(Math.round(o.HacknetNodeConstants.MaxRam/e.ram))))}return!!p.Player.canAfford(a)&&(p.Player.loseMoney(a),e.upgradeRam(n,p.Player.hacknet_node_money_mult),!0)}function D(e,t=1){const n=Math.round(t),a=e.calculateCoreUpgradeCost(n,p.Player.hacknet_node_core_cost_mult);if(isNaN(a)||a<=0||n<0)return!1;const r=e instanceof s.HacknetServer;if(e.cores>=(r?o.HacknetServerConstants.MaxCores:o.HacknetNodeConstants.MaxCores))return!1;if(e.cores+n>(r?o.HacknetServerConstants.MaxCores:o.HacknetNodeConstants.MaxCores)){return D(e,Math.max(0,(r?o.HacknetServerConstants.MaxCores:o.HacknetNodeConstants.MaxCores)-e.cores))}return!!p.Player.canAfford(a)&&(p.Player.loseMoney(a),e.upgradeCore(n,p.Player.hacknet_node_money_mult),!0)}function B(e,t=1){const n=Math.round(t),a=e.calculateCacheUpgradeCost(n);if(isNaN(a)||a<=0||n<0)return!1;if(!(e instanceof s.HacknetServer))return console.warn("purchaseCacheUpgrade() called for a non-HacknetNode"),!1;if(e.cache+n>o.HacknetServerConstants.MaxCache){return B(e,Math.max(0,o.HacknetServerConstants.MaxCache-e.cache))}return!!p.Player.canAfford(a)&&(p.Player.loseMoney(a),e.upgradeCache(n),!0)}function I(){g.routing.isOn(g.Page.HacknetNodes)&&E.a.render(y.a.createElement(v.a,null),k)}function L(){k instanceof HTMLElement&&E.a.unmountComponentAtNode(k),k.style.display="none"}function W(e){return 0===p.Player.hacknetNodes.length?0:C()?function(e){if(!(p.Player.hashManager instanceof l.HashManager))throw new Error("Player does not have a HashManager (should be in 'hashManager' prop)");let t=0;for(let n=0;n{const e=document.createElement("div");if(null===e)throw new Error("unable to create empty div element");return e})();t.MainMenuLinks={Terminal:r,ScriptEditor:r,ActiveScripts:r,CreateProgram:r,Stats:r,Factions:r,Augmentations:r,HacknetNodes:r,Sleeves:r,City:r,Travel:r,Job:r,StockMarket:r,Bladeburner:r,Corporation:r,Gang:r,Milestones:r,Tutorial:r,Options:r,DevMenu:r},t.initializeMainMenuLinks=function(){try{function e(e){const t=a.clearEventListeners(e);if(null==t)throw new Error(`clearEventListeners() failed for element with id: ${e}`);return t}t.MainMenuLinks.Terminal=e("terminal-menu-link"),t.MainMenuLinks.ScriptEditor=e("create-script-menu-link"),t.MainMenuLinks.ActiveScripts=e("active-scripts-menu-link"),t.MainMenuLinks.CreateProgram=e("create-program-menu-link"),t.MainMenuLinks.Stats=e("stats-menu-link"),t.MainMenuLinks.Factions=e("factions-menu-link"),t.MainMenuLinks.Augmentations=e("augmentations-menu-link"),t.MainMenuLinks.HacknetNodes=e("hacknet-nodes-menu-link"),t.MainMenuLinks.Sleeves=e("sleeves-menu-link"),t.MainMenuLinks.City=e("city-menu-link"),t.MainMenuLinks.Travel=e("travel-menu-link"),t.MainMenuLinks.Job=e("job-menu-link"),t.MainMenuLinks.StockMarket=e("stock-market-menu-link"),t.MainMenuLinks.Bladeburner=e("bladeburner-menu-link"),t.MainMenuLinks.Corporation=e("corporation-menu-link"),t.MainMenuLinks.Gang=e("gang-menu-link"),t.MainMenuLinks.Milestones=e("milestones-menu-link"),t.MainMenuLinks.Tutorial=e("tutorial-menu-link");const n=document.getElementById("options-menu-link");if(null===n)throw new Error('Could not find element with id: "options-menu-link"');return t.MainMenuLinks.Options=n,t.MainMenuLinks.DevMenu=e("dev-menu-link"),!0}catch(e){return console.error(`Failed to initialize Main Menu Links: ${e}`),!1}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.companyExists=t.loadCompanies=t.initCompanies=t.Companies=void 0;const a=n(1233),r=n(145),i=n(27);t.Companies={},t.initCompanies=function(){const e=t.Companies;t.Companies={},a.companiesMetadata.forEach(e=>{!function(e){null!=t.Companies[e.name]&&console.warn(`Duplicate Company Position being defined: ${e.name}`),t.Companies[e.name]=new r.Company(e)}(e)});for(const n in t.Companies){const a=t.Companies[n];e[n]instanceof r.Company?(a.favor=e[n].favor,isNaN(a.favor)&&(a.favor=0)):a.favor=0}},t.loadCompanies=function(e){t.Companies=JSON.parse(e,i.Reviver)},t.companyExists=function(e){return t.Companies.hasOwnProperty(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetIndustryResearchTrees=t.IndustryResearchTrees=t.IndustryDescriptions=t.IndustryStartingCosts=t.Industries=void 0;const a=n(1246),r=n(3);t.Industries={Energy:"Energy",Utilities:"Water Utilities",Agriculture:"Agriculture",Fishing:"Fishing",Mining:"Mining",Food:"Food",Tobacco:"Tobacco",Chemical:"Chemical",Pharmaceutical:"Pharmaceutical",Computer:"Computer Hardware",Robotics:"Robotics",Software:"Software",Healthcare:"Healthcare",RealEstate:"RealEstate"},t.IndustryStartingCosts={Energy:225e9,Utilities:15e10,Agriculture:4e10,Fishing:8e10,Mining:3e11,Food:1e10,Tobacco:2e10,Chemical:7e10,Pharmaceutical:2e11,Computer:5e11,Robotics:1e12,Software:25e9,Healthcare:75e10,RealEstate:6e11},t.IndustryDescriptions={Energy:"Engage in the production and distribution of energy.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Energy,"$0.000a")+"
Recommended starting Industry: NO",Utilities:"Distribute water and provide wastewater services.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Utilities,"$0.000a")+"
Recommended starting Industry: NO",Agriculture:"Cultivate crops and breed livestock to produce food.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Agriculture,"$0.000a")+"
Recommended starting Industry: YES",Fishing:"Produce food through the breeding and processing of fish and fish products.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Fishing,"$0.000a")+"
Recommended starting Industry: NO",Mining:"Extract and process metals from the earth.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Mining,"$0.000a")+"
Recommended starting Industry: NO",Food:"Create your own restaurants all around the world.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Food,"$0.000a")+"
Recommended starting Industry: YES",Tobacco:"Create and distribute tobacco and tobacco-related products.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Tobacco,"$0.000a")+"
Recommended starting Industry: YES",Chemical:"Produce industrial chemicals.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Chemical,"$0.000a")+"
Recommended starting Industry: NO",Pharmaceutical:"Discover, develop, and create new pharmaceutical drugs.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Pharmaceutical,"$0.000a")+"
Recommended starting Industry: NO",Computer:"Develop and manufacture new computer hardware and networking infrastructures.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Computer,"$0.000a")+"
Recommended starting Industry: NO",Robotics:"Develop and create robots.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Robotics,"$0.000a")+"
Recommended starting Industry: NO",Software:"Develop computer software and create AI Cores.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Software,"$0.000a")+"
Recommended starting Industry: YES",Healthcare:"Create and manage hospitals.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.Healthcare,"$0.000a")+"
Recommended starting Industry: NO",RealEstate:"Develop and manage real estate properties.

Starting cost: "+r.numeralWrapper.format(t.IndustryStartingCosts.RealEstate,"$0.000a")+"
Recommended starting Industry: NO"},t.IndustryResearchTrees={Energy:a.getBaseResearchTreeCopy(),Utilities:a.getBaseResearchTreeCopy(),Agriculture:a.getBaseResearchTreeCopy(),Fishing:a.getBaseResearchTreeCopy(),Mining:a.getBaseResearchTreeCopy(),Food:a.getProductIndustryResearchTreeCopy(),Tobacco:a.getProductIndustryResearchTreeCopy(),Chemical:a.getBaseResearchTreeCopy(),Pharmaceutical:a.getProductIndustryResearchTreeCopy(),Computer:a.getProductIndustryResearchTreeCopy(),Robotics:a.getProductIndustryResearchTreeCopy(),Software:a.getProductIndustryResearchTreeCopy(),Healthcare:a.getProductIndustryResearchTreeCopy(),RealEstate:a.getProductIndustryResearchTreeCopy()},t.resetIndustryResearchTrees=function(){t.IndustryResearchTrees.Energy=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Utilities=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Agriculture=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Fishing=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Mining=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Food=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Tobacco=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Chemical=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Pharmaceutical=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Computer=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Robotics=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Software=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Healthcare=a.getBaseResearchTreeCopy(),t.IndustryResearchTrees.RealEstate=a.getBaseResearchTreeCopy()}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRandomInt=void 0,t.getRandomInt=function(e,t){const n=Math.min(e,t),a=Math.max(e,t);return Math.floor(Math.random()*(a-n+1))+n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HacknetServerConstants=t.HacknetNodeConstants=void 0,t.HacknetNodeConstants={MoneyGainPerLevel:1.6,BaseCost:1e3,LevelBaseCost:1,RamBaseCost:3e4,CoreBaseCost:5e5,PurchaseNextMult:1.85,UpgradeLevelMult:1.04,UpgradeRamMult:1.28,UpgradeCoreMult:1.48,MaxLevel:200,MaxRam:64,MaxCores:16},t.HacknetServerConstants={HashesPerLevel:.001,BaseCost:5e4,RamBaseCost:2e5,CoreBaseCost:1e6,CacheBaseCost:1e7,PurchaseMult:3.2,UpgradeLevelMult:1.1,UpgradeRamMult:1.4,UpgradeCoreMult:1.55,UpgradeCacheMult:1.85,MaxServers:20,MaxLevel:300,MaxRam:8192,MaxCores:128,MaxCache:15}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CityName=void 0,function(e){e.Aevum="Aevum",e.Chongqing="Chongqing",e.Ishima="Ishima",e.NewTokyo="New Tokyo",e.Sector12="Sector-12",e.Volhaven="Volhaven"}(t.CityName||(t.CityName={}))},,,function(module,__webpack_exports__,__webpack_require__){"use strict";(function($){__webpack_require__.d(__webpack_exports__,"f",function(){return IssueNewSharesCooldown}),__webpack_require__.d(__webpack_exports__,"k",function(){return SellSharesCooldown}),__webpack_require__.d(__webpack_exports__,"m",function(){return WarehouseInitialCost}),__webpack_require__.d(__webpack_exports__,"n",function(){return WarehouseInitialSize}),__webpack_require__.d(__webpack_exports__,"o",function(){return WarehouseUpgradeBaseCost}),__webpack_require__.d(__webpack_exports__,"g",function(){return OfficeInitialCost}),__webpack_require__.d(__webpack_exports__,"h",function(){return OfficeInitialSize}),__webpack_require__.d(__webpack_exports__,"a",function(){return BribeThreshold}),__webpack_require__.d(__webpack_exports__,"b",function(){return BribeToRepRatio}),__webpack_require__.d(__webpack_exports__,"j",function(){return ProductProductionCostRatio}),__webpack_require__.d(__webpack_exports__,"d",function(){return DividendMaxPercentage}),__webpack_require__.d(__webpack_exports__,"c",function(){return Corporation}),__webpack_require__.d(__webpack_exports__,"e",function(){return Industry}),__webpack_require__.d(__webpack_exports__,"i",function(){return OfficeSpace});var _CorporationState__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(531),_CorporationState__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_CorporationState__WEBPACK_IMPORTED_MODULE_0__),_data_CorporationUnlockUpgrades__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(452),_data_CorporationUnlockUpgrades__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_data_CorporationUnlockUpgrades__WEBPACK_IMPORTED_MODULE_1__),_data_CorporationUpgrades__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(451),_data_CorporationUpgrades__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(_data_CorporationUpgrades__WEBPACK_IMPORTED_MODULE_2__),_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(26),_EmployeePositions__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__),_IndustryData__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(35),_IndustryData__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(_IndustryData__WEBPACK_IMPORTED_MODULE_4__),_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(305),_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_5__),_Material__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(292),_Material__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(_Material__WEBPACK_IMPORTED_MODULE_6__),_MaterialSizes__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(134),_MaterialSizes__WEBPACK_IMPORTED_MODULE_7___default=__webpack_require__.n(_MaterialSizes__WEBPACK_IMPORTED_MODULE_7__),_Product__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(204),_Product__WEBPACK_IMPORTED_MODULE_8___default=__webpack_require__.n(_Product__WEBPACK_IMPORTED_MODULE_8__),_ResearchMap__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(410),_ResearchMap__WEBPACK_IMPORTED_MODULE_9___default=__webpack_require__.n(_ResearchMap__WEBPACK_IMPORTED_MODULE_9__),_Warehouse__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(121),_Warehouse__WEBPACK_IMPORTED_MODULE_10___default=__webpack_require__.n(_Warehouse__WEBPACK_IMPORTED_MODULE_10__);__webpack_require__.d(__webpack_exports__,"l",function(){return _Warehouse__WEBPACK_IMPORTED_MODULE_10__.Warehouse});var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(22),_BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_11___default=__webpack_require__.n(_BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_11__),_Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(450),_Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_12___default=__webpack_require__.n(_Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_12__),_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(139),_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_13___default=__webpack_require__.n(_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_13__),_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(38),_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14___default=__webpack_require__.n(_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__),_Player__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(1),_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(3),_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16___default=__webpack_require__.n(_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__),_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(19),_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17___default=__webpack_require__.n(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__),_utils_calculateEffectWithFactors__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(788),_utils_calculateEffectWithFactors__WEBPACK_IMPORTED_MODULE_18___default=__webpack_require__.n(_utils_calculateEffectWithFactors__WEBPACK_IMPORTED_MODULE_18__),_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__(11),_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19___default=__webpack_require__.n(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__),_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__(27),_utils_uiHelpers_appendLineBreaks__WEBPACK_IMPORTED_MODULE_21__=__webpack_require__(787),_utils_uiHelpers_appendLineBreaks__WEBPACK_IMPORTED_MODULE_21___default=__webpack_require__.n(_utils_uiHelpers_appendLineBreaks__WEBPACK_IMPORTED_MODULE_21__),_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__=__webpack_require__(12),_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22___default=__webpack_require__.n(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__),_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_23__=__webpack_require__(57),_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_23___default=__webpack_require__.n(_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_23__),_utils_uiHelpers_createPopupCloseButton__WEBPACK_IMPORTED_MODULE_24__=__webpack_require__(69),_utils_uiHelpers_createPopupCloseButton__WEBPACK_IMPORTED_MODULE_24___default=__webpack_require__.n(_utils_uiHelpers_createPopupCloseButton__WEBPACK_IMPORTED_MODULE_24__),_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__=__webpack_require__(21),_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25___default=__webpack_require__.n(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__),_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__=__webpack_require__(36),_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26___default=__webpack_require__.n(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__),_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_27__=__webpack_require__(62),_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_27___default=__webpack_require__.n(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_27__),_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_28__=__webpack_require__(44),_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_28___default=__webpack_require__.n(_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_28__),_utils_uiHelpers_removeElement__WEBPACK_IMPORTED_MODULE_29__=__webpack_require__(165),_utils_uiHelpers_removeElement__WEBPACK_IMPORTED_MODULE_29___default=__webpack_require__.n(_utils_uiHelpers_removeElement__WEBPACK_IMPORTED_MODULE_29__),_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__=__webpack_require__(48),_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30___default=__webpack_require__.n(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__),_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__=__webpack_require__(55),_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31___default=__webpack_require__.n(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__),react__WEBPACK_IMPORTED_MODULE_32__=__webpack_require__(0),react__WEBPACK_IMPORTED_MODULE_32___default=__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_32__),react_dom__WEBPACK_IMPORTED_MODULE_33__=__webpack_require__(24),react_dom__WEBPACK_IMPORTED_MODULE_33___default=__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_33__),_ui_CorporationUIEventHandler__WEBPACK_IMPORTED_MODULE_34__=__webpack_require__(786),_ui_Root__WEBPACK_IMPORTED_MODULE_35__=__webpack_require__(784),_ui_Routing__WEBPACK_IMPORTED_MODULE_36__=__webpack_require__(449),_ui_Routing__WEBPACK_IMPORTED_MODULE_36___default=__webpack_require__.n(_ui_Routing__WEBPACK_IMPORTED_MODULE_36__),decimal_js__WEBPACK_IMPORTED_MODULE_37__=__webpack_require__(56);const INITIALSHARES=1e9,SHARESPERPRICEUPDATE=1e6,IssueNewSharesCooldown=216e3,SellSharesCooldown=18e3,CyclesPerMarketCycle=50,CyclesPerIndustryStateCycle=CyclesPerMarketCycle/_CorporationState__WEBPACK_IMPORTED_MODULE_0__.AllCorporationStates.length,SecsPerMarketCycle=CyclesPerMarketCycle/5,Cities=["Aevum","Chongqing","Sector-12","New Tokyo","Ishima","Volhaven"],WarehouseInitialCost=5e9,WarehouseInitialSize=100,WarehouseUpgradeBaseCost=1e9,OfficeInitialCost=4e9,OfficeInitialSize=3,OfficeUpgradeBaseCost=1e9,BribeThreshold=1e14,BribeToRepRatio=1e9,ProductProductionCostRatio=5,DividendMaxPercentage=50,EmployeeSalaryMultiplier=3,CyclesPerEmployeeRaise=400,EmployeeRaiseAmount=50,BaseMaxProducts=3;let researchTreeBoxOpened=!1,researchTreeBox=null;function Industry(e={}){this.offices={[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Aevum]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Chongqing]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Sector12]:new OfficeSpace({loc:_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Sector12,size:OfficeInitialSize}),[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.NewTokyo]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Ishima]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Volhaven]:0},this.name=e.name?e.name:0,this.type=e.type?e.type:0,this.sciResearch=new _Material__WEBPACK_IMPORTED_MODULE_6__.Material({name:"Scientific Research"}),this.researched={},this.reqMats={},this.prodMats=[],this.products={},this.makesProducts=!1,this.awareness=0,this.popularity=0,this.startingCost=0,this.reFac=0,this.sciFac=0,this.hwFac=0,this.robFac=0,this.aiFac=0,this.advFac=0,this.prodMult=0,this.lastCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.lastCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0);var t=Object.keys(_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_5__.IndustryUpgrades).length;this.upgrades=Array(t).fill(0),this.state="START",this.newInd=!0,this.warehouses={[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Aevum]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Chonqing]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Sector12]:new _Warehouse__WEBPACK_IMPORTED_MODULE_10__.Warehouse({corp:e.corp,industry:this,loc:_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Sector12,size:WarehouseInitialSize}),[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.NewTokyo]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Ishima]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Volhaven]:0},this.init()}function Employee(e={}){if(!(this instanceof Employee))return new Employee(e);this.name=e.name?e.name:"Bobby",this.mor=e.morale?e.morale:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),this.hap=e.happiness?e.happiness:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),this.ene=e.energy?e.energy:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),this.int=e.intelligence?e.intelligence:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(10,50),this.cha=e.charisma?e.charisma:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(10,50),this.exp=e.experience?e.experience:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(10,50),this.cre=e.creativity?e.creativity:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(10,50),this.eff=e.efficiency?e.efficiency:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(10,50),this.sal=e.salary?e.salary:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(.1,5),this.pro=0,this.cyclesUntilRaise=CyclesPerEmployeeRaise,this.loc=e.loc?e.loc:"",this.pos=_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Unassigned}$(document).mousedown(function(e){researchTreeBoxOpened&&null==$(e.target).closest("#corporation-research-popup-box-content").get(0)&&(Object(_utils_uiHelpers_removeElement__WEBPACK_IMPORTED_MODULE_29__.removeElement)(researchTreeBox),researchTreeBox=null,researchTreeBoxOpened=!1)}),Industry.prototype.init=function(){switch(this.startingCost=_IndustryData__WEBPACK_IMPORTED_MODULE_4__.IndustryStartingCosts[this.type],this.type){case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Energy:this.reFac=.65,this.sciFac=.7,this.robFac=.05,this.aiFac=.3,this.advFac=.08,this.reqMats={Hardware:.1,Metal:.2},this.prodMats=["Energy"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Utilities:case"Utilities":this.reFac=.5,this.sciFac=.6,this.robFac=.4,this.aiFac=.4,this.advFac=.08,this.reqMats={Hardware:.1,Metal:.1},this.prodMats=["Water"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Agriculture:this.reFac=.72,this.sciFac=.5,this.hwFac=.2,this.robFac=.3,this.aiFac=.3,this.advFac=.04,this.reqMats={Water:.5,Energy:.5},this.prodMats=["Plants","Food"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Fishing:this.reFac=.15,this.sciFac=.35,this.hwFac=.35,this.robFac=.5,this.aiFac=.2,this.advFac=.08,this.reqMats={Energy:.5},this.prodMats=["Food"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Mining:this.reFac=.3,this.sciFac=.26,this.hwFac=.4,this.robFac=.45,this.aiFac=.45,this.advFac=.06,this.reqMats={Energy:.8},this.prodMats=["Metal"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Food:this.sciFac=.12,this.hwFac=.15,this.robFac=.3,this.aiFac=.25,this.advFac=.25,this.reFac=.05,this.reqMats={Food:.5,Water:.5,Energy:.2},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Tobacco:this.reFac=.15,this.sciFac=.75,this.hwFac=.15,this.robFac=.2,this.aiFac=.15,this.advFac=.2,this.reqMats={Plants:1,Water:.2},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Chemical:this.reFac=.25,this.sciFac=.75,this.hwFac=.2,this.robFac=.25,this.aiFac=.2,this.advFac=.07,this.reqMats={Plants:1,Energy:.5,Water:.5},this.prodMats=["Chemicals"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Pharmaceutical:this.reFac=.05,this.sciFac=.8,this.hwFac=.15,this.robFac=.25,this.aiFac=.2,this.advFac=.16,this.reqMats={Chemicals:2,Energy:1,Water:.5},this.prodMats=["Drugs"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Computer:case"Computer":this.reFac=.2,this.sciFac=.62,this.robFac=.36,this.aiFac=.19,this.advFac=.17,this.reqMats={Metal:2,Energy:1},this.prodMats=["Hardware"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Robotics:this.reFac=.32,this.sciFac=.65,this.aiFac=.36,this.advFac=.18,this.hwFac=.19,this.reqMats={Hardware:5,Energy:3},this.prodMats=["Robots"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Software:this.sciFac=.62,this.advFac=.16,this.hwFac=.25,this.reFac=.15,this.aiFac=.18,this.robFac=.05,this.reqMats={Hardware:.5,Energy:.5},this.prodMats=["AICores"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Healthcare:this.reFac=.1,this.sciFac=.75,this.advFac=.11,this.hwFac=.1,this.robFac=.1,this.aiFac=.1,this.reqMats={Robots:10,AICores:5,Energy:5,Water:5},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.RealEstate:this.robFac=.6,this.aiFac=.6,this.advFac=.25,this.sciFac=.05,this.hwFac=.05,this.reqMats={Metal:5,Energy:5,Water:2,Hardware:4},this.prodMats=["RealEstate"],this.makesProducts=!0;break;default:return void console.error(`Invalid Industry Type passed into Industry.init(): ${this.type}`)}},Industry.prototype.getProductDescriptionText=function(){if(this.makesProducts)switch(this.type){case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Food:return"create and manage restaurants";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Tobacco:return"create tobacco and tobacco-related products";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Pharmaceutical:return"develop new pharmaceutical drugs";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Computer:case"Computer":return"create new computer hardware and networking infrastructures";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Robotics:return"build specialized robots and robot-related products";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Software:return"develop computer software";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Healthcare:return"build and manage hospitals";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.RealEstate:return"develop and manage real estate properties";default:return console.error("Invalid industry type in Industry.getProductDescriptionText"),""}},Industry.prototype.getMaximumNumberProducts=function(){if(!this.makesProducts)return 0;let e=0;return this.hasResearch("uPgrade: Capacity.I")&&++e,this.hasResearch("uPgrade: Capacity.II")&&++e,BaseMaxProducts+e},Industry.prototype.hasMaximumNumberProducts=function(){return Object.keys(this.products).length>=this.getMaximumNumberProducts()},Industry.prototype.calculateProductionFactors=function(){for(var e=0,t=0;t0&&(e.breakdown+=t+": "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(n.data[e.loc][0]*n.siz,0)+"
")}},Industry.prototype.process=function(e=1,t,n){if(this.state=t,"START"===t){(isNaN(this.thisCycleRevenue)||isNaN(this.thisCycleExpenses))&&(console.error("NaN in Corporation's computed revenue/expenses"),Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("Something went wrong when compting Corporation's revenue/expenses. This is a bug. Please report to game developer"),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0)),this.lastCycleRevenue=this.thisCycleRevenue.dividedBy(e*SecsPerMarketCycle),this.lastCycleExpenses=this.thisCycleExpenses.dividedBy(e*SecsPerMarketCycle),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.lastCycleRevenue.gt(0)&&(this.newInd=!1);var a=0;for(var r in this.offices)this.offices[r]instanceof OfficeSpace&&(a+=this.offices[r].process(e,{industry:this,corporation:n}));this.thisCycleExpenses=this.thisCycleExpenses.plus(a),this.processMaterialMarket(e),this.processProductMarket(e),this.popularity-=1e-4*e,this.popularity=Math.max(0,this.popularity);var i=n.getDreamSenseGain(),o=4*i;return void(i>0&&(this.popularity+=i*e,this.awareness+=o*e))}let s=this.processMaterials(e,n);Array.isArray(s)&&(this.thisCycleRevenue=this.thisCycleRevenue.plus(s[0]),this.thisCycleExpenses=this.thisCycleExpenses.plus(s[1])),s=this.processProducts(e,n),Array.isArray(s)&&(this.thisCycleRevenue=this.thisCycleRevenue.plus(s[0]),this.thisCycleExpenses=this.thisCycleExpenses.plus(s[1]))},Industry.prototype.processMaterialMarket=function(){for(var e=this.reqMats,t=this.prodMats,n=0;n0&&(r.qty+=a,expenses+=a*r.bCost)}(matName,this),this.updateWarehouseSizeUsed(warehouse));break;case"PRODUCTION":if(warehouse.smartSupplyStore=0,this.prodMats.length>0){var mat=warehouse.materials[this.prodMats[0]],maxProd=this.getOfficeProductivity(office)*this.prodMult*company.getProductionMultiplier()*this.getProductionMultiplier();let e;e=mat.prdman[0]?Math.min(maxProd,mat.prdman[1]):maxProd,e*=SecsPerMarketCycle*marketCycles;var totalMatSize=0;for(let e=0;e0){var maxAmt=Math.floor((warehouse.size-warehouse.sizeUsed)/totalMatSize);e=Math.min(maxAmt,e)}e<0&&(e=0),warehouse.smartSupplyStore+=e/(SecsPerMarketCycle*marketCycles);var producableFrac=1;for(var reqMatName in this.reqMats)if(this.reqMats.hasOwnProperty(reqMatName)){var req=this.reqMats[reqMatName]*e;warehouse.materials[reqMatName].qty0&&e>0){for(const t in this.reqMats){var reqMatQtyNeeded=this.reqMats[t]*e*producableFrac;warehouse.materials[t].qty-=reqMatQtyNeeded,warehouse.materials[t].prd=0,warehouse.materials[t].prd-=reqMatQtyNeeded/(SecsPerMarketCycle*marketCycles)}for(let t=0;tmat.bCost?sCost-mat.bCost>markupLimit&&(markup=Math.pow(markupLimit/(sCost-mat.bCost),2)):sCost=0?(mat.qty-=sellAmt,revenue+=sellAmt*sCost,mat.sll=sellAmt/(SecsPerMarketCycle*marketCycles)):mat.sll=0}break;case"EXPORT":for(var matName in warehouse.materials)if(warehouse.materials.hasOwnProperty(matName)){var mat=warehouse.materials[matName];mat.totalExp=0;for(var expI=0;expI=expWarehouse.size)return[0,0];var maxAmt=Math.floor((expWarehouse.size-expWarehouse.sizeUsed)/_MaterialSizes__WEBPACK_IMPORTED_MODULE_7__.MaterialSizes[matName]);amt=Math.min(maxAmt,amt),expWarehouse.materials[matName].imp+=amt/(SecsPerMarketCycle*marketCycles),expWarehouse.materials[matName].qty+=amt,expWarehouse.materials[matName].qlt=mat.qlt,mat.qty-=amt,mat.totalExp+=amt,expIndustry.updateWarehouseSizeUsed(expWarehouse);break}}}mat.totalExp/=SecsPerMarketCycle*marketCycles}break;case"START":break;default:console.error(`Invalid state: ${this.state}`)}this.updateWarehouseSizeUsed(warehouse)}office instanceof OfficeSpace&&(this.sciResearch.qty+=.004*Math.pow(office.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.RandD],.5)*company.getScientificResearchMultiplier()*this.getScientificResearchMultiplier())}return[revenue,expenses]},Industry.prototype.processProducts=function(e=1,t){var n=0;if("PRODUCTION"===this.state)for(const t in this.products){const n=this.products[t];if(!n.fin){const t=n.createCity,a=this.offices[t],r=a.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Engineer],i=a.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Management],o=a.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Operations],s=r+i+o;if(s<=0)break;const l=1+i/(1.2*s),c=(Math.pow(r,.34)+Math.pow(o,.2))*l;n.createProduct(e,c),n.prog>=100&&n.finishProduct(a.employeeProd,this);break}}for(var a in this.products)if(this.products.hasOwnProperty(a)){var r=this.products[a];r instanceof _Product__WEBPACK_IMPORTED_MODULE_8__.Product&&r.fin&&(n+=this.processProduct(e,r,t))}return[n,0]},Industry.prototype.processProduct=function(marketCycles=1,product,corporation){let totalProfit=0;for(let i=0;i0){var maxAmt=Math.floor((warehouse.size-warehouse.sizeUsed)/netStorageSize);e=Math.min(maxAmt,e)}warehouse.smartSupplyStore+=e/(SecsPerMarketCycle*marketCycles);var producableFrac=1;for(var reqMatName in product.reqMats)if(product.reqMats.hasOwnProperty(reqMatName)){var req=product.reqMats[reqMatName]*e;warehouse.materials[reqMatName].qty0&&e>0){for(var reqMatName in product.reqMats)if(product.reqMats.hasOwnProperty(reqMatName)){var reqMatQtyNeeded=product.reqMats[reqMatName]*e*producableFrac;warehouse.materials[reqMatName].qty-=reqMatQtyNeeded,warehouse.materials[reqMatName].prd-=reqMatQtyNeeded/(SecsPerMarketCycle*marketCycles)}product.data[city][0]+=e*producableFrac}product.data[city][1]=e*producableFrac/(SecsPerMarketCycle*marketCycles);break}case"SALE":{for(var reqMatName in product.pCost=0,product.reqMats)product.reqMats.hasOwnProperty(reqMatName)&&(product.pCost+=product.reqMats[reqMatName]*warehouse.materials[reqMatName].bCost);product.pCost*=ProductProductionCostRatio;const businessFactor=this.getBusinessFactor(office),advertisingFactor=this.getAdvertisingFactors()[0],marketFactor=this.getMarketFactor(product),markupLimit=product.rat/product.mku;var sCost;if(product.marketTa2){const e=product.data[city][1],t=markupLimit,n=e,a=.5*Math.pow(product.rat,.65)*marketFactor*corporation.getSalesMultiplier()*businessFactor*advertisingFactor*this.getSalesMultiplier(),r=Math.sqrt(n/a);let i;0===a||0===r?0===n?i=0:(i=product.pCost+markupLimit,console.warn("In Corporation, found illegal 0s when trying to calculate MarketTA2 sale cost")):i=t/r+product.pCost,product.marketTa2Price[city]=i,sCost=i}else product.marketTa1?sCost=product.pCost+markupLimit:Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_27__.isString)(product.sCost)?(sCost=product.sCost.replace(/MP/g,product.pCost+product.rat/product.mku),sCost=eval(sCost)):sCost=product.sCost;var markup=1;sCost>product.pCost&&sCost-product.pCost>markupLimit&&(markup=markupLimit/(sCost-product.pCost));var maxSell=.5*Math.pow(product.rat,.65)*marketFactor*corporation.getSalesMultiplier()*Math.pow(markup,2)*businessFactor*advertisingFactor*this.getSalesMultiplier(),sellAmt;if(product.sllman[city][0]&&Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_27__.isString)(product.sllman[city][1])){var tmp=product.sllman[city][1].replace(/MAX/g,maxSell);tmp=tmp.replace(/PROD/g,product.data[city][1]);try{tmp=eval(tmp)}catch(e){Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("Error evaluating your sell price expression for "+product.name+" in "+this.name+"'s "+city+" office. Sell price is being set to MAX"),tmp=maxSell}sellAmt=Math.min(maxSell,tmp)}else sellAmt=product.sllman[city][0]&&product.sllman[city][1]>0?Math.min(maxSell,product.sllman[city][1]):!1===product.sllman[city][0]?0:maxSell;sellAmt<0&&(sellAmt=0),sellAmt=sellAmt*SecsPerMarketCycle*marketCycles,sellAmt=Math.min(product.data[city][0],sellAmt),sellAmt&&sCost?(product.data[city][0]-=sellAmt,totalProfit+=sellAmt*sCost,product.data[city][2]=sellAmt/(SecsPerMarketCycle*marketCycles)):product.data[city][2]=0;break}case"START":case"PURCHASE":case"EXPORT":break;default:console.error(`Invalid State: ${this.state}`)}}return totalProfit},Industry.prototype.discontinueProduct=function(e){for(var t in this.products)this.products.hasOwnProperty(t)&&e===this.products[t]&&delete this.products[t]},Industry.prototype.upgrade=function(e,t){for(var n=t.corporation,a=t.office,r=e[0];this.upgrades.length<=r;)this.upgrades.push(0);switch(++this.upgrades[r],r){case 0:for(let e=0;e{if(this.sciResearch.qty>=n.cost)return this.sciResearch.qty-=n.cost,t.research(a[e]),this.researched[a[e]]=!0,Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)(`Researched ${a[e]}. It may take a market cycle `+`(~${SecsPerMarketCycle} seconds) before the effects of `+"the Research apply."),this.createResearchBox();Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)(`You do not have enough Scientific Research for ${n.name}`)}):console.warn(`Could not find Research Tree div for ${r}`)}const r=document.getElementById(`${e}-content`);null!=r&&(Object(_utils_uiHelpers_appendLineBreaks__WEBPACK_IMPORTED_MODULE_21__.appendLineBreaks)(r,2),r.appendChild(Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("pre",{display:"block",innerText:"Multipliers from research:\n"+` * Advertising Multiplier: x${t.getAdvertisingMultiplier()}\n`+` * Employee Charisma Multiplier: x${t.getEmployeeChaMultiplier()}\n`+` * Employee Creativity Multiplier: x${t.getEmployeeCreMultiplier()}\n`+` * Employee Efficiency Multiplier: x${t.getEmployeeEffMultiplier()}\n`+` * Employee Intelligence Multiplier: x${t.getEmployeeIntMultiplier()}\n`+` * Production Multiplier: x${t.getProductionMultiplier()}\n`+` * Sales Multiplier: x${t.getSalesMultiplier()}\n`+` * Scientific Research Multiplier: x${t.getScientificResearchMultiplier()}\n`+` * Storage Multiplier: x${t.getStorageMultiplier()}`})),r.appendChild(Object(_utils_uiHelpers_createPopupCloseButton__WEBPACK_IMPORTED_MODULE_24__.createPopupCloseButton)(researchTreeBox,{class:"std-button",display:"block",innerText:"Close"}))),researchTreeBoxOpened=!0},Industry.prototype.toJSON=function(){return Object(_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_20__.Generic_toJSON)("Industry",this)},Industry.fromJSON=function(e){return Object(_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_20__.Generic_fromJSON)(Industry,e.data)},_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_20__.Reviver.constructors.Industry=Industry,Employee.prototype.process=function(e=1,t){var n=.003*e,a=n*Math.random();this.exp+=n,this.cyclesUntilRaise-=e,this.cyclesUntilRaise<=0&&(this.salary+=EmployeeRaiseAmount,this.cyclesUntilRaise+=CyclesPerEmployeeRaise);var r=n*Math.random();return this.pos===_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Training&&(this.cha+=r,this.exp+=r,this.eff+=r),this.ene-=a,this.hap-=a,this.eneHappiness: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(this.hap,3)+"
Energy: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(this.ene,3)+"
Intelligence: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(i,3)+"
Charisma: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(r,3)+"
Experience: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(this.exp,3)+"
Creativity: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(a,3)+"
Efficiency: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(o,3)+"
Salary: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(this.sal,"$0.000a")+"/ s
"}));var s=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("select",{});for(var l in _EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions)_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.hasOwnProperty(l)&&s.add(Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("option",{text:_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions[l],value:_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions[l]}));s.addEventListener("change",()=>{this.pos=s.options[s.selectedIndex].value});for(var c=0;c=this.size},OfficeSpace.prototype.process=function(e=1,t){var n=t.industry;if(n.hasResearch("HRBuddy-Recruitment")&&!this.atCapacity()){const e=this.hireRandomEmployee();n.hasResearch("HRBuddy-Training")&&(e.pos=_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Training)}this.maxEne=100,this.maxHap=100,this.maxMor=100,n.hasResearch("Go-Juice")&&(this.maxEne+=10),n.hasResearch("JoyWire")&&(this.maxHap+=10),n.hasResearch("Sti.mu")&&(this.maxMor+=10);var a=1;n.funds<0&&n.lastCycleRevenue<0?a=Math.pow(.99,e):n.funds>0&&n.lastCycleRevenue>0&&(a=Math.pow(1.01,e));const r=n.hasResearch("AutoBrew"),i=n.hasResearch("AutoPartyManager");var o=0;for(let t=0;tCharisma: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(t.cha,1)+"
Experience: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(t.exp,1)+"
Creativity: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(t.cre,1)+"
Efficiency: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(t.eff,1)+"
Salary: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(t.sal,"$0.000a")+" s
",clickListener:()=>(n.hireEmployee(t,e),Object(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__.removeElementById)("cmpy-mgmt-hire-employee-popup"),!1)})},_=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("a",{class:"a-link-button",innerText:"Cancel",float:"right",clickListener:()=>(Object(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__.removeElementById)("cmpy-mgmt-hire-employee-popup"),!1)}),g=[d,h(u,this),h(m,this),h(p,this),_];Object(_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_23__.createPopup)("cmpy-mgmt-hire-employee-popup",g)}},OfficeSpace.prototype.hireEmployee=function(e,t){var n=t.corporation,a=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoTxtInpBoxGetYesButton)(),r=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoTxtInpBoxGetNoButton)();a.innerHTML="Hire",r.innerHTML="Cancel",a.addEventListener("click",()=>{for(var t=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoTxtInpBoxGetInput)(),a=0;aObject(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoTxtInpBoxClose)()),Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoTxtInpBoxCreate)("Give your employee a nickname!")},OfficeSpace.prototype.hireRandomEmployee=function(){if(!this.atCapacity()&&null==document.getElementById("cmpy-mgmt-hire-employee-popup")){var e=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(76,100)/100,t=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),n=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),a=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),r=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),i=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),o=new Employee({intelligence:t*e,charisma:n*e,experience:a*e,creativity:r*e,efficiency:i*e,salary:EmployeeSalaryMultiplier*(t+n+a+r+i)*e}),s=Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.generateRandomString)(7);for(let e=0;e=CyclesPerIndustryStateCycle){const e=this.getState(),t=1,n=t*CyclesPerIndustryStateCycle;if(this.storedCycles-=n,this.divisions.forEach(n=>{n.process(t,e,this)}),this.shareSaleCooldown>0&&(this.shareSaleCooldown-=n),this.issueNewSharesCooldown>0&&(this.issueNewSharesCooldown-=n),"START"===e){this.revenue=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.expenses=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.divisions.forEach(e=>{e.lastCycleRevenue!==-1/0&&e.lastCycleRevenue!==1/0&&e.lastCycleExpenses!==-1/0&&e.lastCycleExpenses!==1/0&&(this.revenue=this.revenue.plus(e.lastCycleRevenue),this.expenses=this.expenses.plus(e.lastCycleExpenses))});const e=this.revenue.minus(this.expenses).times(t*SecsPerMarketCycle);if(isNaN(this.funds)&&(Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("There was an error calculating your Corporations funds and they got reset to 0. This is a bug. Please report to game developer.

(Your funds have been set to $150b for the inconvenience)"),this.funds=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(15e10)),this.dividendPercentage>0&&e>0)if(isNaN(this.dividendPercentage)||this.dividendPercentage<0||this.dividendPercentage>DividendMaxPercentage)console.error(`Invalid Corporation dividend percentage: ${this.dividendPercentage}`);else{const t=this.dividendPercentage/100*e,n=e-t,a=t/this.totalShares,r=this.numShares*a*(1-this.dividendTaxPercentage/100);_Player__WEBPACK_IMPORTED_MODULE_15__.Player.gainMoney(r),_Player__WEBPACK_IMPORTED_MODULE_15__.Player.recordMoneySource(r,"corporation"),this.funds=this.funds.plus(n)}else this.funds=this.funds.plus(e);this.updateSharePrice()}this.state.nextState(),_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__.routing.isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__.Page.Corporation)&&this.rerender()}},Corporation.prototype.determineValuation=function(){var e,t=this.revenue.minus(this.expenses).toNumber();return this.public?(this.dividendPercentage>0&&(t*=(100-this.dividendPercentage)/100),e=this.funds.toNumber()+85e3*t,e*=Math.pow(1.1,this.divisions.length),e=Math.max(e,0)):(e=1e10+Math.max(this.funds.toNumber(),0)/3,t>0?(e+=315e3*t,e*=Math.pow(1.1,this.divisions.length)):e=1e10*Math.pow(1.1,this.divisions.length),e-=e%1e6),e*_BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_11__.BitNodeMultipliers.CorporationValuation},Corporation.prototype.getInvestment=function(){var e,t=this.determineValuation();let n=4;switch(this.fundingRound){case 0:e=.1,n=4;break;case 1:e=.35,n=3;break;case 2:e=.25,n=3;break;case 3:e=.2,n=2.5;break;case 4:return}var a=t*e*n,r=Math.floor(INITIALSHARES*e),i=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoBoxGetYesButton)(),o=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoBoxGetNoButton)();i.innerHTML="Accept",o.innerHML="Reject",i.addEventListener("click",()=>(++this.fundingRound,this.funds=this.funds.plus(a),this.numShares-=r,this.rerender(),Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoBoxClose)())),o.addEventListener("click",()=>Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoBoxClose)()),Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoBoxCreate)("An investment firm has offered you "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(a,"$0.000a")+" in funding in exchange for a "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(100*e,"0.000a")+"% stake in the company ("+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(r,"0.000a")+" shares).

Do you accept or reject this offer?

Hint: Investment firms will offer more money if your corporation is turning a profit")},Corporation.prototype.goPublic=function(){var e,t=this.determineValuation()/this.totalShares,n=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("p",{innerHTML:"Enter the number of shares you would like to issue for your IPO. These shares will be publicly sold and you will no longer own them. Your Corporation will receive "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(t,"$0.000a")+" per share (the IPO money will be deposited directly into your Corporation's funds).

You have a total of "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(this.numShares,"0.000a")+" of shares that you can issue."}),a=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("input",{type:"number",placeholder:"Shares to issue",onkeyup:t=>{t.preventDefault(),t.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_28__.KEY.ENTER&&e.click()}}),r=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("br",{});e=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("a",{class:"a-link-button",innerText:"Go Public",clickListener:()=>{var e=Math.round(a.value),t=this.determineValuation()/this.totalShares;return isNaN(e)?(Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("Invalid value for number of issued shares"),!1):e>this.numShares?(Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("Error: You don't have that many shares to issue!"),!1):(this.public=!0,this.sharePrice=t,this.issuedShares=e,this.numShares-=e,this.funds=this.funds.plus(e*t),this.rerender(),Object(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__.removeElementById)("cmpy-mgmt-go-public-popup"),Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)(`You took your ${this.name} public and earned `+`${_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.formatMoney(e*t)} in your IPO`),!1)}});var i=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("a",{class:"a-link-button",innerText:"Cancel",clickListener:()=>(Object(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__.removeElementById)("cmpy-mgmt-go-public-popup"),!1)});Object(_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_23__.createPopup)("cmpy-mgmt-go-public-popup",[n,r,a,e,i])},Corporation.prototype.getTargetSharePrice=function(){return this.determineValuation()/(2*(this.totalShares-this.numShares)+1)},Corporation.prototype.updateSharePrice=function(){const e=this.getTargetSharePrice();this.sharePrice<=e?this.sharePrice*=1+.01*Math.random():this.sharePrice*=1-.01*Math.random(),this.sharePrice<=.01&&(this.sharePrice=.01)},Corporation.prototype.immediatelyUpdateSharePrice=function(){this.sharePrice=this.getTargetSharePrice()},Corporation.prototype.calculateShareSale=function(e){let t=e,n=this.shareSalesUntilPriceUpdate,a=this.sharePrice,r=0,i=0;const o=Math.ceil(e/SHARESPERPRICEUPDATE);if(!(isNaN(o)||o>1e7)){for(let e=0;e3600?`${Math.floor(t/3600)} hour(s)`:t>60?`${Math.floor(t/60)} minute(s)`:`${Math.floor(t)} second(s)`},Corporation.prototype.unlock=function(e){const t=e[0],n=e[1];for(;this.unlockUpgrades.length<=t;)this.unlockUpgrades.push(0);this.funds.lt(n)?Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("You don't have enough funds to unlock this!"):(this.unlockUpgrades[t]=1,this.funds=this.funds.minus(n),5===t?this.dividendTaxPercentage-=5:6===t&&(this.dividendTaxPercentage-=10))},Corporation.prototype.upgrade=function(e){for(var t=e[0],n=e[1],a=e[2],r=e[3];this.upgrades.length<=t;)this.upgrades.push(0);for(;this.upgradeMultipliers.length<=t;)this.upgradeMultipliers.push(1);var i=n*Math.pow(a,this.upgrades[t]);if(this.funds.lt(i))Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("You don't have enough funds to purchase this!");else if(++this.upgrades[t],this.funds=this.funds.minus(i),this.upgradeMultipliers[t]=1+this.upgrades[t]*r,1===t)for(var o=0;oh.Start&&(_.currStep-=1);f()}(),!1}),Object(c.clearEventListeners)("interactive-tutorial-next").addEventListener("click",function(){return y(),!1}),f()}function f(){if(!_.isRunning)return;const e=Object(c.clearEventListeners)("terminal-menu-link"),t=Object(c.clearEventListeners)("stats-menu-link"),n=Object(c.clearEventListeners)("active-scripts-menu-link"),r=Object(c.clearEventListeners)("hacknet-nodes-menu-link"),i=Object(c.clearEventListeners)("city-menu-link"),o=Object(c.clearEventListeners)("tutorial-menu-link");e.removeAttribute("class"),t.removeAttribute("class"),n.removeAttribute("class"),r.removeAttribute("class"),i.removeAttribute("class"),o.removeAttribute("class");const s=document.getElementById("interactive-tutorial-next");switch(_.currStep){case h.Start:a.Engine.loadTerminalContent(),v("Welcome to Bitburner, a cyberpunk-themed incremental RPG! The game takes place in a dark, dystopian future... The year is 2077...

This tutorial will show you the basics of the game. You may skip the tutorial at any time."),s.style.display="inline-block";break;case h.GoToCharacterPage:a.Engine.loadTerminalContent(),v("Let's start by heading to the Stats page. Click the Stats tab on the main navigation menu (left-hand side of the screen)"),s.style.display="none",t.setAttribute("class","flashing-button"),t.addEventListener("click",function(){return a.Engine.loadCharacterContent(),y(),!1});break;case h.CharacterPage:a.Engine.loadCharacterContent(),v("The Stats page shows a lot of important information about your progress, such as your skills, money, and bonuses. "),s.style.display="inline-block";break;case h.CharacterGoToTerminalPage:a.Engine.loadCharacterContent(),v("Let's head to your computer's terminal by clicking the Terminal tab on the main navigation menu."),s.style.display="none",e.setAttribute("class","flashing-button"),e.addEventListener("click",function(){return a.Engine.loadTerminalContent(),y(),!1});break;case h.TerminalIntro:a.Engine.loadTerminalContent(),v("The Terminal is used to interface with your home computer as well as all of the other machines around the world."),s.style.display="inline-block";break;case h.TerminalHelp:a.Engine.loadTerminalContent(),v("Let's try it out. Start by entering the help command into the Terminal (Don't forget to press Enter after typing the command)"),s.style.display="none";break;case h.TerminalLs:a.Engine.loadTerminalContent(),v("The help command displays a list of all available Terminal commands, how to use them, and a description of what they do.

Let's try another command. Enter the ls command."),s.style.display="none";break;case h.TerminalScan:a.Engine.loadTerminalContent(),v(" ls is a basic command that shows files on the computer. Right now, it shows that you have a program called NUKE.exe on your computer. We'll get to what this does later.

Using your home computer's terminal, you can connect to other machines throughout the world. Let's do that now by first entering the scan command."),s.style.display="none";break;case h.TerminalScanAnalyze1:a.Engine.loadTerminalContent(),v("The scan command shows all available network connections. In other words, it displays a list of all servers that can be connected to from your current machine. A server is identified by its hostname.

That's great and all, but there's so many servers. Which one should you go to? The scan-analyze command gives some more detailed information about servers on the network. Try it now!"),s.style.display="none";break;case h.TerminalScanAnalyze2:a.Engine.loadTerminalContent(),v("You just ran scan-analyze with a depth of one. This command shows more detailed information about each server that you can connect to (servers that are a distance of one node away).

It is also possible to run scan-analyze with a higher depth. Let's try a depth of two with the following command: scan-analyze 2."),s.style.display="none";break;case h.TerminalConnect:a.Engine.loadTerminalContent(),v("Now you can see information about all servers that are up to two nodes away, as well as figure out how to navigate to those servers through the network. You can only connect to a server that is one node away. To connect to a machine, use the connect [hostname] command.

From the results of the scan-analyze command, we can see that the n00dles server is only one node away. Let's connect so it now using: connect n00dles"),s.style.display="none";break;case h.TerminalAnalyze:a.Engine.loadTerminalContent(),v("You are now connected to another machine! What can you do now? You can hack it!

In the year 2077, currency has become digital and decentralized. People and corporations store their money on servers and computers. Using your hacking abilities, you can hack servers to steal money and gain experience.

Before you try to hack a server, you should run diagnostics using the analyze command."),s.style.display="none";break;case h.TerminalNuke:a.Engine.loadTerminalContent(),v("When the analyze command finishes running it will show useful information about hacking the server.

For this server, the required hacking skill is only 1, which means you can hack it right now. However, in order to hack a server you must first gain root access. The NUKE.exe program that we saw earlier on your home computer is a virus that will grant you root access to a machine if there are enough open ports.

The analyze results shows that there do not need to be any open ports on this machine for the NUKE virus to work, so go ahead and run the virus using the run NUKE.exe command."),s.style.display="none";break;case h.TerminalManualHack:a.Engine.loadTerminalContent(),v("You now have root access! You can hack the server using the hack command. Try doing that now."),s.style.display="none";break;case h.TerminalHackingMechanics:a.Engine.loadTerminalContent(),v("You are now attempting to hack the server. Performing a hack takes time and only has a certain percentage chance of success. This time and success chance is determined by a variety of factors, including your hacking skill and the server's security level.

If your attempt to hack the server is successful, you will steal a certain percentage of the server's total money. This percentage is affected by your hacking skill and the server's security level.

The amount of money on a server is not limitless. So, if you constantly hack a server and deplete its money, then you will encounter diminishing returns in your hacking."),s.style.display="inline-block";break;case h.TerminalCreateScript:a.Engine.loadTerminalContent(),v("Hacking is the core mechanic of the game and is necessary for progressing. However, you don't want to be hacking manually the entire time. You can automate your hacking by writing scripts!

To create a new script or edit an existing one, you can use the nano command. Scripts must end with the .script extension. Let's make a script now by entering nano n00dles.script after the hack command finishes running (Sidenote: Pressing ctrl + c will end a command like hack early)"),s.style.display="none";break;case h.TerminalTypeScript:a.Engine.loadScriptEditorContent("n00dles.script",""),v("This is the script editor. You can use it to program your scripts. Scripts are written in a simplified version of javascript. Copy and paste the following code into the script editor:

while(true) {\n  hack('n00dles');\n}
For anyone with basic programming experience, this code should be straightforward. This script will continuously hack the n00dles server.

To save and close the script editor, press the button in the bottom left, or press ctrl + b."),s.style.display="none";break;case h.TerminalFree:a.Engine.loadTerminalContent(),v("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be run on any machine which you have root access to. Different servers have different amounts of RAM. You can also purchase more RAM for your home server.

To check how much RAM is available on this machine, enter the free command."),s.style.display="none";break;case h.TerminalRunScript:a.Engine.loadTerminalContent(),v("We have 4GB of free RAM on this machine, which is enough to run our script. Let's run our script using run n00dles.script."),s.style.display="none";break;case h.TerminalGoToActiveScriptsPage:a.Engine.loadTerminalContent(),v("Your script is now running! It will continuously run in the background and will automatically stop if the code ever completes (the n00dles.script will never complete because it runs an infinite loop).

These scripts can passively earn you income and hacking experience. Your scripts will also earn money and experience while you are offline, although at a slightly slower rate.

Let's check out some statistics for our running scripts by clicking the Active Scripts link in the main navigation menu."),s.style.display="none",n.setAttribute("class","flashing-button"),n.addEventListener("click",function(){return a.Engine.loadActiveScriptsContent(),y(),!1});break;case h.ActiveScriptsPage:a.Engine.loadActiveScriptsContent(),v("This page displays information about all of your scripts that are running across every server. You can use this to gauge how well your scripts are doing. Let's go back to the Terminal"),s.style.display="none",e.setAttribute("class","flashing-button"),e.addEventListener("click",function(){return a.Engine.loadTerminalContent(),y(),!1});break;case h.ActiveScriptsToTerminal:a.Engine.loadTerminalContent(),v("One last thing about scripts, each active script contains logs that detail what it's doing. We can check these logs using the tail command. Do that now for the script we just ran by typing tail n00dles.script"),s.style.display="none";break;case h.TerminalTailScript:a.Engine.loadTerminalContent(),v("The log for this script won't show much right now (it might show nothing at all) because it just started running...but check back again in a few minutes!

This covers the basics of hacking. To learn more about writing scripts, select the Tutorial link in the main navigation menu to look at the documentation. If you are an experienced JavaScript developer, I would highly suggest you check out the section on NetscriptJS/Netscript 2.0, it's faster and more powerful.

For now, let's move on to something else!"),s.style.display="inline-block";break;case h.GoToHacknetNodesPage:a.Engine.loadTerminalContent(),v("Hacking is not the only way to earn money. One other way to passively earn money is by purchasing and upgrading Hacknet Nodes. Let's go to the Hacknet page through the main navigation menu now."),s.style.display="none",r.setAttribute("class","flashing-button"),r.addEventListener("click",function(){return a.Engine.loadHacknetNodesContent(),y(),!1});break;case h.HacknetNodesIntroduction:a.Engine.loadHacknetNodesContent(),v("here you can purchase new Hacknet Nodes and upgrade your existing ones. Let's purchase a new one now."),s.style.display="none";break;case h.HacknetNodesGoToWorldPage:a.Engine.loadHacknetNodesContent(),v("You just purchased a Hacknet Node! This Hacknet Node will passively earn you money over time, both online and offline. When you get enough money, you can upgrade your newly-purchased Hacknet Node below.

Let's go to the City page through the main navigation menu."),s.style.display="none",i.setAttribute("class","flashing-button"),i.addEventListener("click",function(){return a.Engine.loadLocationContent(),y(),!1});break;case h.WorldDescription:a.Engine.loadLocationContent(),v("This page lists all of the different locations you can currently travel to. Each location has something that you can do. There's a lot of content out in the world, make sure you explore and discover!

Lastly, click on the Tutorial link in the main navigation menu."),s.style.display="none",o.setAttribute("class","flashing-button"),o.addEventListener("click",function(){return a.Engine.loadTutorialContent(),y(),!1});break;case h.TutorialPageInfo:a.Engine.loadTutorialContent(),v("This page contains a lot of different documentation about the game's content and mechanics. I know it's a lot, but I highly suggest you read (or at least skim) through this before you start playing. That's the end of the tutorial. Hope you enjoy the game!"),s.style.display="inline-block",s.innerHTML="Finish Tutorial";break;case h.End:b();break;default:throw new Error("Invalid tutorial step")}!0===_.stepIsDone[_.currStep]&&(s.style.display="inline-block")}function y(){_.currStep===h.GoToCharacterPage&&document.getElementById("stats-menu-link").removeAttribute("class"),_.currStep===h.CharacterGoToTerminalPage&&document.getElementById("terminal-menu-link").removeAttribute("class"),_.currStep===h.TerminalGoToActiveScriptsPage&&document.getElementById("active-scripts-menu-link").removeAttribute("class"),_.currStep===h.ActiveScriptsPage&&document.getElementById("terminal-menu-link").removeAttribute("class"),_.currStep===h.GoToHacknetNodesPage&&document.getElementById("hacknet-nodes-menu-link").removeAttribute("class"),_.currStep===h.HacknetNodesGoToWorldPage&&document.getElementById("city-menu-link").removeAttribute("class"),_.currStep===h.WorldDescription&&document.getElementById("tutorial-menu-link").removeAttribute("class"),_.stepIsDone[_.currStep]=!0,_.currStep
Getting Started GuideDocumentation

The Beginner's Guide to Hacking was added to your home computer! It contains some tips/pointers for starting out with the game. To read it, go to Terminal and enter

cat "+s.LiteratureNames.HackersStartingHandbook}),n=Object(u.createElement)("a",{class:"a-link-button",float:"right",padding:"6px",innerText:"Got it!",clickListener:()=>{Object(p.removeElementById)(e)}});Object(m.createPopup)(e,[t,n]),r.Player.getHomeComputer().messages.push(s.LiteratureNames.HackersStartingHandbook)}let E=null;function v(e){E.innerHTML=e,E.parentElement.scrollTop=0}!function(){document.addEventListener("DOMContentLoaded",function e(){E=document.getElementById("interactive-tutorial-text"),document.removeEventListener("DOMContentLoaded",e)})}()},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clearEventListeners=void 0;const a=n(193);t.clearEventListeners=function(e){try{let t;const n=(t="string"==typeof e?a.getElementById(e):e).cloneNode(!0);return null!==t.parentNode&&t.parentNode.replaceChild(n,t),n}catch(e){return console.error(e),null}}},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&a(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.displayStockMarketContent=t.processStockPrices=t.stockMarketCycle=t.initSymbolToStockMap=t.initStockMarket=t.deleteStockMarket=t.loadStockMarket=t.cancelOrder=t.placeOrder=t.SymbolToStockMap=t.StockMarket=void 0;const o=n(175),s=n(986),l=n(985),c=n(194),u=n(984),m=n(983),p=n(117),d=n(105),h=n(285),_=n(982),g=n(10),f=n(1),y=n(486),b=n(19),E=n(3),v=n(11),k=n(27),C=i(n(0)),P=i(n(24));function S(e,n,a,r,i,o=null){if(!(e instanceof c.Stock))return o?o.log("placeOrder",`Invalid stock: '${e}'`):v.dialogBoxCreate("ERROR: Invalid stock passed to placeOrder() function"),!1;if("number"!=typeof n||"number"!=typeof a)return o?o.log("placeOrder",`Invalid arguments: shares='${n}' price='${a}'`):v.dialogBoxCreate("ERROR: Invalid numeric value provided for either 'shares' or 'price' argument"),!1;const u=new s.Order(e.symbol,n,a,r,i);if(null==t.StockMarket.Orders){const e={};for(const n in t.StockMarket){const a=t.StockMarket[n];a instanceof c.Stock&&(e[a.symbol]=[])}t.StockMarket.Orders=e}t.StockMarket.Orders[e.symbol].push(u);const m={rerenderFn:D,stockMarket:t.StockMarket,symbolToStockMap:t.SymbolToStockMap};return l.processOrders(e,u.type,u.pos,m),D(),!0}function O(e,n=null){if(null==t.StockMarket.Orders)return!1;if(e.order&&e.order instanceof s.Order){const n=e.order,a=t.StockMarket.Orders[n.stockSymbol];for(let e=0;e=n.cap&&(i=.1,n.b=!1),isNaN(i)&&(i=.5);const o=Math.random(),s={rerenderFn:D,stockMarket:t.StockMarket,symbolToStockMap:t.SymbolToStockMap};o1?1:i<0?0:i},t.calculateHackingExpGain=function(e,t){null==e.baseDifficulty&&(e.baseDifficulty=e.hackDifficulty);let n=3;return(n+=e.baseDifficulty*t.hacking_exp_mult*.3)*a.BitNodeMultipliers.HackExpGain},t.calculatePercentMoneyHacked=function(e,t){const n=(100-e.hackDifficulty)/100*((t.hacking_skill-(e.requiredHackingSkill-1))/t.hacking_skill)*t.hacking_money_mult/240;return n<0?0:n>1?1:n*a.BitNodeMultipliers.ScriptHackMoney},t.calculateHackingTime=i,t.calculateGrowTime=function(e,t){return 3.2*i(e,t)},t.calculateWeakenTime=function(e,t){return 4*i(e,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompanyPositions=void 0;const a=n(1219),r=n(287);t.CompanyPositions={},a.companyPositionMetadata.forEach(e=>{!function(e){null!=t.CompanyPositions[e.name]&&console.warn(`Duplicate Company Position being defined: ${e.name}`),t.CompanyPositions[e.name]=new r.CompanyPosition(e)}(e)})},,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isString=void 0,t.isString=function(e){return"string"==typeof e||e instanceof String}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OwnedAugmentationsOrderSetting=t.PurchaseAugmentationsOrderSetting=t.EditorSetting=t.CodeMirrorThemeSetting=t.CodeMirrorKeybindingSetting=t.AceKeybindingSetting=void 0,function(e){e.Ace="ace",e.Emacs="emacs",e.Vim="vim"}(t.AceKeybindingSetting||(t.AceKeybindingSetting={})),function(e){e.Default="default",e.Emacs="emacs",e.Sublime="sublime",e.Vim="vim"}(t.CodeMirrorKeybindingSetting||(t.CodeMirrorKeybindingSetting={})),function(e){e.Monokai="monokai",e.Day_3024="3024-day",e.Night_3024="3024-night",e.abcdef="abcdef",e.Ambiance_mobile="ambiance-mobile",e.Ambiance="ambiance",e.Base16_dark="base16-dark",e.Base16_light="base16-light",e.Bespin="bespin",e.Blackboard="blackboard",e.Cobalt="cobalt",e.Colorforth="colorforth",e.Darcula="darcula",e.Dracula="dracula",e.Duotone_dark="duotone-dark",e.Duotone_light="duotone-light",e.Eclipse="eclipse",e.Elegant="elegant",e.Erlang_dark="erlang-dark",e.Gruvbox_dark="gruvbox-dark",e.Hopscotch="hopscotch",e.Icecoder="icecoder",e.Idea="idea",e.Isotope="isotope",e.Lesser_dark="lesser-dark",e.Liquibyte="liquibyte",e.Lucario="lucario",e.Material="material",e.Mbo="mbo",e.Mdn_like="mdn-like",e.Midnight="midnight",e.Neat="neat",e.Neo="neo",e.Night="night",e.Oceanic_next="oceanic-next",e.Panda_syntax="panda-syntax",e.Paraiso_dark="paraiso-dark",e.Paraiso_light="paraiso-light",e.Pastel_on_dark="pastel-on-dark",e.Railscasts="railscasts",e.Rubyblue="rubyblue",e.Seti="seti",e.Shadowfox="shadowfox",e.Solarized="solarized",e.SolarizedDark="solarized dark",e.ssms="ssms",e.The_matrix="the-matrix",e.Tomorrow_night_bright="tomorrow-night-bright",e.Tomorrow_night_eighties="tomorrow-night-eighties",e.Ttcn="ttcn",e.Twilight="twilight",e.Vibrant_ink="vibrant-ink",e.xq_dark="xq-dark",e.xq_light="xq-light",e.Yeti="yeti",e.Zenburn="zenburn"}(t.CodeMirrorThemeSetting||(t.CodeMirrorThemeSetting={})),function(e){e.Ace="Ace",e.CodeMirror="CodeMirror"}(t.EditorSetting||(t.EditorSetting={})),function(e){e[e.Cost=0]="Cost",e[e.Default=1]="Default",e[e.Reputation=2]="Reputation"}(t.PurchaseAugmentationsOrderSetting||(t.PurchaseAugmentationsOrderSetting={})),function(e){e[e.Alphabetically=0]="Alphabetically",e[e.AcquirementTime=1]="AcquirementTime"}(t.OwnedAugmentationsOrderSetting||(t.OwnedAugmentationsOrderSetting={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PartTimeCompanyPositions=t.BusinessConsultantCompanyPositions=t.SoftwareConsultantCompanyPositions=t.MiscCompanyPositions=t.AgentCompanyPositions=t.SecurityCompanyPositions=t.BusinessCompanyPositions=t.NetworkEngineerCompanyPositions=t.SecurityEngineerCompanyPositions=t.ITCompanyPositions=t.SoftwareCompanyPositions=void 0,t.SoftwareCompanyPositions=["Software Engineering Intern","Junior Software Engineer","Senior Software Engineer","Lead Software Developer","Head of Software","Head of Engineering","Vice President of Technology","Chief Technology Officer"],t.ITCompanyPositions=["IT Intern","IT Analyst","IT Manager","Systems Administrator"],t.SecurityEngineerCompanyPositions=["Security Engineer"],t.NetworkEngineerCompanyPositions=["Network Engineer","Network Administrator"],t.BusinessCompanyPositions=["Business Intern","Business Analyst","Business Manager","Operations Manager","Chief Financial Officer","Chief Executive Officer"],t.SecurityCompanyPositions=["Police Officer","Police Chief","Security Guard","Security Officer","Security Supervisor","Head of Security"],t.AgentCompanyPositions=["Field Agent","Secret Agent","Special Operative"],t.MiscCompanyPositions=["Waiter","Employee"],t.SoftwareConsultantCompanyPositions=["Software Consultant","Senior Software Consultant"],t.BusinessConsultantCompanyPositions=["Business Consultant","Senior Business Consultant"],t.PartTimeCompanyPositions=["Part-time Waiter","Part-time Employee"]},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&a(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.StdButton=void 0;const o=i(n(0));t.StdButton=function(e){const t=null!=e.tooltip&&""!==e.tooltip;let n,a=e.disabled?"std-button-disabled":"std-button";if(t&&(a+=" tooltip"),"string"==typeof e.addClasses&&(a+=` ${e.addClasses}`),t)if("string"==typeof e.tooltip){const t={__html:e.tooltip};n=o.createElement("span",{className:"tooltiptext",dangerouslySetInnerHTML:t})}else n=o.createElement("span",{className:"tooltiptext"},e.tooltip);return o.createElement("button",{className:a,id:e.id,onClick:e.onClick,style:e.style},e.text,t&&n)}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&a(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Reputation=void 0;const o=i(n(0)),s=n(3);t.Reputation=function(e){return o.createElement("span",{className:"reputation samefont"},"number"==typeof e?s.numeralWrapper.formatReputation(e):e)}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createPopupCloseButton=void 0;const a=n(12),r=n(165);t.createPopupCloseButton=function(e,t){const n=a.createElement("button",{class:t.class?t.class:"popup-box-button",display:t.display?t.display:"inline-block",innerText:null==t.innerText?"Cancel":t.innerText});function i(e){27===e.keyCode&&n.click()}return n.addEventListener("click",()=>{if(e instanceof Element)r.removeElement(e);else try{const t=document.getElementById(e);t instanceof Element&&r.removeElement(t)}catch(e){console.error(`createPopupCloseButton() threw: ${e}`)}return document.removeEventListener("keydown",i),!1}),document.addEventListener("keydown",i),n}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isScriptFilename=void 0,t.isScriptFilename=function(e){return e.endsWith(".js")||e.endsWith(".script")||e.endsWith(".ns")}},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var a=n(0);const r=n.n(a).a.Component;class i extends r{corp(){return this.props.corp}eventHandler(){return this.props.eventHandler}routing(){return this.props.routing}}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createOptionElement=void 0;const a=n(12);t.createOptionElement=function(e,t=""){let n=t;return""===n&&(n=e),a.createElement("option",{text:e,value:n})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.substituteAliases=t.removeAlias=t.parseAliasDeclaration=t.printAliases=t.loadGlobalAliases=t.loadAliases=t.GlobalAliases=t.Aliases=void 0;const a=n(7);function r(e){return t.Aliases.hasOwnProperty(e)?t.Aliases[e]:null}function i(e){return t.GlobalAliases.hasOwnProperty(e)?t.GlobalAliases[e]:null}t.Aliases={},t.GlobalAliases={},t.loadAliases=function(e){t.Aliases=""===e?{}:JSON.parse(e)},t.loadGlobalAliases=function(e){t.GlobalAliases=""===e?{}:JSON.parse(e)},t.printAliases=function(){for(const e in t.Aliases)t.Aliases.hasOwnProperty(e)&&a.post("alias "+e+"="+t.Aliases[e]);for(const e in t.GlobalAliases)t.GlobalAliases.hasOwnProperty(e)&&a.post("global alias "+e+"="+t.GlobalAliases[e])},t.parseAliasDeclaration=function(e,n=!1){const a=e.match(/^([_|\w|!|%|,|@]+)="(.+)"$/);return null!=a&&3==a.length&&(n?function(e,n){e in t.Aliases&&delete t.Aliases[e],t.GlobalAliases[e]=n.trim()}(a[1],a[2]):function(e,n){e in t.GlobalAliases&&delete t.GlobalAliases[e],t.Aliases[e]=n.trim()}(a[1],a[2]),!0)},t.removeAlias=function(e){return t.Aliases.hasOwnProperty(e)?(delete t.Aliases[e],!0):!!t.GlobalAliases.hasOwnProperty(e)&&(delete t.GlobalAliases[e],!0)},t.substituteAliases=function(e){var t,n;const a=e.split(" ");if(a.length>0){if("unalias"===a[0]||"alias"===a[0])return a.join(" ");let e=!0,o=0;for(;e&&o<10;){o++,e=!1;const s=null===(t=r(a[0]))||void 0===t?void 0:t.split(" ");null!=s&&(e=!0,a.splice(0,1,...s));for(let t=0;t{t.delay=null,n()},e),t.delayResolve=n})}function s(e,t,n=null){var a="";null!=n&&(a=" (Line "+function(e,t){var n=t.scriptRef.codeCode();try{return((n=n.substring(0,e.start)).match(/\n/g)||[]).length+1}catch(e){return-1}}(n,e)+")");const r=i.AllServers[e.serverIp];if(null==r)throw new Error(`WorkerScript constructed with invalid server ip: ${this.serverIp}`);return"|"+r.hostname+"|"+e.name+"|"+t+a}function l(e,t,n){const a=e.scriptRef.threads;if(!n)return isNaN(a)||a<1?1:a;const r=0|n;if(isNaN(n)||r<1)throw s(e,`Invalid thread count passed to ${t}: ${n}. Threads must be a positive number.`);if(n>a)throw s(e,`Too many threads requested by ${t}. Requested: ${n}. Has: ${a}.`);return r}function c(e){if(!Object(r.isString)(e))return!1;return 4==e.split("|").length}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.killWorkerScript=void 0;const a=n(248),r=n(118),i=n(152),o=n(197),s=n(23),l=n(198),c=n(293);function u(e,t=!0){const n=r.workerScripts.get(e);return n instanceof a.WorkerScript&&(m(n,t),!0)}function m(e,t=!0){e.env.stopFlag=!0,function(e){e instanceof a.WorkerScript&&e.delay&&(clearTimeout(e.delay),e.delayResolve&&e.delayResolve())}(e),function(e,t=!0){if(!(e instanceof a.WorkerScript))return console.error("Invalid argument passed into removeWorkerScript():"),void console.error(e);{const n=e.serverIp,a=e.name,o=s.AllServers[n];if(null==o)return void console.error(`Could not find server on which this script is running: ${n}`);o.ramUsed=c.roundToTwo(o.ramUsed-e.ramUsage),o.ramUsed<0&&(console.warn(`Server (${o.hostname}) RAM usage went negative (if it's due to floating pt imprecision, it's okay): ${o.ramUsed}`),o.ramUsed=0);for(let t=0;t0)for(let n=0;n["+(_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_TIMESTAMPS?Object(_utils_helpers_getTimestamp__WEBPACK_IMPORTED_MODULE_37__.getTimestamp)()+" ":"")+_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().hostname+` ~${n}]> ${t}`),t.length>0&&(Terminal.resetTerminalInput(),Terminal.executeCommands(t))}if(e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.C&&e.ctrlKey&&(_engine__WEBPACK_IMPORTED_MODULE_11__.Engine._actionInProgress?(Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40__.post)("Cancelling..."),_engine__WEBPACK_IMPORTED_MODULE_11__.Engine._actionInProgress=!1,Terminal.finishAction(!0)):_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&Terminal.resetTerminalInput()),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.L&&e.ctrlKey&&(e.preventDefault(),Terminal.executeCommand("clear")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.UPARROW||_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.P&&e.ctrlKey){if(_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&e.preventDefault(),null==t)return;var n=Terminal.commandHistoryIndex;if(0==(r=Terminal.commandHistory.length))return;(n<0||n>r)&&(Terminal.commandHistoryIndex=r),0!=n&&--Terminal.commandHistoryIndex;var a=Terminal.commandHistory[Terminal.commandHistoryIndex];t.value=a,Object(_utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_32__.setTimeoutRef)(function(){t.selectionStart=t.selectionEnd=1e4},10)}if(e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.DOWNARROW||_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.M&&e.ctrlKey){if(_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&e.preventDefault(),null==t)return;var r;n=Terminal.commandHistoryIndex;if(0==(r=Terminal.commandHistory.length))return;if((n<0||n>r)&&(Terminal.commandHistoryIndex=r),n==r||n==r-1)Terminal.commandHistoryIndex=r,t.value="";else{++Terminal.commandHistoryIndex;a=Terminal.commandHistory[Terminal.commandHistoryIndex];t.value=a}}if(e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.TAB){if(e.preventDefault(),null==t)return;let n=t.value;if(""==n)return;const a=n.lastIndexOf(";");-1!==a&&(n=n.slice(a+1));const r=(n=(n=n.trim()).replace(/\s\s+/g," ")).split(" ");let i=r.length-2;i<-1&&(i=0);const o=Object(_Terminal_determineAllPossibilitiesForTabCompletion__WEBPACK_IMPORTED_MODULE_1__.determineAllPossibilitiesForTabCompletion)(_Player__WEBPACK_IMPORTED_MODULE_22__.Player,n,i,Terminal.currDir);if(0==o.length)return;let s="",l="";if(0==r.length)return;1==r.length?l=r[0]:2==r.length?(l=r[0],s=r[1]):3==r.length?(l=r[0]+" "+r[1],s=r[2]):(s=r.pop(),l=r.join(" ")),Object(_Terminal_tabCompletion__WEBPACK_IMPORTED_MODULE_3__.tabCompletion)(l,s,o),t.focus()}_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&(e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.A&&e.ctrlKey&&(e.preventDefault(),Terminal.moveTextCursor("home")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.E&&e.ctrlKey&&(e.preventDefault(),Terminal.moveTextCursor("end")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.B&&e.ctrlKey&&(e.preventDefault(),Terminal.moveTextCursor("prevchar")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.B&&e.altKey&&(e.preventDefault(),Terminal.moveTextCursor("prevword")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.F&&e.ctrlKey&&(e.preventDefault(),Terminal.moveTextCursor("nextchar")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.F&&e.altKey&&(e.preventDefault(),Terminal.moveTextCursor("nextword")),e.keyCode!==_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.H&&e.keyCode!==_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.D||!e.ctrlKey||(Terminal.modifyInput("backspace"),e.preventDefault()))}});let terminalCtrlPressed=!1,shiftKeyPressed=!1;$(document).ready(function(){_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__.routing.isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__.Page.Terminal)&&$(".terminal-input").focus()}),$(document).keydown(function(e){if(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__.routing.isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__.Page.Terminal))if(e.which==_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.CTRL)terminalCtrlPressed=!0;else if(e.shiftKey)shiftKeyPressed=!0;else if(terminalCtrlPressed||shiftKeyPressed||Terminal.contractOpen);else{var t=document.getElementById("terminal-input-text-box");null!=t&&t.focus(),terminalCtrlPressed=!1,shiftKeyPressed=!1}}),$(document).keyup(function(e){_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__.routing.isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__.Page.Terminal)&&(e.which==_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__.KEY.CTRL&&(terminalCtrlPressed=!1),e.shiftKey&&(shiftKeyPressed=!1))});let Terminal={hackFlag:!1,backdoorFlag:!1,analyzeFlag:!1,actionStarted:!1,actionTime:0,commandHistory:[],commandHistoryIndex:0,contractOpen:!1,currDir:"/",resetTerminalInput:function(e=!1){let t="";e&&(t=getTerminalInput());const n=Terminal.currDir;_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.WRAP_INPUT?(document.getElementById("terminal-input-td").innerHTML=`
[${_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().hostname} ~${n}]$
`+`",g.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue,e.innerHTML="",g.option=!!e.lastChild}();var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&D(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var be=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,l,c,u,d=t.createDocumentFragment(),h=[],f=0,p=e.length;f-1)i&&i.push(o);else if(c=ae(o),a=ve(d.appendChild(o),"script"),c&&ye(a),n)for(u=0;o=a[u++];)me.test(o.type||"")&&n.push(o);return d}var we=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ke=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function Ae(){return!1}function Se(e,t){return e===function(){try{return b.activeElement}catch(e){}}()==("focus"===t)}function _e(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)_e(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Ae;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function Fe(e,t,n){n?(Z.set(e,t,!1),k.event.add(e,t,{namespace:!1,handler:function(e){var r,i,o=Z.get(this,t);if(1&e.isTrigger&&this[t]){if(o.length)(k.event.special[t]||{}).delegateType&&e.stopPropagation();else if(o=s.call(arguments),Z.set(this,t,o),r=n(this,t),this[t](),o!==(i=Z.get(this,t))||r?Z.set(this,t,!1):i={},o!==i)return e.stopImmediatePropagation(),e.preventDefault(),i.value}else o.length&&(Z.set(this,t,{value:k.event.trigger(k.extend(o[0],k.Event.prototype),o.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Z.get(e,t)&&k.event.add(e,t,Ee)}k.event={global:{},add:function(e,t,n,r,i){var o,a,s,l,c,u,d,h,f,p,m,g=Z.get(e);if(Y(e))for(n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(oe,i),n.guid||(n.guid=k.guid++),(l=g.events)||(l=g.events=Object.create(null)),(a=g.handle)||(a=g.handle=function(t){return void 0!==k&&k.event.triggered!==t.type?k.event.dispatch.apply(e,arguments):void 0}),c=(t=(t||"").match(R)||[""]).length;c--;)f=m=(s=ke.exec(t[c])||[])[1],p=(s[2]||"").split(".").sort(),f&&(d=k.event.special[f]||{},f=(i?d.delegateType:d.bindType)||f,d=k.event.special[f]||{},u=k.extend({type:f,origType:m,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:p.join(".")},o),(h=l[f])||((h=l[f]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(e,r,p,a)||e.addEventListener&&e.addEventListener(f,a)),d.add&&(d.add.call(e,u),u.handler.guid||(u.handler.guid=n.guid)),i?h.splice(h.delegateCount++,0,u):h.push(u),k.event.global[f]=!0)},remove:function(e,t,n,r,i){var o,a,s,l,c,u,d,h,f,p,m,g=Z.hasData(e)&&Z.get(e);if(g&&(l=g.events)){for(c=(t=(t||"").match(R)||[""]).length;c--;)if(f=m=(s=ke.exec(t[c])||[])[1],p=(s[2]||"").split(".").sort(),f){for(d=k.event.special[f]||{},h=l[f=(r?d.delegateType:d.bindType)||f]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=h.length;o--;)u=h[o],!i&&m!==u.origType||n&&n.guid!==u.guid||s&&!s.test(u.namespace)||r&&r!==u.selector&&("**"!==r||!u.selector)||(h.splice(o,1),u.selector&&h.delegateCount--,d.remove&&d.remove.call(e,u));a&&!h.length&&(d.teardown&&!1!==d.teardown.call(e,p,g.handle)||k.removeEvent(e,f,g.handle),delete l[f])}else for(f in l)k.event.remove(e,f+t[c],n,r,!0);k.isEmptyObject(l)&&Z.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),l=k.event.fix(e),c=(Z.get(this,"events")||Object.create(null))[l.type]||[],u=k.event.special[l.type]||{};for(s[0]=l,t=1;t=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==e.type||!0!==c.disabled)){for(o=[],a={},n=0;n-1:k.find(i,this,null,[c]).length),a[i]&&o.push(r);o.length&&s.push({elem:c,handlers:o})}return c=this,l\s*$/g;function Le(e,t){return D(e,"table")&&D(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Be(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Me(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function je(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Z.hasData(e)&&(s=Z.get(e).events))for(i in Z.remove(t,"handle events"),s)for(n=0,r=s[i].length;n1&&"string"==typeof p&&!g.checkClone&&Te.test(p))return e.each(function(i){var o=e.eq(i);m&&(t[0]=p.call(this,i,o.html())),Re(o,t,n,r)});if(h&&(o=(i=xe(t,e[0].ownerDocument,!1,e,r)).firstChild,1===i.childNodes.length&&(i=o),o||r)){for(s=(a=k.map(ve(i,"script"),Be)).length;d0&&ye(a,!l&&ve(e,"script")),s},cleanData:function(e){for(var t,n,r,i=k.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[Z.expando]){if(t.events)for(r in t.events)i[r]?k.event.remove(n,r):k.removeEvent(n,r,t.handle);n[Z.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),k.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return V(this,function(e){return void 0===e?k.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(k.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return k.clone(this,e,t)})},html:function(e){return V(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!De.test(e)&&!ge[(pe.exec(e)||["",""])[1].toLowerCase()]){e=k.htmlPrefilter(e);try{for(;n3,oe.removeChild(e)),s}}))}();var Ue=["Webkit","Moz","ms"],Ge=b.createElement("div").style,Ke={};function qe(e){var t=k.cssProps[e]||Ke[e];return t||(e in Ge?e:Ke[e]=function(e){for(var t=e[0].toUpperCase()+e.slice(1),n=Ue.length;n--;)if((e=Ue[n]+t)in Ge)return e}(e)||e)}var Ye=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ze={position:"absolute",visibility:"hidden",display:"block"},Qe={letterSpacing:"0",fontWeight:"400"};function Je(e,t,n){var r=re.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function et(e,t,n,r,i,o){var a="width"===t?1:0,s=0,l=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(l+=k.css(e,n+ie[a],!0,i)),r?("content"===n&&(l-=k.css(e,"padding"+ie[a],!0,i)),"margin"!==n&&(l-=k.css(e,"border"+ie[a]+"Width",!0,i))):(l+=k.css(e,"padding"+ie[a],!0,i),"padding"!==n?l+=k.css(e,"border"+ie[a]+"Width",!0,i):s+=k.css(e,"border"+ie[a]+"Width",!0,i));return!r&&o>=0&&(l+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-l-s-.5))||0),l}function tt(e,t,n){var r=$e(e),i=(!g.boxSizingReliable()||n)&&"border-box"===k.css(e,"boxSizing",!1,r),o=i,a=He(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Ne.test(a)){if(!n)return a;a="auto"}return(!g.boxSizingReliable()&&i||!g.reliableTrDimensions()&&D(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===k.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===k.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+et(e,t,n||(i?"border":"content"),o,r,a)+"px"}function nt(e,t,n,r,i){return new nt.prototype.init(e,t,n,r,i)}k.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=He(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=q(t),l=Xe.test(t),c=e.style;if(l||(t=qe(s)),a=k.cssHooks[t]||k.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:c[t];"string"===(o=typeof n)&&(i=re.exec(n))&&i[1]&&(n=ce(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||l||(n+=i&&i[3]||(k.cssNumber[s]?"":"px")),g.clearCloneStyle||""!==n||0!==t.indexOf("background")||(c[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(l?c.setProperty(t,n):c[t]=n))}},css:function(e,t,n,r){var i,o,a,s=q(t);return Xe.test(t)||(t=qe(s)),(a=k.cssHooks[t]||k.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=He(e,t,r)),"normal"===i&&t in Qe&&(i=Qe[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),k.each(["height","width"],function(e,t){k.cssHooks[t]={get:function(e,n,r){if(n)return!Ye.test(k.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?tt(e,t,r):We(e,Ze,function(){return tt(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a=!g.scrollboxSize()&&"absolute"===o.position,s=(a||r)&&"border-box"===k.css(e,"boxSizing",!1,o),l=r?et(e,t,r,s,o):0;return s&&a&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-et(e,t,"border",!1,o)-.5)),l&&(i=re.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=k.css(e,t)),Je(0,n,l)}}}),k.cssHooks.marginLeft=Ve(g.reliableMarginLeft,function(e,t){if(t)return(parseFloat(He(e,"marginLeft"))||e.getBoundingClientRect().left-We(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),k.each({margin:"",padding:"",border:"Width"},function(e,t){k.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+ie[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(k.cssHooks[e+t].set=Je)}),k.fn.extend({css:function(e,t){return V(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a1)}}),k.Tween=nt,nt.prototype={constructor:nt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||k.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(k.cssNumber[n]?"":"px")},cur:function(){var e=nt.propHooks[this.prop];return e&&e.get?e.get(this):nt.propHooks._default.get(this)},run:function(e){var t,n=nt.propHooks[this.prop];return this.options.duration?this.pos=t=k.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):nt.propHooks._default.set(this),this}},nt.prototype.init.prototype=nt.prototype,nt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=k.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){k.fx.step[e.prop]?k.fx.step[e.prop](e):1!==e.elem.nodeType||!k.cssHooks[e.prop]&&null==e.elem.style[qe(e.prop)]?e.elem[e.prop]=e.now:k.style(e.elem,e.prop,e.now+e.unit)}}},nt.propHooks.scrollTop=nt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},k.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},k.fx=nt.prototype.init,k.fx.step={};var rt,it,ot=/^(?:toggle|show|hide)$/,at=/queueHooks$/;function st(){it&&(!1===b.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(st):n.setTimeout(st,k.fx.interval),k.fx.tick())}function lt(){return n.setTimeout(function(){rt=void 0}),rt=Date.now()}function ct(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ie[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function ut(e,t,n){for(var r,i=(dt.tweeners[t]||[]).concat(dt.tweeners["*"]),o=0,a=i.length;o1)},removeAttr:function(e){return this.each(function(){k.removeAttr(this,e)})}}),k.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?k.prop(e,t,n):(1===o&&k.isXMLDoc(e)||(i=k.attrHooks[t.toLowerCase()]||(k.expr.match.bool.test(t)?ht:void 0)),void 0!==n?null===n?void k.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=k.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!g.radioValue&&"radio"===t&&D(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(R);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),ht={set:function(e,t,n){return!1===t?k.removeAttr(e,n):e.setAttribute(n,n),n}},k.each(k.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ft[t]||k.find.attr;ft[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ft[a],ft[a]=i,i=null!=n(e,t,r)?a:null,ft[a]=o),i}});var pt=/^(?:input|select|textarea|button)$/i,mt=/^(?:a|area)$/i;function gt(e){return(e.match(R)||[]).join(" ")}function vt(e){return e.getAttribute&&e.getAttribute("class")||""}function yt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(R)||[]}k.fn.extend({prop:function(e,t){return V(this,k.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[k.propFix[e]||e]})}}),k.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&k.isXMLDoc(e)||(t=k.propFix[t]||t,i=k.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=k.find.attr(e,"tabindex");return t?parseInt(t,10):pt.test(e.nodeName)||mt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),g.optSelected||(k.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),k.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){k.propFix[this.toLowerCase()]=this}),k.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,l=0;if(v(e))return this.each(function(t){k(this).addClass(e.call(this,t,vt(this)))});if((t=yt(e)).length)for(;n=this[l++];)if(i=vt(n),r=1===n.nodeType&&" "+gt(i)+" "){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=gt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,l=0;if(v(e))return this.each(function(t){k(this).removeClass(e.call(this,t,vt(this)))});if(!arguments.length)return this.attr("class","");if((t=yt(e)).length)for(;n=this[l++];)if(i=vt(n),r=1===n.nodeType&&" "+gt(i)+" "){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");i!==(s=gt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):v(e)?this.each(function(n){k(this).toggleClass(e.call(this,n,vt(this),t),t)}):this.each(function(){var t,i,o,a;if(r)for(i=0,o=k(this),a=yt(e);t=a[i++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else void 0!==e&&"boolean"!==n||((t=vt(this))&&Z.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":Z.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+gt(vt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;k.fn.extend({val:function(e){var t,n,r,i=this[0];return arguments.length?(r=v(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,k(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=k.map(i,function(e){return null==e?"":e+""})),(t=k.valHooks[this.type]||k.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))})):i?(t=k.valHooks[i.type]||k.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n:void 0}}),k.extend({valHooks:{option:{get:function(e){var t=k.find.attr(e,"value");return null!=t?t:gt(k.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],l=a?o+1:i.length;for(r=o<0?l:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),k.each(["radio","checkbox"],function(){k.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=k.inArray(k(e).val(),t)>-1}},g.checkOn||(k.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),g.focusin="onfocusin"in n;var xt=/^(?:focusinfocus|focusoutblur)$/,wt=function(e){e.stopPropagation()};k.extend(k.event,{trigger:function(e,t,r,i){var o,a,s,l,c,u,d,h,p=[r||b],m=f.call(e,"type")?e.type:e,g=f.call(e,"namespace")?e.namespace.split("."):[];if(a=h=s=r=r||b,3!==r.nodeType&&8!==r.nodeType&&!xt.test(m+k.event.triggered)&&(m.indexOf(".")>-1&&(m=(g=m.split(".")).shift(),g.sort()),c=m.indexOf(":")<0&&"on"+m,(e=e[k.expando]?e:new k.Event(m,"object"==typeof e&&e)).isTrigger=i?2:3,e.namespace=g.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:k.makeArray(t,[e]),d=k.event.special[m]||{},i||!d.trigger||!1!==d.trigger.apply(r,t))){if(!i&&!d.noBubble&&!y(r)){for(l=d.delegateType||m,xt.test(l+m)||(a=a.parentNode);a;a=a.parentNode)p.push(a),s=a;s===(r.ownerDocument||b)&&p.push(s.defaultView||s.parentWindow||n)}for(o=0;(a=p[o++])&&!e.isPropagationStopped();)h=a,e.type=o>1?l:d.bindType||m,(u=(Z.get(a,"events")||Object.create(null))[e.type]&&Z.get(a,"handle"))&&u.apply(a,t),(u=c&&a[c])&&u.apply&&Y(a)&&(e.result=u.apply(a,t),!1===e.result&&e.preventDefault());return e.type=m,i||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(p.pop(),t)||!Y(r)||c&&v(r[m])&&!y(r)&&((s=r[c])&&(r[c]=null),k.event.triggered=m,e.isPropagationStopped()&&h.addEventListener(m,wt),r[m](),e.isPropagationStopped()&&h.removeEventListener(m,wt),k.event.triggered=void 0,s&&(r[c]=s)),e.result}},simulate:function(e,t,n){var r=k.extend(new k.Event,n,{type:e,isSimulated:!0});k.event.trigger(r,null,t)}}),k.fn.extend({trigger:function(e,t){return this.each(function(){k.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return k.event.trigger(e,t,n,!0)}}),g.focusin||k.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){k.event.simulate(t,e.target,k.event.fix(e))};k.event.special[t]={setup:function(){var r=this.ownerDocument||this.document||this,i=Z.access(r,t);i||r.addEventListener(e,n,!0),Z.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this.document||this,i=Z.access(r,t)-1;i?Z.access(r,t,i):(r.removeEventListener(e,n,!0),Z.remove(r,t))}}});var Ct=n.location,kt={guid:Date.now()},Et=/\?/;k.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||k.error("Invalid XML: "+e),t};var At=/\[\]$/,St=/\r?\n/g,_t=/^(?:submit|button|image|reset|file)$/i,Ft=/^(?:input|select|textarea|keygen)/i;function Dt(e,t,n,r){var i;if(Array.isArray(t))k.each(t,function(t,i){n||At.test(e)?r(e,i):Dt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==C(t))r(e,t);else for(i in t)Dt(e+"["+i+"]",t[i],n,r)}k.param=function(e,t){var n,r=[],i=function(e,t){var n=v(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!k.isPlainObject(e))k.each(e,function(){i(this.name,this.value)});else for(n in e)Dt(n,e[n],t,i);return r.join("&")},k.fn.extend({serialize:function(){return k.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=k.prop(this,"elements");return e?k.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!k(this).is(":disabled")&&Ft.test(this.nodeName)&&!_t.test(e)&&(this.checked||!fe.test(e))}).map(function(e,t){var n=k(this).val();return null==n?null:Array.isArray(n)?k.map(n,function(e){return{name:t.name,value:e.replace(St,"\r\n")}}):{name:t.name,value:n.replace(St,"\r\n")}}).get()}});var Tt=/%20/g,Ot=/#.*$/,Lt=/([?&])_=[^&]*/,Bt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Mt=/^(?:GET|HEAD)$/,jt=/^\/\//,Pt={},Rt={},It="*/".concat("*"),Nt=b.createElement("a");function $t(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(R)||[];if(v(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function Wt(e,t,n,r){var i={},o=e===Rt;function a(s){var l;return i[s]=!0,k.each(e[s]||[],function(e,s){var c=s(t,n,r);return"string"!=typeof c||o||i[c]?o?!(l=c):void 0:(t.dataTypes.unshift(c),a(c),!1)}),l}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=k.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&k.extend(!0,e,r),e}Nt.href=Ct.href,k.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":It,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":k.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,k.ajaxSettings),t):zt(k.ajaxSettings,e)},ajaxPrefilter:$t(Pt),ajaxTransport:$t(Rt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,i,o,a,s,l,c,u,d,h,f=k.ajaxSetup({},t),p=f.context||f,m=f.context&&(p.nodeType||p.jquery)?k(p):k.event,g=k.Deferred(),v=k.Callbacks("once memory"),y=f.statusCode||{},x={},w={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!a)for(a={};t=Bt.exec(o);)a[t[1].toLowerCase()+" "]=(a[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=a[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return c?o:null},setRequestHeader:function(e,t){return null==c&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,x[e]=t),this},overrideMimeType:function(e){return null==c&&(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)y[t]=[y[t],e[t]];return this},abort:function(e){var t=e||C;return r&&r.abort(t),A(0,t),this}};if(g.promise(E),f.url=((e||f.url||Ct.href)+"").replace(jt,Ct.protocol+"//"),f.type=t.method||t.type||f.method||f.type,f.dataTypes=(f.dataType||"*").toLowerCase().match(R)||[""],null==f.crossDomain){l=b.createElement("a");try{l.href=f.url,l.href=l.href,f.crossDomain=Nt.protocol+"//"+Nt.host!=l.protocol+"//"+l.host}catch(e){f.crossDomain=!0}}if(f.data&&f.processData&&"string"!=typeof f.data&&(f.data=k.param(f.data,f.traditional)),Wt(Pt,f,t,E),c)return E;for(d in(u=k.event&&f.global)&&0==k.active++&&k.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!Mt.test(f.type),i=f.url.replace(Ot,""),f.hasContent?f.data&&f.processData&&0===(f.contentType||"").indexOf("application/x-www-form-urlencoded")&&(f.data=f.data.replace(Tt,"+")):(h=f.url.slice(i.length),f.data&&(f.processData||"string"==typeof f.data)&&(i+=(Et.test(i)?"&":"?")+f.data,delete f.data),!1===f.cache&&(i=i.replace(Lt,"$1"),h=(Et.test(i)?"&":"?")+"_="+kt.guid+++h),f.url=i+h),f.ifModified&&(k.lastModified[i]&&E.setRequestHeader("If-Modified-Since",k.lastModified[i]),k.etag[i]&&E.setRequestHeader("If-None-Match",k.etag[i])),(f.data&&f.hasContent&&!1!==f.contentType||t.contentType)&&E.setRequestHeader("Content-Type",f.contentType),E.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+It+"; q=0.01":""):f.accepts["*"]),f.headers)E.setRequestHeader(d,f.headers[d]);if(f.beforeSend&&(!1===f.beforeSend.call(p,E,f)||c))return E.abort();if(C="abort",v.add(f.complete),E.done(f.success),E.fail(f.error),r=Wt(Rt,f,t,E)){if(E.readyState=1,u&&m.trigger("ajaxSend",[E,f]),c)return E;f.async&&f.timeout>0&&(s=n.setTimeout(function(){E.abort("timeout")},f.timeout));try{c=!1,r.send(x,A)}catch(e){if(c)throw e;A(-1,e)}}else A(-1,"No Transport");function A(e,t,a,l){var d,h,b,x,w,C=t;c||(c=!0,s&&n.clearTimeout(s),r=void 0,o=l||"",E.readyState=e>0?4:0,d=e>=200&&e<300||304===e,a&&(x=function(e,t,n){for(var r,i,o,a,s=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){l.unshift(i);break}if(l[0]in n)o=l[0];else{for(i in n){if(!l[0]||e.converters[i+" "+l[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==l[0]&&l.unshift(o),n[o]}(f,E,a)),!d&&k.inArray("script",f.dataTypes)>-1&&(f.converters["text script"]=function(){}),x=function(e,t,n,r){var i,o,a,s,l,c={},u=e.dataTypes.slice();if(u[1])for(a in e.converters)c[a.toLowerCase()]=e.converters[a];for(o=u.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=u.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(!(a=c[l+" "+o]||c["* "+o]))for(i in c)if((s=i.split(" "))[1]===o&&(a=c[l+" "+s[0]]||c["* "+s[0]])){!0===a?a=c[i]:!0!==c[i]&&(o=s[0],u.unshift(s[1]));break}if(!0!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}(f,x,E,d),d?(f.ifModified&&((w=E.getResponseHeader("Last-Modified"))&&(k.lastModified[i]=w),(w=E.getResponseHeader("etag"))&&(k.etag[i]=w)),204===e||"HEAD"===f.type?C="nocontent":304===e?C="notmodified":(C=x.state,h=x.data,d=!(b=x.error))):(b=C,!e&&C||(C="error",e<0&&(e=0))),E.status=e,E.statusText=(t||C)+"",d?g.resolveWith(p,[h,C,E]):g.rejectWith(p,[E,C,b]),E.statusCode(y),y=void 0,u&&m.trigger(d?"ajaxSuccess":"ajaxError",[E,f,d?h:b]),v.fireWith(p,[E,C]),u&&(m.trigger("ajaxComplete",[E,f]),--k.active||k.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return k.get(e,t,n,"json")},getScript:function(e,t){return k.get(e,void 0,t,"script")}}),k.each(["get","post"],function(e,t){k[t]=function(e,n,r,i){return v(n)&&(i=i||r,r=n,n=void 0),k.ajax(k.extend({url:e,type:t,dataType:i,data:n,success:r},k.isPlainObject(e)&&e))}}),k.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),k._evalUrl=function(e,t,n){return k.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){k.globalEval(e,t,n)}})},k.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=k(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return v(e)?this.each(function(t){k(this).wrapInner(e.call(this,t))}):this.each(function(){var t=k(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v(e);return this.each(function(n){k(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){k(this).replaceWith(this.childNodes)}),this}}),k.expr.pseudos.hidden=function(e){return!k.expr.pseudos.visible(e)},k.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},k.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(e){}};var Ht={0:200,1223:204},Vt=k.ajaxSettings.xhr();g.cors=!!Vt&&"withCredentials"in Vt,g.ajax=Vt=!!Vt,k.ajaxTransport(function(e){var t,r;if(g.cors||Vt&&!e.crossDomain)return{send:function(i,o){var a,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)s[a]=e.xhrFields[a];for(a in e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest"),i)s.setRequestHeader(a,i[a]);t=function(e){return function(){t&&(t=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Ht[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=t(),r=s.onerror=s.ontimeout=t("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&n.setTimeout(function(){t&&r()})},t=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}}),k.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),k.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return k.globalEval(e),e}}}),k.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),k.ajaxTransport("script",function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(r,i){t=k("