diff --git a/.obsidian/app.json b/.obsidian/app.json
new file mode 100644
index 0000000..eb5f189
--- /dev/null
+++ b/.obsidian/app.json
@@ -0,0 +1,4 @@
+{
+ "legacyEditor": false,
+ "alwaysUpdateLinks": true
+}
\ No newline at end of file
diff --git a/.obsidian/appearance.json b/.obsidian/appearance.json
new file mode 100644
index 0000000..990f337
--- /dev/null
+++ b/.obsidian/appearance.json
@@ -0,0 +1,3 @@
+{
+ "baseFontSize": 16
+}
\ No newline at end of file
diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json
new file mode 100644
index 0000000..bfdcdf8
--- /dev/null
+++ b/.obsidian/community-plugins.json
@@ -0,0 +1,3 @@
+[
+ "obsidian-circuitjs"
+]
\ No newline at end of file
diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json
new file mode 100644
index 0000000..ab1d511
--- /dev/null
+++ b/.obsidian/core-plugins.json
@@ -0,0 +1,15 @@
+[
+ "file-explorer",
+ "global-search",
+ "switcher",
+ "graph",
+ "backlink",
+ "page-preview",
+ "note-composer",
+ "command-palette",
+ "editor-status",
+ "markdown-importer",
+ "word-count",
+ "open-with-default-app",
+ "file-recovery"
+]
\ No newline at end of file
diff --git a/.obsidian/hotkeys.json b/.obsidian/hotkeys.json
new file mode 100644
index 0000000..9e26dfe
--- /dev/null
+++ b/.obsidian/hotkeys.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/.obsidian/plugins/obsidian-circuitjs/main.js b/.obsidian/plugins/obsidian-circuitjs/main.js
new file mode 100644
index 0000000..f9f5b20
--- /dev/null
+++ b/.obsidian/plugins/obsidian-circuitjs/main.js
@@ -0,0 +1,586 @@
+/*
+THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
+if you want to view the source, please visit the github repository of this plugin
+*/
+
+var __create = Object.create;
+var __defProp = Object.defineProperty;
+var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
+var __getOwnPropNames = Object.getOwnPropertyNames;
+var __getProtoOf = Object.getPrototypeOf;
+var __hasOwnProp = Object.prototype.hasOwnProperty;
+var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
+var __commonJS = (cb, mod) => function __require() {
+ return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
+};
+var __export = (target, all) => {
+ __markAsModule(target);
+ for (var name in all)
+ __defProp(target, name, { get: all[name], enumerable: true });
+};
+var __reExport = (target, module2, desc) => {
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
+ for (let key of __getOwnPropNames(module2))
+ if (!__hasOwnProp.call(target, key) && key !== "default")
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
+ }
+ return target;
+};
+var __toModule = (module2) => {
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
+};
+var __async = (__this, __arguments, generator) => {
+ return new Promise((resolve, reject) => {
+ var fulfilled = (value) => {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ };
+ var rejected = (value) => {
+ try {
+ step(generator.throw(value));
+ } catch (e) {
+ reject(e);
+ }
+ };
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
+ step((generator = generator.apply(__this, __arguments)).next());
+ });
+};
+
+// node_modules/.pnpm/lz-string@1.4.4/node_modules/lz-string/libs/lz-string.js
+var require_lz_string = __commonJS({
+ "node_modules/.pnpm/lz-string@1.4.4/node_modules/lz-string/libs/lz-string.js"(exports, module2) {
+ var LZString2 = function() {
+ var f = String.fromCharCode;
+ var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+ var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
+ var baseReverseDic = {};
+ function getBaseValue(alphabet, character) {
+ if (!baseReverseDic[alphabet]) {
+ baseReverseDic[alphabet] = {};
+ for (var i = 0; i < alphabet.length; i++) {
+ baseReverseDic[alphabet][alphabet.charAt(i)] = i;
+ }
+ }
+ return baseReverseDic[alphabet][character];
+ }
+ var LZString3 = {
+ compressToBase64: function(input) {
+ if (input == null)
+ return "";
+ var res = LZString3._compress(input, 6, function(a) {
+ return keyStrBase64.charAt(a);
+ });
+ switch (res.length % 4) {
+ default:
+ case 0:
+ return res;
+ case 1:
+ return res + "===";
+ case 2:
+ return res + "==";
+ case 3:
+ return res + "=";
+ }
+ },
+ decompressFromBase64: function(input) {
+ if (input == null)
+ return "";
+ if (input == "")
+ return null;
+ return LZString3._decompress(input.length, 32, function(index) {
+ return getBaseValue(keyStrBase64, input.charAt(index));
+ });
+ },
+ compressToUTF16: function(input) {
+ if (input == null)
+ return "";
+ return LZString3._compress(input, 15, function(a) {
+ return f(a + 32);
+ }) + " ";
+ },
+ decompressFromUTF16: function(compressed) {
+ if (compressed == null)
+ return "";
+ if (compressed == "")
+ return null;
+ return LZString3._decompress(compressed.length, 16384, function(index) {
+ return compressed.charCodeAt(index) - 32;
+ });
+ },
+ compressToUint8Array: function(uncompressed) {
+ var compressed = LZString3.compress(uncompressed);
+ var buf = new Uint8Array(compressed.length * 2);
+ for (var i = 0, TotalLen = compressed.length; i < TotalLen; i++) {
+ var current_value = compressed.charCodeAt(i);
+ buf[i * 2] = current_value >>> 8;
+ buf[i * 2 + 1] = current_value % 256;
+ }
+ return buf;
+ },
+ decompressFromUint8Array: function(compressed) {
+ if (compressed === null || compressed === void 0) {
+ return LZString3.decompress(compressed);
+ } else {
+ var buf = new Array(compressed.length / 2);
+ for (var i = 0, TotalLen = buf.length; i < TotalLen; i++) {
+ buf[i] = compressed[i * 2] * 256 + compressed[i * 2 + 1];
+ }
+ var result = [];
+ buf.forEach(function(c) {
+ result.push(f(c));
+ });
+ return LZString3.decompress(result.join(""));
+ }
+ },
+ compressToEncodedURIComponent: function(input) {
+ if (input == null)
+ return "";
+ return LZString3._compress(input, 6, function(a) {
+ return keyStrUriSafe.charAt(a);
+ });
+ },
+ decompressFromEncodedURIComponent: function(input) {
+ if (input == null)
+ return "";
+ if (input == "")
+ return null;
+ input = input.replace(/ /g, "+");
+ return LZString3._decompress(input.length, 32, function(index) {
+ return getBaseValue(keyStrUriSafe, input.charAt(index));
+ });
+ },
+ compress: function(uncompressed) {
+ return LZString3._compress(uncompressed, 16, function(a) {
+ return f(a);
+ });
+ },
+ _compress: function(uncompressed, bitsPerChar, getCharFromInt) {
+ if (uncompressed == null)
+ return "";
+ var i, value, context_dictionary = {}, context_dictionaryToCreate = {}, context_c = "", context_wc = "", context_w = "", context_enlargeIn = 2, context_dictSize = 3, context_numBits = 2, context_data = [], context_data_val = 0, context_data_position = 0, ii;
+ for (ii = 0; ii < uncompressed.length; ii += 1) {
+ context_c = uncompressed.charAt(ii);
+ if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {
+ context_dictionary[context_c] = context_dictSize++;
+ context_dictionaryToCreate[context_c] = true;
+ }
+ context_wc = context_w + context_c;
+ if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) {
+ context_w = context_wc;
+ } else {
+ if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
+ if (context_w.charCodeAt(0) < 256) {
+ for (i = 0; i < context_numBits; i++) {
+ context_data_val = context_data_val << 1;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data_position = 0;
+ context_data.push(getCharFromInt(context_data_val));
+ context_data_val = 0;
+ } else {
+ context_data_position++;
+ }
+ }
+ value = context_w.charCodeAt(0);
+ for (i = 0; i < 8; i++) {
+ context_data_val = context_data_val << 1 | value & 1;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data_position = 0;
+ context_data.push(getCharFromInt(context_data_val));
+ context_data_val = 0;
+ } else {
+ context_data_position++;
+ }
+ value = value >> 1;
+ }
+ } else {
+ value = 1;
+ for (i = 0; i < context_numBits; i++) {
+ context_data_val = context_data_val << 1 | value;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data_position = 0;
+ context_data.push(getCharFromInt(context_data_val));
+ context_data_val = 0;
+ } else {
+ context_data_position++;
+ }
+ value = 0;
+ }
+ value = context_w.charCodeAt(0);
+ for (i = 0; i < 16; i++) {
+ context_data_val = context_data_val << 1 | value & 1;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data_position = 0;
+ context_data.push(getCharFromInt(context_data_val));
+ context_data_val = 0;
+ } else {
+ context_data_position++;
+ }
+ value = value >> 1;
+ }
+ }
+ context_enlargeIn--;
+ if (context_enlargeIn == 0) {
+ context_enlargeIn = Math.pow(2, context_numBits);
+ context_numBits++;
+ }
+ delete context_dictionaryToCreate[context_w];
+ } else {
+ value = context_dictionary[context_w];
+ for (i = 0; i < context_numBits; i++) {
+ context_data_val = context_data_val << 1 | value & 1;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data_position = 0;
+ context_data.push(getCharFromInt(context_data_val));
+ context_data_val = 0;
+ } else {
+ context_data_position++;
+ }
+ value = value >> 1;
+ }
+ }
+ context_enlargeIn--;
+ if (context_enlargeIn == 0) {
+ context_enlargeIn = Math.pow(2, context_numBits);
+ context_numBits++;
+ }
+ context_dictionary[context_wc] = context_dictSize++;
+ context_w = String(context_c);
+ }
+ }
+ if (context_w !== "") {
+ if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
+ if (context_w.charCodeAt(0) < 256) {
+ for (i = 0; i < context_numBits; i++) {
+ context_data_val = context_data_val << 1;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data_position = 0;
+ context_data.push(getCharFromInt(context_data_val));
+ context_data_val = 0;
+ } else {
+ context_data_position++;
+ }
+ }
+ value = context_w.charCodeAt(0);
+ for (i = 0; i < 8; i++) {
+ context_data_val = context_data_val << 1 | value & 1;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data_position = 0;
+ context_data.push(getCharFromInt(context_data_val));
+ context_data_val = 0;
+ } else {
+ context_data_position++;
+ }
+ value = value >> 1;
+ }
+ } else {
+ value = 1;
+ for (i = 0; i < context_numBits; i++) {
+ context_data_val = context_data_val << 1 | value;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data_position = 0;
+ context_data.push(getCharFromInt(context_data_val));
+ context_data_val = 0;
+ } else {
+ context_data_position++;
+ }
+ value = 0;
+ }
+ value = context_w.charCodeAt(0);
+ for (i = 0; i < 16; i++) {
+ context_data_val = context_data_val << 1 | value & 1;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data_position = 0;
+ context_data.push(getCharFromInt(context_data_val));
+ context_data_val = 0;
+ } else {
+ context_data_position++;
+ }
+ value = value >> 1;
+ }
+ }
+ context_enlargeIn--;
+ if (context_enlargeIn == 0) {
+ context_enlargeIn = Math.pow(2, context_numBits);
+ context_numBits++;
+ }
+ delete context_dictionaryToCreate[context_w];
+ } else {
+ value = context_dictionary[context_w];
+ for (i = 0; i < context_numBits; i++) {
+ context_data_val = context_data_val << 1 | value & 1;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data_position = 0;
+ context_data.push(getCharFromInt(context_data_val));
+ context_data_val = 0;
+ } else {
+ context_data_position++;
+ }
+ value = value >> 1;
+ }
+ }
+ context_enlargeIn--;
+ if (context_enlargeIn == 0) {
+ context_enlargeIn = Math.pow(2, context_numBits);
+ context_numBits++;
+ }
+ }
+ value = 2;
+ for (i = 0; i < context_numBits; i++) {
+ context_data_val = context_data_val << 1 | value & 1;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data_position = 0;
+ context_data.push(getCharFromInt(context_data_val));
+ context_data_val = 0;
+ } else {
+ context_data_position++;
+ }
+ value = value >> 1;
+ }
+ while (true) {
+ context_data_val = context_data_val << 1;
+ if (context_data_position == bitsPerChar - 1) {
+ context_data.push(getCharFromInt(context_data_val));
+ break;
+ } else
+ context_data_position++;
+ }
+ return context_data.join("");
+ },
+ decompress: function(compressed) {
+ if (compressed == null)
+ return "";
+ if (compressed == "")
+ return null;
+ return LZString3._decompress(compressed.length, 32768, function(index) {
+ return compressed.charCodeAt(index);
+ });
+ },
+ _decompress: function(length, resetValue, getNextValue) {
+ var dictionary = [], next, enlargeIn = 4, dictSize = 4, numBits = 3, entry = "", result = [], i, w, bits, resb, maxpower, power, c, data = { val: getNextValue(0), position: resetValue, index: 1 };
+ for (i = 0; i < 3; i += 1) {
+ dictionary[i] = i;
+ }
+ bits = 0;
+ maxpower = Math.pow(2, 2);
+ power = 1;
+ while (power != maxpower) {
+ resb = data.val & data.position;
+ data.position >>= 1;
+ if (data.position == 0) {
+ data.position = resetValue;
+ data.val = getNextValue(data.index++);
+ }
+ bits |= (resb > 0 ? 1 : 0) * power;
+ power <<= 1;
+ }
+ switch (next = bits) {
+ case 0:
+ bits = 0;
+ maxpower = Math.pow(2, 8);
+ power = 1;
+ while (power != maxpower) {
+ resb = data.val & data.position;
+ data.position >>= 1;
+ if (data.position == 0) {
+ data.position = resetValue;
+ data.val = getNextValue(data.index++);
+ }
+ bits |= (resb > 0 ? 1 : 0) * power;
+ power <<= 1;
+ }
+ c = f(bits);
+ break;
+ case 1:
+ bits = 0;
+ maxpower = Math.pow(2, 16);
+ power = 1;
+ while (power != maxpower) {
+ resb = data.val & data.position;
+ data.position >>= 1;
+ if (data.position == 0) {
+ data.position = resetValue;
+ data.val = getNextValue(data.index++);
+ }
+ bits |= (resb > 0 ? 1 : 0) * power;
+ power <<= 1;
+ }
+ c = f(bits);
+ break;
+ case 2:
+ return "";
+ }
+ dictionary[3] = c;
+ w = c;
+ result.push(c);
+ while (true) {
+ if (data.index > length) {
+ return "";
+ }
+ bits = 0;
+ maxpower = Math.pow(2, numBits);
+ power = 1;
+ while (power != maxpower) {
+ resb = data.val & data.position;
+ data.position >>= 1;
+ if (data.position == 0) {
+ data.position = resetValue;
+ data.val = getNextValue(data.index++);
+ }
+ bits |= (resb > 0 ? 1 : 0) * power;
+ power <<= 1;
+ }
+ switch (c = bits) {
+ case 0:
+ bits = 0;
+ maxpower = Math.pow(2, 8);
+ power = 1;
+ while (power != maxpower) {
+ resb = data.val & data.position;
+ data.position >>= 1;
+ if (data.position == 0) {
+ data.position = resetValue;
+ data.val = getNextValue(data.index++);
+ }
+ bits |= (resb > 0 ? 1 : 0) * power;
+ power <<= 1;
+ }
+ dictionary[dictSize++] = f(bits);
+ c = dictSize - 1;
+ enlargeIn--;
+ break;
+ case 1:
+ bits = 0;
+ maxpower = Math.pow(2, 16);
+ power = 1;
+ while (power != maxpower) {
+ resb = data.val & data.position;
+ data.position >>= 1;
+ if (data.position == 0) {
+ data.position = resetValue;
+ data.val = getNextValue(data.index++);
+ }
+ bits |= (resb > 0 ? 1 : 0) * power;
+ power <<= 1;
+ }
+ dictionary[dictSize++] = f(bits);
+ c = dictSize - 1;
+ enlargeIn--;
+ break;
+ case 2:
+ return result.join("");
+ }
+ if (enlargeIn == 0) {
+ enlargeIn = Math.pow(2, numBits);
+ numBits++;
+ }
+ if (dictionary[c]) {
+ entry = dictionary[c];
+ } else {
+ if (c === dictSize) {
+ entry = w + w.charAt(0);
+ } else {
+ return null;
+ }
+ }
+ result.push(entry);
+ dictionary[dictSize++] = w + entry.charAt(0);
+ enlargeIn--;
+ w = entry;
+ if (enlargeIn == 0) {
+ enlargeIn = Math.pow(2, numBits);
+ numBits++;
+ }
+ }
+ }
+ };
+ return LZString3;
+ }();
+ if (typeof define === "function" && define.amd) {
+ define(function() {
+ return LZString2;
+ });
+ } else if (typeof module2 !== "undefined" && module2 != null) {
+ module2.exports = LZString2;
+ }
+ }
+});
+
+// main.ts
+__export(exports, {
+ default: () => CircuitJsPlugin
+});
+var import_obsidian2 = __toModule(require("obsidian"));
+
+// circuitRenderer.ts
+var import_obsidian = __toModule(require("obsidian"));
+var LZString = __toModule(require_lz_string());
+var CircuitRenderChild = class extends import_obsidian.MarkdownRenderChild {
+ constructor(el, renderer, content, settings) {
+ super(el);
+ this.settings = settings;
+ this.code = content;
+ this.compressed = LZString.compressToEncodedURIComponent(this.code);
+ if (this.settings.editable) {
+ this.url = `${this.settings.circuitJsUrl}?ctz=${this.compressed}&running=true`;
+ } else {
+ this.url = `${this.settings.circuitJsUrl}?ctz=${this.compressed}&running=false`;
+ }
+ }
+ onload() {
+ const div = document.createElement("div");
+ if (this.settings.editLink) {
+ const editLink = document.createElement("a");
+ editLink.setAttribute("href", this.url);
+ const editLinkContent = document.createTextNode("[EDIT]");
+ editLink.appendChild(editLinkContent);
+ div.appendChild(editLink);
+ }
+ const iframeNode = document.createElement("iframe");
+ iframeNode.setAttribute("src", this.url);
+ iframeNode.setAttribute("width", "100%");
+ iframeNode.setAttribute("height", "600px");
+ div.appendChild(iframeNode);
+ this.containerEl.appendChild(div);
+ }
+ onunload() {
+ }
+};
+
+// main.ts
+var DEFAULT_SETTINGS = {
+ editable: true,
+ editLink: true,
+ circuitJsUrl: "http://falstad.com/circuit/circuitjs.html",
+ circuitTag: "circuitjs"
+};
+var CircuitJsPlugin = class extends import_obsidian2.Plugin {
+ constructor() {
+ super(...arguments);
+ this.postprocessor = (content, el, ctx) => __async(this, null, function* () {
+ ctx.addChild(new CircuitRenderChild(el, this, content, this.settings));
+ });
+ }
+ onload() {
+ return __async(this, null, function* () {
+ yield this.loadSettings();
+ this.registerMarkdownCodeBlockProcessor(this.settings.circuitTag, this.postprocessor);
+ });
+ }
+ onunload() {
+ }
+ loadSettings() {
+ return __async(this, null, function* () {
+ this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
+ });
+ }
+ saveSettings() {
+ return __async(this, null, function* () {
+ yield this.saveData(this.settings);
+ });
+ }
+};
+//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsibm9kZV9tb2R1bGVzLy5wbnBtL2x6LXN0cmluZ0AxLjQuNC9ub2RlX21vZHVsZXMvbHotc3RyaW5nL2xpYnMvbHotc3RyaW5nLmpzIiwgIm1haW4udHMiLCAiY2lyY3VpdFJlbmRlcmVyLnRzIl0s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W9uYXJ5PSB7fSxcbiAgICAgICAgY29udGV4dF9kaWN0aW9uYXJ5VG9DcmVhdGU9IHt9LFxuICAgICAgICBjb250ZXh0X2M9XCJcIixcbiAgICAgICAgY29udGV4dF93Yz1cIlwiLFxuICAgICAgICBjb250ZXh0X3c9XCJcIixcbiAgICAgICAgY29udGV4dF9lbmxhcmdlSW49IDIsIC8vIENvbXBlbnNhdGUgZm9yIHRoZSBmaXJzdCBlbnRyeSB3aGljaCBzaG91bGQgbm90IGNvdW50XG4gICAgICAgIGNvbnRleHRfZGljdFNpemU9IDMsXG4gICAgICAgIGNvbnRleHRfbnVtQml0cz0gMixcbiAgICAgICAgY29udGV4dF9kYXRhPVtdLFxuICAgICAgICBjb250ZXh0X2RhdGFfdmFsPTAsXG4gICAgICAgIGNvbnRleHRfZGF0YV9wb3NpdGlvbj0wLFxuICAgICAgICBpaTtcblxuICAgIGZvciAoaWkgPSAwOyBpaSA8IHVuY29tcHJlc3NlZC5sZW5ndGg7IGlpICs9IDEpIHtcbiAgICAgIGNvbnRleHRfYyA9IHVuY29tcHJlc3NlZC5jaGFyQXQoaWkpO1xuICAgICAgaWYgKCFPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoY29udGV4dF9kaWN0aW9uYXJ5LGNvbnRleHRfYykpIHtcbiAgICAgICAgY29udGV4dF9kaWN0aW9uYXJ5W2NvbnRleHRfY10gPSBjb250ZXh0X2RpY3RTaXplKys7XG4gICAgICAgIGNvbnRleHRfZGljdGlvbmFyeVRvQ3JlYXRlW2NvbnRleHRfY10gPSB0cnVlO1xuICAgICAgfVxuXG4gICAgICBjb250ZXh0X3djID0gY29udGV4dF93ICsgY29udGV4dF9jO1xuICAgICAgaWYgKE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChjb250ZXh0X2RpY3Rpb25hcnksY29udGV4dF93YykpIHtcbiAgICAgICAgY29udGV4dF93ID0gY29udGV4dF93YztcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoY29udGV4dF9kaWN0aW9uYXJ5VG9DcmVhdGUsY29udGV4dF93KSkge1xuICAgICAgICAgIGlmIChjb250ZXh0X3cuY2hhckNvZGVBdCgwKTwyNTYpIHtcbiAgICAgICAgICAgIGZvciAoaT0wIDsgaTxjb250ZXh0X251bUJpdHMgOyBpKyspIHtcbiAgICAgICAgICAgICAgY29udGV4dF9kYXRhX3ZhbCA9IChjb250ZXh0X2RhdGFfdmFsIDw8IDEpO1xuICAgICAgICAgICAgICBpZiAoY29udGV4dF9kYXRhX3Bvc2l0aW9uID09IGJpdHNQZXJDaGFyLTEpIHtcbiAgICAgICAgICAgICAgICBjb250ZXh0X2RhdGFfcG9zaXRpb24gPSAwO1xuICAgICAgICAgICAgICAgIGNvbnRleHRfZGF0YS5wdXNoKGdldENoYXJGcm9tSW50KGNvbnRleHRfZGF0YV92YWwpKTtcbiAgICAgICAgICAgICAgICBjb250ZXh0X2RhdGFfdmFsID0gMDtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb250ZXh0X2RhdGFfcG9zaXRpb24rKztcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFsdWUgPSBjb250ZXh0X3cuY2hhckNvZGVBdCgwKTtcbiAgICAgICAgICAgIGZvciAoaT0wIDsgaTw4IDsgaSsrKSB7XG4gICAgICAgICAgICAgIGNvbnRleHRfZGF0YV92YWwgPSAoY29udGV4dF9kYXRhX3ZhbCA8PCAxKSB8ICh2YWx1ZSYxKTtcbiAgICAgICAgICAgICAgaWYgKGNvbnRleHRfZGF0YV9wb3NpdGlvbiA9PSBiaXRzUGVyQ2hhci0xKSB7XG4gICAgICAgICAgICAgICAgY29udGV4dF9kYXRhX3Bvc2l0aW9uID0gMDtcbiAgICAgICAgICAgICAgICBjb250ZXh0X2RhdGEucHVzaChnZXRDaGFyRnJvbUludChjb250ZXh0X2RhdGFfdmFsKSk7XG4gICAgICAgICAgICAgICAgY29udGV4dF9kYXRhX3ZhbCA9IDA7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgY29udGV4dF9kYXRhX3Bvc2l0aW9uKys7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgdmFsdWUgPSB2YWx1ZSA+PiAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB2YWx1ZSA9IDE7XG4gICAgICAgICAgICBmb3IgKGk9MCA7IGk8Y29udGV4dF9udW1CaXRzIDsgaSsrKSB7XG4gICAgICAgICAgICAgIGNvbnRleHRfZGF0YV92YWwgPSAoY29udGV4dF9kYXRhX3ZhbCA8PCAxKSB8IHZhbHVlO1xuICAgICAgICAgICAgICBpZiAoY29udGV4dF9kYXRhX3Bvc2l0aW9uID09Yml0c1BlckNoYXItMSkge1xuICAgICAgICAgICAgICAgIGNvbnRleHRfZGF0YV9wb3NpdGlvbiA9IDA7XG4gICAgICAgICAgICAgICAgY29udGV4dF9kYXRhLnB1c2goZ2V0Q2hhckZyb21JbnQoY29udGV4dF9kYXRhX3ZhbCkpO1xuICAgICAgICAgICAgICAgIGNvbnRleHRfZGF0YV92YWwgPSAwO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGNvbnRleHRfZGF0YV9wb3NpdGlvbisrO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHZhbHVlID0gMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhbHVlID0gY29udGV4dF93LmNoYXJDb2RlQXQoMCk7XG4gICAgICAgICAgICBmb3IgKGk9MCA7IGk8MTYgOyBpKyspIHtcbiAgICAgICAgICAgICAgY29udGV4dF9kYXRhX3ZhbCA9IChjb250ZXh0X2RhdGFfdmFsIDw8IDEpIHwgKHZhbHVlJjEpO1xuICAgICAgICAgICAgICBpZiAoY29udGV4dF9kYXRhX3Bvc2l0aW9uID09IGJpdHNQZXJDaGFyLTEpIHtcbiAgICAgICAgICAgICAgICBjb250ZXh0X2RhdGFfcG9zaXRpb24gPSAwO1xuICAgICAgICAgICAgICAgIGNvbnRleHRfZGF0YS5wdXNoKGdldENoYXJGcm9tSW50KGNvbnRleHRfZGF0YV92YWwpKTtcbiAgICAgICAgICAgICAgICBjb250ZXh0X2RhdGFfdmFsID0gMDtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb250ZXh0X2RhdGFfcG9zaXRpb24rKztcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB2YWx1ZSA9IHZhbHVlID4+IDE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGNvbnRleHRfZW5sYXJnZUluLS07XG4gICAgICAgICAgaWYgKGNvbnRleHRfZW5sYXJnZUluID09IDApIHtcbiAgICAgICAgICAgIGNvbnRleHRfZW5sYXJnZUluID0gTWF0aC5wb3coMiwgY29udGV4dF9udW1CaXRzKTtcbiAgICAgICAgICAgIGNvbnRleHRfbnVtQml0cysrO1xuICAgICAgICAgIH1cbiAgICAgICAgICBkZWxldGUgY29udGV4dF9kaWN0aW9uYXJ5VG9DcmVhdGVbY29udGV4dF93XTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICB2YWx1ZSA9IGNvbnRleHRfZGljdGlvbmFyeVtjb250ZXh0X3ddO1xuICAgICAgICAgIGZvciAoaT0wIDsgaTxjb250ZXh0X251bUJpdHMgOyBpKyspIHtcbiAgICAgICAgICAgIGNvbnRleHRfZGF0YV92YWwgPSAoY29udGV4dF9kYXRhX3ZhbCA8PCAxKSB8ICh2YWx1ZSYxKTtcbiAgICAgICAgICAgIGlmIChjb250ZXh0X2RhdGFfcG9zaXRpb24gPT0gYml0c1BlckNoYXItMSkge1xuICAgICAgICAgICAgICBjb250ZXh0X2RhdGFfcG9zaXRpb24gPSAwO1xuICAgICAgICAgICAgICBjb250ZXh0X2RhdGEucHVzaChnZXRDaGFyRnJvbUludChjb250ZXh0X2RhdGFfdmFsKSk7XG4gICAgICAgICAgICAgIGNvbnRleHRfZGF0YV92YWwgPSAwO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgY29udGV4dF9kYXRhX3Bvc2l0aW9uKys7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YWx1ZSA9IHZhbHVlID4+IDE7XG4gICAgICAgICAgfVxuXG5cbiAgICAgICAgfVxuICAgICAgICBjb250ZXh0X2VubGFyZ2VJbi0tO1xuICAgICAgICBpZiAoY29udGV4dF9lbmxhcmdlSW4gPT0gMCkge1xuICAgICAgICAgIGNvbnRleHRfZW5sYXJnZUluID0gTWF0aC5wb3coMiwgY29udGV4dF9udW1CaXRzKTtcbiAgICAgICAgICBjb250ZXh0X251bUJpdHMrKztcbiAgICAgICAgfVxuICAgICAgICAvLyBBZGQgd2MgdG8gdGhlIGRpY3Rpb25hcnkuXG4gICAgICAgIGNvbnRleHRfZGljdGlvbmFyeVtjb250ZXh0X3djXSA9IGNvbnRleHRfZGljdFNpemUrKztcbiAgICAgICAgY29udGV4dF93ID0gU3RyaW5nKGNvbnRleHRfYyk7XG4gICAgICB9XG4gICAgfVxuXG4gICAgLy8gT3V0cHV0IHRoZSBjb2RlIGZvciB3LlxuICAgIGlmIChjb250ZXh0X3cgIT09IFwiXCIpIHtcbiAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoY29udGV4dF9kaWN0aW9uYXJ5VG9DcmVhdGUsY29udGV4dF93KSkge1xuICAgICAgICBpZiAoY29udGV4dF93LmNoYXJDb2RlQXQoMCk8MjU2KSB7XG4gICAgICAgICAgZm9yIChpPTAgOyBpPGNvbnRleHRfbnVtQml0cyA7IGkrKykge1xuICAgICAgICAgICAgY29udGV4dF9kYXRhX3ZhbCA9IChjb250ZXh0X2RhdGFfdmFsIDw8IDEpO1xuICAgICAgICAgICAgaWYgKGNvbnRleHRfZGF0YV9wb3NpdGlvbiA9PSBiaXRzUGVyQ2hhci0xKSB7XG4gICAgICAgICAgICAgIGNvbnRleHRfZGF0YV9wb3NpdGlvbiA9IDA7XG4gICAgICAgICAgICAgIGNvbnRleHRfZGF0YS5wdXNoKGdldENoYXJGcm9tSW50KGNvbnRleHRfZGF0YV92YWwpKTtcbiAgICAgICAgICAgICAgY29udGV4dF9kYXRhX3ZhbCA9IDA7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBjb250ZXh0X2RhdGFfcG9zaXRpb24rKztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgdmFsdWUgPSBjb250ZXh0X3cuY2hhckNvZGVBdCgwKTtcbiAgICAgICAgICBmb3IgKGk9MCA7IGk8OCA7IGkrKykge1xuICAgICAgICAgICAgY29udGV4dF9kYXRhX3ZhbCA9IChjb250ZXh0X2RhdGFfdmFsIDw8IDEpIHwgKHZhbHVlJjEpO1xuICAgICAgICAgICAgaWYgKGNvbnRleHRfZGF0YV9wb3NpdGlvbiA9PSBiaXRzUGVyQ2hhci0xKSB7XG4gICAgICAgICAgICAgIGNvbnRleHRfZGF0YV9wb3NpdGlvbiA9IDA7XG4gICAgICAgICAgICAgIGNvbnRleHRfZGF0YS5wdXNoKGdldENoYXJGcm9tSW50KGNvbnRleHRfZGF0YV92YWwpKTtcbiAgICAgICAgICAgICAgY29udGV4dF9kYXRhX3ZhbCA9IDA7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBjb250ZXh0X2RhdGFfcG9zaXRpb24rKztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhbHVlID0gdmFsdWUgPj4gMTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgdmFsdWUgPSAxO1xuICAgICAgICAgIGZvciAoaT0wIDsgaTxjb250ZXh0X251bUJpdHMgOyBpKyspIHtcbiAgICAgICAgICAgIGNvbnRleHRfZGF0YV92YWwgPSAoY29udGV4dF9kYXRhX3ZhbCA8PCAxKSB8IHZhbHVlO1xuICAgICAgICAgICAgaWYgKGNvbnRleHRfZGF0YV9wb3NpdGlvbiA9PSBiaXRzUGVyQ2hhci0xKSB7XG4gICAgICAgICAgICAgIGNvbnRleHRfZGF0YV9wb3NpdGlvbiA9IDA7XG4gICAgICAgICAgICAgIGNvbnRleHRfZGF0YS5wdXNoKGdldENoYXJGcm9tSW50KGNvbnRleHRfZGF0YV92YWwpKTtcbiAgICAgICAgICAgICAgY29udGV4dF9kYXRhX3ZhbCA9IDA7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBjb250ZXh0X2RhdGFfcG9zaXRpb24rKztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhbHVlID0gMDtcbiAgICAgICAgICB9XG4gICAgICAgICAgdmFsdWUgPSBjb250ZXh0X3cuY2hhckNvZGVBdCgwKTtcbiAgICAgICAgICBmb3IgKGk9MCA7IGk8MTYgOyBpKyspIHtcbiAgICAgICAgICAgIGNvbnRleHRfZGF0YV92YWwgPSAoY29udGV4dF9kYXRhX3ZhbCA8PCAxKSB8ICh2YWx1ZSYxKTtcbiAgICAgICAgICAgIGlmIChjb250ZXh0X2RhdGFfcG9zaXRpb24gPT0gYml0c1BlckNoYXItMSkge1xuICAgICAgICAgICAgICBjb250ZXh0X2RhdGFfcG9zaXRpb24gPSAwO1xuICAgICAgICAgICAgICBjb250ZXh0X2RhdGEucHVzaChnZXRDaGFyRnJvbUludChjb250ZXh0X2RhdGFfdmFsKSk7XG4gICAgICAgICAgICAgIGNvbnRleHRfZGF0YV92YWwgPSAwO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgY29udGV4dF9kYXRhX3Bvc2l0aW9uKys7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YWx1ZSA9IHZhbHVlID4+IDE7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGNvbnRleHRfZW5sYXJnZUluLS07XG4gICAgICAgIGlmIChjb250ZXh0X2VubGFyZ2VJbiA9PSAwKSB7XG4gICAgICAgICAgY29udGV4dF9lbmxhcmdlSW4gPSBNYXRoLnBvdygyLCBjb250ZXh0X251bUJpdHMpO1xuICAgICAgICAgIGNvbnRleHRfbnVtQml0cysrO1xuICAgICAgICB9XG4gICAgICAgIGRlbGV0ZSBjb250ZXh0X2RpY3Rpb25hcnlUb0NyZWF0ZVtjb250ZXh0X3ddO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgdmFsdWUgPSBjb250ZXh0X2RpY3Rpb25hcnlbY29udGV4dF93XTtcbiAgICAgICAgZm9yIChpPTAgOyBpPGNvbnRleHRfbnVtQml0cyA7IGkrKykge1xuICAgICAgICAgIGNvbnRleHRfZGF0YV92YWwgPSAoY29udGV4dF9kYXRhX3ZhbCA8PCAxKSB8ICh2YWx1ZSYxKTtcbiAgICAgICAgICBpZiAoY29udGV4dF9kYXRhX3Bvc2l0aW9uID09IGJpdHNQZXJDaGFyLTEpIHtcbiAgICAgICAgICAgIGNvbnRleHRfZGF0YV9wb3NpdGlvbiA9IDA7XG4gICAgICAgICAgICBjb250ZXh0X2RhdGEucHVzaChnZXRDaGFyRnJvbUludChjb250ZXh0X2RhdGFfdmFsKSk7XG4gICAgICAgICAgICBjb250ZXh0X2RhdGFfdmFsID0gMDtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgY29udGV4dF9kYXRhX3Bvc2l0aW9uKys7XG4gICAgICAgICAgfVxuICAgICAgICAgIHZhbHVlID0gdmFsdWUgPj4gMTtcbiAgICAgICAgfVxuXG5cbiAgICAgIH1cbiAgICAgIGNvbnRleHRfZW5sYXJnZUluLS07XG4gICAgICBpZiAoY29udGV4dF9lbmxhcmdlSW4gPT0gMCkge1xuICAgICAgICBjb250ZXh0X2VubGFyZ2VJbiA9IE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xO1xuICAgICAgaWYgKGRhdGEucG9zaXRpb24gPT0gMCkge1xuICAgICAgICBkYXRhLnBvc2l0aW9uID0gcmVzZXRWYWx1ZTtcbiAgICAgICAgZGF0YS52YWwgPSBnZXROZXh0VmFsdWUoZGF0YS5pbmRleCsrKTtcbiAgICAgIH1cbiAgICAgIGJpdHMgfD0gKHJlc2I+MCA/IDEgOiAwKSAqIHBvd2VyO1xuICAgICAgcG93ZXIgPDw9IDE7XG4gICAgfVxuXG4gICAgc3dpdGNoIChuZXh0ID0gYml0cykge1xuICAgICAgY2FzZSAwOlxuICAgICAgICAgIGJpdHMgPSAwO1xuICAgICAgICAgIG1heHBvd2VyID0gTWF0aC5wb3coMiw4KTtcbiAgICAgICAgICBwb3dlcj0xO1xuICAgICAgICAgIHdoaWxlIChwb3dlciE9bWF4cG93ZXIpIHtcbiAgICAgICAgICAgIHJlc2IgPSBkYXRhLnZhbCAmIGRhdGEucG9zaXRpb247XG4gICAgICAgICAgICBkYXRhLnBvc2l0aW9uID4+PSAxO1xuICAgICAgICAgICAgaWYgKGRhdGEucG9zaXRpb24gPT0gMCkge1xuICAgICAgICAgICAgICBkYXRhLnBvc2l0aW9uID0gcmVzZXRWYWx1ZTtcbiAgICAgICAgICAgICAgZGF0YS52YWwgPSBnZXROZXh0VmFsdWUoZGF0YS5pbmRleCsrKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJpdHMgfD0gKHJlc2I+MCA/IDEgOiAwKSAqIHBvd2VyO1xuICAgICAgICAgICAgcG93ZXIgPDw9IDE7XG4gICAgICAgICAgfVxuICAgICAgICBjID0gZihiaXRzKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIDE6XG4gICAgICAgICAgYml0cyA9IDA7XG4gICAgICAgICAgbWF4cG93ZXIgPSBNYXRoLnBvdygyLDE2KTtcbiAgICAgICAgICBwb3dlcj0xO1xuICAgICAgICAgIHdoaWxlIChwb3dlciE9bWF4cG93ZXIpIHtcbiAgICAgICAgICAgIHJlc2IgPSBkYXRhLnZhbCAmIGRhdGEucG9zaXRpb247XG4gICAgICAgICAgICBkYXRhLnBvc2l0aW9uID4+PSAxO1xuICAgICAgICAgICAgaWYgKGRhdGEucG9zaXRpb24gPT0gMCkge1xuICAgICAgICAgICAgICBkYXRhLnBvc2l0aW9uID0gcmVzZXRWYWx1ZTtcbiAgICAgICAgICAgICAgZGF0YS52YWwgPSBnZXROZXh0VmFsdWUoZGF0YS5pbmRleCsrKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJpdHMgfD0gKHJlc2I+MCA/IDEgOiAwKSAqIHBvd2VyO1xuICAgICAgICAgICAgcG93ZXIgPDw9IDE7XG4gICAgICAgICAgfVxuICAgICAgICBjID0gZihiaXRzKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIDI6XG4gICAgICAgIHJldHVybiBcIlwiO1xuICAgIH1cbiAgICBkaWN0aW9uYXJ5WzNdID0gYztcbiAgICB3ID0gYztcbiAgICByZXN1bHQucHVzaChjKTtcbiAgICB3aGlsZSAodHJ1ZSkge1xuICAgICAgaWYgKGRhdGEuaW5kZXggPiBsZW5ndGgpIHtcbiAgICAgICAgcmV0dXJuIFwiXCI7XG4gICAgICB9XG5cbiAgICAgIGJpdHMgPSAwO1xuICAgICAgbWF4cG93ZXIgPSBNYXRoLnBvdygyLG51bUJpdHMpO1xuICAgICAgcG93ZXI9MTtcbiAgICAgIHdoaWxlIChwb3dlciE9bWF4cG93ZXIpIHtcbiAgICAgICAgcmVzYiA9IGRhdGEudmFsICYgZGF0YS5wb3NpdGlvbjtcbiAgICAgICAgZGF0YS5wb3NpdGlvbiA+Pj0gMTtcbiAgICAgICAgaWYgKGRhdGEucG9zaXRpb24gPT0gMCkge1xuICAgICAgICAgIGRhdGEucG9zaXRpb24gPSByZXNldFZhbHVlO1xuICAgICAgICAgIGRhdGEudmFsID0gZ2V0TmV4dFZhbHVlKGRhdGEuaW5kZXgrKyk7XG4gICAgICAgIH1cbiAgICAgICAgYml0cyB8PSAocmVzYj4wID8gMSA6IDApICogcG93ZXI7XG4gICAgICAgIHBvd2VyIDw8PSAxO1xuICAgICAgfVxuXG4gICAgICBzd2l0Y2ggKGMgPSBiaXRzKSB7XG4gICAgICAgIGNhc2UgMDpcbiAgICAgICAgICBiaXRzID0gMDtcbiAgICAgICAgICBtYXhwb3dlciA9IE1hdGgucG93KDIsOCk7XG4gICAgICAgICAgcG93ZXI9MTtcbiAgICAgICAgICB3aGlsZSAocG93ZXIhPW1heHBvd2VyKSB7XG4gICAgICAgICAgICByZXNiID0gZGF0YS52YWwgJiBkYXRhLnBvc2l0aW9uO1xuICAgICAgICAgICAgZGF0YS5wb3NpdGlvbiA+Pj0gMTtcbiAgICAgICAgICAgIGlmIChkYXRhLnBvc2l0aW9uID09IDApIHtcbiAgICAgICAgICAgICAgZGF0YS5wb3NpdGlvbiA9IHJlc2V0VmFsdWU7XG4gICAgICAgICAgICAgIGRhdGEudmFsID0gZ2V0TmV4dFZhbHVlKGRhdGEuaW5kZXgrKyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBiaXRzIHw9IChyZXNiPjAgPyAxIDogMCkgKiBwb3dlcjtcbiAgICAgICAgICAgIHBvd2VyIDw8PSAxO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGRpY3Rpb25hcnlbZGljdFNpemUrK10gPSBmKGJpdHMpO1xuICAgICAgICAgIGMgPSBkaWN0U2l6ZS0xO1xuICAgICAgICAgIGVubGFyZ2VJbi0tO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgYml0cyA9IDA7XG4gICAgICAgICAgbWF4cG93ZXIgPSBNYXRoLnBvdygyLDE2KTtcbiAgICAgICAgICBwb3dlcj0xO1xuICAgICAgICAgIHdoaWxlIChwb3dlciE9bWF4cG93ZXIpIHtcbiAgICAgICAgICAgIHJlc2IgPSBkYXRhLnZhbCAmIGRhdGEucG9zaXRpb247XG4gICAgICAgICAgICBkYXRhLnBvc2l0aW9uID4+PSAxO1xuICAgICAgICAgICAgaWYgKGRhdGEucG9zaXRpb24gPT0gMCkge1xuICAgICAgICAgICAgICBkYXRhLnBvc2l0aW9uID0gcmVzZXRWYWx1ZTtcbiAgICAgICAgICAgICAgZGF0YS52YWwgPSBnZXROZXh0VmFsdWUoZGF0YS5pbmRleCsrKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJpdHMgfD0gKHJlc2I+MCA/IDEgOiAwKSAqIHBvd2VyO1xuICAgICAgICAgICAgcG93ZXIgPDw9IDE7XG4gICAgICAgICAgfVxuICAgICAgICAgIGRpY3Rpb25hcnlbZGljdFNpemUrK10gPSBmKGJpdHMpO1xuICAgICAgICAgIGMgPSBkaWN0U2l6ZS0xO1xuICAgICAgICAgIGVubGFyZ2VJbi0tO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgcmV0dXJuIHJlc3VsdC5qb2luKCcnKTtcbiAgICAgIH1cblxuICAgICAgaWYgKGVubGFyZ2VJbiA9PSAwKSB7XG4gICAgICAgIGVubGFyZ2VJbiA9IE1hdGgucG93KDIsIG51bUJpdHMpO1xuICAgICAgICBudW1CaXRzKys7XG4gICAgICB9XG5cbiAgICAgIGlmIChkaWN0aW9uYXJ5W2NdKSB7XG4gICAgICAgIGVudHJ5ID0gZGljdGlvbmFyeVtjXTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGlmIChjID09PSBkaWN0U2l6ZSkge1xuICAgICAgICAgIGVudHJ5ID0gdyArIHcuY2hhckF0KDApO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXN1bHQucHVzaChlbnRyeSk7XG5cbiAgICAgIC8vIEFkZCB3K2VudHJ5WzBdIHRvIHRoZSBkaWN0aW9uYXJ5LlxuICAgICAgZGljdGlvbmFyeVtkaWN0U2l6ZSsrX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4RSxXQUFXO0FBQUE7QUFBQSxFQUlMLGVBQWU7QUFBQTtBQUNwQixXQUFLLFdBQVcsT0FBTyxPQUFPLElBQUksa0JBQWtCLE1BQU0sS0FBSztBQUFBO0FBQUE7QUFBQSxFQUcxRCxlQUFlO0FBQUE7QUFDcEIsWUFBTSxLQUFLLFNBQVMsS0FBSztBQUFBO0FBQUE7QUFBQTsiLAogICJuYW1lcyI6IFtdCn0K
diff --git a/.obsidian/plugins/obsidian-circuitjs/manifest.json b/.obsidian/plugins/obsidian-circuitjs/manifest.json
new file mode 100644
index 0000000..9a551ea
--- /dev/null
+++ b/.obsidian/plugins/obsidian-circuitjs/manifest.json
@@ -0,0 +1,10 @@
+{
+ "id": "obsidian-circuitjs",
+ "name": "Obsidian CircuitJS",
+ "version": "1.0.0",
+ "minAppVersion": "0.12.0",
+ "description": "Integrating CircuitJS and Obsidian",
+ "author": "Steven Gann",
+ "authorUrl": "https://github.com/StevenGann",
+ "isDesktopOnly": true
+}
diff --git a/.obsidian/plugins/obsidian-circuitjs/styles.css b/.obsidian/plugins/obsidian-circuitjs/styles.css
new file mode 100644
index 0000000..8537307
--- /dev/null
+++ b/.obsidian/plugins/obsidian-circuitjs/styles.css
@@ -0,0 +1 @@
+Not Found
\ No newline at end of file
diff --git a/.obsidian/workspace b/.obsidian/workspace
new file mode 100644
index 0000000..4a96367
--- /dev/null
+++ b/.obsidian/workspace
@@ -0,0 +1,101 @@
+{
+ "main": {
+ "id": "20f00a703135d3b3",
+ "type": "split",
+ "children": [
+ {
+ "id": "f044b8f2aaa9c540",
+ "type": "leaf",
+ "state": {
+ "type": "markdown",
+ "state": {
+ "file": "Areas/electricity/parts/capacitors.md.md",
+ "mode": "source",
+ "source": false
+ }
+ }
+ }
+ ],
+ "direction": "vertical"
+ },
+ "left": {
+ "id": "e6019eea54339191",
+ "type": "split",
+ "children": [
+ {
+ "id": "bcaa06271147c8b2",
+ "type": "tabs",
+ "children": [
+ {
+ "id": "b2484810d49bee98",
+ "type": "leaf",
+ "state": {
+ "type": "file-explorer",
+ "state": {}
+ }
+ },
+ {
+ "id": "1d7a2eec817a817f",
+ "type": "leaf",
+ "state": {
+ "type": "search",
+ "state": {
+ "query": "",
+ "matchingCase": false,
+ "explainSearch": false,
+ "collapseAll": false,
+ "extraContext": false,
+ "sortOrder": "alphabetical"
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "direction": "horizontal",
+ "width": 300
+ },
+ "right": {
+ "id": "5cbdf016cba539bb",
+ "type": "split",
+ "children": [
+ {
+ "id": "1e5dd0e7a1e6a44f",
+ "type": "tabs",
+ "children": [
+ {
+ "id": "f03fddf060b0214b",
+ "type": "leaf",
+ "state": {
+ "type": "backlink",
+ "state": {
+ "file": "Areas/electricity/parts/capacitors.md.md",
+ "collapseAll": false,
+ "extraContext": false,
+ "sortOrder": "alphabetical",
+ "showSearch": false,
+ "searchQuery": "",
+ "backlinkCollapsed": false,
+ "unlinkedCollapsed": true
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "direction": "horizontal",
+ "width": 300,
+ "collapsed": true
+ },
+ "active": "f044b8f2aaa9c540",
+ "lastOpenFiles": [
+ "Areas/electricity/parts/capacitors.md.md",
+ "Areas/electricity/formulas/kirchhoffs-law.md.md",
+ "Areas/electricity/ac.md.md",
+ "Areas/electricity/glossary.md",
+ "a.md",
+ "Areas/electricity/formulas.md",
+ "Areas/electricity/parts/resistors.md.md",
+ "Areas/electricity/basics.md"
+ ]
+}
\ No newline at end of file
diff --git a/Areas/electricity/ac.md.md b/Areas/electricity/ac.md.md
new file mode 100644
index 0000000..e1b9d85
--- /dev/null
+++ b/Areas/electricity/ac.md.md
@@ -0,0 +1,31 @@
+# AC (Alternating Current)
+
+
+![](./assets/wave.gif)
+
+
+A few important characteristics of an AC Signal:
+
+## Time Period
+How much time passes during one cycle of the signal (until it reaches the same point it started twice)
+
+## Frequency
+How many cycles the signal completes in a specified time frame.
+
+## Amplitute
+The maximum voltage of the signal compared to 0
+
+## Peak-Peak Voltage
+The difference between the highest and lowest peak.
+
+## Root Mean Square Values
+This helps calculating the current an equivalent DC Signal would need to provide the same amount of power.
+
+![](./assets/rms.gif)
+
+$$
+\begin{flalign}
+V_{RMS} = 0.7 * V_{PEAK} &&\\
+V_{PEAK} = 1.4 * V_{RMS}
+\end{flalign}
+$$
diff --git a/Areas/electricity/assets/Parallel_plate_capacitor.svg b/Areas/electricity/assets/Parallel_plate_capacitor.svg
new file mode 100644
index 0000000..2a1de03
--- /dev/null
+++ b/Areas/electricity/assets/Parallel_plate_capacitor.svg
@@ -0,0 +1,295 @@
+
+
+
diff --git a/Areas/electricity/assets/ceramic-capacitor.webp b/Areas/electricity/assets/ceramic-capacitor.webp
new file mode 100644
index 0000000..2003e72
Binary files /dev/null and b/Areas/electricity/assets/ceramic-capacitor.webp differ
diff --git a/Areas/electricity/assets/kirchhoffs-law-1.svg b/Areas/electricity/assets/kirchhoffs-law-1.svg
new file mode 100644
index 0000000..dcadcdc
--- /dev/null
+++ b/Areas/electricity/assets/kirchhoffs-law-1.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Areas/electricity/assets/rms.gif b/Areas/electricity/assets/rms.gif
new file mode 100644
index 0000000..545aad6
Binary files /dev/null and b/Areas/electricity/assets/rms.gif differ
diff --git a/Areas/electricity/assets/tantalum-capacitor.jpg b/Areas/electricity/assets/tantalum-capacitor.jpg
new file mode 100644
index 0000000..bf0cb2b
Binary files /dev/null and b/Areas/electricity/assets/tantalum-capacitor.jpg differ
diff --git a/Areas/electricity/assets/wave.gif b/Areas/electricity/assets/wave.gif
new file mode 100644
index 0000000..221014f
Binary files /dev/null and b/Areas/electricity/assets/wave.gif differ
diff --git a/Areas/electricity/formulas.md b/Areas/electricity/formulas.md
index 0b79cb6..e3dfa6d 100644
--- a/Areas/electricity/formulas.md
+++ b/Areas/electricity/formulas.md
@@ -32,27 +32,26 @@ $$
$$
\begin{flalign}
-&\frac{1}{R} = \frac{1}{R1} + \frac{1}{R2} + \frac{1}{R3} ... &\\
-
+\frac{1}{R} = \frac{1}{R1} + \frac{1}{R2} + \frac{1}{R3} ... &&\\
\\
-&\textit{For two resistors in parallel:} &\\
+\textit{For two resistors in parallel:} &&\\
\\
-&R = \frac{R1 * R2}{R1 + R2}
+R = \frac{R1 * R2}{R1 + R2} &&\\
\end{flalign}
$$
-*Tip:*
-If two resistors of the same value are in parallel the total resistance is half the value of a single resistor
+***Tip:***
+If resistors of the same value are in parallel the total resistance is a single resistor divided by the amount if resistors.
# Kirchhoff's Law
-### Conservation of Charge
+## Conservation of Charge (First Law)
-All current entering a node in a circuit must also leave that node
+All current entering a node must also leave that node
$$
\begin{flalign}
-& \sum{I_{IN}} = \sum{I_{OUT}} &
+\sum{I_{IN}} = \sum{I_{OUT}}&&
\end{flalign}
$$
@@ -63,54 +62,15 @@ $$
For this circuit kirchhoffs law states that:
$$
\begin{flalign}
-&i1 = i2 + i3 + i4 &
+i1 = i2 + i3 + i4 &&
\end{flalign}
$$
-### Conservation of Energy
+## Conservation of Energy (Second Law)
+All the potential differences around the loop must sum to zero.
$$
\begin{flalign}
-& \sum{V} = 0 &
+\sum{V} = 0 &&
\end{flalign}
$$
-**Example:**
-
-![](./assets/kirchhoffs-law-02.svg)
-
-For this circuit this means.
-
-$$
-\begin{flalign}
-V_{R1} = -(I*R1) && \text{Voltage Drop across R}_{1} \\
-V_{R2} = -(I*R2) && \text{Voltage Drop across R}_{2}\\
-\\
-
-V_{S} - IR_{1} - IR_{2} &= 0 & | + IR_{1} + IR_{2}\\
-V_{S} &= IR_{1} + IR_{2} \\
-\\
-V_{S} &= I(R_{1}+R_{2}) \\
-V_{S} &= I*R_{t} \\
-
-\end{flalign}
-$$
-
-We can change that formula around to find out the current of the entire circuit, aswell as current through single resistors
-
-$$
-\begin{flalign}
-& V_{S} = I*R_{t} & | \div R_{t} \\
-\\
-& I = \frac{V_{S}}{R_{t}} = \frac{V_{S}}{R_{1}+R_{2}} \\
-\\
-& VR_{1} = V_{S}(\frac{R1}{R1+R2}) \\
-& VR_{2} = V_{S}(\frac{R2}{R1+R2}) \\
-\\
-& VR_{1} = 5(\frac{500}{500+1500}) \\
-& VR_{1} = 1.25v
-\\
-& VR_{2} = 5(\frac{1500}{500+1500}) \\
-& VR_{2} = 3.75v
-
-\end{flalign}
-$$
\ No newline at end of file
diff --git a/Areas/electricity/formulas/kirchhoffs-law.md.md b/Areas/electricity/formulas/kirchhoffs-law.md.md
new file mode 100644
index 0000000..087601e
--- /dev/null
+++ b/Areas/electricity/formulas/kirchhoffs-law.md.md
@@ -0,0 +1,135 @@
+# Kirchhoffs Law
+
+### Example 1
+**Example:**
+
+![](../assets/kirchhoffs-law-02.svg)
+
+For this circuit this means.
+
+$$
+\begin{flalign}
+V_{R1} = -(I*R1) && \text{Voltage Drop across R}_{1} \\
+V_{R2} = -(I*R2) && \text{Voltage Drop across R}_{2}\\
+\\
+
+V_{S} - IR_{1} - IR_{2} &= 0 & | + IR_{1} + IR_{2}\\
+V_{S} &= IR_{1} + IR_{2} \\
+\\
+V_{S} &= I(R_{1}+R_{2}) \\
+V_{S} &= I*R_{t} \\
+
+\end{flalign}
+$$
+
+We can change that formula around to find out the current of the entire circuit, aswell as current through single resistors
+
+$$
+\begin{flalign}
+I &= I*R_{t} = \frac{V_{S}}{R_{t}} = \frac{V_{S}}{R_{1}+R_{2}}\\
+\\
+VR_{1} &= V_{S}(\frac{R1}{R1+R2})\\
+VR_{2} &= V_{S}(\frac{R2}{R1+R2})\\
+\\
+VR_{1} &= 5(\frac{500}{500+1500})\\
+VR_{1} &= 1.25v&\\
+\\
+VR_{2} &= 5(\frac{1500}{500+1500})\\
+VR_{2} &= 3.75v
+
+\end{flalign}
+$$
+
+### Example 2
+
+
+```circuitjs
+$ 1 0.000005 10.20027730826997 50 5 43 5e-11
+v 192 288 192 112 0 0 40 10 0 0 1
+x 125 208 167 211 4 24 10V
+r 192 112 336 112 0 10
+r 336 112 480 112 0 20
+w 480 112 480 288 0
+r 336 112 336 288 0 50
+w 480 288 336 288 0
+w 336 288 192 288 0
+x 304 204 319 207 4 12 R3
+x 256 140 271 143 4 12 R1
+x 400 138 415 141 4 12 R2
+x 332 104 340 107 4 12 A
+x 332 304 340 307 4 12 B
+x 205 102 215 105 4 12 I1
+x 467 105 477 108 4 12 I2
+x 346 276 356 279 4 12 I3
+```
+
+In this circuit we have three major loops we can apply [[formulas#Conservation of Energy Second Law|Kirchhoffs Second Law]] to, the one on the left, the one on the right and the most outer one. We can also use [[formulas#Conservation of Charge First Law | Kirchhoffs First Law]] for the node title **A**.
+
+$$
+\begin{flalign}
+&\textit{Node A:} \\\
+& I_{1} = I_{2}+I_{3} \\
+\\
+&\textit{Left Loop:} \circlearrowright &\\
+& 10_{v} - I_{1}*R_{1} - I_{3}*R_{3} = 0& \\
+\\
+&\textit{Right Loop} \circlearrowleft &\\
+&I_{2}*R_{2} - I_{3}*R_{3} = 0; &\\
+\\
+&\textit{Outer Loop:} \circlearrowright &\\
+& 10_{v} - I_{1}*R_{1} - I_{2}*R_{2} = 0& \\
+\\
+\end{flalign}
+$$
+
+Now if we would like to find out I2 for example we can use the Right Loop Formula to do so:
+
+$$
+\begin{flalign}
+& \textit{Right Loop} \circlearrowleft &\\
+& I_{2}*R_{2} - I_{3}*R_{3} = 0 &&| + I_{3}*R_{3}\\\
+\\
+& I_{2}*R_{2} = I_{3}*R_{3} &&| \div R_{2} \\
+\\
+& I_{2} = \frac{I_{3}*R_{3}}{R_{2}} &&| \text{ Input Numbers } \\
+\\
+& I_{2} = \frac{I_{3}*5}{2} &&| \text{ Simplify} \\
+\\
+& I_{2} = \frac{5I_{3}}{2} &&| \text{ Simplify} \\
+\\
+&\textit{LeftLoop:} \\
+& 10 - I_{1}*R_{1} - I_{3}*R_{3} = 0&&| \text{ Replace I1 with node a} \\
+& 10 - (I_{2}+I_{3})*R_{1} - I_{3}*R_{3} = 0 &&| \text{ Replace I2 with previous} \\
+\\
+& 10 - (\frac{5I_{3}}{2}+I_{3})*R_{1} - I_{2}*R_{2} = 0
+\end{flalign}
+$$
+
+On the last formula we only have one unknown variable, which is $I_{3}$ so lets solve for that.
+
+$$
+\begin{flalign}
+& 10 - (\frac{5I_{3}}{2}+I_{3})R_{1} - I_{3}R_{3} = 0 &&| \text{ Replace Variables}\\\
+\\
+& 10 - (2.5I_{3}+I_{3})10 - 50I_{3} = 0 && \\
+\\
+& 10 - 35I_{3} - 50I_{3} = 0 &&\\
+& 10 - 85I_{3} = 0 && | +85I_{3}\\
+& 10 = 85I_{3} && | \div 85 \\
+& 0.117647059 \approx I_{3} \\
+& 117.64mA = I_{3}
+\end{flalign}
+$$
+
+Now lets found out $I_{2}$ aswell
+
+$$
+\begin{flalign}
+I_{2} = \frac{I_{3}*5}{2} &&\\
+I_{2} = \frac{0.11764 * 5}{2} &&\\
+\\
+I_{2} \approx 0.2941 && \\
+\\
+I_2 \approx 294mA && \\
+\end{flalign}
+$$
\ No newline at end of file
diff --git a/Areas/electricity/glossary.md b/Areas/electricity/glossary.md
index fa59fbd..82fdc86 100644
--- a/Areas/electricity/glossary.md
+++ b/Areas/electricity/glossary.md
@@ -9,6 +9,31 @@ Current
## Ohms
Resistance
+## Watt (Power)
+
+$Power = V * I = \frac{V^{2}}{R} = I^{2}R$
+
+Joules per Second
+
+Term | Symbol | Weight
+-----------|----|------
+ Nanowatt | nW | 10-9
+ Microwatt | $\micro$W | $10^{-6}$
+ Milliwatt | mW | $10^{-3}$
+ Watt | W | $10^{0}$
+ Kilowatt | kW | $10^{3}$
+ Megawatt | MW | $10^{6}$
+ Gigawatt | GW | $10^{9}$
+
+**Examples:**
+
+Device | Power
+-------|----------
+Arduino| 167mW
+Laptop | 1.5W
+House | 2.2kW
+
+
## Ohms Law
$$
V = \frac{I}{R}
@@ -25,6 +50,16 @@ Means if a component is symmetric or not
Polarised means that a component is not symmetric
## Voltage Divider
+
+## Farad
+Term | Symbol | Weight
+-----------|----|------
+ Picofarad | pW | $10^{-12}$
+ Nanofarad | nF | $10^{-9}$
+ Microfarad | $\micro$F | $10^{-6}$
+ Milifarad | mF | $10^{-3}$
+ Kilofarad | kF | $10^{3}$
+
## LED
Anode - The shorter Leg
diff --git a/Areas/electricity/parts/capacitors.md.md b/Areas/electricity/parts/capacitors.md.md
new file mode 100644
index 0000000..e543369
--- /dev/null
+++ b/Areas/electricity/parts/capacitors.md.md
@@ -0,0 +1,65 @@
+# Capacitors
+
+Capacity is measured in [[glossary#Farad|Farads]].
+
+Capacity is calculated as follows:
+
+$$
+\begin{flalign}
+& C = \epsilon r \frac{A}{4\pi d} &&\\\
+\\
+& \epsilon r = \text{Dielectrics relative permittivity} &&\\
+& A = \text{Amount of Area the plates overlap} &&\\
+& d = \text{Distance between plates} &&\\
+\end{flalign}
+$$
+
+
+![](../assets/Parallel_plate_capacitor.svg)
+
+### Important Metrics
+
+**Size:**
+Larger Capacity $\approx$ Larger Size
+
+**Maximum Voltage**
+Each capacitor has a maximum voltage that can be dropped across it.
+
+**Leakage Current**
+Capacitors are not perfect, and leak some current across the terminals.
+
+**Equivalent series Resistance (ESR)**
+The terminals are not 100% conductive, so the will have some very small resistance, (usually less than $0.01\ohm$)
+
+**Tolerance**
+The capacity is not always exact, the tolerance describes how much it could vary, usually about $\mp 1\%$ to $\mp 20\%$
+
+## Ceramic Capacitors
+- least expansive
+- relative small usually $< 10\micro F$
+- low current leakage and ESR
+- best for high frequency coupling
+
+![](../assets/ceramic-capacitor.webp)
+
+
+## Aluminium and Tantalum Electrolytic
+- Usually polarized
+- Capacity usuially $1\micro F - 1mF$
+- Good for high voltage
+
+![](../assets/tantalum-capacitor.jpg)
+
+## Super Capacitors
+
+- Usually can handle only low voltage
+- Capacity in the range of farads
+
+## Film Capacitor
+- usually low ESR
+
+## Mica Capacitor
+- Can work in hot environments > $200\deg$
+- Low ESR
+- High Precision
+- High Cost
\ No newline at end of file
diff --git a/Areas/electricity/led.md.md b/Areas/electricity/parts/led.md.md
similarity index 97%
rename from Areas/electricity/led.md.md
rename to Areas/electricity/parts/led.md.md
index 16a57be..90bb30b 100644
--- a/Areas/electricity/led.md.md
+++ b/Areas/electricity/parts/led.md.md
@@ -30,7 +30,7 @@ Our power source must have more voltage than the voltage drop, otherwise we cant
First we need to find the datasheet of the specific component, it can be easily found by googling it
-![TLUR DataSheet](./datasheets/tlur6400.pdf)
+![TLUR DataSheet](tlur6400.pdf)
Now lets put that LED into a test circuit and calculate the resistance for it:
diff --git a/Areas/electricity/parts/resistors.md.md b/Areas/electricity/parts/resistors.md.md
new file mode 100644
index 0000000..8103c1d
--- /dev/null
+++ b/Areas/electricity/parts/resistors.md.md
@@ -0,0 +1,3 @@
+# Resistors
+
+Resistors transform voltage into heat.
\ No newline at end of file
diff --git a/Areas/electricity/voltage-dividers.md b/Areas/electricity/parts/voltage-dividers.md
similarity index 100%
rename from Areas/electricity/voltage-dividers.md
rename to Areas/electricity/parts/voltage-dividers.md
diff --git a/a.md b/a.md
new file mode 100644
index 0000000..e69de29